Class AbstractTestElement
-
- All Implemented Interfaces:
-
java.io.Serializable
,java.lang.Cloneable
,org.apache.jmeter.gui.Searchable
,org.apache.jmeter.testelement.TestElement
public abstract class AbstractTestElement implements TestElement, Serializable, Searchable
-
-
Field Summary
Fields Modifier and Type Field Description public transient JMeterContext
threadContext
public transient String
threadName
public final static TestElement.Companion
Companion
public final static String
NAME
public final static String
GUI_CLASS
public final static String
ENABLED
public final static String
TEST_CLASS
public final static String
COMMENTS
-
Method Summary
Modifier and Type Method Description JMeterContext
getThreadContext()
void
setThreadContext(JMeterContext inthreadContext)
String
getThreadName()
void
setThreadName(String inthreadName)
Object
clone()
void
clear()
Clear the TestElement of all data. void
clearTestElementChildren()
This method should clear any test element properties that are merged by . void
removeProperty(String key)
Remove property stored under the key
boolean
equals(Object o)
int
hashCode()
void
addTestElement(TestElement el)
void
setName(String name)
Associates a name with this element. String
getName()
Associates a name with this element. void
setComment(String comment)
Associates a comment with this element. String
getComment()
Associates a comment with this element. JMeterProperty
getProperty(String key)
Get the named property. JMeterProperty
getPropertyOrNull(String key)
Retrieve property or return null
if the property is unset.void
traverse(TestElementTraverser traverser)
Convenient way to traverse a test element. int
getPropertyAsInt(String key)
Return a property as an int value. int
getPropertyAsInt(String key, int defaultValue)
Return a property as an int value or a default value if no property could be found. boolean
getPropertyAsBoolean(String key)
Return a property as a boolean value. boolean
getPropertyAsBoolean(String key, boolean defaultVal)
Return a property as a boolean value or a default value if no property could be found. float
getPropertyAsFloat(String key)
Return a property as a float value. long
getPropertyAsLong(String key)
Return a property as a long value. long
getPropertyAsLong(String key, long defaultValue)
Return a property as a long value or a default value if no property could be found. double
getPropertyAsDouble(String key)
Return a property as a double value. String
getPropertyAsString(String key)
Return a property as a string value. String
getPropertyAsString(String key, String defaultValue)
Return a property as an string value or a default value if no property could be found. void
setProperty(JMeterProperty property)
Sets and overwrites a property in the TestElement. void
setProperty(String name, String value)
void
setProperty(String name, String value, String dflt)
Create a String property - but only if it is not the default. void
setProperty(String name, boolean value)
void
setProperty(String name, boolean value, boolean dflt)
Create a boolean property - but only if it is not the default. void
setProperty(String name, int value)
void
setProperty(String name, int value, int dflt)
Create an int property - but only if it is not the default. void
setProperty(String name, long value)
void
setProperty(String name, long value, long dflt)
Create a long property - but only if it is not the default. PropertyIterator
propertyIterator()
Get a Property Iterator for the TestElements properties. boolean
isRunningVersion()
Returns the runningVersion. void
recoverRunningVersion()
Tells the test element to return to the state it was in when setRunningVersion(true) was called. boolean
isTemporary(JMeterProperty property)
Test whether a given property is only a temporary resident of the TestElement void
setTemporary(JMeterProperty property)
Indicate that the given property should be only a temporary property in the TestElement. boolean
canRemove()
Called by Remove to determine if it is safe to remove the element. boolean
isEnabled()
Configures if the current test element should be enabled or not. void
setEnabled(boolean enabled)
Configures if the current test element should be enabled or not. List<String>
getSearchableTokens()
Get a list of all tokens that should be visible to searching } void
setRunningVersion(boolean runningVersion)
Sets the runningVersion. -
Methods inherited from class org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProps, getSchema, getString, getThreadContext, getThreadName, removed, set, setThreadContext, setThreadName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getThreadContext
JMeterContext getThreadContext()
- Returns:
Returns the threadContext.
-
setThreadContext
void setThreadContext(JMeterContext inthreadContext)
- Parameters:
inthreadContext
- The threadContext to set.
-
getThreadName
String getThreadName()
- Returns:
Returns the threadName.
-
setThreadName
void setThreadName(String inthreadName)
- Parameters:
inthreadName
- The threadName to set.
-
clear
void clear()
Clear the TestElement of all data.
-
clearTestElementChildren
void clearTestElementChildren()
This method should clear any test element properties that are merged by .addTestElement.
Default implementation - does nothing
-
removeProperty
void removeProperty(String key)
Remove property stored under the
key
-
hashCode
int hashCode()
-
addTestElement
void addTestElement(TestElement el)
-
setComment
void setComment(String comment)
Associates a comment with this element.
-
getComment
String getComment()
Associates a comment with this element.
-
getProperty
JMeterProperty getProperty(String key)
Get the named property. If it doesn't exist, a new NullProperty object is created with the same name and returned.
-
getPropertyOrNull
@API(status = API.Status.EXPERIMENTAL, since = "5.6") JMeterProperty getPropertyOrNull(String key)
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.- Since:
5.6
-
traverse
void traverse(TestElementTraverser traverser)
Convenient way to traverse a test element.
- Parameters:
traverser
- The traverser that is notified of the contained elements
-
getPropertyAsInt
int 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
int getPropertyAsInt(String key, int 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
-
getPropertyAsBoolean
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
boolean getPropertyAsBoolean(String key, boolean defaultVal)
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 get- Returns:
the value of the property, or
defaultValue
if no property could be found
-
getPropertyAsFloat
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
-
getPropertyAsLong
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
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
-
getPropertyAsDouble
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
-
getPropertyAsString
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
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
-
setProperty
void 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
-
setProperty
void setProperty(String name, String value)
-
setProperty
void setProperty(String name, String value, String dflt)
Create a String property - but only if it is not the default. This is intended for use when adding new properties to JMeter so that JMX files are not expanded unnecessarily. N.B. - must agree with the default applied when reading the property.
- Parameters:
name
- property namevalue
- current valuedflt
- default
-
setProperty
void setProperty(String name, boolean value)
-
setProperty
void setProperty(String name, boolean value, boolean dflt)
Create a boolean property - but only if it is not the default. This is intended for use when adding new properties to JMeter so that JMX files are not expanded unnecessarily. N.B. - must agree with the default applied when reading the property.
- Parameters:
name
- property namevalue
- current valuedflt
- default
-
setProperty
void setProperty(String name, int value)
-
setProperty
void setProperty(String name, int value, int dflt)
Create an int property - but only if it is not the default. This is intended for use when adding new properties to JMeter so that JMX files are not expanded unnecessarily. N.B. - must agree with the default applied when reading the property.
- Parameters:
name
- property namevalue
- current valuedflt
- default
-
setProperty
void setProperty(String name, long value)
-
setProperty
void setProperty(String name, long value, long dflt)
Create a long property - but only if it is not the default. This is intended for use when adding new properties to JMeter so that JMX files are not expanded unnecessarily. N.B. - must agree with the default applied when reading the property.
- Parameters:
name
- property namevalue
- current valuedflt
- default
-
propertyIterator
PropertyIterator propertyIterator()
Get a Property Iterator for the TestElements properties.
- Returns:
PropertyIterator
-
isRunningVersion
boolean isRunningVersion()
Returns the runningVersion.
-
recoverRunningVersion
void recoverRunningVersion()
Tells the test element to return to the state it was in when setRunningVersion(true) was called.
-
isTemporary
boolean isTemporary(JMeterProperty property)
Test whether a given property is only a temporary resident of the TestElement
-
setTemporary
void setTemporary(JMeterProperty property)
Indicate that the given property should be only a temporary property in the TestElement.
-
canRemove
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.
-
isEnabled
boolean isEnabled()
Configures if the current test element should be enabled or not.
-
setEnabled
void setEnabled(boolean enabled)
Configures if the current test element should be enabled or not.
-
getSearchableTokens
List<String> getSearchableTokens()
Get a list of all tokens that should be visible to searching }
-
setRunningVersion
void setRunningVersion(boolean runningVersion)
Sets the runningVersion.
- Parameters:
runningVersion
- the runningVersion to set
-
-
-
-