Class TestElementParamBuilder


  • public class TestElementParamBuilder
    extends Object
    Is a wrapper class for TestElement for easy creation of MethodParam instances.
    Since:
    0.45
    • Constructor Detail

      • TestElementParamBuilder

        public TestElementParamBuilder​(org.apache.jmeter.testelement.TestElement testElement)
        Creates an instance for a given TestElement.

        When creating parameters from properties names, fully qualified property names are required.

        If the test element has a common prefix for properties, consider using TestElementParamBuilder(TestElement, String) instead.

        Parameters:
        testElement - is the JMeter test element backing this parameter builder.
      • TestElementParamBuilder

        public TestElementParamBuilder​(org.apache.jmeter.testelement.TestElement testElement,
                                       String propsPrefix)
        Same as TestElementParamBuilder(TestElement) but allowing to define a common properties prefix for the test element.
        Parameters:
        testElement - is the JMeter test element backing this parameter builder.
        propsPrefix - is the common prefix for all properties of the test element.
        See Also:
        TestElementParamBuilder(TestElement)
    • Method Detail

      • nameParam

        public NameParam nameParam​(String defaultName)
        Generates a MethodParam representing a test element name.
        Parameters:
        defaultName - is the default name used by the JMeter test element.
        Returns:
        the MethodParam instance.
      • intParam

        public MethodParam intParam​(String propName,
                                    Integer defaultValue)
        Generates a MethodParam representing an integer test element property.
        Parameters:
        propName - is the name of the property holding an integer value. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        defaultValue - is the default value used by the test element for this property.
        Returns:
        the MethodParam instance.
        Throws:
        UnsupportedOperationException - when no integer can be parsed from the property value.
        Since:
        0.61
      • intParam

        public MethodParam intParam​(String propName)
        Same as intParam(String, Integer) but with no default value.
        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        Returns:
        the MethodParam instance.
        See Also:
        intParam(String, Integer)
      • prop

        public org.apache.jmeter.testelement.property.JMeterProperty prop​(String propName)
        Gets the JMeterProperty instance for the given test element and property name.

        This is useful in general to access raw values of properties, and abstract how to access them (eg: if they are nested in object properties you can easily access them using slashes)

        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        Returns:
        the JMeterProperty instance.
      • longParam

        public MethodParam longParam​(String propName,
                                     Long defaultValue)
        Generates a MethodParam representing a long test element property.
        Parameters:
        propName - is the name of the property holding a long value. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        defaultValue - is the default value used by the test element for this property.
        Returns:
        the MethodParam instance.
        Throws:
        UnsupportedOperationException - when no long can be parsed from the property value.
        Since:
        1.10
      • longParam

        public MethodParam longParam​(String propName)
        Same as longParam(String, Long) but with no default value.
        Parameters:
        propName - is the name of the property holding a long value. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        Returns:
        the MethodParam instance.
        Throws:
        UnsupportedOperationException - when no long can be parsed from the property value.
        Since:
        0.61
      • floatParam

        public MethodParam floatParam​(String propName)
        Generates a MethodParam representing a float test element property.
        Parameters:
        propName - is the name of the property holding a float value. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        Returns:
        the MethodParam instance.
        Throws:
        UnsupportedOperationException - when no float can be parsed from the property value.
        Since:
        0.63
      • doubleParam

        public MethodParam doubleParam​(String propName)
        Generates a MethodParam representing a double test element property.
        Parameters:
        propName - is the name of the property holding a double value. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        Returns:
        the MethodParam instance.
        Throws:
        UnsupportedOperationException - when no double can be parsed from the property value.
        Since:
        0.61
      • stringParam

        public MethodParam stringParam​(String propName,
                                       String defaultValue)
        Gets a MethodParam for a string test element property.
        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        defaultValue - the default value assigned to the JMeter test element property.
        Returns:
        the MethodParam instance.
      • stringParam

        public MethodParam stringParam​(String propName)
        Same as stringParam(String, String) but with no default value.
        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        Returns:
        the MethodParam instance.
        See Also:
        stringParam(String, String)
      • boolParam

        public MethodParam boolParam​(String propName,
                                     boolean defaultValue)
        Gets a MethodParam representing a boolean test element property.
        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        defaultValue - the default value assigned to the JMeter test element property.
        Returns:
        the MethodParam instance.
      • durationParam

        public MethodParam durationParam​(String propName,
                                         Duration defaultValue)
        Gets a MethodParam representing a test element property containing a duration (in seconds).
        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        defaultValue - the default value assigned to the JMeter test element property.
        Returns:
        the MethodParam instance.
      • durationParamMillis

        public MethodParam durationParamMillis​(String propName,
                                               Duration defaultValue)
        Gets a MethodParam representing a test element property containing a duration (in milliseconds).
        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        defaultValue - the default value assigned to the JMeter test element property.
        Returns:
        the MethodParam instance.
      • enumParam

        public <T extends Enum<?> & EnumParam.EnumPropertyValueMethodParam enumParam​(String propName,
                                                                                       T defaultValue)
        Gets a MethodParam representing a test element property with a restricted set (enumerated) of string values.
        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        defaultValue - the default value assigned to the JMeter test element property.
        Returns:
        the MethodParam instance.
        Since:
        0.62
      • encodingParam

        public MethodParam encodingParam​(String propName,
                                         Charset defaultValue)
        Gets a MethodParam representing a test element property containing an encoding (Charset).
        Parameters:
        propName - is the name of the property. For nested properties (a property that is inside another object property) you can use the slash character to separate the levels (eg: http_config/use_proxy).
        defaultValue - the default value assigned to the JMeter test element property.
        Returns:
        the MethodParam instance.
        Since:
        0.62