Class AbstractJavaSamplerClient
- All Implemented Interfaces:
JavaSamplerClient
See SleepTest
for an example of
how to extend this class.
While it may be necessary to make changes to the JavaSamplerClient interface from time to time (therefore requiring changes to any implementations of this interface), we intend to make this abstract class provide reasonable implementations of any new methods so that subclasses do not necessarily need to be updated for new versions. Therefore, when creating a new JavaSamplerClient implementation, developers are encouraged to subclass this abstract class rather than implementing the JavaSamplerClient interface directly. Implementing JavaSamplerClient directly will continue to be supported for cases where extending this class is not possible (for example, when the client class is already a subclass of some other class).
The runTest() method of JavaSamplerClient does not have a default implementation here, so subclasses must define at least this method. It may be useful to override other methods as well.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionProvide a list of parameters which this test supports.protected org.slf4j.Logger
Get a Logger instance which can be used by subclasses to log information.void
setupTest
(JavaSamplerContext context) Do any initialization required by this client.void
teardownTest
(JavaSamplerContext context) Do any clean-up required by this test at the end of a test run.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.jmeter.protocol.java.sampler.JavaSamplerClient
runTest
-
Constructor Details
-
AbstractJavaSamplerClient
public AbstractJavaSamplerClient()
-
-
Method Details
-
setupTest
Description copied from interface:JavaSamplerClient
Do any initialization required by this client. It is generally recommended to do any initialization such as getting parameter values in the setupTest method rather than the runTest method in order to add as little overhead as possible to the test.- Specified by:
setupTest
in interfaceJavaSamplerClient
- Parameters:
context
- the context to run with. This provides access to initialization parameters.
-
teardownTest
Description copied from interface:JavaSamplerClient
Do any clean-up required by this test at the end of a test run.- Specified by:
teardownTest
in interfaceJavaSamplerClient
- Parameters:
context
- the context to run with. This provides access to initialization parameters.
-
getDefaultParameters
Description copied from interface:JavaSamplerClient
Provide a list of parameters which this test supports. Any parameter names and associated values returned by this method will appear in the GUI by default so the user doesn't have to remember the exact names. The user can add other parameters which are not listed here. If this method returns null then no parameters will be listed. If the value for some parameter is null then that parameter will be listed in the GUI with an empty value.- Specified by:
getDefaultParameters
in interfaceJavaSamplerClient
- Returns:
- a specification of the parameters used by this test which should be listed in the GUI, or null if no parameters should be listed.
-
getNewLogger
protected org.slf4j.Logger getNewLogger()Get a Logger instance which can be used by subclasses to log information. This is the same Logger which is used by the base JavaSampler classes (jmeter.protocol.java).- Returns:
Logger
instance which can be used for logging
-