Class TestElementParamBuilder
- java.lang.Object
-
- us.abstracta.jmeter.javadsl.codegeneration.TestElementParamBuilder
-
public class TestElementParamBuilder extends Object
Is a wrapper class forTestElementfor easy creation ofMethodParaminstances.- Since:
- 0.45
-
-
Constructor Summary
Constructors Constructor Description TestElementParamBuilder(org.apache.jmeter.testelement.TestElement testElement)Creates an instance for a givenTestElement.TestElementParamBuilder(org.apache.jmeter.testelement.TestElement testElement, String propsPrefix)Same asTestElementParamBuilder(TestElement)but allowing to define a common properties prefix for the test element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodParamboolParam(String propName, boolean defaultValue)Gets a MethodParam representing a boolean test element property.<V,T extends MethodParam>
MethodParambuildParam(String propName, BiFunction<String,V,T> builder, V defaultValue)MethodParamdoubleParam(String propName)Generates a MethodParam representing a double test element property.MethodParamdurationParam(String propName)Same asdurationParam(String, Duration)but with no default value.MethodParamdurationParam(String propName, Duration defaultValue)Gets a MethodParam representing a test element property containing a duration (in seconds).MethodParamdurationParamMillis(String propName, Duration defaultValue)Gets a MethodParam representing a test element property containing a duration (in milliseconds).MethodParamencodingParam(String propName, Charset defaultValue)Gets a MethodParam representing a test element property containing an encoding (Charset).<T extends Enum<?> & EnumParam.EnumPropertyValue>
MethodParamenumParam(String propName, T defaultValue)Gets a MethodParam representing a test element property with a restricted set (enumerated) of string values.MethodParamfloatParam(String propName)Generates a MethodParam representing a float test element property.MethodParamintParam(String propName)Same asintParam(String, Integer)but with no default value.MethodParamintParam(String propName, Integer defaultValue)Generates a MethodParam representing an integer test element property.MethodParamlongParam(String propName)Same aslongParam(String, Long)but with no default value.MethodParamlongParam(String propName, Long defaultValue)Generates a MethodParam representing a long test element property.NameParamnameParam(String defaultName)Generates a MethodParam representing a test element name.org.apache.jmeter.testelement.property.JMeterPropertyprop(String propName)Gets theJMeterPropertyinstance for the given test element and property name.MethodParamstringParam(String propName)Same asstringParam(String, String)but with no default value.MethodParamstringParam(String propName, String defaultValue)Gets a MethodParam for a string test element property.
-
-
-
Constructor Detail
-
TestElementParamBuilder
public TestElementParamBuilder(org.apache.jmeter.testelement.TestElement testElement)
Creates an instance for a givenTestElement.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 asTestElementParamBuilder(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 asintParam(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
MethodParaminstance. - See Also:
intParam(String, Integer)
-
buildParam
public <V,T extends MethodParam> MethodParam buildParam(String propName, BiFunction<String,V,T> builder, V defaultValue)
-
prop
public org.apache.jmeter.testelement.property.JMeterProperty prop(String propName)
Gets theJMeterPropertyinstance 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
JMeterPropertyinstance.
-
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 aslongParam(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
MethodParaminstance.
-
stringParam
public MethodParam stringParam(String propName)
Same asstringParam(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
MethodParaminstance. - 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
MethodParaminstance.
-
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
MethodParaminstance.
-
durationParam
public MethodParam durationParam(String propName)
Same asdurationParam(String, Duration)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
MethodParaminstance. - See Also:
durationParam(String, Duration)
-
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
MethodParaminstance.
-
enumParam
public <T extends Enum<?> & EnumParam.EnumPropertyValue> MethodParam 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
MethodParaminstance. - 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
MethodParaminstance. - Since:
- 0.62
-
-