org.apache.jmeter.testelement

Class JTLData

Implemented Interfaces:
Serializable, DataSet, Visualizer

public class JTLData
extends Object
implements Serializable, DataSet

The purpose of TableData is to contain the results of a single .jtl file. It is equivalent to what the AggregateListener table. A HashMap is used to store the data. The URL is the key and the value is SamplingStatCalculator

Field Summary

protected HashMap
data
protected long
endTimestamp
protected File
inputFile
protected String
jtl_file
protected long
startTimestamp

Constructor Summary

JTLData()

Method Summary

void
add(SampleResult sample)
the implementation will set the start timestamp if the HashMap is empty. otherwise it will set the end timestamp using the end time
String
getDataSource()
Return the datasource.
String
getDataSourceName()
In some cases, we may want to return a string that isn't the full datasource string or something different.
Date
getDate()
The date we use for the result is the start timestamp.
long
getEndTimestamp()
return the timestamp in millisecond format.
String
getMonthDayDate()
convienance method for getting the date in mmdd format
String
getMonthDayYearDate()
convienant method for getting the date in yyyymmdd format
long
getStartTimestamp()
return the timestamp in millisecond format.
SamplingStatCalculator
getStatistics(String url)
The method will SamplingStatCalculator for the given URL.
Set
getStats()
Return a Set of the values
List
getStats(List urls)
The purpose of the method is to make it convienant to pass a list of the URLs and return a list of the SamplingStatCalculators.
Set
getURLs()
Return a Set of the URLs
boolean
isStats()
By default, the method always returns true.
void
loadData()
The implementation loads a single .jtl file and cleans up the ResultCollector.
void
setDataSource(String absolutePath)
Depending on the implementation, the datasouce could be a file or a RDBMS.
void
setEndTimestamp(long stamp)
Set the timestamp using the last result from the datasource
void
setStartTimestamp(long stamp)
Set the timestamp using the first result from the datasource

Field Details

data

protected HashMap data

endTimestamp

protected long endTimestamp

inputFile

protected File inputFile

jtl_file

protected String jtl_file

startTimestamp

protected long startTimestamp

Constructor Details

JTLData

public JTLData()

Method Details

add

public void add(SampleResult sample)
the implementation will set the start timestamp if the HashMap is empty. otherwise it will set the end timestamp using the end time
Specified by:
add in interface Visualizer

getDataSource

public String getDataSource()
Return the datasource. For files, it should be the absolute path. For databases, it should be the datasource name created in jmeter.
Specified by:
getDataSource in interface DataSet

getDataSourceName

public String getDataSourceName()
In some cases, we may want to return a string that isn't the full datasource string or something different. For example, we may want to return just the filename and not the absolutePath of a JTL file.
Specified by:
getDataSourceName in interface DataSet

getDate

public Date getDate()
The date we use for the result is the start timestamp. The reasoning is that a test may run for a long time, but it is most likely scheduled to run using CRON on unix or scheduled task in windows.
Specified by:
getDate in interface DataSet
Returns:
start time

getEndTimestamp

public long getEndTimestamp()
return the timestamp in millisecond format.
Specified by:
getEndTimestamp in interface DataSet

getMonthDayDate

public String getMonthDayDate()
convienance method for getting the date in mmdd format
Specified by:
getMonthDayDate in interface DataSet

getMonthDayYearDate

public String getMonthDayYearDate()
convienant method for getting the date in yyyymmdd format
Specified by:
getMonthDayYearDate in interface DataSet

getStartTimestamp

public long getStartTimestamp()
return the timestamp in millisecond format.
Specified by:
getStartTimestamp in interface DataSet

getStatistics

public SamplingStatCalculator getStatistics(String url)
The method will SamplingStatCalculator for the given URL. If the URL doesn't exist, the method returns null.
Specified by:
getStatistics in interface DataSet
Parameters:
url -
Returns:
data for this URL

getStats

public Set getStats()
Return a Set of the values
Specified by:
getStats in interface DataSet
Returns:
values

getStats

public List getStats(List urls)
The purpose of the method is to make it convienant to pass a list of the URLs and return a list of the SamplingStatCalculators. If no URLs match, the list is empty. The SamplingStatCalculators will be returned in the same sequence as the url list.
Specified by:
getStats in interface DataSet
Parameters:
urls -
Returns:
array list of non-null entries (may be empty)

getURLs

public Set getURLs()
Return a Set of the URLs
Specified by:
getURLs in interface DataSet
Returns:
set of URLs

isStats

public boolean isStats()
By default, the method always returns true. Subclasses can over ride the implementation.
Specified by:
isStats in interface Visualizer

loadData

public void loadData()
The implementation loads a single .jtl file and cleans up the ResultCollector.
Specified by:
loadData in interface DataSet

setDataSource

public void setDataSource(String absolutePath)
Depending on the implementation, the datasouce could be a file or a RDBMS. It's up to the implementing class to decide.
Specified by:
setDataSource in interface DataSet
Parameters:

setEndTimestamp

public void setEndTimestamp(long stamp)
Set the timestamp using the last result from the datasource
Specified by:
setEndTimestamp in interface DataSet
Parameters:
stamp -

setStartTimestamp

public void setStartTimestamp(long stamp)
Set the timestamp using the first result from the datasource
Specified by:
setStartTimestamp in interface DataSet
Parameters:
stamp -

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