mstover1 2003/02/07 13:33:58
Modified: src/core/org/apache/jmeter/functions ValueReplacer.java
src/core/org/apache/jmeter/gui GuiPackage.java
src/core/org/apache/jmeter/gui/tree JMeterTreeListener.java
src/core/org/apache/jmeter/testelement TestPlan.java
src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui
ProxyControlGui.java
Log:
minor refactoring
Revision Changes Path
1.5 +18 -8
jakarta-jmeter/src/core/org/apache/jmeter/functions/ValueReplacer.java
Index: ValueReplacer.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/functions/ValueReplacer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ValueReplacer.java 15 Oct 2002 18:53:26 -0000 1.4
+++ ValueReplacer.java 7 Feb 2003 21:33:58 -0000 1.5
@@ -27,14 +27,16 @@
transient private static Logger log =
Hierarchy.getDefaultHierarchy().getLoggerFor(JMeterUtils.ELEMENTS);
CompoundFunction masterFunction = new CompoundFunction();
Map variables = new HashMap();
+ TestPlan tp;
public ValueReplacer()
{
}
- public ValueReplacer(Map variables)
+ public ValueReplacer(TestPlan tp)
{
- setUserDefinedVariables(variables);
+ this.tp = tp;
+ setUserDefinedVariables(tp.getUserDefinedVariables());
}
public void setUserDefinedVariables(Map variables)
@@ -81,6 +83,12 @@
}
return newValue;
}
+
+ public void addVariable(String name,String value)
+ {
+ tp.addParameter(name,value);
+ setUserDefinedVariables(tp.getUserDefinedVariables());
+ }
public Collection replaceValues(Collection values) throws
InvalidVariableException
{
@@ -187,7 +195,7 @@
public static class Test extends TestCase
{
- Map variables;
+ TestPlan variables;
public Test(String name)
{
@@ -196,16 +204,18 @@
public void setUp()
{
- variables = new HashMap();
- variables.put("server","jakarta.apache.org");
- variables.put("username","jack");
- variables.put("password","jacks_password");
- variables.put("regex",".*");
+ variables = new TestPlan();
+ variables.addParameter("server","jakarta.apache.org");
+ variables.addParameter("username","jack");
+ variables.addParameter("password","jacks_password");
+ variables.addParameter("regex",".*");
}
public void testReverseReplacement() throws Exception
{
ValueReplacer replacer = new ValueReplacer(variables);
+ assertTrue(variables.getUserDefinedVariables().containsKey("server"));
+ assertTrue(replacer.variables.containsKey("server"));
TestElement element = new TestPlan();
element.setProperty("domain","jakarta.apache.org");
List args = new LinkedList();
1.9 +219 -208 jakarta-jmeter/src/core/org/apache/jmeter/gui/GuiPackage.java
Index: GuiPackage.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/GuiPackage.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- GuiPackage.java 7 Feb 2003 00:36:25 -0000 1.8
+++ GuiPackage.java 7 Feb 2003 21:33:58 -0000 1.9
@@ -53,9 +53,13 @@
* <http://www.apache.org/>.
*/
package org.apache.jmeter.gui;
+import java.awt.Component;
+import java.awt.event.MouseEvent;
import java.util.HashMap;
import java.util.Map;
+import javax.swing.JPopupMenu;
+
import org.apache.jmeter.exceptions.IllegalUserActionException;
import org.apache.jmeter.functions.ValueReplacer;
import org.apache.jmeter.gui.tree.JMeterTreeListener;
@@ -82,220 +86,227 @@
*/
public class GuiPackage
{
- transient private static Logger log =
- Hierarchy.getDefaultHierarchy().getLoggerFor("jmeter.gui");
- private static GuiPackage guiPack;
- private boolean dirty = false;
- private Map nodesToGui = new HashMap();
- private Map guis = new HashMap();
- private JMeterTreeNode currentNode = null;
- /**
- * GuiPackage is a Singleton class.
- * @see java.lang.Object#Object()
- */
- private GuiPackage()
- {}
- private JMeterTreeModel treeModel;
- private org.apache.jmeter.gui.MainFrame mainFrame;
- private org.apache.jmeter.gui.tree.JMeterTreeListener treeListener;
- public JMeterGUIComponent getGui(TestElement node, String guiClass)
- {
- log.debug("Getting gui for "+ node);
- try
- {
- JMeterGUIComponent comp = (JMeterGUIComponent)
nodesToGui.get(node);
- log.debug("Gui retrieved = " + comp);
- if (comp == null)
- {
- comp = (JMeterGUIComponent) guis.get(guiClass);
- if (comp == null || comp instanceof UnsharedComponent)
- {
- comp = (JMeterGUIComponent)
Class.forName(guiClass).newInstance();
- if(!(comp instanceof UnsharedComponent))
- {
- guis.put(guiClass, comp);
- }
- }
- nodesToGui.put(node, comp);
- }
- return comp;
- }
- catch (Exception e)
- {
- log.error("Problem retrieving gui", e);
- return null;
- }
- }
-
- public void removeNode(TestElement node)
- {
- nodesToGui.remove(node);
- }
- /**
- * Convenience method for grabbing the gui for the current node
- */
- public JMeterGUIComponent getCurrentGui()
- {
- try
- {
- JMeterGUIComponent comp =
getGui(treeListener.getCurrentNode().createTestElement());
-
comp.configure(treeListener.getCurrentNode().createTestElement());
- return comp;
- }
- catch (Exception e)
- {
- log.error("Problem retrieving gui", e);
- return null;
- }
- }
- public TestElement createTestElement(String guiClass)
- {
- try
- {
- JMeterGUIComponent comp = (JMeterGUIComponent)
guis.get(guiClass);
- if (comp == null || comp instanceof UnsharedComponent)
- {
- comp = (JMeterGUIComponent)
Class.forName(guiClass).newInstance();
- guis.put(guiClass, comp);
- }
- TestElement node = ((JMeterGUIComponent)
Class.forName(guiClass).newInstance()).createTestElement();
- nodesToGui.put(node, comp);
- return node;
- }
- catch (Exception e)
- {
- log.error("Problem retrieving gui", e);
- return null;
- }
- }
- public JMeterGUIComponent getGui(TestElement node)
- {
- try
- {
- return getGui(node,
node.getPropertyAsString(TestElement.GUI_CLASS));
- }
- catch (Exception e)
- {
- log.error("Problem retrieving gui", e);
- return null;
- }
- }
-
+ transient private static Logger log =
Hierarchy.getDefaultHierarchy().getLoggerFor("jmeter.gui");
+ private static GuiPackage guiPack;
+ private boolean dirty = false;
+ private Map nodesToGui = new HashMap();
+ private Map guis = new HashMap();
+ private JMeterTreeNode currentNode = null;
+ /**
+ * GuiPackage is a Singleton class.
+ * @see java.lang.Object#Object()
+ */
+ private GuiPackage()
+ {}
+ private JMeterTreeModel treeModel;
+ private org.apache.jmeter.gui.MainFrame mainFrame;
+ private org.apache.jmeter.gui.tree.JMeterTreeListener treeListener;
+ public JMeterGUIComponent getGui(TestElement node, String guiClass)
+ {
+ log.debug("Getting gui for " + node);
+ try
+ {
+ JMeterGUIComponent comp = (JMeterGUIComponent) nodesToGui.get(node);
+ log.debug("Gui retrieved = " + comp);
+ if (comp == null)
+ {
+ comp = (JMeterGUIComponent) guis.get(guiClass);
+ if (comp == null || comp instanceof UnsharedComponent)
+ {
+ comp = (JMeterGUIComponent)
Class.forName(guiClass).newInstance();
+ if (!(comp instanceof UnsharedComponent))
+ {
+ guis.put(guiClass, comp);
+ }
+ }
+ nodesToGui.put(node, comp);
+ }
+ return comp;
+ }
+ catch (Exception e)
+ {
+ log.error("Problem retrieving gui", e);
+ return null;
+ }
+ }
+
+ public void removeNode(TestElement node)
+ {
+ nodesToGui.remove(node);
+ }
+ /**
+ * Convenience method for grabbing the gui for the current node
+ */
+ public JMeterGUIComponent getCurrentGui()
+ {
+ try
+ {
+ JMeterGUIComponent comp =
getGui(treeListener.getCurrentNode().createTestElement());
+ comp.configure(treeListener.getCurrentNode().createTestElement());
+ return comp;
+ }
+ catch (Exception e)
+ {
+ log.error("Problem retrieving gui", e);
+ return null;
+ }
+ }
+ public TestElement createTestElement(String guiClass)
+ {
+ try
+ {
+ JMeterGUIComponent comp = (JMeterGUIComponent) guis.get(guiClass);
+ if (comp == null || comp instanceof UnsharedComponent)
+ {
+ comp = (JMeterGUIComponent) Class.forName(guiClass).newInstance();
+ guis.put(guiClass, comp);
+ }
+ TestElement node = ((JMeterGUIComponent)
Class.forName(guiClass).newInstance()).createTestElement();
+ nodesToGui.put(node, comp);
+ return node;
+ }
+ catch (Exception e)
+ {
+ log.error("Problem retrieving gui", e);
+ return null;
+ }
+ }
+ public JMeterGUIComponent getGui(TestElement node)
+ {
+ try
+ {
+ return getGui(node, node.getPropertyAsString(TestElement.GUI_CLASS));
+ }
+ catch (Exception e)
+ {
+ log.error("Problem retrieving gui", e);
+ return null;
+ }
+ }
+
public void updateCurrentGui()
{
- if(currentNode != null)
+ if (currentNode != null)
{
JMeterGUIComponent comp = getGui(currentNode.createTestElement());
comp.configure(currentNode.createTestElement());
}
}
+
+ public void updateCurrentNode()
+ {
+ try
+ {
+ if (currentNode != null)
+ {
+ log.debug("Updating current node " +
currentNode.createTestElement());
+ JMeterGUIComponent comp = getGui(currentNode.createTestElement());
+ TestElement el = currentNode.createTestElement();
+ nodesToGui.remove(el);
+ currentNode.setUserObject(comp.createTestElement());
+ el = currentNode.createTestElement();
+ nodesToGui.put(el, comp);
+ }
+ currentNode = treeListener.getCurrentNode();
+ }
+ catch (Exception e)
+ {
+ log.error("Problem retrieving gui", e);
+ }
+ }
+ /**
+ * When GuiPackage is requested for the first time, it should be given handles
to
+ * JMeter's Tree Listener and TreeModel.
+ * @param listener The TreeListener for JMeter's test tree.
+ * @param treeModel The model for JMeter's test tree.
+ * @return GuiPackage
+ */
+ public static GuiPackage getInstance(JMeterTreeListener listener,
JMeterTreeModel treeModel)
+ {
+ if (guiPack == null)
+ {
+ guiPack = new GuiPackage();
+ guiPack.setTreeListener(listener);
+ guiPack.setTreeModel(treeModel);
+ }
+ return guiPack;
+ }
+ /**
+ * The dirty property is a flag that indicates whether there are parts of
JMeter's test tree
+ * that the user has not saved since last modification. Various (@link Command
actions) set
+ * this property when components are modified/created/saved.
+ * @param d
+ */
+ public void setDirty(boolean d)
+ {
+ dirty = d;
+ }
+ /**
+ * Retrieves the state of the 'dirty' property, a flag that indicates if there
are test
+ * tree components that have been modified since they were last saved.
+ * @return boolean
+ */
+ public boolean isDirty()
+ {
+ return dirty;
+ }
+ public boolean addSubTree(HashTree subTree) throws IllegalUserActionException
+ {
+ return treeModel.addSubTree(subTree, treeListener.getCurrentNode());
+ }
+ public HashTree getCurrentSubTree()
+ {
+ return treeModel.getCurrentSubTree(treeListener.getCurrentNode());
+ }
+ public static GuiPackage getInstance()
+ {
+ return guiPack;
+ }
+ public JMeterTreeModel getTreeModel()
+ {
+ return treeModel;
+ }
+ public ValueReplacer getReplacer()
+ {
+ ValueReplacer replacer =
+ new ValueReplacer((TestPlan) ((JMeterGUIComponent)
getTreeModel().getTestPlan().getArray()[0]).createTestElement());
+ return replacer;
+ }
+ public void setTreeModel(JMeterTreeModel newTreeModel)
+ {
+ treeModel = newTreeModel;
+ }
+ public void setMainFrame(org.apache.jmeter.gui.MainFrame newMainFrame)
+ {
+ mainFrame = newMainFrame;
+ }
+ public org.apache.jmeter.gui.MainFrame getMainFrame()
+ {
+ return mainFrame;
+ }
+ public void setTreeListener(org.apache.jmeter.gui.tree.JMeterTreeListener
newTreeListener)
+ {
+ treeListener = newTreeListener;
+ }
+ public org.apache.jmeter.gui.tree.JMeterTreeListener getTreeListener()
+ {
+ return treeListener;
+ }
- public void updateCurrentNode()
- {
- try
- {
- if(currentNode != null)
- {
- log.debug("Updating current node " +
currentNode.createTestElement());
- JMeterGUIComponent comp =
getGui(currentNode.createTestElement());
- TestElement el = currentNode.createTestElement();
- nodesToGui.remove(el);
- currentNode.setUserObject(comp.createTestElement());
- el = currentNode.createTestElement();
- nodesToGui.put(el,comp);
- }
- currentNode = treeListener.getCurrentNode();
- }
- catch (Exception e)
- {
- log.error("Problem retrieving gui", e);
- }
- }
- /**
- * When GuiPackage is requested for the first time, it should be given handles
to
- * JMeter's Tree Listener and TreeModel.
- * @param listener The TreeListener for JMeter's test tree.
- * @param treeModel The model for JMeter's test tree.
- * @return GuiPackage
- */
- public static GuiPackage getInstance(
- JMeterTreeListener listener,
- JMeterTreeModel treeModel)
- {
- if (guiPack == null)
- {
- guiPack = new GuiPackage();
- guiPack.setTreeListener(listener);
- guiPack.setTreeModel(treeModel);
- }
- return guiPack;
- }
- /**
- * The dirty property is a flag that indicates whether there are parts of
JMeter's test tree
- * that the user has not saved since last modification. Various (@link
Command actions) set
- * this property when components are modified/created/saved.
- * @param d
- */
- public void setDirty(boolean d)
- {
- dirty = d;
- }
- /**
- * Retrieves the state of the 'dirty' property, a flag that indicates if there
are test
- * tree components that have been modified since they were last saved.
- * @return boolean
- */
- public boolean isDirty()
- {
- return dirty;
- }
- public boolean addSubTree(HashTree subTree)
- throws IllegalUserActionException
- {
- return treeModel.addSubTree(subTree, treeListener.getCurrentNode());
- }
- public HashTree getCurrentSubTree()
- {
- return treeModel.getCurrentSubTree(treeListener.getCurrentNode());
- }
- public static GuiPackage getInstance()
- {
- return guiPack;
- }
- public JMeterTreeModel getTreeModel()
- {
- return treeModel;
- }
- public ValueReplacer getReplacer()
- {
- ValueReplacer replacer =
- new ValueReplacer(
- ((TestPlan) ((JMeterGUIComponent) getTreeModel()
- .getTestPlan()
- .getArray()[0])
- .createTestElement())
- .getUserDefinedVariables());
- return replacer;
- }
- public void setTreeModel(JMeterTreeModel newTreeModel)
- {
- treeModel = newTreeModel;
- }
- public void setMainFrame(org.apache.jmeter.gui.MainFrame newMainFrame)
- {
- mainFrame = newMainFrame;
- }
- public org.apache.jmeter.gui.MainFrame getMainFrame()
- {
- return mainFrame;
- }
- public void setTreeListener(
- org.apache.jmeter.gui.tree.JMeterTreeListener newTreeListener)
- {
- treeListener = newTreeListener;
- }
- public org.apache.jmeter.gui.tree.JMeterTreeListener getTreeListener()
- {
- return treeListener;
- }
+ public void displayPopUp(MouseEvent e,JPopupMenu popup)
+ {
+ displayPopUp((Component) e.getSource(),e,popup);
+ }
+
+ public void displayPopUp(Component invoker,MouseEvent e, JPopupMenu popup)
+ {
+ if (popup != null)
+ {
+ log.debug("Showing pop up for " + invoker + " at x,y = "+
e.getX()+","+e.getY());
+ popup.pack();
+ popup.show(invoker, e.getX(), e.getY());
+ popup.setVisible(true);
+ popup.requestFocus();
+ }
+ }
}
1.7 +3 -1
jakarta-jmeter/src/core/org/apache/jmeter/gui/tree/JMeterTreeListener.java
Index: JMeterTreeListener.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/tree/JMeterTreeListener.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JMeterTreeListener.java 3 Feb 2003 16:08:35 -0000 1.6
+++ JMeterTreeListener.java 7 Feb 2003 21:33:58 -0000 1.7
@@ -359,6 +359,7 @@
}
if(getCurrentNode() instanceof JMeterGUIComponent)
{
+ log.debug("About to display pop-up");
displayPopUp(e);
}
}
@@ -450,11 +451,12 @@
private void displayPopUp(MouseEvent e)
{
JPopupMenu pop =
((JMeterGUIComponent)getCurrentNode()).createPopupMenu();
- displayPopUp(e,pop);
+ GuiPackage.getInstance().displayPopUp(e,pop);
}
private void displayPopUp(MouseEvent e,JPopupMenu popup)
{
+ log.warn("Shouldn't be here");
if(popup != null)
{
popup.pack();
1.3 +155 -149
jakarta-jmeter/src/core/org/apache/jmeter/testelement/TestPlan.java
Index: TestPlan.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/testelement/TestPlan.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestPlan.java 5 Feb 2003 05:12:09 -0000 1.2
+++ TestPlan.java 7 Feb 2003 21:33:58 -0000 1.3
@@ -21,154 +21,160 @@
public class TestPlan extends AbstractTestElement implements Serializable
{
- /****************************************
- * !ToDo (Field description)
- ***************************************/
- public final static String THREAD_GROUPS = "TestPlan.thread_groups";
- public final static String FUNCTIONAL_MODE = "TestPlan.functional_mode";
- public final static String USER_DEFINED_VARIABLES =
"TestPlan.user_defined_variables";
-
- private List threadGroups = new LinkedList();
- private List configs = new LinkedList();
- private static List itemsCanAdd = new LinkedList();
- private static TestPlan plan;
- private Map userDefinedVariables = new HashMap();
-
- static
- {
- // WARNING! This String value must be identical to the String value
returned
- // in org.apache.jmeter.threads.ThreadGroup.getClassLabel() method.
- // If it's not you will not be able to add a Thread Group element to a
Test Plan.
- itemsCanAdd.add(JMeterUtils.getResString("threadgroup"));
- }
-
- /****************************************
- * !ToDo (Constructor description)
- ***************************************/
- public TestPlan()
- {
- this("Test Plan");
- setFunctionalMode(false);
- }
-
- public boolean isFunctionalMode()
- {
- return getPropertyAsBoolean(FUNCTIONAL_MODE);
- }
-
- public void setUserDefinedVariables(Arguments vars)
- {
- setProperty(USER_DEFINED_VARIABLES,vars);
- }
-
- public Map getUserDefinedVariables()
- {
- Arguments args = (Arguments)getProperty(USER_DEFINED_VARIABLES);
- if(args != null)
- {
- return args.getArgumentsAsMap();
- }
- return new HashMap();
- }
-
- public void setFunctionalMode(boolean funcMode)
- {
- setProperty(FUNCTIONAL_MODE,new Boolean(funcMode));
- }
-
- /****************************************
- * !ToDo (Constructor description)
- *
- *@param name !ToDo (Parameter description)
- ***************************************/
- public TestPlan(String name)
- {
- setName(name);
- setProperty(THREAD_GROUPS, threadGroups);
- }
-
- public void addParameter(String name,String value)
- {
- userDefinedVariables.put(name,value);
- }
-
- /****************************************
- * Description of the Method
- *
- *@param name Description of Parameter
- *@return Description of the Returned Value
- ***************************************/
- public static TestPlan createTestPlan(String name)
- {
- if(plan == null)
- {
- if(name == null)
- {
- plan = new TestPlan();
- }
- else
- {
- plan = new TestPlan(name);
- }
-
plan.setProperty(TestElement.GUI_CLASS,"org.apache.jmeter.control.gui.TestPlanGui");
- }
- return plan;
- }
-
- /****************************************
- * !ToDo
- *
- *@param tg !ToDo
- ***************************************/
- public void addTestElement(TestElement tg)
- {
+ /****************************************
+ * !ToDo (Field description)
+ ***************************************/
+ public final static String THREAD_GROUPS = "TestPlan.thread_groups";
+ public final static String FUNCTIONAL_MODE = "TestPlan.functional_mode";
+ public final static String USER_DEFINED_VARIABLES =
"TestPlan.user_defined_variables";
+
+ private List threadGroups = new LinkedList();
+ private List configs = new LinkedList();
+ private static List itemsCanAdd = new LinkedList();
+ private static TestPlan plan;
+ private Map userDefinedVariables = new HashMap();
+
+ static {
+ // WARNING! This String value must be identical to the String value returned
+ // in org.apache.jmeter.threads.ThreadGroup.getClassLabel() method.
+ // If it's not you will not be able to add a Thread Group element to a Test
Plan.
+ itemsCanAdd.add(JMeterUtils.getResString("threadgroup"));
+ }
+
+ /****************************************
+ * !ToDo (Constructor description)
+ ***************************************/
+ public TestPlan()
+ {
+ this("Test Plan");
+ setFunctionalMode(false);
+ }
+
+ public boolean isFunctionalMode()
+ {
+ return getPropertyAsBoolean(FUNCTIONAL_MODE);
+ }
+
+ public void setUserDefinedVariables(Arguments vars)
+ {
+ setProperty(USER_DEFINED_VARIABLES, vars);
+ }
+
+ public Map getUserDefinedVariables()
+ {
+ Arguments args = getVariables();
+ return args.getArgumentsAsMap();
+ }
+
+ private Arguments getVariables()
+ {
+ Arguments args = (Arguments) getProperty(USER_DEFINED_VARIABLES);
+ if (args == null)
+ {
+ args = new Arguments();
+ setUserDefinedVariables(args);
+ }
+ return args;
+ }
+
+ public void setFunctionalMode(boolean funcMode)
+ {
+ setProperty(FUNCTIONAL_MODE, new Boolean(funcMode));
+ }
+
+ /****************************************
+ * !ToDo (Constructor description)
+ *
+ *@param name !ToDo (Parameter description)
+ ***************************************/
+ public TestPlan(String name)
+ {
+ setName(name);
+ setProperty(THREAD_GROUPS, threadGroups);
+ }
+
+ public void addParameter(String name, String value)
+ {
+ getVariables().addArgument(name, value);
+ }
+
+ /****************************************
+ * Description of the Method
+ *
+ *@param name Description of Parameter
+ *@return Description of the Returned Value
+ ***************************************/
+ public static TestPlan createTestPlan(String name)
+ {
+ if (plan == null)
+ {
+ if (name == null)
+ {
+ plan = new TestPlan();
+ }
+ else
+ {
+ plan = new TestPlan(name);
+ }
+ plan.setProperty(TestElement.GUI_CLASS,
"org.apache.jmeter.control.gui.TestPlanGui");
+ }
+ return plan;
+ }
+
+ /****************************************
+ * !ToDo
+ *
+ *@param tg !ToDo
+ ***************************************/
+ public void addTestElement(TestElement tg)
+ {
super.addTestElement(tg);
- if(tg instanceof ThreadGroup)
- {
- addThreadGroup((ThreadGroup)tg);
- }
- }
-
- /****************************************
- * !ToDo
- *
- *@param child !ToDo
- ***************************************/
- public void addJMeterComponent(TestElement child)
- {
- if(child instanceof ThreadGroup)
- {
- addThreadGroup((ThreadGroup)child);
- }
- }
-
- /****************************************
- * Gets the ThreadGroups attribute of the TestPlan object
- *
- *@return The ThreadGroups value
- ***************************************/
- public Collection getThreadGroups()
- {
- return threadGroups;
- }
-
- /****************************************
- * Adds a feature to the ConfigElement attribute of the TestPlan object
- *
- *@param c The feature to be added to the ConfigElement attribute
- ***************************************/
- public void addConfigElement(ConfigElement c)
- {
- configs.add(c);
- }
-
- /****************************************
- * Adds a feature to the ThreadGroup attribute of the TestPlan object
- *
- *@param group The feature to be added to the ThreadGroup attribute
- ***************************************/
- public void addThreadGroup(ThreadGroup group)
- {
- threadGroups.add(group);
- }
+ if (tg instanceof ThreadGroup)
+ {
+ addThreadGroup((ThreadGroup) tg);
+ }
+ }
+
+ /****************************************
+ * !ToDo
+ *
+ *@param child !ToDo
+ ***************************************/
+ public void addJMeterComponent(TestElement child)
+ {
+ if (child instanceof ThreadGroup)
+ {
+ addThreadGroup((ThreadGroup) child);
+ }
+ }
+
+ /****************************************
+ * Gets the ThreadGroups attribute of the TestPlan object
+ *
+ *@return The ThreadGroups value
+ ***************************************/
+ public Collection getThreadGroups()
+ {
+ return threadGroups;
+ }
+
+ /****************************************
+ * Adds a feature to the ConfigElement attribute of the TestPlan object
+ *
+ *@param c The feature to be added to the ConfigElement attribute
+ ***************************************/
+ public void addConfigElement(ConfigElement c)
+ {
+ configs.add(c);
+ }
+
+ /****************************************
+ * Adds a feature to the ThreadGroup attribute of the TestPlan object
+ *
+ *@param group The feature to be added to the ThreadGroup attribute
+ ***************************************/
+ public void addThreadGroup(ThreadGroup group)
+ {
+ threadGroups.add(group);
+ }
}
1.8 +10 -4
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
Index: ProxyControlGui.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ProxyControlGui.java 7 Feb 2003 00:36:25 -0000 1.7
+++ ProxyControlGui.java 7 Feb 2003 21:33:58 -0000 1.8
@@ -152,9 +152,7 @@
{
if (model == null)
{
- model = new ProxyControl();
- model.setProperty(TestElement.GUI_CLASS, this.getClass().getName());
- model.setProperty(TestElement.TEST_CLASS, model.getClass().getName());
+ model = makeProxyControl();
}
log.debug("creating/configuring model = " + model);
model.setProperty(TestElement.NAME, getName());
@@ -162,6 +160,14 @@
setIncludeListInProxyControl(model);
setExcludeListInProxyControl(model);
return model;
+ }
+
+ protected ProxyControl makeProxyControl()
+ {
+ ProxyControl local = new ProxyControl();
+ local.setProperty(TestElement.GUI_CLASS, this.getClass().getName());
+ local.setProperty(TestElement.TEST_CLASS, local.getClass().getName());
+ return local;
}
protected void setIncludeListInProxyControl(ProxyControl element)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]