jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1433168 - in /jmeter/trunk: src/functions/org/apache/jmeter/functions/Uuid.java xdocs/changes.xml xdocs/usermanual/functions.xml
Date Mon, 14 Jan 2013 22:10:41 GMT
Author: pmouawad
Date: Mon Jan 14 22:10:40 2013
New Revision: 1433168

URL: http://svn.apache.org/viewvc?rev=1433168&view=rev
Log:
Bug 54418 - UUID Function
Bugzilla Id: 54418

Added:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/Uuid.java   (with props)
Modified:
    jmeter/trunk/xdocs/changes.xml
    jmeter/trunk/xdocs/usermanual/functions.xml

Added: jmeter/trunk/src/functions/org/apache/jmeter/functions/Uuid.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/Uuid.java?rev=1433168&view=auto
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/Uuid.java (added)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/Uuid.java Mon Jan 14 22:10:40 2013
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.functions;
+
+import org.apache.jmeter.engine.util.CompoundVariable;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.samplers.Sampler;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Function to create a UUID
+ *
+ * Parameters:
+ * - None
+ *
+ * Returns:
+ * - A pseudo random UUID 4
+ * @since 2.9
+ */
+public class Uuid extends AbstractFunction {
+
+	private static final List<String> desc = new LinkedList<String>();
+
+	private static final String KEY = "__UUID"; //$NON-NLS-1$
+
+	public Uuid() {
+	}
+
+	@Override
+	public String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException
{
+		return UUID.randomUUID().toString();
+	}
+
+	@Override
+	public void setParameters(Collection<CompoundVariable> parameters) throws InvalidVariableException
{
+		checkParameterCount(parameters, 0, 0);
+	}
+
+	@Override
+	public String getReferenceKey() {
+		return KEY;
+	}
+
+	@Override
+	public List<String> getArgumentDesc() {
+		return desc;
+	}
+
+}

Propchange: jmeter/trunk/src/functions/org/apache/jmeter/functions/Uuid.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1433168&r1=1433167&r2=1433168&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Mon Jan 14 22:10:40 2013
@@ -241,6 +241,7 @@ to the elements View Results Tree, Asser
 <h3>Functions</h3>
 <ul>
 <li><bugzilla>54189</bugzilla> - Add a function to quote ORO regexp meta
characters</li>
+<li><bugzilla>54418</bugzilla> - UUID Function</li>
 </ul>
 
 <h3>I18N</h3>

Modified: jmeter/trunk/xdocs/usermanual/functions.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/functions.xml?rev=1433168&r1=1433167&r2=1433168&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/functions.xml (original)
+++ jmeter/trunk/xdocs/usermanual/functions.xml Mon Jan 14 22:10:40 2013
@@ -109,6 +109,7 @@ Alternatively, just use / instead for th
         <tr><td>Calculation</td><td> <a href="#__longSum">longSum</a></td><td>add
long numbers</td><td>2.3.2</td></tr>
         <tr><td>Calculation</td><td> <a href="#__Random">Random</a></td><td>generate
a random number</td><td>1.9</td></tr>
         <tr><td>Calculation</td><td> <a href="#__RandomString">RandomString</a></td><td>generate
a random string</td><td>2.6</td></tr>
+        <tr><td>Calculation</td><td> <a href="#__UUID">UUID</a></td><td>generate
a random type 4 UUID</td><td>2.9</td></tr>
         <tr><td>Scripting</td><td> <a href="#__BeanShell">BeanShell</a></td><td>run
a BeanShell script</td><td>1.X</td></tr>
         <tr><td>Scripting</td><td> <a href="#__javaScript">javaScript</a></td><td>process
JavaScript (Mozilla Rhino)</td><td>1.9</td></tr>
         <tr><td>Scripting</td><td> <a href="#__jexl">jexl,
jexl2</a></td><td>evaluate a Commons Jexl expression</td><td>jexl(2.2),
jexl2(2.6)</td></tr>
@@ -578,6 +579,14 @@ the comma after 7 is escaped.</note>
 </properties>
 </component>
 
+<component index="&sect-num;.5.8" name="__UUID">
+<description>
+<p>The UUID function returns a pseudo random type 4 Universally Unique IDentifier (UUID).</p>
+</description>
+<properties>
+</properties>
+</component>
+
 <component index="&sect-num;.5.8" name="__CSVRead">
 <description><p>The CSVRead function returns a string from a CSV file (c.f. <a
href="#_StringFromFile">StringFromFile</a>)</p>
 	<p>NOTE: versions up to 1.9.1 only supported a single file. 



Mime
View raw message