Apache JMeter

org.apache.jmeter.control
Class SwitchController

java.lang.Object
  extended by org.apache.jmeter.testelement.AbstractTestElement
      extended by org.apache.jmeter.control.GenericController
          extended by org.apache.jmeter.control.SwitchController
All Implemented Interfaces:
Serializable, Cloneable, Controller, Searchable, TestElement, TestCompilerHelper

public class SwitchController
extends GenericController
implements Serializable

Implements a controller which selects at most one of its children based on the condition value, which may be a number or a string.

For numeric input, the controller processes the appropriate child, where the numbering starts from 0. If the number is out of range, then the first (0th) child is selected. If the condition is the empty string, then it is assumed to be 0.

For non-empty non-numeric input, the child is selected by name. This may be the name of the controller or a sampler. If the string does not match any of the names, then the controller with the name "default" (any case) is processed. If there is no default entry, then unlike the numeric case, no child is selected.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.jmeter.control.GenericController
current, subControllersAndSamplers
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
SwitchController()
           
 
Method Summary
 String getSelection()
           
protected  void incrementCurrent()
          incrementCurrent is called when the current child (whether sampler or controller) has been processed.
 Sampler next()
           Determines the next sampler to be processed.
 void setSelection(String inputValue)
           
 
Methods inherited from class org.apache.jmeter.control.GenericController
addIterationListener, addTestElement, addTestElementOnce, currentReturnedNull, fireIterationStart, fireIterEvents, getCurrentElement, getIterCount, getSubControllers, incrementIterCount, initialize, isDone, isFirst, nextIsAController, nextIsASampler, nextIsNull, readResolve, reInitialize, reInitializeSubController, removeCurrentElement, removeIterationListener, resetCurrent, resetIterCount, setCurrentElement, setDone, setFirst, triggerEndOfLoop
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addPropertiesValues, addProperty, addProperty, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jmeter.testelement.TestElement
canRemove, clear, clearTestElementChildren, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
 

Constructor Detail

SwitchController

public SwitchController()
Method Detail

next

public Sampler next()
Description copied from class: GenericController

Determines the next sampler to be processed.

If isDone, returns null.

Gets the list element using current pointer. If this is null, calls GenericController.nextIsNull().

If the list element is a sampler, calls GenericController.nextIsASampler(Sampler), otherwise calls GenericController.nextIsAController(Controller)

If any of the called methods throws NextIsNullException, returns null, otherwise the value obtained above is returned.

Specified by:
next in interface Controller
Overrides:
next in class GenericController
Returns:
the next sampler or null

incrementCurrent

protected void incrementCurrent()
incrementCurrent is called when the current child (whether sampler or controller) has been processed.

Setting it to int.max marks the controller as having processed all its children. Thus the controller processes one child per iteration.

Increments the current pointer; called by currentReturnedNull to move the controller on to its next child.

Overrides:
incrementCurrent in class GenericController

setSelection

public void setSelection(String inputValue)

getSelection

public String getSelection()

Apache JMeter

Copyright © 1998-2013 Apache Software Foundation. All Rights Reserved.