}
public int doJob() {
checkParams();
AbstractGraphPanelVisualizer pluginInstance = pluginType;
pluginType.setIgnoreCurrentTestStartTime();
setOptions(pluginInstance);
CorrectedResultCollector rc;
rc = (CorrectedResultCollector) pluginInstance.createTestElement();
rc.setExcludeLabels(excludeLabels);
rc.setIncludeLabels(includeLabels);
rc.setStartOffset(startOffset);
rc.setEndOffset(endOffset);
if (includeSamplesWithRegex >= 0) {
rc.setEnabledIncludeRegex(includeSamplesWithRegex != 0);
}
if (excludeSamplesWithRegex >= 0) {
rc.setEnabledExcludeRegex(excludeSamplesWithRegex != 0);
}
if (successFilter >= 0) {
rc.setErrorLogging(successFilter == 0);
rc.setSuccessOnlyLogging(successFilter != 0);
}
if (pluginType.getStaticLabel().equals(
JMeterPluginsUtils.prefixLabel("Merge Results"))) {
log.debug("Using properties file with MergeResults plugin: "
+ inputFile);
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream(inputFile);
// load a properties file
prop.load(input);
for (int i = 1; i < 5; i++) {
rc.setFilename(null == prop.getProperty("inputJtl" + i) ? ""
: prop.getProperty("inputJtl" + i));
if (rc.getFilename().isEmpty()) {
break;
}
rc.setPrefixLabel(null == prop.getProperty("prefixLabel"
+ i) ? "" : prop.getProperty("prefixLabel" + i));
rc.setIncludeLabels(null == prop
.getProperty("includeLabels" + i) ? "" : prop
.getProperty("includeLabels" + i));
rc.setExcludeLabels(null == prop
.getProperty("excludeLabels" + i) ? "" : prop
.getProperty("excludeLabels" + i));
rc.setEnabledIncludeRegex(Boolean.valueOf(prop
.getProperty("includeLabelRegex" + i)));
rc.setEnabledExcludeRegex(Boolean.valueOf(prop
.getProperty("excludeLabelRegex" + i)));
rc.setStartOffset(null == prop.getProperty("startOffset"
+ i) ? "" : prop.getProperty("startOffset" + i));
rc.setEndOffset(null == prop.getProperty("endOffset" + i) ? ""
: prop.getProperty("endOffset" + i));
rc.setListener(pluginInstance);
pluginInstance.configure(rc);
// rc.testStarted();
rc.loadExistingFile();
// rc.testEnded();
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} else {
log.debug("Using JTL file: " + inputFile);
rc.setFilename(inputFile);
rc.setListener(pluginInstance);
pluginInstance.configure(rc);
// rc.testStarted();
rc.loadExistingFile();
// rc.testEnded();
}
// to handle issue 64 and since it must be cheap - set options again
setOptions(pluginInstance);
if ((exportMode & EXPORT_PNG) == EXPORT_PNG) {
File pngFile = new File(outputPNG);
forceDir(pngFile);
try {
pluginInstance.getGraphPanelChart().saveGraphToPNG(pngFile, graphWidth, graphHeight);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
if ((exportMode & EXPORT_CSV) == EXPORT_CSV) {
File csvFile = new File(outputCSV);
forceDir(csvFile);
try {
pluginInstance.getGraphPanelChart().saveGraphToCSV(csvFile);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}