View | Details | Raw Unified | Return to bug 48749
Collapse All | Expand All

(-)src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java (-3 / +3 lines)
Lines 59-65 Link Here
59
import org.apache.jmeter.testelement.property.JMeterProperty;
59
import org.apache.jmeter.testelement.property.JMeterProperty;
60
import org.apache.jmeter.testelement.property.PropertyIterator;
60
import org.apache.jmeter.testelement.property.PropertyIterator;
61
import org.apache.jmeter.testelement.property.StringProperty;
61
import org.apache.jmeter.testelement.property.StringProperty;
62
import org.apache.jmeter.threads.ThreadGroup;
62
import org.apache.jmeter.threads.AbstractThreadGroup;
63
import org.apache.jmeter.timers.Timer;
63
import org.apache.jmeter.timers.Timer;
64
import org.apache.jmeter.util.JMeterUtils;
64
import org.apache.jmeter.util.JMeterUtils;
65
import org.apache.jorphan.logging.LoggingManager;
65
import org.apache.jorphan.logging.LoggingManager;
Lines 638-644 Link Here
638
     * <ul>
638
     * <ul>
639
     * <li>The controller specified by the <code>target</code> property.
639
     * <li>The controller specified by the <code>target</code> property.
640
     * <li>If none was specified, the first RecordingController in the tree.
640
     * <li>If none was specified, the first RecordingController in the tree.
641
     * <li>If none is found, the first ThreadGroup in the tree.
641
     * <li>If none is found, the first AbstractThreadGroup in the tree.
642
     * <li>If none is found, the Workspace.
642
     * <li>If none is found, the Workspace.
643
     * </ul>
643
     * </ul>
644
     *
644
     *
Lines 654-660 Link Here
654
        if (myTarget != null) {
654
        if (myTarget != null) {
655
            return myTarget;
655
            return myTarget;
656
        }
656
        }
657
        myTarget = findFirstNodeOfType(ThreadGroup.class);
657
        myTarget = findFirstNodeOfType(AbstractThreadGroup.class);
658
        if (myTarget != null) {
658
        if (myTarget != null) {
659
            return myTarget;
659
            return myTarget;
660
        }
660
        }
(-)src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java (-1 / +2 lines)
Lines 332-338 Link Here
332
                    }
332
                    }
333
                }
333
                }
334
            }
334
            }
