|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 String |
BINARY
Data type value indicating that the response data is binary. |
static String |
DEFAULT_HTTP_ENCODING
The default encoding to be used if not overridden. |
static 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)
Copy constructor. |
Method Summary | |
---|---|
void |
addAssertionResult(AssertionResult assertResult)
|
void |
addRawSubResult(SampleResult subResult)
Add a subresult to the collection without updating any parent fields. |
void |
addSubResult(SampleResult subResult)
Add a subresult and adjust the parent byte count and end-time. |
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) |
long |
currentTimeInMillis()
|
int |
getAllThreads()
|
AssertionResult[] |
getAssertionResults()
Gets the assertion results associated with this sample. |
int |
getBodySize()
|
int |
getBytes()
return the bytes returned by the response. |
String |
getContentType()
|
String |
getDataEncodingNoDefault()
Returns the dataEncoding. |
String |
getDataEncodingWithDefault()
Returns the dataEncoding or the default if no dataEncoding was provided. |
protected String |
getDataEncodingWithDefault(String defaultEncoding)
Returns the dataEncoding or the default if no dataEncoding was provided. |
String |
getDataType()
|
long |
getEndTime()
|
int |
getErrorCount()
Returns the count of errors. |
int |
getGroupThreads()
|
int |
getHeadersSize()
Get the headers size in bytes |
long |
getIdleTime()
|
long |
getLatency()
|
String |
getMediaType()
Get the media type from the Content Type |
SampleResult |
getParent()
|
String |
getRequestHeaders()
|
String |
getResponseCode()
|
byte[] |
getResponseData()
Gets the responseData attribute of the SampleResult object. |
String |
getResponseDataAsString()
Gets the responseData of the SampleResult object as a String |
String |
getResponseHeaders()
|
String |
getResponseMessage()
|
String |
getResultFileName()
|
int |
getSampleCount()
return the sample count. by default, the value is 1. |
String |
getSampleLabel()
|
String |
getSampleLabel(boolean includeGroup)
Get the sample label for use in summary reports etc. |
String |
getSamplerData()
|
SampleSaveConfiguration |
getSaveConfig()
|
long |
getStartTime()
|
SampleResult[] |
getSubResults()
Gets the subresults associated with this sample. |
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. |
URL |
getURL()
|
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(String filename)
Set the "marked" flag to show that the result has been written to the file. |
void |
removeAssertionResults()
Allow custom SampleSenders to drop unwanted assertionResults |
void |
removeSubResults()
Allow custom SampleSenders to drop unwanted subResults |
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 |
setBodySize(int bodySize)
|
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(String string)
Stores the content-type string, e.g. |
void |
setDataEncoding(String dataEncoding)
Sets the dataEncoding. |
void |
setDataType(String dataType)
|
void |
setEncodingAndType(String ct)
Extract and save the DataEncoding and DataType from the parameter provided. |
void |
setEndTime(long end)
|
void |
setErrorCount(int i)
|
void |
setGroupThreads(int n)
|
void |
setHeadersSize(int size)
Set the headers size in bytes |
void |
setIdleTime(long idle)
Set idle time pause. |
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(String string)
|
void |
setResponseCode(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(String response)
Deprecated. - only intended for use from BeanShell code |
void |
setResponseData(String response,
String encoding)
Sets the encoding and responseData attributes of the SampleResult object. |
void |
setResponseHeaders(String string)
|
void |
setResponseMessage(String msg)
|
void |
setResponseMessageOK()
|
void |
setResponseOK()
Set result statuses OK - shorthand method to set: ResponseCode ResponseMessage Successful status |
void |
setResultFileName(String resultFileName)
|
void |
setSampleCount(int count)
The statistical sample sender aggregates several samples to save on transmission costs. |
void |
setSampleLabel(String label)
|
void |
setSamplerData(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(String threadName)
|
void |
setTimeStamp(long timeStamp)
This is only intended for use by SampleResultConverter! |
void |
setURL(URL location)
|
void |
storeSubResult(SampleResult subResult)
Add a subresult read from a results file. |
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 String DEFAULT_HTTP_ENCODING
public static final String TEXT
getDataType()
,
setDataType(java.lang.String)
,
Constant Field Valuespublic static final 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 long currentTimeInMillis()
public void setStampAndTime(long stamp, long elapsed)
public boolean markFile(String filename)
filename
-
public String getResponseCode()
public void setResponseCodeOK()
public void setResponseCode(String code)
public boolean isResponseCodeOK()
public String getResponseMessage()
public void setResponseMessage(String msg)
public void setResponseMessageOK()
public void setResponseOK()
public String getThreadName()
public void setThreadName(String threadName)
public long getTimeStamp()
getStartTime()
,
getEndTime()
public String getSampleLabel()
public String getSampleLabel(boolean includeGroup)
includeGroup
- whether to include the thread group name
public void setSampleLabel(String label)
public void addAssertionResult(AssertionResult assertResult)
public AssertionResult[] getAssertionResults()
public void addSubResult(SampleResult subResult)
subResult
- public void addRawSubResult(SampleResult subResult)
subResult
- public void storeSubResult(SampleResult subResult)
subResult
- public SampleResult[] getSubResults()
public void setResponseData(byte[] response)
response
- the new responseData value@Deprecated public void setResponseData(String response)
response
- the new responseData value (String)public void setResponseData(String response, String encoding)
response
- the new responseData value (String)encoding
- the encoding to set and then use (if null, use platform default)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 String getResponseDataAsString()
public void setSamplerData(String s)
public String getSamplerData()
public long getTime()
public boolean isSuccessful()
public void setDataType(String dataType)
public String getDataType()
public void setEncodingAndType(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 String toString()
toString
in class Object
public String getDataEncodingWithDefault()
protected String getDataEncodingWithDefault(String defaultEncoding)
defaultEncoding
- the default to be applied
public String getDataEncodingNoDefault()
public void setDataEncoding(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 String getRequestHeaders()
public String getResponseHeaders()
public void setRequestHeaders(String string)
string
- -
request headerspublic void setResponseHeaders(String string)
string
- -
response headerspublic String getContentType()
public String getMediaType()
public void setContentType(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)
public void setEndTime(long end)
public void setIdleTime(long idle)
idle
- longpublic 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
- number of samples represented by this instancepublic 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(URL location)
public URL getURL()
public String getUrlAsString()
public SampleResult getParent()
public void setParent(SampleResult parent)
parent
- The parent to set.public String getResultFileName()
public void setResultFileName(String resultFileName)
public int getGroupThreads()
public void setGroupThreads(int n)
public int getAllThreads()
public void setAllThreads(int n)
public void removeAssertionResults()
public void removeSubResults()
public void setHeadersSize(int size)
size
- public int getHeadersSize()
public int getBodySize()
public void setBodySize(int bodySize)
bodySize
- the body size to set
|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |