|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jmeter.samplers.SampleResult
public class SampleResult
This is a nice packaging for the various information returned from taking a sample of an entry.
Field Summary | |
---|---|
static java.lang.String |
BINARY
Data type value indicating that the response data is binary. |
static java.lang.String |
DEFAULT_HTTP_ENCODING
The default encoding to be used if not overridden. |
static java.lang.String |
TEXT
Data type value indicating that the response data is text. |
Constructor Summary | |
---|---|
|
SampleResult()
|
protected |
SampleResult(long elapsed,
boolean atend)
Create a sample with a specific elapsed time but don't allow the times to be changed later (only used by HTTPSampleResult) |
|
SampleResult(long stamp,
long elapsed)
Allow users to create a sample with specific timestamp and elapsed times for cloning purposes, but don't allow the times to be changed later Currently used by OldSaveService, CSVSaveService and StatisticalSampleResult |
|
SampleResult(SampleResult res)
Construct a 'parent' result for an already-existing result, essentially cloning it |
Method Summary | |
---|---|
void |
addAssertionResult(AssertionResult assertResult)
|
void |
addSubResult(SampleResult subResult)
|
void |
configure(Configuration info)
|
static SampleResult |
createTestSample(long elapsed)
Create a sample with a specific elapsed time for test purposes, but don't allow the times to be changed later |
static SampleResult |
createTestSample(long start,
long end)
Create a sample with specific start and end times for test purposes, but don't allow the times to be changed later (used by StatVisualizerModel.Test) |
static long |
currentTimeInMs()
|
int |
getAllThreads()
|
AssertionResult[] |
getAssertionResults()
Gets the assertion results associated with this sample. |
int |
getBytes()
return the bytes returned by the response. |
java.lang.String |
getContentType()
|
java.lang.String |
getDataEncoding()
Deprecated. use getDataEncodingWithDefault() or getDataEncodingNoDefault() as needed. |
java.lang.String |
getDataEncodingNoDefault()
Returns the dataEncoding. |
java.lang.String |
getDataEncodingWithDefault()
Returns the dataEncoding or the default if no dataEncoding was provided |
java.lang.String |
getDataType()
|
long |
getEndTime()
|
int |
getErrorCount()
Returns the count of errors. |
int |
getGroupThreads()
|
long |
getIdleTime()
|
long |
getLatency()
|
java.lang.String |
getMediaType()
Get the media type from the Content Type |
SampleResult |
getParent()
|
java.lang.String |
getRequestHeaders()
|
java.lang.String |
getResponseCode()
|
byte[] |
getResponseData()
Gets the responseData attribute of the SampleResult object. |
java.lang.String |
getResponseDataAsString()
Gets the responseData of the SampleResult object as a String |
java.lang.String |
getResponseHeaders()
|
java.lang.String |
getResponseMessage()
|
java.lang.String |
getResultFileName()
|
int |
getSampleCount()
return the sample count. by default, the value is 1. |
java.lang.String |
getSampleLabel()
|
java.lang.String |
getSampleLabel(boolean includeGroup)
Get the sample label for use in summary reports etc. |
java.lang.String |
getSamplerData()
|
SampleSaveConfiguration |
getSaveConfig()
|
long |
getStartTime()
|
SampleResult[] |
getSubResults()
Gets the subresults associated with this sample. |
java.lang.String |
getThreadName()
|
long |
getTime()
Get the time it took this sample to occur. |
long |
getTimeStamp()
Get the sample timestamp, which may be either the start time or the end time. |
java.net.URL |
getURL()
|
java.lang.String |
getUrlAsString()
Get a String representation of the URL (if defined). |
boolean |
isMonitor()
If the sampler is a monitor, method will return true. |
boolean |
isResponseCodeOK()
|
boolean |
isStampedAtStart()
|
boolean |
isStopTest()
|
boolean |
isStopTestNow()
|
boolean |
isStopThread()
|
boolean |
isSuccessful()
|
void |
latencyEnd()
Set the time to the first response |
boolean |
markFile(java.lang.String filename)
Set the "marked" flag to show that the result has been written to the file. |
void |
sampleEnd()
Record the end time of a sample and calculate the elapsed time |
void |
samplePause()
Pause a sample |
void |
sampleResume()
Resume a sample |
void |
sampleStart()
Record the start time of a sample |
void |
setAllThreads(int n)
|
void |
setBytes(int length)
In the event the sampler does want to pass back the actual contents, we still want to calculate the throughput. |
void |
setContentType(java.lang.String string)
Stores the content-type string, e.g. |
void |
setDataEncoding(java.lang.String dataEncoding)
Sets the dataEncoding. |
void |
setDataType(java.lang.String dataType)
|
void |
setEncodingAndType(java.lang.String ct)
Extract and save the DataEncoding and DataType from the parameter provided. |
protected void |
setEndTime(long end)
|
void |
setErrorCount(int i)
|
void |
setGroupThreads(int n)
|
void |
setLatency(long latency)
This is only intended for use by SampleResultConverter! |
void |
setMonitor(boolean monitor)
When a Sampler is working as a monitor |
void |
setParent(SampleResult parent)
|
void |
setRequestHeaders(java.lang.String string)
|
void |
setResponseCode(java.lang.String code)
|
void |
setResponseCodeOK()
Set response code to OK, i.e. "200" |
void |
setResponseData(byte[] response)
Sets the responseData attribute of the SampleResult object. |
void |
setResponseData(java.lang.String response)
Deprecated. - only intended for use from BeanShell code |
void |
setResponseHeaders(java.lang.String string)
|
void |
setResponseMessage(java.lang.String msg)
|
void |
setResponseMessageOK()
|
void |
setResultFileName(java.lang.String resultFileName)
|
void |
setSampleCount(int count)
For the JMS sampler, it can perform multiple samples for greater degree of accuracy. |
void |
setSampleLabel(java.lang.String label)
|
void |
setSamplerData(java.lang.String s)
|
void |
setSaveConfig(SampleSaveConfiguration propertiesToSave)
|
void |
setStampAndTime(long stamp,
long elapsed)
|
protected void |
setStartTime(long start)
|
void |
setStopTest(boolean b)
|
void |
setStopTestNow(boolean b)
|
void |
setStopThread(boolean b)
|
void |
setSuccessful(boolean success)
Sets the successful attribute of the SampleResult object. |
void |
setThreadName(java.lang.String threadName)
|
void |
setTime(long elapsed)
Deprecated. use sampleStart() and sampleEnd() instead |
void |
setTimeStamp(long timeStamp)
This is only intended for use by SampleResultConverter! |
void |
setURL(java.net.URL location)
|
void |
storeSubResult(SampleResult subResult)
Add a subresult read from a results file. |
java.lang.String |
toString()
Returns the display name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_HTTP_ENCODING
public static final java.lang.String TEXT
getDataType()
,
setDataType(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String BINARY
getDataType()
,
setDataType(java.lang.String)
,
Constant Field ValuesConstructor Detail |
---|
public SampleResult()
public SampleResult(SampleResult res)
res
- existing sample resultprotected SampleResult(long elapsed, boolean atend)
elapsed
- timeatend
- create the sample finishing now, else starting nowpublic SampleResult(long stamp, long elapsed)
stamp
- -
this may be a start time or an end timeelapsed
- Method Detail |
---|
public void setSaveConfig(SampleSaveConfiguration propertiesToSave)
propertiesToSave
- The propertiesToSave to set.public SampleSaveConfiguration getSaveConfig()
public boolean isStampedAtStart()
public static SampleResult createTestSample(long start, long end)
start
- start timeend
- end timepublic static SampleResult createTestSample(long elapsed)
elapsed
- -
desired elapsed timepublic static long currentTimeInMs()
public void setStampAndTime(long stamp, long elapsed)
public void setTime(long elapsed)
elapsed
- time in millisecondspublic boolean markFile(java.lang.String filename)
filename
-
public java.lang.String getResponseCode()
public void setResponseCodeOK()
public void setResponseCode(java.lang.String code)
public boolean isResponseCodeOK()
public java.lang.String getResponseMessage()
public void setResponseMessage(java.lang.String msg)
public void setResponseMessageOK()
public java.lang.String getThreadName()
public void setThreadName(java.lang.String threadName)
public long getTimeStamp()
getStartTime()
,
getEndTime()
public java.lang.String getSampleLabel()
public java.lang.String getSampleLabel(boolean includeGroup)
includeGroup
- whether to include the thread group name
public void setSampleLabel(java.lang.String label)
public void addAssertionResult(AssertionResult assertResult)
public AssertionResult[] getAssertionResults()
public void addSubResult(SampleResult subResult)
public void storeSubResult(SampleResult subResult)
subResult
- public SampleResult[] getSubResults()
public void configure(Configuration info)
public void setResponseData(byte[] response)
response
- the new responseData valuepublic void setResponseData(java.lang.String response)
response
- the new responseData value (String)public byte[] getResponseData()
Note that some samplers may not store all the data, in which case
getResponseData().length will be incorrect.
Instead, always use getBytes()
to obtain the sample result byte count.
public java.lang.String getResponseDataAsString()
public void setSamplerData(java.lang.String s)
public java.lang.String getSamplerData()
public long getTime()
public boolean isSuccessful()
public void setDataType(java.lang.String dataType)
public java.lang.String getDataType()
public void setEncodingAndType(java.lang.String ct)
ct
- - content type (may be null)which should be used to save the full content-type string
public void setSuccessful(boolean success)
success
- the new successful valuepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDataEncoding()
public java.lang.String getDataEncodingWithDefault()
public java.lang.String getDataEncodingNoDefault()
public void setDataEncoding(java.lang.String dataEncoding)
dataEncoding
- the dataEncoding to set, e.g. ISO-8895-1, UTF-8public boolean isStopTest()
public boolean isStopTestNow()
public boolean isStopThread()
public void setStopTest(boolean b)
public void setStopTestNow(boolean b)
public void setStopThread(boolean b)
public java.lang.String getRequestHeaders()
public java.lang.String getResponseHeaders()
public void setRequestHeaders(java.lang.String string)
string
- -
request headerspublic void setResponseHeaders(java.lang.String string)
string
- -
response headerspublic java.lang.String getContentType()
public java.lang.String getMediaType()
public void setContentType(java.lang.String string)
string
- which can be used to extract the charset.
public long getIdleTime()
public long getEndTime()
public long getStartTime()
protected final void setStartTime(long start)
protected void setEndTime(long end)
public void sampleStart()
public void sampleEnd()
public void samplePause()
public void sampleResume()
public void setMonitor(boolean monitor)
monitor
- public boolean isMonitor()
public void setSampleCount(int count)
count
- public int getSampleCount()
public int getErrorCount()
public void setErrorCount(int i)
public void setBytes(int length)
length
- public int getBytes()
public long getLatency()
public void latencyEnd()
public void setLatency(long latency)
latency
- The latency to set.public void setTimeStamp(long timeStamp)
timeStamp
- The timeStamp to set.public void setURL(java.net.URL location)
public java.net.URL getURL()
public java.lang.String getUrlAsString()
public SampleResult getParent()
public void setParent(SampleResult parent)
parent
- The parent to set.public java.lang.String getResultFileName()
public void setResultFileName(java.lang.String resultFileName)
public int getGroupThreads()
public void setGroupThreads(int n)
public int getAllThreads()
public void setAllThreads(int n)
|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |