org.apache.jmeter.control

Class SwitchController

Implemented Interfaces:
Cloneable, Serializable, Controller, TestElement

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.

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()
Creates a Generic Controller

Method Summary

String
getSelection()
protected void
incrementCurrent()
Increments the current pointer; called by currentReturnedNull to move the controller on to its next child.
Sampler
next()
Determines the next sampler to be processed.
void
setSelection(String inputValue)

Methods inherited from class org.apache.jmeter.control.GenericController

addIterationListener, addTestElement, currentReturnedNull, fireIterEvents, fireIterationStart, getCurrentElement, getIterCount, getSubControllers, incrementCurrent, incrementIterCount, initialize, isDone, isFirst, next, nextIsAController, nextIsASampler, nextIsNull, reInitialize, removeCurrentElement, resetCurrent, resetIterCount, setCurrentElement, setDone, setFirst

Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

addProperty, addTestElement, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty

Constructor Details

SwitchController

public SwitchController()
Creates a Generic Controller

Method Details

getSelection

public String getSelection()

incrementCurrent

protected void incrementCurrent()
Increments the current pointer; called by currentReturnedNull to move the controller on to its next child.
Overrides:
incrementCurrent in interface GenericController

next

public Sampler next()
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 interface GenericController
Returns:
the next sampler or null

setSelection

public void setSelection(String inputValue)

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