335
        } catch (IOException ex) {
335
        } catch (Exception ex) {
336
            isSuccessful=false;
336
            log.debug("", ex);
337
            log.debug("", ex);
337
            res.setResponseCode("500"); //$NON-NLS-1$
338
            res.setResponseCode("500"); //$NON-NLS-1$
338
            res.setResponseMessage(ex.toString());
339
            res.setResponseMessage(ex.toString());
(-)src/components/org/apache/jmeter/control/gui/ModuleControllerGui.java (-2 / +2 lines)
Lines 38-44 Link Here
38
import org.apache.jmeter.testelement.TestElement;
38
import org.apache.jmeter.testelement.TestElement;
39
import org.apache.jmeter.testelement.TestPlan;
39
import org.apache.jmeter.testelement.TestPlan;
40
import org.apache.jmeter.testelement.WorkBench;
40
import org.apache.jmeter.testelement.WorkBench;
41
import org.apache.jmeter.threads.ThreadGroup;
41
import org.apache.jmeter.threads.AbstractThreadGroup;
42
import org.apache.jmeter.util.JMeterUtils;
42
import org.apache.jmeter.util.JMeterUtils;
43
import org.apache.jorphan.gui.layout.VerticalLayout;
43
import org.apache.jorphan.gui.layout.VerticalLayout;
44
44
Lines 205-211 Link Here
205
                StringBuilder name = new StringBuilder();
205
                StringBuilder name = new StringBuilder();
206
                JMeterTreeNode cur = (JMeterTreeNode) node.getChildAt(i);
206
                JMeterTreeNode cur = (JMeterTreeNode) node.getChildAt(i);
207
                TestElement te = cur.getTestElement();
207
                TestElement te = cur.getTestElement();
208
                if (te instanceof ThreadGroup) {
208
                if (te instanceof AbstractThreadGroup) {
209
                    name.append(parent_name);
209
                    name.append(parent_name);
210
                    name.append(cur.getName());
210
                    name.append(cur.getName());
211
                    name.append(seperator);
211
                    name.append(seperator);
(-)src/components/org/apache/jmeter/timers/ConstantThroughputTimer.java (-5 / +5 lines)
Lines 26-32 Link Here
26
import org.apache.jmeter.testelement.AbstractTestElement;
26
import org.apache.jmeter.testelement.AbstractTestElement;
27
import org.apache.jmeter.testelement.TestListener;
27
import org.apache.jmeter.testelement.TestListener;
28
import org.apache.jmeter.threads.JMeterContextService;
28
import org.apache.jmeter.threads.JMeterContextService;
29
import org.apache.jmeter.threads.ThreadGroup;
29
import org.apache.jmeter.threads.AbstractThreadGroup;
30
import org.apache.jmeter.util.JMeterUtils;
30
import org.apache.jmeter.util.JMeterUtils;
31
import org.apache.jorphan.logging.LoggingManager;
31
import org.apache.jorphan.logging.LoggingManager;
32
import org.apache.log.Logger;
32
import org.apache.log.Logger;
Lines 70-78 Link Here
70
    //For calculating throughput across all threads
70
    //For calculating throughput across all threads
71
    private final static ThroughputInfo allThreadsInfo = new ThroughputInfo();
71
    private final static ThroughputInfo allThreadsInfo = new ThroughputInfo();
72
72
73
    //For holding the ThrougputInfo objects for all ThreadGroups. Keyed by ThreadGroup objects
73
    //For holding the ThrougputInfo objects for all ThreadGroups. Keyed by AbstractThreadGroup objects
74
    private final static Map<ThreadGroup, ThroughputInfo> threadGroupsInfoMap =
74
    private final static Map<AbstractThreadGroup, ThroughputInfo> threadGroupsInfoMap =
75
        new ConcurrentHashMap<ThreadGroup, ThroughputInfo>();
75
        new ConcurrentHashMap<AbstractThreadGroup, ThroughputInfo>();
76
76
77
77
78
    /**
78
    /**
Lines 165-171 Link Here
165
            break;
165
            break;
166
166
167
        case 4: //All threads in this group - alternate calculation
167
        case 4: //All threads in this group - alternate calculation
168
            final org.apache.jmeter.threads.ThreadGroup group =
168
            final org.apache.jmeter.threads.AbstractThreadGroup group =
169
                JMeterContextService.getContext().getThreadGroup();
169
                JMeterContextService.getContext().getThreadGroup();
170
            ThroughputInfo groupInfo;
170
            ThroughputInfo groupInfo;
171
            synchronized (threadGroupsInfoMap) {
171
            synchronized (threadGroupsInfoMap) {
(-)src/core/org/apache/jmeter/control/gui/TestPlanGui.java (-3 / +1 lines)
Lines 36-42 Link Here
36
import org.apache.jmeter.testelement.TestElement;
36
import org.apache.jmeter.testelement.TestElement;
37
import org.apache.jmeter.testelement.TestPlan;
37
import org.apache.jmeter.testelement.TestPlan;
38
import org.apache.jmeter.testelement.property.JMeterProperty;
38
import org.apache.jmeter.testelement.property.JMeterProperty;
39
import org.apache.jmeter.threads.gui.ThreadGroupGui;
40
import org.apache.jmeter.util.JMeterUtils;
39
import org.apache.jmeter.util.JMeterUtils;
41
40
42
/**
41
/**
Lines 87-94 Link Here
87
    public JPopupMenu createPopupMenu() {
86
    public JPopupMenu createPopupMenu() {
88
        JPopupMenu pop = new JPopupMenu();
87
        JPopupMenu pop = new JPopupMenu();
89
        JMenu addMenu = new JMenu(JMeterUtils.getResString("add")); // $NON-NLS-1$
88
        JMenu addMenu = new JMenu(JMeterUtils.getResString("add")); // $NON-NLS-1$
90
        addMenu.add(MenuFactory.makeMenuItem(new ThreadGroupGui().getStaticLabel(), ThreadGroupGui.class.getName(),
89
        addMenu.add(MenuFactory.makeMenu(MenuFactory.THREADS, ActionNames.ADD));
91
                ActionNames.ADD));
92
        addMenu.add(MenuFactory.makeMenu(MenuFactory.CONFIG_ELEMENTS, ActionNames.ADD));
90
        addMenu.add(MenuFactory.makeMenu(MenuFactory.CONFIG_ELEMENTS, ActionNames.ADD));
93
        addMenu.add(MenuFactory.makeMenu(MenuFactory.TIMERS, ActionNames.ADD));
91
        addMenu.add(MenuFactory.makeMenu(MenuFactory.TIMERS, ActionNames.ADD));
94
        addMenu.add(MenuFactory.makeMenu(MenuFactory.PRE_PROCESSORS, ActionNames.ADD));
92
        addMenu.add(MenuFactory.makeMenu(MenuFactory.PRE_PROCESSORS, ActionNames.ADD));
(-)src/core/org/apache/jmeter/gui/util/MenuFactory.java (-5 / +13 lines)
Lines 64-69 Link Here
64
     *  These are used as menu categories in the menuMap Hashmap,
64
     *  These are used as menu categories in the menuMap Hashmap,
65
     *  and also for resource lookup in messages.properties
65
     *  and also for resource lookup in messages.properties
66
    */
66
    */
67
    public static final String THREADS = "menu_threads"; //$NON-NLS-1$
68
67
    public static final String TIMERS = "menu_timer"; //$NON-NLS-1$
69
    public static final String TIMERS = "menu_timer"; //$NON-NLS-1$
68
70
69
    public static final String CONTROLLERS = "menu_logic_controller"; //$NON-NLS-1$
71
    public static final String CONTROLLERS = "menu_logic_controller"; //$NON-NLS-1$
Lines 90-95 Link Here
90
    // MENU_ADD_xxx - controls which items are in the ADD menu
92
    // MENU_ADD_xxx - controls which items are in the ADD menu
91
    // MENU_PARENT_xxx - controls which items are in the Insert Parent menu
93
    // MENU_PARENT_xxx - controls which items are in the Insert Parent menu
92
    private static final String[] MENU_ADD_CONTROLLER = new String[] {
94
    private static final String[] MENU_ADD_CONTROLLER = new String[] {
95
        MenuFactory.THREADS,
93
        MenuFactory.CONTROLLERS,
96
        MenuFactory.CONTROLLERS,
94
        MenuFactory.CONFIG_ELEMENTS,
97
        MenuFactory.CONFIG_ELEMENTS,
95
        MenuFactory.TIMERS,
98
        MenuFactory.TIMERS,
Lines 115-125 Link Here
115
    private static final String[] MENU_PARENT_SAMPLER = new String[] {
118
    private static final String[] MENU_PARENT_SAMPLER = new String[] {
116
        MenuFactory.CONTROLLERS };
119
        MenuFactory.CONTROLLERS };
117
120
118
    private static final List<MenuInfo> timers, controllers, samplers, configElements,
121
    private static final List<MenuInfo> timers, controllers, samplers, threads,
119
        assertions, listeners, nonTestElements,
122
        configElements, assertions, listeners, nonTestElements,
120
        postProcessors, preProcessors;
123
        postProcessors, preProcessors;
121
124
122
    static {
125
    static {
126
        threads = new LinkedList<MenuInfo>();
123
        timers = new LinkedList<MenuInfo>();
127
        timers = new LinkedList<MenuInfo>();
124
        controllers = new LinkedList<MenuInfo>();
128
        controllers = new LinkedList<MenuInfo>();
125
        samplers = new LinkedList<MenuInfo>();
129
        samplers = new LinkedList<MenuInfo>();
Lines 129-134 Link Here
129
        postProcessors = new LinkedList<MenuInfo>();
133
        postProcessors = new LinkedList<MenuInfo>();
130
        preProcessors = new LinkedList<MenuInfo>();
134
        preProcessors = new LinkedList<MenuInfo>();
131
        nonTestElements = new LinkedList<MenuInfo>();
135
        nonTestElements = new LinkedList<MenuInfo>();
136
        menuMap.put(THREADS, threads);
132
        menuMap.put(TIMERS, timers);
137
        menuMap.put(TIMERS, timers);
133
        menuMap.put(ASSERTIONS, assertions);
138
        menuMap.put(ASSERTIONS, assertions);
134
        menuMap.put(CONFIG_ELEMENTS, configElements);
139
        menuMap.put(CONFIG_ELEMENTS, configElements);
Lines 455-460 Link Here
455
                    log.debug(name + " participates in no menus.");
460
                    log.debug(name + " participates in no menus.");
456
                    continue;
461
                    continue;
457
                }
462
                }
463
                if (categories.contains(THREADS)) {
464
                    threads.add(new MenuInfo(item, name));
465
                }
458
                if (categories.contains(TIMERS)) {
466
                if (categories.contains(TIMERS)) {
459
                    timers.add(new MenuInfo(item, name));
467
                    timers.add(new MenuInfo(item, name));
460
                }
468
                }
Lines 545-558 Link Here
545
        if (parent instanceof TestPlan) {
553
        if (parent instanceof TestPlan) {
546
            if (foundClass(nodes,
554
            if (foundClass(nodes,
547
                     new Class[]{Sampler.class, Controller.class}, // Samplers and Controllers need not apply ...
555
                     new Class[]{Sampler.class, Controller.class}, // Samplers and Controllers need not apply ...
548
                     org.apache.jmeter.threads.ThreadGroup.class)  // but ThreadGroup (Controller) is OK
556
                     org.apache.jmeter.threads.AbstractThreadGroup.class)  // but AbstractThreadGroup (Controller) is OK
549
                ){
557
                ){
550
                return false;
558
                return false;
551
            }
559
            }
552
            return true;
560
            return true;
553
        }
561
        }
554
        // ThreadGroup is only allowed under a TestPlan
562
        // AbstractThreadGroup is only allowed under a TestPlan
555
        if (foundClass(nodes, new Class[]{org.apache.jmeter.threads.ThreadGroup.class})){
563
        if (foundClass(nodes, new Class[]{org.apache.jmeter.threads.AbstractThreadGroup.class})){
556
            return false;
564
            return false;
557
        }
565
        }
558
        if (parent instanceof Controller) {// Includes thread group; anything goes
566
        if (parent instanceof Controller) {// Includes thread group; anything goes
(-)src/core/org/apache/jmeter/testelement/TestPlan.java (-11 / +11 lines)
Lines 31-37 Link Here
31
import org.apache.jmeter.testelement.property.BooleanProperty;
31
import org.apache.jmeter.testelement.property.BooleanProperty;
32
import org.apache.jmeter.testelement.property.JMeterProperty;
32
import org.apache.jmeter.testelement.property.JMeterProperty;
33
import org.apache.jmeter.testelement.property.TestElementProperty;
33
import org.apache.jmeter.testelement.property.TestElementProperty;
34
import org.apache.jmeter.threads.ThreadGroup;
34
import org.apache.jmeter.threads.AbstractThreadGroup;
35
import org.apache.jorphan.logging.LoggingManager;
35
import org.apache.jorphan.logging.LoggingManager;
36
import org.apache.jorphan.util.JOrphanUtils;
36
import org.apache.jorphan.util.JOrphanUtils;
37
import org.apache.log.Logger;
37
import org.apache.log.Logger;
Lines 55-61 Link Here
55
55
56
    private final static String BASEDIR = "basedir";
56
    private final static String BASEDIR = "basedir";
57
57
58
    private transient List<ThreadGroup> threadGroups = new LinkedList<ThreadGroup>();
58
    private transient List<AbstractThreadGroup> threadGroups = new LinkedList<AbstractThreadGroup>();
59
59
60
    // Does not appear to be needed
60
    // Does not appear to be needed
61
//  private transient List configs = new LinkedList();
61
//  private transient List configs = new LinkedList();
Lines 71-77 Link Here
71
71
72
    static {
72
    static {
73
        // WARNING! This String value must be identical to the String value
73
        // WARNING! This String value must be identical to the String value
74
        // returned in org.apache.jmeter.threads.ThreadGroup.getClassLabel()
74
        // returned in org.apache.jmeter.threads.AbstractThreadGroup.getClassLabel()
75
        // method. If it's not you will not be able to add a Thread Group
75
        // method. If it's not you will not be able to add a Thread Group
76
        // element to a Test Plan.
76
        // element to a Test Plan.
77
77
Lines 96-102 Link Here
96
96
97
    // create transient item
97
    // create transient item
98
    private Object readResolve(){
98
    private Object readResolve(){
99
        threadGroups = new LinkedList<ThreadGroup>();
99
        threadGroups = new LinkedList<AbstractThreadGroup>();
100
        return this;
100
        return this;
101
    }
101
    }
102
102
Lines 228-242 Link Here
228
    @Override
228
    @Override
229
    public void addTestElement(TestElement tg) {
229
    public void addTestElement(TestElement tg) {
230
        super.addTestElement(tg);
230
        super.addTestElement(tg);
231
        if (tg instanceof ThreadGroup && !isRunningVersion()) {
231
        if (tg instanceof AbstractThreadGroup && !isRunningVersion()) {
232
            addThreadGroup((ThreadGroup) tg);
232
            addThreadGroup((AbstractThreadGroup) tg);
233
        }
233
        }
234
    }
234
    }
235
235
236
//    // Does not appear to be needed
236
//    // Does not appear to be needed
237
//  public void addJMeterComponent(TestElement child) {
237
//  public void addJMeterComponent(TestElement child) {
238
//      if (child instanceof ThreadGroup) {
238
//      if (child instanceof AbstractThreadGroup) {
239
//          addThreadGroup((ThreadGroup) child);
239
//          addThreadGroup((AbstractThreadGroup) child);
240
//      }
240
//      }
241
//  }
241
//  }
242
242
Lines 262-273 Link Here
262
//  }
262
//  }
263
263
264
    /**
264
    /**
265
     * Adds a feature to the ThreadGroup attribute of the TestPlan object.
265
     * Adds a feature to the AbstractThreadGroup attribute of the TestPlan object.
266
     *
266
     *
267
     * @param group
267
     * @param group
268
     *            the feature to be added to the ThreadGroup attribute
268
     *            the feature to be added to the AbstractThreadGroup attribute
269
     */
269
     */
270
    public void addThreadGroup(ThreadGroup group) {
270
    public void addThreadGroup(AbstractThreadGroup group) {
271
        threadGroups.add(group);
271
        threadGroups.add(group);
272
    }
272
    }
273
273
(-)src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java (-119 / +4 lines)
Lines 19-57 Link Here
19
package org.apache.jmeter.threads.gui;
19
package org.apache.jmeter.threads.gui;
20
20
21
import java.awt.BorderLayout;
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
23
import java.awt.event.ItemEvent;
22
import java.awt.event.ItemEvent;
24
import java.awt.event.ItemListener;
23
import java.awt.event.ItemListener;
25
import java.util.Collection;
26
import java.util.Date;
24
import java.util.Date;
27
25
28
import javax.swing.BorderFactory;
26
import javax.swing.BorderFactory;
29
import javax.swing.Box;
30
import javax.swing.ButtonGroup;
31
import javax.swing.JCheckBox;
27
import javax.swing.JCheckBox;
32
import javax.swing.JLabel;
28
import javax.swing.JLabel;
33
import javax.swing.JPanel;
29
import javax.swing.JPanel;
34
import javax.swing.JPopupMenu;
35
import javax.swing.JRadioButton;
36
import javax.swing.JTextField;
30
import javax.swing.JTextField;
37
31
38
import org.apache.jmeter.control.LoopController;
32
import org.apache.jmeter.control.LoopController;
39
import org.apache.jmeter.control.gui.LoopControlPanel;
33
import org.apache.jmeter.control.gui.LoopControlPanel;
40
import org.apache.jmeter.gui.AbstractJMeterGuiComponent;
41
import org.apache.jmeter.gui.action.ActionNames;
42
import org.apache.jmeter.gui.tree.JMeterTreeNode;
43
import org.apache.jmeter.gui.util.FocusRequester;
34
import org.apache.jmeter.gui.util.FocusRequester;
44
import org.apache.jmeter.gui.util.JDateField;
35
import org.apache.jmeter.gui.util.JDateField;
45
import org.apache.jmeter.gui.util.MenuFactory;
46
import org.apache.jmeter.gui.util.VerticalPanel;
36
import org.apache.jmeter.gui.util.VerticalPanel;
47
import org.apache.jmeter.testelement.TestElement;
37
import org.apache.jmeter.testelement.TestElement;
48
import org.apache.jmeter.testelement.property.BooleanProperty;
38
import org.apache.jmeter.testelement.property.BooleanProperty;
49
import org.apache.jmeter.testelement.property.LongProperty;
39
import org.apache.jmeter.testelement.property.LongProperty;
50
import org.apache.jmeter.testelement.property.StringProperty;
51
import org.apache.jmeter.threads.ThreadGroup;
40
import org.apache.jmeter.threads.ThreadGroup;
52
import org.apache.jmeter.util.JMeterUtils;
41
import org.apache.jmeter.util.JMeterUtils;
53
42
54
public class ThreadGroupGui extends AbstractJMeterGuiComponent implements ItemListener {
43
public class ThreadGroupGui extends AbstractThreadGroupGui implements ItemListener {
55
    private static final long serialVersionUID = 240L;
44
    private static final long serialVersionUID = 240L;
56
45
57
    private LoopControlPanel loopPanel;
46
    private LoopControlPanel loopPanel;
Lines 76-100 Link Here
76
65
77
    private JTextField delay; // Relative start-up time
66
    private JTextField delay; // Relative start-up time
78
67
79
    // Sampler error action buttons
80
    private JRadioButton continueBox;
81
82
    private JRadioButton stopThrdBox;
83
84
    private JRadioButton stopTestBox;
85
86
    private JRadioButton stopTestNowBox;
87
    
88
    public ThreadGroupGui() {
68
    public ThreadGroupGui() {
89
        super();
69
        super();
90
        init();
70
        init();
91
        initGui();
71
        initGui();
92
    }
72
    }
93
73
94
    public Collection<String> getMenuCategories() {
95
        return null;
96
    }
97
98
    public TestElement createTestElement() {
74
    public TestElement createTestElement() {
99
        ThreadGroup tg = new ThreadGroup();
75
        ThreadGroup tg = new ThreadGroup();
100
        modifyTestElement(tg);
76
        modifyTestElement(tg);
Lines 117-154 Link Here
117
        tg.setProperty(new LongProperty(ThreadGroup.START_TIME, start.getDate().getTime()));
93
        tg.setProperty(new LongProperty(ThreadGroup.START_TIME, start.getDate().getTime()));
118
        tg.setProperty(new LongProperty(ThreadGroup.END_TIME, end.getDate().getTime()));
94
        tg.setProperty(new LongProperty(ThreadGroup.END_TIME, end.getDate().getTime()));
119
        tg.setProperty(new BooleanProperty(ThreadGroup.SCHEDULER, scheduler.isSelected()));
95
        tg.setProperty(new BooleanProperty(ThreadGroup.SCHEDULER, scheduler.isSelected()));
120
        tg.setProperty(new StringProperty(ThreadGroup.ON_SAMPLE_ERROR, onSampleError()));
121
        tg.setProperty(ThreadGroup.DURATION, duration.getText());
96
        tg.setProperty(ThreadGroup.DURATION, duration.getText());
122
        tg.setProperty(ThreadGroup.DELAY, delay.getText());
97
        tg.setProperty(ThreadGroup.DELAY, delay.getText());
123
    }
98
    }
124
99
125
    private void setSampleErrorBoxes(ThreadGroup te) {
126
        if (te.getOnErrorStopTest()) {
127
            stopTestBox.setSelected(true);
128
        } else if (te.getOnErrorStopTestNow()) {
129
            stopTestNowBox.setSelected(true);
130
        } else if (te.getOnErrorStopThread()) {
131
            stopThrdBox.setSelected(true);
132
        } else {
133
            continueBox.setSelected(true);
134
        }
135
    }
136
137
    private String onSampleError() {
138
        if (stopTestBox.isSelected()) {
139
            return ThreadGroup.ON_SAMPLE_ERROR_STOPTEST;
140
        }
141
        if (stopTestNowBox.isSelected()) {
142
            return ThreadGroup.ON_SAMPLE_ERROR_STOPTEST_NOW;
143
        }
144
        if (stopThrdBox.isSelected()) {
145
            return ThreadGroup.ON_SAMPLE_ERROR_STOPTHREAD;
146
        }
147
148
        // Defaults to continue
149
        return ThreadGroup.ON_SAMPLE_ERROR_CONTINUE;
150
    }
151
152
    @Override
100
    @Override
153
    public void configure(TestElement tg) {
101
    public void configure(TestElement tg) {
154
        super.configure(tg);
102
        super.configure(tg);
Lines 174-181 Link Here
174
        }
122
        }
175
        duration.setText(tg.getPropertyAsString(ThreadGroup.DURATION));
123
        duration.setText(tg.getPropertyAsString(ThreadGroup.DURATION));
176
        delay.setText(tg.getPropertyAsString(ThreadGroup.DELAY));
124
        delay.setText(tg.getPropertyAsString(ThreadGroup.DELAY));
177
178
        setSampleErrorBoxes((ThreadGroup) tg);
179
    }
125
    }
180
126
181
    public void itemStateChanged(ItemEvent ie) {
127
    public void itemStateChanged(ItemEvent ie) {
Lines 188-212 Link Here
188
        }
134
        }
189
    }
135
    }
190
136
191
    public JPopupMenu createPopupMenu() {
192
        JPopupMenu pop = new JPopupMenu();
193
        pop.add(MenuFactory.makeMenus(new String[] {
194
                MenuFactory.CONTROLLERS,
195
                MenuFactory.CONFIG_ELEMENTS,
196
                MenuFactory.TIMERS,
197
                MenuFactory.PRE_PROCESSORS,
198
                MenuFactory.SAMPLERS,
199
                MenuFactory.POST_PROCESSORS,
200
                MenuFactory.ASSERTIONS,
201
                MenuFactory.LISTENERS,
202
                },
203
                JMeterUtils.getResString("add"), // $NON-NLS-1$
204
                ActionNames.ADD));
205
        MenuFactory.addEditMenu(pop, true);
206
        MenuFactory.addFileMenu(pop);
207
        return pop;
208
    }
209
210
    private JPanel createControllerPanel() {
137
    private JPanel createControllerPanel() {
211
        loopPanel = new LoopControlPanel(false);
138
        loopPanel = new LoopControlPanel(false);
212
        LoopController looper = (LoopController) loopPanel.createTestElement();
139
        LoopController looper = (LoopController) loopPanel.createTestElement();
Lines 276-306 Link Here
276
        return "threadgroup"; // $NON-NLS-1$
203
        return "threadgroup"; // $NON-NLS-1$
277
    }
204
    }
278
205
279
    private JPanel createOnErrorPanel() {
280
        JPanel panel = new JPanel();
281
        panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("sampler_on_error_action"))); // $NON-NLS-1$
282
283
        ButtonGroup group = new ButtonGroup();
284
285
        continueBox = new JRadioButton(JMeterUtils.getResString("sampler_on_error_continue")); // $NON-NLS-1$
286
        group.add(continueBox);
287
        panel.add(continueBox);
288
289
        stopThrdBox = new JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_thread")); // $NON-NLS-1$
290
        group.add(stopThrdBox);
291
        panel.add(stopThrdBox);
292
293
        stopTestBox = new JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_test")); // $NON-NLS-1$
294
        group.add(stopTestBox);
295
        panel.add(stopTestBox);
296
297
        stopTestNowBox = new JRadioButton(JMeterUtils.getResString("sampler_on_error_stop_test_now")); // $NON-NLS-1$
298
        group.add(stopTestNowBox);
299
        panel.add(stopTestNowBox);
300
301
        return panel;
302
    }
303
304
    @Override
206
    @Override
305
    public void clearGui(){
207
    public void clearGui(){
306
        super.clearGui();
208
        super.clearGui();
Lines 311-317 Link Here
311
    private void initGui(){
213
    private void initGui(){
312
        threadInput.setText("1"); // $NON-NLS-1$
214
        threadInput.setText("1"); // $NON-NLS-1$
313
        rampInput.setText("1"); // $NON-NLS-1$
215
        rampInput.setText("1"); // $NON-NLS-1$
314
        continueBox.setSelected(true);
315
        loopPanel.clearGui();
216
        loopPanel.clearGui();
316
        scheduler.setSelected(false);
217
        scheduler.setSelected(false);
317
        Date today = new Date();
218
        Date today = new Date();
Lines 321-337 Link Here
321
        duration.setText(""); // $NON-NLS-1$
222
        duration.setText(""); // $NON-NLS-1$
322
    }
223
    }
323
224
324
    private void init() {
225
   @Override
325
        setLayout(new BorderLayout(0, 5));
226
   protected void init() {
326
        setBorder(makeBorder());
227
        super.init();
327
228
328
        Box box = Box.createVerticalBox();
329
        box.add(makeTitlePanel());
330
        box.add(createOnErrorPanel());
331
        add(box, BorderLayout.NORTH);
332
333
        // JPanel mainPanel = new JPanel(new BorderLayout());
334
335
        // THREAD PROPERTIES
229
        // THREAD PROPERTIES
336
        VerticalPanel threadPropsPanel = new VerticalPanel();
230
        VerticalPanel threadPropsPanel = new VerticalPanel();
337
        threadPropsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
231
        threadPropsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
Lines 385-397 Link Here
385
        intgrationPanel.add(mainPanel);
279
        intgrationPanel.add(mainPanel);
386
        add(intgrationPanel, BorderLayout.CENTER);
280
        add(intgrationPanel, BorderLayout.CENTER);
387
    }
281
    }
388
389
    public void setNode(JMeterTreeNode node) {
390
        getNamePanel().setNode(node);
391
    }
392
393
    @Override
394
    public Dimension getPreferredSize() {
395
        return getMinimumSize();
396
    }
397
}
282
}
(-)src/core/org/apache/jmeter/threads/ThreadGroup.java (-148 / +38 lines)
Lines 18-54 Link Here
18
18
19
package org.apache.jmeter.threads;
19
package org.apache.jmeter.threads;
20
20
21
import java.io.Serializable;
22
23
import org.apache.jmeter.control.Controller;
24
import org.apache.jmeter.control.LoopController;
25
import org.apache.jmeter.engine.event.LoopIterationListener;
26
import org.apache.jmeter.samplers.Sampler;
27
import org.apache.jmeter.testelement.AbstractTestElement;
28
import org.apache.jmeter.testelement.TestElement;
29
import org.apache.jmeter.testelement.property.BooleanProperty;
21
import org.apache.jmeter.testelement.property.BooleanProperty;
30
import org.apache.jmeter.testelement.property.IntegerProperty;
22
import org.apache.jmeter.testelement.property.IntegerProperty;
31
import org.apache.jmeter.testelement.property.JMeterProperty;
32
import org.apache.jmeter.testelement.property.LongProperty;
23
import org.apache.jmeter.testelement.property.LongProperty;
33
import org.apache.jmeter.testelement.property.TestElementProperty;
24
import org.apache.jorphan.logging.LoggingManager;
25
import org.apache.log.Logger;
34
26
35
/**
27
/**
36
 * ThreadGroup holds the settings for a JMeter thread group.
28
 * ThreadGroup holds the settings for a JMeter thread group.
37
 * 
29
 * 
38
 * This class is intended to be ThreadSafe.
30
 * This class is intended to be ThreadSafe.
39
 */
31
 */
40
public class ThreadGroup extends AbstractTestElement implements Serializable, Controller {
32
public class ThreadGroup extends AbstractThreadGroup {
33
    private static final Logger log = LoggingManager.getLoggerForClass();
41
34
42
    private static final long serialVersionUID = 233L;
35
    private static final long serialVersionUID = 233L;
43
36
44
    /** Number of threads in the thread group */
45
    public final static String NUM_THREADS = "ThreadGroup.num_threads";
46
47
    /** Ramp-up time */
37
    /** Ramp-up time */
48
    public final static String RAMP_TIME = "ThreadGroup.ramp_time";
38
    public final static String RAMP_TIME = "ThreadGroup.ramp_time";
49
39
50
    public final static String MAIN_CONTROLLER = "ThreadGroup.main_controller";
51
52
    /** Whether scheduler is being used */
40
    /** Whether scheduler is being used */
53
    public final static String SCHEDULER = "ThreadGroup.scheduler";
41
    public final static String SCHEDULER = "ThreadGroup.scheduler";
54
42
Lines 64-135 Link Here
64
    /** Scheduler start delay, overrides start time */
52
    /** Scheduler start delay, overrides start time */
65
    public final static String DELAY = "ThreadGroup.delay";
53
    public final static String DELAY = "ThreadGroup.delay";
66
54
67
    /** Action to be taken when a Sampler error occurs */
68
    public final static String ON_SAMPLE_ERROR = "ThreadGroup.on_sample_error"; // int
69
70
    /** Continue, i.e. ignore sampler errors */
71
    public final static String ON_SAMPLE_ERROR_CONTINUE = "continue";
72
73
    /** Stop current thread if sampler error occurs */
74
    public final static String ON_SAMPLE_ERROR_STOPTHREAD = "stopthread";
75
76
    /** Stop test (all threads) if sampler error occurs */
77
    public final static String ON_SAMPLE_ERROR_STOPTEST = "stoptest";
78
79
    /** Stop test NOW (all threads) if sampler error occurs */
80
    public final static String ON_SAMPLE_ERROR_STOPTEST_NOW = "stoptestnow";
81
82
    // @GuardedBy("this")
83
    private int numberOfThreads = 0; // Number of active threads in this group
84
85
    /**
55
    /**
86
     * No-arg constructor.
56
     * No-arg constructor.
87
     */
57
     */
88
    public ThreadGroup() {
58
    public ThreadGroup() {
89
    }
59
    }
90
60
91
    /**
92
     * Set the total number of threads to start
93
     *
94
     * @param numThreads
95
     *            the number of threads.
96
     */
97
    public void setNumThreads(int numThreads) {
98
        setProperty(new IntegerProperty(NUM_THREADS, numThreads));
99
    }
100
61
101
    /**
62
    /**
102
     * Increment the number of active threads
103
     */
104
    synchronized void incrNumberOfThreads() {
105
        numberOfThreads++;
106
    }
107
108
    /**
109
     * Decrement the number of active threads
110
     */
111
    synchronized void decrNumberOfThreads() {
112
        numberOfThreads--;
113
    }
114
115
    /**
116
     * Get the number of active threads
117
     */
118
    public synchronized int getNumberOfThreads() {
119
        return numberOfThreads;
120
    }
121
122
    /** {@inheritDoc} */
123
    public boolean isDone() {
124
        return getSamplerController().isDone();
125
    }
126
127
    /** {@inheritDoc} */
128
    public Sampler next() {
129
        return getSamplerController().next();
130
    }
131
132
    /**
133
     * Set whether scheduler is being used
63
     * Set whether scheduler is being used
134
     *
64
     *
135
     * @param Scheduler true is scheduler is to be used
65
     * @param Scheduler true is scheduler is to be used
Lines 242-327 Link Here
242
        return getPropertyAsInt(ThreadGroup.RAMP_TIME);
172
        return getPropertyAsInt(ThreadGroup.RAMP_TIME);
243
    }
173
    }
244
174
245
    /**
175
   @Override
246
     * Get the sampler controller.
176
   public void scheduleThread(JMeterThread thread)
247
     *
177
   {
248
     * @return the sampler controller.
178
       int rampUp = getRampUp();
249
     */
179
       float perThreadDelay = ((float) (rampUp * 1000) / (float) getNumThreads());
250
    public Controller getSamplerController() {
180
       thread.setInitialDelay((int) (perThreadDelay * thread.getThreadNum()));
251
        Controller c = (Controller) getProperty(MAIN_CONTROLLER).getObjectValue();
252
        return c;
253
    }
254
181
255
    /**
182
       scheduleThread(thread, this);
256
     * Set the sampler controller.
183
   }
257
     *
258
     * @param c
259
     *            the sampler controller.
260
     */
261
    public void setSamplerController(LoopController c) {
262
        c.setContinueForever(false);
263
        setProperty(new TestElementProperty(MAIN_CONTROLLER, c));
264
    }
265
184
266
    /**
185
    /**
267
     * Get the number of threads.
186
     * This will schedule the time for the JMeterThread.
268
     *
187
     *
269
     * @return the number of threads.
188
     * @param thread
189
     * @param group
270
     */
190
     */
271
    public int getNumThreads() {
191
    private void scheduleThread(JMeterThread thread, ThreadGroup group) {
272
        return this.getPropertyAsInt(ThreadGroup.NUM_THREADS);
192
        // if true the Scheduler is enabled
273
    }
193
        if (group.getScheduler()) {
194
            long now = System.currentTimeMillis();
195
            // set the start time for the Thread
196
            if (group.getDelay() > 0) {// Duration is in seconds
197
                thread.setStartTime(group.getDelay() * 1000 + now);
198
            } else {
199
                long start = group.getStartTime();
200
                if (start < now) {
201
                    start = now; // Force a sensible start time
202
                }
203
                thread.setStartTime(start);
204
            }
274
205
275
    /**
206
            // set the endtime for the Thread
276
     * Add a test element.
207
            if (group.getDuration() > 0) {// Duration is in seconds
277
     *
208
                thread.setEndTime(group.getDuration() * 1000 + (thread.getStartTime()));
278
     * @param child
209
            } else {
279
     *            the test element to add.
210
                thread.setEndTime(group.getEndTime());
280
     */
211
            }
281
    @Override
282
    public void addTestElement(TestElement child) {
283
        getSamplerController().addTestElement(child);
284
    }
285
212
286
    /** {@inheritDoc} */
213
            // Enables the scheduler
287
    public void addIterationListener(LoopIterationListener lis) {
214
            thread.setScheduled(true);
288
        getSamplerController().addIterationListener(lis);
215
        }
289
    }
216
    }
290
291
    /** {@inheritDoc} */
292
    public void initialize() {
293
        Controller c = getSamplerController();
294
        JMeterProperty property = c.getProperty(TestElement.NAME);
295
        property.setObjectValue(getName()); // Copy our name into that of the controller
296
        property.setRunningVersion(property.isRunningVersion());// otherwise name reverts
297
        c.initialize();
298
    }
299
300
    /**
301
     * Check if a sampler error should cause thread to stop.
302
     *
303
     * @return true if thread should stop
304
     */
305
    public boolean getOnErrorStopThread() {
306
        return getPropertyAsString(ThreadGroup.ON_SAMPLE_ERROR).equalsIgnoreCase(ON_SAMPLE_ERROR_STOPTHREAD);
307
    }
308
309
    /**
310
     * Check if a sampler error should cause test to stop.
311
     *
312
     * @return true if test (all threads) should stop
313
     */
314
    public boolean getOnErrorStopTest() {
315
        return getPropertyAsString(ThreadGroup.ON_SAMPLE_ERROR).equalsIgnoreCase(ON_SAMPLE_ERROR_STOPTEST);
316
    }
317
318
    /**
319
     * Check if a sampler error should cause test to stop now.
320
     *
321
     * @return true if test (all threads) should stop immediately
322
     */
323
    public boolean getOnErrorStopTestNow() {
324
        return getPropertyAsString(ThreadGroup.ON_SAMPLE_ERROR).equalsIgnoreCase(ON_SAMPLE_ERROR_STOPTEST_NOW);
325
    }
326
327
}
217
}
(-)src/core/org/apache/jmeter/threads/JMeterContext.java (-3 / +3 lines)
Lines 43-49 Link Here
43
43
44
    private JMeterThread thread;
44
    private JMeterThread thread;
45
45
46
    private ThreadGroup threadGroup;
46
    private AbstractThreadGroup threadGroup;
47
47
48
    private int threadNum;
48
    private int threadNum;
49
49
Lines 145-155 Link Here
145
        this.thread = thread;
145
        this.thread = thread;
146
    }
146
    }
147
147
148
    public ThreadGroup getThreadGroup() {
148
    public AbstractThreadGroup getThreadGroup() {
149
        return this.threadGroup;
149
        return this.threadGroup;
150
    }
150
    }
151
151
152
    public void setThreadGroup(ThreadGroup threadgrp) {
152
    public void setThreadGroup(AbstractThreadGroup threadgrp) {
153
        this.threadGroup = threadgrp;
153
        this.threadGroup = threadgrp;
154
    }
154
    }
155
155
(-)src/core/org/apache/jmeter/threads/JMeterThread.java (-2 / +2 lines)
Lines 102-108 Link Here
102
    // based on this scheduler is enabled or disabled
102
    // based on this scheduler is enabled or disabled
103
103
104
    // Gives access to parent thread threadGroup
104
    // Gives access to parent thread threadGroup
105
    private ThreadGroup threadGroup;
105
    private AbstractThreadGroup threadGroup;
106
106
107
    private StandardJMeterEngine engine = null; // For access to stop methods.
107
    private StandardJMeterEngine engine = null; // For access to stop methods.
108
108
Lines 764-770 Link Here
764
        onErrorStopThread = b;
764
        onErrorStopThread = b;
765
    }
765
    }
