Home » jakarta-jmeter-2.3.4_src » org.apache.jmeter.samplers » [javadoc | source]
org.apache.jmeter.samplers
public class: SampleResult [javadoc | source]
java.lang.Object
   org.apache.jmeter.samplers.SampleResult

All Implemented Interfaces:
    Serializable

Direct Known Subclasses:
    HTTPSampleResult, StatisticalSampleResult

This is a nice packaging for the various information returned from taking a sample of an entry.
Field Summary
static final  Logger log     
public static final  String DEFAULT_HTTP_ENCODING    The default encoding to be used if not overridden. The value is ISO-8859-1. 
static final  String DEFAULT_ENCODING    The default encoding to be used to decode the responseData byte array. The value is defined by the property "sampleresult.default.encoding" with a default of DEFAULT_HTTP_ENCODING if that is not defined. 
public static final  String TEXT    Data type value indicating that the response data is text. 
public static final  String BINARY    Data type value indicating that the response data is binary. 
Constructor:
 public SampleResult() 
 public SampleResult(SampleResult res) 
    Construct a 'parent' result for an already-existing result, essentially cloning it
    Parameters:
    res - existing sample result
 protected SampleResult(long elapsed,
    boolean atend) 
 public SampleResult(long stamp,
    long elapsed) 
Method from org.apache.jmeter.samplers.SampleResult Summary:
addAssertionResult,   addSubResult,   configure,   createTestSample,   createTestSample,   currentTimeInMs,   getAllThreads,   getAssertionResults,   getBytes,   getContentType,   getDataEncoding,   getDataEncodingNoDefault,   getDataEncodingWithDefault,   getDataType,   getEndTime,   getErrorCount,   getGroupThreads,   getIdleTime,   getLatency,   getMediaType,   getParent,   getRequestHeaders,   getResponseCode,   getResponseData,   getResponseDataAsString,   getResponseHeaders,   getResponseMessage,   getResultFileName,   getSampleCount,   getSampleLabel,   getSampleLabel,   getSamplerData,   getSaveConfig,   getStartTime,   getSubResults,   getThreadName,   getTime,   getTimeStamp,   getURL,   getUrlAsString,   isMonitor,   isResponseCodeOK,   isStampedAtStart,   isStopTest,   isStopTestNow,   isStopThread,   isSuccessful,   latencyEnd,   markFile,   sampleEnd,   samplePause,   sampleResume,   sampleStart,   setAllThreads,   setBytes,   setContentType,   setDataEncoding,   setDataType,   setEncodingAndType,   setEndTime,   setErrorCount,   setGroupThreads,   setLatency,   setMonitor,   setParent,   setRequestHeaders,   setResponseCode,   setResponseCodeOK,   setResponseData,   setResponseData,   setResponseHeaders,   setResponseMessage,   setResponseMessageOK,   setResultFileName,   setSampleCount,   setSampleLabel,   setSamplerData,   setSaveConfig,   setStampAndTime,   setStartTime,   setStopTest,   setStopTestNow,   setStopThread,   setSuccessful,   setThreadName,   setTime,   setTimeStamp,   setURL,   storeSubResult,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.jmeter.samplers.SampleResult Detail:
 public  void addAssertionResult(AssertionResult assertResult) 
 public  void addSubResult(SampleResult subResult) 
 public  void configure(Configuration info) 
 public 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
 public 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)
 public static long currentTimeInMs() 
 public int getAllThreads() 
 public AssertionResult[] getAssertionResults() 
    Gets the assertion results associated with this sample.
 public int getBytes() 
    return the bytes returned by the response.
 public String getContentType() 
 public String getDataEncoding() 
