use of org.apache.jmeter.sampler.TestAction in project jmeter-plugins by undera.
the class ArrivalsThreadGroupTest method getListedHashTree.
public static ListedHashTree getListedHashTree(AbstractDynamicThreadGroup atg, boolean stopThread) {
ListedHashTree tree = new ListedHashTree();
TestAction pauser = new TestAction();
if (stopThread) {
pauser.setAction(TestAction.STOP);
} else {
pauser.setAction(TestAction.PAUSE);
}
pauser.setTarget(TestAction.THREAD);
pauser.setDuration(String.valueOf(300));
tree.add(atg, pauser);
return tree;
}
use of org.apache.jmeter.sampler.TestAction in project jmeter by apache.
the class TestActionGui method createTestElement.
/**
* @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement()
*/
@Override
public TestElement createTestElement() {
TestAction ta = new TestAction();
modifyTestElement(ta);
return ta;
}
use of org.apache.jmeter.sampler.TestAction in project jmeter by apache.
the class TestActionGui method modifyTestElement.
/**
* Modifies a given TestElement to mirror the data in the gui components.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
*/
@Override
public void modifyTestElement(TestElement element) {
super.configureTestElement(element);
TestAction ta = (TestAction) element;
ta.setAction(action);
ta.setTarget(target);
ta.setDuration(durationField.getText());
}
use of org.apache.jmeter.sampler.TestAction in project jmeter by apache.
the class DefaultThinkTimeCreator method createThinkTime.
@Override
public JMeterTreeNode[] createThinkTime(GuiPackage guiPackage, JMeterTreeNode parentNode) throws IllegalUserActionException {
TestAction testAction = (TestAction) guiPackage.createTestElement(TestActionGui.class.getName());
testAction.setAction(TestAction.PAUSE);
testAction.setDuration("0");
JMeterTreeNode thinkTimeNode = new JMeterTreeNode(testAction, guiPackage.getTreeModel());
thinkTimeNode.setName("Think Time");
RandomTimer randomTimer = (RandomTimer) guiPackage.createTestElement(DEFAULT_TIMER_IMPLEMENTATION);
randomTimer.setDelay(DEFAULT_PAUSE);
randomTimer.setRange(DEFAULT_RANGE);
randomTimer.setName("Pause");
JMeterTreeNode urtNode = new JMeterTreeNode(randomTimer, guiPackage.getTreeModel());
return new JMeterTreeNode[] { thinkTimeNode, urtNode };
}
use of org.apache.jmeter.sampler.TestAction 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();
}
Aggregations