kcassell 2003/02/04 13:02:13
Modified: src/core/org/apache/jmeter/save SaveServiceConstants.java
SaveService.java DataSource.java
Log:
Reformatted to Turbine standards
Revision Changes Path
1.2 +109 -108
jakarta-jmeter/src/core/org/apache/jmeter/save/SaveServiceConstants.java
Index: SaveServiceConstants.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/save/SaveServiceConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SaveServiceConstants.java 29 Jan 2003 19:13:54 -0000 1.1
+++ SaveServiceConstants.java 4 Feb 2003 21:02:13 -0000 1.2
@@ -54,6 +54,7 @@
*/
package org.apache.jmeter.save;
+
/************************************************************
* This interface defines a number of constants used in the properties file
* that is used to indicate which portions of the results will be
@@ -68,111 +69,111 @@
public interface SaveServiceConstants
{
- //---------------------------------------------------------------------
- // PROPERTY FILE CONSTANTS
- //---------------------------------------------------------------------
-
- /** The file containing the properties governing the information to
- be saved. **/
- public static final String PROPS_FILE =
- "jmeter.properties";
-
- /** Indicates that the results file should be in XML format. **/
- public static final String XML = "xml";
-
- /** Indicates that the results file should be in CSV format. **/
- public static final String CSV = "csv";
-
- /** Indicates that the results should be stored in a database. **/
- public static final String DATABASE = "db";
-
- /** A properties file indicator for true. **/
- public static final String TRUE = "true";
-
- /** A properties file indicator for false. **/
- public static final String FALSE = "false";
-
- /** A properties file indicator for milliseconds. **/
- public static final String MILLISECONDS = "ms";
-
- /** A properties file indicator for none. **/
- public static final String NONE = "none";
-
- /** A properties file indicator for the first of a series. **/
- public static final String FIRST = "first";
-
- /** A properties file indicator for all of a series. **/
- public static final String ALL = "all";
-
- /** The name of the property indicating which assertion results
- should be saved. **/
- public static final String ASSERTION_RESULTS_PROP
- = "jmeter.save.saveservice.assertion_results";
-
- /** The name of the property indicating whether the data type
- should be saved. **/
- public static final String SAVE_DATA_TYPE_PROP
- = "jmeter.save.saveservice.data_type";
-
- /** The name of the property indicating whether the label
- should be saved. **/
- public static final String SAVE_LABEL_PROP
- = "jmeter.save.saveservice.label";
-
- /** The name of the property indicating whether the response code
- should be saved. **/
- public static final String SAVE_RESPONSE_CODE_PROP
- = "jmeter.save.saveservice.response_code";
-
- /** The name of the property indicating whether the response data
- should be saved. **/
- public static final String SAVE_RESPONSE_DATA_PROP
- = "jmeter.save.saveservice.response_data";
-
- /** The name of the property indicating whether the response message
- should be saved. **/
- public static final String SAVE_RESPONSE_MESSAGE_PROP
- = "jmeter.save.saveservice.response_message";
-
- /** The name of the property indicating whether the success indicator
- should be saved. **/
- public static final String SAVE_SUCCESSFUL_PROP
- = "jmeter.save.saveservice.successful";
-
- /** The name of the property indicating whether the thread name
- should be saved. **/
- public static final String SAVE_THREAD_NAME_PROP
- = "jmeter.save.saveservice.thread_name";
-
- /** The name of the property indicating whether the time
- should be saved. **/
- public static final String SAVE_TIME_PROP
- = "jmeter.save.saveservice.time";
-
- /** The name of the property indicating whether the time stamp
- should be saved. **/
- public static final String TIME_STAMP_FORMAT_PROP
- = "jmeter.save.saveservice.timestamp_format";
-
- //---------------------------------------------------------------------
- // XML RESULT FILE CONSTANTS
- //---------------------------------------------------------------------
-
- public final static String PRESERVE = "preserve";
- public final static String XML_SPACE = "xml:space";
- public static final String ASSERTION_RESULT_TAG_NAME = "assertionResult";
- public static final String BINARY = "binary";
- public static final String DATA_TYPE = "dataType";
- public static final String ERROR = "error";
- public static final String FAILURE = "failure";
- public static final String FAILURE_MESSAGE = "failureMessage";
- public static final String LABEL = "label";
- public static final String RESPONSE_CODE = "responseCode";
- public static final String RESPONSE_MESSAGE = "responseMessage";
- public static final String SAMPLE_RESULT_TAG_NAME = "sampleResult";
- public static final String SUCCESSFUL = "success";
- public static final String THREAD_NAME = "threadName";
- public static final String TIME = "time";
- public static final String TIME_STAMP = "timeStamp";
+ // ---------------------------------------------------------------------
+ // PROPERTY FILE CONSTANTS
+ // ---------------------------------------------------------------------
+
+ /** The file containing the properties governing the information to
+ be saved. **/
+ public static final String PROPS_FILE =
+ "jmeter.properties";
+
+ /** Indicates that the results file should be in XML format. **/
+ public static final String XML = "xml";
+
+ /** Indicates that the results file should be in CSV format. **/
+ public static final String CSV = "csv";
+
+ /** Indicates that the results should be stored in a database. **/
+ public static final String DATABASE = "db";
+
+ /** A properties file indicator for true. **/
+ public static final String TRUE = "true";
+
+ /** A properties file indicator for false. **/
+ public static final String FALSE = "false";
+
+ /** A properties file indicator for milliseconds. **/
+ public static final String MILLISECONDS = "ms";
+
+ /** A properties file indicator for none. **/
+ public static final String NONE = "none";
+
+ /** A properties file indicator for the first of a series. **/
+ public static final String FIRST = "first";
+
+ /** A properties file indicator for all of a series. **/
+ public static final String ALL = "all";
+
+ /** The name of the property indicating which assertion results
+ should be saved. **/
+ public static final String ASSERTION_RESULTS_PROP
+ = "jmeter.save.saveservice.assertion_results";
+
+ /** The name of the property indicating whether the data type
+ should be saved. **/
+ public static final String SAVE_DATA_TYPE_PROP
+ = "jmeter.save.saveservice.data_type";
+
+ /** The name of the property indicating whether the label
+ should be saved. **/
+ public static final String SAVE_LABEL_PROP
+ = "jmeter.save.saveservice.label";
+
+ /** The name of the property indicating whether the response code
+ should be saved. **/
+ public static final String SAVE_RESPONSE_CODE_PROP
+ = "jmeter.save.saveservice.response_code";
+
+ /** The name of the property indicating whether the response data
+ should be saved. **/
+ public static final String SAVE_RESPONSE_DATA_PROP
+ = "jmeter.save.saveservice.response_data";
+
+ /** The name of the property indicating whether the response message
+ should be saved. **/
+ public static final String SAVE_RESPONSE_MESSAGE_PROP
+ = "jmeter.save.saveservice.response_message";
+
+ /** The name of the property indicating whether the success indicator
+ should be saved. **/
+ public static final String SAVE_SUCCESSFUL_PROP
+ = "jmeter.save.saveservice.successful";
+
+ /** The name of the property indicating whether the thread name
+ should be saved. **/
+ public static final String SAVE_THREAD_NAME_PROP
+ = "jmeter.save.saveservice.thread_name";
+
+ /** The name of the property indicating whether the time
+ should be saved. **/
+ public static final String SAVE_TIME_PROP
+ = "jmeter.save.saveservice.time";
+
+ /** The name of the property indicating whether the time stamp
+ should be saved. **/
+ public static final String TIME_STAMP_FORMAT_PROP
+ = "jmeter.save.saveservice.timestamp_format";
+
+ // ---------------------------------------------------------------------
+ // XML RESULT FILE CONSTANTS
+ // ---------------------------------------------------------------------
+
+ public final static String PRESERVE = "preserve";
+ public final static String XML_SPACE = "xml:space";
+ public static final String ASSERTION_RESULT_TAG_NAME = "assertionResult";
+ public static final String BINARY = "binary";
+ public static final String DATA_TYPE = "dataType";
+ public static final String ERROR = "error";
+ public static final String FAILURE = "failure";
+ public static final String FAILURE_MESSAGE = "failureMessage";
+ public static final String LABEL = "label";
+ public static final String RESPONSE_CODE = "responseCode";
+ public static final String RESPONSE_MESSAGE = "responseMessage";
+ public static final String SAMPLE_RESULT_TAG_NAME = "sampleResult";
+ public static final String SUCCESSFUL = "success";
+ public static final String THREAD_NAME = "threadName";
+ public static final String TIME = "time";
+ public static final String TIME_STAMP = "timeStamp";
}
1.12 +540 -506 jakarta-jmeter/src/core/org/apache/jmeter/save/SaveService.java
Index: SaveService.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/save/SaveService.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SaveService.java 29 Jan 2003 19:16:16 -0000 1.11
+++ SaveService.java 4 Feb 2003 21:02:13 -0000 1.12
@@ -54,6 +54,7 @@
*/
package org.apache.jmeter.save;
+
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Collection;
@@ -80,6 +81,7 @@
import org.apache.jorphan.collections.ListedHashTree;
import org.xml.sax.SAXException;
+
/************************************************************
* This class provides a means for saving test results. Test
* results are typically saved in an XML file, but other
@@ -93,596 +95,628 @@
public class SaveService implements SaveServiceConstants
{
- transient private static Logger log =
- Hierarchy.getDefaultHierarchy().getLoggerFor("jmeter.util");
+ transient private static Logger log =
+ Hierarchy.getDefaultHierarchy().getLoggerFor("jmeter.util");
+
+ protected static final int SAVE_NO_ASSERTIONS = 0;
+ protected static final int SAVE_FIRST_ASSERTION = SAVE_NO_ASSERTIONS + 1;
+ protected static final int SAVE_ALL_ASSERTIONS = SAVE_FIRST_ASSERTION + 1;;
- protected static final int SAVE_NO_ASSERTIONS = 0;
- protected static final int SAVE_FIRST_ASSERTION = SAVE_NO_ASSERTIONS + 1;
- protected static final int SAVE_ALL_ASSERTIONS = SAVE_FIRST_ASSERTION + 1;;
+ /** A formatter for the time stamp. **/
+ protected static SimpleDateFormat formatter = null;
- /** A formatter for the time stamp. **/
- protected static SimpleDateFormat formatter = null;
+ /** A flag to indicate whether the data type should
+ be saved to the test results. **/
+ protected static boolean saveDataType = true;
- /** A flag to indicate whether the data type should
- be saved to the test results. **/
- protected static boolean saveDataType = true;
+ /** A flag to indicate whether the label should
+ be saved to the test results. **/
+ protected static boolean saveLabel = true;
- /** A flag to indicate whether the label should
- be saved to the test results. **/
- protected static boolean saveLabel = true;
+ /** A flag to indicate whether the response code should
+ be saved to the test results. **/
+ protected static boolean saveResponseCode = false;
- /** A flag to indicate whether the response code should
- be saved to the test results. **/
- protected static boolean saveResponseCode = false;
+ /** A flag to indicate whether the response data should
+ be saved to the test results. **/
+ protected static boolean saveResponseData = false;
- /** A flag to indicate whether the response data should
- be saved to the test results. **/
- protected static boolean saveResponseData = false;
+ /** A flag to indicate whether the response message should
+ be saved to the test results. **/
+ protected static boolean saveResponseMessage = false;
- /** A flag to indicate whether the response message should
- be saved to the test results. **/
- protected static boolean saveResponseMessage = false;
+ /** A flag to indicate whether the success indicator should
+ be saved to the test results. **/
+ protected static boolean saveSuccessful = true;
- /** A flag to indicate whether the success indicator should
- be saved to the test results. **/
- protected static boolean saveSuccessful = true;
+ /** A flag to indicate whether the thread name should
+ be saved to the test results. **/
+ protected static boolean saveThreadName = true;
- /** A flag to indicate whether the thread name should
- be saved to the test results. **/
- protected static boolean saveThreadName = true;
+ /** A flag to indicate whether the time should
+ be saved to the test results. **/
+ protected static boolean saveTime = true;
- /** A flag to indicate whether the time should
- be saved to the test results. **/
- protected static boolean saveTime = true;
+ /** A flag to indicate the format of the time stamp within
+ the test results. **/
+ protected static String timeStampFormat = MILLISECONDS;
- /** A flag to indicate the format of the time stamp within
- the test results. **/
- protected static String timeStampFormat = MILLISECONDS;
+ /** A flag to indicate whether the time stamp should be printed
+ in milliseconds. **/
+ protected static boolean printMilliseconds = true;
- /** A flag to indicate whether the time stamp should be printed
- in milliseconds. **/
- protected static boolean printMilliseconds = true;
+ /** A flag to indicate which assertion results should
+ be saved to the test results. Legitimate values include
+ none, first, all. **/
+ protected static String whichAssertionResults = FIRST;
- /** A flag to indicate which assertion results should
- be saved to the test results. Legitimate values include
- none, first, all. **/
- protected static String whichAssertionResults = FIRST;
+ protected static int assertionsResultsToSave = SAVE_NO_ASSERTIONS;
- protected static int assertionsResultsToSave = SAVE_NO_ASSERTIONS;
+ private static DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
-
- private static DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
+ // Initialize various variables based on properties.
+ static
+ {
+ readAndSetSaveProperties();
+ } // static initialization
+ public SaveService()
+ {}
- // Initialize various variables based on properties.
- static
+ protected static void readAndSetSaveProperties()
+ {
+ Properties systemProps = System.getProperties();
+ Properties props = new Properties(systemProps);
+
+ try
+ {
+ props = JMeterUtils.getProperties(PROPS_FILE);
+ }
+ catch (Exception e)
{
- readAndSetSaveProperties();
- } // static initialization
+ log.error("SaveService.readAndSetSaveProperties: Problem loading
properties file " + PROPS_FILE, e);
+ }
+ saveDataType =
+ TRUE.equalsIgnoreCase(props.getProperty(SAVE_DATA_TYPE_PROP,
+ TRUE));
+ saveLabel =
+ TRUE.equalsIgnoreCase(props.getProperty(SAVE_LABEL_PROP,
+ TRUE));
+ saveResponseCode =
+ TRUE.equalsIgnoreCase(props.getProperty(SAVE_RESPONSE_CODE_PROP,
+ TRUE));
+ saveResponseData =
+ TRUE.equalsIgnoreCase(props.getProperty(SAVE_RESPONSE_DATA_PROP,
+ FALSE));
+ saveResponseMessage =
+ TRUE.equalsIgnoreCase(props.getProperty(SAVE_RESPONSE_MESSAGE_PROP,
+ TRUE));
+ saveSuccessful =
+ TRUE.equalsIgnoreCase(props.getProperty(SAVE_SUCCESSFUL_PROP,
+ TRUE));
+ saveThreadName =
+ TRUE.equalsIgnoreCase(props.getProperty(SAVE_THREAD_NAME_PROP,
+ TRUE));
+ saveTime =
+ TRUE.equalsIgnoreCase(props.getProperty(SAVE_TIME_PROP,
+ TRUE));
+ timeStampFormat =
+ props.getProperty(TIME_STAMP_FORMAT_PROP, MILLISECONDS);
+ printMilliseconds = MILLISECONDS.equalsIgnoreCase(timeStampFormat);
+ //
+ if (!printMilliseconds && !NONE.equalsIgnoreCase(timeStampFormat)
+ && (timeStampFormat != null))
+ {
+ formatter = new SimpleDateFormat(timeStampFormat);
+ }
- public SaveService()
+ whichAssertionResults = props.getProperty(ASSERTION_RESULTS_PROP,
+ NONE);
+
+ if (NONE.equals(whichAssertionResults))
+ {
+ assertionsResultsToSave = SAVE_NO_ASSERTIONS;
+ }
+ else if (FIRST.equals(whichAssertionResults))
+ {
+ assertionsResultsToSave = SAVE_FIRST_ASSERTION;
+ }
+ else if (ALL.equals(whichAssertionResults))
{
+ assertionsResultsToSave = SAVE_ALL_ASSERTIONS;
}
+ }
- protected static void readAndSetSaveProperties()
+ public static void saveSubTree(HashTree subTree, OutputStream writer) throws
+ IOException
+ {
+ Configuration config = (Configuration) getConfigsFromTree(subTree).get(0);
+ DefaultConfigurationSerializer saver = new DefaultConfigurationSerializer();
+
+ saver.setIndent(true);
+ try
+ {
+ saver.serialize(writer, config);
+ }
+ catch (SAXException e)
{
- Properties systemProps = System.getProperties();
- Properties props = new Properties(systemProps);
+ throw new IOException("SAX implementation problem");
+ }
+ catch (ConfigurationException e)
+ {
+ throw new IOException("Problem using Avalon Configuration tools");
+ }
+ }
- try
- {
- props = JMeterUtils.getProperties(PROPS_FILE);
- }
- catch (Exception e)
- {
- log.error("SaveService.readAndSetSaveProperties: Problem
loading properties file " + PROPS_FILE, e);
- }
+ public static SampleResult getSampleResult(Configuration config)
+ {
+ SampleResult result = new SampleResult();
- saveDataType =
- TRUE.equalsIgnoreCase(props.getProperty(SAVE_DATA_TYPE_PROP,
- TRUE));
- saveLabel =
- TRUE.equalsIgnoreCase(props.getProperty(SAVE_LABEL_PROP,
- TRUE));
- saveResponseCode =
-
TRUE.equalsIgnoreCase(props.getProperty(SAVE_RESPONSE_CODE_PROP,
- TRUE));
- saveResponseData =
-
TRUE.equalsIgnoreCase(props.getProperty(SAVE_RESPONSE_DATA_PROP,
- FALSE));
- saveResponseMessage =
-
TRUE.equalsIgnoreCase(props.getProperty(SAVE_RESPONSE_MESSAGE_PROP,
- TRUE));
- saveSuccessful =
-
TRUE.equalsIgnoreCase(props.getProperty(SAVE_SUCCESSFUL_PROP,
- TRUE));
- saveThreadName =
-
TRUE.equalsIgnoreCase(props.getProperty(SAVE_THREAD_NAME_PROP,
- TRUE));
- saveTime =
- TRUE.equalsIgnoreCase(props.getProperty(SAVE_TIME_PROP,
- TRUE));
- timeStampFormat =
- props.getProperty(TIME_STAMP_FORMAT_PROP, MILLISECONDS);
- printMilliseconds = MILLISECONDS.equalsIgnoreCase(timeStampFormat);
- //
- if (!printMilliseconds
- && !NONE.equalsIgnoreCase(timeStampFormat)
- && (timeStampFormat != null))
- {
- formatter = new SimpleDateFormat(timeStampFormat);
- }
+ result.setThreadName(config.getAttribute(THREAD_NAME, ""));
+ result.setDataType(config.getAttribute(DATA_TYPE, ""));
+ result.setResponseCode(config.getAttribute(RESPONSE_CODE, ""));
+ result.setResponseMessage(config.getAttribute(RESPONSE_MESSAGE, ""));
+ result.setTime(config.getAttributeAsLong(TIME, 0L));
+ result.setTimeStamp(config.getAttributeAsLong(TIME_STAMP, 0L));
+ result.setSuccessful(config.getAttributeAsBoolean(SUCCESSFUL, false));
+ result.setSampleLabel(config.getAttribute(LABEL, ""));
+ result.setResponseData(getBinaryData(config.getChild(BINARY)));
+ Configuration[] subResults = config.getChildren(SAMPLE_RESULT_TAG_NAME);
- whichAssertionResults = props.getProperty(ASSERTION_RESULTS_PROP,
- NONE);
+ for (int i = 0; i < subResults.length; i++)
+ {
+ result.addSubResult(getSampleResult(subResults[i]));
+ }
+ Configuration[] assResults = config.getChildren(ASSERTION_RESULT_TAG_NAME);
- if (NONE.equals(whichAssertionResults))
- {
- assertionsResultsToSave = SAVE_NO_ASSERTIONS;
- }
- else if (FIRST.equals(whichAssertionResults))
- {
- assertionsResultsToSave = SAVE_FIRST_ASSERTION;
- }
- else if (ALL.equals(whichAssertionResults))
- {
- assertionsResultsToSave = SAVE_ALL_ASSERTIONS;
- }
+ for (int i = 0; i < assResults.length; i++)
+ {
+ result.addAssertionResult(getAssertionResult(assResults[i]));
}
+ return result;
+ }
+ private static List getConfigsFromTree(HashTree subTree)
+ {
+ Iterator iter = subTree.list().iterator();
+ List configs = new LinkedList();
- public static void saveSubTree(HashTree subTree,OutputStream writer) throws
- IOException
+ while (iter.hasNext())
{
- Configuration config =
(Configuration)getConfigsFromTree(subTree).get(0);
- DefaultConfigurationSerializer saver = new
DefaultConfigurationSerializer();
- saver.setIndent(true);
- try
- {
- saver.serialize(writer,config);
- }
- catch(SAXException e)
- {
- throw new IOException("SAX implementation problem");
- }
- catch(ConfigurationException e)
- {
- throw new IOException("Problem using Avalon Configuration
tools");
- }
+ TestElement item = (TestElement) iter.next();
+ DefaultConfiguration config = new DefaultConfiguration("node", "node");
+
+ config.addChild(getConfigForTestElement(null, item));
+ List configList = getConfigsFromTree(subTree.getTree(item));
+ Iterator iter2 = configList.iterator();
+
+ while (iter2.hasNext())
+ {
+ config.addChild((Configuration) iter2.next());
+ }
+ configs.add(config);
}
-
- public static SampleResult getSampleResult(Configuration config)
+ return configs;
+ }
+
+ public static Configuration getConfiguration(byte[] bin)
+ {
+ DefaultConfiguration config = new DefaultConfiguration(BINARY, "JMeter Save
Service");
+
+ try
{
- SampleResult result = new SampleResult();
- result.setThreadName(config.getAttribute(THREAD_NAME,""));
- result.setDataType(config.getAttribute(DATA_TYPE,""));
- result.setResponseCode(config.getAttribute(RESPONSE_CODE,""));
- result.setResponseMessage(config.getAttribute(RESPONSE_MESSAGE,""));
- result.setTime(config.getAttributeAsLong(TIME,0L));
- result.setTimeStamp(config.getAttributeAsLong(TIME_STAMP,0L));
-
result.setSuccessful(config.getAttributeAsBoolean(SUCCESSFUL,false));
- result.setSampleLabel(config.getAttribute(LABEL,""));
- result.setResponseData(getBinaryData(config.getChild(BINARY)));
- Configuration[] subResults =
config.getChildren(SAMPLE_RESULT_TAG_NAME);
- for(int i = 0;i < subResults.length;i++)
- {
- result.addSubResult(getSampleResult(subResults[i]));
- }
- Configuration[] assResults =
config.getChildren(ASSERTION_RESULT_TAG_NAME);
- for(int i = 0;i < assResults.length;i++)
- {
-
result.addAssertionResult(getAssertionResult(assResults[i]));
- }
- return result;
+ config.setValue(new String(bin, "utf-8"));
}
+ catch (UnsupportedEncodingException e)
+ {
+ log.error("", e);
+ }
+ return config;
+ }
- private static List getConfigsFromTree(HashTree subTree)
+ public static byte[] getBinaryData(Configuration config)
+ {
+ if (config == null)
{
- Iterator iter = subTree.list().iterator();
- List configs = new LinkedList();
- while (iter.hasNext())
- {
- TestElement item = (TestElement)iter.next();
- DefaultConfiguration config = new
DefaultConfiguration("node","node");
- config.addChild(getConfigForTestElement(null,item));
- List configList = getConfigsFromTree(subTree.getTree(item));
- Iterator iter2 = configList.iterator();
- while(iter2.hasNext())
- {
- config.addChild((Configuration)iter2.next());
- }
- configs.add(config);
- }
- return configs;
+ return new byte[0];
}
-
- public static Configuration getConfiguration(byte[] bin)
+ try
{
- DefaultConfiguration config = new
DefaultConfiguration(BINARY,"JMeter Save Service");
- try {
- config.setValue(new String(bin,"utf-8"));
- } catch(UnsupportedEncodingException e) {
- log.error("",e);
- }
- return config;
+ return config.getValue("").getBytes("utf-8");
}
-
- public static byte[] getBinaryData(Configuration config)
+ catch (UnsupportedEncodingException e)
{
- if(config == null)
- {
- return new byte[0];
- }
- try {
- return config.getValue("").getBytes("utf-8");
- } catch(UnsupportedEncodingException e) {
- return new byte[0];
- }
+ return new byte[0];
+ }
+ }
+
+ public static AssertionResult getAssertionResult(Configuration config)
+ {
+ AssertionResult result = new AssertionResult();
+
+ result.setError(config.getAttributeAsBoolean(ERROR, false));
+ result.setFailure(config.getAttributeAsBoolean(FAILURE, false));
+ result.setFailureMessage(config.getAttribute(FAILURE_MESSAGE, ""));
+ return result;
+ }
+
+ public static Configuration getConfiguration(AssertionResult assResult)
+ {
+ DefaultConfiguration config = new
DefaultConfiguration(ASSERTION_RESULT_TAG_NAME,
+ "JMeter Save Service");
+
+ config.setAttribute(FAILURE_MESSAGE, assResult.getFailureMessage());
+ config.setAttribute(ERROR, "" + assResult.isError());
+ config.setAttribute(FAILURE, "" + assResult.isFailure());
+ return config;
+ }
+
+ /**
+ This method determines the content of the result data that
+ will be stored.
+ @param result the object containing all of the data that has
+ been collected.
+ @param funcTest an indicator of whether the user wants all
+ data recorded.
+ **/
+
+ public static Configuration getConfiguration(SampleResult result, boolean
funcTest)
+ {
+ DefaultConfiguration config = new
DefaultConfiguration(SAMPLE_RESULT_TAG_NAME, "JMeter Save Service");
+
+ if (saveTime)
+ {
+ config.setAttribute(TIME, "" + result.getTime());
+ }
+ if (saveLabel)
+ {
+ config.setAttribute(LABEL, result.getSampleLabel());
}
-
- public static AssertionResult getAssertionResult(Configuration config)
+ if (saveResponseCode)
{
- AssertionResult result = new AssertionResult();
- result.setError(config.getAttributeAsBoolean(ERROR,false));
- result.setFailure(config.getAttributeAsBoolean(FAILURE,false));
- result.setFailureMessage(config.getAttribute(FAILURE_MESSAGE,""));
- return result;
- }
-
- public static Configuration getConfiguration(AssertionResult assResult)
- {
- DefaultConfiguration config = new
DefaultConfiguration(ASSERTION_RESULT_TAG_NAME,
- "JMeter Save Service");
- config.setAttribute(FAILURE_MESSAGE,assResult.getFailureMessage());
- config.setAttribute(ERROR,""+assResult.isError());
- config.setAttribute(FAILURE,""+assResult.isFailure());
- return config;
- }
-
-
- /**
- This method determines the content of the result data that
- will be stored.
- @param result the object containing all of the data that has
- been collected.
- @param funcTest an indicator of whether the user wants all
- data recorded.
- **/
+ config.setAttribute(RESPONSE_CODE, result.getResponseCode());
+ }
+ if (saveResponseMessage)
+ {
+ config.setAttribute(RESPONSE_MESSAGE, result.getResponseMessage());
+ }
+ if (saveThreadName)
+ {
+ config.setAttribute(THREAD_NAME, result.getThreadName());
+ }
+ if (saveDataType)
+ {
+ config.setAttribute(DATA_TYPE, result.getDataType());
+ }
- public static Configuration getConfiguration(SampleResult result,boolean
funcTest)
+ if (printMilliseconds)
{
- DefaultConfiguration config = new
DefaultConfiguration(SAMPLE_RESULT_TAG_NAME,"JMeter Save Service");
+ config.setAttribute(TIME_STAMP, "" + result.getTimeStamp());
+ }
+ else if (formatter != null)
+ {
+ String stamp = formatter.format(new Date(result.getTimeStamp()));
- if (saveTime)
- {
- config.setAttribute(TIME,""+result.getTime());
- }
- if (saveLabel)
- {
- config.setAttribute(LABEL,result.getSampleLabel());
- }
- if (saveResponseCode)
- {
- config.setAttribute(RESPONSE_CODE,result.getResponseCode());
- }
- if (saveResponseMessage)
- {
-
config.setAttribute(RESPONSE_MESSAGE,result.getResponseMessage());
- }
- if (saveThreadName)
- {
- config.setAttribute(THREAD_NAME,result.getThreadName());
- }
- if (saveDataType)
- {
- config.setAttribute(DATA_TYPE,result.getDataType());
- }
+ config.setAttribute(TIME_STAMP, stamp);
+ }
- if (printMilliseconds)
- {
- config.setAttribute(TIME_STAMP,""+result.getTimeStamp());
- }
- else if (formatter != null)
- {
- String stamp = formatter.format(new
Date(result.getTimeStamp()));
- config.setAttribute(TIME_STAMP, stamp);
- }
+ if (saveSuccessful)
+ {
+ config.setAttribute(SUCCESSFUL, new
Boolean(result.isSuccessful()).toString());
+ }
- if (saveSuccessful)
- {
- config.setAttribute(SUCCESSFUL,new
Boolean(result.isSuccessful()).toString());
- }
+ SampleResult[] subResults = result.getSubResults();
- SampleResult[] subResults = result.getSubResults();
- for(int i = 0;i < subResults.length;i++)
- {
- config.addChild(getConfiguration(subResults[i],funcTest));
- }
+ for (int i = 0; i < subResults.length; i++)
+ {
+ config.addChild(getConfiguration(subResults[i], funcTest));
+ }
- AssertionResult[] assResults = result.getAssertionResults();
+ AssertionResult[] assResults = result.getAssertionResults();
- if(funcTest)
- {
-
config.addChild(getConfigForTestElement(null,result.getSamplerData()));
- for(int i = 0;i < assResults.length;i++)
- {
- config.addChild(getConfiguration(assResults[i]));
- }
- config.addChild(getConfiguration(result.getResponseData()));
- }
- // Determine which of the assertion results to save and
- // whether to save the response data
- else
- {
- if (assertionsResultsToSave == SAVE_ALL_ASSERTIONS)
- {
-
config.addChild(getConfigForTestElement(null,result.getSamplerData()));
- for(int i = 0;i < assResults.length;i++)
- {
-
config.addChild(getConfiguration(assResults[i]));
- }
- }
- else if ((assertionsResultsToSave == SAVE_FIRST_ASSERTION)
- && assResults.length > 0)
- {
- config.addChild(getConfiguration(assResults[0]));
- }
-
- if (saveResponseData)
- {
-
config.addChild(getConfiguration(result.getResponseData()));
- }
- }
- return config;
+ if (funcTest)
+ {
+ config.addChild(getConfigForTestElement(null, result.getSamplerData()));
+ for (int i = 0; i < assResults.length; i++)
+ {
+ config.addChild(getConfiguration(assResults[i]));
+ }
+ config.addChild(getConfiguration(result.getResponseData()));
}
-
- public static Configuration getConfigForTestElement(String
named,TestElement item)
+ // Determine which of the assertion results to save and
+ // whether to save the response data
+ else
{
- DefaultConfiguration config = new
DefaultConfiguration("testelement","testelement");
- if(named != null)
+ if (assertionsResultsToSave == SAVE_ALL_ASSERTIONS)
+ {
+ config.addChild(getConfigForTestElement(null,
result.getSamplerData()));
+ for (int i = 0; i < assResults.length; i++)
{
- config.setAttribute("name",named);
+ config.addChild(getConfiguration(assResults[i]));
}
- if(item.getProperty(TestElement.TEST_CLASS) != null)
- {
-
config.setAttribute("class",(String)item.getProperty(TestElement.TEST_CLASS));
- }
- else
- {
- config.setAttribute("class",item.getClass().getName());
- }
- Iterator iter = item.getPropertyNames().iterator();
- while (iter.hasNext())
- {
- String name = (String)iter.next();
- Object value = item.getProperty(name);
- if(value instanceof TestElement)
- {
-
config.addChild(getConfigForTestElement(name,(TestElement)value));
- }
- else if(value instanceof Collection)
- {
-
config.addChild(createConfigForCollection(name,(Collection)value));
- }
- else if(value != null)
- {
-
config.addChild(createConfigForString(name,value.toString()));
- }
- }
- return config;
+ }
+ else if ((assertionsResultsToSave == SAVE_FIRST_ASSERTION)
+ && assResults.length > 0)
+ {
+ config.addChild(getConfiguration(assResults[0]));
+ }
+
+ if (saveResponseData)
+ {
+ config.addChild(getConfiguration(result.getResponseData()));
+ }
}
+ return config;
+ }
+
+ public static Configuration getConfigForTestElement(String named, TestElement
item)
+ {
+ DefaultConfiguration config = new DefaultConfiguration("testelement",
"testelement");
- private static Configuration createConfigForCollection(String
propertyName,Collection list)
+ if (named != null)
{
- DefaultConfiguration config = new
DefaultConfiguration("collection","collection");
- if(propertyName != null)
- {
- config.setAttribute("name",propertyName);
- }
- config.setAttribute("class",list.getClass().getName());
- Iterator iter = list.iterator();
- while (iter.hasNext())
- {
- Object item = iter.next();
- if(item instanceof TestElement)
- {
-
config.addChild(getConfigForTestElement(null,(TestElement)item));
- }
- else if(item instanceof Collection)
- {
-
config.addChild(createConfigForCollection(null,(Collection)item));
- }
- else
- {
-
config.addChild(createConfigForString(item.toString()));
- }
- }
- return config;
+ config.setAttribute("name", named);
+ }
+ if (item.getProperty(TestElement.TEST_CLASS) != null)
+ {
+ config.setAttribute("class", (String)
item.getProperty(TestElement.TEST_CLASS));
+ }
+ else
+ {
+ config.setAttribute("class", item.getClass().getName());
}
+ Iterator iter = item.getPropertyNames().iterator();
- private static Configuration createConfigForString(String value)
+ while (iter.hasNext())
{
- DefaultConfiguration config = new
DefaultConfiguration("string","string");
- config.setValue(value);
- config.setAttribute(XML_SPACE,PRESERVE);
- return config;
+ String name = (String) iter.next();
+ Object value = item.getProperty(name);
+
+ if (value instanceof TestElement)
+ {
+ config.addChild(getConfigForTestElement(name, (TestElement) value));
+ }
+ else if (value instanceof Collection)
+ {
+ config.addChild(createConfigForCollection(name, (Collection)
value));
+ }
+ else if (value != null)
+ {
+ config.addChild(createConfigForString(name, value.toString()));
+ }
}
+ return config;
+ }
+
+ private static Configuration createConfigForCollection(String propertyName,
Collection list)
+ {
+ DefaultConfiguration config = new DefaultConfiguration("collection",
"collection");
- private static Configuration createConfigForString(String name,String value)
+ if (propertyName != null)
{
- if(value == null)
- {
- value = "";
- }
- DefaultConfiguration config = new
DefaultConfiguration("property","property");
- config.setAttribute("name",name);
- config.setValue(value);
- config.setAttribute(XML_SPACE,PRESERVE);
- return config;
+ config.setAttribute("name", propertyName);
}
+ config.setAttribute("class", list.getClass().getName());
+ Iterator iter = list.iterator();
- public synchronized static HashTree loadSubTree(InputStream in) throws
IOException
+ while (iter.hasNext())
{
- try
- {
- Configuration config = builder.build(in);
- HashTree loadedTree = generateNode(config);
- return loadedTree;
- }
- catch(ConfigurationException e)
- {
- throw new IOException("Problem loading using Avalon
Configuration tools");
- }
- catch(SAXException e)
- {
- throw new IOException("Problem with SAX implementation");
- }
+ Object item = iter.next();
+
+ if (item instanceof TestElement)
+ {
+ config.addChild(getConfigForTestElement(null, (TestElement) item));
+ }
+ else if (item instanceof Collection)
+ {
+ config.addChild(createConfigForCollection(null, (Collection) item));
+ }
+ else
+ {
+ config.addChild(createConfigForString(item.toString()));
+ }
}
+ return config;
+ }
+
+ private static Configuration createConfigForString(String value)
+ {
+ DefaultConfiguration config = new DefaultConfiguration("string", "string");
- public static TestElement createTestElement(Configuration config) throws
ConfigurationException,
- ClassNotFoundException,
IllegalAccessException,InstantiationException
+ config.setValue(value);
+ config.setAttribute(XML_SPACE, PRESERVE);
+ return config;
+ }
+
+ private static Configuration createConfigForString(String name, String value)
+ {
+ if (value == null)
{
- TestElement element = null;
- element =
(TestElement)Class.forName((String)config.getAttribute("class")).newInstance();
- Configuration[] children = config.getChildren();
- for (int i = 0; i < children.length; i++)
- {
- if(children[i].getName().equals("property"))
- {
- try
- {
-
element.setProperty(children[i].getAttribute("name"),
- children[i].getValue());
- }
- catch (Exception ex)
- {
- log.error("Problem loading property",ex);
-
element.setProperty(children[i].getAttribute("name"),"");
- }
- }
- else if(children[i].getName().equals("testelement"))
- {
-
element.setProperty(children[i].getAttribute("name"),
- createTestElement(children[i]));
- }
- else if(children[i].getName().equals("collection"))
- {
-
element.setProperty(children[i].getAttribute("name"),
- createCollection(children[i]));
- }
- }
- return element;
+ value = "";
}
+ DefaultConfiguration config = new DefaultConfiguration("property",
"property");
- private static Collection createCollection(Configuration config) throws
ConfigurationException,
-
ClassNotFoundException,IllegalAccessException,InstantiationException
+ config.setAttribute("name", name);
+ config.setValue(value);
+ config.setAttribute(XML_SPACE, PRESERVE);
+ return config;
+ }
+
+ public synchronized static HashTree loadSubTree(InputStream in) throws
IOException
+ {
+ try
{
- Collection coll =
(Collection)Class.forName((String)config.getAttribute("class")).newInstance();
- Configuration[] items = config.getChildren();
- for (int i = 0; i < items.length; i++)
- {
- if(items[i].getName().equals("property"))
- {
- coll.add(items[i].getValue(""));
- }
- else if(items[i].getName().equals("testelement"))
- {
- coll.add(createTestElement(items[i]));
- }
- else if(items[i].getName().equals("collection"))
- {
- coll.add(createCollection(items[i]));
- }
- else if(items[i].getName().equals("string"))
- {
- coll.add(items[i].getValue(""));
- }
- }
- return coll;
+ Configuration config = builder.build(in);
+ HashTree loadedTree = generateNode(config);
+
+ return loadedTree;
+ }
+ catch (ConfigurationException e)
+ {
+ throw new IOException("Problem loading using Avalon Configuration
tools");
+ }
+ catch (SAXException e)
+ {
+ throw new IOException("Problem with SAX implementation");
}
+ }
+
+ public static TestElement createTestElement(Configuration config) throws
ConfigurationException,
+ ClassNotFoundException, IllegalAccessException, InstantiationException
+ {
+ TestElement element = null;
+
+ element = (TestElement) Class.forName((String)
config.getAttribute("class")).newInstance();
+ Configuration[] children = config.getChildren();
- private static HashTree generateNode(Configuration config)
+ for (int i = 0; i < children.length; i++)
{
- TestElement element = null;
+ if (children[i].getName().equals("property"))
+ {
try
{
- element = createTestElement(config.getChild("testelement"));
+ element.setProperty(children[i].getAttribute("name"),
+ children[i].getValue());
}
- catch(Exception e)
+ catch (Exception ex)
{
- log.error("Problem loading part of file",e);
- return null;
+ log.error("Problem loading property", ex);
+ element.setProperty(children[i].getAttribute("name"), "");
}
- HashTree subTree = new ListedHashTree(element);
- Configuration[] subNodes = config.getChildren("node");
- for (int i = 0; i < subNodes.length; i++)
- {
- HashTree t = generateNode(subNodes[i]);
- if(t != null)
- {
- subTree.add(element,t);
- }
- }
- return subTree;
+ }
+ else if (children[i].getName().equals("testelement"))
+ {
+ element.setProperty(children[i].getAttribute("name"),
+ createTestElement(children[i]));
+ }
+ else if (children[i].getName().equals("collection"))
+ {
+ element.setProperty(children[i].getAttribute("name"),
+ createCollection(children[i]));
+ }
+ }
+ return element;
+ }
+
+ private static Collection createCollection(Configuration config)
+ throws ConfigurationException, ClassNotFoundException,
+ IllegalAccessException, InstantiationException
+ {
+ Collection coll = (Collection) Class.forName((String)
config.getAttribute("class")).newInstance();
+ Configuration[] items = config.getChildren();
+
+ for (int i = 0; i < items.length; i++)
+ {
+ if (items[i].getName().equals("property"))
+ {
+ coll.add(items[i].getValue(""));
+ }
+ else if (items[i].getName().equals("testelement"))
+ {
+ coll.add(createTestElement(items[i]));
+ }
+ else if (items[i].getName().equals("collection"))
+ {
+ coll.add(createCollection(items[i]));
+ }
+ else if (items[i].getName().equals("string"))
+ {
+ coll.add(items[i].getValue(""));
+ }
+ }
+ return coll;
+ }
+
+ private static HashTree generateNode(Configuration config)
+ {
+ TestElement element = null;
+
+ try
+ {
+ element = createTestElement(config.getChild("testelement"));
+ }
+ catch (Exception e)
+ {
+ log.error("Problem loading part of file", e);
+ return null;
+ }
+ HashTree subTree = new ListedHashTree(element);
+ Configuration[] subNodes = config.getChildren("node");
+
+ for (int i = 0; i < subNodes.length; i++)
+ {
+ HashTree t = generateNode(subNodes[i]);
+
+ if (t != null)
+ {
+ subTree.add(element, t);
+ }
+ }
+ return subTree;
+ }
+
+ public static class Test extends TestCase
+ {
+ private static final String[] FILES = new String[]
+ {
+ "AssertionTestPlan.jmx",
+ "AuthManagerTestPlan.jmx",
+ "HeaderManagerTestPlan.jmx",
+ "InterleaveTestPlan2.jmx",
+ "InterleaveTestPlan.jmx",
+ "LoopTestPlan.jmx",
+ "Modification Manager.jmx",
+ "OnceOnlyTestPlan.jmx",
+ "proxy.jmx",
+ "ProxyServerTestPlan.jmx",
+ "SimpleTestPlan.jmx",
+ };
+
+ public Test(String name)
+ {
+ super(name);
}
-
- public static class Test extends TestCase
+
+ public void setUp()
+ {}
+
+ public void testLoadAndSave() throws java.io.IOException
{
- private static final String[] FILES= new String[]
- {
- "AssertionTestPlan.jmx",
- "AuthManagerTestPlan.jmx",
- "HeaderManagerTestPlan.jmx",
- "InterleaveTestPlan2.jmx",
- "InterleaveTestPlan.jmx",
- "LoopTestPlan.jmx",
- "Modification Manager.jmx",
- "OnceOnlyTestPlan.jmx",
- "proxy.jmx",
- "ProxyServerTestPlan.jmx",
- "SimpleTestPlan.jmx",
- };
+ byte[] original = new byte[1000000];
- public Test(String name)
- {
- super(name);
- }
-
- public void setUp() {
- }
+ for (int i = 0; i < FILES.length; i++)
+ {
+ InputStream in = new FileInputStream(new File("testfiles/" +
FILES[i]));
+ int len = in.read(original);
+
+ in.close();
- public void testLoadAndSave() throws java.io.IOException {
- byte[] original= new byte[1000000];
+ in = new ByteArrayInputStream(original, 0, len);
+ HashTree tree = loadSubTree(in);
- for (int i=0; i<FILES.length; i++) {
- InputStream in= new FileInputStream(new
File("testfiles/"+FILES[i]));
- int len= in.read(original);
- in.close();
-
- in= new ByteArrayInputStream(original, 0, len);
- HashTree tree= loadSubTree(in);
- in.close();
-
- ByteArrayOutputStream out= new ByteArrayOutputStream(1000000);
- saveSubTree(tree, out);
- out.close();
-
- // We only check the length of the result. Comparing the
- // actual result (out.toByteArray==original) will usually
- // fail, because the order of the properties within each
- // test element may change. Comparing the lengths should be
- // enough to detect most problem cases...
- if (len!=out.size()) {
- fail("Loading file bin/testfiles/"+FILES[i]+" and "+
- "saving it back changes its contents.");
- }
-
- // Note this test will fail if a property is added or
- // removed to any of the components used in the test
- // files. The way to solve this is to appropriately change
- // the test file.
- }
+ in.close();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream(1000000);
+
+ saveSubTree(tree, out);
+ out.close();
+
+ // We only check the length of the result. Comparing the
+ // actual result (out.toByteArray==original) will usually
+ // fail, because the order of the properties within each
+ // test element may change. Comparing the lengths should be
+ // enough to detect most problem cases...
+ if (len != out.size())
+ {
+ fail("Loading file bin/testfiles/" + FILES[i] + " and " +
"saving it back changes its contents.");
}
+
+ // Note this test will fail if a property is added or
+ // removed to any of the components used in the test
+ // files. The way to solve this is to appropriately change
+ // the test file.
+ }
}
+ }
}
1.2 +60 -41 jakarta-jmeter/src/core/org/apache/jmeter/save/DataSource.java
Index: DataSource.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/save/DataSource.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DataSource.java 22 Oct 2002 04:13:46 -0000 1.1
+++ DataSource.java 4 Feb 2003 21:02:13 -0000 1.2
@@ -1,11 +1,13 @@
package org.apache.jmeter.save;
+
import java.io.IOException;
import java.util.Collection;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jorphan.collections.HashTree;
+
/**
* @author Administrator
*
@@ -14,46 +16,63 @@
*/
public interface DataSource
{
- public final static int BASE_INFO_MASK = 1;
- public final static int EXTRA_INFO_MASK = 1 << 1;
- public final static int SUB_RESULTS_MASK = 1 << 2;
- public final static int RESPONSE_MASK = 1 << 3;
- public final static int REQUEST_DATA_MASK = 1 << 4;
- public final static int ASSERTION_RESULTS_MASK = 1 << 5;
-
- public final static int APPEND = 1;
- public final static int OVERWRITE = 2;
-
- /**
- * Opens a file for recording sample results.
* @param filename The name of
the file to record to. Any attempt to open a file that's
- * already been opened will result in an exception
* @param mode Mode
indicates whether the file is opened for appending data to the
- * end of the file or overwriting the file contents.
* @param contentMask
- A mask defining what data is recorded. The options are:<br>
- * BASE_INFO_MASK = all the basic data points (label, time, success)<br>
- * EXTRA_INFO_MASK = Various miscellaneous data (thread_name, timestamp,
response code,
- * response message, data type)<br>
- * SUB_RESULTS_MASK = Whether to include sub results in the recording. The
level of detail
- * of the sub results will match that chosen for the main result<br>
- * RESPONSE_MASK = Whether to store the response data<br>
- * REQUEST_DATA_MASK = Records the request data<br>
- * ASSERTION_RESULTS_MASK = Record the messages from assertions
- *
*/
- public void openSource(int mode,int contentMask) throws IOException;
-
- /**
- * Closes a file that had been opened for recording.
* @param filename
Name of file to close.
*/
- public void closeSource() throws IOException;
-
- /**
- * Load a file of previously recorded sample results and return them all in a
collection.
* @return Collection
* @throws JMeterSaveException
*/
- public Collection loadLog() throws IOException;
-
- /**
- * Load a number of samples from the data source, starting from the next
sample.
* @param length
* @return Collection
* @throws IOException
*/
- public Collection loadLog(int length) throws IOException;
-
- /**
- * Save a SampleResult object to the specified file. The file must have been
initialized
- * with a {@link beginRecording(String,int,int,int)} call.
* @param
filename
* @param result
* @throws JMeterSaveException
*/
- public void recordSample(SampleResult result) throws IOException;
+ public final static int BASE_INFO_MASK = 1;
+ public final static int EXTRA_INFO_MASK = 1 << 1;
+ public final static int SUB_RESULTS_MASK = 1 << 2;
+ public final static int RESPONSE_MASK = 1 << 3;
+ public final static int REQUEST_DATA_MASK = 1 << 4;
+ public final static int ASSERTION_RESULTS_MASK = 1 << 5;
+
+ public final static int APPEND = 1;
+ public final static int OVERWRITE = 2;
+
+ /**
+ * Opens a file for recording sample results.
+ * @param filename The name of the file to record to. Any attempt to open a
file that's
+ * already been opened will result in an exception
+ * @param mode Mode indicates whether the file is opened for appending data to
the
+ * end of the file or overwriting the file contents.
+ * @param contentMask - A mask defining what data is recorded. The options
are:<br>
+ * BASE_INFO_MASK = all the basic data points (label, time, success)<br>
+ * EXTRA_INFO_MASK = Various miscellaneous data (thread_name, timestamp,
response code,
+ * response message, data type)<br>
+ * SUB_RESULTS_MASK = Whether to include sub results in the recording. The
level of detail
+ * of the sub results will match that chosen for the main result<br>
+ * RESPONSE_MASK = Whether to store the response data<br>
+ * REQUEST_DATA_MASK = Records the request data<br>
+ * ASSERTION_RESULTS_MASK = Record the messages from assertions
+ *
+ */
+ public void openSource(int mode, int contentMask) throws IOException;
+
+ /**
+ * Closes a file that had been opened for recording.
+ * @param filename Name of file to close.
+ */
+ public void closeSource() throws IOException;
+
+ /**
+ * Load a file of previously recorded sample results and return them all in a
collection.
+ * @return Collection
+ * @throws JMeterSaveException
+ */
+ public Collection loadLog() throws IOException;
+
+ /**
+ * Load a number of samples from the data source, starting from the next sample.
+ * @param length
+ * @return Collection
+ * @throws IOException
+ */
+ public Collection loadLog(int length) throws IOException;
+
+ /**
+ * Save a SampleResult object to the specified file. The file must have been
initialized
+ * with a {@link beginRecording(String,int,int,int)} call.
+ * @param filename
+ * @param result
+ * @throws JMeterSaveException
+ */
+ public void recordSample(SampleResult result) throws IOException;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]