JSR223 to Java.
#
Why Replacing JSR223 by Java.- Java can be edit easily with IDE and also debugged as simple as any java application.
- Using java we can use inheritance, and external library to reuse code and writing our library to be reused in future projects.
- Java has better performance tha groovy.
- Unit test.
#
Java Implementation.To Implement Java you can extends from AbstractJavaxxWrapper and implement execute method, depend on type of testElement, execute has the same input parameter as JSR223, expected the parameters witch is replaced by a map.
Class | Type | JSR223 equivalent |
---|---|---|
AbstractJavaSamplerWrapper | Sampler | JSR223Sampler |
AbstractJavaAssertionWrapper | Assertion | JSR223Assertion |
AbstractJavaPostProcessorWrapper | PostProcessor | JSR223PostProcessor |
AbstractJavaPreProcessorWrapper | PreProcessor | JSR223PreProcessor |
AbstractJavaTimerWrapper | Timer | JSR223Timer |
AbstractJavaListenerWrapper | Listener | JSR223Listener |
#
ExtendsJMC is based on lombok, each wrapper class should be annotated with :
@SuperBuilder(setterPrefix = "with", toBuilder = true)
#
Parameters#
Maptip
Map Parameters is preferable than attributes.
All JavaTest implementation can have parameter as Map < String,String > .
- addParameters(Map< String, String > parameters) : add list of key/value.
- addParameter(String name, String value) : add key/value.
- List< String > getParametersKey() : implement this method to validate parameters key: null to skip validation and empty list to not accept parameters.
Execute Method has the Parameters Map as arguments
#
Attributes (Beta)- Simple attribute (String,integer, boolean) can also be used for configuration.
- Complex attribute : complex attribute (List, Map , composed object, ..) can't be used to be persisted with JMX, but can be used during execution. All those attribute should be annotated with @JmcOmitField.
danger
Complex attribute should be skipped by annotation @JmcOmitField.