use of org.apache.jmeter.timers.ConstantTimer in project jmeter-plugins by undera.
the class ConcurrencyThreadGroupTest method testSetDoneThreadsAfterHold.
// WAP-9261
@Test(timeout = 25000)
public void testSetDoneThreadsAfterHold() throws Exception {
JMeterContextService.getContext().setVariables(new JMeterVariables());
TestSampleListener listener = new TestSampleListener();
DebugSampler sampler = new DebugSampler();
sampler.setName("Sampler");
ConstantTimer timer = new ConstantTimer();
timer.setDelay("2000");
timer.setName("timer");
LoopController loopController = new LoopController();
loopController.setContinueForever(true);
loopController.setLoops(-1);
loopController.setName("loop c");
ConcurrencyThreadGroupExt ctg = new ConcurrencyThreadGroupExt();
ctg.setName("CTG");
ctg.setRampUp("5");
ctg.setTargetLevel("3");
ctg.setSteps("1");
// TODO: increase this value for debugging
ctg.setHold("10");
ctg.setIterationsLimit("");
ctg.setUnit("S");
ListedHashTree loopTree = new ListedHashTree();
loopTree.add(loopController, timer);
loopTree.add(loopController, sampler);
loopTree.add(loopController, listener);
ListedHashTree hashTree = new ListedHashTree();
hashTree.add(ctg, loopTree);
TestCompiler compiler = new TestCompiler(hashTree);
// this hashTree can be save to *jmx
hashTree.traverse(compiler);
ListenerNotifier notifier = new ListenerNotifier();
long startTime = System.currentTimeMillis();
ctg.start(1, notifier, hashTree, new StandardJMeterEngine());
Thread threadStarter = ctg.getThreadStarter();
threadStarter.join();
long endTime = System.currentTimeMillis();
// wait when all thread stopped
Thread.currentThread().sleep(5000);
assertTrue((endTime - startTime) < 20000);
// ALL threads must be stopped
assertEquals(0, ctg.getNumberOfThreads());
}
use of org.apache.jmeter.timers.ConstantTimer in project jmeter by apache.
the class ConstantTimerGui method createTestElement.
/**
* Create the test element underlying this GUI component.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
*/
@Override
public TestElement createTestElement() {
ConstantTimer timer = new ConstantTimer();
modifyTestElement(timer);
return timer;
}
Aggregations