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 2008/07/07 01:42:14 UTC

svn commit: r674362 [3/6] - in /jakarta/jmeter/trunk/src/core/org/apache/jmeter: ./ config/ config/gui/ control/ control/gui/ engine/ engine/event/ engine/util/ exceptions/

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/GenericController.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control;
@@ -45,287 +45,287 @@
  * </p>
  */
 public class GenericController extends AbstractTestElement implements Controller, Serializable {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	private transient LinkedList iterationListeners = new LinkedList();
+    private transient LinkedList iterationListeners = new LinkedList();
 
-	// May be replaced by RandomOrderController
-	protected transient List subControllersAndSamplers = new ArrayList();
+    // May be replaced by RandomOrderController
+    protected transient List subControllersAndSamplers = new ArrayList();
 
-	protected transient int current;
+    protected transient int current;
 
-	private transient int iterCount;
-
-	private transient boolean done, first;
-
-	/**
-	 * Creates a Generic Controller
-	 */
-	public GenericController() {
-	}
-
-	public void initialize() {
-		resetCurrent();
-		resetIterCount();
-		done = false; // TODO should this use setDone()?
-		first = true; // TODO should this use setFirst()?
-		TestElement elem;
-		for (int i = 0; i < subControllersAndSamplers.size(); i++) {
-			elem = (TestElement) subControllersAndSamplers.get(i);
-			if (elem instanceof Controller) {
-				((Controller) elem).initialize();
-			}
-		}
-	}
-
-	/**
-	 * Resets the controller:
-	 * <ul>
-	 * <li>resetCurrent() (i.e. current=0)</li>
-	 * <li>increment iteration count</li>
-	 * <li>sets first=true</li>
-	 * <li>recoverRunningVersion() to set the controller back to the initial state</li>
-	 * </ul>
-	 * 
-	 */
-	protected void reInitialize() {
-		resetCurrent();
-		incrementIterCount();
-		setFirst(true);
-		recoverRunningVersion();
-	}
-
-	/**
-	 * <p>
-	 * Determines the next sampler to be processed.
-	 * </p>
-	 * 
-	 * <p>
-	 * If isDone, returns null.
-	 * </p>
-	 * 
-	 * <p>
-	 * Gets the list element using current pointer.
-	 * If this is null, calls {@link #nextIsNull()}.
-	 * </p>
-	 * 
-	 * <p>
-	 * If the list element is a sampler, calls {@link #nextIsASampler(Sampler)},
-	 * otherwise calls {@link #nextIsAController(Controller)}
-	 * </p>
-	 * 
-	 * <p>
-	 * If any of the called methods throws NextIsNullException, returns null,
-	 * otherwise the value obtained above is returned.
-	 * </p>
-	 * 
-	 * @return the next sampler or null
-	 */
-	public Sampler next() {
-		fireIterEvents();
-		if (log.isDebugEnabled()) {
-			log.debug("Calling next on: " + this.getClass().getName());
-		}
-		if (isDone()) {
-			return null;
-		}
-		Sampler returnValue = null;
-		try {
-			TestElement currentElement = getCurrentElement();
-			setCurrentElement(currentElement);
-			if (currentElement == null) {
-				// incrementCurrent();
-				returnValue = nextIsNull();
-			} else {
-				if (currentElement instanceof Sampler) {
-					returnValue = nextIsASampler((Sampler) currentElement);
-				} else { // must be a controller
-					returnValue = nextIsAController((Controller) currentElement);
-				}
-			}
-		} catch (NextIsNullException e) {
-			returnValue = null;
-		}
-		return returnValue;
-	}
-
-	/**
-	 * @see org.apache.jmeter.control.Controller#isDone()
-	 */
-	public boolean isDone() {
-		return done;
-	}
-
-	protected void setDone(boolean done) {
-		this.done = done;
-	}
-
-	protected boolean isFirst() {
-		return first;
-	}
-
-	public void setFirst(boolean b) {
-		first = b;
-	}
-
-	/**
-	 * Called by next() if the element is a Controller,
-	 * and returns the next sampler from the controller.
-	 * If this is null, then updates the current pointer and makes recursive call to next().
-	 * @param controller
-	 * @return the next sampler
-	 * @throws NextIsNullException
-	 */
-	protected Sampler nextIsAController(Controller controller) throws NextIsNullException {
-		Sampler sampler = controller.next();
-		if (sampler == null) {
-			currentReturnedNull(controller);
-			sampler = next();
-		}
-		return sampler;
-	}
-
-	/**
-	 * Increment the current pointer and return the element.
-	 * Called by next() if the element is a sampler.
-	 * (May be overriden by sub-classes).
-	 *  
-	 * @param element
-	 * @return input element
-	 * @throws NextIsNullException
-	 */
-	protected Sampler nextIsASampler(Sampler element) throws NextIsNullException {
-		incrementCurrent();
-		return element;
-	}
-
-	/**
-	 * Called by next() when getCurrentElement() returns null.
-	 * Reinitialises the controller.
-	 * 
-	 * @return null (always, for this class)
-	 * @throws NextIsNullException
-	 */
-	protected Sampler nextIsNull() throws NextIsNullException {
-		reInitialize();
-		return null;
-	}
-
-	/**
-	 * If the controller is done, remove it from the list,
-	 * otherwise increment to next entry in list.
-	 * 
-	 * @param c controller
-	 */
-	protected void currentReturnedNull(Controller c) {
-		if (c.isDone()) {
-			removeCurrentElement();
-		} else {
-			incrementCurrent();
-		}
-	}
-
-	/**
-	 * Gets the SubControllers attribute of the GenericController object
-	 * 
-	 * @return the SubControllers value
-	 */
-	protected List getSubControllers() {
-		return subControllersAndSamplers;
-	}
-
-	private void addElement(TestElement child) {
-		subControllersAndSamplers.add(child);
-	}
-
-	/**
-	 * Empty implementation - does nothing.
-	 * 
-	 * @param currentElement
-	 * @throws NextIsNullException
-	 */
-	protected void setCurrentElement(TestElement currentElement) throws NextIsNullException {
-	}
-
-	/**
-	 * <p>
-	 * Gets the element indicated by the <code>current</code> index, if one exists,
-	 * from the <code>subControllersAndSamplers</code> list.
-	 * </p>
-	 * <p>
-	 * If the <code>subControllersAndSamplers</code> list is empty, 
-	 * then set done = true, and throw NextIsNullException.
-	 * </p>
-	 * @return the current element - or null if current index too large
-	 * @throws NextIsNullException if list is empty
-	 */
-	protected TestElement getCurrentElement() throws NextIsNullException {
-		if (current < subControllersAndSamplers.size()) {
-			return (TestElement) subControllersAndSamplers.get(current);
-		}
-		if (subControllersAndSamplers.size() == 0) {
-			setDone(true);
-			throw new NextIsNullException();
-		}
-		return null;
-	}
-
-	protected void removeCurrentElement() {
-		subControllersAndSamplers.remove(current);
-	}
-
-	/**
-	 * Increments the current pointer; called by currentReturnedNull to move the
-	 * controller on to its next child.
-	 */
-	protected void incrementCurrent() {
-		current++;
-	}
-
-	protected void resetCurrent() {
-		current = 0;
-	}
-
-	public void addTestElement(TestElement child) {
-		if (child instanceof Controller || child instanceof Sampler) {
-			addElement(child);
-		}
-	}
-
-	public void addIterationListener(LoopIterationListener lis) {
-		/*
-		 * A little hack - add each listener to the start of the list - this
-		 * ensures that the thread running the show is the first listener and
-		 * can modify certain values before other listeners are called.
-		 */
-		iterationListeners.addFirst(lis);
-	}
-
-	protected void fireIterEvents() {
-		if (isFirst()) {
-			fireIterationStart();
-			first = false; // TODO - should this use setFirst() ?
-		}
-	}
-
-	protected void fireIterationStart() {
-		Iterator iter = iterationListeners.iterator();
-		LoopIterationEvent event = new LoopIterationEvent(this, getIterCount());
-		while (iter.hasNext()) {
-			LoopIterationListener item = (LoopIterationListener) iter.next();
-			item.iterationStart(event);
-		}
-	}
-
-	protected int getIterCount() {
-		return iterCount;
-	}
-
-	protected void incrementIterCount() {
-		iterCount++;
-	}
-
-	protected void resetIterCount() {
-		iterCount = 0;
-	}
+    private transient int iterCount;
+
+    private transient boolean done, first;
+
+    /**
+     * Creates a Generic Controller
+     */
+    public GenericController() {
+    }
+
+    public void initialize() {
+        resetCurrent();
+        resetIterCount();
+        done = false; // TODO should this use setDone()?
+        first = true; // TODO should this use setFirst()?
+        TestElement elem;
+        for (int i = 0; i < subControllersAndSamplers.size(); i++) {
+            elem = (TestElement) subControllersAndSamplers.get(i);
+            if (elem instanceof Controller) {
+                ((Controller) elem).initialize();
+            }
+        }
+    }
+
+    /**
+     * Resets the controller:
+     * <ul>
+     * <li>resetCurrent() (i.e. current=0)</li>
+     * <li>increment iteration count</li>
+     * <li>sets first=true</li>
+     * <li>recoverRunningVersion() to set the controller back to the initial state</li>
+     * </ul>
+     *
+     */
+    protected void reInitialize() {
+        resetCurrent();
+        incrementIterCount();
+        setFirst(true);
+        recoverRunningVersion();
+    }
+
+    /**
+     * <p>
+     * Determines the next sampler to be processed.
+     * </p>
+     *
+     * <p>
+     * If isDone, returns null.
+     * </p>
+     *
+     * <p>
+     * Gets the list element using current pointer.
+     * If this is null, calls {@link #nextIsNull()}.
+     * </p>
+     *
+     * <p>
+     * If the list element is a sampler, calls {@link #nextIsASampler(Sampler)},
+     * otherwise calls {@link #nextIsAController(Controller)}
+     * </p>
+     *
+     * <p>
+     * If any of the called methods throws NextIsNullException, returns null,
+     * otherwise the value obtained above is returned.
+     * </p>
+     *
+     * @return the next sampler or null
+     */
+    public Sampler next() {
+        fireIterEvents();
+        if (log.isDebugEnabled()) {
+            log.debug("Calling next on: " + this.getClass().getName());
+        }
+        if (isDone()) {
+            return null;
+        }
+        Sampler returnValue = null;
+        try {
+            TestElement currentElement = getCurrentElement();
+            setCurrentElement(currentElement);
+            if (currentElement == null) {
+                // incrementCurrent();
+                returnValue = nextIsNull();
+            } else {
+                if (currentElement instanceof Sampler) {
+                    returnValue = nextIsASampler((Sampler) currentElement);
+                } else { // must be a controller
+                    returnValue = nextIsAController((Controller) currentElement);
+                }
+            }
+        } catch (NextIsNullException e) {
+            returnValue = null;
+        }
+        return returnValue;
+    }
+
+    /**
+     * @see org.apache.jmeter.control.Controller#isDone()
+     */
+    public boolean isDone() {
+        return done;
+    }
+
+    protected void setDone(boolean done) {
+        this.done = done;
+    }
+
+    protected boolean isFirst() {
+        return first;
+    }
+
+    public void setFirst(boolean b) {
+        first = b;
+    }
+
+    /**
+     * Called by next() if the element is a Controller,
+     * and returns the next sampler from the controller.
+     * If this is null, then updates the current pointer and makes recursive call to next().
+     * @param controller
+     * @return the next sampler
+     * @throws NextIsNullException
+     */
+    protected Sampler nextIsAController(Controller controller) throws NextIsNullException {
+        Sampler sampler = controller.next();
+        if (sampler == null) {
+            currentReturnedNull(controller);
+            sampler = next();
+        }
+        return sampler;
+    }
+
+    /**
+     * Increment the current pointer and return the element.
+     * Called by next() if the element is a sampler.
+     * (May be overriden by sub-classes).
+     *
+     * @param element
+     * @return input element
+     * @throws NextIsNullException
+     */
+    protected Sampler nextIsASampler(Sampler element) throws NextIsNullException {
+        incrementCurrent();
+        return element;
+    }
+
+    /**
+     * Called by next() when getCurrentElement() returns null.
+     * Reinitialises the controller.
+     *
+     * @return null (always, for this class)
+     * @throws NextIsNullException
+     */
+    protected Sampler nextIsNull() throws NextIsNullException {
+        reInitialize();
+        return null;
+    }
+
+    /**
+     * If the controller is done, remove it from the list,
+     * otherwise increment to next entry in list.
+     *
+     * @param c controller
+     */
+    protected void currentReturnedNull(Controller c) {
+        if (c.isDone()) {
+            removeCurrentElement();
+        } else {
+            incrementCurrent();
+        }
+    }
+
+    /**
+     * Gets the SubControllers attribute of the GenericController object
+     *
+     * @return the SubControllers value
+     */
+    protected List getSubControllers() {
+        return subControllersAndSamplers;
+    }
+
+    private void addElement(TestElement child) {
+        subControllersAndSamplers.add(child);
+    }
+
+    /**
+     * Empty implementation - does nothing.
+     *
+     * @param currentElement
+     * @throws NextIsNullException
+     */
+    protected void setCurrentElement(TestElement currentElement) throws NextIsNullException {
+    }
+
+    /**
+     * <p>
+     * Gets the element indicated by the <code>current</code> index, if one exists,
+     * from the <code>subControllersAndSamplers</code> list.
+     * </p>
+     * <p>
+     * If the <code>subControllersAndSamplers</code> list is empty,
+     * then set done = true, and throw NextIsNullException.
+     * </p>
+     * @return the current element - or null if current index too large
+     * @throws NextIsNullException if list is empty
+     */
+    protected TestElement getCurrentElement() throws NextIsNullException {
+        if (current < subControllersAndSamplers.size()) {
+            return (TestElement) subControllersAndSamplers.get(current);
+        }
+        if (subControllersAndSamplers.size() == 0) {
+            setDone(true);
+            throw new NextIsNullException();
+        }
+        return null;
+    }
+
+    protected void removeCurrentElement() {
+        subControllersAndSamplers.remove(current);
+    }
+
+    /**
+     * Increments the current pointer; called by currentReturnedNull to move the
+     * controller on to its next child.
+     */
+    protected void incrementCurrent() {
+        current++;
+    }
+
+    protected void resetCurrent() {
+        current = 0;
+    }
+
+    public void addTestElement(TestElement child) {
+        if (child instanceof Controller || child instanceof Sampler) {
+            addElement(child);
+        }
+    }
+
+    public void addIterationListener(LoopIterationListener lis) {
+        /*
+         * A little hack - add each listener to the start of the list - this
+         * ensures that the thread running the show is the first listener and
+         * can modify certain values before other listeners are called.
+         */
+        iterationListeners.addFirst(lis);
+    }
+
+    protected void fireIterEvents() {
+        if (isFirst()) {
+            fireIterationStart();
+            first = false; // TODO - should this use setFirst() ?
+        }
+    }
+
+    protected void fireIterationStart() {
+        Iterator iter = iterationListeners.iterator();
+        LoopIterationEvent event = new LoopIterationEvent(this, getIterCount());
+        while (iter.hasNext()) {
+            LoopIterationListener item = (LoopIterationListener) iter.next();
+            item.iterationStart(event);
+        }
+    }
+
+    protected int getIterCount() {
+        return iterCount;
+    }
+
+    protected void incrementIterCount() {
+        iterCount++;
+    }
+
+    protected void resetIterCount() {
+        iterCount = 0;
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/IfController.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control;
@@ -28,120 +28,120 @@
 import org.mozilla.javascript.Scriptable;
 
 /*******************************************************************************
- * 
+ *
  * @author Cyrus Montakab created 2003/06/30
- * 
+ *
  * This is a Conditional Controller; it will execute the set of statements
- * (samplers/controllers, etc) while the 'condition' is true. 
- * In a programming world - this is equivalant of : 
+ * (samplers/controllers, etc) while the 'condition' is true.
+ * In a programming world - this is equivalant of :
  * if (condition) {
- *          statements .... 
- *          } 
- * In JMeter you may have : Thread-Group (set to loop a number of times or indefinitely, 
+ *          statements ....
+ *          }
+ * In JMeter you may have : Thread-Group (set to loop a number of times or indefinitely,
  *    ... Samplers ... (e.g. Counter )
- *    ... Other Controllers .... 
- *    ... IfController ( condition set to something like - ${counter}<10) 
- *       ... statements to perform if condition is true 
- *       ... 
+ *    ... Other Controllers ....
+ *    ... IfController ( condition set to something like - ${counter}<10)
+ *       ... statements to perform if condition is true
+ *       ...
  *    ... Other Controllers /Samplers }
- * 
+ *
  ******************************************************************************/
 
 public class IfController extends GenericController implements Serializable {
 
-	private static final Logger logger = LoggingManager.getLoggerForClass();
+    private static final Logger logger = LoggingManager.getLoggerForClass();
 
-	private final static String CONDITION = "IfController.condition"; //$NON-NLS-1$
+    private final static String CONDITION = "IfController.condition"; //$NON-NLS-1$
 
-	private final static String EVALUATE_ALL = "IfController.evaluateAll"; //$NON-NLS-1$
+    private final static String EVALUATE_ALL = "IfController.evaluateAll"; //$NON-NLS-1$
 
-	/**
-	 * constructor
-	 */
-	public IfController() {
-		super();
-	}
-
-	/**
-	 * constructor
-	 */
-	public IfController(String condition) {
-		super();
-		this.setCondition(condition);
-	}
-
-	/**
-	 * Condition Accessor - this is gonna be like ${count}<10
-	 */
-	public void setCondition(String condition) {
-		setProperty(new StringProperty(CONDITION, condition));
-	}
-
-	/**
-	 * Condition Accessor - this is gonna be like ${count}<10
-	 */
-	public String getCondition() {
-		return getPropertyAsString(CONDITION);
-	}
-
-	/**
-	 * evaluate the condition clause log error if bad condition
-	 */
-	static boolean evaluateCondition(String cond) {
-		logger.debug("    getCondition() : [" + cond + "]");
-
-		String resultStr = "";
-		boolean result = false;
-
-		// now evaluate the condition using JavaScript
-		Context cx = Context.enter();
-		try {
-			Scriptable scope = cx.initStandardObjects(null);
-			Object cxResultObject = cx.evaluateString(scope, cond
-			/** * conditionString ** */
-			, "<cmd>", 1, null);
-			resultStr = Context.toString(cxResultObject);
-
-			if (resultStr.equals("false")) { //$NON-NLS-1$
-				result = false;
-			} else if (resultStr.equals("true")) { //$NON-NLS-1$
-				result = true;
-			} else {
-				throw new Exception(" BAD CONDITION :: " + cond + " :: expected true or false");
-			}
-
-			logger.debug("    >> evaluate Condition -  [ " + cond + "] results is  [" + result + "]");
-		} catch (Exception e) {
-			logger.error(e.getMessage(), e);
-		} finally {
-			Context.exit();
-		}
-
-		return result;
-	}
-
-	/**
-	 * This is overriding the parent method. 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;
-		// setDone(false);
-		return false;
-	}
-
-	/**
-	 * @see org.apache.jmeter.control.Controller#next()
-	 */
-	public Sampler next() {
+    /**
+     * constructor
+     */
+    public IfController() {
+        super();
+    }
+
+    /**
+     * constructor
+     */
+    public IfController(String condition) {
+        super();
+        this.setCondition(condition);
+    }
+
+    /**
+     * Condition Accessor - this is gonna be like ${count}<10
+     */
+    public void setCondition(String condition) {
+        setProperty(new StringProperty(CONDITION, condition));
+    }
+
+    /**
+     * Condition Accessor - this is gonna be like ${count}<10
+     */
+    public String getCondition() {
+        return getPropertyAsString(CONDITION);
+    }
+
+    /**
+     * evaluate the condition clause log error if bad condition
+     */
+    static boolean evaluateCondition(String cond) {
+        logger.debug("    getCondition() : [" + cond + "]");
+
+        String resultStr = "";
+        boolean result = false;
+
+        // now evaluate the condition using JavaScript
+        Context cx = Context.enter();
+        try {
+            Scriptable scope = cx.initStandardObjects(null);
+            Object cxResultObject = cx.evaluateString(scope, cond
+            /** * conditionString ** */
+            , "<cmd>", 1, null);
+            resultStr = Context.toString(cxResultObject);
+
+            if (resultStr.equals("false")) { //$NON-NLS-1$
+                result = false;
+            } else if (resultStr.equals("true")) { //$NON-NLS-1$
+                result = true;
+            } else {
+                throw new Exception(" BAD CONDITION :: " + cond + " :: expected true or false");
+            }
+
+            logger.debug("    >> evaluate Condition -  [ " + cond + "] results is  [" + result + "]");
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        } finally {
+            Context.exit();
+        }
+
+        return result;
+    }
+
+    /**
+     * This is overriding the parent method. 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;
+        // setDone(false);
+        return false;
+    }
+
+    /**
+     * @see org.apache.jmeter.control.Controller#next()
+     */
+    public Sampler next() {
         // We should only evalute the condition if it is the first
         // time ( first "iteration" ) we are called.
         // For subsequent calls, we are inside the IfControllerGroup,
@@ -150,22 +150,22 @@
         if(isEvaluateAll() || isFirst()) {
             result = evaluateCondition(getCondition());
         }
-        
-		if (result) {
-			return super.next();
-		}
-		try {
-			return nextIsNull();
-		} catch (NextIsNullException e1) {
-			return null;
-		}
-	}
-
-	public boolean isEvaluateAll() {
-		return getPropertyAsBoolean(EVALUATE_ALL,false);
-	}
-
-	public void setEvaluateAll(boolean b) {
-		setProperty(EVALUATE_ALL,b);
-	}
+
+        if (result) {
+            return super.next();
+        }
+        try {
+            return nextIsNull();
+        } catch (NextIsNullException e1) {
+            return null;
+        }
+    }
+
+    public boolean isEvaluateAll() {
+        return getPropertyAsBoolean(EVALUATE_ALL,false);
+    }
+
+    public void setEvaluateAll(boolean b) {
+        setProperty(EVALUATE_ALL,b);
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/LoopController.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control;
@@ -31,72 +31,72 @@
  */
 public class LoopController extends GenericController implements Serializable {
 
-	private final static String LOOPS = "LoopController.loops"; // $NON-NLS-1$
-	
-	private static final long serialVersionUID = 232L;
-
-	/*
-	 * In spite of the name, this is actually used to determine if the loop controller is repeatable.
-	 * 
-	 * The value is only used in nextIsNull() when the loop end condition has been detected:
-	 * If forever==true, then it calls resetLoopCount(), otherwise it calls setDone(true).
-	 * 
-	 * Loop Controllers always set forever=true, so that they will be executed next time
-	 * the parent invokes them.
-	 * 
-	 * Thread Group sets the value false, so nextIsNull() sets done, and the Thread Group will not be repeated.
-	 * However, it's not clear that a Thread Group could ever be repeated.  
-	 */
-	private final static String CONTINUE_FOREVER = "LoopController.continue_forever"; // $NON-NLS-1$
-
-	private transient int loopCount = 0;
-
-	public LoopController() {
-		setContinueForever_private(true);
-	}
-
-	public void setLoops(int loops) {
-		setProperty(new IntegerProperty(LOOPS, loops));
-	}
-
-	public void setLoops(String loopValue) {
-		setProperty(new StringProperty(LOOPS, loopValue));
-	}
-
-	public int getLoops() {
-		try {
-			JMeterProperty prop = getProperty(LOOPS);
-			return Integer.parseInt(prop.getStringValue());
-		} catch (NumberFormatException e) {
-			return 0;
-		}
-	}
-
-	public String getLoopString() {
-		return getPropertyAsString(LOOPS);
-	}
-
-	/**
-	 * Determines whether the loop will return any samples if it is rerun.
-	 * 
-	 * @param forever
-	 *            true if the loop must be reset after ending a run
-	 */
-	public void setContinueForever(boolean forever) {
-		setContinueForever_private(forever);
-	}
-
-	private void setContinueForever_private(boolean forever) {
-		setProperty(new BooleanProperty(CONTINUE_FOREVER, forever));
-	}
-
-	private boolean getContinueForever() {
-		return getPropertyAsBoolean(CONTINUE_FOREVER);
-	}
+    private final static String LOOPS = "LoopController.loops"; // $NON-NLS-1$
+
+    private static final long serialVersionUID = 232L;
+
+    /*
+     * In spite of the name, this is actually used to determine if the loop controller is repeatable.
+     *
+     * The value is only used in nextIsNull() when the loop end condition has been detected:
+     * If forever==true, then it calls resetLoopCount(), otherwise it calls setDone(true).
+     *
+     * Loop Controllers always set forever=true, so that they will be executed next time
+     * the parent invokes them.
+     *
+     * Thread Group sets the value false, so nextIsNull() sets done, and the Thread Group will not be repeated.
+     * However, it's not clear that a Thread Group could ever be repeated.
+     */
+    private final static String CONTINUE_FOREVER = "LoopController.continue_forever"; // $NON-NLS-1$
+
+    private transient int loopCount = 0;
+
+    public LoopController() {
+        setContinueForever_private(true);
+    }
+
+    public void setLoops(int loops) {
+        setProperty(new IntegerProperty(LOOPS, loops));
+    }
+
+    public void setLoops(String loopValue) {
+        setProperty(new StringProperty(LOOPS, loopValue));
+    }
+
+    public int getLoops() {
+        try {
+            JMeterProperty prop = getProperty(LOOPS);
+            return Integer.parseInt(prop.getStringValue());
+        } catch (NumberFormatException e) {
+            return 0;
+        }
+    }
+
+    public String getLoopString() {
+        return getPropertyAsString(LOOPS);
+    }
+
+    /**
+     * Determines whether the loop will return any samples if it is rerun.
+     *
+     * @param forever
+     *            true if the loop must be reset after ending a run
+     */
+    public void setContinueForever(boolean forever) {
+        setContinueForever_private(forever);
+    }
+
+    private void setContinueForever_private(boolean forever) {
+        setProperty(new BooleanProperty(CONTINUE_FOREVER, forever));
+    }
+
+    private boolean getContinueForever() {
+        return getPropertyAsBoolean(CONTINUE_FOREVER);
+    }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.jmeter.control.Controller#next()
      */
     public Sampler next() {
@@ -106,55 +106,55 @@
         return super.next();
     }
 
-	private boolean endOfLoop() {
-		final int loops = getLoops();
-		return (loops > -1) && (loopCount >= loops);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.jmeter.control.GenericController#nextIsNull()
-	 */
-	protected Sampler nextIsNull() throws NextIsNullException {
-		reInitialize();
-		if (endOfLoop()) {
-			if (!getContinueForever()) {
-				setDone(true);
-			} else {
-				resetLoopCount();
-			}
-			return null;
-		}
-		return next();
-	}
-
-	protected void incrementLoopCount() {
-		loopCount++;
-	}
-
-	protected void resetLoopCount() {
-		loopCount = 0;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.jmeter.control.GenericController#getIterCount()
-	 */
-	protected int getIterCount() {
-		return loopCount + 1;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.jmeter.control.GenericController#reInitialize()
-	 */
-	protected void reInitialize() {
-		setFirst(true);
-		resetCurrent();
-		incrementLoopCount();
-		recoverRunningVersion();
-	}
+    private boolean endOfLoop() {
+        final int loops = getLoops();
+        return (loops > -1) && (loopCount >= loops);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.jmeter.control.GenericController#nextIsNull()
+     */
+    protected Sampler nextIsNull() throws NextIsNullException {
+        reInitialize();
+        if (endOfLoop()) {
+            if (!getContinueForever()) {
+                setDone(true);
+            } else {
+                resetLoopCount();
+            }
+            return null;
+        }
+        return next();
+    }
+
+    protected void incrementLoopCount() {
+        loopCount++;
+    }
+
+    protected void resetLoopCount() {
+        loopCount = 0;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.jmeter.control.GenericController#getIterCount()
+     */
+    protected int getIterCount() {
+        return loopCount + 1;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.jmeter.control.GenericController#reInitialize()
+     */
+    protected void reInitialize() {
+        setFirst(true);
+        resetCurrent();
+        incrementLoopCount();
+        recoverRunningVersion();
+    }
 }
\ No newline at end of file

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/ReplaceableController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/ReplaceableController.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/ReplaceableController.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/ReplaceableController.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control;
@@ -23,22 +23,22 @@
 /**
  * This interface represents a controller that gets replaced during the
  * compilation phase of test execution in an arbitrary way.
- * 
+ *
  */
 public interface ReplaceableController {
 
-	/**
-	 * Used to replace the test execution tree (usually by adding the
-	 * subelements of the TestElement that is replacing the
-	 * ReplaceableController.
-	 * 
-	 * @see org.apache.jorphan.collections.HashTree
-	 */
-	public HashTree getReplacementSubTree();
+    /**
+     * Used to replace the test execution tree (usually by adding the
+     * subelements of the TestElement that is replacing the
+     * ReplaceableController.
+     *
+     * @see org.apache.jorphan.collections.HashTree
+     */
+    public HashTree getReplacementSubTree();
 
-	/**
+    /**
      * Compute the replacement tree.
-     * 
+     *
      * @param context
      */
     public void resolveReplacementSubTree(Object context);

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/RunTime.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control;
@@ -26,97 +26,97 @@
 
 public class RunTime extends GenericController implements Serializable {
 
-	private final static String SECONDS = "RunTime.seconds"; //$NON-NLS-1$
+    private final static String SECONDS = "RunTime.seconds"; //$NON-NLS-1$
 
-	private volatile long startTime = 0;
+    private volatile long startTime = 0;
 
-	private int loopCount = 0; // for getIterCount
+    private int loopCount = 0; // for getIterCount
 
-	public RunTime() {
-	}
+    public RunTime() {
+    }
 
-	public void setRuntime(long seconds) {
-		setProperty(new LongProperty(SECONDS, seconds));
-	}
-
-	public void setRuntime(String seconds) {
-		setProperty(new StringProperty(SECONDS, seconds));
-	}
-
-	public long getRuntime() {
-		try {
-			return Long.parseLong(getPropertyAsString(SECONDS));
-		} catch (NumberFormatException e) {
-			return 0L;
-		}
-	}
-
-	public String getRuntimeString() {
-		return getPropertyAsString(SECONDS);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.jmeter.control.Controller#isDone()
-	 */
-	public boolean isDone() {
-		if (getRuntime() > 0 && getSubControllers().size() > 0) {
-			return super.isDone();
-		}
-		return true; // Runtime is zero - no point staying around
-	}
-
-	private boolean endOfLoop() {
-		return System.currentTimeMillis() - startTime >= 1000 * getRuntime();
-	}
-
-	public Sampler next() {
-		if (startTime == 0) {
-		    startTime = System.currentTimeMillis();
-		}
-		if (endOfLoop()) {
-			reInitialize();// ??
-			resetLoopCount();
-			return null;
-		}
-		return super.next();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.jmeter.control.GenericController#nextIsNull()
-	 */
-	protected Sampler nextIsNull() throws NextIsNullException {
-		reInitialize();
-		if (endOfLoop()) {
-			resetLoopCount();
-			return null;
-		}
-		return next();
-	}
-
-	protected void incrementLoopCount() {
-		loopCount++;
-	}
-
-	protected void resetLoopCount() {
-		loopCount = 0;
-		startTime = 0;
-	}
-
-	/*
-	 * This is needed for OnceOnly to work like other Loop Controllers
-	 */
-	protected int getIterCount() {
-		return loopCount + 1;
-	}
-
-	protected void reInitialize() {
-		setFirst(true);
-		resetCurrent();
-		incrementLoopCount();
-		recoverRunningVersion();
-	}
+    public void setRuntime(long seconds) {
+        setProperty(new LongProperty(SECONDS, seconds));
+    }
+
+    public void setRuntime(String seconds) {
+        setProperty(new StringProperty(SECONDS, seconds));
+    }
+
+    public long getRuntime() {
+        try {
+            return Long.parseLong(getPropertyAsString(SECONDS));
+        } catch (NumberFormatException e) {
+            return 0L;
+        }
+    }
+
+    public String getRuntimeString() {
+        return getPropertyAsString(SECONDS);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.jmeter.control.Controller#isDone()
+     */
+    public boolean isDone() {
+        if (getRuntime() > 0 && getSubControllers().size() > 0) {
+            return super.isDone();
+        }
+        return true; // Runtime is zero - no point staying around
+    }
+
+    private boolean endOfLoop() {
+        return System.currentTimeMillis() - startTime >= 1000 * getRuntime();
+    }
+
+    public Sampler next() {
+        if (startTime == 0) {
+            startTime = System.currentTimeMillis();
+        }
+        if (endOfLoop()) {
+            reInitialize();// ??
+            resetLoopCount();
+            return null;
+        }
+        return super.next();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.jmeter.control.GenericController#nextIsNull()
+     */
+    protected Sampler nextIsNull() throws NextIsNullException {
+        reInitialize();
+        if (endOfLoop()) {
+            resetLoopCount();
+            return null;
+        }
+        return next();
+    }
+
+    protected void incrementLoopCount() {
+        loopCount++;
+    }
+
+    protected void resetLoopCount() {
+        loopCount = 0;
+        startTime = 0;
+    }
+
+    /*
+     * This is needed for OnceOnly to work like other Loop Controllers
+     */
+    protected int getIterCount() {
+        return loopCount + 1;
+    }
+
+    protected void reInitialize() {
+        setFirst(true);
+        resetCurrent();
+        incrementLoopCount();
+        recoverRunningVersion();
+    }
 }
\ No newline at end of file

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionController.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control;
@@ -35,168 +35,168 @@
 
 /**
  * Transaction Controller to measure transaction times
- * 
+ *
  * There are two different modes for the controller:
  * - generate additional total sample after nested samples (as in JMeter 2.2)
  * - generate parent sampler containing the nested samples
- * 
+ *
  */
 public class TransactionController extends GenericController implements SampleListener, Controller, Serializable {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
     private transient TransactionSampler transactionSampler;
 
-	private transient ListenerNotifier lnf;
+    private transient ListenerNotifier lnf;
+
+    private transient SampleResult res;
 
-	private transient SampleResult res;
-    
     private transient int calls;
 
     private transient int noFailingSamples;
-    
-	private static final String PARENT = "TransactionController.parent";// $NON-NLS-1$
 
-	/**
-	 * Creates a Transaction Controller
-	 */
-	public TransactionController() {
-		lnf = new ListenerNotifier();
-	}
+    private static final String PARENT = "TransactionController.parent";// $NON-NLS-1$
+
+    /**
+     * Creates a Transaction Controller
+     */
+    public TransactionController() {
+        lnf = new ListenerNotifier();
+    }
 
     private Object readResolve(){
         lnf = new ListenerNotifier();
         return this;
     }
 
-	public void setParent(boolean _parent){
-		setProperty(new BooleanProperty(PARENT, _parent));
-	}
-
-	public boolean isParent(){
-		return getPropertyAsBoolean(PARENT);
-	}
-
-	/**
-	 * @see org.apache.jmeter.control.Controller#next()
-	 */
-	public Sampler next(){
-		if (isParent()){
-			return next1();
-		}
-		return next2();
-	}
-	
+    public void setParent(boolean _parent){
+        setProperty(new BooleanProperty(PARENT, _parent));
+    }
+
+    public boolean isParent(){
+        return getPropertyAsBoolean(PARENT);
+    }
+
+    /**
+     * @see org.apache.jmeter.control.Controller#next()
+     */
+    public Sampler next(){
+        if (isParent()){
+            return next1();
+        }
+        return next2();
+    }
+
 ///////////////// Transaction Controller - parent ////////////////
 
-	private Sampler next1() {
+    private Sampler next1() {
         // Check if transaction is done
         if(transactionSampler != null && transactionSampler.isTransactionDone()) {
-        	if (log.isDebugEnabled()) {
+            if (log.isDebugEnabled()) {
                 log.debug("End of transaction " + getName());
-        	}
+            }
             // This transaction is done
             transactionSampler = null;
             return null;
         }
-        
+
         // Check if it is the start of a new transaction
-		if (isFirst()) // must be the start of the subtree
-		{
-        	if (log.isDebugEnabled()) {
-		        log.debug("Start of transaction " + getName());
-        	}
-		    transactionSampler = new TransactionSampler(this, getName());
-		}
+        if (isFirst()) // must be the start of the subtree
+        {
+            if (log.isDebugEnabled()) {
+                log.debug("Start of transaction " + getName());
+            }
+            transactionSampler = new TransactionSampler(this, getName());
+        }
 
         // Sample the children of the transaction
-		Sampler subSampler = super.next();
+        Sampler subSampler = super.next();
         transactionSampler.setSubSampler(subSampler);
         // If we do not get any sub samplers, the transaction is done
         if (subSampler == null) {
             transactionSampler.setTransactionDone();
         }
         return transactionSampler;
-	}
-	
-	protected Sampler nextIsAController(Controller controller) throws NextIsNullException {
-		if (!isParent()) {
-			return super.nextIsAController(controller);
-		}
-		Sampler returnValue;
-		Sampler sampler = controller.next();
-		if (sampler == null) {
-			currentReturnedNull(controller);
-			// We need to call the super.next, instead of this.next, which is done in GenericController,
-			// because if we call this.next(), it will return the TransactionSampler, and we do not want that.
-			// We need to get the next real sampler or controller
-			returnValue = super.next();
-		} else {
-			returnValue = sampler;
-		}
-		return returnValue;
-	}
+    }
+
+    protected Sampler nextIsAController(Controller controller) throws NextIsNullException {
+        if (!isParent()) {
+            return super.nextIsAController(controller);
+        }
+        Sampler returnValue;
+        Sampler sampler = controller.next();
+        if (sampler == null) {
+            currentReturnedNull(controller);
+            // We need to call the super.next, instead of this.next, which is done in GenericController,
+            // because if we call this.next(), it will return the TransactionSampler, and we do not want that.
+            // We need to get the next real sampler or controller
+            returnValue = super.next();
+        } else {
+            returnValue = sampler;
+        }
+        return returnValue;
+    }
 
 ////////////////////// Transaction Controller - additional sample //////////////////////////////
 
-	private Sampler next2() {
-		if (isFirst()) // must be the start of the subtree
-		{
-			calls = 0;
+    private Sampler next2() {
+        if (isFirst()) // must be the start of the subtree
+        {
+            calls = 0;
             noFailingSamples = 0;
-			res = new SampleResult();
+            res = new SampleResult();
             res.setSampleLabel(getName());
             // Assume success
             res.setSuccessful(true);
-			res.sampleStart();
-		}
+            res.sampleStart();
+        }
 
         Sampler returnValue = super.next();
-        
-		if (returnValue == null) // Must be the end of the controller
-		{
-			if (res != null) {
-				res.sampleEnd();
+
+        if (returnValue == null) // Must be the end of the controller
+        {
+            if (res != null) {
+                res.sampleEnd();
                 res.setResponseMessage("Number of samples in transaction : " + calls + ", number of failing samples : " + noFailingSamples);
                 if(res.isSuccessful()) {
                     res.setResponseCodeOK();
                 }
 
-				// TODO could these be done earlier (or just once?)
+                // TODO could these be done earlier (or just once?)
                 JMeterContext threadContext = getThreadContext();
                 JMeterVariables threadVars = threadContext.getVariables();
 
-				SamplePackage pack = (SamplePackage) threadVars.getObject(JMeterThread.PACKAGE_OBJECT);
-				if (pack == null) {
-					log.warn("Could not fetch SamplePackage");
-				} else {
+                SamplePackage pack = (SamplePackage) threadVars.getObject(JMeterThread.PACKAGE_OBJECT);
+                if (pack == null) {
+                    log.warn("Could not fetch SamplePackage");
+                } else {
                     SampleEvent event = new SampleEvent(res, threadContext.getThreadGroup().getName(),threadVars);
                     // We must set res to null now, before sending the event for the transaction,
-                    // so that we can ignore that event in our sampleOccured method 
+                    // so that we can ignore that event in our sampleOccured method
                     res = null;
-					lnf.notifyListeners(event, pack.getSampleListeners());
-				}
-			}
-		}
+                    lnf.notifyListeners(event, pack.getSampleListeners());
+                }
+            }
+        }
         else {
             // We have sampled one of our children
-            calls++;            
+            calls++;
         }
 
-		return returnValue;
-	}
-    
+        return returnValue;
+    }
+
     public void sampleOccurred(SampleEvent se) {
-    	if (!isParent()) {
-	        // Check if we are still sampling our children
-	        if(res != null) {
-	            SampleResult sampleResult = se.getResult(); 
-	            res.setThreadName(sampleResult.getThreadName());
-	            res.setBytes(res.getBytes() + sampleResult.getBytes());
-	            if(!sampleResult.isSuccessful()) {
-	                res.setSuccessful(false);
-	                noFailingSamples++;
-	            }
-	        }
+        if (!isParent()) {
+            // Check if we are still sampling our children
+            if(res != null) {
+                SampleResult sampleResult = se.getResult();
+                res.setThreadName(sampleResult.getThreadName());
+                res.setBytes(res.getBytes() + sampleResult.getBytes());
+                if(!sampleResult.isSuccessful()) {
+                    res.setSuccessful(false);
+                    noFailingSamples++;
+                }
+            }
         }
     }
 

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionSampler.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionSampler.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionSampler.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/TransactionSampler.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 /*
@@ -30,52 +30,52 @@
 
 /**
  * Transaction Controller to measure transaction times
- * 
+ *
  */
 public class TransactionSampler extends AbstractSampler {
   private boolean transactionDone = false;
 
-    private TransactionController transactionController; 
-    
-	private Sampler subSampler;
+    private TransactionController transactionController;
 
-	private SampleResult transactionSampleResult;
+    private Sampler subSampler;
 
-	private int calls = 0;
+    private SampleResult transactionSampleResult;
 
-	private int noFailingSamples = 0;
+    private int calls = 0;
 
-	public TransactionSampler(){
-		//log.warn("Constructor only intended for use in testing");
-	}
+    private int noFailingSamples = 0;
 
-	public TransactionSampler(TransactionController controller, String name) {
+    public TransactionSampler(){
+        //log.warn("Constructor only intended for use in testing");
+    }
+
+    public TransactionSampler(TransactionController controller, String name) {
         transactionController = controller;
-		setName(name); // ensure name is available for debugging
-		transactionSampleResult = new SampleResult();
-		transactionSampleResult.setSampleLabel(name);
-		// Assume success
-		transactionSampleResult.setSuccessful(true);
-		transactionSampleResult.sampleStart();
-	}
+        setName(name); // ensure name is available for debugging
+        transactionSampleResult = new SampleResult();
+        transactionSampleResult.setSampleLabel(name);
+        // Assume success
+        transactionSampleResult.setSuccessful(true);
+        transactionSampleResult.sampleStart();
+    }
 
     /**
      * One cannot sample the TransactionSample directly.
      */
-	public SampleResult sample(Entry e) {
+    public SampleResult sample(Entry e) {
         // It is the JMeterThread which knows how to sample a
         // real sampler
         return null;
-	}
-    
+    }
+
     public Sampler getSubSampler() {
         return subSampler;
     }
-    
+
     public SampleResult getTransactionResult() {
         return transactionSampleResult;
     }
-    
+
     public TransactionController getTransactionController() {
         return transactionController;
     }
@@ -83,7 +83,7 @@
     public boolean isTransactionDone() {
         return transactionDone;
     }
-    
+
     public void addSubSamplerResult(SampleResult res) {
         // Another subsample for the transaction
         calls++;
@@ -96,19 +96,19 @@
         transactionSampleResult.addSubResult(res);
     }
 
-	protected void setTransactionDone() {
-		this.transactionDone = true;
-		// Set the overall status for the transaction sample
-		// TODO: improve, e.g. by adding counts to the SampleResult class
-		transactionSampleResult.setResponseMessage("Number of samples in transaction : "
-						+ calls + ", number of failing samples : "
-						+ noFailingSamples);
-		if (transactionSampleResult.isSuccessful()) {
-			transactionSampleResult.setResponseCodeOK();
-		}
-	}
-
-	protected void setSubSampler(Sampler subSampler) {
-		this.subSampler = subSampler;
-	}
+    protected void setTransactionDone() {
+        this.transactionDone = true;
+        // Set the overall status for the transaction sample
+        // TODO: improve, e.g. by adding counts to the SampleResult class
+        transactionSampleResult.setResponseMessage("Number of samples in transaction : "
+                        + calls + ", number of failing samples : "
+                        + noFailingSamples);
+        if (transactionSampleResult.isSuccessful()) {
+            transactionSampleResult.setResponseCodeOK();
+        }
+    }
+
+    protected void setSubSampler(Sampler subSampler) {
+        this.subSampler = subSampler;
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/WhileController.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control;
@@ -32,84 +32,84 @@
 // @see TestWhileController for unit tests
 
 public class WhileController extends GenericController implements Serializable {
-	private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = LoggingManager.getLoggerForClass();
 
-	private static final long serialVersionUID = 232L;
-	
-	private static final String CONDITION = "WhileController.condition"; // $NON-NLS-1$
-
-	public WhileController() {
-	}
-
-	/*
-	 * Evaluate the condition, which can be: 
-	 * blank or LAST = was the last sampler OK? 
-	 * otherwise, evaluate the condition to see if it is not "false"
-	 * If blank, only evaluate at the end of the loop
-	 * 
-	 * Must only be called at start and end of loop
-	 * 
-	 * @param loopEnd - are we at loop end? 
-	 * @return true means OK to continue
-	 */
-	private boolean endOfLoop(boolean loopEnd) {
-		String cnd = getCondition();
-		log.debug("Condition string:" + cnd+".");
-		boolean res;
-		// If blank, only check previous sample when at end of loop
-		if ((loopEnd && cnd.length() == 0) || "LAST".equalsIgnoreCase(cnd)) {// $NON-NLS-1$
-			JMeterVariables threadVars = JMeterContextService.getContext().getVariables();
-			res = "false".equalsIgnoreCase(threadVars.get(JMeterThread.LAST_SAMPLE_OK));// $NON-NLS-1$
-		} else {
-			// cnd may be null if next() called us
-			res = "false".equalsIgnoreCase(cnd);// $NON-NLS-1$
-		}
-		log.debug("Condition value: " + res);
-		return res;
-	}
-
-	/*
-	 * (non-Javadoc) Only called at End of Loop
-	 * 
-	 * @see org.apache.jmeter.control.GenericController#nextIsNull()
-	 */
-	protected Sampler nextIsNull() throws NextIsNullException {
-		reInitialize();
-		if (endOfLoop(true)){
-			return null;
-		}
-		return next();
-	}
-
-	/*
-	 * This skips controller entirely if the condition is false on first entry.
-	 */
-	public Sampler next(){
-		if (isFirst()){
-			if (endOfLoop(false)){
-				return null;
-			}
-		}
-		return super.next();
-	}
-
-	/**
-	 * @param string
-	 *            the condition to save
-	 */
-	public void setCondition(String string) {
-		log.debug("setCondition(" + string + ")");
-		setProperty(new StringProperty(CONDITION, string));
-	}
-
-	/**
-	 * @return the condition
-	 */
-	public String getCondition() {
-		String cnd;
+    private static final long serialVersionUID = 232L;
+
+    private static final String CONDITION = "WhileController.condition"; // $NON-NLS-1$
+
+    public WhileController() {
+    }
+
+    /*
+     * Evaluate the condition, which can be:
+     * blank or LAST = was the last sampler OK?
+     * otherwise, evaluate the condition to see if it is not "false"
+     * If blank, only evaluate at the end of the loop
+     *
+     * Must only be called at start and end of loop
+     *
+     * @param loopEnd - are we at loop end?
+     * @return true means OK to continue
+     */
+    private boolean endOfLoop(boolean loopEnd) {
+        String cnd = getCondition();
+        log.debug("Condition string:" + cnd+".");
+        boolean res;
+        // If blank, only check previous sample when at end of loop
+        if ((loopEnd && cnd.length() == 0) || "LAST".equalsIgnoreCase(cnd)) {// $NON-NLS-1$
+            JMeterVariables threadVars = JMeterContextService.getContext().getVariables();
+            res = "false".equalsIgnoreCase(threadVars.get(JMeterThread.LAST_SAMPLE_OK));// $NON-NLS-1$
+        } else {
+            // cnd may be null if next() called us
+            res = "false".equalsIgnoreCase(cnd);// $NON-NLS-1$
+        }
+        log.debug("Condition value: " + res);
+        return res;
+    }
+
+    /*
+     * (non-Javadoc) Only called at End of Loop
+     *
+     * @see org.apache.jmeter.control.GenericController#nextIsNull()
+     */
+    protected Sampler nextIsNull() throws NextIsNullException {
+        reInitialize();
+        if (endOfLoop(true)){
+            return null;
+        }
+        return next();
+    }
+
+    /*
+     * This skips controller entirely if the condition is false on first entry.
+     */
+    public Sampler next(){
+        if (isFirst()){
+            if (endOfLoop(false)){
+                return null;
+            }
+        }
+        return super.next();
+    }
+
+    /**
+     * @param string
+     *            the condition to save
+     */
+    public void setCondition(String string) {
+        log.debug("setCondition(" + string + ")");
+        setProperty(new StringProperty(CONDITION, string));
+    }
+
+    /**
+     * @return the condition
+     */
+    public String getCondition() {
+        String cnd;
         JMeterProperty prop=getProperty(CONDITION);
         prop.recoverRunningVersion(this);
-		cnd = prop.getStringValue();
-		return cnd;
-	}
+        cnd = prop.getStringValue();
+        return cnd;
+    }
 }
\ No newline at end of file

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/AbstractControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/AbstractControllerGui.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/AbstractControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/AbstractControllerGui.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control.gui;
@@ -28,35 +28,35 @@
 
 /**
  * This is the base class for JMeter GUI components which manage controllers.
- * 
+ *
  * @version $Revision$ on $Date$
  */
 public abstract class AbstractControllerGui extends AbstractJMeterGuiComponent {
-	/**
-	 * When a user right-clicks on the component in the test tree, or selects
-	 * the edit menu when the component is selected, the component will be asked
-	 * to return a JPopupMenu that provides all the options available to the
-	 * user from this component.
-	 * <p>
-	 * This implementation returns menu items appropriate for most controller
-	 * components.
-	 * 
-	 * @return a JPopupMenu appropriate for the component.
-	 */
-	public JPopupMenu createPopupMenu() {
-		return MenuFactory.getDefaultControllerMenu();
-	}
-
-	/**
-	 * This is the list of menu categories this gui component will be available
-	 * under. This implementation returns
-	 * {@link org.apache.jmeter.gui.util.MenuFactory#CONTROLLERS}, which is
-	 * appropriate for most controller components.
-	 * 
-	 * @return a Collection of Strings, where each element is one of the
-	 *         constants defined in MenuFactory
-	 */
-	public Collection getMenuCategories() {
-		return Arrays.asList(new String[] { MenuFactory.CONTROLLERS });
-	}
+    /**
+     * When a user right-clicks on the component in the test tree, or selects
+     * the edit menu when the component is selected, the component will be asked
+     * to return a JPopupMenu that provides all the options available to the
+     * user from this component.
+     * <p>
+     * This implementation returns menu items appropriate for most controller
+     * components.
+     *
+     * @return a JPopupMenu appropriate for the component.
+     */
+    public JPopupMenu createPopupMenu() {
+        return MenuFactory.getDefaultControllerMenu();
+    }
+
+    /**
+     * This is the list of menu categories this gui component will be available
+     * under. This implementation returns
+     * {@link org.apache.jmeter.gui.util.MenuFactory#CONTROLLERS}, which is
+     * appropriate for most controller components.
+     *
+     * @return a Collection of Strings, where each element is one of the
+     *         constants defined in MenuFactory
+     */
+    public Collection getMenuCategories() {
+        return Arrays.asList(new String[] { MenuFactory.CONTROLLERS });
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/IfControllerPanel.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control.gui;
@@ -37,88 +37,88 @@
  * The user interface for a controller which specifies that its subcomponents
  * should be executed while a condition holds. This component can be used
  * standalone or embedded into some other component.
- * 
+ *
  */
 
 public class IfControllerPanel extends AbstractControllerGui implements ActionListener {
 
-	/**
-	 * A field allowing the user to specify the number of times the controller
-	 * should loop.
-	 */
-	private JTextField theCondition;
-	
-	private JCheckBox evaluateAll;
-
-	/**
-	 * Boolean indicating whether or not this component should display its name.
-	 * If true, this is a standalone component. If false, this component is
-	 * intended to be used as a subpanel for another component.
-	 */
-	private boolean displayName = true;
-
-	/**
-	 * Create a new LoopControlPanel as a standalone component.
-	 */
-	public IfControllerPanel() {
-		this(true);
-	}
-
-	/**
-	 * Create a new IfControllerPanel as either a standalone or an embedded
-	 * component.
-	 * 
-	 * @param displayName
-	 *            indicates whether or not this component should display its
-	 *            name. If true, this is a standalone component. If false, this
-	 *            component is intended to be used as a subpanel for another
-	 *            component.
-	 */
-	public IfControllerPanel(boolean displayName) {
-		this.displayName = displayName;
-		init();
-	}
-
-	/**
-	 * A newly created component can be initialized with the contents of a Test
-	 * Element object by calling this method. The component is responsible for
-	 * querying the Test Element object for the relevant information to display
-	 * in its GUI.
-	 * 
-	 * @param element
-	 *            the TestElement to configure
-	 */
-	public void configure(TestElement element) {
-		super.configure(element);
-		if (element instanceof IfController) {
-			IfController ifController = (IfController) element;
-			theCondition.setText(ifController.getCondition());
-			evaluateAll.setSelected(ifController.isEvaluateAll());
-		}
-
-	}
-
-	/**
-	 * Implements JMeterGUIComponent.createTestElement()
-	 */
-	public TestElement createTestElement() {
-		IfController controller = new IfController();
-		modifyTestElement(controller);
-		return controller;
-	}
-
-	/**
-	 * Implements JMeterGUIComponent.modifyTestElement(TestElement)
-	 */
-	public void modifyTestElement(TestElement controller) {
-		configureTestElement(controller);
-		if (controller instanceof IfController) {
-			IfController ifController = (IfController) controller;
-			ifController.setCondition(theCondition.getText());
-			ifController.setEvaluateAll(evaluateAll.isSelected());
-		}
-	}
-    
+    /**
+     * A field allowing the user to specify the number of times the controller
+     * should loop.
+     */
+    private JTextField theCondition;
+
+    private JCheckBox evaluateAll;
+
+    /**
+     * Boolean indicating whether or not this component should display its name.
+     * If true, this is a standalone component. If false, this component is
+     * intended to be used as a subpanel for another component.
+     */
+    private boolean displayName = true;
+
+    /**
+     * Create a new LoopControlPanel as a standalone component.
+     */
+    public IfControllerPanel() {
+        this(true);
+    }
+
+    /**
+     * Create a new IfControllerPanel as either a standalone or an embedded
+     * component.
+     *
+     * @param displayName
+     *            indicates whether or not this component should display its
+     *            name. If true, this is a standalone component. If false, this
+     *            component is intended to be used as a subpanel for another
+     *            component.
+     */
+    public IfControllerPanel(boolean displayName) {
+        this.displayName = displayName;
+        init();
+    }
+
+    /**
+     * A newly created component can be initialized with the contents of a Test
+     * Element object by calling this method. The component is responsible for
+     * querying the Test Element object for the relevant information to display
+     * in its GUI.
+     *
+     * @param element
+     *            the TestElement to configure
+     */
+    public void configure(TestElement element) {
+        super.configure(element);
+        if (element instanceof IfController) {
+            IfController ifController = (IfController) element;
+            theCondition.setText(ifController.getCondition());
+            evaluateAll.setSelected(ifController.isEvaluateAll());
+        }
+
+    }
+
+    /**
+     * Implements JMeterGUIComponent.createTestElement()
+     */
+    public TestElement createTestElement() {
+        IfController controller = new IfController();
+        modifyTestElement(controller);
+        return controller;
+    }
+
+    /**
+     * Implements JMeterGUIComponent.modifyTestElement(TestElement)
+     */
+    public void modifyTestElement(TestElement controller) {
+        configureTestElement(controller);
+        if (controller instanceof IfController) {
+            IfController ifController = (IfController) controller;
+            ifController.setCondition(theCondition.getText());
+            ifController.setEvaluateAll(evaluateAll.isSelected());
+        }
+    }
+
     /**
      * Implements JMeterGUIComponent.clearGui
      */
@@ -128,66 +128,66 @@
         evaluateAll.setSelected(false);
     }
 
-	/**
-	 * Invoked when an action occurs. This implementation assumes that the
-	 * target component is the infinite loops checkbox.
-	 * 
-	 * @param event
-	 *            the event that has occurred
-	 */
-	public void actionPerformed(ActionEvent event) {
-		new FocusRequester(theCondition);
-	}
-
-	public String getLabelResource() {
-		return "if_controller_title"; // $NON-NLS-1$
-	}
-
-	/**
-	 * Initialize the GUI components and layout for this component.
-	 */
-	private void init() {
-		// Standalone
-		if (displayName) {
-			setLayout(new BorderLayout(0, 5));
-			setBorder(makeBorder());
-			add(makeTitlePanel(), BorderLayout.NORTH);
-
-			JPanel mainPanel = new JPanel(new BorderLayout());
-			mainPanel.add(createConditionPanel(), BorderLayout.NORTH);
-			add(mainPanel, BorderLayout.CENTER);
-
-		} else {
-			// Embedded
-			setLayout(new BorderLayout());
-			add(createConditionPanel(), BorderLayout.NORTH);
-		}
-	}
-
-	/**
-	 * Create a GUI panel containing the condition.
-	 * 
-	 * @return a GUI panel containing the condition components
-	 */
-	private JPanel createConditionPanel() {
-		JPanel conditionPanel = new JPanel(new BorderLayout(5, 0));
-
-		// Condition LABEL
-		JLabel conditionLabel = new JLabel(JMeterUtils.getResString("if_controller_label")); // $NON-NLS-1$
-		conditionPanel.add(conditionLabel, BorderLayout.WEST);
-
-		// TEXT FIELD
-		theCondition = new JTextField(""); // $NON-NLS-1$
-		conditionLabel.setLabelFor(theCondition);
-		conditionPanel.add(theCondition, BorderLayout.CENTER);
-		theCondition.addActionListener(this);
-
-		conditionPanel.add(Box.createHorizontalStrut(conditionLabel.getPreferredSize().width
-				+ theCondition.getPreferredSize().width), BorderLayout.NORTH);
-
-		// Evaluate All checkbox
-		evaluateAll = new JCheckBox(JMeterUtils.getResString("if_controller_evaluate_all")); // $NON-NLS-1$
-		conditionPanel.add(evaluateAll,BorderLayout.SOUTH);
-		return conditionPanel;
-	}
+    /**
+     * Invoked when an action occurs. This implementation assumes that the
+     * target component is the infinite loops checkbox.
+     *
+     * @param event
+     *            the event that has occurred
+     */
+    public void actionPerformed(ActionEvent event) {
+        new FocusRequester(theCondition);
+    }
+
+    public String getLabelResource() {
+        return "if_controller_title"; // $NON-NLS-1$
+    }
+
+    /**
+     * Initialize the GUI components and layout for this component.
+     */
+    private void init() {
+        // Standalone
+        if (displayName) {
+            setLayout(new BorderLayout(0, 5));
+            setBorder(makeBorder());
+            add(makeTitlePanel(), BorderLayout.NORTH);
+
+            JPanel mainPanel = new JPanel(new BorderLayout());
+            mainPanel.add(createConditionPanel(), BorderLayout.NORTH);
+            add(mainPanel, BorderLayout.CENTER);
+
+        } else {
+            // Embedded
+            setLayout(new BorderLayout());
+            add(createConditionPanel(), BorderLayout.NORTH);
+        }
+    }
+
+    /**
+     * Create a GUI panel containing the condition.
+     *
+     * @return a GUI panel containing the condition components
+     */
+    private JPanel createConditionPanel() {
+        JPanel conditionPanel = new JPanel(new BorderLayout(5, 0));
+
+        // Condition LABEL
+        JLabel conditionLabel = new JLabel(JMeterUtils.getResString("if_controller_label")); // $NON-NLS-1$
+        conditionPanel.add(conditionLabel, BorderLayout.WEST);
+
+        // TEXT FIELD
+        theCondition = new JTextField(""); // $NON-NLS-1$
+        conditionLabel.setLabelFor(theCondition);
+        conditionPanel.add(theCondition, BorderLayout.CENTER);
+        theCondition.addActionListener(this);
+
+        conditionPanel.add(Box.createHorizontalStrut(conditionLabel.getPreferredSize().width
+                + theCondition.getPreferredSize().width), BorderLayout.NORTH);
+
+        // Evaluate All checkbox
+        evaluateAll = new JCheckBox(JMeterUtils.getResString("if_controller_evaluate_all")); // $NON-NLS-1$
+        conditionPanel.add(evaluateAll,BorderLayout.SOUTH);
+        return conditionPanel;
+    }
 }
\ No newline at end of file

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/LogicControllerGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/LogicControllerGui.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/LogicControllerGui.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/LogicControllerGui.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control.gui;
@@ -25,38 +25,38 @@
 
 /**
  * A generic controller component.
- * 
+ *
  */
 public class LogicControllerGui extends AbstractControllerGui {
-	/**
-	 * Create a new LogicControllerGui instance.
-	 */
-	public LogicControllerGui() {
-		init();
-	}
-
-	/* Implements JMeterGUIComponent.createTestElement() */
-	public TestElement createTestElement() {
-		GenericController lc = new GenericController();
-		configureTestElement(lc);
-		return lc;
-	}
-
-	/* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
-	public void modifyTestElement(TestElement el) {
-		configureTestElement(el);
-	}
-
-	public String getLabelResource() {
-		return "logic_controller_title"; // $NON-NLS-1$
-	}
-
-	/**
-	 * Initialize the GUI components and layout for this component.
-	 */
-	private void init() {
-		setLayout(new BorderLayout());
-		setBorder(makeBorder());
-		add(makeTitlePanel(), BorderLayout.NORTH);
-	}
+    /**
+     * Create a new LogicControllerGui instance.
+     */
+    public LogicControllerGui() {
+        init();
+    }
+
+    /* Implements JMeterGUIComponent.createTestElement() */
+    public TestElement createTestElement() {
+        GenericController lc = new GenericController();
+        configureTestElement(lc);
+        return lc;
+    }
+
+    /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
+    public void modifyTestElement(TestElement el) {
+        configureTestElement(el);
+    }
+
+    public String getLabelResource() {
+        return "logic_controller_title"; // $NON-NLS-1$
+    }
+
+    /**
+     * Initialize the GUI components and layout for this component.
+     */
+    private void init() {
+        setLayout(new BorderLayout());
+        setBorder(makeBorder());
+        add(makeTitlePanel(), BorderLayout.NORTH);
+    }
 }

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java?rev=674362&r1=674361&r2=674362&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/control/gui/LoopControlPanel.java Sun Jul  6 16:42:12 2008
@@ -13,7 +13,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  */
 
 package org.apache.jmeter.control.gui;
@@ -37,224 +37,224 @@
  * The user interface for a controller which specifies that its subcomponents
  * should be executed some number of times in a loop. This component can be used
  * standalone or embedded into some other component.
- * 
+ *
  */
 
 public class LoopControlPanel extends AbstractControllerGui implements ActionListener {
-	/**
-	 * A checkbox allowing the user to specify whether or not the controller
-	 * should loop forever.
-	 */
-	private JCheckBox infinite;
-
-	/**
-	 * A field allowing the user to specify the number of times the controller
-	 * should loop.
-	 */
-	private JTextField loops;
-
-	/**
-	 * Boolean indicating whether or not this component should display its name.
-	 * If true, this is a standalone component. If false, this component is
-	 * intended to be used as a subpanel for another component.
-	 */
-	private boolean displayName = true;
-
-	/** The name of the infinite checkbox component. */
-	private static final String INFINITE = "Infinite Field"; // $NON-NLS-1$
-
-	/** The name of the loops field component. */
-	private static final String LOOPS = "Loops Field"; // $NON-NLS-1$
-
-	/**
-	 * Create a new LoopControlPanel as a standalone component.
-	 */
-	public LoopControlPanel() {
-		this(true);
-	}
-
-	/**
-	 * Create a new LoopControlPanel as either a standalone or an embedded
-	 * component.
-	 * 
-	 * @param displayName
-	 *            indicates whether or not this component should display its
-	 *            name. If true, this is a standalone component. If false, this
-	 *            component is intended to be used as a subpanel for another
-	 *            component.
-	 */
-	public LoopControlPanel(boolean displayName) {
-		this.displayName = displayName;
-		init();
-		setState(1);
-	}
-
-	/**
-	 * A newly created component can be initialized with the contents of a Test
-	 * Element object by calling this method. The component is responsible for
-	 * querying the Test Element object for the relevant information to display
-	 * in its GUI.
-	 * 
-	 * @param element
-	 *            the TestElement to configure
-	 */
-	public void configure(TestElement element) {
-		super.configure(element);
-		if (element instanceof LoopController) {
-			setState(((LoopController) element).getLoopString());
-		} else {
-			setState(1);
-		}
-	}
-
-	/* Implements JMeterGUIComponent.createTestElement() */
-	public TestElement createTestElement() {
-		LoopController lc = new LoopController();
-		modifyTestElement(lc);
-		return lc;
-	}
-
-	/* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
-	public void modifyTestElement(TestElement lc) {
-		configureTestElement(lc);
-		if (lc instanceof LoopController) {
-			if (loops.getText().length() > 0) {
-				((LoopController) lc).setLoops(loops.getText());
-			} else {
-				((LoopController) lc).setLoops(-1);
-			}
-		}
-	}
+    /**
+     * A checkbox allowing the user to specify whether or not the controller
+     * should loop forever.
+     */
+    private JCheckBox infinite;
+
+    /**
+     * A field allowing the user to specify the number of times the controller
+     * should loop.
+     */
+    private JTextField loops;
+
+    /**
+     * Boolean indicating whether or not this component should display its name.
+     * If true, this is a standalone component. If false, this component is
+     * intended to be used as a subpanel for another component.
+     */
+    private boolean displayName = true;
+
+    /** The name of the infinite checkbox component. */
+    private static final String INFINITE = "Infinite Field"; // $NON-NLS-1$
+
+    /** The name of the loops field component. */
+    private static final String LOOPS = "Loops Field"; // $NON-NLS-1$
+
+    /**
+     * Create a new LoopControlPanel as a standalone component.
+     */
+    public LoopControlPanel() {
+        this(true);
+    }
+
+    /**
+     * Create a new LoopControlPanel as either a standalone or an embedded
+     * component.
+     *
+     * @param displayName
+     *            indicates whether or not this component should display its
+     *            name. If true, this is a standalone component. If false, this
+     *            component is intended to be used as a subpanel for another
+     *            component.
+     */
+    public LoopControlPanel(boolean displayName) {
+        this.displayName = displayName;
+        init();
+        setState(1);
+    }
+
+    /**
+     * A newly created component can be initialized with the contents of a Test
+     * Element object by calling this method. The component is responsible for
+     * querying the Test Element object for the relevant information to display
+     * in its GUI.
+     *
+     * @param element
+     *            the TestElement to configure
+     */
+    public void configure(TestElement element) {
+        super.configure(element);
+        if (element instanceof LoopController) {
+            setState(((LoopController) element).getLoopString());
+        } else {
+            setState(1);
+        }
+    }
+
+    /* Implements JMeterGUIComponent.createTestElement() */
+    public TestElement createTestElement() {
+        LoopController lc = new LoopController();
+        modifyTestElement(lc);
+        return lc;
+    }
+
+    /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
+    public void modifyTestElement(TestElement lc) {
+        configureTestElement(lc);
+        if (lc instanceof LoopController) {
+            if (loops.getText().length() > 0) {
+                ((LoopController) lc).setLoops(loops.getText());
+            } else {
+                ((LoopController) lc).setLoops(-1);
+            }
+        }
+    }
 
     /**
      * Implements JMeterGUIComponent.clearGui
      */
     public void clearGui() {
         super.clearGui();
-        
+
         loops.setText("1"); // $NON-NLS-1$
         infinite.setSelected(false);
     }
 
-	/**
-	 * Invoked when an action occurs. This implementation assumes that the
-	 * target component is the infinite loops checkbox.
-	 * 
-	 * @param event
-	 *            the event that has occurred
-	 */
-	public void actionPerformed(ActionEvent event) {
-		if (infinite.isSelected()) {
-			loops.setText(""); // $NON-NLS-1$
-			loops.setEnabled(false);
-		} else {
-			loops.setEnabled(true);
-			new FocusRequester(loops);
-		}
-	}
-
-	public String getLabelResource() {
-		return "loop_controller_title"; // $NON-NLS-1$
-	}
-
-	/**
-	 * Initialize the GUI components and layout for this component.
-	 */
-	private void init() {
-		// The Loop Controller panel can be displayed standalone or inside
-		// another panel. For standalone, we want to display the TITLE, NAME,
-		// etc. (everything). However, if we want to display it within another
-		// panel, we just display the Loop Count fields (not the TITLE and
-		// NAME).
-
-		// Standalone
-		if (displayName) {
-			setLayout(new BorderLayout(0, 5));
-			setBorder(makeBorder());
-			add(makeTitlePanel(), BorderLayout.NORTH);
-
-			JPanel mainPanel = new JPanel(new BorderLayout());
-			mainPanel.add(createLoopCountPanel(), BorderLayout.NORTH);
-			add(mainPanel, BorderLayout.CENTER);
-		} else {
-			// Embedded
-			setLayout(new BorderLayout());
-			add(createLoopCountPanel(), BorderLayout.NORTH);
-		}
-	}
-
-	/**
-	 * Create a GUI panel containing the components related to the number of
-	 * loops which should be executed.
-	 * 
-	 * @return a GUI panel containing the loop count components
-	 */
-	private JPanel createLoopCountPanel() {
-		JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
-
-		// LOOP LABEL
-		JLabel loopsLabel = new JLabel(JMeterUtils.getResString("iterator_num")); // $NON-NLS-1$
-		loopPanel.add(loopsLabel, BorderLayout.WEST);
-
-		JPanel loopSubPanel = new JPanel(new BorderLayout(5, 0));
-
-		// TEXT FIELD
-		loops = new JTextField("1", 5); // $NON-NLS-1$
-		loops.setName(LOOPS);
-		loopsLabel.setLabelFor(loops);
-		loopSubPanel.add(loops, BorderLayout.CENTER);
-
-		// FOREVER CHECKBOX
-		infinite = new JCheckBox(JMeterUtils.getResString("infinite")); // $NON-NLS-1$
-		infinite.setActionCommand(INFINITE);
-		infinite.addActionListener(this);
-		loopSubPanel.add(infinite, BorderLayout.WEST);
-
-		loopPanel.add(loopSubPanel, BorderLayout.CENTER);
-
-		loopPanel.add(Box.createHorizontalStrut(loopsLabel.getPreferredSize().width + loops.getPreferredSize().width
-				+ infinite.getPreferredSize().width), BorderLayout.NORTH);
-
-		return loopPanel;
-	}
-
-	/**
-	 * Set the number of loops which should be reflected in the GUI. The
-	 * loopCount parameter should contain the String representation of an
-	 * integer. This integer will be treated as the number of loops. If this
-	 * integer is less than 0, the number of loops will be assumed to be
-	 * infinity.
-	 * 
-	 * @param loopCount
-	 *            the String representation of the number of loops
-	 */
-	private void setState(String loopCount) {
-		if (loopCount.startsWith("-")) { // $NON-NLS-1$
-			setState(-1);
-		} else {
-			loops.setText(loopCount);
-			infinite.setSelected(false);
-			loops.setEnabled(true);
-		}
-	}
-
-	/**
-	 * Set the number of loops which should be reflected in the GUI. If the
-	 * loopCount is less than 0, the number of loops will be assumed to be
-	 * infinity.
-	 * 
-	 * @param loopCount
-	 *            the number of loops
-	 */
-	private void setState(int loopCount) {
-		if (loopCount <= -1) {
-			infinite.setSelected(true);
-			loops.setEnabled(false);
-			loops.setText(""); // $NON-NLS-1$
-		} else {
-			infinite.setSelected(false);
-			loops.setEnabled(true);
-			loops.setText(Integer.toString(loopCount));
-		}
-	}
+    /**
+     * Invoked when an action occurs. This implementation assumes that the
+     * target component is the infinite loops checkbox.
+     *
+     * @param event
+     *            the event that has occurred
+     */
+    public void actionPerformed(ActionEvent event) {
+        if (infinite.isSelected()) {
+            loops.setText(""); // $NON-NLS-1$
+            loops.setEnabled(false);
+        } else {
+            loops.setEnabled(true);
+            new FocusRequester(loops);
+        }
+    }
+
+    public String getLabelResource() {
+        return "loop_controller_title"; // $NON-NLS-1$
+    }
+
+    /**
+     * Initialize the GUI components and layout for this component.
+     */
+    private void init() {
+        // The Loop Controller panel can be displayed standalone or inside
+        // another panel. For standalone, we want to display the TITLE, NAME,
+        // etc. (everything). However, if we want to display it within another
+        // panel, we just display the Loop Count fields (not the TITLE and
+        // NAME).
+
+        // Standalone
+        if (displayName) {
+            setLayout(new BorderLayout(0, 5));
+            setBorder(makeBorder());
+            add(makeTitlePanel(), BorderLayout.NORTH);
+
+            JPanel mainPanel = new JPanel(new BorderLayout());
+            mainPanel.add(createLoopCountPanel(), BorderLayout.NORTH);
+            add(mainPanel, BorderLayout.CENTER);
+        } else {
+            // Embedded
+            setLayout(new BorderLayout());
+            add(createLoopCountPanel(), BorderLayout.NORTH);
+        }
+    }
+
+    /**
+     * Create a GUI panel containing the components related to the number of
+     * loops which should be executed.
+     *
+     * @return a GUI panel containing the loop count components
+     */
+    private JPanel createLoopCountPanel() {
+        JPanel loopPanel = new JPanel(new BorderLayout(5, 0));
+
+        // LOOP LABEL
+        JLabel loopsLabel = new JLabel(JMeterUtils.getResString("iterator_num")); // $NON-NLS-1$
+        loopPanel.add(loopsLabel, BorderLayout.WEST);
+
+        JPanel loopSubPanel = new JPanel(new BorderLayout(5, 0));
+
+        // TEXT FIELD
+        loops = new JTextField("1", 5); // $NON-NLS-1$
+        loops.setName(LOOPS);
+        loopsLabel.setLabelFor(loops);
+        loopSubPanel.add(loops, BorderLayout.CENTER);
+
+        // FOREVER CHECKBOX
+        infinite = new JCheckBox(JMeterUtils.getResString("infinite")); // $NON-NLS-1$
+        infinite.setActionCommand(INFINITE);
+        infinite.addActionListener(this);
+        loopSubPanel.add(infinite, BorderLayout.WEST);
+
+        loopPanel.add(loopSubPanel, BorderLayout.CENTER);
+
+        loopPanel.add(Box.createHorizontalStrut(loopsLabel.getPreferredSize().width + loops.getPreferredSize().width
+                + infinite.getPreferredSize().width), BorderLayout.NORTH);
+
+        return loopPanel;
+    }
+
+    /**
+     * Set the number of loops which should be reflected in the GUI. The
+     * loopCount parameter should contain the String representation of an
+     * integer. This integer will be treated as the number of loops. If this
+     * integer is less than 0, the number of loops will be assumed to be
+     * infinity.
+     *
+     * @param loopCount
+     *            the String representation of the number of loops
+     */
+    private void setState(String loopCount) {
+        if (loopCount.startsWith("-")) { // $NON-NLS-1$
+            setState(-1);
+        } else {
+            loops.setText(loopCount);
+            infinite.setSelected(false);
+            loops.setEnabled(true);
+        }
+    }
+
+    /**
+     * Set the number of loops which should be reflected in the GUI. If the
+     * loopCount is less than 0, the number of loops will be assumed to be
+     * infinity.
+     *
+     * @param loopCount
+     *            the number of loops
+     */
+    private void setState(int loopCount) {
+        if (loopCount <= -1) {
+            infinite.setSelected(true);
+            loops.setEnabled(false);
+            loops.setText(""); // $NON-NLS-1$
+        } else {
+            infinite.setSelected(false);
+            loops.setEnabled(true);
+            loops.setText(Integer.toString(loopCount));
+        }
+    }
 }



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