@Test public void testDoJob() throws IOException { System.out.println("doJob 1"); instance.setInputFile(basedir + "/short.jtl"); File pngfile = File.createTempFile("test", ".png"); instance.setOutputPNGFile(pngfile.getAbsolutePath()); instance.setYAxisLabel("Response time [ms]"); File csvfile = File.createTempFile("test", ".csv"); instance.setOutputCSVFile(csvfile.getAbsolutePath()); instance.setPluginType("ResponseTimesOverTime"); instance.addExportMode(PluginsCMDWorker.EXPORT_PNG); instance.addExportMode(PluginsCMDWorker.EXPORT_CSV); int result = instance.doJob(); int expResult = 0; assertEquals(expResult, result); System.out.println(csvfile.length()); System.out.println(pngfile.length()); assertTrue(110 < csvfile.length()); assertTrue(16000 < pngfile.length()); }
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"))) { mergeResults(pluginInstance, rc); } else { log.debug("Using JTL file: " + inputFile); rc.setFilename(inputFile); rc.setListener(pluginInstance); pluginInstance.configure(rc); rc.loadExistingFile(); } setOptions(pluginInstance); pluginInstance.getGraphPanelChart().setYAxisLabel(yAxisLabel); 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); } } return 0; }
PluginsCMDWorker { 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"))) { mergeResults(pluginInstance, rc); } else { log.debug("Using JTL file: " + inputFile); rc.setFilename(inputFile); rc.setListener(pluginInstance); pluginInstance.configure(rc); rc.loadExistingFile(); } setOptions(pluginInstance); pluginInstance.getGraphPanelChart().setYAxisLabel(yAxisLabel); 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); } } return 0; } }
PluginsCMDWorker { 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"))) { mergeResults(pluginInstance, rc); } else { log.debug("Using JTL file: " + inputFile); rc.setFilename(inputFile); rc.setListener(pluginInstance); pluginInstance.configure(rc); rc.loadExistingFile(); } setOptions(pluginInstance); pluginInstance.getGraphPanelChart().setYAxisLabel(yAxisLabel); 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); } } return 0; } PluginsCMDWorker(); }
PluginsCMDWorker { 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"))) { mergeResults(pluginInstance, rc); } else { log.debug("Using JTL file: " + inputFile); rc.setFilename(inputFile); rc.setListener(pluginInstance); pluginInstance.configure(rc); rc.loadExistingFile(); } setOptions(pluginInstance); pluginInstance.getGraphPanelChart().setYAxisLabel(yAxisLabel); 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); } } return 0; } PluginsCMDWorker(); void addExportMode(int mode); void setInputFile(String string); void setOutputCSVFile(String string); void setOutputPNGFile(String string); void setPluginType(String string); void setGraphWidth(int i); void setGraphHeight(int i); void setYAxisLabel(String yAxisLabel); int doJob(); void setAggregate(int logicValue); void setZeroing(int logicValue); void setPreventOutliers(int logicValue); void setRowsLimit(int parseInt); void setForceY(int parseInt); void setHideLowCounts(int parseInt); void setGranulation(int parseInt); void setRelativeTimes(int logicValue); void setGradient(int logicValue); void setMarkers(int logicValue); void setIncludeLabels(String string); void setExcludeLabels(String string); void setIncludeSamplesWithRegex(int logicValue); void setExcludeSamplesWithRegex(int logicValue); void setStartOffset(String string); void setEndOffset(String string); void setAutoScaleRows(int logicValue); void setLineWeight(float parseInt); void setSuccessFilter(int logicValue); void processUnknownOption(String nextArg, ListIterator args); }
PluginsCMDWorker { 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"))) { mergeResults(pluginInstance, rc); } else { log.debug("Using JTL file: " + inputFile); rc.setFilename(inputFile); rc.setListener(pluginInstance); pluginInstance.configure(rc); rc.loadExistingFile(); } setOptions(pluginInstance); pluginInstance.getGraphPanelChart().setYAxisLabel(yAxisLabel); 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); } } return 0; } PluginsCMDWorker(); void addExportMode(int mode); void setInputFile(String string); void setOutputCSVFile(String string); void setOutputPNGFile(String string); void setPluginType(String string); void setGraphWidth(int i); void setGraphHeight(int i); void setYAxisLabel(String yAxisLabel); int doJob(); void setAggregate(int logicValue); void setZeroing(int logicValue); void setPreventOutliers(int logicValue); void setRowsLimit(int parseInt); void setForceY(int parseInt); void setHideLowCounts(int parseInt); void setGranulation(int parseInt); void setRelativeTimes(int logicValue); void setGradient(int logicValue); void setMarkers(int logicValue); void setIncludeLabels(String string); void setExcludeLabels(String string); void setIncludeSamplesWithRegex(int logicValue); void setExcludeSamplesWithRegex(int logicValue); void setStartOffset(String string); void setEndOffset(String string); void setAutoScaleRows(int logicValue); void setLineWeight(float parseInt); void setSuccessFilter(int logicValue); void processUnknownOption(String nextArg, ListIterator args); static final int EXPORT_PNG; static final int EXPORT_CSV; }