Package org.apache.jmeter.samplers
Class SampleEvent
java.lang.Object
org.apache.jmeter.samplers.SampleEvent
- All Implemented Interfaces:
Serializable
Packages information regarding the target of a sample event, such as the
result from that event and the thread group it ran in.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructor used for Unit tests only.SampleEvent
(SampleResult result, String threadGroup) Creates SampleEvent without saving any variables.SampleEvent
(SampleResult result, String threadGroup, String hostname) Only intended for use when loading results from a file.SampleEvent
(SampleResult result, String threadGroup, JMeterVariables jmvars) Constructor used for normal samples, saves variable values if any are defined.SampleEvent
(SampleResult result, String threadGroup, JMeterVariables jmvars, boolean isTransactionSampleEvent) -
Method Summary
Modifier and TypeMethodDescriptionGet the name of the host for which this event was recordedGet theSampleResult
associated with this eventGet the name of the thread group for which this event was recordedstatic int
Get the number of defined variablesstatic String
getVarName
(int i) Get the nth variable name (zero-based)getVarValue
(int i) Get the nth variable value (zero-based)static void
Set up the additional variable names to be saved from the value in theSAMPLE_VARIABLES
propertyboolean
toString()
-
Field Details
-
SAMPLE_VARIABLES
The property "sample_variables" is used to define additional variables to be saved- See Also:
-
HOSTNAME
-
-
Constructor Details
-
SampleEvent
public SampleEvent()Constructor used for Unit tests only. Usesnull
for the associatedSampleResult
and thethreadGroup
-name. -
SampleEvent
Creates SampleEvent without saving any variables.- Parameters:
result
- The SampleResult to be associated with this eventthreadGroup
- The name of the thread, theSampleResult
was recorded
-
SampleEvent
Constructor used for normal samples, saves variable values if any are defined.- Parameters:
result
- The SampleResult to be associated with this eventthreadGroup
- The name of the thread, theSampleResult
was recordedjmvars
- theJMeterVariables
of the thread, theSampleResult
was recorded
-
SampleEvent
Only intended for use when loading results from a file.- Parameters:
result
- The SampleResult to be associated with this eventthreadGroup
- The name of the thread, theSampleResult
was recordedhostname
- The name of the host, for which theSampleResult
was recorded
-
SampleEvent
public SampleEvent(SampleResult result, String threadGroup, JMeterVariables jmvars, boolean isTransactionSampleEvent) - Parameters:
result
- The SampleResult to be associated with this eventthreadGroup
- The name of the thread, theSampleResult
was recordedjmvars
- theJMeterVariables
of the thread, theSampleResult
was recordedisTransactionSampleEvent
- Flag whether this event is an transaction sample event
-
-
Method Details
-
initSampleVariables
public static void initSampleVariables()Set up the additional variable names to be saved from the value in theSAMPLE_VARIABLES
property -
getVarCount
public static int getVarCount()Get the number of defined variables- Returns:
- the number of variables defined
-
getVarName
Get the nth variable name (zero-based)- Parameters:
i
- specifies which variable name should be returned (zero-based)- Returns:
- the variable name of the nth variable
-
getVarValue
Get the nth variable value (zero-based)- Parameters:
i
- specifies which variable value should be returned (zero-based)- Returns:
- the value of the nth variable
- Throws:
JMeterError
- when an invalid indexi
was given
-
getResult
Get theSampleResult
associated with this event- Returns:
- the associated
SampleResult
-
getThreadGroup
Get the name of the thread group for which this event was recorded- Returns:
- the name of the thread group
-
getHostname
Get the name of the host for which this event was recorded- Returns:
- the name of the host
-
isTransactionSampleEvent
public boolean isTransactionSampleEvent()- Returns:
- the isTransactionSampleEvent
-
toString
-