org.specrunner.plugins.core
Class AbstractPluginDual

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.AbstractPluginScoped
                  extended by org.specrunner.plugins.core.AbstractPluginValue
                      extended by org.specrunner.plugins.core.AbstractPluginDual
All Implemented Interfaces:
IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin
Direct Known Subclasses:
AbstractPluginDefine, PluginEquals

public abstract class AbstractPluginDual
extends AbstractPluginValue

A generic plugin which performs a test, it the result is true, a success result is added, otherwise adds an error to the result.

Author:
Thiago Santos

Field Summary
 
Fields inherited from class org.specrunner.plugins.core.AbstractPlugin
FEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_TIMEOUT, FEATURE_WAIT
 
Constructor Summary
AbstractPluginDual()
           
 
Method Summary
 void doEnd(IContext context, IResultSet result)
          The end action. i.e. after a loop specification perform something in a newly generated table.
 ENext doStart(IContext context, IResultSet result)
          Performs the start action. i.e. create a database schema.
protected abstract  Throwable getError()
          Gets the error, if the operation returns false.
protected  Object getObjectValue(IContext context, nu.xom.Node node)
          Default behavior.
 Boolean getOnstart()
          Get if execute on start.
protected abstract  boolean operation(Object obj, IContext context)
          Stand for the testing operation.
protected  ENext perform(IContext context, IResultSet result)
          Perform plugin action/assertion.
 void setOnstart(Boolean onstart)
          Set on start flag.
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginValue
getValue, getValue, isEval, setEval, setValue
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginScoped
getScope, saveGlobal, saveLocal, saveStrict, setScope
 
Methods inherited from class org.specrunner.plugins.core.AbstractPluginNamed
getName, setName
 
Methods inherited from class org.specrunner.plugins.core.AbstractPlugin
copy, 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
 
Methods inherited from interface org.specrunner.plugins.IActionType
getActionType
 

Constructor Detail

AbstractPluginDual

public AbstractPluginDual()
Method Detail

getOnstart

public Boolean getOnstart()
Get if execute on start.

Returns:
true, to perform on start, false, otherwise.

setOnstart

public void setOnstart(Boolean onstart)
Set on start flag.

Parameters:
onstart - On start execution.

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.

doEnd

public void doEnd(IContext context,
                  IResultSet result)
           throws PluginException
Description copied from interface: IPlugin
The end action. i.e. after a loop specification perform something in a newly generated table. Performed after doStart().

Specified by:
doEnd in interface IPlugin
Overrides:
doEnd in class AbstractPlugin
Parameters:
context - The context.
result - The result set.
Throws:
PluginException - On execution errors.

perform

protected ENext perform(IContext context,
                        IResultSet result)
                 throws PluginException
Perform plugin action/assertion.

Parameters:
context - The context.
result - The result.
Returns:
The next move.
Throws:
PluginException - On plugin execution errors.

getObjectValue

protected Object getObjectValue(IContext context,
                                nu.xom.Node node)
                         throws PluginException
Default behavior.

Parameters:
context - The context.
node - The node.
Returns:
The value object.
Throws:
PluginException - On evaluation errors.

operation

protected abstract boolean operation(Object obj,
                                     IContext context)
                              throws PluginException
Stand for the testing operation.

Parameters:
obj - The value to be used.
context - The context.
Returns:
true status must be OK, false otherwise, in which case error should be set.
Throws:
PluginException - On operation errors.

getError

protected abstract Throwable getError()
Gets the error, if the operation returns false.

Returns:
The failure.


Copyright © 2014. All rights reserved.