Class AbstractTestElement

    • Constructor Detail

      • AbstractTestElement

        public AbstractTestElement()
    • Method Detail

      • clear

        public void clear()
        Clear the TestElement of all data.
        Specified by:
        clear in interface TestElement
      • removeProperty

        public void removeProperty​(String key)
        Remove property stored under the key
        Specified by:
        removeProperty in interface TestElement
        Parameters:
        key - name of the property to be removed
      • hashCode

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

        public void setName​(String name)
        Specified by:
        setName in interface TestElement
        Parameters:
        name - of this element
      • getName

        public String getName()
        Description copied from interface: TestElement
        Get the name of this test element
        Specified by:
        getName in interface TestElement
        Returns:
        name of this element
      • setComment

        public void setComment​(String comment)
        Description copied from interface: TestElement
        Associates a comment with this element
        Specified by:
        setComment in interface TestElement
        Parameters:
        comment - to be associated
      • getComment

        public String getComment()
        Specified by:
        getComment in interface TestElement
        Returns:
        comment associated with this element
      • 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 TestElement
        Parameters:
        key - the name of the property to get
        Returns:
        JMeterProperty stored under the name, or NullProperty if no property can be found
      • traverse

        public void traverse​(TestElementTraverser traverser)
        Description copied from interface: TestElement
        Convenient way to traverse a test element.
        Specified by:
        traverse in interface TestElement
        Parameters:
        traverser - The traverser that is notified of the contained elements
      • getPropertyAsInt

        public int getPropertyAsInt​(String key)
        Description copied from interface: TestElement
        Return a property as an int value.
        Specified by:
        getPropertyAsInt in interface TestElement
        Parameters:
        key - the name of the property to get
        Returns:
        the value of the property
      • getPropertyAsInt

        public int getPropertyAsInt​(String key,
                                    int defaultValue)
        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 interface TestElement
        Parameters:
        key - the name of the property to get
        defaultValue - the default value to use
        Returns:
        the value of the property, or defaultValue if no property could be found
      • getPropertyAsBoolean

        public boolean getPropertyAsBoolean​(String key)
        Description copied from interface: TestElement
        Return a property as a boolean value.
        Specified by:
        getPropertyAsBoolean in interface TestElement
        Parameters:
        key - the name of the property to get
        Returns:
        the value of the property
      • getPropertyAsBoolean

        public boolean getPropertyAsBoolean​(String key,
                                            boolean defaultVal)
        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 interface TestElement
        Parameters:
        key - the name of the property to get
        defaultVal - the default value to use
        Returns:
        the value of the property, or defaultValue if no property could be found
      • getPropertyAsFloat

        public float getPropertyAsFloat​(String key)
        Description copied from interface: TestElement
        Return a property as a float value.
        Specified by:
        getPropertyAsFloat in interface TestElement
        Parameters:
        key - the name of the property to get
        Returns:
        the value of the property
      • getPropertyAsLong

        public long getPropertyAsLong​(String key)
        Description copied from interface: TestElement
        Return a property as a long value.
        Specified by:
        getPropertyAsLong in interface TestElement
        Parameters:
        key - the name of the property to get
        Returns:
        the value of the property
      • getPropertyAsLong

        public long getPropertyAsLong​(String key,
                                      long defaultValue)
        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 interface TestElement
        Parameters:
        key - the name of the property to get
        defaultValue - the default value to use
        Returns:
        the value of the property, or defaultValue if no property could be found
      • getPropertyAsDouble

        public double getPropertyAsDouble​(String key)
        Description copied from interface: TestElement
        Return a property as a double value.
        Specified by:
        getPropertyAsDouble in interface TestElement
        Parameters:
        key - the name of the property to get
        Returns:
        the value of the property
      • getPropertyAsString

        public String getPropertyAsString​(String key)
        Description copied from interface: TestElement
        Return a property as a string value.
        Specified by:
        getPropertyAsString in interface TestElement
        Parameters:
        key - the name of the property to get
        Returns:
        the value of the property
      • getPropertyAsString

        public String getPropertyAsString​(String key,
                                          String defaultValue)
        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 interface TestElement
        Parameters:
        key - the name of the property to get
        defaultValue - the default value to use
        Returns:
        the value of the property, or defaultValue if no property could be found
      • 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
      • setProperty

        public void setProperty​(JMeterProperty property)
        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 interface TestElement
        Parameters:
        property - the property to be set
      • 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 TestElement
        Parameters:
        name - property name
        value - current value
        dflt - default
      • 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 TestElement
        Parameters:
        name - property name
        value - current value
        dflt - default
      • 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 TestElement
        Parameters:
        name - property name
        value - current value
        dflt - default
      • 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 TestElement
        Parameters:
        name - property name
        value - current value
        dflt - default
      • mergeIn

        protected void mergeIn​(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 TestElement
        Returns:
        true if the element is the running version
      • setRunningVersion

        public void setRunningVersion​(boolean runningVersion)
        Sets the runningVersion.
        Specified by:
        setRunningVersion in interface TestElement
        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 interface TestElement
      • emptyTemporary

        protected void emptyTemporary()
        Clears temporaryProperties
      • isTemporary

        public boolean isTemporary​(JMeterProperty property)
        Test whether a given property is only a temporary resident of the TestElement
        Specified by:
        isTemporary in interface TestElement
        Parameters:
        property - the property to be tested
        Returns:
        true if property is temporary
      • setTemporary

        public void setTemporary​(JMeterProperty property)
        Indicate that the given property should be only a temporary property in the TestElement
        Specified by:
        setTemporary in interface TestElement
        Parameters:
        property - void
      • setThreadName

        public void setThreadName​(String inthreadName)
        Specified by:
        setThreadName in interface TestElement
        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 interface TestElement
        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 interface TestElement
        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 interface TestElement
        Parameters:
        enabled - the status to set
      • 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<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