jakarta-jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: jakarta-jmeter/src/core/org/apache/jmeter/control IfController.java
Date Tue, 05 Oct 2004 20:32:25 GMT
sebb        2004/10/05 13:32:25

  Modified:    src/core/org/apache/jmeter/control Tag: rel-2_0
                        IfController.java
  Log:
  Fix bug where first false result disabled controller for rest of test
  [copied fix from HEAD]
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.2.1   +38 -24    jakarta-jmeter/src/core/org/apache/jmeter/control/IfController.java
  
  Index: IfController.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/control/IfController.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- IfController.java	14 Feb 2004 03:34:29 -0000	1.3
  +++ IfController.java	5 Oct 2004 20:32:24 -0000	1.3.2.1
  @@ -19,6 +19,8 @@
   package org.apache.jmeter.control;
   
   import java.io.Serializable;
  +
  +import org.apache.jmeter.junit.JMeterTestCase;
   import org.apache.jmeter.samplers.Sampler;
   import org.apache.jmeter.testelement.TestElement;
   import org.apache.jmeter.testelement.property.StringProperty;
  @@ -26,7 +28,6 @@
   import org.apache.log.Logger;
   import org.mozilla.javascript.Context;
   import org.mozilla.javascript.Scriptable;
  -import org.apache.jmeter.junit.JMeterTestCase;
   
   /**
    * 
  @@ -83,7 +84,7 @@
   	   * Condition Accessor - this is gonna be like     ${count}<10
   	   */
   	  public String getCondition() {
  -			return getPropertyAsString(CONDITION);
  +	  		return getPropertyAsString(CONDITION);
   	  }
   
   	  /**
  @@ -137,17 +138,18 @@
   	   * IsDone indicates whether the termination condition is reached.
   	   * I.e. if the condition evaluates to False - then isDone() returns TRUE
   	   */
  -	  public boolean isDone() {
  -
  -			boolean result = true;
  -			try {
  -				  result = !evaluateCondition();
  -			} catch (Exception e) {
  -				  logger.error(e.getMessage(), e);
  -			}
  -			setDone(true);
  -			return result;
  -	  }
  +	public boolean isDone() {
  +//		boolean result = true;
  +//		try {
  +//			  result = !evaluateCondition();
  +//		} catch (Exception e) {
  +//			  logger.error(e.getMessage(), e);
  +//		}
  +//		setDone(true);
  +//		return result;
  +//		setDone(false);
  +		return false;
  +	}
   
   	  /**
   	   * @see org.apache.jmeter.control.Controller#next()
  @@ -160,15 +162,27 @@
   	   *    - if its the first time this is run. The first time is special
   	   *       cause it is called prior the iteration even starts !
   	   */
  -	  public Sampler next() {
  -			Sampler currentElement = super.next();
  -
  -			if (!isDone()) {
  -				  return currentElement;
  -			} else {
  -				  return null;
  -			}
  -	  }
  +	public Sampler next() 
  +	{
  +		boolean result = false;
  +		try {
  +			result = evaluateCondition();
  +		}
  +		catch (Exception e)
  +		{
  +			logger.error(e.getMessage(),e);
  +		}
  +		if (result)
  +		   return super.next();
  +		else try
  +		{
  +		   return nextIsNull();
  +		}
  +		catch (NextIsNullException e1)
  +		{
  +		   return null;
  +		}
  +	}
   
   ////////////////////////////// Start of Test Code ///////////////////////////
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Mime
View raw message