jsalvata 2003/12/16 18:58:58
Modified: xdocs/usermanual best-practices.xml component_reference.xml
src/protocol/http/org/apache/jmeter/protocol/http/proxy
ProxyControl.java
Log:
Tremendous shuffling of the ProxyControl to improve
processing of default values and user-defined variables.
Hopefully also made the code a little bit cleaner... or not :-)
Revision Changes Path
1.7 +23 -7 jakarta-jmeter/xdocs/usermanual/best-practices.xml
Index: best-practices.xml
===================================================================
RCS file: /home/cvs/jakarta-jmeter/xdocs/usermanual/best-practices.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- best-practices.xml 20 Jun 2003 14:15:36 -0000 1.6
+++ best-practices.xml 17 Dec 2003 02:58:58 -0000 1.7
@@ -32,7 +32,7 @@
<section name="11.4 Using the Proxy Server" anchor="proxy_server">
<p>Refer to <complink name="HTTP Proxy Server"/> for details on setting up the proxy
-server. The most important thing to do is filter out all requests you aren't
+server. The most important thing to do is filter out all requests you aren't
interested in. For instance, there's no point in recording image requests (JMeter
can
be instructed to download all images on a page - see <complink name="HTTP
Request"/>).
These will just clutter your test plan. Most likely, there is an extension all
your files
@@ -43,16 +43,32 @@
also have to exclude stylesheets, javascript files, and other included files. Test
out your settings to verify you are recording what you want, and then erase and
start
fresh.</p>
-<p>The Proxy Server expects to find a ThreadGroup element with a Recording
Controller under it where it will record HTTP Requests to. This conveniently packages
all your samples under one
-controller, which can be given a name that describes the test case.</p>
+<!--TODO: most uses for include/exclude are now
+covered by the Grouping features. include/exclude may still be useful to filter
hosts out, so
+that regular browsing with the proxy enabled and the browser configured won't fill
your test
+plan with crap. Think about other uses. -->
+<p>The Proxy Server expects to find a ThreadGroup element with a Recording
Controller
+under it where it will record HTTP Requests to. This conveniently packages all
your samples under one
+controller, which can be given a name that describes the test case.</p><!--TODO: is
this best practice? I don't think so!-->
<p>Now, go through the steps of a Test Case. If you have no pre-defined test
cases, use
JMeter to record your actions to define your test cases. Once you have finished a
definite series of steps, save the entire test case in an appropriately named file.
Then, wipe
clean and start a new test case. By doing this, you can quickly record a large
number of
-test case "rough drafts".</p>
+test case "rough drafts".</p><!--TODO: no need to wipe out now - you can create a
new controller and
+resume recording into it-->
<p>One of the most useful features of the Proxy Server is that you can abstract out
-certain common elements from the recorded samples. By defining some <a
href="functions.html">user-defined variables</a> at the Test Plan level, you can have
JMeter automatically replace values in you recorded samples. For instance, if you are
testing an app on server "xxx.yyy.com", then you can define a variable called "server"
with the value of "xxx.yyy.com", and anyplace that value is found in your recorded
samples will be replaced with "${server}".</p>
-
+certain common elements from the recorded samples. By defining some
+<a href="functions.html">user-defined variables</a> at the Test Plan level or in
+<complink name="User Defined Variables"/> elements, you can have JMeter
automatically
+replace values in you recorded samples. For instance, if you are testing an app on
+server "xxx.yyy.com", then you can define a variable called "server" with the value
of
+"xxx.yyy.com", and anyplace that value is found in your recorded samples will be
replaced
+with "${server}".</p><!--TODO: Describe how to use this to record against one
server[name]
+and run against another. Actually, this particular example may be beter for the
HTTP Request Defaults...
+a good similar example for the variables is http vs. https.-->
+<!--TODO: Hey! We need to mention that https is not supported and how to work
around that!-->
+<!--SUMMARY of all TODO's above: we need some actual usage to identify best
practices
+with this new features.-->
</section>
</body>
1.67 +20 -3 jakarta-jmeter/xdocs/usermanual/component_reference.xml
Index: component_reference.xml
===================================================================
RCS file: /home/cvs/jakarta-jmeter/xdocs/usermanual/component_reference.xml,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- component_reference.xml 15 Dec 2003 17:28:55 -0000 1.66
+++ component_reference.xml 17 Dec 2003 02:58:58 -0000 1.67
@@ -1035,14 +1035,31 @@
the port # is from the Proxy Control Panel shown above.</note>
<b>Where Do Samples Get Recorded?</b>
-<p>JMeter places the recorded samples in the Target Controller you choose. If you
choose the default option "Use Recording Controller", they will be stored in a
Recording Controller found under a Thread Group (so be sure to add a ThreadGroup and
then a Recording Controller before you start recording). Also, if you have an HTTP
Request Defaults element directly within the controller where samples are being
stored, then the recorded samples will have empty fields for the default values you
specified. Additionally, you can specify user-defined values that will replaced in
your samples as they are recorded. See <a
href="best-practices.html#proxy_server">Best Practices with the Proxy Server</a> for
more info.</p>
+<p>JMeter places the recorded samples in the Target Controller you choose. If you
choose the default option
+"Use Recording Controller", they will be stored in the first Recording Controller
found in the test object tree (so be
+sure to add a Recording Controller before you start recording).</p>
+
+<p>If the HTTP Proxy Server finds enabled <complink name="HTTP Request Defaults"/>
directly within the
+controller where samples are being stored, or directly within any of its parent
controllers, the recorded samples
+will have empty fields for the default values you specified. You may further
control this behaviour by placing an
+HTTP Request Defaults element directly within the HTTP Proxy Server, whose
non-blank values will override
+those in the other HTTP Request Defaults. See <a
href="best-practices.html#proxy_server"> Best
+Practices with the Proxy Server</a> for more info.</p>
+
+<p>Similarly, if the HTTP Proxy Server finds <complink name="User Defined
Variables"/> directly within the
+controller where samples are being stored, or directly within any of its parent
controllers, the recorded samples
+will have any occurences of the values of those variables replaced by the
corresponding variable. Again, you can
+place User Defined Variables directly within the HTTP Proxy Server to override the
values to be replaced. See
+<a href="best-practices.html#proxy_server"> Best Practices with the Proxy
Server</a> for more info.</p>
<p>When you are done recording your test samples, stop the proxy server (hit the
"stop" button). Remember to reset
your browser's proxy settings. Now, you may want to sort and re-order the test
script, add timers, listeners, a
cookie manager, etc.</p>
<b>How can I record the server's responses too?</b>
-<p>The HTTP Proxy Server actually performs a sampling to obtain the server's
response, and will notify any listeners directly inside the controller where the
samples are being stored. So you just need to place a View Results Tree listener there
to get the responses recorded.</p>
+<p>The HTTP Proxy Server actually performs a sampling to obtain the server's
response, and will notify any
+listeners directly inside the controller where the samples are being stored. So you
just need to place a
+<complink name="View Results Tree"/> listener there to get the responses
recorded.</p>
</component>
1.47 +266 -152
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Index: ProxyControl.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- ProxyControl.java 5 Dec 2003 19:38:54 -0000 1.46
+++ ProxyControl.java 17 Dec 2003 02:58:58 -0000 1.47
@@ -63,12 +63,14 @@
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
-
import junit.framework.TestCase;
import org.apache.jmeter.assertions.ResponseAssertion;
+import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.config.ConfigElement;
+import org.apache.jmeter.config.ConfigTestElement;
import org.apache.jmeter.control.GenericController;
import org.apache.jmeter.engine.util.ValueReplacer;
import org.apache.jmeter.exceptions.IllegalUserActionException;
@@ -76,8 +78,6 @@
import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.gui.tree.JMeterTreeModel;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
-import org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui;
-import org.apache.jmeter.protocol.http.config.gui.UrlConfigGui;
import org.apache.jmeter.protocol.http.control.HeaderManager;
import org.apache.jmeter.protocol.http.control.RecordingController;
import org.apache.jmeter.protocol.http.sampler.HTTPSampler;
@@ -87,9 +87,11 @@
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestListener;
import org.apache.jmeter.testelement.TestPlan;
+import org.apache.jmeter.testelement.WorkBench;
import org.apache.jmeter.testelement.property.BooleanProperty;
import org.apache.jmeter.testelement.property.CollectionProperty;
import org.apache.jmeter.testelement.property.IntegerProperty;
+import org.apache.jmeter.testelement.property.JMeterProperty;
import org.apache.jmeter.testelement.property.PropertyIterator;
import org.apache.jmeter.threads.ThreadGroup;
import org.apache.jmeter.timers.Timer;
@@ -291,7 +293,21 @@
{
if (filterUrl(sampler))
{
- placeConfigElement(sampler, subConfigs);
+ JMeterTreeNode myTarget= findTargetControllerNode();
+ Collection defaultConfigurations=
+ findApplicableElements(myTarget, ConfigTestElement.class, false);
+ Collection userDefinedVariables =
+ findApplicableElements(myTarget, Arguments.class, true);
+
+ removeValuesFromSampler(sampler, defaultConfigurations);
+ replaceValues(sampler, subConfigs, userDefinedVariables);
+ sampler.setUseKeepAlive(useKeepAlive);
+ sampler.setProperty(
+ TestElement.GUI_CLASS,
+ "org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui");
+
+ placeSampler(sampler, subConfigs, myTarget);
+
notifySampleListeners(new SampleEvent(result,sampler.getName()));
}
}
@@ -312,7 +328,7 @@
}
}
- protected boolean filterUrl(HTTPSampler sampler)
+ private boolean filterUrl(HTTPSampler sampler)
{
String domain = sampler.getDomain();
if (domain == null || domain.length() == 0)
@@ -348,14 +364,12 @@
private void addAssertion(JMeterTreeModel model,JMeterTreeNode node)
throws IllegalUserActionException
{
- if (addAssertions){
- ResponseAssertion ra = new ResponseAssertion();
- ra.setProperty(TestElement.GUI_CLASS,
- "org.apache.jmeter.assertions.gui.AssertionGui");
- ra.setName("Check response");
- ra.setTestField(ResponseAssertion.RESPONSE_DATA);
- model.addComponent(ra,node);
- }
+ ResponseAssertion ra = new ResponseAssertion();
+ ra.setProperty(TestElement.GUI_CLASS,
+ "org.apache.jmeter.assertions.gui.AssertionGui");
+ ra.setName("Check response");
+ ra.setTestField(ResponseAssertion.RESPONSE_DATA);
+ model.addComponent(ra,node);
}
/*
@@ -441,187 +455,268 @@
}
}
}
-
- private void placeConfigElement(
- HTTPSampler sampler,
- TestElement[] subConfigs)
+
+ /**
+ * Finds the first enabled node of a given type in the tree.
+ *
+ * @param type class of the node to be found
+ *
+ * @return the first node of the given type in the test component tree,
+ * or <code>null</code> if none was found.
+ */
+ private JMeterTreeNode findFirstNodeOfType(Class type)
{
- JMeterTreeNode myTarget= target;
- TestElement urlConfig = null;
JMeterTreeModel treeModel = GuiPackage.getInstance().getTreeModel();
- if (myTarget == null)
- {
- List nodes = treeModel.getNodesOfType(RecordingController.class);
- Iterator iter= nodes.iterator();
- while (iter.hasNext()) {
- JMeterTreeNode node= (JMeterTreeNode) iter.next();
- if (node.isEnabled()) {
- myTarget= node;
- break;
- }
- }
- }
- if (myTarget == null)
- {
- List nodes = treeModel.getNodesOfType(ThreadGroup.class);
- Iterator iter = nodes.iterator();
- while (iter.hasNext()) {
- JMeterTreeNode node= (JMeterTreeNode) iter.next();
- if (node.isEnabled()) {
- myTarget= node;
- break;
- }
+ List nodes = treeModel.getNodesOfType(type);
+ Iterator iter= nodes.iterator();
+ while (iter.hasNext()) {
+ JMeterTreeNode node= (JMeterTreeNode) iter.next();
+ if (node.isEnabled()) {
+ return node;
}
}
+ return null;
+ }
- Enumeration enum = myTarget.children();
- String guiClassName = null;
+ /**
+ * Finds the controller where samplers have to be stored, that is:
+ * <ul>
+ * <li>The controller specified by the <code>target</code> property.
+ * <li>If none was specified, the first RecordingController in the tree.
+ * <li>If none is found, the first ThreadGroup in the tree.
+ * <li>If none is found, the Workspace.
+ * </ul>
+ *
+ * @return the tree node for the controller where the proxy must store
+ * the generated samplers.
+ */
+ private JMeterTreeNode findTargetControllerNode()
+ {
+ JMeterTreeNode myTarget= getTarget();
+ if (myTarget != null) return myTarget;
+ myTarget= findFirstNodeOfType(RecordingController.class);
+ if (myTarget != null) return myTarget;
+ myTarget= findFirstNodeOfType(ThreadGroup.class);
+ if (myTarget != null) return myTarget;
+ myTarget= findFirstNodeOfType(WorkBench.class);
+ if (myTarget != null) return myTarget;
+ log.error("Program error: proxy recording target not found.");
+ return null;
+ }
+
+ /**
+ * Finds all configuration objects of the given class applicable to
+ * the recorded samplers, that is:
+ * <ul>
+ * <li>All such elements directly within the HTTP Proxy Server (these
+ * have the highest priority).
+ * <li>All such elements directly within the target controller (higher
+ * priority) or directly within any containing controller (lower
+ * priority), including the Test Plan itself (lowest priority).
+ * </ul>
+ *
+ * @param myTarget tree node for the recording target controller.
+ * @param myClass Class of the elements to be found.
+ * @param ascending true if returned elements should be ordered in ascending
+ * priority, false if they should be in descending priority.
+ *
+ * @return a collection of applicable objects of the given class.
+ */
+ private Collection findApplicableElements(
+ JMeterTreeNode myTarget,
+ Class myClass,
+ boolean ascending)
+ {
+ JMeterTreeModel treeModel = GuiPackage.getInstance().getTreeModel();
+ LinkedList elements= new LinkedList();
+
+ // Look for elements directly within the HTTP proxy:
+ Enumeration enum = treeModel.getNodeOf(this).children();
while (enum.hasMoreElements())
- {
+ {
JMeterTreeNode subNode =
(JMeterTreeNode) enum.nextElement();
- TestElement sample =
- (TestElement) subNode.createTestElement();
- guiClassName =
- sample.getPropertyAsString(TestElement.GUI_CLASS);
- if (guiClassName.equals(UrlConfigGui.class.getName())
- || guiClassName.equals(HttpDefaultsGui.class.getName()))
+ if (subNode.isEnabled())
{
- urlConfig = sample;
- break;
+ TestElement element= (TestElement)subNode.getUserObject();
+ if(myClass.isInstance(element))
+ {
+ if (ascending) elements.addFirst(element);
+ else elements.add(element);
+ }
}
}
- if (areMatched(sampler, urlConfig))
+ // Look for arguments elements in the target controller or higher up:
+ for (JMeterTreeNode controller= myTarget;
+ controller != null;
+ controller= (JMeterTreeNode)controller.getParent())
{
- removeValuesFromSampler(sampler, urlConfig);
- replaceValues(sampler,subConfigs);
- sampler.setUseKeepAlive(useKeepAlive);
- sampler.setProperty(
- TestElement.GUI_CLASS,
- "org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui");
- try
- {
- boolean firstInBatch=false;
- long now = System.currentTimeMillis();
- long deltaT= now - lastTime;
- if (deltaT > sampleGap){
- if (!myTarget.isLeaf()
- && groupingMode == GROUPING_ADD_SEPARATORS)
+ enum = controller.children();
+ String guiClassName = null;
+ while (enum.hasMoreElements())
+ {
+ JMeterTreeNode subNode =
+ (JMeterTreeNode) enum.nextElement();
+ if (subNode.isEnabled())
+ {
+ TestElement element= (TestElement)subNode.getUserObject();
+ if (myClass.isInstance(element))
{
- addDivider(treeModel, myTarget);
+ log.debug("Applicable:
"+element.getPropertyAsString(TestElement.NAME));
+ if (ascending) elements.addFirst(element);
+ else elements.add(element);
}
- if (groupingMode == GROUPING_IN_CONTROLLERS)
+
+ // Special case for the TestPlan's Arguments sub-element:
+ if (element instanceof TestPlan)
{
- addSimpleController(treeModel, myTarget, sampler.getName());
+ Arguments args= (Arguments)
+
element.getProperty(TestPlan.USER_DEFINED_VARIABLES).getObjectValue();
+ if (myClass.isInstance(args))
+ {
+ if (ascending) elements.addFirst(args);
+ else elements.add(args);
+ }
}
- firstInBatch=true;//Remember this was first in its batch
}
- if (lastTime == 0) deltaT= 0; // Decent value for timers
- lastTime = now;
+ }
+ }
+
+ return elements;
+ }
- if (groupingMode == GROUPING_STORE_FIRST_ONLY)
+ private void placeSampler(
+ HTTPSampler sampler,
+ TestElement[] subConfigs,
+ JMeterTreeNode myTarget)
+ {
+ try
+ {
+ JMeterTreeModel treeModel = GuiPackage.getInstance().getTreeModel();
+
+ boolean firstInBatch=false;
+ long now = System.currentTimeMillis();
+ long deltaT= now - lastTime;
+ if (deltaT > sampleGap){
+ if (!myTarget.isLeaf()
+ && groupingMode == GROUPING_ADD_SEPARATORS)
{
- if (!firstInBatch) return; // Huh! don't store this one!
-
- // If we're not storing subsequent samplers, we'll need the
- // first sampler to do all the work...:
- sampler.setFollowRedirects(true);
- sampler.setImageParser(true);
+ addDivider(treeModel, myTarget);
}
-
if (groupingMode == GROUPING_IN_CONTROLLERS)
{
- // Find the last controller in the target to store the
- // sampler there:
- for (int i= myTarget.getChildCount()-1; i>=0; i--)
+ addSimpleController(treeModel, myTarget, sampler.getName());
+ }
+ firstInBatch=true;//Remember this was first in its batch
+ }
+ if (lastTime == 0) deltaT= 0; // Decent value for timers
+ lastTime = now;
+
+ if (groupingMode == GROUPING_STORE_FIRST_ONLY)
+ {
+ if (!firstInBatch) return; // Huh! don't store this one!
+
+ // If we're not storing subsequent samplers, we'll need the
+ // first sampler to do all the work...:
+ sampler.setFollowRedirects(true);
+ sampler.setImageParser(true);
+ }
+
+ if (groupingMode == GROUPING_IN_CONTROLLERS)
+ {
+ // Find the last controller in the target to store the
+ // sampler there:
+ for (int i= myTarget.getChildCount()-1; i>=0; i--)
+ {
+ JMeterTreeNode c= (JMeterTreeNode)myTarget.getChildAt(i);
+ if (c.createTestElement() instanceof GenericController)
{
- JMeterTreeNode c= (JMeterTreeNode)myTarget.getChildAt(i);
- if (c.createTestElement() instanceof GenericController)
- {
- myTarget= c;
- break;
- }
+ myTarget= c;
+ break;
}
}
-
- JMeterTreeNode newNode =
- treeModel.addComponent(sampler, myTarget);
-
- if(firstInBatch){
+ }
+
+ JMeterTreeNode newNode =
+ treeModel.addComponent(sampler, myTarget);
+
+ if(firstInBatch){
+ if (addAssertions){
addAssertion(treeModel,newNode);
- addTimers(treeModel, newNode, deltaT);
- firstInBatch=false;
}
-
- for (int i = 0;
- subConfigs != null && i < subConfigs.length;
- i++)
+ addTimers(treeModel, newNode, deltaT);
+ firstInBatch=false;
+ }
+
+ for (int i = 0;
+ subConfigs != null && i < subConfigs.length;
+ i++)
+ {
+ if (subConfigs[i] instanceof HeaderManager)
{
- if (subConfigs[i] instanceof HeaderManager)
- {
- subConfigs[i].setProperty(
- TestElement.GUI_CLASS,
- "org.apache.jmeter.protocol.http.gui.HeaderPanel");
- treeModel.addComponent(subConfigs[i], newNode);
- }
+ subConfigs[i].setProperty(
+ TestElement.GUI_CLASS,
+ "org.apache.jmeter.protocol.http.gui.HeaderPanel");
+ treeModel.addComponent(subConfigs[i], newNode);
}
}
- catch (IllegalUserActionException e)
- {
+ }
+ catch (IllegalUserActionException e)
+ {
JMeterUtils.reportErrorToUser(e.getMessage());
- }
}
}
+ /**
+ * Remove from the sampler all values which match the one provided by the
+ * first configuration in the given collection which provides a value for
+ * that property.
+ *
+ * @param sampler Sampler to remove values from.
+ * @param configurations ConfigTestElements in descending priority.
+ */
private void removeValuesFromSampler(
HTTPSampler sampler,
- TestElement urlConfig)
+ Collection configurations)
{
- if (urlConfig != null)
+ for (PropertyIterator props= sampler.propertyIterator();
+ props.hasNext();
+ )
{
- if (sampler
- .getDomain()
- .equals(urlConfig.getPropertyAsString(HTTPSampler.DOMAIN)))
+ JMeterProperty prop= props.next();
+ String name= prop.getName();
+ String value= prop.getStringValue();
+
+ // There's a few properties which are excluded from this processing:
+ if (name.equals(TestElement.ENABLED)
+ || name.equals(TestElement.GUI_CLASS)
+ || name.equals(TestElement.NAME)
+ || name.equals(TestElement.TEST_CLASS))
{
- sampler.setDomain("");
+ continue; // go on with next property.
}
- // Need to add some kind of "ignore-me" value
- if (sampler.getPort()
- == urlConfig.getPropertyAsInt(HTTPSampler.PORT))
- {
- sampler.setPort(HTTPSampler.UNSPECIFIED_PORT);
- }
-
- if (sampler
- .getPath()
- .equals(urlConfig.getPropertyAsString(HTTPSampler.PATH)))
- {
- sampler.setPath("");
- }
-
- if (sampler
- .getProtocol()
-
.equalsIgnoreCase(urlConfig.getPropertyAsString(HTTPSampler.PROTOCOL))
+ for (Iterator configs= configurations.iterator();
+ configs.hasNext();
)
{
- sampler.setProtocol("");
+ ConfigTestElement config= (ConfigTestElement)configs.next();
+
+ String configValue= config.getPropertyAsString(name);
+
+ if (configValue != null && configValue.length() > 0)
+ {
+ if (configValue.equals(value)) sampler.setProperty(name, "");
+ // Property was found in a config element. Whether or not
+ // it matched the value in the sampler, we're done with
+ // this property -- don't look at lower-priority configs:
+ break;
+ }
}
}
}
- private boolean areMatched(HTTPSampler sampler, TestElement urlConfig)
- {
- return urlConfig == null
- || (urlConfig.getPropertyAsString(HTTPSampler.DOMAIN).equals("")
- || urlConfig.getPropertyAsString(HTTPSampler.DOMAIN).equals(
- sampler.getDomain()))
- && (urlConfig.getPropertyAsString(HTTPSampler.PATH).equals("")
- || urlConfig.getPropertyAsString(HTTPSampler.PATH).equals(
- sampler.getPath()));
- }
-
private String generateMatchUrl(HTTPSampler sampler)
{
StringBuffer buf = new StringBuffer(sampler.getDomain());
@@ -663,17 +758,36 @@
return false;
}
- protected void replaceValues(TestElement sampler, TestElement[] configs)
- {
+ /**
+ * Scan all test elements passed in for values matching the value of
+ * any of the variables in any of the variable-holding elements in the
+ * collection.
+ *
+ * @param sampler A TestElement to replace values on
+ * @param configs More TestElements to replace values on
+ * @param variables Collection of Arguments to use to do the replacement,
+ * ordered by ascending priority.
+ */
+ private void replaceValues(
+ TestElement sampler,
+ TestElement[] configs,
+ Collection variables)
+ {
+ // Build the replacer from all the variables in the collection:
+ ValueReplacer replacer= new ValueReplacer();
+ for (Iterator vars= variables.iterator(); vars.hasNext(); )
+ {
+ replacer.addVariables(((Arguments)vars.next()).getArgumentsAsMap());
+ }
+
try
{
- GuiPackage.getInstance().getReplacer().reverseReplace(sampler);
+ replacer.reverseReplace(sampler);
for (int i = 0; i < configs.length; i++)
{
if (configs[i] != null)
{
- GuiPackage.getInstance().getReplacer().reverseReplace(
- configs[i]);
+ replacer.reverseReplace(configs[i]);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]