Deprecated! use - getDataEncodingWithDefault() or getDataEncodingNoDefault() as needed.

    Returns the dataEncoding or the default if no dataEncoding was provided
 public String getDataEncodingNoDefault() 
    Returns the dataEncoding. May be null or the empty String.
 public String getDataEncodingWithDefault() 
    Returns the dataEncoding or the default if no dataEncoding was provided
 public String getDataType() 
 public long getEndTime() 
 public int getErrorCount() 
    Returns the count of errors.
 public int getGroupThreads() 
 public long getIdleTime() 
 public long getLatency() 
 public String getMediaType() 
    Get the media type from the Content Type
 public SampleResult getParent() 
 public String getRequestHeaders() 
 public String getResponseCode() 
 public byte[] getResponseData() 
    Gets the responseData attribute of the SampleResult object.

    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() 
    Gets the responseData of the SampleResult object as a String
 public String getResponseHeaders() 
 public String getResponseMessage() 
 public String getResultFileName() 
 public int getSampleCount() 
    return the sample count. by default, the value is 1.
 public String getSampleLabel() 
 public String getSampleLabel(boolean includeGroup) 
    Get the sample label for use in summary reports etc.
 public String getSamplerData() 
 public SampleSaveConfiguration getSaveConfig() 
 public long getStartTime() 
 public SampleResult[] getSubResults() 
    Gets the subresults associated with this sample.
 public String getThreadName() 
 public long getTime() 
    Get the time it took this sample to occur.
 public long getTimeStamp() 
    Get the sample timestamp, which may be either the start time or the end time.
 public URL getURL() 
 public String getUrlAsString() 
    Get a String representation of the URL (if defined).
 public boolean isMonitor() 
    If the sampler is a monitor, method will return true.
 public boolean isResponseCodeOK() 
 public boolean isStampedAtStart() 
 public boolean isStopTest() 
 public boolean isStopTestNow() 
 public boolean isStopThread() 
 public boolean isSuccessful() 
 public  void latencyEnd() 
    Set the time to the first response
 public synchronized boolean markFile(String filename) 
    Set the "marked" flag to show that the result has been written to the file.
 public  void sampleEnd() 
    Record the end time of a sample and calculate the elapsed time
 public  void samplePause() 
    Pause a sample
 public  void sampleResume() 
    Resume a sample
 public  void sampleStart() 
    Record the start time of a sample
 public  void setAllThreads(int n) 
 public  void setBytes(int length) 
    In the event the sampler does want to pass back the actual contents, we still want to calculate the throughput. The bytes is the bytes of the response data.
 public  void setContentType(String string) 
    Stores the content-type string, e.g. "text/xml; charset=utf-8"
 public  void setDataEncoding(String dataEncoding) 
    Sets the dataEncoding.
 public  void setDataType(String dataType) 
 public  void setEncodingAndType(String ct) 
    Extract and save the DataEncoding and DataType from the parameter provided. Does not save the full content Type.
 protected  void setEndTime(long end) 
 public  void setErrorCount(int i) 
 public  void setGroupThreads(int n) 
 public  void setLatency(long latency) 
    This is only intended for use by SampleResultConverter!
 public  void setMonitor(boolean monitor) 
    When a Sampler is working as a monitor
 public  void setParent(SampleResult parent) 
 public  void setRequestHeaders(String string) 
 public  void setResponseCode(String code) 
 public  void setResponseCodeOK() 
    Set response code to OK, i.e. "200"
 public  void setResponseData(byte[] response) 
    Sets the responseData attribute of the SampleResult object. If the parameter is null, then the responseData is set to an empty byte array. This ensures that getResponseData() can never be null.
 public  void setResponseData(String response) 
Deprecated! - - only intended for use from BeanShell code

    Sets the responseData attribute of the SampleResult object. Should only be called after setting the dataEncoding (if necessary)
 public  void setResponseHeaders(String string) 
 public  void setResponseMessage(String msg) 
 public  void setResponseMessageOK() 
 public  void setResultFileName(String resultFileName) 
 public  void setSampleCount(int count) 
    For the JMS sampler, it can perform multiple samples for greater degree of accuracy.
 public  void setSampleLabel(String label) 
 public  void setSamplerData(String s) 
 public  void setSaveConfig(SampleSaveConfiguration propertiesToSave) 
 public  void setStampAndTime(long stamp,
    long elapsed) 
 protected final  void setStartTime(long start) 
 public  void setStopTest(boolean b) 
 public  void setStopTestNow(boolean b) 
 public  void setStopThread(boolean b) 
 public  void setSuccessful(boolean success) 
    Sets the successful attribute of the SampleResult object.
 public  void setThreadName(String threadName) 
 public  void setTime(long elapsed) 
Deprecated! use - sampleStart() and sampleEnd() instead

    Method to set the elapsed time for a sample. Retained for backward compatibility with 3rd party add-ons. It is assumed that the method is only called at the end of a sample and that timeStamps are end-times Also used by SampleResultConverter when creating results from files. Must not be used in conjunction with sampleStart()/End()
 public  void setTimeStamp(long timeStamp) 
    This is only intended for use by SampleResultConverter!
 public  void setURL(URL location) 
 public  void storeSubResult(SampleResult subResult) 
    Add a subresult read from a results file. As for addSubResult(), except that the fields don't need to be accumulated
 public String toString() 
    Returns the display name.