|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.control.GenericController
public class GenericController
This class is the basis for all the controllers. It also implements SimpleController.
The main entry point is next(), which is called by by JMeterThread as follows:
while (running && (sampler = controller.next()) != null)
Field Summary | |
---|---|
protected int |
current
Index of current sub controller or sampler |
protected List<TestElement> |
subControllersAndSamplers
|
Fields inherited from interface org.apache.jmeter.testelement.TestElement |
---|
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS |
Constructor Summary | |
---|---|
GenericController()
Creates a Generic Controller |
Method Summary | |
---|---|
void |
addIterationListener(LoopIterationListener lis)
Controllers have to notify listeners of when they begin an iteration through their sub-elements. |
void |
addTestElement(TestElement child)
|
boolean |
addTestElementOnce(TestElement child)
Add child test element only if it has not already been added. |
protected void |
currentReturnedNull(Controller c)
If the controller is done, remove it from the list, otherwise increment to next entry in list. |
protected void |
fireIterationStart()
|
protected void |
fireIterEvents()
|
protected TestElement |
getCurrentElement()
Gets the element indicated by the current index, if one exists,
from the subControllersAndSamplers list. |
protected int |
getIterCount()
|
protected List<TestElement> |
getSubControllers()
Gets the SubControllers attribute of the GenericController object |
protected void |
incrementCurrent()
Increments the current pointer; called by currentReturnedNull to move the controller on to its next child. |
protected void |
incrementIterCount()
|
void |
initialize()
Called to initialize a controller at the beginning of a test iteration. |
protected void |
initializeSubControllers()
(re)Initializes sub controllers See Bug 50032 |
boolean |
isDone()
Indicates whether the Controller is done delivering Samplers for the rest of the test. |
protected boolean |
isFirst()
|
Sampler |
next()
Determines the next sampler to be processed. |
protected Sampler |
nextIsAController(Controller controller)
Called by next() if the element is a Controller, and returns the
next sampler from the controller. |
protected Sampler |
nextIsASampler(Sampler element)
Increment the current pointer and return the element. |
protected Sampler |
nextIsNull()
Called by next() when getCurrentElement() returns null . |
protected Object |
readResolve()
|
protected void |
reInitialize()
Resets the controller (called after execution of last child of controller): resetCurrent() (i.e. current=0) increment iteration count sets first=true recoverRunningVersion() to set the controller back to the initial state |
protected void |
reInitializeSubController()
Deprecated. replaced by GeneriController#initializeSubControllers |
protected void |
removeCurrentElement()
|
void |
removeIterationListener(LoopIterationListener iterationListener)
Remove listener |
protected void |
resetCurrent()
|
protected void |
resetIterCount()
|
protected void |
setCurrentElement(TestElement currentElement)
Empty implementation - does nothing. |
protected void |
setDone(boolean done)
|
void |
setFirst(boolean b)
If b is true, it means first is reset which means Controller has executed all its children |
void |
triggerEndOfLoop()
Trigger end of loop condition on controller (used by Start Next Loop feature) |
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 |
Field Detail |
---|
protected transient List<TestElement> subControllersAndSamplers
protected transient int current
Constructor Detail |
---|
public GenericController()
Method Detail |
---|
public void initialize()
Controller
initialize
in interface Controller
protected void initializeSubControllers()
protected void reInitialize()
public Sampler next()
Determines the next sampler to be processed.
If isDone()
is true
, returns null.
Gets the list element using current pointer.
If this is null
, calls nextIsNull()
.
If the list element is a Sampler
, calls nextIsASampler(Sampler)
,
otherwise calls nextIsAController(Controller)
If any of the called methods throws NextIsNullException
, returns null
,
otherwise the value obtained above is returned.
next
in interface Controller
null
public boolean isDone()
Controller
isDone
in interface Controller
Controller.isDone()
protected void setDone(boolean done)
protected boolean isFirst()
public void setFirst(boolean b)
b
- The flag, whether first is resetedprotected Sampler nextIsAController(Controller controller) throws NextIsNullException
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()
.
controller
- the current next element
NextIsNullException
- when the end of the list has already been reachedprotected Sampler nextIsASampler(Sampler element) throws NextIsNullException
next()
if the element is a sampler. (May be overriden by
sub-classes).
element
- the current next element
NextIsNullException
- when the end of the list has already been reachedprotected Sampler nextIsNull() throws NextIsNullException
next()
when getCurrentElement()
returns null
.
Reinitialises the controller.
NextIsNullException
- when the end of the list has already been reachedpublic void triggerEndOfLoop()
triggerEndOfLoop
in interface Controller
protected void reInitializeSubController()
protected void currentReturnedNull(Controller c)
c
- controllerprotected List<TestElement> getSubControllers()
protected void setCurrentElement(TestElement currentElement) throws NextIsNullException
currentElement
- the current element
NextIsNullException
- when the list has been completed alreadyprotected TestElement getCurrentElement() throws NextIsNullException
Gets the element indicated by the current
index, if one exists,
from the subControllersAndSamplers
list.
If the subControllersAndSamplers
list is empty,
then set done = true, and throw NextIsNullException.
NextIsNullException
- if list is emptyprotected void removeCurrentElement()
protected void incrementCurrent()
protected void resetCurrent()
public void addTestElement(TestElement child)
AbstractTestElement
addTestElement
in interface TestElement
addTestElement
in class AbstractTestElement
public final boolean addTestElementOnce(TestElement child)
Only for use by TestCompiler.
addTestElementOnce
in interface TestCompilerHelper
child
- the TestElement
to be added
true
if the child was addedpublic void addIterationListener(LoopIterationListener lis)
Controller
addIterationListener
in interface Controller
lis
- The LoopIterationListener
to addpublic void removeIterationListener(LoopIterationListener iterationListener)
removeIterationListener
in interface Controller
iterationListener
- LoopIterationListener
protected void fireIterEvents()
protected void fireIterationStart()
protected int getIterCount()
protected void incrementIterCount()
protected void resetIterCount()
protected Object readResolve()
|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |