Package org.apache.jmeter.testelement
Class AbstractTestElement
java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
- All Implemented Interfaces:
Serializable
,Cloneable
,Searchable
,TestElement
- Direct Known Subclasses:
AbstractBoltTestElement
,AbstractJDBCTestElement
,AbstractListenerElement
,AbstractSampler
,AbstractScopedTestElement
,AbstractThreadGroup
,AnchorModifier
,Argument
,Authorization
,BackendListener
,BeanShellTestElement
,BoltConnectionElement
,CompareAssertion
,ConfigTestElement
,ConstantThroughputTimer
,ConstantTimer
,Cookie
,CounterConfig
,DataSourceElement
,DebugPostProcessor
,GenericController
,Header
,HTMLAssertion
,HTTPFileArg
,HttpMirrorControl
,JMESPathAssertion
,JMSProperties
,JMSProperty
,JSONPathAssertion
,LDAPArgument
,MailerModel
,MD5HexAssertion
,OnErrorTestElement
,PreciseThroughputTimer
,RegExUserParameters
,RemoteListenerWrapper
,RemoteSampleListenerWrapper
,RemoteTestListenerWrapper
,RemoteThreadsListenerWrapper
,ResultSaver
,SampleTimeout
,ScriptingTestElement
,SMIMEAssertionTestElement
,StaticHost
,SubstitutionElement
,Summariser
,SyncTimer
,TestPlan
,URLRewritingModifier
,UserParameters
,WorkBench
,XMLAssertion
,XMLSchemaAssertion
public abstract class AbstractTestElement
extends Object
implements TestElement, Serializable, Searchable
- See Also:
-
Field Summary
Fields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
addPropertiesValues
(List<String> result, Set<String> propertyNames) Add to result the values of propertyNamesprotected void
addProperty
(JMeterProperty property) Add property to test element without cloning itprotected void
addProperty
(JMeterProperty property, boolean clone) Add property to test elementvoid
boolean
Called by Remove to determine if it is safe to remove the element.void
clear()
Clear the TestElement of all data.protected void
clearTemporary
(JMeterProperty property) Remove property from temporaryPropertiesvoid
This method should clear any test element properties that are merged byTestElement.addTestElement(TestElement)
.clone()
protected void
Clears temporaryPropertiesboolean
Returns comment associated with this element.getName()
Get the name of this test elementgetProperty
(String key) Get the named property.boolean
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.double
Return a property as a double value.float
getPropertyAsFloat
(String key) Return a property as a float value.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.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.Return a property as a string value.getPropertyAsString
(String key, String defaultValue) Return a property as an string value or a default value if no property could be found.Get a list of all tokens that should be visible to searchingReturns the threadName.int
hashCode()
boolean
Check if ENABLED property is present and true ; defaults to trueboolean
Returns the runningVersion.boolean
isTemporary
(JMeterProperty property) Test whether a given property is only a temporary resident of the TestElementprotected void
Log the properties of the test elementprotected void
mergeIn
(TestElement element) Add to this the properties of element (by reference)Get a Property Iterator for the TestElements properties.void
Tells the test element to return to the state it was in when setRunningVersion(true) was called.void
removeProperty
(String key) Remove property stored under thekey
void
setComment
(String comment) Associates a comment with this elementvoid
setEnabled
(boolean enabled) Set the enabled status of the test elementvoid
Associates a name with this element.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.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
(JMeterProperty property) Sets and overwrites a property in the TestElement.void
setRunningVersion
(boolean runningVersion) Sets the runningVersion.void
setTemporary
(JMeterProperty property) Indicate that the given property should be only a temporary property in the TestElementvoid
setThreadContext
(JMeterContext inthreadContext) void
setThreadName
(String inthreadName) Configures thread name.void
traverse
(TestElementTraverser traverser) Convenient way to traverse a test element.protected void
traverseCollection
(CollectionProperty col, TestElementTraverser traverser) protected void
traverseMap
(MapProperty map, TestElementTraverser traverser) protected void
traverseProperty
(TestElementTraverser traverser, JMeterProperty value) Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.jmeter.testelement.TestElement
removed
-
Constructor Details
-
AbstractTestElement
protected AbstractTestElement()
-
-
Method Details
-
clone
- Specified by:
clone
in interfaceTestElement
- Overrides:
clone
in classObject
-
clear
public void clear()Clear the TestElement of all data.- Specified by:
clear
in interfaceTestElement
-
clearTestElementChildren
public void clearTestElementChildren()This method should clear any test element properties that are merged byTestElement.addTestElement(TestElement)
.Default implementation - does nothing
- Specified by:
clearTestElementChildren
in interfaceTestElement
-
removeProperty
Remove property stored under thekey
- Specified by:
removeProperty
in interfaceTestElement
- Parameters:
key
- name of the property to be removed
-
equals
-
hashCode
public int hashCode() -
addTestElement
- Specified by:
addTestElement
in interfaceTestElement
-
setName
Description copied from interface:TestElement
Associates a name with this element.- Specified by:
setName
in interfaceTestElement
- Parameters:
name
- to be associated
-
getName
Description copied from interface:TestElement
Get the name of this test element- Specified by:
getName
in interfaceTestElement
- Returns:
- name of this element
-
setComment
Description copied from interface:TestElement
Associates a comment with this element- Specified by:
setComment
in interfaceTestElement
- Parameters:
comment
- to be associated
-
getComment
Description copied from interface:TestElement
Returns comment associated with this element.- Specified by:
getComment
in interfaceTestElement
- Returns:
- comment associated with this element
-
getProperty
Get the named property. If it doesn't exist, a new NullProperty object is created with the same name and returned.- Specified by:
getProperty
in interfaceTestElement
- Parameters:
key
- the name of the property to get- Returns:
JMeterProperty
stored under the name, orNullProperty
if no property can be found
-
traverse
Description copied from interface:TestElement
Convenient way to traverse a test element.- Specified by:
traverse
in interfaceTestElement
- Parameters:
traverser
- The traverser that is notified of the contained elements
-
traverseProperty
-
traverseMap
-
traverseCollection
-
getPropertyAsInt
Description copied from interface:TestElement
Return a property as an int value.- Specified by:
getPropertyAsInt
in interfaceTestElement
- Parameters:
key
- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsInt
Description copied from interface:TestElement
Return a property as an int value or a default value if no property could be found.- Specified by:
getPropertyAsInt
in interfaceTestElement
- 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
Description copied from interface:TestElement
Return a property as a boolean value.- Specified by:
getPropertyAsBoolean
in interfaceTestElement
- Parameters:
key
- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsBoolean
Description copied from interface:TestElement
Return a property as a boolean value or a default value if no property could be found.- Specified by:
getPropertyAsBoolean
in interfaceTestElement
- Parameters:
key
- the name of the property to getdefaultVal
- the default value to use- Returns:
- the value of the property, or
defaultValue
if no property could be found
-
getPropertyAsFloat
Description copied from interface:TestElement
Return a property as a float value.- Specified by:
getPropertyAsFloat
in interfaceTestElement
- Parameters:
key
- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsLong
Description copied from interface:TestElement
Return a property as a long value.- Specified by:
getPropertyAsLong
in interfaceTestElement
- Parameters:
key
- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsLong
Description copied from interface:TestElement
Return a property as a long value or a default value if no property could be found.- Specified by:
getPropertyAsLong
in interfaceTestElement
- 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
Description copied from interface:TestElement
Return a property as a double value.- Specified by:
getPropertyAsDouble
in interfaceTestElement
- Parameters:
key
- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsString
Description copied from interface:TestElement
Return a property as a string value.- Specified by:
getPropertyAsString
in interfaceTestElement
- Parameters:
key
- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsString
Description copied from interface:TestElement
Return a property as an string value or a default value if no property could be found.- Specified by:
getPropertyAsString
in interfaceTestElement
- 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
-
addProperty
Add property to test element- Parameters:
property
-JMeterProperty
to add to current Test Elementclone
- clone property
-
addProperty
Add property to test element without cloning it- Parameters:
property
-JMeterProperty
-
clearTemporary
Remove property from temporaryProperties- Parameters:
property
-JMeterProperty
-
logProperties
protected void logProperties()Log the properties of the test element- See Also:
-
setProperty
Description copied from interface:TestElement
Sets and overwrites a property in the TestElement. This call will be ignored if the TestElement is currently a "running version".- Specified by:
setProperty
in interfaceTestElement
- Parameters:
property
- the property to be set
-
setProperty
- Specified by:
setProperty
in interfaceTestElement
-
setProperty
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.- Specified by:
setProperty
in interfaceTestElement
- Parameters:
name
- property namevalue
- current valuedflt
- default
-
setProperty
- Specified by:
setProperty
in interfaceTestElement
-
setProperty
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.- Specified by:
setProperty
in interfaceTestElement
- Parameters:
name
- property namevalue
- current valuedflt
- default
-
setProperty
- Specified by:
setProperty
in interfaceTestElement
-
setProperty
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.- Specified by:
setProperty
in interfaceTestElement
- Parameters:
name
- property namevalue
- current valuedflt
- default
-
setProperty
- Specified by:
setProperty
in interfaceTestElement
-
setProperty
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.- Specified by:
setProperty
in interfaceTestElement
- Parameters:
name
- property namevalue
- current valuedflt
- default
-
propertyIterator
Description copied from interface:TestElement
Get a Property Iterator for the TestElements properties.- Specified by:
propertyIterator
in interfaceTestElement
- Returns:
- PropertyIterator
-
mergeIn
Add to this the properties of element (by reference)- Parameters:
element
-TestElement
-
isRunningVersion
public boolean isRunningVersion()Returns the runningVersion.- Specified by:
isRunningVersion
in interfaceTestElement
- Returns:
true
if the element is the running version
-
setRunningVersion
public void setRunningVersion(boolean runningVersion) Sets the runningVersion.- Specified by:
setRunningVersion
in interfaceTestElement
- Parameters:
runningVersion
- the runningVersion to set
-
recoverRunningVersion
public void recoverRunningVersion()Tells the test element to return to the state it was in when setRunningVersion(true) was called.- Specified by:
recoverRunningVersion
in interfaceTestElement
-
emptyTemporary
protected void emptyTemporary()Clears temporaryProperties -
isTemporary
Test whether a given property is only a temporary resident of the TestElement- Specified by:
isTemporary
in interfaceTestElement
- Parameters:
property
- the property to be tested- Returns:
true
if property is temporary
-
setTemporary
Indicate that the given property should be only a temporary property in the TestElement- Specified by:
setTemporary
in interfaceTestElement
- Parameters:
property
- void
-
getThreadContext
- Specified by:
getThreadContext
in interfaceTestElement
- Returns:
- Returns the threadContext.
-
setThreadContext
- Specified by:
setThreadContext
in interfaceTestElement
- Parameters:
inthreadContext
- The threadContext to set.
-
getThreadName
Description copied from interface:TestElement
Returns the threadName.- Specified by:
getThreadName
in interfaceTestElement
- Returns:
- Returns the threadName.
-
setThreadName
Description copied from interface:TestElement
Configures thread name.- Specified by:
setThreadName
in interfaceTestElement
- Parameters:
inthreadName
- The threadName to set.
-
canRemove
public 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.- Specified by:
canRemove
in interfaceTestElement
- Returns:
- true if safe to remove the element
-
isEnabled
public boolean isEnabled()Description copied from interface:TestElement
Check if ENABLED property is present and true ; defaults to true- Specified by:
isEnabled
in interfaceTestElement
- Returns:
- true if element is enabled
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:TestElement
Set the enabled status of the test element- Specified by:
setEnabled
in interfaceTestElement
- Parameters:
enabled
- the status to set
-
getSearchableTokens
Get a list of all tokens that should be visible to searching}- Specified by:
getSearchableTokens
in interfaceSearchable
- Returns:
- List of searchable tokens
-
addPropertiesValues
Add to result the values of propertyNames- Parameters:
result
- List of values of propertyNamespropertyNames
- Set of names of properties to extract
-