use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class AggregateReportGuiTest method testAdd.
/**
* Test of add method, of class StatVisualizerAccessorGui.
*/
@Test
public void testAdd() throws IOException {
System.out.println("add");
AggregateReportGui instance = new AggregateReportGui();
SampleResult res = new SampleResult();
instance.add(res);
SampleResult res2 = new SampleResult();
instance.add(res2);
ResultCollector rc = new ResultCollector();
rc.setListener(instance);
rc.sampleOccurred(new SampleEvent(res, ""));
rc.sampleOccurred(new SampleEvent(res2, ""));
File f = File.createTempFile("test", ".csv");
instance.getGraphPanelChart().saveGraphToCSV(f);
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class JMXMonCollector method generateSample.
@Override
public void generateSample(double value, String label) {
JMXMonSampleResult res = new JMXMonSampleResult();
res.setSampleLabel(label);
res.setValue(value);
res.setSuccessful(true);
SampleEvent e = new SampleEvent(res, JMXMON);
jmxMonSampleOccurred(e);
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter by apache.
the class TestResultSaver method testSuccess.
@Test
public void testSuccess() {
sampleResult.setSuccessful(true);
resultSaver.setProperty(ResultSaver.NUMBER_PAD_LENGTH, "5");
resultSaver.testStarted();
resultSaver.sampleOccurred(new SampleEvent(sampleResult, "JUnit-TG"));
String fileName = sampleResult.getResultFileName();
assertNotNull(fileName);
assertEquals("00001.unknown", fileName);
File file = new File(FileServer.getDefaultBase(), fileName);
assertTrue(file.exists());
assertTrue(file.delete());
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter by apache.
the class TestResultSaver method testFailureSaveErrorsOnly.
@Test
public void testFailureSaveErrorsOnly() {
sampleResult.setSuccessful(true);
resultSaver.setProperty(ResultSaver.NUMBER_PAD_LENGTH, "5");
resultSaver.setProperty(ResultSaver.VARIABLE_NAME, "myVar");
resultSaver.setProperty(ResultSaver.ERRORS_ONLY, "true");
resultSaver.testStarted();
sampleResult.setSuccessful(false);
resultSaver.sampleOccurred(new SampleEvent(sampleResult, "JUnit-TG"));
String fileName = sampleResult.getResultFileName();
assertNotNull(fileName);
assertEquals("00001.unknown", fileName);
File file = new File(FileServer.getDefaultBase(), fileName);
assertTrue(file.exists());
assertTrue(file.delete());
assertEquals("00001.unknown", vars.get("myVar"));
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter by apache.
the class JMeterThread method notifyListeners.
private void notifyListeners(List<SampleListener> listeners, SampleResult result) {
SampleEvent event = new SampleEvent(result, threadGroup.getName(), threadVars);
notifier.notifyListeners(event, listeners);
}
Aggregations