org.apache.commons.scxml
Class SCXMLTestHelper

java.lang.Object
  extended by org.apache.commons.scxml.SCXMLTestHelper

public class SCXMLTestHelper
extends Object

Helper methods for running SCXML unit tests.


Field Summary
static String SERIALIZATION_DIR
          Serialized Commons SCXML object model temporary store.
static String SERIALIZATION_FILE_PREFIX
           
static String SERIALIZATION_FILE_SUFFIX
           
 
Method Summary
static void assertPostTriggerState(SCXMLExecutor exec, String triggerEventName, String expectedStateId)
           
static void assertPostTriggerState(SCXMLExecutor exec, TriggerEvent triggerEvent, String expectedStateId)
           
static void assertPostTriggerStates(SCXMLExecutor exec, String triggerEventName, String[] expectedStateIds)
           
static void assertPostTriggerStates(SCXMLExecutor exec, TriggerEvent triggerEvent, String[] expectedStateIds)
           
static SCXML digest(URL url)
           
static SCXML digest(URL url, ErrorHandler errHandler)
           
static SCXML digest(URL url, ErrorHandler errHandler, List customActions)
           
static SCXML digest(URL url, List customActions)
           
static Set fireEvent(SCXMLExecutor exec, String name)
           
static Set fireEvent(SCXMLExecutor exec, TriggerEvent te)
           
static Set fireEvents(SCXMLExecutor exec, TriggerEvent[] evts)
           
static String getCurrentState(SCXMLExecutor exec)
          Get the active leaf state for this executor instance.
static SCXMLExecutor getExecutor(Context context, Evaluator evaluator, SCXML scxml, EventDispatcher ed, Tracer trc)
           
static SCXMLExecutor getExecutor(Context context, Evaluator evaluator, SCXML scxml, EventDispatcher ed, Tracer trc, SCXMLSemantics semantics)
           
static SCXMLExecutor getExecutor(Evaluator evaluator, SCXML scxml)
           
static SCXMLExecutor getExecutor(SCXML scxml)
           
static SCXMLExecutor getExecutor(SCXML scxml, Context ctx, Evaluator evaluator)
           
static SCXMLExecutor getExecutor(SCXML scxml, SCXMLSemantics semantics)
           
static SCXMLExecutor getExecutor(URL url)
           
static SCXMLExecutor getExecutor(URL url, Context ctx, Evaluator evaluator)
           
static SCXMLExecutor getExecutor(URL url, ErrorHandler errHandler)
           
static SCXMLExecutor getExecutor(URL url, Evaluator evaluator)
           
static Context lookupContext(SCXMLExecutor exec, String id)
           
static Context lookupContext(SCXMLExecutor exec, TransitionTarget tt)
           
static TransitionTarget lookupTransitionTarget(SCXMLExecutor exec, String id)
           
static SCXML parse(URL url)
           
static SCXML parse(URL url, ErrorHandler errHandler)
           
static SCXML parse(URL url, ErrorHandler errHandler, List customActions)
           
static SCXML parse(URL url, List customActions)
           
static void setCurrentState(SCXMLExecutor exec, String id)
          Set the active leaf state for this executor instance.
static SCXMLExecutor testExecutorSerializability(SCXMLExecutor exec)
           
static SCXML testModelSerializability(SCXML scxml)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERIALIZATION_DIR

public static final String SERIALIZATION_DIR
Serialized Commons SCXML object model temporary store. Assumes the default build artifacts are generated in the "target" directory (so it can be removed via a clean build).

See Also:
Constant Field Values

SERIALIZATION_FILE_PREFIX

public static final String SERIALIZATION_FILE_PREFIX
See Also:
Constant Field Values

SERIALIZATION_FILE_SUFFIX

public static final String SERIALIZATION_FILE_SUFFIX
See Also:
Constant Field Values
Method Detail

digest

public static SCXML digest(URL url)
                    throws Exception
Throws:
Exception

digest

public static SCXML digest(URL url,
                           List customActions)
                    throws Exception
Throws:
Exception

digest

