Search in sources :

Example 1 with CorrectedResultCollector

use of kg.apc.jmeter.vizualizers.CorrectedResultCollector in project jmeter-plugins by undera.

the class MergeResultsServiceTest method testMergeSamples_nullFilename.

@Test
public void testMergeSamples_nullFilename() throws Exception {
    CorrectedResultCollector crc = new CorrectedResultCollector();
    crc.getSaveConfig().setAsXml(false);
    crc.setFilename(null);
    MergeResultsService instance = new MergeResultsService();
    instance.mergeSamples(crc, SAMPLES);
}
Also used : CorrectedResultCollector(kg.apc.jmeter.vizualizers.CorrectedResultCollector)

Example 2 with CorrectedResultCollector

use of kg.apc.jmeter.vizualizers.CorrectedResultCollector in project jmeter-plugins by undera.

the class MergeResultsServiceTest method testMergeSamples_saveFieldNames.

@Test
public void testMergeSamples_saveFieldNames() throws Exception {
    String fname = "test-merge.csv";
    CorrectedResultCollector crc = new CorrectedResultCollector();
    crc.getSaveConfig().setAsXml(false);
    crc.setFilename(fname);
    crc.getSaveConfig().setFieldNames(true);
    MergeResultsService instance = new MergeResultsService();
    instance.mergeSamples(crc, SAMPLES);
    File f = new File(fname);
    assertEquals(true, f.exists());
    f.delete();
}
Also used : File(java.io.File) CorrectedResultCollector(kg.apc.jmeter.vizualizers.CorrectedResultCollector)

Example 3 with CorrectedResultCollector

use of kg.apc.jmeter.vizualizers.CorrectedResultCollector in project jmeter-plugins by undera.

the class FilterResultsTool method processParams.

@Override
protected int processParams(ListIterator args) throws UnsupportedOperationException, IllegalArgumentException {
    String outputFile = "out.res";
    LoggingManager.setPriority(Priority.INFO);
    // first process params without worker created
    while (args.hasNext()) {
        String nextArg = (String) args.next();
        if (nextArg.equals("--loglevel")) {
            args.remove();
            String loglevelStr = (String) args.next();
            args.remove();
            LoggingManager.setPriority(loglevelStr);
        }
    }
    // rewind it
    while (args.hasPrevious()) {
        args.previous();
    }
    CorrectedResultCollector collector = filterResults.getCollector();
    SampleSaveConfiguration saveConfig = collector.getSaveConfig();
    while (args.hasNext()) {
        String nextArg = (String) args.next();
        log.debug("Arg: " + nextArg);
        if (nextArg.equalsIgnoreCase("--input-file")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing input file JTL (or CSV) file name");
            }
            collector.setProperty("filename", (String) args.next());
            log.info("--input-file " + collector.getFilename());
        } else if (nextArg.equalsIgnoreCase("--output-file")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing Output file name");
            }
            // outputfile is a parameter to FilterResults
            outputFile = (String) args.next();
            log.info("--output-file " + outputFile);
        } else if (nextArg.equalsIgnoreCase("--include-labels")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing include labels list");
            }
            collector.setIncludeLabels((String) args.next());
            log.info("--include-labels " + collector.getList(CorrectedResultCollector.INCLUDE_SAMPLE_LABELS));
        } else if (nextArg.equalsIgnoreCase("--exclude-labels")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing exclude labels list");
            }
            collector.setExcludeLabels((String) args.next());
            log.info("--exclude-labels " + collector.getList(CorrectedResultCollector.EXCLUDE_SAMPLE_LABELS));
        } else if (nextArg.equalsIgnoreCase("--success-filter")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing success filter flag (true/false)");
            }
            collector.setSuccessOnlyLogging(Boolean.valueOf((String) args.next()));
            log.info("--success-filter " + collector.isSuccessOnlyLogging());
        } else if (nextArg.equalsIgnoreCase("--include-label-regex")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing include label regex flag (true/false)");
            }
            collector.setEnabledIncludeRegex(Boolean.valueOf((String) args.next()));
            log.info("--include-label-regex " + collector.getRegexChkboxState(CorrectedResultCollector.INCLUDE_REGEX_CHECKBOX_STATE));
        } else if (nextArg.equalsIgnoreCase("--exclude-label-regex")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing exclude label regex flag (true/false)");
            }
            collector.setEnabledExcludeRegex(Boolean.valueOf((String) args.next()));
            log.info("--exclude-label-regex " + collector.getRegexChkboxState(CorrectedResultCollector.EXCLUDE_REGEX_CHECKBOX_STATE));
        } else if (nextArg.equalsIgnoreCase("--start-offset")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing start offset flag (sec)");
            }
            collector.setStartOffset((String) args.next());
            log.info("--start-offset " + collector.getPropertyAsString(CorrectedResultCollector.START_OFFSET));
        } else if (nextArg.equalsIgnoreCase("--end-offset")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing end offset flag (sec)");
            }
            collector.setEndOffset((String) args.next());
            log.info("--end-offset " + collector.getPropertyAsString(CorrectedResultCollector.END_OFFSET));
        } else if (nextArg.equalsIgnoreCase("--save-as-xml")) {
            if (!args.hasNext()) {
                throw new IllegalArgumentException("Missing save as xml flag (true/false, true = XML/false = CSV)");
            }
            saveConfig.setAsXml(Boolean.valueOf((String) args.next()));
            log.info("--save-as-xml " + saveConfig.saveAsXml());
        } else {
            throw new UnsupportedOperationException("Unrecognized option: " + nextArg);
        }
    }
    collector.setSaveConfig(saveConfig);
    return doJob(collector, outputFile);
}
Also used : SampleSaveConfiguration(org.apache.jmeter.samplers.SampleSaveConfiguration) CorrectedResultCollector(kg.apc.jmeter.vizualizers.CorrectedResultCollector)

