Class AbstractTestElement
java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
- All Implemented Interfaces:
Serializable, Cloneable, Searchable, TestElement
- Direct Known Subclasses:
AbstractJDBCTestElement, AbstractListenerElement, AbstractSampler, AbstractScopedTestElement, AbstractThreadGroup, AnchorModifier, Argument, Authorization, BackendListener, BeanShellTestElement, CompareAssertion, ConfigTestElement, ConstantThroughputTimer, ConstantTimer, Cookie, CounterConfig, DataSourceElement, DebugPostProcessor, GenericController, Header, HTMLAssertion, HTTPFileArg, HttpMirrorControl, JMSProperties, JMSProperty, LDAPArgument, MailerModel, MD5HexAssertion, MonitorStats, OnErrorTestElement, ParamMask, ParamModifier, RegExUserParameters, RemoteListenerWrapper, RemoteSampleListenerWrapper, RemoteTestListenerWrapper, RemoteThreadsListenerWrapper, ResultSaver, ScriptingTestElement, SMIMEAssertionTestElement, 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 TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaddPropertiesValues(List<String> result, Set<String> propertyNames) Add to result the values of propertyNamesprotected voidaddProperty(JMeterProperty property) Add property to test element without cloning itprotected voidaddProperty(JMeterProperty property, boolean clone) Add property to test elementvoidbooleanCalled by Remove to determine if it is safe to remove the element.voidclear()Clear the TestElement of all data.protected voidclearTemporary(JMeterProperty property) Remove property from temporaryPropertiesvoidThis method should clear any test element properties that are merged byTestElement.addTestElement(TestElement).clone()protected voidClears temporaryPropertiesbooleangetName()Get the name of this test elementgetProperty(String key) Get the named property.booleanReturn a property as a boolean value.booleangetPropertyAsBoolean(String key, boolean defaultVal) Return a property as a boolean value or a default value if no property could be found.doubleReturn a property as a double value.floatgetPropertyAsFloat(String key) Return a property as a float value.intgetPropertyAsInt(String key) Return a property as an int value.intgetPropertyAsInt(String key, int defaultValue) Return a property as an int value or a default value if no property could be found.longgetPropertyAsLong(String key) Return a property as a long value.longgetPropertyAsLong(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 searchinginthashCode()booleanCheck if ENABLED property is present and true ; defaults to truebooleanReturns the runningVersion.booleanisTemporary(JMeterProperty property) Test whether a given property is only a temporary resident of the TestElementprotected voidLog the properties of the test elementprotected voidmergeIn(TestElement element) Add to this the properties of element (by reference)Get a Property Iterator for the TestElements properties.voidTells the test element to return to the state it was in when setRunningVersion(true) was called.voidremoveProperty(String key) Remove property stored under thekeyvoidsetComment(String comment) Associates a comment with this elementvoidsetEnabled(boolean enabled) Set the enabled status of the test elementvoidvoidsetProperty(String name, boolean value) voidsetProperty(String name, boolean value, boolean dflt) Create a boolean property - but only if it is not the default.voidsetProperty(String name, int value) voidsetProperty(String name, int value, int dflt) Create an int property - but only if it is not the default.voidsetProperty(String name, long value) voidsetProperty(String name, long value, long dflt) Create a long property - but only if it is not the default.voidsetProperty(String name, String value) voidsetProperty(String name, String value, String dflt) Create a String property - but only if it is not the default.voidsetProperty(JMeterProperty property) Sets and overwrites a property in the TestElement.voidsetRunningVersion(boolean runningVersion) Sets the runningVersion.voidsetTemporary(JMeterProperty property) Indicate that the given property should be only a temporary property in the TestElementvoidsetThreadContext(JMeterContext inthreadContext) voidsetThreadName(String inthreadName) voidtraverse(TestElementTraverser traverser) Convenient way to traverse a test element.protected voidtraverseCollection(CollectionProperty col, TestElementTraverser traverser) protected voidtraverseMap(MapProperty map, TestElementTraverser traverser) protected voidtraverseProperty(TestElementTraverser traverser, JMeterProperty value)
-
Constructor Details
-
AbstractTestElement
public AbstractTestElement()
-
-
Method Details
-
clone
- Specified by:
clonein interfaceTestElement- Overrides:
clonein classObject
-
clear
-
clearTestElementChildren
public void clearTestElementChildren()This method should clear any test element properties that are merged byTestElement.addTestElement(TestElement).Default implementation - does nothing
- Specified by:
clearTestElementChildrenin interfaceTestElement
-
removeProperty
Remove property stored under thekey- Specified by:
removePropertyin interfaceTestElement- Parameters:
key- name of the property to be removed
-
equals
-
hashCode
-
addTestElement
- Specified by:
addTestElementin interfaceTestElement
-
setName
- Specified by:
setNamein interfaceTestElement- Parameters:
name- of this element
-
getName
Description copied from interface:TestElementGet the name of this test element- Specified by:
getNamein interfaceTestElement- Returns:
- name of this element
-
setComment
Description copied from interface:TestElementAssociates a comment with this element- Specified by:
setCommentin interfaceTestElement- Parameters:
comment- to be associated
-
getComment
- Specified by:
getCommentin 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:
getPropertyin interfaceTestElement- Parameters:
key- the name of the property to get- Returns:
JMeterPropertystored under the name, orNullPropertyif no property can be found
-
traverse
Description copied from interface:TestElementConvenient way to traverse a test element.- Specified by:
traversein interfaceTestElement- Parameters:
traverser- The traverser that is notified of the contained elements
-
traverseProperty
-
traverseMap
-
traverseCollection
-
getPropertyAsInt
Description copied from interface:TestElementReturn a property as an int value.- Specified by:
getPropertyAsIntin interfaceTestElement- Parameters:
key- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsInt
Description copied from interface:TestElementReturn a property as an int value or a default value if no property could be found.- Specified by:
getPropertyAsIntin interfaceTestElement- Parameters:
key- the name of the property to getdefaultValue- the default value to use- Returns:
- the value of the property, or
defaultValueif no property could be found
-
getPropertyAsBoolean
Description copied from interface:TestElementReturn a property as a boolean value.- Specified by:
getPropertyAsBooleanin interfaceTestElement- Parameters:
key- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsBoolean
Description copied from interface:TestElementReturn a property as a boolean value or a default value if no property could be found.- Specified by:
getPropertyAsBooleanin interfaceTestElement- Parameters:
key- the name of the property to getdefaultVal- the default value to use- Returns:
- the value of the property, or
defaultValueif no property could be found
-
getPropertyAsFloat
Description copied from interface:TestElementReturn a property as a float value.- Specified by:
getPropertyAsFloatin interfaceTestElement- Parameters:
key- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsLong
Description copied from interface:TestElementReturn a property as a long value.- Specified by:
getPropertyAsLongin interfaceTestElement- Parameters:
key- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsLong
Description copied from interface:TestElementReturn a property as a long value or a default value if no property could be found.- Specified by:
getPropertyAsLongin interfaceTestElement- Parameters:
key- the name of the property to getdefaultValue- the default value to use- Returns:
- the value of the property, or
defaultValueif no property could be found
-
getPropertyAsDouble
Description copied from interface:TestElementReturn a property as a double value.- Specified by:
getPropertyAsDoublein interfaceTestElement- Parameters:
key- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsString
Description copied from interface:TestElementReturn a property as a string value.- Specified by:
getPropertyAsStringin interfaceTestElement- Parameters:
key- the name of the property to get- Returns:
- the value of the property
-
getPropertyAsString
Description copied from interface:TestElementReturn a property as an string value or a default value if no property could be found.- Specified by:
getPropertyAsStringin interfaceTestElement- Parameters:
key- the name of the property to getdefaultValue- the default value to use- Returns:
- the value of the property, or
defaultValueif no property could be found
-
addProperty
Add property to test element- Parameters:
property-JMeterPropertyto 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:TestElementSets and overwrites a property in the TestElement. This call will be ignored if the TestElement is currently a "running version".- Specified by:
setPropertyin interfaceTestElement- Parameters:
property- the property to be set
-
setProperty
- Specified by:
setPropertyin 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:
setPropertyin interfaceTestElement- Parameters:
name- property namevalue- current valuedflt- default
-
setProperty
- Specified by:
setPropertyin 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:
setPropertyin interfaceTestElement- Parameters:
name- property namevalue- current valuedflt- default
-
setProperty
- Specified by:
setPropertyin 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:
setPropertyin interfaceTestElement- Parameters:
name- property namevalue- current valuedflt- default
-
setProperty
- Specified by:
setPropertyin 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:
setPropertyin interfaceTestElement- Parameters:
name- property namevalue- current valuedflt- default
-
propertyIterator
Description copied from interface:TestElementGet a Property Iterator for the TestElements properties.- Specified by:
propertyIteratorin 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:
isRunningVersionin interfaceTestElement- Returns:
trueif the element is the running version
-
setRunningVersion
public void setRunningVersion(boolean runningVersion) Sets the runningVersion.- Specified by:
setRunningVersionin 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:
recoverRunningVersionin interfaceTestElement
-
emptyTemporary
protected void emptyTemporary()Clears temporaryProperties -
isTemporary
Test whether a given property is only a temporary resident of the TestElement- Specified by:
isTemporaryin interfaceTestElement- Parameters:
property- the property to be tested- Returns:
trueif property is temporary
-
setTemporary
Indicate that the given property should be only a temporary property in the TestElement- Specified by:
setTemporaryin interfaceTestElement- Parameters:
property- void
-
getThreadContext
- Specified by:
getThreadContextin interfaceTestElement- Returns:
- Returns the threadContext.
-
setThreadContext
- Specified by:
setThreadContextin interfaceTestElement- Parameters:
inthreadContext- The threadContext to set.
-
getThreadName
- Specified by:
getThreadNamein interfaceTestElement- Returns:
- Returns the threadName.
-
setThreadName
- Specified by:
setThreadNamein 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:
canRemovein interfaceTestElement- Returns:
- true if safe to remove the element
-
isEnabled
public boolean isEnabled()Description copied from interface:TestElementCheck if ENABLED property is present and true ; defaults to true- Specified by:
isEnabledin interfaceTestElement- Returns:
- true if element is enabled
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:TestElementSet the enabled status of the test element- Specified by:
setEnabledin interfaceTestElement- Parameters:
enabled- the status to set
-
getSearchableTokens
Get a list of all tokens that should be visible to searching}- Specified by:
getSearchableTokensin interfaceSearchable- Returns:
- List of searchable tokens
-
addPropertiesValues
-