Class AbstractTestElement

java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
All Implemented Interfaces:
Serializable, Cloneable, Searchable, org.apache.jmeter.testelement.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 org.apache.jmeter.testelement.TestElement, Serializable, Searchable
See Also:
  • Constructor Details

    • AbstractTestElement

      protected AbstractTestElement()
  • Method Details

    • clone

      public Object clone()
      Specified by:
      clone in interface org.apache.jmeter.testelement.TestElement
      Overrides:
      clone in class Object
    • clear

      public void clear()
      Specified by:
      clear in interface org.apache.jmeter.testelement.TestElement
    • clearTestElementChildren

      public void clearTestElementChildren()

      Default implementation - does nothing

      Specified by:
      clearTestElementChildren in interface org.apache.jmeter.testelement.TestElement
    • removeProperty

      public void removeProperty(String key)
      Specified by:
      removeProperty in interface org.apache.jmeter.testelement.TestElement
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • addTestElement

      public void addTestElement(org.apache.jmeter.testelement.TestElement el)
      Specified by:
      addTestElement in interface org.apache.jmeter.testelement.TestElement
    • setName

      public void setName(String name)
      Specified by:
      setName in interface org.apache.jmeter.testelement.TestElement
    • getName

      public String getName()
      Specified by:
      getName in interface org.apache.jmeter.testelement.TestElement
    • setComment

      public void setComment(String comment)
      Specified by:
      setComment in interface org.apache.jmeter.testelement.TestElement
    • getComment

      public String getComment()
      Specified by:
      getComment in interface org.apache.jmeter.testelement.TestElement
    • getProperty

      public 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.
      Specified by:
      getProperty in interface org.apache.jmeter.testelement.TestElement
    • getPropertyOrNull

      @API(status=EXPERIMENTAL, since="5.6") public JMeterProperty getPropertyOrNull(String key)
      Specified by:
      getPropertyOrNull in interface org.apache.jmeter.testelement.TestElement
      Since:
      5.6
    • traverse

      public void traverse(TestElementTraverser traverser)
      Specified by:
      traverse in interface org.apache.jmeter.testelement.TestElement
    • traverseProperty

      protected void traverseProperty(TestElementTraverser traverser, JMeterProperty value)
    • traverseMap

      protected void traverseMap(MapProperty map, TestElementTraverser traverser)
    • traverseCollection

      protected void traverseCollection(CollectionProperty col, TestElementTraverser traverser)
    • getPropertyAsInt

      public int getPropertyAsInt(String key)
      Specified by:
      getPropertyAsInt in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsInt

      public int getPropertyAsInt(String key, int defaultValue)
      Specified by:
      getPropertyAsInt in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsBoolean

      public boolean getPropertyAsBoolean(String key)
      Specified by:
      getPropertyAsBoolean in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsBoolean

      public boolean getPropertyAsBoolean(String key, boolean defaultVal)
      Specified by:
      getPropertyAsBoolean in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsFloat

      public float getPropertyAsFloat(String key)
      Specified by:
      getPropertyAsFloat in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsLong

      public long getPropertyAsLong(String key)
      Specified by:
      getPropertyAsLong in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsLong

      public long getPropertyAsLong(String key, long defaultValue)
      Specified by:
      getPropertyAsLong in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsDouble

      public double getPropertyAsDouble(String key)
      Specified by:
      getPropertyAsDouble in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsString

      public String getPropertyAsString(String key)
      Specified by:
      getPropertyAsString in interface org.apache.jmeter.testelement.TestElement
    • getPropertyAsString

      public String getPropertyAsString(String key, String defaultValue)
      Specified by:
      getPropertyAsString in interface org.apache.jmeter.testelement.TestElement
    • addProperty

      protected void addProperty(JMeterProperty property, boolean clone)
      Add property to test element
      Parameters:
      property - JMeterProperty to add to current Test Element
      clone - clone property
    • addProperty

      protected void addProperty(JMeterProperty property)
      Add property to test element without cloning it
      Parameters:
      property - JMeterProperty
    • clearTemporary

      protected void clearTemporary(JMeterProperty property)
      Remove property from temporaryProperties
      Parameters:
      property - JMeterProperty
    • logProperties

      protected void logProperties()
      Log the properties of the test element
      See Also:
      • TestElement.setProperty(JMeterProperty)
    • setProperty

      public void setProperty(JMeterProperty property)
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
    • setProperty

      public void setProperty(String name, String value)
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
    • setProperty

      public 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.
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
      Parameters:
      name - property name
      value - current value
      dflt - default
    • setProperty

      public void setProperty(String name, boolean value)
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
    • setProperty

      public 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.
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
      Parameters:
      name - property name
      value - current value
      dflt - default
    • setProperty

      public void setProperty(String name, int value)
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
    • setProperty

      public 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.
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
      Parameters:
      name - property name
      value - current value
      dflt - default
    • setProperty

      public void setProperty(String name, long value)
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
    • setProperty

      public 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.
      Specified by:
      setProperty in interface org.apache.jmeter.testelement.TestElement
      Parameters:
      name - property name
      value - current value
      dflt - default
    • propertyIterator

      public PropertyIterator propertyIterator()
      Specified by:
      propertyIterator in interface org.apache.jmeter.testelement.TestElement
    • mergeIn

      protected void mergeIn(org.apache.jmeter.testelement.TestElement element)
      Add to this the properties of element (by reference)
      Parameters:
      element - TestElement
    • isRunningVersion

      public boolean isRunningVersion()
      Returns the runningVersion.
      Specified by:
      isRunningVersion in interface org.apache.jmeter.testelement.TestElement
    • setRunningVersion

      public void setRunningVersion(boolean runningVersion)
      Sets the runningVersion.
      Specified by:
      setRunningVersion in interface org.apache.jmeter.testelement.TestElement
      Parameters:
      runningVersion - the runningVersion to set
    • recoverRunningVersion

      public void recoverRunningVersion()
      Specified by:
      recoverRunningVersion in interface org.apache.jmeter.testelement.TestElement
    • emptyTemporary

      protected void emptyTemporary()
      Clears temporaryProperties
    • isTemporary

      public boolean isTemporary(JMeterProperty property)
      Specified by:
      isTemporary in interface org.apache.jmeter.testelement.TestElement
    • setTemporary

      public void setTemporary(JMeterProperty property)
      Specified by:
      setTemporary in interface org.apache.jmeter.testelement.TestElement
    • getThreadContext

      public JMeterContext getThreadContext()
      Specified by:
      getThreadContext in interface org.apache.jmeter.testelement.TestElement
      Returns:
      Returns the threadContext.
    • setThreadContext

      public void setThreadContext(JMeterContext inthreadContext)
      Specified by:
      setThreadContext in interface org.apache.jmeter.testelement.TestElement
      Parameters:
      inthreadContext - The threadContext to set.
    • getThreadName

      public String getThreadName()
      Specified by:
      getThreadName in interface org.apache.jmeter.testelement.TestElement
      Returns:
      Returns the threadName.
    • setThreadName

      public void setThreadName(String inthreadName)
      Specified by:
      setThreadName in interface org.apache.jmeter.testelement.TestElement
      Parameters:
      inthreadName - The threadName to set.
    • canRemove

      public boolean canRemove()
      Specified by:
      canRemove in interface org.apache.jmeter.testelement.TestElement
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface org.apache.jmeter.testelement.TestElement
    • setEnabled

      public void setEnabled(boolean enabled)
      Specified by:
      setEnabled in interface org.apache.jmeter.testelement.TestElement
    • getSearchableTokens

      public List<String> getSearchableTokens()
      Get a list of all tokens that should be visible to searching}
      Specified by:
      getSearchableTokens in interface Searchable
      Returns:
      List of searchable tokens
    • addPropertiesValues

      protected final void addPropertiesValues(List<? super String> result, Set<String> propertyNames)
      Add to result the values of propertyNames
      Parameters:
      result - List of values of propertyNames
      propertyNames - Set of names of properties to extract