766
766
767
    public void setThreadGroup(ThreadGroup group) {
767
    public void setThreadGroup(AbstractThreadGroup group) {
768
        this.threadGroup = group;
768
        this.threadGroup = group;
769
    }
769
    }
770
770
(-)src/core/org/apache/jmeter/engine/ConvertListeners.java (-3 / +3 lines)
Lines 30-36 Link Here
30
import org.apache.jmeter.samplers.SampleListener;
30
import org.apache.jmeter.samplers.SampleListener;
31
import org.apache.jmeter.testelement.TestListener;
31
import org.apache.jmeter.testelement.TestListener;
32
import org.apache.jmeter.testelement.ThreadListener;
32
import org.apache.jmeter.testelement.ThreadListener;
33
import org.apache.jmeter.threads.ThreadGroup;
33
import org.apache.jmeter.threads.AbstractThreadGroup;
34
import org.apache.jorphan.collections.HashTree;
34
import org.apache.jorphan.collections.HashTree;
35
import org.apache.jorphan.collections.HashTreeTraverser;
35
import org.apache.jorphan.collections.HashTreeTraverser;
36
import org.apache.jorphan.logging.LoggingManager;
36
import org.apache.jorphan.logging.LoggingManager;
Lines 53-60 Link Here
53
        Iterator<?> iter = subTree.list().iterator();
