use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class MergeResultsService method mergeSamples.
public void mergeSamples(CorrectedResultCollector crc, List<SampleResult> samples) {
SampleEvent event;
try {
initializeFileOutput(crc.getFilename(), crc.getSaveConfig());
} catch (IOException e) {
log.warn("Error trying to initialize output file " + e.toString());
}
for (SampleResult result : samples) {
SampleSaveConfiguration config = crc.getSaveConfig();
event = new SampleEvent(result, null);
try {
if (config.saveAsXml()) {
SaveService.saveSampleResult(event, out);
} else {
// !saveAsXml
String savee = CSVSaveService.resultToDelimitedString(event);
out.println(savee);
}
} catch (Exception err) {
log.error("Error trying to record a sample", err);
// should throw exception back to caller
}
}
finalizeFileOutput();
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class PerfMonCollectorTest method testSampleOccurred.
/**
* Test of sampleOccurred method, of class PerfMonCollector.
*/
@Test
public void testSampleOccurred() {
System.out.println("sampleOccurred");
SampleEvent event = new SampleEvent(new PerfMonSampleResult(), "test");
PerfMonCollector instance = new PerfMonCollector();
instance.sampleOccurred(event);
// TODO review the generated test code and remove the default call to fail.
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class PerfMonCollector method generateErrorSample.
@Override
public void generateErrorSample(String label, String errorMsg) {
PerfMonSampleResult res = new PerfMonSampleResult();
res.setSampleLabel(label);
res.setValue(-1L);
res.setResponseMessage(errorMsg);
res.setSuccessful(false);
SampleEvent e = new SampleEvent(res, PERFMON);
super.sampleOccurred(e);
log.error("Perfmon plugin error: " + errorMsg);
}
Aggregations