org.specrunner.plugins.core.flow
Class PluginFor

java.lang.Object
  extended by org.specrunner.parameters.core.ParameterHolder
      extended by org.specrunner.plugins.core.AbstractPlugin
          extended by org.specrunner.plugins.core.flow.PluginFor
All Implemented Interfaces:
IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin

public class PluginFor
extends AbstractPlugin

Performs a indexed loop.

Example:

Check the square and cubic roots from 0 to 10, with step 2:
n square cubic
${index} ${index * index} ${index * index * index}

The CSS annotated version:

Check the square and cubic roots from 0 to 10, with step 2:
 <table border=1>
 <tr>
 <th>n</th>
 <th>square</th>
 <th>cubic</th>
 </tr>
 <tbody class="for" min=0 max=10 step=2 var=any>
 <tr>
 <td>${any}</td>
 <td>${any * any}</td>
 <td>${any * any * any}</td>
 </tr>
 <tbody>
 </table>
 

Author:
Thiago Santos

Field Summary
protected  Integer max
          Maximum value.
protected  int min
          Minimum value.
protected  int step
          Step.
protected  String var
          Index variable name.
 
Fields inherited from class org.specrunner.plugins.core.AbstractPlugin
FEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_TIMEOUT, FEATURE_WAIT
 
Constructor Summary
PluginFor()
           
 
Method Summary
 ENext doStart(IContext context, IResultSet result)
          Performs the start action. i.e. create a database schema.
 ActionType getActionType()
          Get the plugin type.
 Integer getMax()
          Gets the ending index.
 int getMin()
          Gets the starting index.
 int getStep()
          Gets the index jumping step.
 String getVar()
          The index variable name.
 void setMax(Integer max)
          Set the last valid index.
 void setMin(int min)
          Set the starting index.
 void setStep(int step)
          Change index jumping step.
 void setVar(String var)
          Change the variable name.
 
Methods inherited from class org.specrunner.plugins.core.AbstractPlugin
copy, doEnd, getCondition, getConditionModel, getNormalized, getNormalized, getParent, getSleep, getSleepModel, getThreadsafe, getTimeout, getTimeoutModel, getWait, getWaitModel, initialize, setCondition, setConditionModel, setNormalized, setParent, setSleep, setSleepModel, setThreadsafe, setTimeout, setTimeoutModel, setWait, setWaitModel, toString
 
Methods inherited from class org.specrunner.parameters.core.ParameterHolder
getParameters, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.specrunner.parameters.IParameterHolder
getParameters, setParameters
 

Field Detail

var

protected String var
Index variable name.


min

protected int min
Minimum value.


max

protected Integer max
Maximum value.


step

protected int step
Step.

Constructor Detail

PluginFor

public PluginFor()
Method Detail

getVar

public String getVar()
The index variable name. Default is 'index'.

Returns:
The variable name.

setVar

public void setVar(String var)
Change the variable name.

Parameters:
var - The variable.

getMin

public int getMin()
Gets the starting index. Default is '0'.

Returns:
The starting index.

setMin

public void setMin(int min)
Set the starting index.

Parameters:
min - The starting.

getMax

public Integer getMax()
Gets the ending index.

Returns:
The last valid index.

setMax

public void setMax(Integer max)
Set the last valid index.

Parameters:
max - The new last index.

getStep

public int getStep()
Gets the index jumping step.

Returns:
The step.

setStep

public void setStep(int step)
Change index jumping step.

Parameters:
step - The step.

getActionType

public ActionType getActionType()
Description copied from interface: IActionType
Get the plugin type.

Returns:
The type.

doStart

public ENext doStart(IContext context,
                     IResultSet result)
              throws PluginException
Description copied from interface: IPlugin
Performs the start action. i.e. create a database schema. Performed after initialization.

Specified by:
doStart in interface IPlugin
Overrides:
doStart in class AbstractPlugin
Parameters:
context - The context.
result - The result set.
Returns:
SKIP, to skip node, DEEP, to go deep into the node.
Throws:
PluginException - On execution errors.


Copyright © 2014. All rights reserved.