use of org.apache.jmeter.threads.AbstractThreadGroup in project jmeter by apache.
the class ThreadGroupGui 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 tg) {
super.configureTestElement(tg);
if (tg instanceof AbstractThreadGroup) {
((AbstractThreadGroup) tg).setSamplerController((LoopController) loopPanel.createTestElement());
}
tg.setProperty(AbstractThreadGroup.NUM_THREADS, threadInput.getText());
tg.setProperty(ThreadGroup.RAMP_TIME, rampInput.getText());
tg.setProperty(new LongProperty(ThreadGroup.START_TIME, start.getDate().getTime()));
tg.setProperty(new LongProperty(ThreadGroup.END_TIME, end.getDate().getTime()));
if (showDelayedStart) {
tg.setProperty(ThreadGroup.DELAYED_START, delayedStart.isSelected(), false);
}
tg.setProperty(new BooleanProperty(ThreadGroup.SCHEDULER, scheduler.isSelected()));
tg.setProperty(ThreadGroup.DURATION, duration.getText());
tg.setProperty(ThreadGroup.DELAY, delay.getText());
}
use of org.apache.jmeter.threads.AbstractThreadGroup in project jmeter by apache.
the class ProxyControl method findTargetControllerNode.
/**
* Finds the controller where samplers have to be stored, that is:
* <ul>
* <li>The controller specified by the <code>target</code> property.
* <li>If none was specified, the first RecordingController in the tree.
* <li>If none is found, the first AbstractThreadGroup in the tree.
* <li>If none is found, the Workspace.
* </ul>
*
* @return the tree node for the controller where the proxy must store the
* generated samplers.
*/
public JMeterTreeNode findTargetControllerNode() {
JMeterTreeNode myTarget = getTarget();
if (myTarget != null) {
return myTarget;
}
myTarget = findFirstNodeOfType(RecordingController.class);
if (myTarget != null) {
return myTarget;
}
myTarget = findFirstNodeOfType(AbstractThreadGroup.class);
if (myTarget != null) {
return myTarget;
}
myTarget = findFirstNodeOfType(WorkBench.class);
if (myTarget != null) {
return myTarget;
}
log.error("Program error: test script recording target not found.");
return null;
}
use of org.apache.jmeter.threads.AbstractThreadGroup in project jmeter by apache.
the class TreeClonerForValidation method addNodeToTree.
/**
* @see org.apache.jmeter.engine.TreeCloner#addNodeToTree(java.lang.Object)
*/
@Override
protected Object addNodeToTree(Object node) {
if ((VALIDATION_IGNORE_TIMERS && node instanceof Timer) || (VALIDATION_IGNORE_BACKENDS && node instanceof Backend)) {
// don't add timer or backend
return node;
} else {
Object clonedNode = super.addNodeToTree(node);
if (clonedNode instanceof org.apache.jmeter.threads.ThreadGroup) {
ThreadGroup tg = (ThreadGroup) clonedNode;
tg.setNumThreads(VALIDATION_NUMBER_OF_THREADS);
tg.setScheduler(false);
tg.setProperty(ThreadGroup.DELAY, 0);
if (((AbstractThreadGroup) clonedNode).getSamplerController() instanceof LoopController) {
((LoopController) ((AbstractThreadGroup) clonedNode).getSamplerController()).setLoops(VALIDATION_ITERATIONS);
}
}
return clonedNode;
}
}
Aggregations