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-plugins by undera.
the class MonitoringResultsCollector method generateSample.
@Override
public void generateSample(double value, String label) {
MonitoringSampleResult res = new MonitoringSampleResult();
res.setSampleLabel(label);
res.setValue(value);
res.setSuccessful(true);
SampleEvent e = new SampleEvent(res, getPrefix());
monitoringSampleOccurred(e);
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class FlexibleFileWriterTest method testSampleOccurred.
@Test
public void testSampleOccurred() throws IOException {
System.out.println("sampleOccurred");
SampleResult res = new SampleResult();
res.setResponseData("test".getBytes());
SampleEvent e = new SampleEvent(res, "Test");
FlexibleFileWriter instance = new FlexibleFileWriter();
instance.setColumns("isSuccsessful|\\t||\\t|latency");
String tmpFile = File.createTempFile("ffw_test_", ".txt").getAbsolutePath();
instance.setFilename(tmpFile);
instance.testStarted();
for (int n = 0; n < 10; n++) {
String exp = "0\t|\t" + n;
System.out.println(exp);
res.setLatency(n);
res.setSampleLabel("n" + n);
instance.sampleOccurred(e);
// ByteBuffer written = instance.fileEmul.getWrittenBytes();
// assertEquals(exp, JMeterPluginsUtils.byteBufferToString(written));
}
instance.testEnded();
assertTrue(tmpFile.length() > 0);
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class FlexibleFileWriterTest method testSampleOccurred_var.
@Test
public void testSampleOccurred_var() throws IOException {
System.out.println("sampleOccurred-var");
SampleResult res = new SampleResult();
res.setResponseData("test".getBytes());
JMeterVariables vars = new JMeterVariables();
vars.put("TEST1", "TEST");
SampleEvent e = new SampleEvent(res, "Test", vars);
FlexibleFileWriter instance = new FlexibleFileWriter();
instance.setFilename(File.createTempFile("ffw_test_", ".txt").getAbsolutePath());
System.out.println("prop: " + JMeterUtils.getProperty("sample_variables"));
System.out.println("count: " + SampleEvent.getVarCount());
instance.setColumns("variable#0| |variable#| |variable#4t");
instance.testStarted();
for (int n = 0; n < 10; n++) {
String exp = "TEST variable# variable#4t";
System.out.println(exp);
instance.sampleOccurred(e);
// ByteBuffer written = instance.fileEmul.getWrittenBytes();
// assertEquals(exp, JMeterPluginsUtils.byteBufferToString(written));
}
instance.testEnded();
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class FlexibleFileWriterTest method testSampleOccurred_labels.
@Test
public void testSampleOccurred_labels() throws IOException {
System.out.println("sampleOccurred_labels");
SampleResult res = new SampleResult();
res.setResponseData("test".getBytes());
FlexibleFileWriter instance = new FlexibleFileWriter();
instance.setFilename(File.createTempFile("ffw_test_", ".txt").getAbsolutePath());
instance.setColumns("threadName|\\t|sampleLabel");
instance.testStarted();
res.setSampleLabel("SAMPLELBL");
res.setThreadName("THRDNAME");
SampleEvent e = new SampleEvent(res, "Test");
instance.sampleOccurred(e);
// ByteBuffer written = instance.fileEmul.getWrittenBytes();
// assertEquals(exp, JMeterPluginsUtils.byteBufferToString(written));
instance.testEnded();
}
Aggregations