Search in sources :

Example 41 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class AbstractGraphPanelVisualizerTest method testIncludeExcludeRegex_exclude_include.

@Test
public void testIncludeExcludeRegex_exclude_include() {
    CorrectedResultCollector instance = new CorrectedResultCollector();
    instance.setExcludeLabels("[T-Z][0-9].*");
    instance.setIncludeLabels("[P-T][0-9].*");
    instance.setProperty(CorrectedResultCollector.EXCLUDE_REGEX_CHECKBOX_STATE, true);
    instance.setProperty(CorrectedResultCollector.INCLUDE_REGEX_CHECKBOX_STATE, true);
    instance.testStarted();
    DebugVisualizer vis = new DebugVisualizer();
    vis.configure(instance);
    instance.setListener(vis);
    vis.lastLabel = null;
    SampleResult res = new SampleResult();
    res.setSampleLabel("Z1_TEST");
    instance.sampleOccurred(new SampleEvent(res, "tg"));
    assertNull(vis.lastLabel);
    vis.lastLabel = null;
    SampleResult res2 = new SampleResult();
    res2.setSampleLabel("P1_TEST");
    instance.sampleOccurred(new SampleEvent(res2, "tg"));
    assertEquals("P1_TEST", vis.lastLabel);
    vis.lastLabel = null;
    SampleResult res3 = new SampleResult();
    res3.setSampleLabel("T1_TEST");
    instance.sampleOccurred(new SampleEvent(res3, "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 42 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class AbstractGraphPanelVisualizerTest method testIncludeExcludeRegex_exclude_only.

@Test
public void testIncludeExcludeRegex_exclude_only() {
    CorrectedResultCollector instance = new CorrectedResultCollector();
    instance.setProperty(CorrectedResultCollector.EXCLUDE_SAMPLE_LABELS, "P[0-9].*");
    instance.setProperty(CorrectedResultCollector.EXCLUDE_REGEX_CHECKBOX_STATE, true);
    instance.testStarted();
    DebugVisualizer vis = new DebugVisualizer();
    instance.setListener(vis);
    vis.configure(instance);
    vis.lastLabel = null;
    SampleResult res = new SampleResult();
    res.setSampleLabel("P1_TEST");
    instance.sampleOccurred(new SampleEvent(res, "tg"));
    assertNull(vis.lastLabel);
    vis.lastLabel = null;
    SampleResult res1 = new SampleResult();
    res1.setSampleLabel("T1_TEST");
    instance.sampleOccurred(new SampleEvent(res1, "tg"));
    assertEquals("T1_TEST", vis.lastLabel);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) CorrectedResultCollector(kg.apc.jmeter.vizualizers.CorrectedResultCollector) SampleEvent(org.apache.jmeter.samplers.SampleEvent)

Example 43 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class AutoStopTest method testSampleOccurred.

/**
 * Test of sampleOccurred method, of class AutoStop.
 */
@Test
public void testSampleOccurred() throws InterruptedException {
    System.out.println("sampleOccurred");
    SampleResult res = new SampleResult();
    res.setLatency(500);
    SampleEvent se = new SampleEvent(res, "");
    AutoStop instance = new AutoStop();
    instance.setResponseTime("10");
    instance.setResponseTimeSecs("3");
    instance.setErrorRate("0");
    instance.sampleOccurred(se);
    for (int n = 0; n < 5; n++) {
        synchronized (this) {
            wait(1000);
        }
        instance.sampleOccurred(se);
    }
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) SampleEvent(org.apache.jmeter.samplers.SampleEvent) Test(org.junit.Test)

Example 44 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class AbstractDynamicThreadGroupModel method saveLogRecord.

protected void saveLogRecord(String marker, String threadName, String arrivalID) {
    SampleResult res = new SampleResult();
    res.sampleStart();
    res.setSampleLabel(arrivalID);
    res.setResponseMessage(marker);
    res.setThreadName(threadName);
    res.sampleEnd();
    SampleEvent evt = new SampleEvent(res, getName());
    logFile.sampleOccurred(evt);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) SampleEvent(org.apache.jmeter.samplers.SampleEvent)

Example 45 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class MonitoringResultsCollectorTest method testMonitoringSampleOccurred.

/**
 * Test of monitoringSampleOccurred method, of class MonitoringResultsCollector.
 */
@Test
public void testMonitoringSampleOccurred() {
    System.out.println("monitoringSampleOccurred");
    SampleEvent event = new SampleEvent(new SampleResult(), "test");
    MonitoringResultsCollector instance = new MonitoringResultsCollector();
    instance.monitoringSampleOccurred(event);
// TODO review the generated test code and remove the default call to fail.
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) SampleEvent(org.apache.jmeter.samplers.SampleEvent) Test(org.junit.Test)

Aggregations

SampleEvent (org.apache.jmeter.samplers.SampleEvent)58 SampleResult (org.apache.jmeter.samplers.SampleResult)30 Test (org.junit.Test)17 CorrectedResultCollector (kg.apc.jmeter.vizualizers.CorrectedResultCollector)12 Test (org.junit.jupiter.api.Test)10 File (java.io.File)5 JMeterSerialTest (org.apache.jorphan.test.JMeterSerialTest)4 SampleSaveConfiguration (org.apache.jmeter.samplers.SampleSaveConfiguration)3 JMeterVariables (org.apache.jmeter.threads.JMeterVariables)3 IOException (java.io.IOException)2 ResultCollector (org.apache.jmeter.reporters.ResultCollector)2 StatisticalSampleResult (org.apache.jmeter.samplers.StatisticalSampleResult)2 ArrivalsThreadGroupTest (com.blazemeter.jmeter.threads.arrivals.ArrivalsThreadGroupTest)1 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1