Search in sources :

Example 6 with AbstractThreadGroup

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());
}
Also used : BooleanProperty(org.apache.jmeter.testelement.property.BooleanProperty) LongProperty(org.apache.jmeter.testelement.property.LongProperty) AbstractThreadGroup(org.apache.jmeter.threads.AbstractThreadGroup)

Example 7 with AbstractThreadGroup

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;
}
Also used : AbstractThreadGroup(org.apache.jmeter.threads.AbstractThreadGroup) JMeterTreeNode(org.apache.jmeter.gui.tree.JMeterTreeNode) RecordingController(org.apache.jmeter.protocol.http.control.RecordingController) WorkBench(org.apache.jmeter.testelement.WorkBench)

Example 8 with AbstractThreadGroup

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;
    }
}
Also used : Backend(org.apache.jmeter.visualizers.backend.Backend) Timer(org.apache.jmeter.timers.Timer) ThreadGroup(org.apache.jmeter.threads.ThreadGroup) AbstractThreadGroup(org.apache.jmeter.threads.AbstractThreadGroup) LoopController(org.apache.jmeter.control.LoopController)

Aggregations

AbstractThreadGroup (org.apache.jmeter.threads.AbstractThreadGroup)8 JMeterTreeNode (org.apache.jmeter.gui.tree.JMeterTreeNode)3 LinkedList (java.util.LinkedList)2 TestElement (org.apache.jmeter.testelement.TestElement)2 TestStateListener (org.apache.jmeter.testelement.TestStateListener)2 RemoteException (java.rmi.RemoteException)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 Controller (org.apache.jmeter.control.Controller)1 LoopController (org.apache.jmeter.control.LoopController)1 ModuleController (org.apache.jmeter.control.ModuleController)1 TestFragmentController (org.apache.jmeter.control.TestFragmentController)1 JMeterTreeListener (org.apache.jmeter.gui.tree.JMeterTreeListener)1 RecordingController (org.apache.jmeter.protocol.http.control.RecordingController)1 RemoteListenerWrapper (org.apache.jmeter.samplers.RemoteListenerWrapper)1 RemoteSampleListener (org.apache.jmeter.samplers.RemoteSampleListener)1 RemoteSampleListenerImpl (org.apache.jmeter.samplers.RemoteSampleListenerImpl)1 RemoteSampleListenerWrapper (org.apache.jmeter.samplers.RemoteSampleListenerWrapper)1 RemoteTestListenerWrapper (org.apache.jmeter.samplers.RemoteTestListenerWrapper)1 Remoteable (org.apache.jmeter.samplers.Remoteable)1 SampleListener (org.apache.jmeter.samplers.SampleListener)1