|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient org.apache.jmeter.protocol.java.test.SleepTest
public class SleepTest
The SleepTest
class is a simple example class for a JMeter
Java protocol client. The class implements the JavaSamplerClient
interface.
During each sample, this client will sleep for some amount of time. The amount of time to sleep is determined from the two parameters SleepTime and SleepMask using the formula:
totalSleepTime = SleepTime + (System.currentTimeMillis() % SleepMask)Thus, the SleepMask provides a way to add a random component to the sleep time.
Field Summary | |
---|---|
static long |
DEFAULT_SLEEP_MASK
The default value of the SleepMask parameter. |
static long |
DEFAULT_SLEEP_TIME
The default value of the SleepTime parameter, in milliseconds. |
Constructor Summary | |
---|---|
SleepTest()
Default constructor for SleepTest . |
Method Summary | |
---|---|
Arguments |
getDefaultParameters()
Provide a list of parameters which this test supports. |
SampleResult |
runTest(JavaSamplerContext context)
Perform a single sample. |
void |
setupTest(JavaSamplerContext context)
Do any initialization required by this client. |
Methods inherited from class org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient |
---|
getLogger, teardownTest |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_SLEEP_TIME
public static final long DEFAULT_SLEEP_MASK
Constructor Detail |
---|
public SleepTest()
SleepTest
.
The Java Sampler uses the default constructor to instantiate an instance
of the client class.
Method Detail |
---|
public void setupTest(JavaSamplerContext context)
setupTest
in interface JavaSamplerClient
setupTest
in class AbstractJavaSamplerClient
context
- the context to run with. This provides access to
initialization parameters.public SampleResult runTest(JavaSamplerContext context)
SampleResult
object.
SampleResult
has many fields which can be used. At a
minimum, the test should use SampleResult.sampleStart
and
SampleResult.sampleEnd
to set the time that the test
required to execute. It is also a good idea to set the sampleLabel and
the successful flag.
runTest
in interface JavaSamplerClient
context
- the context to run with. This provides access to
initialization parameters.
SampleResult.sampleStart()
,
SampleResult.sampleEnd()
,
SampleResult.setSuccessful(boolean)
,
SampleResult.setSampleLabel(String)
public Arguments getDefaultParameters()
getDefaultParameters
in interface JavaSamplerClient
getDefaultParameters
in class AbstractJavaSamplerClient
|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |