org.specrunner.plugins.core
Class UtilPlugin

java.lang.Object
  extended by org.specrunner.plugins.core.UtilPlugin

public final class UtilPlugin
extends Object

Plugins utility class.

Author:
Thiago Santos

Method Summary
static void compare(nu.xom.Node node, IPlugin plugin, IResultSet result, IComparator comparator, Object expected, Object received)
          Perform a comparison and add the result to the given node.
static void compare(nu.xom.Node node, IResultSet result, Object expected, Object received)
          Perform a comparison and add the result to the given node.
static
<T extends IPlugin>
T
create(IContext context, Class<T> type, nu.xom.Element element)
          Equivalent to create(...
static
<T extends IPlugin>
T
create(IContext context, Class<T> type, nu.xom.Element element, boolean initialize)
          Creates a plugin based on its type.
static IPlugin create(IContext context, IPlugin instance, nu.xom.Element element)
          Equivalent to create(...
static IPlugin create(IContext context, IPlugin instance, nu.xom.Element element, boolean initialize)
          Creates a plugin based on its template.
static IPlugin destroy(IContext context, IPlugin plugin, nu.xom.Element element)
          Make plugin sensible to attributes after running.
static void performChildren(nu.xom.Node node, IContext context, IResultSet result)
          Executes the children of a given node.
static void performComandsFirst(IContext context, IResultSet result, nu.xom.Node element)
          Perform children using commands before asserts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <T extends IPlugin> T create(IContext context,
                                           Class<T> type,
                                           nu.xom.Element element)
                                throws PluginException
Equivalent to create(...,false).

Type Parameters:
T - A subtype of IPlugin.
Parameters:
context - The reference context.
type - The plugin type.
element - The element to be used as reference for plugin creation.
Returns:
The newly created plugin.
Throws:
PluginException - On plugin creation errors.

create

public static IPlugin create(IContext context,
                             IPlugin instance,
                             nu.xom.Element element)
                      throws PluginException
Equivalent to create(...,false).

Parameters:
context - The reference context.
instance - The plugin template instance.
element - The element to be used as reference for plugin creation.
Returns:
The newly created plugin.
Throws:
PluginException - On plugin creation errors.

create

public static <T extends IPlugin> T create(IContext context,
                                           Class<T> type,
                                           nu.xom.Element element,
                                           boolean initialize)
                                throws PluginException
Creates a plugin based on its type. The attributes of 'element'will be evaluated as expressions in the given context and used to set plugin attributes with corresponding names.

Type Parameters:
T - A subtype of IPlugin.
Parameters:
context - The reference context.
type - The plugin type.
element - The element to be used as reference for plugin creation.
initialize - true, if initialize() should be called, false, otherwise.
Returns:
The newly created plugin.
Throws:
PluginException - On plugin creation errors.

create

public static IPlugin create(IContext context,
                             IPlugin instance,
                             nu.xom.Element element,
                             boolean initialize)
                      throws PluginException
Creates a plugin based on its template. The attributes of 'element' will be evaluated as expressions in the given context and used to set plugin attributes with corresponding names.

Parameters:
context - The reference context.
instance - The template instance.
element - The element to be used as reference for plugin creation.
initialize - true, if initialize() should be called, false, otherwise.
Returns:
The newly created plugin.
Throws:
PluginException - On plugin creation errors.

destroy

public static IPlugin destroy(IContext context,
                              IPlugin plugin,
                              nu.xom.Element element)
                       throws PluginException
Make plugin sensible to attributes after running.

Parameters:
context - The context.
plugin - The plugin.
element - The element.
Returns:
The plugin itself.
Throws:
PluginException - On plugin finalization.

performChildren

public static void performChildren(nu.xom.Node node,
                                   IContext context,
                                   IResultSet result)
                            throws PluginException
Executes the children of a given node.

Parameters:
node - The parent node.
context - The context.
result - The result set.
Throws:
PluginException - On execution errors.

performComandsFirst

public static void performComandsFirst(IContext context,
                                       IResultSet result,
                                       nu.xom.Node element)
                                throws PluginException
Perform children using commands before asserts.

Parameters:
context - The context.
result - The result.
element - The base element.
Throws:
PluginException - On execution errors.

compare

public static void compare(nu.xom.Node node,
                           IResultSet result,
                           Object expected,
                           Object received)
                    throws PluginException
Perform a comparison and add the result to the given node.

Parameters:
node - Node to be annotated.
result - The result set.
expected - The expected String.
received - The received String
Throws:
PluginException - On plugin errors.

compare

public static void compare(nu.xom.Node node,
                           IPlugin plugin,
                           IResultSet result,
                           IComparator comparator,
                           Object expected,
                           Object received)
                    throws PluginException
Perform a comparison and add the result to the given node.

Parameters:
node - Node to be annotated.
plugin - The plugin type.
result - The result set.
comparator - The comparator.
expected - The expected String.
received - The received String
Throws:
PluginException - On plugin errors.


Copyright © 2014. All rights reserved.