List of usage examples for org.apache.commons.scxml2 SCXMLExecutor getRootContext
public Context getRootContext()
From source file:com.github.woonsan.commons.scxml.examples.stopwatch.StopWatchFrame.java
public StopWatchFrame(SCXMLExecutor executor) { super("SCXML StopWatch"); initUI();//from w w w. j a va2s .c o m this.executor = executor; this.stopWatch = (StopWatch) executor.getRootContext().get("stopWatch"); }
From source file:org.onehippo.repository.scxml.ActionAndResultActionTest.java
@Test public void testActionAndResultAction() throws Exception { MockRepositorySCXMLRegistry registry = new MockRepositorySCXMLRegistry(); RepositorySCXMLExecutorFactory execFactory = new RepositorySCXMLExecutorFactory(); execFactory.initialize();//from w w w .j a va 2 s . c om MockNode scxmlConfigNode = registry.createConfigNode(); MockNode scxmlDefNode = registry.addScxmlNode(scxmlConfigNode, "helloScxml", SCXML_HELLO_ACTION_AND_RESULT); registry.addCustomAction(scxmlDefNode, "http://www.onehippo.org/cms7/repository/scxml", "action", ActionAction.class.getName()); registry.addCustomAction(scxmlDefNode, "http://www.onehippo.org/cms7/repository/scxml", "result", ResultAction.class.getName()); registry.setUp(scxmlConfigNode); SCXMLDefinition helloScxml = registry.getSCXMLDefinition("helloScxml"); assertNotNull(helloScxml); SCXMLExecutor helloExec = execFactory.createSCXMLExecutor(helloScxml); SCXMLWorkflowContext workflowContext = new SCXMLWorkflowContext(helloScxml.getId(), new MockWorkflowContext("testuser")); helloExec.getRootContext().set(SCXMLWorkflowContext.SCXML_CONTEXT_KEY, workflowContext); helloExec.getRootContext().set("world", Boolean.TRUE); helloExec.go(); assertTrue(workflowContext.getActions().get("hello")); assertEquals(workflowContext, workflowContext.getResult()); }