Interface TestElement
-
- All Implemented Interfaces:
-
kotlin.Cloneable
public interface TestElement implements Cloneable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
TestElement.Companion
-
Method Summary
Modifier and Type Method Description abstract Unit
addTestElement(TestElement child)
abstract Unit
clearTestElementChildren()
This method should clear any test element properties that are merged by . abstract Unit
setProperty(String key, String value)
abstract Unit
setProperty(String key, String value, String dflt)
abstract Unit
setProperty(String key, Boolean value)
abstract Unit
setProperty(String key, Boolean value, Boolean dflt)
abstract Unit
setProperty(String key, Integer value)
abstract Unit
setProperty(String key, Integer value, Integer dflt)
abstract Unit
setProperty(String name, Long value)
abstract Unit
setProperty(String name, Long value, Long dflt)
abstract Unit
setProperty(JMeterProperty property)
Sets and overwrites a property in the TestElement. abstract Boolean
isTemporary(JMeterProperty property)
Test whether a given property is only a temporary resident of the TestElement abstract Unit
setTemporary(JMeterProperty property)
Indicate that the given property should be only a temporary property in the TestElement. abstract Boolean
getPropertyAsBoolean(String key)
Return a property as a boolean value. abstract Boolean
getPropertyAsBoolean(String key, Boolean defaultValue)
Return a property as a boolean value or a default value if no property could be found. abstract Long
getPropertyAsLong(String key)
Return a property as a long value. abstract Long
getPropertyAsLong(String key, Long defaultValue)
Return a property as a long value or a default value if no property could be found. abstract Integer
getPropertyAsInt(String key)
Return a property as an int value. abstract Integer
getPropertyAsInt(String key, Integer defaultValue)
Return a property as an int value or a default value if no property could be found. abstract Float
getPropertyAsFloat(String key)
Return a property as a float value. abstract Double
getPropertyAsDouble(String key)
Return a property as a double value. abstract Unit
recoverRunningVersion()
Tells the test element to return to the state it was in when setRunningVersion(true) was called. abstract Unit
clear()
Clear the TestElement of all data. abstract String
getPropertyAsString(String key)
Return a property as a string value. abstract String
getPropertyAsString(String key, String defaultValue)
Return a property as an string value or a default value if no property could be found. abstract JMeterProperty
getProperty(String propName)
Given the name of the property, returns the appropriate property from JMeter. JMeterProperty
getPropertyOrNull(String propName)
Retrieve property or return null
if the property is unset.JMeterProperty
getPropertyOrNull(PropertyDescriptor<?, ?> property)
Retrieve property or return null
if the property is unset.String
get(StringPropertyDescriptor<?> property)
Retrieve property as string, or default value, or empty string if the property is unset. Boolean
get(BooleanPropertyDescriptor<?> property)
Retrieve boolean property value, or default value, or false
if the property is unset.Integer
get(IntegerPropertyDescriptor<?> property)
Retrieve integer property value. Long
get(LongPropertyDescriptor<?> property)
Retrieve long property value, or default value, or 0
if the property is unset.Float
get(FloatPropertyDescriptor<?> property)
Retrieve float property value, or default value, or 0.0f
if the property is unset.Double
get(DoublePropertyDescriptor<?> property)
Retrieve double property value, or default value, or 0.0
if the property is unset.<ValueClass extends Any> Class<out ValueClass>
get(ClassPropertyDescriptor<?, ValueClass> property)
Retrieve Class property value, or default value, or throw NoSuchElementException in case the property is unset. <TestElementClass extends TestElement> TestElementClass
get(TestElementPropertyDescriptor<?, TestElementClass> property)
Retrieve TestElement property value, or throw NoSuchElementException in case the property is unset. CollectionProperty
get(CollectionPropertyDescriptor<?> property)
Retrieve CollectionProperty property value, or throw NoSuchElementException in case the property is unset. String
getString(PropertyDescriptor<?, ?> property)
Read property value as string, or default value, or empty string if the property is unset. Unit
set(PropertyDescriptor<?, ?> property, String value)
Set property as string, or remove it if the given value is null
.Unit
set(BooleanPropertyDescriptor<?> property, Boolean value)
Set property as boolean, or remove it if the given value is null. Unit
set(IntegerPropertyDescriptor<?> property, Integer value)
Set property as integer. Unit
set(LongPropertyDescriptor<?> property, Long value)
Set property as long. Unit
set(FloatPropertyDescriptor<?> property, Float value)
Set property as float. Unit
set(DoublePropertyDescriptor<?> property, Double value)
Set property as double. <ValueClass extends Any> Unit
set(ClassPropertyDescriptor<?, ValueClass> property, Class<out ValueClass> value)
Set property as Class, or remove it if the given value is null
.<TestElementClass extends TestElement> Unit
set(TestElementPropertyDescriptor<?, TestElementClass> property, TestElementClass value)
Set property as TestElement, or remove it if the given TestElement is null
.Unit
set(CollectionPropertyDescriptor<?> property, Collection<?> value)
Set property as Collection, or remove it if the given Collection is null
.<ValueClass extends Any> Class<out ValueClass>
getOrNull(ClassPropertyDescriptor<?, ValueClass> property)
Retrieve Class property value, or default value, or null
in case the property is unset.<TestElementClass extends TestElement> TestElementClass
getOrNull(TestElementPropertyDescriptor<?, TestElementClass> property)
Retrieve TestElement property value, or return null in case the property is unset. CollectionProperty
getOrNull(CollectionPropertyDescriptor<?> property)
Retrieve CollectionProperty property value, or return null
in case the property is unset.<TestElementClass extends TestElement> TestElementClass
getOrCreate(TestElementPropertyDescriptor<?, TestElementClass> property, Function0<TestElementClass> ifMissing)
Retrieve TestElement property value, or create one and set it the property is unset. CollectionProperty
getOrCreate(CollectionPropertyDescriptor<?> property, Function0<Collection<JMeterProperty>> ifMissing)
Retrieve CollectionProperty property value, or create one and set it the property is unset. abstract PropertyIterator
propertyIterator()
Get a Property Iterator for the TestElements properties. abstract Unit
removeProperty(String key)
Remove property stored under the key
Unit
removeProperty(PropertyDescriptor<?, ?> property)
Remove property stored under the key
abstract Object
clone()
abstract Unit
traverse(TestElementTraverser traverser)
Convenient way to traverse a test element. abstract Boolean
canRemove()
Called by Remove to determine if it is safe to remove the element. Unit
removed()
Called when the test element is removed from the test plan. TestElementSchema
getSchema()
PropertiesAccessor<TestElement, TestElementSchema>
getProps()
abstract Boolean
isEnabled()
Configures if the current test element should be enabled or not. abstract Unit
setEnabled(Boolean isEnabled)
Configures if the current test element should be enabled or not. abstract Boolean
isRunningVersion()
Make the test element the running version, or make it no longer the running version. abstract Unit
setRunningVersion(Boolean isRunningVersion)
Make the test element the running version, or make it no longer the running version. abstract JMeterContext
getThreadContext()
Associates a thread context with this element. abstract Unit
setThreadContext(JMeterContext threadContext)
Associates a thread context with this element. abstract String
getThreadName()
Associates a thread name with this element. abstract Unit
setThreadName(@Deprecated(message = "Use JMeterContextService.getContext().thread.threadName instead", replaceWith = @ReplaceWith(imports = {"org.apache.jmeter.threads.JMeterContextService"}, expression = "JMeterContextService.getContext().thread.threadName")) String threadName)
Associates a thread name with this element. abstract String
getName()
Associates a name with this element. abstract Unit
setName(String name)
Associates a name with this element. abstract String
getComment()
Associates a comment with this element. abstract Unit
setComment(String comment)
Associates a comment with this element. -
-
Method Detail
-
addTestElement
abstract Unit addTestElement(TestElement child)
-
clearTestElementChildren
abstract Unit clearTestElementChildren()
This method should clear any test element properties that are merged by .addTestElement.
-
setProperty
abstract Unit setProperty(String key, String value)
-
setProperty
abstract Unit setProperty(String key, String value, String dflt)
-
setProperty
abstract Unit setProperty(String key, Boolean value)
-
setProperty
abstract Unit setProperty(String key, Boolean value, Boolean dflt)
-
setProperty
abstract Unit setProperty(String key, Integer value)
-
setProperty
abstract Unit setProperty(String key, Integer value, Integer dflt)
-
setProperty
abstract Unit setProperty(String name, Long value)
-
setProperty
abstract Unit setProperty(String name, Long value, Long dflt)
-
setProperty
abstract Unit setProperty(JMeterProperty property)
Sets and overwrites a property in the TestElement. This call will be ignored if the TestElement is currently a "running version".
- Parameters:
property
- the property to be set
-
isTemporary
abstract Boolean isTemporary(JMeterProperty property)
Test whether a given property is only a temporary resident of the TestElement
- Parameters:
property
- the property to be tested- Returns:
true
if property is temporary
-
setTemporary
abstract Unit setTemporary(JMeterProperty property)
Indicate that the given property should be only a temporary property in the TestElement.
- Parameters:
property
- property to set as temporary one
-
getPropertyAsBoolean
abstract Boolean getPropertyAsBoolean(String key)
Return a property as a boolean value.
- Parameters:
key
- the name of the property to get- Returns:
the value of the property
-
getPropertyAsBoolean
abstract Boolean getPropertyAsBoolean(String key, Boolean defaultValue)
Return a property as a boolean value or a default value if no property could be found.
- Parameters:
key
- the name of the property to getdefaultValue
- the default value to use- Returns:
the value of the property, or
defaultValue
if no property could be found
-
getPropertyAsLong
abstract Long getPropertyAsLong(String key)
Return a property as a long value.
- Parameters:
key
- the name of the property to get- Returns:
the value of the property
-
getPropertyAsLong
abstract Long getPropertyAsLong(String key, Long defaultValue)
Return a property as a long value or a default value if no property could be found.
- Parameters:
key
- the name of the property to getdefaultValue
- the default value to use- Returns:
the value of the property, or
defaultValue
if no property could be found
-
getPropertyAsInt
abstract Integer getPropertyAsInt(String key)
Return a property as an int value.
- Parameters:
key
- the name of the property to get- Returns:
the value of the property
-
getPropertyAsInt
abstract Integer getPropertyAsInt(String key, Integer defaultValue)
Return a property as an int value or a default value if no property could be found.
- Parameters:
key
- the name of the property to getdefaultValue
- the default value to use- Returns:
the value of the property, or
defaultValue
if no property could be found
-
getPropertyAsFloat
abstract Float getPropertyAsFloat(String key)
Return a property as a float value.
- Parameters:
key
- the name of the property to get- Returns:
the value of the property
-
getPropertyAsDouble
abstract Double getPropertyAsDouble(String key)
Return a property as a double value.
- Parameters:
key
- the name of the property to get- Returns:
the value of the property
-
recoverRunningVersion
abstract Unit recoverRunningVersion()
Tells the test element to return to the state it was in when setRunningVersion(true) was called.
-
getPropertyAsString
abstract String getPropertyAsString(String key)
Return a property as a string value.
- Parameters:
key
- the name of the property to get- Returns:
the value of the property
-
getPropertyAsString
abstract String getPropertyAsString(String key, String defaultValue)
Return a property as an string value or a default value if no property could be found.
- Parameters:
key
- the name of the property to getdefaultValue
- the default value to use- Returns:
the value of the property, or
defaultValue
if no property could be found
-
getProperty
abstract JMeterProperty getProperty(String propName)
Given the name of the property, returns the appropriate property from JMeter. If it is null, a NullProperty object will be returned.
- Parameters:
propName
- the name of the property to get- Returns:
JMeterProperty stored under the name, or NullProperty if no property can be found
-
getPropertyOrNull
@API(status = API.Status.EXPERIMENTAL, since = "5.6") JMeterProperty getPropertyOrNull(String propName)
Retrieve property or return
null
if the property is unset.Note: the result of the method does not account the default value, so consider using
get(PropertyDescriptor)
methods if you need to account for default values.- Parameters:
propName
- the name of the property to get- Returns:
JMeterProperty or
null
if the property is unset- Since:
5.6
-
getPropertyOrNull
@API(status = API.Status.EXPERIMENTAL, since = "5.6") JMeterProperty getPropertyOrNull(PropertyDescriptor<?, ?> property)
Retrieve property or return
null
if the property is unset.Note: the result of the method does not account the default value, so consider using
get(PropertyDescriptor)
methods if you need to account for default values.- Parameters:
property
- descriptor of the property to retrieve- Returns:
JMeterProperty or
null
if the property is unset- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") String get(StringPropertyDescriptor<?> property)
Retrieve property as string, or default value, or empty string if the property is unset.
- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Boolean get(BooleanPropertyDescriptor<?> property)
Retrieve boolean property value, or default value, or
false
if the property is unset.- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Integer get(IntegerPropertyDescriptor<?> property)
Retrieve integer property value.
- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Long get(LongPropertyDescriptor<?> property)
Retrieve long property value, or default value, or
0
if the property is unset.- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Float get(FloatPropertyDescriptor<?> property)
Retrieve float property value, or default value, or
0.0f
if the property is unset.- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Double get(DoublePropertyDescriptor<?> property)
Retrieve double property value, or default value, or
0.0
if the property is unset.- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") <ValueClass extends Any> Class<out ValueClass> get(ClassPropertyDescriptor<?, ValueClass> property)
Retrieve Class property value, or default value, or throw NoSuchElementException in case the property is unset.
- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") <TestElementClass extends TestElement> TestElementClass get(TestElementPropertyDescriptor<?, TestElementClass> property)
Retrieve TestElement property value, or throw NoSuchElementException in case the property is unset.
- Since:
5.6
-
get
@API(status = API.Status.EXPERIMENTAL, since = "5.6") CollectionProperty get(CollectionPropertyDescriptor<?> property)
Retrieve CollectionProperty property value, or throw NoSuchElementException in case the property is unset.
- Since:
5.6
-
getString
@API(status = API.Status.EXPERIMENTAL, since = "5.6") String getString(PropertyDescriptor<?, ?> property)
Read property value as string, or default value, or empty string if the property is unset.
- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Unit set(PropertyDescriptor<?, ?> property, String value)
Set property as string, or remove it if the given value is
null
.- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Unit set(BooleanPropertyDescriptor<?> property, Boolean value)
Set property as boolean, or remove it if the given value is null.
- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Unit set(IntegerPropertyDescriptor<?> property, Integer value)
Set property as integer.
- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Unit set(LongPropertyDescriptor<?> property, Long value)
Set property as long.
- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Unit set(FloatPropertyDescriptor<?> property, Float value)
Set property as float.
- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Unit set(DoublePropertyDescriptor<?> property, Double value)
Set property as double.
- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") <ValueClass extends Any> Unit set(ClassPropertyDescriptor<?, ValueClass> property, Class<out ValueClass> value)
Set property as Class, or remove it if the given value is
null
. The value is set as StringProperty with the name of the given class.- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") <TestElementClass extends TestElement> Unit set(TestElementPropertyDescriptor<?, TestElementClass> property, TestElementClass value)
Set property as TestElement, or remove it if the given TestElement is
null
. The values of collection will be converted to JMeterProperty as in CollectionProperty.addItem.- Since:
5.6
-
set
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Unit set(CollectionPropertyDescriptor<?> property, Collection<?> value)
Set property as Collection, or remove it if the given Collection is
null
.- Since:
5.6
-
getOrNull
@API(status = API.Status.EXPERIMENTAL, since = "5.6") <ValueClass extends Any> Class<out ValueClass> getOrNull(ClassPropertyDescriptor<?, ValueClass> property)
Retrieve Class property value, or default value, or
null
in case the property is unset.- Since:
5.6
-
getOrNull
@API(status = API.Status.EXPERIMENTAL, since = "5.6") <TestElementClass extends TestElement> TestElementClass getOrNull(TestElementPropertyDescriptor<?, TestElementClass> property)
Retrieve TestElement property value, or return null in case the property is unset.
- Since:
5.6
-
getOrNull
@API(status = API.Status.EXPERIMENTAL, since = "5.6") CollectionProperty getOrNull(CollectionPropertyDescriptor<?> property)
Retrieve CollectionProperty property value, or return
null
in case the property is unset.- Since:
5.6
-
getOrCreate
@API(status = API.Status.EXPERIMENTAL, since = "5.6") <TestElementClass extends TestElement> TestElementClass getOrCreate(TestElementPropertyDescriptor<?, TestElementClass> property, Function0<TestElementClass> ifMissing)
Retrieve TestElement property value, or create one and set it the property is unset.
- Since:
5.6
-
getOrCreate
@API(status = API.Status.EXPERIMENTAL, since = "5.6") CollectionProperty getOrCreate(CollectionPropertyDescriptor<?> property, Function0<Collection<JMeterProperty>> ifMissing)
Retrieve CollectionProperty property value, or create one and set it the property is unset.
- Since:
5.6
-
propertyIterator
abstract PropertyIterator propertyIterator()
Get a Property Iterator for the TestElements properties.
- Returns:
PropertyIterator
-
removeProperty
abstract Unit removeProperty(String key)
Remove property stored under the
key
- Parameters:
key
- name of the property to be removed
-
removeProperty
@API(status = API.Status.EXPERIMENTAL, since = "5.6") Unit removeProperty(PropertyDescriptor<?, ?> property)
Remove property stored under the
key
- Since:
5.6
-
traverse
abstract Unit traverse(TestElementTraverser traverser)
Convenient way to traverse a test element.
- Parameters:
traverser
- The traverser that is notified of the contained elements
-
canRemove
abstract Boolean canRemove()
Called by Remove to determine if it is safe to remove the element. The element can either clean itself up, and return true, or the element can return false.
- Returns:
true if safe to remove the element
-
removed
Unit removed()
Called when the test element is removed from the test plan. Must not throw any exception
-
getSchema
TestElementSchema getSchema()
-
getProps
PropertiesAccessor<TestElement, TestElementSchema> getProps()
-
isEnabled
abstract Boolean isEnabled()
Configures if the current test element should be enabled or not.
-
setEnabled
abstract Unit setEnabled(Boolean isEnabled)
Configures if the current test element should be enabled or not.
-
isRunningVersion
abstract Boolean isRunningVersion()
Make the test element the running version, or make it no longer the running version. This tells the test element that it's current state must be retrievable by a call to recoverRunningVersion(). It is kind of like making the TestElement Read-Only, but not as strict. Changes can be made and the element can be modified, but the state of the element at the time of the call to setRunningVersion() must be recoverable.
flag whether this element should be the running version
-
setRunningVersion
abstract Unit setRunningVersion(Boolean isRunningVersion)
Make the test element the running version, or make it no longer the running version. This tells the test element that it's current state must be retrievable by a call to recoverRunningVersion(). It is kind of like making the TestElement Read-Only, but not as strict. Changes can be made and the element can be modified, but the state of the element at the time of the call to setRunningVersion() must be recoverable.
flag whether this element should be the running version
-
getThreadContext
abstract JMeterContext getThreadContext()
Associates a thread context with this element.
-
setThreadContext
abstract Unit setThreadContext(JMeterContext threadContext)
Associates a thread context with this element.
-
getThreadName
abstract String getThreadName()
Associates a thread name with this element.
-
setThreadName
@API(status = API.Status.DEPRECATED, since = "5.6") abstract Unit setThreadName(@Deprecated(message = "Use JMeterContextService.getContext().thread.threadName instead", replaceWith = @ReplaceWith(imports = {"org.apache.jmeter.threads.JMeterContextService"}, expression = "JMeterContextService.getContext().thread.threadName")) String threadName)
Associates a thread name with this element.
-
getComment
abstract String getComment()
Associates a comment with this element.
-
setComment
abstract Unit setComment(String comment)
Associates a comment with this element.
-
-
-
-