public static SCXML digest(URL url,
                           ErrorHandler errHandler)
                    throws Exception
Throws:
Exception

digest

public static SCXML digest(URL url,
                           ErrorHandler errHandler,
                           List customActions)
                    throws Exception
Throws:
Exception

parse

public static SCXML parse(URL url)
                   throws Exception
Throws:
Exception

parse

public static SCXML parse(URL url,
                          List customActions)
                   throws Exception
Throws:
Exception

parse

public static SCXML parse(URL url,
                          ErrorHandler errHandler)
                   throws Exception
Throws:
Exception

parse

public static SCXML parse(URL url,
                          ErrorHandler errHandler,
                          List customActions)
                   throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(URL url)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(URL url,
                                        Evaluator evaluator)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(URL url,
                                        ErrorHandler errHandler)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(SCXML scxml)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(SCXML scxml,
                                        SCXMLSemantics semantics)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(Evaluator evaluator,
                                        SCXML scxml)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(URL url,
                                        Context ctx,
                                        Evaluator evaluator)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(SCXML scxml,
                                        Context ctx,
                                        Evaluator evaluator)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(Context context,
                                        Evaluator evaluator,
                                        SCXML scxml,
                                        EventDispatcher ed,
                                        Tracer trc)
                                 throws Exception
Throws:
Exception

getExecutor

public static SCXMLExecutor getExecutor(Context context,
                                        Evaluator evaluator,
                                        SCXML scxml,
                                        EventDispatcher ed,
                                        Tracer trc,
                                        SCXMLSemantics semantics)
                                 throws Exception
Throws:
Exception

lookupTransitionTarget

public static TransitionTarget lookupTransitionTarget(SCXMLExecutor exec,
                                                      String id)

lookupContext

public static Context lookupContext(SCXMLExecutor exec,
                                    TransitionTarget tt)

lookupContext

public static Context lookupContext(SCXMLExecutor exec,
                                    String id)

fireEvent

public static Set fireEvent(SCXMLExecutor exec,
                            String name)
                     throws Exception
Throws:
Exception

fireEvent

public static Set fireEvent(SCXMLExecutor exec,
                            TriggerEvent te)
                     throws Exception
Throws:
Exception

fireEvents

public static Set fireEvents(SCXMLExecutor exec,
                             TriggerEvent[] evts)
                      throws Exception
Throws:
Exception

assertPostTriggerState

public static void assertPostTriggerState(SCXMLExecutor exec,
                                          String triggerEventName,
                                          String expectedStateId)
                                   throws Exception
Throws:
Exception

assertPostTriggerStates

public static void assertPostTriggerStates(SCXMLExecutor exec,
                                           String triggerEventName,
                                           String[] expectedStateIds)
                                    throws Exception
Throws:
Exception

assertPostTriggerState

public static void assertPostTriggerState(SCXMLExecutor exec,
                                          TriggerEvent triggerEvent,
                                          String expectedStateId)
                                   throws Exception
Throws:
Exception

assertPostTriggerStates

public static void assertPostTriggerStates(SCXMLExecutor exec,
                                           TriggerEvent triggerEvent,
                                           String[] expectedStateIds)
                                    throws Exception
Throws:
Exception

testModelSerializability

public static SCXML testModelSerializability(SCXML scxml)
                                      throws Exception
Throws:
Exception

testExecutorSerializability

public static SCXMLExecutor testExecutorSerializability(SCXMLExecutor exec)
                                                 throws Exception
Throws:
Exception

getCurrentState

public static String getCurrentState(SCXMLExecutor exec)
Get the active leaf state for this executor instance. Assumes no usage of <parallel>.

Parameters:
exec - The SCXMLExecutor instance whose active state is being queried.
Returns:
The id of the active state.

setCurrentState

public static void setCurrentState(SCXMLExecutor exec,
                                   String id)
Set the active leaf state for this executor instance. Assumes no usage of <parallel>.

Parameters:
exec - The SCXMLExecutor instance whose active state is to be set.
id - The id of the state to be made active.


Copyright © 2005-2010 The Apache Software Foundation. All Rights Reserved.