Index: src/functions/org/apache/jmeter/functions/Uuid.java =================================================================== --- src/functions/org/apache/jmeter/functions/Uuid.java (revision 0) +++ src/functions/org/apache/jmeter/functions/Uuid.java (working copy) @@ -0,0 +1,68 @@ +/* + * 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 + */ +public class Uuid extends AbstractFunction { + + private static final List desc = new LinkedList(); + + 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 parameters) throws InvalidVariableException { + checkParameterCount(parameters, 0, 0); + } + + @Override + public String getReferenceKey() { + return KEY; + } + + @Override + public List getArgumentDesc() { + return desc; + } + +} Index: xdocs/usermanual/functions.xml =================================================================== --- xdocs/usermanual/functions.xml (revision 1433090) +++ xdocs/usermanual/functions.xml (working copy) @@ -109,6 +109,7 @@ Calculation longSumadd long numbers2.3.2 Calculation Randomgenerate a random number1.9 Calculation RandomStringgenerate a random string2.6 + Calculation UUIDgenerate a random type 4 UUID2.9 Scripting BeanShellrun a BeanShell script1.X Scripting javaScriptprocess JavaScript (Mozilla Rhino)1.9 Scripting jexl, jexl2evaluate a Commons Jexl expressionjexl(2.2), jexl2(2.6) @@ -578,6 +579,13 @@ + +

The UUID function returns a pseudo random type 4 Universally Unique IDentifier (UUID). + + + + +

The CSVRead function returns a string from a CSV file (c.f. StringFromFile)

NOTE: versions up to 1.9.1 only supported a single file.