Class CsvFileSampleSource
java.lang.Object
org.apache.jmeter.report.processor.AbstractSampleSource
org.apache.jmeter.report.processor.CsvFileSampleSource
- All Implemented Interfaces:
Runnable
,SampleSource
Read a csv source file and write its rows (samples) all the registered
If there is several other source files with the same root name then those files are produced on their corresponding channels.
SampleConsumer
s.If there is several other source files with the same root name then those files are produced on their corresponding channels.
The root name of the files is determined by the source file name and is made
of its name without the file extension :
Example: If results.csv
is the source file name then
results
is the root file name.
The CsvFileSampleSource
looks for all the files in the same
directory of the main source file that have the same root file name
Example : if the directory contains results.csv
,
results-1.csv
, results-2.csv
, etc. then all
these files will be read and produced on their corresponding channels.
The channel on which an input file will be produce is determined by its
suffix
- If the input file is named
results-1.csv
then it will be produced on the channel 1. - If the input file is named
results-2.csv
then it will be produced on the channel 2. - If the input file is named
results.csv
then it will be produced on the channel 0.
- Since:
- 3.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
File name whose sample are being produced on the channel -
Constructor Summary
ConstructorDescriptionCsvFileSampleSource
(File inputFile, char separator) Build a sample source from the specified input file and character separator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSampleConsumer
(SampleConsumer consumer) Add a sample consumer to this sample source.void
removeSampleConsumer
(SampleConsumer consumer) Remove a sample consumer from this sample source.void
run()
Run this sample source.
This sample source will start reading all inputs CSV files and produce their samples to this sample source registered sample consumers.void
setSampleConsumers
(List<SampleConsumer> consumers) Sets the specified sample consumers that will consume samples produced by this sample source.Methods inherited from class org.apache.jmeter.report.processor.AbstractSampleSource
getSampleContext, setSampleContext
-
Field Details
-
SOURCE_FILE_ATTRIBUTE
File name whose sample are being produced on the channel- See Also:
-
-
Constructor Details
-
CsvFileSampleSource
Build a sample source from the specified input file and character separator.- Parameters:
inputFile
- The input sample file (CSV file) (must not benull
)separator
- The character separator to be used for delimiting samples columns
-
-
Method Details
-
setSampleConsumers
Description copied from interface:SampleSource
Sets the specified sample consumers that will consume samples produced by this sample source.- Specified by:
setSampleConsumers
in interfaceSampleSource
- Specified by:
setSampleConsumers
in classAbstractSampleSource
- Parameters:
consumers
- consumers to be set
-
addSampleConsumer
Description copied from interface:SampleSource
Add a sample consumer to this sample source.- Specified by:
addSampleConsumer
in interfaceSampleSource
- Specified by:
addSampleConsumer
in classAbstractSampleSource
- Parameters:
consumer
- consumer to be added
-
removeSampleConsumer
Description copied from interface:SampleSource
Remove a sample consumer from this sample source.- Specified by:
removeSampleConsumer
in interfaceSampleSource
- Specified by:
removeSampleConsumer
in classAbstractSampleSource
- Parameters:
consumer
- consumer to be removed
-
run
public void run()Run this sample source.
This sample source will start reading all inputs CSV files and produce their samples to this sample source registered sample consumers.- Specified by:
run
in interfaceRunnable
- Specified by:
run
in classAbstractSampleSource
-