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 2007/12/02 22:57:29 UTC
svn commit: r600384 - in /jakarta/jmeter/trunk:
src/components/org/apache/jmeter/control/SwitchController.java
xdocs/changes.xml
Author: sebb
Date: Sun Dec 2 13:57:28 2007
New Revision: 600384
URL: http://svn.apache.org/viewvc?rev=600384&view=rev
Log:
Fix Switch Controller to work properly with functions and variables
Modified:
jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/SwitchController.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified: jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/SwitchController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/SwitchController.java?rev=600384&r1=600383&r2=600384&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/SwitchController.java (original)
+++ jakarta/jmeter/trunk/src/components/org/apache/jmeter/control/SwitchController.java Sun Dec 2 13:57:28 2007
@@ -20,45 +20,46 @@
import java.io.Serializable;
+import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.testelement.property.StringProperty;
-public class SwitchController extends InterleaveControl implements Serializable {
+public class SwitchController extends GenericController implements Serializable {
private final static String SWITCH_VALUE = "SwitchController.value";
public SwitchController() {
super();
- this.setStyle(USE_SUB_CONTROLLERS);
}
- public void reInitialize() {
- super.reInitialize();
- current = getSelectionAsInt();
- }
-
- /**
- * @see org.apache.jmeter.control.GenericController#resetCurrent()
- */
- protected void resetCurrent() {
- int c = getSubControllers().size();
- if (c > 0) {
+ public Sampler next() {
+ if (isFirst()) { // Set the selection once per iteration
current = getSelectionAsInt();
- } else {
- current = 0;
}
+ return super.next();
}
- /**
+ /*
+ * (non-Javadoc)
+ *
+ * incrementCurrent is called when the current child (whether sampler or controller)
+ * has been processed.
+ *
+ * Setting it to int.max marks the controller as having processed all its
+ * children. Thus the controller processes one child per iteration.
+ *
* @see org.apache.jmeter.control.GenericController#incrementCurrent()
*/
protected void incrementCurrent() {
- super.incrementCurrent();
- current = getSelectionAsInt();
+ current=Integer.MAX_VALUE;
}
public void setSelection(String inputValue) {
setProperty(new StringProperty(SWITCH_VALUE, inputValue));
}
+ /*
+ * Returns the selection value as a int,
+ * with the value set to zero if it is out of range.
+ */
private int getSelectionAsInt() {
int ret;
getProperty(SWITCH_VALUE).recoverRunningVersion(null);
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=600384&r1=600383&r2=600384&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Sun Dec 2 13:57:28 2007
@@ -39,6 +39,7 @@
<h4>Bug fixes</h4>
<ul>
<li>Check that the CSV delimiter is reasonable.</li>
+<li>Fix Switch Controller to work properly with functions and variables</li>
</ul>
<h4>Improvements</h4>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org