use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class JMXMonCollectorTest method testJMXMonSampleOccurred.
/**
* Test of JMXMonSampleOccurred method, of class JMXMonCollector.
*/
@Test
public void testJMXMonSampleOccurred() {
System.out.println("JMXMonSampleOccurred");
SampleEvent event = new SampleEvent(new SampleResult(), "test");
JMXMonCollector instance = new JMXMonCollector();
instance.jmxMonSampleOccurred(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 JMXMonCollectorTest method testSampleOccurred.
/**
* Test of sampleOccurred method, of class JMXMonCollector.
*/
@Test
public void testSampleOccurred() {
System.out.println("sampleOccurred");
SampleEvent event = null;
JMXMonCollector instance = new JMXMonCollector();
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 generateSample.
// need floating point precision for memory and cpu
@Override
public void generateSample(double value, String label) {
PerfMonSampleResult res = new PerfMonSampleResult();
res.setSampleLabel(label);
res.setValue(value);
res.setSuccessful(true);
SampleEvent e = new SampleEvent(res, PERFMON);
super.sampleOccurred(e);
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class ConcurrencyThreadGroupTest method testStartNextLoop.
@Test
public void testStartNextLoop() throws Exception {
JMeterContextService.getContext().setVariables(new JMeterVariables());
TestSampleListener listener = new TestSampleListener();
DebugSampler beforeSampler = new DebugSamplerExt();
beforeSampler.setName("Before Test Action sampler");
TestAction testAction = new TestAction();
testAction.setAction(TestAction.RESTART_NEXT_LOOP);
DebugSampler afterSampler = new DebugSamplerExt();
afterSampler.setName("After Test Action sampler");
ConcurrencyThreadGroup ctg = new ConcurrencyThreadGroup();
ctg.setProperty(new StringProperty(AbstractThreadGroup.ON_SAMPLE_ERROR, AbstractThreadGroup.ON_SAMPLE_ERROR_CONTINUE));
ctg.setRampUp("0");
ctg.setTargetLevel("1");
ctg.setSteps("0");
// TODO: increase this value for debugging
ctg.setHold("5");
ctg.setIterationsLimit("10");
ctg.setUnit("S");
ListedHashTree hashTree = new ListedHashTree();
hashTree.add(ctg);
hashTree.add(ctg, beforeSampler);
hashTree.add(ctg, testAction);
hashTree.add(ctg, afterSampler);
hashTree.add(ctg, listener);
TestCompiler compiler = new TestCompiler(hashTree);
hashTree.traverse(compiler);
ListenerNotifier notifier = new ListenerNotifier();
ctg.start(1, notifier, hashTree, new StandardJMeterEngine());
ctg.waitThreadsStopped();
for (SampleEvent event : listener.events) {
assertEquals("Before Test Action sampler", event.getResult().getSampleLabel());
}
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class ConsoleStatusLoggerTest method testSampleOccurred.
/**
* Test of sampleOccurred method, of class ConsoleStatusLogger.
*/
@Test
public void testSampleOccurred() throws InterruptedException {
System.out.println("sampleOccurred");
SampleResult res = new SampleResult();
res.setResponseCode("200");
SampleEvent se = new SampleEvent(res, "testTG");
ConsoleStatusLogger instance = new ConsoleStatusLogger();
instance.testStarted();
instance.sampleOccurred(se);
instance.sampleOccurred(se);
Thread.sleep(1020);
instance.sampleOccurred(se);
instance.sampleOccurred(se);
Thread.sleep(1020);
instance.sampleOccurred(se);
instance.sampleOccurred(se);
}
Aggregations