Apache JMeter

org.apache.jmeter.save
Class CSVSaveService

java.lang.Object
  extended byorg.apache.jmeter.save.CSVSaveService

public final class CSVSaveService
extends Object

This class provides a means for saving/reading test results as CSV files.


Method Summary
static SampleSaveConfiguration getSampleSaveConfiguration(String headerLine, String filename)
          Parse a CSV header line
static SampleEvent makeResultFromDelimitedString(String inputLine, SampleSaveConfiguration saveConfig, long lineNumber)
          Make a SampleResult given a delimited string.
static String printableFieldNamesToString()
          Generates the field names for the output file
static String printableFieldNamesToString(SampleSaveConfiguration saveConfig)
          Generates the field names for the output file
static String resultToDelimitedString(SampleEvent event)
          Convert a result into a string, where the fields of the result are separated by the default delimiter.
static String resultToDelimitedString(SampleEvent event, String delimiter)
          Convert a result into a string, where the fields of the result are separated by a specified String.
static void saveCSVStats(Vector data, FileWriter writer)
          Method will save aggregate statistics as CSV.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

makeResultFromDelimitedString

public static SampleEvent makeResultFromDelimitedString(String inputLine,
                                                        SampleSaveConfiguration saveConfig,
                                                        long lineNumber)
Make a SampleResult given a delimited string.

Parameters:
inputLine - - line from CSV file
saveConfig - - configuration
lineNumber - - line number for error reporting
Returns:
SampleResult or null if header line detected
Throws:
JMeterError

printableFieldNamesToString

public static String printableFieldNamesToString()
Generates the field names for the output file

Returns:
the field names as a string

printableFieldNamesToString

public static String printableFieldNamesToString(SampleSaveConfiguration saveConfig)
Generates the field names for the output file

Returns:
the field names as a string

getSampleSaveConfiguration

public static SampleSaveConfiguration getSampleSaveConfiguration(String headerLine,
                                                                 String filename)
Parse a CSV header line

Parameters:
headerLine - from CSV file
filename - name of file (for log message only)
Returns:
config corresponding to the header items found or null if not a header line

saveCSVStats

public static void saveCSVStats(Vector data,
                                FileWriter writer)
                         throws IOException
Method will save aggregate statistics as CSV. For now I put it here. Not sure if it should go in the newer SaveService instead of here. if we ever decide to get rid of this class, we'll need to move this method to the new save service.

Parameters:
data -
writer -
Throws:
IOException

resultToDelimitedString

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

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

resultToDelimitedString

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

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

Apache JMeter

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