You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2008/07/07 01:42:14 UTC
svn commit: r674362 [4/6] - in
/jakarta/jmeter/trunk/src/core/org/apache/jmeter: ./ config/ config/gui/
control/ control/gui/ engine/ engine/event/ engine/util/ exceptions/
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/RunTimeGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/RunTimeGui.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/RunTimeGui.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/RunTimeGui.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.control.gui;
@@ -35,186 +35,186 @@
* The user interface for a controller which specifies that its subcomponents
* should be executed some number of seconds in a loop. This component can be
* used standalone or embedded into some other component.
- *
+ *
*/
public class RunTimeGui extends AbstractControllerGui implements ActionListener {
- /**
- * A field allowing the user to specify the number of seconds the controller
- * should loop.
- */
- private JTextField seconds;
-
- /**
- * Boolean indicating whether or not this component should display its name.
- * If true, this is a standalone component. If false, this component is
- * intended to be used as a subpanel for another component.
- */
- private boolean displayName = true;
-
- /**
- * Create a new LoopControlPanel as a standalone component.
- */
- public RunTimeGui() {
- this(true);
- }
-
- /**
- * Create a new LoopControlPanel as either a standalone or an embedded
- * component.
- *
- * @param displayName
- * indicates whether or not this component should display its
- * name. If true, this is a standalone component. If false, this
- * component is intended to be used as a subpanel for another
- * component.
- */
- public RunTimeGui(boolean displayName) {
- this.displayName = displayName;
- init();
- setState(1);
- }
-
- /**
- * A newly created component can be initialized with the contents of a Test
- * Element object by calling this method. The component is responsible for
- * querying the Test Element object for the relevant information to display
- * in its GUI.
- *
- * @param element
- * the TestElement to configure
- */
- public void configure(TestElement element) {
- super.configure(element);
- if (element instanceof RunTime) {
- setState(((RunTime) element).getRuntimeString());
- } else {
- setState(1);
- }
- }
-
- /* Implements JMeterGUIComponent.createTestElement() */
- public TestElement createTestElement() {
- RunTime lc = new RunTime();
- modifyTestElement(lc);
- return lc;
- }
-
- /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
- public void modifyTestElement(TestElement lc) {
- configureTestElement(lc);
- if (lc instanceof RunTime) {
- if (seconds.getText().length() > 0) {
- ((RunTime) lc).setRuntime(seconds.getText());
- } else {
- ((RunTime) lc).setRuntime(0);
- }
- }
- }
+ /**
+ * A field allowing the user to specify the number of seconds the controller
+ * should loop.
+ */
+ private JTextField seconds;
+
+ /**
+ * Boolean indicating whether or not this component should display its name.
+ * If true, this is a standalone component. If false, this component is
+ * intended to be used as a subpanel for another component.
+ */
+ private boolean displayName = true;
+
+ /**
+ * Create a new LoopControlPanel as a standalone component.
+ */
+ public RunTimeGui() {
+ this(true);
+ }
+
+ /**
+ * Create a new LoopControlPanel as either a standalone or an embedded
+ * component.
+ *
+ * @param displayName
+ * indicates whether or not this component should display its
+ * name. If true, this is a standalone component. If false, this
+ * component is intended to be used as a subpanel for another
+ * component.
+ */
+ public RunTimeGui(boolean displayName) {
+ this.displayName = displayName;
+ init();
+ setState(1);
+ }
+
+ /**
+ * A newly created component can be initialized with the contents of a Test
+ * Element object by calling this method. The component is responsible for
+ * querying the Test Element object for the relevant information to display
+ * in its GUI.
+ *
+ * @param element
+ * the TestElement to configure
+ */
+ public void configure(TestElement element) {
+ super.configure(element);
+ if (element instanceof RunTime) {
+ setState(((RunTime) element).getRuntimeString());
+ } else {
+ setState(1);
+ }
+ }
+
+ /* Implements JMeterGUIComponent.createTestElement() */
+ public TestElement createTestElement() {
+ RunTime lc = new RunTime();
+ modifyTestElement(lc);
+ return lc;
+ }
+
+ /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
+ public void modifyTestElement(TestElement lc) {
+ configureTestElement(lc);
+ if (lc instanceof RunTime) {
+ if (seconds.getText().length() > 0) {
+ ((RunTime) lc).setRuntime(seconds.getText());
+ } else {
+ ((RunTime) lc).setRuntime(0);
+ }
+ }
+ }
/**
* Implements JMeterGUIComponent.clearGui
*/
public void clearGui() {
super.clearGui();
-
+
seconds.setText("1"); // $NON-NLS-1$
}
- /**
- * Invoked when an action occurs. This implementation assumes that the
- * target component is the infinite seconds checkbox.
- *
- * @param event
- * the event that has occurred
- */
- public void actionPerformed(ActionEvent event) {
- seconds.setEnabled(true);
- }
-
- public String getLabelResource() {
- return "runtime_controller_title"; // $NON-NLS-1$
- }
-
- /**
- * Initialize the GUI components and layout for this component.
- */
- private void init() {
- // The Loop Controller panel can be displayed standalone or inside
- // another panel. For standalone, we want to display the TITLE, NAME,
- // etc. (everything). However, if we want to display it within another
- // panel, we just display the Loop Count fields (not the TITLE and
- // NAME).
-
- // Standalone
- if (displayName) {
- setLayout(new BorderLayout(0, 5));
- setBorder(makeBorder());
- add(makeTitlePanel(), BorderLayout.NORTH);
-
- JPanel mainPanel = new JPanel(new BorderLayout());
- mainPanel.add(createLoopCountPanel(), BorderLayout.NORTH);
- add(mainPanel, BorderLayout.CENTER);
- } else {
- // Embedded
- setLayout(new BorderLayout());
- add(createLoopCountPanel(), BorderLayout.NORTH);
- }
- }
-
- /**
- * Create a GUI panel containing the components related to the number of
- * seconds which should be executed.
- *
- * @return a GUI panel containing the loop count components
- */
- private JPanel createLoopCountPanel() {
- JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
-
- // SECONDS LABEL
- JLabel secondsLabel = new JLabel(JMeterUtils.getResString("runtime_seconds")); // $NON-NLS-1$
- loopPanel.add(secondsLabel, BorderLayout.WEST);
-
- JPanel loopSubPanel = new JPanel(new BorderLayout(5, 0));
-
- // TEXT FIELD
- seconds = new JTextField("1", 5); // $NON-NLS-1$
- secondsLabel.setLabelFor(seconds);
- loopSubPanel.add(seconds, BorderLayout.CENTER);
-
- loopPanel.add(loopSubPanel, BorderLayout.CENTER);
-
- loopPanel.add(Box.createHorizontalStrut(secondsLabel.getPreferredSize().width
- + seconds.getPreferredSize().width), BorderLayout.NORTH);
-
- return loopPanel;
- }
-
- /**
- * Set the number of seconds which should be reflected in the GUI. The
- * secsCount parameter should contain the String representation of an
- * integer. This integer will be treated as the number of seconds. If this
- * integer is less than 0, the number of seconds will be assumed to be
- * infinity.
- *
- * @param secsCount
- * the String representation of the number of seconds
- */
- private void setState(String secsCount) {
- seconds.setText(secsCount);
- seconds.setEnabled(true);
- }
-
- /**
- * Set the number of seconds which should be reflected in the GUI. If the
- * secsCount is less than 0, the number of seconds will be assumed to be
- * infinity.
- *
- * @param secsCount
- * the number of seconds
- */
- private void setState(long secsCount) {
- seconds.setEnabled(true);
- seconds.setText("" + secsCount); // $NON-NLS-1$
- }
+ /**
+ * Invoked when an action occurs. This implementation assumes that the
+ * target component is the infinite seconds checkbox.
+ *
+ * @param event
+ * the event that has occurred
+ */
+ public void actionPerformed(ActionEvent event) {
+ seconds.setEnabled(true);
+ }
+
+ public String getLabelResource() {
+ return "runtime_controller_title"; // $NON-NLS-1$
+ }
+
+ /**
+ * Initialize the GUI components and layout for this component.
+ */
+ private void init() {
+ // The Loop Controller panel can be displayed standalone or inside
+ // another panel. For standalone, we want to display the TITLE, NAME,
+ // etc. (everything). However, if we want to display it within another
+ // panel, we just display the Loop Count fields (not the TITLE and
+ // NAME).
+
+ // Standalone
+ if (displayName) {
+ setLayout(new BorderLayout(0, 5));
+ setBorder(makeBorder());
+ add(makeTitlePanel(), BorderLayout.NORTH);
+
+ JPanel mainPanel = new JPanel(new BorderLayout());
+ mainPanel.add(createLoopCountPanel(), BorderLayout.NORTH);
+ add(mainPanel, BorderLayout.CENTER);
+ } else {
+ // Embedded
+ setLayout(new BorderLayout());
+ add(createLoopCountPanel(), BorderLayout.NORTH);
+ }
+ }
+
+ /**
+ * Create a GUI panel containing the components related to the number of
+ * seconds which should be executed.
+ *
+ * @return a GUI panel containing the loop count components
+ */
+ private JPanel createLoopCountPanel() {
+ JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
+
+ // SECONDS LABEL
+ JLabel secondsLabel = new JLabel(JMeterUtils.getResString("runtime_seconds")); // $NON-NLS-1$
+ loopPanel.add(secondsLabel, BorderLayout.WEST);
+
+ JPanel loopSubPanel = new JPanel(new BorderLayout(5, 0));
+
+ // TEXT FIELD
+ seconds = new JTextField("1", 5); // $NON-NLS-1$
+ secondsLabel.setLabelFor(seconds);
+ loopSubPanel.add(seconds, BorderLayout.CENTER);
+
+ loopPanel.add(loopSubPanel, BorderLayout.CENTER);
+
+ loopPanel.add(Box.createHorizontalStrut(secondsLabel.getPreferredSize().width
+ + seconds.getPreferredSize().width), BorderLayout.NORTH);
+
+ return loopPanel;
+ }
+
+ /**
+ * Set the number of seconds which should be reflected in the GUI. The
+ * secsCount parameter should contain the String representation of an
+ * integer. This integer will be treated as the number of seconds. If this
+ * integer is less than 0, the number of seconds will be assumed to be
+ * infinity.
+ *
+ * @param secsCount
+ * the String representation of the number of seconds
+ */
+ private void setState(String secsCount) {
+ seconds.setText(secsCount);
+ seconds.setEnabled(true);
+ }
+
+ /**
+ * Set the number of seconds which should be reflected in the GUI. If the
+ * secsCount is less than 0, the number of seconds will be assumed to be
+ * infinity.
+ *
+ * @param secsCount
+ * the number of seconds
+ */
+ private void setState(long secsCount) {
+ seconds.setEnabled(true);
+ seconds.setText("" + secsCount); // $NON-NLS-1$
+ }
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TestPlanGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TestPlanGui.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TestPlanGui.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TestPlanGui.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.control.gui;
@@ -44,163 +44,163 @@
/**
* JMeter GUI component representing the test plan which will be executed when
* the test is run.
- *
+ *
*/
public class TestPlanGui extends AbstractJMeterGuiComponent {
- /**
- * A checkbox allowing the user to specify whether or not JMeter should do
- * functional testing.
- */
- private JCheckBox functionalMode;
+ /**
+ * A checkbox allowing the user to specify whether or not JMeter should do
+ * functional testing.
+ */
+ private JCheckBox functionalMode;
- private JCheckBox serializedMode;
+ private JCheckBox serializedMode;
- /** A panel allowing the user to define variables. */
- private ArgumentsPanel argsPanel;
+ /** A panel allowing the user to define variables. */
+ private ArgumentsPanel argsPanel;
FileListPanel browseJar = null;
/**
- * Create a new TestPlanGui.
- */
- public TestPlanGui() {
- init();
- }
-
- /**
- * When a user right-clicks on the component in the test tree, or selects
- * the edit menu when the component is selected, the component will be asked
- * to return a JPopupMenu that provides all the options available to the
- * user from this component.
- * <p>
- * The TestPlan will return a popup menu allowing you to add ThreadGroups,
- * Listeners, Configuration Elements, Assertions, PreProcessors,
- * PostProcessors, and Timers.
- *
- * @return a JPopupMenu appropriate for the component.
- */
- public JPopupMenu createPopupMenu() {
- JPopupMenu pop = new JPopupMenu();
- JMenu addMenu = new JMenu(JMeterUtils.getResString("add")); // $NON-NLS-1$
- addMenu.add(MenuFactory.makeMenuItem(new ThreadGroupGui().getStaticLabel(), ThreadGroupGui.class.getName(),
- ActionNames.ADD));
- addMenu.add(MenuFactory.makeMenu(MenuFactory.CONFIG_ELEMENTS, ActionNames.ADD));
- addMenu.add(MenuFactory.makeMenu(MenuFactory.TIMERS, ActionNames.ADD));
- addMenu.add(MenuFactory.makeMenu(MenuFactory.PRE_PROCESSORS, ActionNames.ADD));
- addMenu.add(MenuFactory.makeMenu(MenuFactory.ASSERTIONS, ActionNames.ADD));
- addMenu.add(MenuFactory.makeMenu(MenuFactory.POST_PROCESSORS, ActionNames.ADD));
- addMenu.add(MenuFactory.makeMenu(MenuFactory.LISTENERS, ActionNames.ADD));
- pop.add(addMenu);
- MenuFactory.addPasteResetMenu(pop);
- MenuFactory.addFileMenu(pop);
- return pop;
- }
-
- /* Implements JMeterGUIComponent.createTestElement() */
- public TestElement createTestElement() {
- TestPlan tp = new TestPlan();
- modifyTestElement(tp);
- return tp;
- }
-
- /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
- public void modifyTestElement(TestElement plan) {
- super.configureTestElement(plan);
- if (plan instanceof TestPlan) {
- TestPlan tp = (TestPlan) plan;
- tp.setFunctionalMode(functionalMode.isSelected());
- tp.setSerialized(serializedMode.isSelected());
- tp.setUserDefinedVariables((Arguments) argsPanel.createTestElement());
+ * Create a new TestPlanGui.
+ */
+ public TestPlanGui() {
+ init();
+ }
+
+ /**
+ * When a user right-clicks on the component in the test tree, or selects
+ * the edit menu when the component is selected, the component will be asked
+ * to return a JPopupMenu that provides all the options available to the
+ * user from this component.
+ * <p>
+ * The TestPlan will return a popup menu allowing you to add ThreadGroups,
+ * Listeners, Configuration Elements, Assertions, PreProcessors,
+ * PostProcessors, and Timers.
+ *
+ * @return a JPopupMenu appropriate for the component.
+ */
+ public JPopupMenu createPopupMenu() {
+ JPopupMenu pop = new JPopupMenu();
+ JMenu addMenu = new JMenu(JMeterUtils.getResString("add")); // $NON-NLS-1$
+ addMenu.add(MenuFactory.makeMenuItem(new ThreadGroupGui().getStaticLabel(), ThreadGroupGui.class.getName(),
+ ActionNames.ADD));
+ addMenu.add(MenuFactory.makeMenu(MenuFactory.CONFIG_ELEMENTS, ActionNames.ADD));
+ addMenu.add(MenuFactory.makeMenu(MenuFactory.TIMERS, ActionNames.ADD));
+ addMenu.add(MenuFactory.makeMenu(MenuFactory.PRE_PROCESSORS, ActionNames.ADD));
+ addMenu.add(MenuFactory.makeMenu(MenuFactory.ASSERTIONS, ActionNames.ADD));
+ addMenu.add(MenuFactory.makeMenu(MenuFactory.POST_PROCESSORS, ActionNames.ADD));
+ addMenu.add(MenuFactory.makeMenu(MenuFactory.LISTENERS, ActionNames.ADD));
+ pop.add(addMenu);
+ MenuFactory.addPasteResetMenu(pop);
+ MenuFactory.addFileMenu(pop);
+ return pop;
+ }
+
+ /* Implements JMeterGUIComponent.createTestElement() */
+ public TestElement createTestElement() {
+ TestPlan tp = new TestPlan();
+ modifyTestElement(tp);
+ return tp;
+ }
+
+ /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
+ public void modifyTestElement(TestElement plan) {
+ super.configureTestElement(plan);
+ if (plan instanceof TestPlan) {
+ TestPlan tp = (TestPlan) plan;
+ tp.setFunctionalMode(functionalMode.isSelected());
+ tp.setSerialized(serializedMode.isSelected());
+ tp.setUserDefinedVariables((Arguments) argsPanel.createTestElement());
tp.setTestPlanClasspathArray(browseJar.getFiles());
- }
- }
+ }
+ }
+
+ public String getLabelResource() {
+ return "test_plan"; // $NON-NLS-1$
+ }
- public String getLabelResource() {
- return "test_plan"; // $NON-NLS-1$
- }
-
- /**
- * This is the list of menu categories this gui component will be available
- * under. This implementation returns null, since the TestPlan appears at
- * the top level of the tree and cannot be added elsewhere.
- *
- * @return a Collection of Strings, where each element is one of the
- * constants defined in MenuFactory
- */
- public Collection getMenuCategories() {
- return null;
- }
-
- /**
- * A newly created component can be initialized with the contents of a Test
- * Element object by calling this method. The component is responsible for
- * querying the Test Element object for the relevant information to display
- * in its GUI.
- *
- * @param el
- * the TestElement to configure
- */
- public void configure(TestElement el) {
- super.configure(el);
- if (el instanceof TestPlan) {
- TestPlan tp = (TestPlan) el;
- functionalMode.setSelected(tp.isFunctionalMode());
- serializedMode.setSelected(tp.isSerialized());
- final JMeterProperty udv = tp.getUserDefinedVariablesAsProperty();
- if (udv != null) {
- argsPanel.configure((Arguments) udv.getObjectValue());
- }
+ /**
+ * This is the list of menu categories this gui component will be available
+ * under. This implementation returns null, since the TestPlan appears at
+ * the top level of the tree and cannot be added elsewhere.
+ *
+ * @return a Collection of Strings, where each element is one of the
+ * constants defined in MenuFactory
+ */
+ public Collection getMenuCategories() {
+ return null;
+ }
+
+ /**
+ * A newly created component can be initialized with the contents of a Test
+ * Element object by calling this method. The component is responsible for
+ * querying the Test Element object for the relevant information to display
+ * in its GUI.
+ *
+ * @param el
+ * the TestElement to configure
+ */
+ public void configure(TestElement el) {
+ super.configure(el);
+ if (el instanceof TestPlan) {
+ TestPlan tp = (TestPlan) el;
+ functionalMode.setSelected(tp.isFunctionalMode());
+ serializedMode.setSelected(tp.isSerialized());
+ final JMeterProperty udv = tp.getUserDefinedVariablesAsProperty();
+ if (udv != null) {
+ argsPanel.configure((Arguments) udv.getObjectValue());
+ }
browseJar.setFiles(tp.getTestPlanClasspathArray());
- }
- }
+ }
+ }
- /**
- * Create a panel allowing the user to define variables for the test.
- *
- * @return a panel for user-defined variables
- */
- private JPanel createVariablePanel() {
- argsPanel = new ArgumentsPanel(JMeterUtils.getResString("user_defined_variables")); // $NON-NLS-1$
+ /**
+ * Create a panel allowing the user to define variables for the test.
+ *
+ * @return a panel for user-defined variables
+ */
+ private JPanel createVariablePanel() {
+ argsPanel = new ArgumentsPanel(JMeterUtils.getResString("user_defined_variables")); // $NON-NLS-1$
- return argsPanel;
- }
+ return argsPanel;
+ }
protected Container createClassPathPanel() {
browseJar = new FileListPanel(JMeterUtils.getResString("test_plan_classpath_browse"), ".jar"); // $NON-NLS-1$ $NON-NLS-2$
return browseJar;
}
- /**
- * Initialize the components and layout of this component.
- */
- private void init() {
- setLayout(new BorderLayout(10, 10));
- setBorder(makeBorder());
-
- add(makeTitlePanel(), BorderLayout.NORTH);
-
- add(createVariablePanel(), BorderLayout.CENTER);
-
- VerticalPanel southPanel = new VerticalPanel();
- serializedMode = new JCheckBox(JMeterUtils.getResString("testplan.serialized")); // $NON-NLS-1$
- southPanel.add(serializedMode);
- functionalMode = new JCheckBox(JMeterUtils.getResString("functional_mode")); // $NON-NLS-1$
- southPanel.add(functionalMode);
- JTextArea explain = new JTextArea(JMeterUtils.getResString("functional_mode_explanation")); // $NON-NLS-1$
- explain.setEditable(false);
- explain.setBackground(this.getBackground());
- southPanel.add(explain);
+ /**
+ * Initialize the components and layout of this component.
+ */
+ private void init() {
+ setLayout(new BorderLayout(10, 10));
+ setBorder(makeBorder());
+
+ add(makeTitlePanel(), BorderLayout.NORTH);
+
+ add(createVariablePanel(), BorderLayout.CENTER);
+
+ VerticalPanel southPanel = new VerticalPanel();
+ serializedMode = new JCheckBox(JMeterUtils.getResString("testplan.serialized")); // $NON-NLS-1$
+ southPanel.add(serializedMode);
+ functionalMode = new JCheckBox(JMeterUtils.getResString("functional_mode")); // $NON-NLS-1$
+ southPanel.add(functionalMode);
+ JTextArea explain = new JTextArea(JMeterUtils.getResString("functional_mode_explanation")); // $NON-NLS-1$
+ explain.setEditable(false);
+ explain.setBackground(this.getBackground());
+ southPanel.add(explain);
southPanel.add(createClassPathPanel());
- add(southPanel, BorderLayout.SOUTH);
- }
+ add(southPanel, BorderLayout.SOUTH);
+ }
- public void clearGui() {
- super.clearGui();
- functionalMode.setSelected(false);
- serializedMode.setSelected(false);
- argsPanel.clear();
- browseJar.clearFiles();
- }
+ public void clearGui() {
+ super.clearGui();
+ functionalMode.setSelected(false);
+ serializedMode.setSelected(false);
+ argsPanel.clear();
+ browseJar.clearFiles();
+ }
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/TransactionControllerGui.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.control.gui;
@@ -27,49 +27,49 @@
/**
* A Transaction controller component.
- *
+ *
*/
public class TransactionControllerGui extends AbstractControllerGui {
- private JCheckBox parent; // If selected, then generate parent sample, otherwise as per original controller
+ private JCheckBox parent; // If selected, then generate parent sample, otherwise as per original controller
- /**
- * Create a new TransactionControllerGui instance.
- */
- public TransactionControllerGui() {
- init();
- }
-
- /* Implements JMeterGUIComponent.createTestElement() */
- public TestElement createTestElement() {
- TransactionController lc = new TransactionController();
- configureTestElement(lc);
- return lc;
- }
-
- public void configure(TestElement el) {
- super.configure(el);
- parent.setSelected(((TransactionController) el).isParent());
- }
-
- /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
- public void modifyTestElement(TestElement el) {
- configureTestElement(el);
- ((TransactionController) el).setParent(parent.isSelected());
- }
-
- public String getLabelResource() {
- return "transaction_controller_title"; // $NON-NLS-1$
- }
-
- /**
- * Initialize the GUI components and layout for this component.
- */
- private void init() {
- setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
- setBorder(makeBorder());
- add(makeTitlePanel());
- parent = new JCheckBox(JMeterUtils.getResString("transaction_controller_parent")); // $NON-NLS-1$
- add(parent);
- }
+ /**
+ * Create a new TransactionControllerGui instance.
+ */
+ public TransactionControllerGui() {
+ init();
+ }
+
+ /* Implements JMeterGUIComponent.createTestElement() */
+ public TestElement createTestElement() {
+ TransactionController lc = new TransactionController();
+ configureTestElement(lc);
+ return lc;
+ }
+
+ public void configure(TestElement el) {
+ super.configure(el);
+ parent.setSelected(((TransactionController) el).isParent());
+ }
+
+ /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
+ public void modifyTestElement(TestElement el) {
+ configureTestElement(el);
+ ((TransactionController) el).setParent(parent.isSelected());
+ }
+
+ public String getLabelResource() {
+ return "transaction_controller_title"; // $NON-NLS-1$
+ }
+
+ /**
+ * Initialize the GUI components and layout for this component.
+ */
+ private void init() {
+ setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
+ setBorder(makeBorder());
+ add(makeTitlePanel());
+ parent = new JCheckBox(JMeterUtils.getResString("transaction_controller_parent")); // $NON-NLS-1$
+ add(parent);
+ }
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WhileControllerGui.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.control.gui;
@@ -34,62 +34,62 @@
public class WhileControllerGui extends AbstractControllerGui implements ActionListener {
- private static final String CONDITION_LABEL = "while_controller_label"; // $NON-NLS-1$
+ private static final String CONDITION_LABEL = "while_controller_label"; // $NON-NLS-1$
- /**
- * A field allowing the user to specify the condition (not yet used).
- */
- private JTextField theCondition;
-
- /** The name of the condition field component. */
- private static final String CONDITION = "While_Condition"; // $NON-NLS-1$
-
- /**
- * Create a new LoopControlPanel as a standalone component.
- */
- public WhileControllerGui() {
- init();
- }
-
- /**
- * A newly created component can be initialized with the contents of a Test
- * Element object by calling this method. The component is responsible for
- * querying the Test Element object for the relevant information to display
- * in its GUI.
- *
- * @param element
- * the TestElement to configure
- */
- public void configure(TestElement element) {
- super.configure(element);
- if (element instanceof WhileController) {
- theCondition.setText(((WhileController) element).getCondition());
- }
-
- }
-
- /**
- * Implements JMeterGUIComponent.createTestElement()
- */
- public TestElement createTestElement() {
- WhileController controller = new WhileController();
- modifyTestElement(controller);
- return controller;
- }
-
- /**
- * Implements JMeterGUIComponent.modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement controller) {
- configureTestElement(controller);
- if (controller instanceof WhileController) {
- if (theCondition.getText().length() > 0) {
- ((WhileController) controller).setCondition(theCondition.getText());
- } else {
- ((WhileController) controller).setCondition(""); // $NON-NLS-1$
- }
- }
- }
+ /**
+ * A field allowing the user to specify the condition (not yet used).
+ */
+ private JTextField theCondition;
+
+ /** The name of the condition field component. */
+ private static final String CONDITION = "While_Condition"; // $NON-NLS-1$
+
+ /**
+ * Create a new LoopControlPanel as a standalone component.
+ */
+ public WhileControllerGui() {
+ init();
+ }
+
+ /**
+ * A newly created component can be initialized with the contents of a Test
+ * Element object by calling this method. The component is responsible for
+ * querying the Test Element object for the relevant information to display
+ * in its GUI.
+ *
+ * @param element
+ * the TestElement to configure
+ */
+ public void configure(TestElement element) {
+ super.configure(element);
+ if (element instanceof WhileController) {
+ theCondition.setText(((WhileController) element).getCondition());
+ }
+
+ }
+
+ /**
+ * Implements JMeterGUIComponent.createTestElement()
+ */
+ public TestElement createTestElement() {
+ WhileController controller = new WhileController();
+ modifyTestElement(controller);
+ return controller;
+ }
+
+ /**
+ * Implements JMeterGUIComponent.modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement controller) {
+ configureTestElement(controller);
+ if (controller instanceof WhileController) {
+ if (theCondition.getText().length() > 0) {
+ ((WhileController) controller).setCondition(theCondition.getText());
+ } else {
+ ((WhileController) controller).setCondition(""); // $NON-NLS-1$
+ }
+ }
+ }
/**
* Implements JMeterGUIComponent.clearGui
@@ -99,58 +99,58 @@
theCondition.setText(""); // $NON-NLS-1$
}
- /**
- * Invoked when an action occurs. This implementation assumes that the
- * target component is the infinite loops checkbox.
- *
- * @param event
- * the event that has occurred
- */
- public void actionPerformed(ActionEvent event) {
- new FocusRequester(theCondition);
- }
-
- public String getLabelResource() {
- return "while_controller_title"; // $NON-NLS-1$
- }
-
- /**
- * Initialize the GUI components and layout for this component.
- */
- private void init() {
- setLayout(new BorderLayout(0, 5));
- setBorder(makeBorder());
- add(makeTitlePanel(), BorderLayout.NORTH);
-
- JPanel mainPanel = new JPanel(new BorderLayout());
- mainPanel.add(createConditionPanel(), BorderLayout.NORTH);
- add(mainPanel, BorderLayout.CENTER);
-
- }
-
- /**
- * Create a GUI panel containing the condition. TODO make use of the field
- *
- * @return a GUI panel containing the condition components
- */
- private JPanel createConditionPanel() {
- JPanel conditionPanel = new JPanel(new BorderLayout(5, 0));
-
- // Condition LABEL
- JLabel conditionLabel = new JLabel(JMeterUtils.getResString(CONDITION_LABEL));
- conditionPanel.add(conditionLabel, BorderLayout.WEST);
-
- // TEXT FIELD
- // This means exit if last sample failed
- theCondition = new JTextField(""); // $NON-NLS-1$
- theCondition.setName(CONDITION);
- conditionLabel.setLabelFor(theCondition);
- conditionPanel.add(theCondition, BorderLayout.CENTER);
- theCondition.addActionListener(this);
+ /**
+ * Invoked when an action occurs. This implementation assumes that the
+ * target component is the infinite loops checkbox.
+ *
+ * @param event
+ * the event that has occurred
+ */
+ public void actionPerformed(ActionEvent event) {
+ new FocusRequester(theCondition);
+ }
- conditionPanel.add(Box.createHorizontalStrut(conditionLabel.getPreferredSize().width
- + theCondition.getPreferredSize().width), BorderLayout.NORTH);
+ public String getLabelResource() {
+ return "while_controller_title"; // $NON-NLS-1$
+ }
+
+ /**
+ * Initialize the GUI components and layout for this component.
+ */
+ private void init() {
+ setLayout(new BorderLayout(0, 5));
+ setBorder(makeBorder());
+ add(makeTitlePanel(), BorderLayout.NORTH);
+
+ JPanel mainPanel = new JPanel(new BorderLayout());
+ mainPanel.add(createConditionPanel(), BorderLayout.NORTH);
+ add(mainPanel, BorderLayout.CENTER);
- return conditionPanel;
- }
+ }
+
+ /**
+ * Create a GUI panel containing the condition. TODO make use of the field
+ *
+ * @return a GUI panel containing the condition components
+ */
+ private JPanel createConditionPanel() {
+ JPanel conditionPanel = new JPanel(new BorderLayout(5, 0));
+
+ // Condition LABEL
+ JLabel conditionLabel = new JLabel(JMeterUtils.getResString(CONDITION_LABEL));
+ conditionPanel.add(conditionLabel, BorderLayout.WEST);
+
+ // TEXT FIELD
+ // This means exit if last sample failed
+ theCondition = new JTextField(""); // $NON-NLS-1$
+ theCondition.setName(CONDITION);
+ conditionLabel.setLabelFor(theCondition);
+ conditionPanel.add(theCondition, BorderLayout.CENTER);
+ theCondition.addActionListener(this);
+
+ conditionPanel.add(Box.createHorizontalStrut(conditionLabel.getPreferredSize().width
+ + theCondition.getPreferredSize().width), BorderLayout.NORTH);
+
+ return conditionPanel;
+ }
}
\ No newline at end of file
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/WorkBenchGui.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.control.gui;
@@ -34,83 +34,83 @@
/**
* JMeter GUI component representing a work bench where users can make
* preparations for the test plan.
- *
+ *
*/
public class WorkBenchGui extends AbstractJMeterGuiComponent {
- /**
- * Create a new WorkbenchGui.
- */
- public WorkBenchGui() {
- super();
- init();
- }
-
- /**
- * This is the list of menu categories this gui component will be available
- * under. This implementation returns null, since the WorkBench appears at
- * the top level of the tree and cannot be added elsewhere.
- *
- * @return a Collection of Strings, where each element is one of the
- * constants defined in MenuFactory
- */
- public Collection getMenuCategories() {
- return null;
- }
-
- /* Implements JMeterGUIComponent.createTestElement() */
- public TestElement createTestElement() {
- WorkBench wb = new WorkBench();
- modifyTestElement(wb);
- return wb;
- }
-
- /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
- public void modifyTestElement(TestElement wb) {
- super.configureTestElement(wb);
- }
-
- /**
- * When a user right-clicks on the component in the test tree, or selects
- * the edit menu when the component is selected, the component will be asked
- * to return a JPopupMenu that provides all the options available to the
- * user from this component.
- * <p>
- * The WorkBench returns a popup menu allowing you to add anything.
- *
- * @return a JPopupMenu appropriate for the component.
- */
- public JPopupMenu createPopupMenu() {
- JPopupMenu menu = new JPopupMenu();
- JMenu addMenu = MenuFactory.makeMenus(new String[] {
- MenuFactory.NON_TEST_ELEMENTS,
- MenuFactory.CONTROLLERS,
- MenuFactory.CONFIG_ELEMENTS,
- MenuFactory.TIMERS,
- MenuFactory.PRE_PROCESSORS,
- MenuFactory.SAMPLERS,
- MenuFactory.ASSERTIONS,
- MenuFactory.POST_PROCESSORS,
- MenuFactory.LISTENERS,
- },
- JMeterUtils.getResString("add"), // $NON-NLS-1$
- ActionNames.ADD);
- menu.add(addMenu);
- MenuFactory.addPasteResetMenu(menu);
- MenuFactory.addFileMenu(menu);
- return menu;
- }
-
- public String getLabelResource() {
- return "workbench_title"; // $NON-NLS-1$
- }
-
- /**
- * Initialize the components and layout of this component.
- */
- private void init() {
- setLayout(new BorderLayout());
- setBorder(makeBorder());
+ /**
+ * Create a new WorkbenchGui.
+ */
+ public WorkBenchGui() {
+ super();
+ init();
+ }
+
+ /**
+ * This is the list of menu categories this gui component will be available
+ * under. This implementation returns null, since the WorkBench appears at
+ * the top level of the tree and cannot be added elsewhere.
+ *
+ * @return a Collection of Strings, where each element is one of the
+ * constants defined in MenuFactory
+ */
+ public Collection getMenuCategories() {
+ return null;
+ }
+
+ /* Implements JMeterGUIComponent.createTestElement() */
+ public TestElement createTestElement() {
+ WorkBench wb = new WorkBench();
+ modifyTestElement(wb);
+ return wb;
+ }
+
+ /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
+ public void modifyTestElement(TestElement wb) {
+ super.configureTestElement(wb);
+ }
+
+ /**
+ * When a user right-clicks on the component in the test tree, or selects
+ * the edit menu when the component is selected, the component will be asked
+ * to return a JPopupMenu that provides all the options available to the
+ * user from this component.
+ * <p>
+ * The WorkBench returns a popup menu allowing you to add anything.
+ *
+ * @return a JPopupMenu appropriate for the component.
+ */
+ public JPopupMenu createPopupMenu() {
+ JPopupMenu menu = new JPopupMenu();
+ JMenu addMenu = MenuFactory.makeMenus(new String[] {
+ MenuFactory.NON_TEST_ELEMENTS,
+ MenuFactory.CONTROLLERS,
+ MenuFactory.CONFIG_ELEMENTS,
+ MenuFactory.TIMERS,
+ MenuFactory.PRE_PROCESSORS,
+ MenuFactory.SAMPLERS,
+ MenuFactory.ASSERTIONS,
+ MenuFactory.POST_PROCESSORS,
+ MenuFactory.LISTENERS,
+ },
+ JMeterUtils.getResString("add"), // $NON-NLS-1$
+ ActionNames.ADD);
+ menu.add(addMenu);
+ MenuFactory.addPasteResetMenu(menu);
+ MenuFactory.addFileMenu(menu);
+ return menu;
+ }
+
+ public String getLabelResource() {
+ return "workbench_title"; // $NON-NLS-1$
+ }
+
+ /**
+ * Initialize the components and layout of this component.
+ */
+ private void init() {
+ setLayout(new BorderLayout());
+ setBorder(makeBorder());
- add(makeTitlePanel(), BorderLayout.NORTH);
- }
+ add(makeTitlePanel(), BorderLayout.NORTH);
+ }
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/ClientJMeterEngine.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.engine;
@@ -35,125 +35,125 @@
* Class to run remote tests from the client JMeter and collect remote samples
*/
public class ClientJMeterEngine implements JMeterEngine, Runnable {
- private static final Logger log = LoggingManager.getLoggerForClass();
+ private static final Logger log = LoggingManager.getLoggerForClass();
- RemoteJMeterEngine remote;
+ RemoteJMeterEngine remote;
- HashTree test;
+ HashTree test;
- SearchByClass testListeners;
+ SearchByClass testListeners;
- ConvertListeners sampleListeners;
+ ConvertListeners sampleListeners;
- private String host;
+ private String host;
- private static RemoteJMeterEngine getEngine(String h) throws MalformedURLException, RemoteException,
- NotBoundException {
- return (RemoteJMeterEngine) Naming.lookup("//" + h + "/JMeterEngine"); // $NON-NLS-1$ $NON-NLS-2$
- }
+ private static RemoteJMeterEngine getEngine(String h) throws MalformedURLException, RemoteException,
+ NotBoundException {
+ return (RemoteJMeterEngine) Naming.lookup("//" + h + "/JMeterEngine"); // $NON-NLS-1$ $NON-NLS-2$
+ }
- public ClientJMeterEngine(String host) throws MalformedURLException, NotBoundException, RemoteException {
- this(getEngine(host));
- this.host = host;
- }
+ public ClientJMeterEngine(String host) throws MalformedURLException, NotBoundException, RemoteException {
+ this(getEngine(host));
+ this.host = host;
+ }
- public ClientJMeterEngine(RemoteJMeterEngine remote) {
- this.remote = remote;
- }
+ public ClientJMeterEngine(RemoteJMeterEngine remote) {
+ this.remote = remote;
+ }
- protected HashTree getTestTree() {
- return test;
- }
+ protected HashTree getTestTree() {
+ return test;
+ }
- public void configure(HashTree testTree) {
+ public void configure(HashTree testTree) {
TreeCloner cloner = new TreeCloner(false);
testTree.traverse(cloner);
- test = cloner.getClonedTree();
- }
+ test = cloner.getClonedTree();
+ }
- public void setHost(String host) {
- this.host = host;
- }
-
- public void runTest() {
- log.info("about to run remote test");
- new Thread(this).start();
- log.info("done initiating run command");
- }
-
- public void stopTest() {
- log.info("about to stop remote test on "+host);
- try {
- remote.stopTest();
- } catch (Exception ex) {
- log.error("", ex); // $NON-NLS-1$
- }
- }
-
- public void reset() {
- try {
- try {
- remote.reset();
- } catch (java.rmi.ConnectException e) {
- remote = getEngine(host);
- remote.reset();
- }
- } catch (Exception ex) {
- log.error("", ex); // $NON-NLS-1$
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- public void run() {
- log.info("running clientengine run method");
- testListeners = new SearchByClass(TestListener.class);
- sampleListeners = new ConvertListeners();
- HashTree testTree = getTestTree();
- PreCompiler compiler = new PreCompiler(true); // limit the changes to client only test elements
- synchronized(testTree) {
- testTree.traverse(compiler);
- testTree.traverse(new TurnElementsOn());
- testTree.traverse(testListeners);
- testTree.traverse(sampleListeners);
- }
-
- try {
- JMeterContextService.startTest();
- remote.setHost(host);
- log.info("sent host =" + host);
- remote.configure(test);
- log.info("sent test");
- remote.runTest();
- log.info("sent run command");
- } catch (Exception ex) {
- log.error("", ex); // $NON-NLS-1$
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.jmeter.engine.JMeterEngine#exit()
- */
- public void exit() {
- log.info("about to exit remote server on "+host);
- try {
- remote.exit();
- } catch (RemoteException e) {
- log.warn("Could not perform remote exit: " + e.toString());
- }
- }
-
- public void setProperties(Properties p) {
- log.info("Sending properties "+p);
- try {
- remote.setProperties(p);
- } catch (RemoteException e) {
- log.warn("Could not set properties: " + e.toString());
- }
- }
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public void runTest() {
+ log.info("about to run remote test");
+ new Thread(this).start();
+ log.info("done initiating run command");
+ }
+
+ public void stopTest() {
+ log.info("about to stop remote test on "+host);
+ try {
+ remote.stopTest();
+ } catch (Exception ex) {
+ log.error("", ex); // $NON-NLS-1$
+ }
+ }
+
+ public void reset() {
+ try {
+ try {
+ remote.reset();
+ } catch (java.rmi.ConnectException e) {
+ remote = getEngine(host);
+ remote.reset();
+ }
+ } catch (Exception ex) {
+ log.error("", ex); // $NON-NLS-1$
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ log.info("running clientengine run method");
+ testListeners = new SearchByClass(TestListener.class);
+ sampleListeners = new ConvertListeners();
+ HashTree testTree = getTestTree();
+ PreCompiler compiler = new PreCompiler(true); // limit the changes to client only test elements
+ synchronized(testTree) {
+ testTree.traverse(compiler);
+ testTree.traverse(new TurnElementsOn());
+ testTree.traverse(testListeners);
+ testTree.traverse(sampleListeners);
+ }
+
+ try {
+ JMeterContextService.startTest();
+ remote.setHost(host);
+ log.info("sent host =" + host);
+ remote.configure(test);
+ log.info("sent test");
+ remote.runTest();
+ log.info("sent run command");
+ } catch (Exception ex) {
+ log.error("", ex); // $NON-NLS-1$
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.jmeter.engine.JMeterEngine#exit()
+ */
+ public void exit() {
+ log.info("about to exit remote server on "+host);
+ try {
+ remote.exit();
+ } catch (RemoteException e) {
+ log.warn("Could not perform remote exit: " + e.toString());
+ }
+ }
+
+ public void setProperties(Properties p) {
+ log.info("Sending properties "+p);
+ try {
+ remote.setProperties(p);
+ } catch (RemoteException e) {
+ log.warn("Could not set properties: " + e.toString());
+ }
+ }
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/ConvertListeners.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.engine;
@@ -39,55 +39,55 @@
* @author mstover
*/
public class ConvertListeners implements HashTreeTraverser {
- private static final Logger log = LoggingManager.getLoggerForClass();
+ private static final Logger log = LoggingManager.getLoggerForClass();
- /*
- * (non-Javadoc)
- *
- * @see HashTreeTraverser#addNode(Object, HashTree)
- */
- public void addNode(Object node, HashTree subTree) {
- Iterator iter = subTree.list().iterator();
- while (iter.hasNext()) {
- Object item = iter.next();
- if (item instanceof ThreadGroup) {
- log.info("num threads = " + ((ThreadGroup) item).getNumThreads());
- }
- if (item instanceof Remoteable
- && (item instanceof TestListener || item instanceof SampleListener)) {
- try {
- RemoteSampleListener rtl = new RemoteSampleListenerImpl(item);
- if (item instanceof TestListener && item instanceof SampleListener) {
- RemoteListenerWrapper wrap = new RemoteListenerWrapper(rtl);
- subTree.replace(item, wrap);
- } else if (item instanceof TestListener) {
- RemoteTestListenerWrapper wrap = new RemoteTestListenerWrapper(rtl);
- subTree.replace(item, wrap);
- } else {
- RemoteSampleListenerWrapper wrap = new RemoteSampleListenerWrapper(rtl);
- subTree.replace(item, wrap);
- }
- } catch (RemoteException e) {
- log.error("", e); // $NON-NLS-1$
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see HashTreeTraverser#subtractNode()
- */
- public void subtractNode() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see HashTreeTraverser#processPath()
- */
- public void processPath() {
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see HashTreeTraverser#addNode(Object, HashTree)
+ */
+ public void addNode(Object node, HashTree subTree) {
+ Iterator iter = subTree.list().iterator();
+ while (iter.hasNext()) {
+ Object item = iter.next();
+ if (item instanceof ThreadGroup) {
+ log.info("num threads = " + ((ThreadGroup) item).getNumThreads());
+ }
+ if (item instanceof Remoteable
+ && (item instanceof TestListener || item instanceof SampleListener)) {
+ try {
+ RemoteSampleListener rtl = new RemoteSampleListenerImpl(item);
+ if (item instanceof TestListener && item instanceof SampleListener) {
+ RemoteListenerWrapper wrap = new RemoteListenerWrapper(rtl);
+ subTree.replace(item, wrap);
+ } else if (item instanceof TestListener) {
+ RemoteTestListenerWrapper wrap = new RemoteTestListenerWrapper(rtl);
+ subTree.replace(item, wrap);
+ } else {
+ RemoteSampleListenerWrapper wrap = new RemoteSampleListenerWrapper(rtl);
+ subTree.replace(item, wrap);
+ }
+ } catch (RemoteException e) {
+ log.error("", e); // $NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see HashTreeTraverser#subtractNode()
+ */
+ public void subtractNode() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see HashTreeTraverser#processPath()
+ */
+ public void processPath() {
+ }
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/JMeterEngine.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/JMeterEngine.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/JMeterEngine.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/JMeterEngine.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.engine;
@@ -23,17 +23,17 @@
import org.apache.jorphan.collections.HashTree;
public interface JMeterEngine {
- void configure(HashTree testPlan);
+ void configure(HashTree testPlan);
- void runTest() throws JMeterEngineException;
+ void runTest() throws JMeterEngineException;
- void stopTest();
+ void stopTest();
- void reset();
+ void reset();
- void setHost(String host);
-
- void setProperties(Properties p);
+ void setHost(String host);
- void exit();
+ void setProperties(Properties p);
+
+ void exit();
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/JMeterEngineException.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/JMeterEngineException.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/JMeterEngineException.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/JMeterEngineException.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.engine;
@@ -24,11 +24,11 @@
* @author mstover
*/
public class JMeterEngineException extends Exception implements Serializable {
- public JMeterEngineException() {
- super();
- }
+ public JMeterEngineException() {
+ super();
+ }
- public JMeterEngineException(String msg) {
- super(msg);
- }
+ public JMeterEngineException(String msg) {
+ super(msg);
+ }
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/PreCompiler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/PreCompiler.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/PreCompiler.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/PreCompiler.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.engine;
@@ -35,35 +35,35 @@
/**
* Class to replace function and variable references in the test tree.
- *
+ *
*/
public class PreCompiler implements HashTreeTraverser {
- private static final Logger log = LoggingManager.getLoggerForClass();
+ private static final Logger log = LoggingManager.getLoggerForClass();
- private final ValueReplacer replacer;
-
-// Used by both StandardJMeterEngine and ClientJMeterEngine.
-// In the latter case, only ResultCollectors are updated,
-// as only these are relevant to the client, and updating
-// other elements causes all sorts of problems.
- private final boolean isRemote; // skip certain processing for remote tests
-
- public PreCompiler() {
- replacer = new ValueReplacer();
- isRemote = false;
- }
-
- public PreCompiler(boolean remote) {
- replacer = new ValueReplacer();
- isRemote = remote;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see HashTreeTraverser#addNode(Object, HashTree)
- */
- public void addNode(Object node, HashTree subTree) {
+ private final ValueReplacer replacer;
+
+// Used by both StandardJMeterEngine and ClientJMeterEngine.
+// In the latter case, only ResultCollectors are updated,
+// as only these are relevant to the client, and updating
+// other elements causes all sorts of problems.
+ private final boolean isRemote; // skip certain processing for remote tests
+
+ public PreCompiler() {
+ replacer = new ValueReplacer();
+ isRemote = false;
+ }
+
+ public PreCompiler(boolean remote) {
+ replacer = new ValueReplacer();
+ isRemote = remote;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see HashTreeTraverser#addNode(Object, HashTree)
+ */
+ public void addNode(Object node, HashTree subTree) {
if(isRemote && node instanceof ResultCollector)
{
try {
@@ -73,7 +73,7 @@
}
}
if (isRemote) {
- return;
+ return;
}
if(node instanceof TestElement)
{
@@ -83,36 +83,36 @@
log.error("invalid variables", e);
}
}
- if (node instanceof TestPlan) {
+ if (node instanceof TestPlan) {
((TestPlan)node).prepareForPreCompile(); //A hack to make user-defined variables in the testplan element more dynamic
Map args = ((TestPlan) node).getUserDefinedVariables();
- replacer.setUserDefinedVariables(args);
- JMeterVariables vars = new JMeterVariables();
- vars.putAll(args);
- JMeterContextService.getContext().setVariables(vars);
- }
+ replacer.setUserDefinedVariables(args);
+ JMeterVariables vars = new JMeterVariables();
+ vars.putAll(args);
+ JMeterContextService.getContext().setVariables(vars);
+ }
- if (node instanceof Arguments) {
+ if (node instanceof Arguments) {
((Arguments)node).setRunningVersion(true);
- Map args = ((Arguments) node).getArgumentsAsMap();
- replacer.addVariables(args);
- JMeterContextService.getContext().getVariables().putAll(args);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see HashTreeTraverser#subtractNode()
- */
- public void subtractNode() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see HashTreeTraverser#processPath()
- */
- public void processPath() {
- }
+ Map args = ((Arguments) node).getArgumentsAsMap();
+ replacer.addVariables(args);
+ JMeterContextService.getContext().getVariables().putAll(args);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see HashTreeTraverser#subtractNode()
+ */
+ public void subtractNode() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see HashTreeTraverser#processPath()
+ */
+ public void processPath() {
+ }
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngine.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.engine;
@@ -25,17 +25,17 @@
import org.apache.jorphan.collections.HashTree;
public interface RemoteJMeterEngine extends Remote {
- void configure(HashTree testTree) throws RemoteException;
+ void configure(HashTree testTree) throws RemoteException;
- void runTest() throws RemoteException, JMeterEngineException;
+ void runTest() throws RemoteException, JMeterEngineException;
- void stopTest() throws RemoteException;
+ void stopTest() throws RemoteException;
- void reset() throws RemoteException;
+ void reset() throws RemoteException;
- void setHost(String host) throws RemoteException;
+ void setHost(String host) throws RemoteException;
- void setProperties(Properties p) throws RemoteException;
+ void setProperties(Properties p) throws RemoteException;
- void exit() throws RemoteException;
+ void exit() throws RemoteException;
}
Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java Sun Jul 6 16:42:12 2008
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package org.apache.jmeter.engine;
@@ -35,108 +35,108 @@
* This is the JMeter server main code.
*/
public class RemoteJMeterEngineImpl extends java.rmi.server.UnicastRemoteObject implements RemoteJMeterEngine {
- private static final Logger log = LoggingManager.getLoggerForClass();
+ private static final Logger log = LoggingManager.getLoggerForClass();
- private JMeterEngine backingEngine;
+ private JMeterEngine backingEngine;
- private String hostName;
+ private String hostName;
- public static final int DEFAULT_RMI_PORT =
- JMeterUtils.getPropDefault("server.rmi.port", 1099); // $NON-NLS-1$
+ public static final int DEFAULT_RMI_PORT =
+ JMeterUtils.getPropDefault("server.rmi.port", 1099); // $NON-NLS-1$
- // Should we create our own copy of the RMI registry?
- private static final boolean createServer =
- JMeterUtils.getPropDefault("server.rmi.create", true); // $NON-NLS-1$
-
- public RemoteJMeterEngineImpl() throws RemoteException {
- init(DEFAULT_RMI_PORT);
- }
-
- public RemoteJMeterEngineImpl(int port) throws RemoteException {
- init(port == 0 ? DEFAULT_RMI_PORT : port);
- }
-
- private void init(int port) throws RemoteException {
- log.info("Starting backing engine on " + port);
- InetAddress localHost=null;
- try {
- localHost = InetAddress.getLocalHost();
- } catch (UnknownHostException e1) {
- throw new RemoteException("Cannot start. Unable to get local host IP address.");
- }
- log.info("IP address="+localHost.getHostAddress());
- hostName = localHost.getHostName();
- if (localHost.isLoopbackAddress()){
- throw new RemoteException("Cannot start. "+hostName+" is a loopback address.");
- }
- log.debug("This = " + this);
- if (createServer){
- log.info("Creating RMI registry (server.rmi.create=true)");
- try {
- LocateRegistry.createRegistry(port);
- } catch (RemoteException e){
- String msg="Problem creating registry: "+e;
- log.warn(msg);
- System.err.println(msg);
- System.err.println("Continuing...");
- }
- }
- try {
- Registry reg = LocateRegistry.getRegistry(port);
- log.info("Creating JMeter engine on host "+hostName);
- backingEngine = new StandardJMeterEngine(hostName);// see setHost()
- reg.rebind("JMeterEngine", this); // $NON-NLS-1$
- log.info("Bound to registry on port " + port);
- } catch (Exception ex) {
- log.error("rmiregistry needs to be running to start JMeter in server " + "mode\n\t" + ex.toString());
- // Throw an Exception to ensure caller knows ...
- throw new RemoteException("Cannot start. See server log file.");
- }
- }
-
- // TODO: is this really needed? The hostname is passed in when the engine is created
- public void setHost(String host) {
- hostName=host;
- log.info("received host: " + host);
- backingEngine.setHost(host);
- }
-
- /**
- * Adds a feature to the ThreadGroup attribute of the RemoteJMeterEngineImpl
- * object.
- *
- * @param testTree
- * the feature to be added to the ThreadGroup attribute
- */
- public void configure(HashTree testTree) throws RemoteException {
- log.info("received test tree");
- backingEngine.configure(testTree);
- }
-
- public void runTest() throws RemoteException, JMeterEngineException {
- log.info("running test");
- log.debug("This = " + this);
- long now=System.currentTimeMillis();
- System.out.println("Starting the test on host " + hostName + " @ "+new Date(now)+" ("+now+")");
- backingEngine.runTest();
- }
-
- public void reset() throws RemoteException {
- log.info("Reset");
- backingEngine.reset();
- }
-
- public void stopTest() throws RemoteException {
- log.info("Stopping test");
- backingEngine.stopTest();// TODO: askThreadsToStop() instead?
- }
-
- public void exit() throws RemoteException {
- log.info("Exitting");
- backingEngine.exit();
- }
-
- public void setProperties(Properties p) throws RemoteException {
- backingEngine.setProperties(p);
- }
+ // Should we create our own copy of the RMI registry?
+ private static final boolean createServer =
+ JMeterUtils.getPropDefault("server.rmi.create", true); // $NON-NLS-1$
+
+ public RemoteJMeterEngineImpl() throws RemoteException {
+ init(DEFAULT_RMI_PORT);
+ }
+
+ public RemoteJMeterEngineImpl(int port) throws RemoteException {
+ init(port == 0 ? DEFAULT_RMI_PORT : port);
+ }
+
+ private void init(int port) throws RemoteException {
+ log.info("Starting backing engine on " + port);
+ InetAddress localHost=null;
+ try {
+ localHost = InetAddress.getLocalHost();
+ } catch (UnknownHostException e1) {
+ throw new RemoteException("Cannot start. Unable to get local host IP address.");
+ }
+ log.info("IP address="+localHost.getHostAddress());
+ hostName = localHost.getHostName();
+ if (localHost.isLoopbackAddress()){
+ throw new RemoteException("Cannot start. "+hostName+" is a loopback address.");
+ }
+ log.debug("This = " + this);
+ if (createServer){
+ log.info("Creating RMI registry (server.rmi.create=true)");
+ try {
+ LocateRegistry.createRegistry(port);
+ } catch (RemoteException e){
+ String msg="Problem creating registry: "+e;
+ log.warn(msg);
+ System.err.println(msg);
+ System.err.println("Continuing...");
+ }
+ }
+ try {
+ Registry reg = LocateRegistry.getRegistry(port);
+ log.info("Creating JMeter engine on host "+hostName);
+ backingEngine = new StandardJMeterEngine(hostName);// see setHost()
+ reg.rebind("JMeterEngine", this); // $NON-NLS-1$
+ log.info("Bound to registry on port " + port);
+ } catch (Exception ex) {
+ log.error("rmiregistry needs to be running to start JMeter in server " + "mode\n\t" + ex.toString());
+ // Throw an Exception to ensure caller knows ...
+ throw new RemoteException("Cannot start. See server log file.");
+ }
+ }
+
+ // TODO: is this really needed? The hostname is passed in when the engine is created
+ public void setHost(String host) {
+ hostName=host;
+ log.info("received host: " + host);
+ backingEngine.setHost(host);
+ }
+
+ /**
+ * Adds a feature to the ThreadGroup attribute of the RemoteJMeterEngineImpl
+ * object.
+ *
+ * @param testTree
+ * the feature to be added to the ThreadGroup attribute
+ */
+ public void configure(HashTree testTree) throws RemoteException {
+ log.info("received test tree");
+ backingEngine.configure(testTree);
+ }
+
+ public void runTest() throws RemoteException, JMeterEngineException {
+ log.info("running test");
+ log.debug("This = " + this);
+ long now=System.currentTimeMillis();
+ System.out.println("Starting the test on host " + hostName + " @ "+new Date(now)+" ("+now+")");
+ backingEngine.runTest();
+ }
+
+ public void reset() throws RemoteException {
+ log.info("Reset");
+ backingEngine.reset();
+ }
+
+ public void stopTest() throws RemoteException {
+ log.info("Stopping test");
+ backingEngine.stopTest();// TODO: askThreadsToStop() instead?
+ }
+
+ public void exit() throws RemoteException {
+ log.info("Exitting");
+ backingEngine.exit();
+ }
+
+ public void setProperties(Properties p) throws RemoteException {
+ backingEngine.setProperties(p);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org