Apache JMeter
2.0.1.20050615

org.apache.jmeter.save
Class SaveService

java.lang.Object
  extended byorg.apache.jmeter.save.SaveService
All Implemented Interfaces:
SaveServiceConstants

public final class SaveService
extends Object
implements SaveServiceConstants

This class provides a means for saving test results. Test results are typically saved in an XML file, but other storage mechanisms may also be used, for instance, CSV files or databases.

Version:
$Revision: 1.37.2.1 $ $Date: 2004/06/12 18:32:04 $
Author:
Mike Stover, Keith Cassell

Nested Class Summary
static class SaveService.Test
           
 
Field Summary
protected static int assertionsResultsToSave
           
protected static String defaultDelimiter
          The string used to separate fields when stored to disk, for example, the comma for CSV files.
protected static SimpleDateFormat formatter
          A formatter for the time stamp.
protected static int outputFormat
          A flag to indicate which output format to use for results.
protected static boolean printFieldNames
          A flag to indicate whether to print the field names for delimited result files.
protected static boolean printMilliseconds
          A flag to indicate whether the time stamp should be printed in milliseconds.
protected static int SAVE_ALL_ASSERTIONS
           
protected static int SAVE_FIRST_ASSERTION
           
protected static int SAVE_NO_ASSERTIONS
           
protected static boolean saveAssertionResultsFailureMessage
          A flag to indicate whether the assertion result's failure message should be saved to the test results.
protected static boolean saveDataType
          A flag to indicate whether the data type should be saved to the test results.
protected static boolean saveLabel
          A flag to indicate whether the label should be saved to the test results.
protected static boolean saveResponseCode
          A flag to indicate whether the response code should be saved to the test results.
protected static boolean saveResponseData
          A flag to indicate whether the response data should be saved to the test results.
protected static boolean saveResponseMessage
          A flag to indicate whether the response message should be saved to the test results.
protected static boolean saveSuccessful
          A flag to indicate whether the success indicator should be saved to the test results.
protected static boolean saveThreadName
          A flag to indicate whether the thread name should be saved to the test results.
protected static boolean saveTime
          A flag to indicate whether the time should be saved to the test results.
protected static String timeStampFormat
          A flag to indicate the format of the time stamp within the test results.
protected static String whichAssertionResults
          A flag to indicate which assertion results should be saved to the test results.
 
Fields inherited from interface org.apache.jmeter.save.SaveServiceConstants
ALL, ASSERTION_RESULT_TAG_NAME, ASSERTION_RESULTS_FAILURE_MESSAGE_PROP, ASSERTION_RESULTS_PROP, BINARY, CSV, DATA_TYPE, DATABASE, DEFAULT_DELIMITER_PROP, ERROR, FAILURE, FAILURE_MESSAGE, FALSE, FIRST, LABEL, MILLISECONDS, NONE, OUTPUT_FORMAT_PROP, PRESERVE, PRINT_FIELD_NAMES_PROP, RESPONSE_CODE, RESPONSE_MESSAGE, SAMPLE_RESULT_TAG_NAME, SAVE_AS_CSV, SAVE_AS_XML, SAVE_DATA_TYPE_PROP, SAVE_LABEL_PROP, SAVE_RESPONSE_CODE_PROP, SAVE_RESPONSE_DATA_PROP, SAVE_RESPONSE_MESSAGE_PROP, SAVE_SUCCESSFUL_PROP, SAVE_THREAD_NAME_PROP, SAVE_TIME_PROP, SUCCESSFUL, THREAD_NAME, TIME, TIME_STAMP, TIME_STAMP_FORMAT_PROP, TRUE, XML, XML_SPACE
 
Method Summary
static TestElement createTestElement(org.apache.avalon.framework.configuration.Configuration config)
           
static AssertionResult getAssertionResult(org.apache.avalon.framework.configuration.Configuration config)
           
static byte[] getBinaryData(org.apache.avalon.framework.configuration.Configuration config)
           
static org.apache.avalon.framework.configuration.Configuration getConfigForTestElement(String named, TestElement item)
           
static org.apache.avalon.framework.configuration.Configuration getConfiguration(AssertionResult assResult)
           
static org.apache.avalon.framework.configuration.Configuration getConfiguration(byte[] bin)
           
static org.apache.avalon.framework.configuration.Configuration getConfiguration(SampleResult result, boolean funcTest)
          This method determines the content of the result data that will be stored.
static int getOutputFormat()
          Return the format for the saved results, e.g., csv or xml.
static boolean getPrintFieldNames()
          Return whether the field names should be printed to a delimited results file.
static SampleResult getSampleResult(org.apache.avalon.framework.configuration.Configuration config)
           
static HashTree loadSubTree(InputStream in)
           
static SampleResult makeResultFromDelimitedString(String delim)
          Make a SampleResult given a delimited string.
static String printableFieldNamesToString()
          Return whether the field names should be printed to the output file.
protected static void readProperties()
          Read in the properties having to do with saving from a properties file.
static String resultToDelimitedString(SampleResult sample)
          Convert a result into a string, where the fields of the result are separated by the default delimiter.
static String resultToDelimitedString(SampleResult sample, String delimiter)
          Convert a result into a string, where the fields of the result are separated by a specified String.
