Class JMeterVariables
-
- All Implemented Interfaces:
public class JMeterVariables
Class which defines JMeter variables. These are similar to properties, but they are local to a single thread.
-
-
Field Summary
Fields Modifier and Type Field Description public int
iteration
-
Constructor Summary
Constructors Constructor Description JMeterVariables()
Constructor, that preloads the variables from the JMeter properties
-
Method Summary
Modifier and Type Method Description int
getIteration()
String
getThreadName()
void
incIteration()
Increase the current number of iterations Object
remove(String key)
Remove a variable. void
put(String key, String value)
Creates or updates a variable with a String value. void
putObject(String key, Object value)
Creates or updates a variable with a value that does not have to be a String. void
putAll(Map<String, out Object> vars)
Updates the variables with all entries found in the Map vars
void
putAll(JMeterVariables vars)
Updates the variables with all entries found in the variables in vars
String
get(String key)
Gets the value of a variable, converted to a String. Object
getObject(String key)
Gets the value of a variable (not converted to String). Iterator<Map.Entry<String, Object>>
getIterator()
Gets a read-only Iterator over the variables. Set<Map.Entry<String, Object>>
entrySet()
boolean
isSameUserOnNextIteration()
-
-
Method Detail
-
getIteration
int getIteration()
- Returns:
the current number of iterations
-
getThreadName
String getThreadName()
- Returns:
the name of the currently running thread
-
incIteration
void incIteration()
Increase the current number of iterations
-
remove
Object remove(String key)
Remove a variable.
- Parameters:
key
- the variable name to remove- Returns:
the variable value, or
null
if there was no such variable
-
put
void put(String key, String value)
Creates or updates a variable with a String value.
- Parameters:
key
- the variable namevalue
- the variable value
-
putObject
void putObject(String key, Object value)
Creates or updates a variable with a value that does not have to be a String.
- Parameters:
key
- the variable namevalue
- the variable value
-
putAll
void putAll(Map<String, out Object> vars)
Updates the variables with all entries found in the Map
vars
- Parameters:
vars
- map with the entries to be updated
-
putAll
void putAll(JMeterVariables vars)
Updates the variables with all entries found in the variables in
vars
- Parameters:
vars
- JMeterVariables with the entries to be updated
-
get
String get(String key)
Gets the value of a variable, converted to a String.
- Parameters:
key
- the name of the variable- Returns:
the value of the variable or a toString called on it if it's non String, or
null
if it does not exist
-
getObject
Object getObject(String key)
Gets the value of a variable (not converted to String).
- Parameters:
key
- the name of the variable- Returns:
the value of the variable, or
null
if it does not exist
-
getIterator
Iterator<Map.Entry<String, Object>> getIterator()
Gets a read-only Iterator over the variables.
- Returns:
the iterator
-
entrySet
Set<Map.Entry<String, Object>> entrySet()
- Returns:
an unmodifiable view of the entries contained in JMeterVariables
-
isSameUserOnNextIteration
boolean isSameUserOnNextIteration()
- Returns:
boolean true if user is the same on next iteration of Thread loop, false otherwise
-
-
-
-