Example 4 with CorrectedResultCollector

use of kg.apc.jmeter.vizualizers.CorrectedResultCollector in project jmeter-plugins by undera.

the class AbstractGraphPanelVisualizerTest method testMinMax_min_max.

@Test
public void testMinMax_min_max() {
    CorrectedResultCollector instance = new CorrectedResultCollector();
    instance.setStartOffset("10");
    instance.setEndOffset("20");
    instance.testStarted();
    DebugVisualizer vis = new DebugVisualizer();
    vis.configure(instance);
    instance.setListener(vis);
    vis.startTimeRef = 10300;
    vis.startTimeInf = 10000;
    vis.startTimeSup = 11000;
    vis.lastLabel = null;
    SampleResult res = SampleResult.createTestSample(31500, 32000);
    res.setSampleLabel("test");
    instance.sampleOccurred(new SampleEvent(res, "tg"));
    assertNull(vis.lastLabel);
    vis.lastLabel = null;
    SampleResult res1 = SampleResult.createTestSample(29000, 30000);
    res1.setSampleLabel("test1");
    instance.sampleOccurred(new SampleEvent(res1, "tg"));
    assertEquals("test1", vis.lastLabel);
    vis.lastLabel = null;
    SampleResult res2 = SampleResult.createTestSample(19000, 20000);
    res2.setSampleLabel("test2");
    instance.sampleOccurred(new SampleEvent(res2, "tg"));
    assertNull(vis.lastLabel);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) CorrectedResultCollector(kg.apc.jmeter.vizualizers.CorrectedResultCollector) SampleEvent(org.apache.jmeter.samplers.SampleEvent)

Example 5 with CorrectedResultCollector

use of kg.apc.jmeter.vizualizers.CorrectedResultCollector in project jmeter-plugins by undera.

the class AbstractGraphPanelVisualizerTest method testMinMax_none.

@Test
public void testMinMax_none() {
    CorrectedResultCollector instance = new CorrectedResultCollector();
    instance.testStarted();
    DebugVisualizer vis = new DebugVisualizer();
    vis.configure(instance);
    instance.setListener(vis);
    SampleResult res = SampleResult.createTestSample(21000, 30000);
    res.setSampleLabel("test");
    instance.sampleOccurred(new SampleEvent(res, "tg"));
    assertEquals("test", vis.lastLabel);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) CorrectedResultCollector(kg.apc.jmeter.vizualizers.CorrectedResultCollector) SampleEvent(org.apache.jmeter.samplers.SampleEvent)

Aggregations

CorrectedResultCollector (kg.apc.jmeter.vizualizers.CorrectedResultCollector)22 SampleEvent (org.apache.jmeter.samplers.SampleEvent)12 SampleResult (org.apache.jmeter.samplers.SampleResult)12 File (java.io.File)4 IOException (java.io.IOException)1 AbstractGraphPanelVisualizer (kg.apc.jmeter.graphs.AbstractGraphPanelVisualizer)1 SampleSaveConfiguration (org.apache.jmeter.samplers.SampleSaveConfiguration)1 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)1 JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)1 NullProperty (org.apache.jmeter.testelement.property.NullProperty)1