static void saveSubTree(HashTree subTree, OutputStream writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAVE_NO_ASSERTIONS

protected static final int SAVE_NO_ASSERTIONS
See Also:
Constant Field Values

SAVE_FIRST_ASSERTION

protected static final int SAVE_FIRST_ASSERTION
See Also:
Constant Field Values

SAVE_ALL_ASSERTIONS

protected static final int SAVE_ALL_ASSERTIONS
See Also:
Constant Field Values

formatter

protected static SimpleDateFormat formatter
A formatter for the time stamp.


outputFormat

protected static int outputFormat
A flag to indicate which output format to use for results.


printFieldNames

protected static boolean printFieldNames
A flag to indicate whether to print the field names for delimited result files.


saveDataType

protected static boolean saveDataType
A flag to indicate whether the data type should be saved to the test results.


saveAssertionResultsFailureMessage

protected static boolean saveAssertionResultsFailureMessage
A flag to indicate whether the assertion result's failure message should be saved to the test results.


saveLabel

protected static boolean saveLabel
A flag to indicate whether the label should be saved to the test results.


saveResponseCode

protected static boolean saveResponseCode
A flag to indicate whether the response code should be saved to the test results.


saveResponseData

protected static boolean saveResponseData
A flag to indicate whether the response data should be saved to the test results.


saveResponseMessage

protected static boolean saveResponseMessage
A flag to indicate whether the response message should be saved to the test results.


saveSuccessful

protected static boolean saveSuccessful
A flag to indicate whether the success indicator should be saved to the test results.


saveThreadName

protected static boolean saveThreadName
A flag to indicate whether the thread name should be saved to the test results.


saveTime

protected static boolean saveTime
A flag to indicate whether the time should be saved to the test results.


timeStampFormat

protected static String timeStampFormat
A flag to indicate the format of the time stamp within the test results.


printMilliseconds

protected static boolean printMilliseconds
A flag to indicate whether the time stamp should be printed in milliseconds.


whichAssertionResults

protected static String whichAssertionResults
A flag to indicate which assertion results should be saved to the test results. Legitimate values include none, first, all.


assertionsResultsToSave

protected static int assertionsResultsToSave

defaultDelimiter

protected static String defaultDelimiter
The string used to separate fields when stored to disk, for example, the comma for CSV files.

Method Detail

readProperties

protected static void readProperties()
Read in the properties having to do with saving from a properties file.


getOutputFormat

public static int getOutputFormat()
Return the format for the saved results, e.g., csv or xml.

Returns:
the format for the saved results

getPrintFieldNames

public static boolean getPrintFieldNames()
Return whether the field names should be printed to a delimited results file.

Returns:
whether the field names should be printed

makeResultFromDelimitedString

public static SampleResult makeResultFromDelimitedString(String delim)
Make a SampleResult given a delimited string.

Parameters:
delim -
Returns:
SampleResult

printableFieldNamesToString

public static String printableFieldNamesToString()
Return whether the field names should be printed to the output file.

Returns:
whether the field names should be printed to the output file

saveSubTree

public static void saveSubTree(HashTree subTree,
                               OutputStream writer)
                        throws IOException
Throws:
IOException

getSampleResult

public static SampleResult getSampleResult(org.apache.avalon.framework.configuration.Configuration config)

getConfiguration

public static org.apache.avalon.framework.configuration.Configuration getConfiguration(byte[] bin)

getBinaryData

public static byte[] getBinaryData(org.apache.avalon.framework.configuration.Configuration config)

getAssertionResult

public static AssertionResult getAssertionResult(org.apache.avalon.framework.configuration.Configuration config)

getConfiguration

public static org.apache.avalon.framework.configuration.Configuration getConfiguration(AssertionResult assResult)

getConfiguration

public static org.apache.avalon.framework.configuration.Configuration getConfiguration(SampleResult result,
                                                                                       boolean funcTest)
This method determines the content of the result data that will be stored.

Parameters:
result - the object containing all of the data that has been collected.
funcTest - an indicator of whether the user wants all data recorded.

resultToDelimitedString

public static String resultToDelimitedString(SampleResult sample)
Convert a result into a string, where the fields of the result are separated by the default delimiter.

Parameters:
sample - the test result to be converted
Returns:
the separated value representation of the result

resultToDelimitedString

public static String resultToDelimitedString(SampleResult sample,
                                             String delimiter)
Convert a result into a string, where the fields of the result are separated by a specified String.

Parameters:
sample - the test result to be converted
delimiter - the separation string
Returns:
the separated value representation of the result

getConfigForTestElement

public static org.apache.avalon.framework.configuration.Configuration getConfigForTestElement(String named,
                                                                                              TestElement item)

loadSubTree

public static HashTree loadSubTree(InputStream in)
                            throws IOException
Throws:
IOException

createTestElement

public static TestElement createTestElement(org.apache.avalon.framework.configuration.Configuration config)
                                     throws org.apache.avalon.framework.configuration.ConfigurationException,
                                            ClassNotFoundException,
                                            IllegalAccessException,
                                            InstantiationException
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
ClassNotFoundException
IllegalAccessException
InstantiationException

Apache JMeter
2.0.1.20050615

Copyright © 1998-2005 Apache Software Foundation. All Rights Reserved.