53
        Iterator<?> iter = subTree.list().iterator();
54
        while (iter.hasNext()) {
54
        while (iter.hasNext()) {
55
            Object item = iter.next();
55
            Object item = iter.next();
56
            if (item instanceof ThreadGroup) {
56
            if (item instanceof AbstractThreadGroup) {
57
                log.info("num threads = " + ((ThreadGroup) item).getNumThreads());
57
                log.info("num threads = " + ((AbstractThreadGroup) item).getNumThreads());
58
            }
58
            }
59
            if (item instanceof Remoteable) {
59
            if (item instanceof Remoteable) {
60
                if (item instanceof ThreadListener){
60
                if (item instanceof ThreadListener){
(-)src/core/org/apache/jmeter/engine/StandardJMeterEngine.java (-47 / +8 lines)
Lines 44-50 Link Here
44
import org.apache.jmeter.threads.JMeterThreadMonitor;
44
import org.apache.jmeter.threads.JMeterThreadMonitor;
45
import org.apache.jmeter.threads.ListenerNotifier;
45
import org.apache.jmeter.threads.ListenerNotifier;
46
import org.apache.jmeter.threads.TestCompiler;
46
import org.apache.jmeter.threads.TestCompiler;
47
import org.apache.jmeter.threads.ThreadGroup;
47
import org.apache.jmeter.threads.AbstractThreadGroup;
48
import org.apache.jmeter.util.JMeterUtils;
48
import org.apache.jmeter.util.JMeterUtils;
49
import org.apache.jorphan.collections.HashTree;
49
import org.apache.jorphan.collections.HashTree;
50
import org.apache.jorphan.collections.ListedHashTree;
50
import org.apache.jorphan.collections.ListedHashTree;
Lines 257-263 Link Here
257
        Iterator<?> iter = elements.iterator();
257
        Iterator<?> iter = elements.iterator();
258
        while (iter.hasNext()) {
258
        while (iter.hasNext()) {
259
            Object item = iter.next();
259
            Object item = iter.next();
260
            if (item instanceof ThreadGroup) {
260
            if (item instanceof AbstractThreadGroup) {
261
                iter.remove();
261
                iter.remove();
262
            } else if (!(item instanceof TestElement)) {
262
            } else if (!(item instanceof TestElement)) {
263
                iter.remove();
263
                iter.remove();
Lines 420-432 Link Here
420
420
421
        List<?> testLevelElements = new LinkedList<Object>(test.list(test.getArray()[0]));
421
        List<?> testLevelElements = new LinkedList<Object>(test.list(test.getArray()[0]));
422
        removeThreadGroups(testLevelElements);
422
        removeThreadGroups(testLevelElements);
423
        SearchByClass<ThreadGroup> searcher = new SearchByClass<ThreadGroup>(ThreadGroup.class);
423
        SearchByClass<AbstractThreadGroup> searcher = new SearchByClass<AbstractThreadGroup>(AbstractThreadGroup.class);
424
        test.traverse(searcher);
424
        test.traverse(searcher);
425
        TestCompiler.initialize();
425
        TestCompiler.initialize();
426
        // for each thread group, generate threads
426
        // for each thread group, generate threads
427
        // hand each thread the sampler controller
427
        // hand each thread the sampler controller
428
        // and the listeners, and the timer
428
        // and the listeners, and the timer
429
        Iterator<ThreadGroup> iter = searcher.getSearchResults().iterator();
429
        Iterator<AbstractThreadGroup> iter = searcher.getSearchResults().iterator();
430
430
431
        /*
431
        /*
432
         * Here's where the test really starts. Run a Full GC now: it's no harm
432
         * Here's where the test really starts. Run a Full GC now: it's no harm
Lines 443-458 Link Here
443
        startingGroups = true;
443
        startingGroups = true;
444
        while (running && iter.hasNext()) {// for each thread group
444
        while (running && iter.hasNext()) {// for each thread group
445
            groupCount++;
445
            groupCount++;
446
            ThreadGroup group = iter.next();
446
            AbstractThreadGroup group = iter.next();
447
            int numThreads = group.getNumThreads();
447
            int numThreads = group.getNumThreads();
448
            JMeterContextService.addTotalThreads(numThreads);
448
            JMeterContextService.addTotalThreads(numThreads);
449
            boolean onErrorStopTest = group.getOnErrorStopTest();
449
            boolean onErrorStopTest = group.getOnErrorStopTest();
450
            boolean onErrorStopTestNow = group.getOnErrorStopTestNow();
450
            boolean onErrorStopTestNow = group.getOnErrorStopTestNow();
451
            boolean onErrorStopThread = group.getOnErrorStopThread();
451
            boolean onErrorStopThread = group.getOnErrorStopThread();
452
            String groupName = group.getName();
452
            String groupName = group.getName();
453
            int rampUp = group.getRampUp();
453
            log.info("Starting " + numThreads + " threads for group " + groupName + ".");
454
            float perThreadDelay = ((float) (rampUp * 1000) / (float) numThreads);
455
            log.info("Starting " + numThreads + " threads for group " + groupName + ". Ramp up = " + rampUp + ".");
456
454
457
            if (onErrorStopTest) {
455
            if (onErrorStopTest) {
458
                log.info("Test will stop on error");
456
                log.info("Test will stop on error");
Lines 463-469 Link Here
463
            } else {
461
            } else {
464
                log.info("Thread will continue on error");
462
                log.info("Thread will continue on error");
465
            }
463
            }
466
467
            ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
464
            ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
468
            threadGroupTree.add(group, testLevelElements);
465
            threadGroupTree.add(group, testLevelElements);
469
            for (int i = 0; running && i < numThreads; i++) {
466
            for (int i = 0; running && i < numThreads; i++) {
Lines 471-488 Link Here
471
                jmeterThread.setThreadNum(i);
468
                jmeterThread.setThreadNum(i);
472
                jmeterThread.setThreadGroup(group);
469
                jmeterThread.setThreadGroup(group);
473
                jmeterThread.setInitialContext(JMeterContextService.getContext());
470
                jmeterThread.setInitialContext(JMeterContextService.getContext());
474
                jmeterThread.setInitialDelay((int) (perThreadDelay * i));
475
                final String threadName = groupName + " " + (groupCount) + "-" + (i + 1);
471
                final String threadName = groupName + " " + (groupCount) + "-" + (i + 1);
476
                jmeterThread.setThreadName(threadName);
472
                jmeterThread.setThreadName(threadName);
477
478
                scheduleThread(jmeterThread, group);
479
480
                // Set up variables for stop handling
481
                jmeterThread.setEngine(this);
473
                jmeterThread.setEngine(this);
482
                jmeterThread.setOnErrorStopTest(onErrorStopTest);
474
                jmeterThread.setOnErrorStopTest(onErrorStopTest);
483
                jmeterThread.setOnErrorStopTestNow(onErrorStopTestNow);
475
                jmeterThread.setOnErrorStopTestNow(onErrorStopTestNow);
484
                jmeterThread.setOnErrorStopThread(onErrorStopThread);
476
                jmeterThread.setOnErrorStopThread(onErrorStopThread);
485
477
478
                group.scheduleThread(jmeterThread);
479
486
                Thread newThread = new Thread(jmeterThread);
480
                Thread newThread = new Thread(jmeterThread);
487
                newThread.setName(threadName);
481
                newThread.setName(threadName);
488
                allThreads.put(jmeterThread, newThread);
482
                allThreads.put(jmeterThread, newThread);
Lines 503-541 Link Here
503
        startingGroups = false;
497
        startingGroups = false;
504
    }
498
    }
505
499
506
    /**
507
     * This will schedule the time for the JMeterThread.
508
     *
509
     * @param thread
510
     * @param group
511
     */
512
    private void scheduleThread(JMeterThread thread, ThreadGroup group) {
513
        // if true the Scheduler is enabled
514
        if (group.getScheduler()) {
515
            long now = System.currentTimeMillis();
516
            // set the start time for the Thread
517
            if (group.getDelay() > 0) {// Duration is in seconds
518
                thread.setStartTime(group.getDelay() * 1000 + now);
519
            } else {
520
                long start = group.getStartTime();
521
                if (start < now) {
522
                    start = now; // Force a sensible start time
523
                }
524
                thread.setStartTime(start);
525
            }
526
527
            // set the endtime for the Thread
528
            if (group.getDuration() > 0) {// Duration is in seconds
529
                thread.setEndTime(group.getDuration() * 1000 + (thread.getStartTime()));
530
            } else {
531
                thread.setEndTime(group.getEndTime());
532
            }
533
534
            // Enables the scheduler
535
            thread.setScheduled(true);
536
        }
537
    }
538
539
    private boolean verifyThreadsStopped() {
500
    private boolean verifyThreadsStopped() {
540
        boolean stoppedAll = true;
501
        boolean stoppedAll = true;
541
        List<Thread> threadsToCheck = new ArrayList<Thread>(allThreads.size());
502
        List<Thread> threadsToCheck = new ArrayList<Thread>(allThreads.size());
(-)src/core/org/apache/jmeter/resources/messages.properties (+1 lines)
Lines 488-493 Link Here
488
menu_edit=Edit
488
menu_edit=Edit
489
menu_expand_all=Expand All
489
menu_expand_all=Expand All
490
menu_generative_controller=Sampler
490
menu_generative_controller=Sampler
491
menu_threads=Threads (Users)
491
menu_listener=Listener
492
menu_listener=Listener
492
menu_logic_controller=Logic Controller
493
menu_logic_controller=Logic Controller
493
menu_merge=Merge
494
menu_merge=Merge
(-)src/core/org/apache/jmeter/util/JMeterVersion.java (-1 / +1 lines)
Lines 44-50 Link Here
44
     * This ensures that JMeterUtils always gets the correct
44
     * This ensures that JMeterUtils always gets the correct
45
     * version, even if JMeterUtils is not re-compiled during the build.
45
     * version, even if JMeterUtils is not re-compiled during the build.
46
     */
46
     */
47
    private static final String VERSION = "2.4";
47
    private static final String VERSION = "2.4.20100216";
48
48
49
    static final String COPYRIGHT = "Copyright (c) 1998-2009 The Apache Software Foundation";
49
    static final String COPYRIGHT = "Copyright (c) 1998-2009 The Apache Software Foundation";
50
50
(-)src/reports/org/apache/jmeter/testelement/ReportPlan.java (-10 / +10 lines)
Lines 32-38 Link Here
32
import org.apache.jmeter.testelement.property.CollectionProperty;
32
import org.apache.jmeter.testelement.property.CollectionProperty;
33
import org.apache.jmeter.testelement.property.StringProperty;
33
import org.apache.jmeter.testelement.property.StringProperty;
34
import org.apache.jmeter.testelement.property.TestElementProperty;
34
import org.apache.jmeter.testelement.property.TestElementProperty;
35
import org.apache.jmeter.threads.ThreadGroup;
35
import org.apache.jmeter.threads.AbstractThreadGroup;
36
import org.apache.jmeter.util.JMeterUtils;
36
import org.apache.jmeter.util.JMeterUtils;
37
import org.apache.jorphan.logging.LoggingManager;
37
import org.apache.jorphan.logging.LoggingManager;
38
import org.apache.log.Logger;
38
import org.apache.log.Logger;
Lines 50-56 Link Here
50
50
51
    public static final String BASEDIR = "ReportPlan.basedir";
51
    public static final String BASEDIR = "ReportPlan.basedir";
52
52
53
    private transient List<ThreadGroup> reportPages = new LinkedList<ThreadGroup>();
53
    private transient List<AbstractThreadGroup> reportPages = new LinkedList<AbstractThreadGroup>();
54
54
55
    private transient List<ConfigElement> configs = new LinkedList<ConfigElement>();
55
    private transient List<ConfigElement> configs = new LinkedList<ConfigElement>();
56
56
Lines 128-141 Link Here
128
    @Override
128
    @Override
129
    public void addTestElement(TestElement tg) {
129
    public void addTestElement(TestElement tg) {
130
        super.addTestElement(tg);
130
        super.addTestElement(tg);
131
        if (tg instanceof ThreadGroup && !isRunningVersion()) {
131
        if (tg instanceof AbstractThreadGroup && !isRunningVersion()) {
132
            addReportPage((ThreadGroup) tg);
132
            addReportPage((AbstractThreadGroup) tg);
133
        }
133
        }
134
    }
134
    }
135
135
136
    public void addJMeterComponent(TestElement child) {
136
    public void addJMeterComponent(TestElement child) {
137
        if (child instanceof ThreadGroup) {
137
        if (child instanceof AbstractThreadGroup) {
138
            addReportPage((ThreadGroup) child);
138
            addReportPage((AbstractThreadGroup) child);
139
        }
139
        }
140
    }
140
    }
141
141
Lines 144-150 Link Here
144
     *
144
     *
145
     * @return the ThreadGroups value
145
     * @return the ThreadGroups value
146
     */
146
     */
147
    public Collection<ThreadGroup> getReportPages() {
147
    public Collection<AbstractThreadGroup> getReportPages() {
148
        return reportPages;
148
        return reportPages;
149
    }
149
    }
150
150
Lines 159-170 Link Here
159
    }
159
    }
160
160
161
    /**
161
    /**
162
     * Adds a feature to the ThreadGroup attribute of the TestPlan object.
162
     * Adds a feature to the AbstractThreadGroup attribute of the TestPlan object.
163
     *
163
     *
164
     * @param group
164
     * @param group
165
     *            the feature to be added to the ThreadGroup attribute
165
     *            the feature to be added to the AbstractThreadGroup attribute
166
     */
166
     */
167
    public void addReportPage(ThreadGroup group) {
167
    public void addReportPage(AbstractThreadGroup group) {
168
        reportPages.add(group);
168
        reportPages.add(group);
169
    }
169
    }
170
170

Return to bug 48749