org.specrunner.plugins.core.flow
Class PluginIfBranch

java.lang.Object
  extended by org.specrunner.parameters.core.ParameterHolder
      extended by org.specrunner.plugins.core.AbstractPlugin
          extended by org.specrunner.plugins.core.AbstractPluginNamed
              extended by org.specrunner.plugins.core.flow.PluginIfBranch
All Implemented Interfaces:
IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin
Direct Known Subclasses:
PluginElse, PluginThen

public abstract class PluginIfBranch
extends AbstractPluginNamed

Performs the branch selection.

Author:
Thiago Santos

Field Summary
static String CSS_RELEGATED
          CSS style for unselected branch.
static String CSS_SELECTED
          CSS style for selected branch.
static String FEATURE_HIDE
          Feature to set invalid branch.
 
Fields inherited from class org.specrunner.plugins.core.AbstractPlugin
FEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_TIMEOUT, FEATURE_WAIT
 
Constructor Summary
PluginIfBranch()
           
 
Method Summary
 ENext doStart(IContext context, IResultSet result)
          Performs the start action. i.e. create a database schema.
protected  void encapsule(IContext context, Boolean condition)
          Wrap the node with 'selected' or 'unselected' flag, and hide or not the unselected branch.
protected abstract  boolean expected()
          Return the expected branch condition.
 ActionType getActionType()
          Get the plugin type.
 Boolean getHide()
          Gets the hide status.
 void initialize(IContext context)
          Initialize the plugin.
 void setHide(Boolean hide)
          Sets the hide status of unselected branches.
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginNamed
getName, setName
 
Methods inherited from class org.specrunner.plugins.core.AbstractPlugin
copy, doEnd, getCondition, getConditionModel, getNormalized, getNormalized, getParent, getSleep, getSleepModel, getThreadsafe, getTimeout, getTimeoutModel, getWait, getWaitModel, 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

CSS_SELECTED

public static final String CSS_SELECTED
CSS style for selected branch.

See Also:
Constant Field Values

CSS_RELEGATED

public static final String CSS_RELEGATED
CSS style for unselected branch.

See Also:
Constant Field Values

FEATURE_HIDE

public static final String FEATURE_HIDE
Feature to set invalid branch.

Constructor Detail

PluginIfBranch

public PluginIfBranch()
Method Detail

getHide

public Boolean getHide()
Gets the hide status. Default is 'true'.

Returns:
true, to hide, false, otherwise.

setHide

public void setHide(Boolean hide)
Sets the hide status of unselected branches.

Parameters:
hide - true, to hide, false, otherwise.

getActionType

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

Returns:
The type.

initialize

public void initialize(IContext context)
                throws PluginException
Description copied from interface: IPlugin
Initialize the plugin. Performed after set parameters.

Specified by:
initialize in interface IPlugin
Overrides:
initialize in class AbstractPlugin
Parameters:
context - The test context.
Throws:
PluginException - On initialization errors.

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.

encapsule

protected void encapsule(IContext context,
                         Boolean condition)
Wrap the node with 'selected' or 'unselected' flag, and hide or not the unselected branch.

Parameters:
context - The context.
condition - The condition.

expected

protected abstract boolean expected()
Return the expected branch condition.

Returns:
true, for 'then', false, for 'else'.


Copyright © 2014. All rights reserved.