sebb 2005/03/16 16:31:58
Modified: src/core/org/apache/jmeter/control Tag: rel-2_0
WhileController.java
Log:
Clarify logic by reversing sense of test
Revision Changes Path
No revision
No revision
1.1.2.9 +8 -8
jakarta-jmeter/src/core/org/apache/jmeter/control/WhileController.java
Index: WhileController.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/control/WhileController.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- WhileController.java 13 Mar 2005 18:38:37 -0000 1.1.2.8
+++ WhileController.java 17 Mar 2005 00:31:58 -0000 1.1.2.9
@@ -70,7 +70,7 @@
* @param loopEnd - are we at loop end?
* @return true means OK to continue
*/
- private boolean conditionTrue(boolean loopEnd)
+ private boolean endOfLoop(boolean loopEnd)
{
// clear cached condition
getProperty(CONDITION).recoverRunningVersion(null);
@@ -81,16 +81,16 @@
if ((loopEnd && cnd.length() == 0)
|| "LAST".equalsIgnoreCase(cnd)) {// $NON-NLS-1$
if (testMode) {
- res=testModeResult;
+ res=!testModeResult;
} else {
JMeterVariables threadVars =
JMeterContextService.getContext().getVariables();
// Use !false rather than true, so that null is treated as
true
- res =
!"false".equalsIgnoreCase(threadVars.get(JMeterThread.LAST_SAMPLE_OK));//
$NON-NLS-1$
+ res =
"false".equalsIgnoreCase(threadVars.get(JMeterThread.LAST_SAMPLE_OK));//
$NON-NLS-1$
}
} else {
// cnd may be blank if next() called us
- res = !"false".equalsIgnoreCase(cnd);// $NON-NLS-1$
+ res = "false".equalsIgnoreCase(cnd);// $NON-NLS-1$
}
log.debug("Condition value: "+res);
return res;
@@ -103,7 +103,7 @@
protected Sampler nextIsNull() throws NextIsNullException
{
reInitialize();
- if (conditionTrue(true))
+ if (!endOfLoop(true))
{
return super.next();
}
@@ -120,7 +120,7 @@
return super.next();
}
// Must be start of loop
- if(conditionTrue(false)) // Still OK
+ if(!endOfLoop(false))
{
return super.next(); // OK to continue
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]