You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by at...@apache.org on 2014/04/03 09:13:44 UTC
svn commit: r1584272 [5/6] - in /commons/proper/scxml/trunk/src:
main/java/org/apache/commons/scxml2/ main/java/org/apache/commons/scxml2/env/
main/java/org/apache/commons/scxml2/env/groovy/
main/java/org/apache/commons/scxml2/env/javascript/ main/java...
Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/test/StandaloneUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/test/StandaloneUtils.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/test/StandaloneUtils.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/test/StandaloneUtils.java Thu Apr 3 07:13:42 2014
@@ -29,7 +29,6 @@ import org.apache.commons.scxml2.Context
import org.apache.commons.scxml2.Evaluator;
import org.apache.commons.scxml2.EventDispatcher;
import org.apache.commons.scxml2.SCXMLExecutor;
-import org.apache.commons.scxml2.SCXMLHelper;
import org.apache.commons.scxml2.TriggerEvent;
import org.apache.commons.scxml2.env.SimpleScheduler;
import org.apache.commons.scxml2.env.Tracer;
@@ -114,7 +113,7 @@ public final class StandaloneUtils {
rootCtx.setLocal(name, value);
System.out.println("Set variable " + name + " to "
+ value);
- } else if (SCXMLHelper.isStringEmpty(event)
+ } else if (event == null || event.trim().length() == 0
|| event.equalsIgnoreCase("null")) {
TriggerEvent[] evts = {new TriggerEvent(null,
TriggerEvent.SIGNAL_EVENT, null)};
Modified: commons/proper/scxml/trunk/src/site/xdoc/guide/scxml-documents.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/site/xdoc/guide/scxml-documents.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/site/xdoc/guide/scxml-documents.xml (original)
+++ commons/proper/scxml/trunk/src/site/xdoc/guide/scxml-documents.xml Thu Apr 3 07:13:42 2014
@@ -268,7 +268,7 @@
and an outbound transition out of the <parallel>
from any region causes the state machine to exit all
regions.</li>
- <li>When all regions reach a "final" state, an "id.done" event
+ <li>When all regions reach a "final" state, an "done.state.id" event
is fired, where "id" is the id of the parent <parallel>
</li>
</ul>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/NamespacePrefixedXPathsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/NamespacePrefixedXPathsTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/NamespacePrefixedXPathsTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/NamespacePrefixedXPathsTest.java Thu Apr 3 07:13:42 2014
@@ -70,7 +70,7 @@ public class NamespacePrefixedXPathsTest
Assert.assertEquals("ten", currentStates.iterator().next().getId());
// should move to "twenty"
- currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
@@ -79,7 +79,7 @@ public class NamespacePrefixedXPathsTest
Assert.assertEquals(Double.valueOf("11"), retval);
// On to "thirty"
- currentStates = SCXMLTestHelper.fireEvent(exec, "twenty.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.twenty");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("thirty", currentStates.iterator().next().getId());
exec = SCXMLTestHelper.testInstanceSerializability(exec);
@@ -89,20 +89,20 @@ public class NamespacePrefixedXPathsTest
Assert.assertEquals("Equal to 20", retvalstr);
// and so on ...
- currentStates = SCXMLTestHelper.fireEvent(exec, "thirty.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.thirty");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("forty", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "forty.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.forty");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("fifty", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "fifty.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.fifty");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("sixty", (currentStates.iterator().
next()).getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "sixty.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.sixty");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("seventy", currentStates.iterator().next().getId());
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCInstanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCInstanceTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCInstanceTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCInstanceTest.java Thu Apr 3 07:13:42 2014
@@ -55,7 +55,7 @@ public class SCInstanceTest {
}
@Test
- public void testGetRootContextEvaluator() {
+ public void testGetRootContextEvaluator() throws Exception {
Evaluator evaluator = new JexlEvaluator();
executor.setEvaluator(evaluator);
@@ -77,7 +77,7 @@ public class SCInstanceTest {
}
@Test
- public void testGetContextNullParent() {
+ public void testGetContextNullParent() throws Exception {
State target = new State();
target.setId("1");
@@ -93,7 +93,7 @@ public class SCInstanceTest {
}
@Test
- public void testGetContextParent() {
+ public void testGetContextParent() throws Exception {
State target = new State();
target.setId("1");
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLExecutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLExecutorTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLExecutorTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLExecutorTest.java Thu Apr 3 07:13:42 2014
@@ -195,7 +195,7 @@ public class SCXMLExecutorTest {
Set<EnterableState> currentStates = exec.getCurrentStatus().getStates();
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
}
@@ -204,13 +204,13 @@ public class SCXMLExecutorTest {
public void testSCXMLExecutorTransitions01Sample() throws Exception {
exec = SCXMLTestHelper.getExecutor(transitions01);
Assert.assertNotNull(exec);
- Set<EnterableState> currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ Set<EnterableState> currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty_one", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_one.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.twenty_one");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty_two", currentStates.iterator().next().getId());
- SCXMLTestHelper.fireEvent(exec, "twenty_two.done");
+ SCXMLTestHelper.fireEvent(exec, "done.state.twenty_two");
Assert.assertEquals(3, exec.getCurrentStatus().getStates().size());
}
@@ -225,7 +225,7 @@ public class SCXMLExecutorTest {
currentStates = SCXMLTestHelper.fireEvent(exec, "ten.self");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
}
@@ -234,7 +234,7 @@ public class SCXMLExecutorTest {
public void testSCXMLExecutorTransitions03Sample() throws Exception {
exec = SCXMLTestHelper.getExecutor(transitions03);
Assert.assertNotNull(exec);
- Set<EnterableState> currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ Set<EnterableState> currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(3, currentStates.size());
Set<String> expected = new HashSet<String>();
expected.add("twenty_one_2");
@@ -254,7 +254,7 @@ public class SCXMLExecutorTest {
Assert.assertNotNull(scxml);
exec = SCXMLTestHelper.getExecutor(scxml);
Assert.assertNotNull(exec);
- Set<EnterableState> currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ Set<EnterableState> currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(3, currentStates.size());
Set<String> expected = new HashSet<String>();
expected.add("twenty_one_1");
@@ -300,7 +300,7 @@ public class SCXMLExecutorTest {
Set<EnterableState> currentStates = exec.getCurrentStatus().getStates();
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLTestHelper.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLTestHelper.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLTestHelper.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLTestHelper.java Thu Apr 3 07:13:42 2014
@@ -159,7 +159,6 @@ public class SCXMLTestHelper {
}
exec.addListener(scxml, trc);
exec.setRootContext(context);
- exec.setSuperStep(true);
exec.setStateMachine(scxml);
exec.go();
Assert.assertNotNull(exec);
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/StatusTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/StatusTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/StatusTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/StatusTest.java Thu Apr 3 07:13:42 2014
@@ -16,6 +16,9 @@
*/
package org.apache.commons.scxml2;
+import java.util.Set;
+
+import org.apache.commons.scxml2.model.EnterableState;
import org.apache.commons.scxml2.model.Final;
import org.apache.commons.scxml2.model.State;
import org.junit.Assert;
@@ -58,5 +61,26 @@ public class StatusTest {
Assert.assertTrue(status.isFinal());
}
-
+
+ @Test
+ public void testGetAllStatesEmptyStatus() {
+
+ Set<EnterableState> returnValue = status.getAllStates();
+
+ Assert.assertEquals(0, returnValue.size());
+ }
+
+ @Test
+ public void testGetAllStatesContainsParent() {
+ State parent = new State();
+ parent.setId("0");
+ State state = new State();
+ state.setId("1");
+ state.setParent(parent);
+ status.getStates().add(state);
+
+ Set<EnterableState> returnValue = status.getAllStates();
+
+ Assert.assertEquals(2, returnValue.size());
+ }
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/TieBreakerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/TieBreakerTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/TieBreakerTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/TieBreakerTest.java Thu Apr 3 07:13:42 2014
@@ -82,7 +82,7 @@ public class TieBreakerTest {
Set<EnterableState> currentStates = exec.getCurrentStatus().getStates();
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
}
@@ -94,7 +94,7 @@ public class TieBreakerTest {
Set<EnterableState> currentStates = exec.getCurrentStatus().getStates();
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("eleven", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("thirty", currentStates.iterator().next().getId());
}
@@ -106,7 +106,7 @@ public class TieBreakerTest {
Set<EnterableState> currentStates = exec.getCurrentStatus().getStates();
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("eleven", currentStates.iterator().next().getId());
- currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.ten");
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("forty", currentStates.iterator().next().getId());
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/AbstractSCXMLListenerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/AbstractSCXMLListenerTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/AbstractSCXMLListenerTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/AbstractSCXMLListenerTest.java Thu Apr 3 07:13:42 2014
@@ -82,11 +82,11 @@ public class AbstractSCXMLListenerTest {
}
/**
- * @see SCXMLListener#onTransition(TransitionTarget,TransitionTarget,Transition)
+ * @see SCXMLListener#onTransition(TransitionTarget,TransitionTarget,Transition,String)
*/
@Override
public void onTransition(TransitionTarget from, TransitionTarget to,
- Transition transition) {
+ Transition transition, String event) {
heardOnTransition = true;
}
};
@@ -96,10 +96,10 @@ public class AbstractSCXMLListenerTest {
Assert.assertFalse("heardOnTransition == false", heardOnTransition);
listener0.onEntry(to);
listener0.onExit(to);
- listener0.onTransition(from, to, transition);
+ listener0.onTransition(from, to, transition, null);
Assert.assertTrue("heardOnEntry", heardOnEntry);
Assert.assertTrue("heardOnExit", heardOnExit);
- Assert.assertTrue("heardOnExit", heardOnTransition);
+ Assert.assertTrue("heardOnTransition", heardOnTransition);
}
@Test
@@ -127,7 +127,7 @@ public class AbstractSCXMLListenerTest {
Assert.assertFalse("heardOnTransition == false", heardOnTransition);
listener1.onEntry(to);
listener1.onExit(to);
- listener1.onTransition(from, to, transition);
+ listener1.onTransition(from, to, transition, null);
Assert.assertTrue("heardOnEntry", heardOnEntry);
Assert.assertTrue("heardOnExit", heardOnExit);
Assert.assertFalse("heardOnTransition == false", heardOnTransition);
@@ -150,7 +150,7 @@ public class AbstractSCXMLListenerTest {
Assert.assertFalse("heardOnTransition == false", heardOnTransition);
listener2.onEntry(to);
listener2.onExit(to);
- listener2.onTransition(from, to, transition);
+ listener2.onTransition(from, to, transition, null);
Assert.assertTrue("heardOnEntry", heardOnEntry);
Assert.assertFalse("heardOnExit == false", heardOnExit);
Assert.assertFalse("heardOnTransition == false", heardOnTransition);
@@ -167,7 +167,7 @@ public class AbstractSCXMLListenerTest {
Assert.assertFalse("heardOnTransition == false", heardOnTransition);
listener3.onEntry(to);
listener3.onExit(to);
- listener3.onTransition(from, to, transition);
+ listener3.onTransition(from, to, transition, null);
Assert.assertFalse("heardOnEntry == false", heardOnEntry);
Assert.assertFalse("heardOnExit == false", heardOnExit);
Assert.assertFalse("heardOnTransition == false", heardOnTransition);
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/AbstractStateMachineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/AbstractStateMachineTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/AbstractStateMachineTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/AbstractStateMachineTest.java Thu Apr 3 07:13:42 2014
@@ -18,6 +18,7 @@ package org.apache.commons.scxml2.env;
import java.net.URL;
+import org.apache.commons.scxml2.model.ModelException;
import org.junit.Assert;
import org.junit.Test;
@@ -42,7 +43,7 @@ public class AbstractStateMachineTest {
private boolean fooCalled;
- public Foo(final URL scxmlDocument) {
+ public Foo(final URL scxmlDocument) throws ModelException {
super(scxmlDocument);
}
@@ -59,7 +60,7 @@ public class AbstractStateMachineTest {
private boolean barCalled;
- public Bar(final URL scxmlDocument) {
+ public Bar(final URL scxmlDocument) throws ModelException {
super(scxmlDocument);
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/LogUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/LogUtilsTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/LogUtilsTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/LogUtilsTest.java Thu Apr 3 07:13:42 2014
@@ -60,8 +60,8 @@ public class LogUtilsTest {
transition.setCond("condition");
transition.setEvent("event happened");
- Assert.assertEquals( "transition (event = event happened, cond = condition, from = /FROM, to = /TO)",
- LogUtils.transToString(targetFrom, targetTo, transition));
+ Assert.assertEquals( "(event = event happened, cond = condition, from = /FROM, to = /TO)",
+ LogUtils.transToString(targetFrom, targetTo, transition, transition.getEvent()));
}
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatch.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatch.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatch.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatch.java Thu Apr 3 07:13:42 2014
@@ -19,6 +19,7 @@ package org.apache.commons.scxml2.env;
import java.util.Timer;
import java.util.TimerTask;
+import org.apache.commons.scxml2.model.ModelException;
import org.apache.commons.scxml2.model.TransitionTarget;
/**
@@ -49,7 +50,7 @@ public class StopWatch extends AbstractS
/** The display decorations. */
private static final String DELIM = ":", DOT = ".", EMPTY = "", ZERO = "0";
- public StopWatch() {
+ public StopWatch() throws ModelException {
super(StopWatch.class.getClassLoader().
getResource("org/apache/commons/scxml2/env/stopwatch.xml"));
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatchDisplay.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatchDisplay.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatchDisplay.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatchDisplay.java Thu Apr 3 07:13:42 2014
@@ -31,6 +31,8 @@ import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import org.apache.commons.scxml2.model.ModelException;
+
/**
* Quick GUI to demonstrate the SCXML driven stopwatch.
@@ -50,7 +52,7 @@ public class StopWatchDisplay extends JF
private StopWatch stopWatch;
private Image watchImage, watchIcon;
- public StopWatchDisplay() {
+ public StopWatchDisplay() throws ModelException {
super("SCXML stopwatch");
stopWatch = new StopWatch();
setupUI();
@@ -143,7 +145,7 @@ public class StopWatchDisplay extends JF
}
}
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
new StopWatchDisplay();
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatchTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatchTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatchTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/StopWatchTest.java Thu Apr 3 07:13:42 2014
@@ -29,7 +29,7 @@ public class StopWatchTest {
* Set up instance variables required by this test case.
*/
@Before
- public void setUp() {
+ public void setUp() throws Exception {
stopWatch = new StopWatch();
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyEvaluatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyEvaluatorTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyEvaluatorTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyEvaluatorTest.java Thu Apr 3 07:13:42 2014
@@ -60,7 +60,7 @@ public class GroovyEvaluatorTest {
state1.setId("state1");
allStates.add(state1);
- ctx.setLocal(SCXMLSystemContext.VARIABLE_ALL_STATES, allStates);
+ ctx.setLocal(SCXMLSystemContext.ALL_STATES_KEY, allStates);
Assert.assertTrue(eval.evalCond(ctx, "In('state1')"));
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSEvaluatorTest.java Thu Apr 3 07:13:42 2014
@@ -119,7 +119,7 @@ public class JSEvaluatorTest {
evaluator = new JSEvaluator();
fsm = new SCXMLExecutor();
- context.set("_ALL_NAMESPACES",null);
+ context.set(Context.NAMESPACES_KEY,null);
fsm.setEvaluator (evaluator);
fsm.setRootContext (context);
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/example-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/example-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/example-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/example-01.xml Thu Apr 3 07:13:42 2014
@@ -22,147 +22,147 @@
initial = 'start'
version = '1.0'>
- <!-- DATA MODEL -->
+ <!-- DATA MODEL -->
- <datamodel>
- <data id='jungle'>
- <animals xmlns=''>
- <lion>
- <name>Simba</name>
- <age>12</age>
- </lion>
- <tiger>
- <name>Sher Khan</name>
- <age>13</age>
- </tiger>
- </animals>
- </data>
- </datamodel>
-
- <!-- INITIALISATION -->
-
- <state id='start'>
- <onentry>
- <log expr='"Starting Javascript sample script: " + new Date()' />
- </onentry>
- <transition target='javascript' />
- </state>
-
- <!-- JAVASCRIPT -->
-
- <state id='javascript'>
- <onentry>
- <scxml:var name='factorial' expr='new Function("N","if (N == 1)
+ <datamodel>
+ <data id='jungle'>
+ <animals xmlns=''>
+ <lion>
+ <name>Simba</name>
+ <age>12</age>
+ </lion>
+ <tiger>
+ <name>Sher Khan</name>
+ <age>13</age>
+ </tiger>
+ </animals>
+ </data>
+ </datamodel>
+
+ <!-- INITIALISATION -->
+
+ <state id='start'>
+ <onentry>
+ <log expr='"Starting Javascript sample script: " + new Date()' />
+ </onentry>
+ <transition target='javascript' />
+ </state>
+
+ <!-- JAVASCRIPT -->
+
+ <state id='javascript'>
+ <onentry>
+ <scxml:var name='factorial' expr='new Function("N","if (N == 1)
return N;
else
return N * factorial(N-1)")' />
- </onentry>
- <initial>
- <transition target='javascript.simple' />
- </initial>
-
- <!-- SIMPLE JAVASCRIPT EXPRESSIONS -->
-
- <state id='javascript.simple'>
- <onentry>
- <log expr='"Arithmetic: " + (1 + 2 + 3 + 4 + 5)' />
- <log expr='"Boolean : " + ((1 + 2) < (3 + 4))' />
- <log expr='"String : " + "QWERTY"' />
- </onentry>
- <transition target='javascript.var' />
- </state>
-
- <!-- SCXML VAR -->
-
- <state id='javascript.var'>
- <onentry>
- <scxml:var name='snake_name' expr='"Kaa"' />
- <scxml:var name='snake_age' expr='"99"' />
- <log expr='"Snake: " + snake_name + "," + (snake_age + 1)' />
- </onentry>
- <transition target='javascript.datamodel' />
- </state>
-
- <!-- SCXML DATA MODEL -->
-
- <state id='javascript.datamodel'>
- <onentry>
- <log expr='"Lion : " + Data(jungle,"animals/lion/name") + "," + Data(jungle,"animals/lion/age")' />
- <log expr='"Tiger: " + Data(jungle,"animals/tiger/name") + "," + Data(jungle,"animals/tiger/age")' />
- <assign location='Data(jungle,"animals/lion/age")' expr='Data(jungle,"animals/tiger/age")' />
- <log expr='"Lion : " + Data(jungle,"animals/lion/name") + "," + Data(jungle,"animals/lion/age")' />
- <log expr='"Tiger: " + Data(jungle,"animals/tiger/name") + "," + Data(jungle,"animals/tiger/age")' />
- </onentry>
- <transition target='javascript.functions.inline' />
- </state>
-
- <!-- JAVASCRIPT FUNCTIONS -->
-
- <state id='javascript.functions.inline'>
- <onentry>
- <log expr='function fibonacci()
+ </onentry>
+ <initial>
+ <transition target='javascript.simple' />
+ </initial>
+
+ <!-- SIMPLE JAVASCRIPT EXPRESSIONS -->
+
+ <state id='javascript.simple'>
+ <onentry>
+ <log expr='"Arithmetic: " + (1 + 2 + 3 + 4 + 5)' />
+ <log expr='"Boolean : " + ((1 + 2) < (3 + 4))' />
+ <log expr='"String : " + "QWERTY"' />
+ </onentry>
+ <transition target='javascript.var' />
+ </state>
+
+ <!-- SCXML VAR -->
+
+ <state id='javascript.var'>
+ <onentry>
+ <scxml:var name='snake_name' expr='"Kaa"' />
+ <scxml:var name='snake_age' expr='"99"' />
+ <log expr='"Snake: " + snake_name + "," + (snake_age + 1)' />
+ </onentry>
+ <transition target='javascript.datamodel' />
+ </state>
+
+ <!-- SCXML DATA MODEL -->
+
+ <state id='javascript.datamodel'>
+ <onentry>
+ <log expr='"Lion : " + Data(jungle,"animals/lion/name") + "," + Data(jungle,"animals/lion/age")' />
+ <log expr='"Tiger: " + Data(jungle,"animals/tiger/name") + "," + Data(jungle,"animals/tiger/age")' />
+ <assign location='Data(jungle,"animals/lion/age")' expr='Data(jungle,"animals/tiger/age")' />
+ <log expr='"Lion : " + Data(jungle,"animals/lion/name") + "," + Data(jungle,"animals/lion/age")' />
+ <log expr='"Tiger: " + Data(jungle,"animals/tiger/name") + "," + Data(jungle,"animals/tiger/age")' />
+ </onentry>
+ <transition target='javascript.functions.inline' />
+ </state>
+
+ <!-- JAVASCRIPT FUNCTIONS -->
+
+ <state id='javascript.functions.inline'>
+ <onentry>
+ <log expr='function fibonacci()
{ return 1 + 1 + 2 + 3 + 5;
};
"FIBONACCI(5) : " + fibonacci()' />
- </onentry>
- <transition target='javascript.functions.var' />
- </state>
-
- <state id='javascript.functions.var'>
- <onentry>
- <scxml:var name='fibonacci' expr='new Function("return 1 + 1 + 2 + 3 + 5 + 6")' />
- <log expr='"FIBONACCI(6) : " + fibonacci()' />
- </onentry>
- <transition target='javascript.functions.global' />
- </state>
-
- <state id='javascript.functions.global'>
- <onentry>
- <log expr='"factorial: " + factorial(5)' />
- </onentry>
- <transition target='javascript.functions.print' />
- </state>
-
- <state id='javascript.functions.print'>
- <onentry>
- <log expr='function debug(msg)
+ </onentry>
+ <transition target='javascript.functions.var' />
+ </state>
+
+ <state id='javascript.functions.var'>
+ <onentry>
+ <scxml:var name='fibonacci' expr='new Function("return 1 + 1 + 2 + 3 + 5 + 6")' />
+ <log expr='"FIBONACCI(6) : " + fibonacci()' />
+ </onentry>
+ <transition target='javascript.functions.global' />
+ </state>
+
+ <state id='javascript.functions.global'>
+ <onentry>
+ <log expr='"factorial: " + factorial(5)' />
+ </onentry>
+ <transition target='javascript.functions.print' />
+ </state>
+
+ <state id='javascript.functions.print'>
+ <onentry>
+ <log expr='function debug(msg)
{ println("** " + msg + " **");
return "ok"
}
debug("This is the Javascript println() function")' />
- </onentry>
- <transition target='javascript.eventdatamap.example' />
- </state>
+ </onentry>
+ <transition target='javascript.eventdatamap.example' />
+ </state>
- </state>
+ </state>
<!-- _eventdatamap USAGE -->
<state id='javascript.eventdatamap.example'>
- <onentry>
- <my:eventdatamaptest />
- </onentry>
- <transition target='in.test' event='ok' >
- </transition>
+ <onentry>
+ <my:eventdatamaptest />
+ </onentry>
+ <transition target='in.test' event='ok' >
+ </transition>
</state>
<!-- In() FUNCTION USAGE -->
<state id='in.test'>
- <transition cond="In('foo.bar')" /> <!-- stay -->
- <transition target='end' cond="!In('foo.bar')" >
- <log label="In(foo.bar)" expr='In("foo.bar")' />
- </transition>
+ <transition cond="In('foo.bar')" /> <!-- stay -->
+ <transition target='end' cond="!In('foo.bar')" >
+ <log label="In(foo.bar)" expr='In("foo.bar")' />
+ </transition>
</state>
- <!-- DONE -->
-
- <final id='end'>
- <onentry>
- <log expr='"Ending Javascript sample script: " + new Date()' />
- </onentry>
- </final>
+ <!-- DONE -->
+
+ <final id='end'>
+ <onentry>
+ <log expr='"Ending Javascript sample script: " + new Date()' />
+ </onentry>
+ </final>
</scxml>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-01.xml Thu Apr 3 07:13:42 2014
@@ -68,7 +68,7 @@
first argument is the named XML data tree and the second is
the XPath expression to a node whose value is to be
examined -->
- <transition event="ten.done"
+ <transition event="done.state.ten"
cond="mainvar eq 10 and Data(maindata,'root/a/b/c') eq 'beta'"
target="twenty" />
<onexit>
@@ -82,7 +82,7 @@
<onentry>
<assign name="mainvar" expr="20" />
</onentry>
- <transition event="twenty.done"
+ <transition event="done.state.twenty"
cond="Data(maindata,'root/a/b/c') eq 'gamma' and mainvar eq 20"
target="thirty" />
<onexit>
@@ -99,7 +99,7 @@
the Data() function. Note that data "docdata"
did not have a node at 'root/foo/a/b/d' to begin with,
the XML tree was manipulated by the <assign> above -->
- <transition event="thirty.done"
+ <transition event="done.state.thirty"
cond="Data(docdata,'root/foo/a/b/d') + Data(docdata,'root/foo/a/b/e') eq 579.789"
target="forty" />
</state>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-02.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-02.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-02.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-02.xml Thu Apr 3 07:13:42 2014
@@ -35,7 +35,7 @@
</datamodel>
<transition xmlns:ns1="http://namespace.test.domain/1"
- event="ten.done" cond="Data(data10,'root/ns1:foo/bar') eq 10"
+ event="done.state.ten" cond="Data(data10,'root/ns1:foo/bar') eq 10"
target="twenty" />
</state>
@@ -55,7 +55,7 @@
</data>
</datamodel>
- <transition event="twenty.done" cond="Data(data20,'ns3:root/ns4:foo') eq 20"
+ <transition event="done.state.twenty" cond="Data(data20,'ns3:root/ns4:foo') eq 20"
target="thirty" />
</state>
@@ -74,7 +74,7 @@
</data>
</datamodel>
- <transition event="thirty.done"
+ <transition event="done.state.thirty"
xmlns:ns1="http://namespace.test.domain/1"
xmlns:ns2="http://namespace.test.domain/2"
xmlns:ns3="http://namespace.test.domain/3"
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-03.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-03.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-03.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-03.xml Thu Apr 3 07:13:42 2014
@@ -69,7 +69,7 @@
expr="Data(rootdata,'pre1:root/pre2:foo/pre3:bar') + Data(data10,'root/pre1:foo/bar')" />
</onentry>
- <transition event="ten.done"
+ <transition event="done.state.ten"
cond="tentest eq 11"
target="twenty" />
@@ -102,7 +102,7 @@
<!-- Redefine namespace prefixes -->
- <transition event="twenty.done"
+ <transition event="done.state.twenty"
xmlns:ns1="scheme://namespace.test.domain/1"
xmlns:ns2="scheme://namespace.test.domain/2"
cond="Data(data20,'ns1:root/ns2:foo') eq 20 and Data(rootdata,'ns1:root/ns2:foo/ns3:bar') eq 2"
@@ -146,7 +146,7 @@
</datamodel>
- <transition event="thirty.done"
+ <transition event="done.state.thirty"
xmlns:ns1="scheme://namespace.test.domain/1"
xmlns:ns2="scheme://namespace.test.domain/2"
xmlns:ns3="scheme://namespace.test.domain/3"
@@ -177,7 +177,7 @@
</datamodel>
- <transition event="forty.done"
+ <transition event="done.state.forty"
cond="Data(data40,'root/ns1:foo/@ns2:attfoo') + Data(data41,'ns3:root/ns4:foo') eq 81"
target="fifty" />
@@ -205,7 +205,7 @@
</datamodel>
- <transition event="fifty.done"
+ <transition event="done.state.fifty"
xmlns:ns1="scheme://namespace.test.domain/1"
xmlns:ns2="scheme://namespace.test.domain/2"
xmlns:ns3="scheme://namespace.test.domain/3"
@@ -237,7 +237,7 @@
</datamodel>
- <transition event="sixty.done"
+ <transition event="done.state.sixty"
xmlns:pre1="scheme://namespace.test.domain/1"
xmlns:pre2="scheme://namespace.test.domain/2"
xmlns:pre3="scheme://namespace.test.domain/3"
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-04.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-04.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-04.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/datamodel-04.xml Thu Apr 3 07:13:42 2014
@@ -28,13 +28,13 @@
</datamodel>
<state id="ten">
- <transition event="ten.done" target="twenty">
+ <transition event="done.state.ten" target="twenty">
<assign name="payload" expr="_event.data" />
</transition>
</state>
<state id="twenty">
- <transition event="twenty.done" target="thirty" />
+ <transition event="done.state.twenty" target="thirty" />
<onexit>
<log label="Persisted event.data.one" expr="payload.one"/>
<log label="Persisted event.data.two" expr="payload.two"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/stateless-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/stateless-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/stateless-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/jexl/stateless-01.xml Thu Apr 3 07:13:42 2014
@@ -31,7 +31,7 @@
</onentry>
<state id="ten">
- <transition event="ten.done" cond="instancevar eq 20"
+ <transition event="done.state.ten" cond="instancevar eq 20"
target="twenty" />
<onexit>
<assign name="instancevar" expr="30" />
@@ -39,7 +39,7 @@
</state>
<state id="twenty">
- <transition event="twenty.done" cond="instancevar eq 30"
+ <transition event="done.state.twenty" cond="instancevar eq 30"
target="thirty" />
</state>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/history-deep-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/history-deep-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/history-deep-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/history-deep-01.xml Thu Apr 3 07:13:42 2014
@@ -45,11 +45,11 @@
</initial>
<state id="phase1">
- <transition event="phase.done" target="phase2"/>
+ <transition event="done.state.phase" target="phase2"/>
</state>
<state id="phase2">
- <transition event="phase.done" target="phase3"/>
+ <transition event="done.state.phase" target="phase3"/>
</state>
<final id="phase3"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/history-shallow-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/history-shallow-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/history-shallow-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/history-shallow-01.xml Thu Apr 3 07:13:42 2014
@@ -39,11 +39,11 @@
</history>
<state id="phase1">
- <transition event="phase.done" target="phase2"/>
+ <transition event="done.state.phase" target="phase2"/>
</state>
<state id="phase2">
- <transition event="phase.done" target="phase3"/>
+ <transition event="done.state.phase" target="phase3"/>
</state>
<final id="phase3"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java Thu Apr 3 07:13:42 2014
@@ -19,8 +19,9 @@ package org.apache.commons.scxml2.invoke
import java.net.URL;
import java.util.Map;
-import org.apache.commons.scxml2.SCInstance;
+import org.apache.commons.scxml2.Evaluator;
import org.apache.commons.scxml2.SCXMLExecutor;
+import org.apache.commons.scxml2.SCXMLIOProcessor;
import org.apache.commons.scxml2.SCXMLTestHelper;
import org.apache.commons.scxml2.TriggerEvent;
import org.apache.commons.scxml2.env.jexl.JexlContext;
@@ -117,15 +118,19 @@ public class InvokeParamNameTest {
// Not needed
}
- public void parentEvents(TriggerEvent[] evts) throws InvokerException {
+ public void parentEvent(TriggerEvent evt) throws InvokerException {
// Not needed
}
- public void setParentStateId(String parentStateId) {
+ public void setInvokeId(String invokeId) {
// Not needed
}
- public void setParentExecutor(SCXMLExecutor parentExecutor) {
+ public void setEvaluator(Evaluator evaluator) {
+ // Not needed
+ }
+
+ public void setParentIOProcessor(SCXMLIOProcessor parentIOProcessor) {
// Not needed
}
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-01.xml Thu Apr 3 07:13:42 2014
@@ -30,7 +30,7 @@
<log expr="'Finalizing ...'" />
</finalize>
</invoke>
- <transition event="invoker.invoke.done" target="end" />
+ <transition event="done.invoke.invoker" target="end" />
</state>
<final id="end"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-02.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-02.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-02.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-02.xml Thu Apr 3 07:13:42 2014
@@ -21,7 +21,7 @@
<state id="invoker">
<invoke type="scxml" src="invoked-02.xml"/>
- <transition event="invoker.invoke.done" target="end" />
+ <transition event="done.invoke.invoker" target="end" />
</state>
<final id="end"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-03.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-03.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-03.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/invoker-03.xml Thu Apr 3 07:13:42 2014
@@ -25,7 +25,7 @@
<log expr="'Invoker ...'"/>
</onentry>
<invoke type="scxml" src="invoked-03.xml"/>
- <transition event="invoker.invoke.done" target="end">
+ <transition event="done.invoke.invoker" target="end">
<log expr="' Outer invoke completed'"/>
</transition>
</state>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/SCXMLReaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/SCXMLReaderTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/SCXMLReaderTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/SCXMLReaderTest.java Thu Apr 3 07:13:42 2014
@@ -163,9 +163,9 @@ public class SCXMLReaderTest {
public void testSCXMLReaderSend01Sample() throws Exception {
// Digest
scxml = SCXMLTestHelper.parse(send01);
- State ten = (State) scxml.getInitialTransition().getTargets().get(0);
+ State ten = (State) scxml.getInitialTransition().getTargets().iterator().next();
Assert.assertEquals("ten", ten.getId());
- List<Transition> ten_done = ten.getTransitionsList("ten.done");
+ List<Transition> ten_done = ten.getTransitionsList("done.state.ten");
Assert.assertEquals(1, ten_done.size());
Transition ten2twenty = ten_done.get(0);
List<Action> actions = ten2twenty.getActions();
@@ -189,7 +189,7 @@ public class SCXMLReaderTest {
Assert.assertNotNull(scxml);
scxmlAsString = serialize(scxml);
Assert.assertNotNull(scxmlAsString);
- Final foo = (Final) scxml.getInitialTransition().getTargets().get(0);
+ Final foo = (Final) scxml.getInitialTransition().getTargets().iterator().next();
Assert.assertEquals("foo", foo.getId());
}
@@ -200,9 +200,9 @@ public class SCXMLReaderTest {
"action", MyAction.class);
cas.add(ca);
scxml = SCXMLTestHelper.parse(action01, cas);
- EnterableState state = (EnterableState) scxml.getInitialTransition().getTargets().get(0);
+ EnterableState state = (EnterableState) scxml.getInitialTransition().getTargets().iterator().next();
Assert.assertEquals("actions", state.getId());
- List<Action> actions = state.getOnEntry().getActions();
+ List<Action> actions = state.getOnEntries().get(0).getActions();
Assert.assertEquals(1, actions.size());
MyAction my = (MyAction) actions.get(0);
Assert.assertNotNull(my);
@@ -218,7 +218,7 @@ public class SCXMLReaderTest {
Assert.assertNotNull(scxml);
scxmlAsString = serialize(scxml);
Assert.assertNotNull(scxmlAsString);
- Final foo = (Final) scxml.getInitialTransition().getTargets().get(0);
+ Final foo = (Final) scxml.getInitialTransition().getTargets().iterator().next();
Assert.assertEquals("foo", foo.getId());
Datamodel dataModel = scxml.getDatamodel();
Assert.assertNotNull(dataModel);
@@ -241,7 +241,7 @@ public class SCXMLReaderTest {
Assert.assertNotNull(scxml);
scxmlAsString = serialize(scxml);
Assert.assertNotNull(scxmlAsString);
- foo = (Final) scxml.getInitialTransition().getTargets().get(0);
+ foo = (Final) scxml.getInitialTransition().getTargets().iterator().next();
Assert.assertEquals("foo", foo.getId());
dataModel = scxml.getDatamodel();
Assert.assertNotNull(dataModel);
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-1.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-1.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-1.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-1.xml Thu Apr 3 07:13:42 2014
@@ -22,7 +22,7 @@
<state id="srctest1" src="src-test-2.xml">
<transition event="src.test" target="srctest3end"/>
- <transition event="srctest1.done" target="srctest1end"/>
+ <transition event="done.state.srctest1" target="srctest1end"/>
</state>
<final id="srctest1end"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-2.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-2.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-2.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-2.xml Thu Apr 3 07:13:42 2014
@@ -21,7 +21,7 @@
initial="srctest2">
<state id="srctest2" src="src-test-3.xml">
- <transition event="srctest2.done" target="srctest2end"/>
+ <transition event="done.state.srctest2" target="srctest2end"/>
</state>
<final id="srctest2end"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-4.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-4.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-4.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-4.xml Thu Apr 3 07:13:42 2014
@@ -21,7 +21,7 @@
initial="srctest1">
<state id="srctest1" src="bad-document-404.xml">
- <transition event="srctest1.done" target="srctest1end"/>
+ <transition event="done.state.srctest1" target="srctest1end"/>
</state>
<final id="srctest1end"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-5.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-5.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-5.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/io/src-test-5.xml Thu Apr 3 07:13:42 2014
@@ -21,7 +21,7 @@
initial="srctest1">
<state id="srctest1" src="src-test-3.xml#badstateid404">
- <transition event="srctest1.done" target="srctest1end"/>
+ <transition event="done.state.srctest1" target="srctest1end"/>
</state>
<final id="srctest1end"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/issues/issue62-02.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/issues/issue62-02.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/issues/issue62-02.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/issues/issue62-02.xml Thu Apr 3 07:13:42 2014
@@ -27,7 +27,7 @@
<transition target="s2.1"/>
</initial>
<state id="s2.1" src="issue62-02-ext.xml#e1" />
- <transition event="s2.1.done" target="s3"/>
+ <transition event="done.state.s2.1" target="s3"/>
</state>
<final id="s3"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/issues/issue62-03.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/issues/issue62-03.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/issues/issue62-03.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/issues/issue62-03.xml Thu Apr 3 07:13:42 2014
@@ -27,7 +27,7 @@
<transition target="s2.1"/>
</initial>
<state id="s2.1" src="issue62-03-ext.xml#e1" />
- <transition event="s2.1.done" target="s3"/>
+ <transition event="done.state.s2.1" target="s3"/>
</state>
<final id="s3"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/DatamodelTest.java Thu Apr 3 07:13:42 2014
@@ -100,12 +100,12 @@ public class DatamodelTest {
Map<String, Object> payload = new HashMap<String, Object>();
payload.put("one", "1");
payload.put("two", "2");
- TriggerEvent te = new TriggerEvent("ten.done", TriggerEvent.SIGNAL_EVENT, payload);
+ TriggerEvent te = new TriggerEvent("done.state.ten", TriggerEvent.SIGNAL_EVENT, payload);
SCXMLTestHelper.fireEvent(exec01, te);
currentStates = exec01.getCurrentStatus().getStates();
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
- SCXMLTestHelper.fireEvent(exec01, "twenty.done");
+ SCXMLTestHelper.fireEvent(exec01, "done.state.twenty");
currentStates = exec01.getCurrentStatus().getStates();
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("thirty", currentStates.iterator().next().getId());
@@ -125,7 +125,7 @@ public class DatamodelTest {
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", currentStates.iterator().next().getId());
exec01 = SCXMLTestHelper.testInstanceSerializability(exec01);
- currentStates = fireEvent("ten.done", exec01);
+ currentStates = fireEvent("done.state.ten", exec01);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
// exec02
@@ -133,23 +133,23 @@ public class DatamodelTest {
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", currentStates.iterator().next().getId());
// exec01
- currentStates = fireEvent("twenty.done", exec01);
+ currentStates = fireEvent("done.state.twenty", exec01);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("thirty", currentStates.iterator().next().getId());
exec01 = SCXMLTestHelper.testInstanceSerializability(exec01);
// exec02
- currentStates = fireEvent("ten.done", exec02);
+ currentStates = fireEvent("done.state.ten", exec02);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
exec02 = SCXMLTestHelper.testInstanceSerializability(exec02);
- currentStates = fireEvent("twenty.done", exec02);
+ currentStates = fireEvent("done.state.twenty", exec02);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("thirty", currentStates.iterator().next().getId());
- currentStates = fireEvent("thirty.done", exec02);
+ currentStates = fireEvent("done.state.thirty", exec02);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("forty", currentStates.iterator().next().getId());
// exec01
- currentStates = fireEvent("thirty.done", exec01);
+ currentStates = fireEvent("done.state.thirty", exec01);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("forty", currentStates.iterator().next().getId());
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/HistoryTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/HistoryTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/HistoryTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/HistoryTest.java Thu Apr 3 07:13:42 2014
@@ -148,7 +148,7 @@ public class HistoryTest {
}
private String nextPhase() throws Exception {
- Set<EnterableState> currentStates = SCXMLTestHelper.fireEvent(exec, "phase.done");
+ Set<EnterableState> currentStates = SCXMLTestHelper.fireEvent(exec, "done.state.phase");
Assert.assertEquals(1, currentStates.size());
return currentStates.iterator().next().getId();
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/ScxmlInitialAttributeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/ScxmlInitialAttributeTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/ScxmlInitialAttributeTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/ScxmlInitialAttributeTest.java Thu Apr 3 07:13:42 2014
@@ -17,7 +17,6 @@
package org.apache.commons.scxml2.model;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
@@ -59,8 +58,8 @@ public class ScxmlInitialAttributeTest {
public void testInitial() throws Exception {
SCXML scxml = SCXMLTestHelper.parse(new StringReader(SCXML_WITH_LEGAL_INITIAL), null);
assertEquals("The initial state ID reading was wrong.", "s1", scxml.getInitial());
- assertNotNull(scxml.getInitialTransition().getTargets().get(0));
- assertEquals("The initial state resolution was wrong.", "s1", scxml.getInitialTransition().getTargets().get(0).getId());
+ TransitionTarget tt = scxml.getInitialTransition().getTargets().iterator().next();
+ assertEquals("The initial state resolution was wrong.", "s1", tt.getId());
SCXMLExecutor exec = executeSCXML(scxml);
assertEquals(scxml.getTargets().get("s1"), exec.getCurrentStatus().getStates().iterator().next());
}
@@ -69,8 +68,8 @@ public class ScxmlInitialAttributeTest {
public void testNoInitial() throws Exception {
SCXML scxml = SCXMLTestHelper.parse(new StringReader(SCXML_WITH_NO_INITIAL), null);
assertNull(scxml.getInitial());
- assertNotNull("The initial state ID reading was wrong.", scxml.getInitialTransition().getTargets().get(0));
- assertEquals("The initial state resolution was wrong.", "s1", scxml.getInitialTransition().getTargets().get(0).getId());
+ TransitionTarget tt = scxml.getInitialTransition().getTargets().iterator().next();
+ assertEquals("The initial state resolution was wrong.", "s1", tt.getId());
SCXMLExecutor exec = executeSCXML(scxml);
assertEquals(scxml.getTargets().get("s1"), exec.getCurrentStatus().getStates().iterator().next());
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/StatelessModelTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/StatelessModelTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/StatelessModelTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/StatelessModelTest.java Thu Apr 3 07:13:42 2014
@@ -173,7 +173,7 @@ public class StatelessModelTest {
Set<EnterableState> currentStates = exec01.getCurrentStatus().getStates();
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", currentStates.iterator().next().getId());
- currentStates = fireEvent("ten.done", exec01);
+ currentStates = fireEvent("done.state.ten", exec01);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
// exec02
@@ -181,14 +181,14 @@ public class StatelessModelTest {
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", currentStates.iterator().next().getId());
// exec01
- currentStates = fireEvent("twenty.done", exec01);
+ currentStates = fireEvent("done.state.twenty", exec01);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("thirty", currentStates.iterator().next().getId());
// exec02
- currentStates = fireEvent("ten.done", exec02);
+ currentStates = fireEvent("done.state.ten", exec02);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", currentStates.iterator().next().getId());
- currentStates = fireEvent("twenty.done", exec02);
+ currentStates = fireEvent("done.state.twenty", exec02);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("thirty", currentStates.iterator().next().getId());
}
@@ -198,11 +198,11 @@ public class StatelessModelTest {
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("ten", (currentStates.iterator().
next()).getId());
- currentStates = fireEvent("ten.done", exec01);
+ currentStates = fireEvent("done.state.ten", exec01);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("twenty", (currentStates.iterator().
next()).getId());
- currentStates = fireEvent("twenty.done", exec01);
+ currentStates = fireEvent("done.state.twenty", exec01);
Assert.assertEquals(1, currentStates.size());
Assert.assertEquals("thirty", (currentStates.iterator().
next()).getId());
Added: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTargetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTargetTest.java?rev=1584272&view=auto
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTargetTest.java (added)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTargetTest.java Thu Apr 3 07:13:42 2014
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml2.model;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TransitionTargetTest {
+
+ @Test
+ public void testIsDescendantNullParent() {
+ State state = new State();
+ State context = new State();
+
+ Assert.assertFalse(state.isDescendantOf(context));
+ }
+
+ @Test
+ public void testIsDescendantNotEqual() {
+ State state = new State();
+ state.setParent(new State());
+ State context = new State();
+
+ Assert.assertFalse(state.isDescendantOf(context));
+ }
+
+ @Test
+ public void testIsDescendantEqual() {
+ State state = new State();
+ State context = new State();
+ state.setParent(context);
+
+ Assert.assertTrue(state.isDescendantOf(context));
+ }
+
+ @Test
+ public void testIsDescendantParentEqual() {
+ State state = new State();
+ State context = new State();
+ State parent = new State();
+
+ parent.setParent(context);
+ state.setParent(parent);
+
+ Assert.assertTrue(state.isDescendantOf(context));
+ }
+}
Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTargetTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTargetTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTest.java?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/TransitionTest.java Thu Apr 3 07:13:42 2014
@@ -30,32 +30,15 @@ public class TransitionTest {
}
@Test
- public void testGetRuntimeTargetNullNoParent() {
- Assert.assertTrue(transition.getRuntimeTargets().size() > 0);
- }
-
- @Test
- public void testGetRuntimeTargetNullWithParent() {
+ public void testGetTargets() {
+ Assert.assertEquals(0, transition.getTargets().size());
+
State state = new State();
state.setId("1");
-
- transition.setParent(state);
-
- Assert.assertEquals("1", (transition.getRuntimeTargets().get(0)).getId());
- }
-
- @Test
- public void testGetRuntimeTarget() {
- State state = new State();
- state.setId("2");
-
+
transition.getTargets().add(state);
-
- Assert.assertEquals("2", (transition.getRuntimeTargets().get(0)).getId());
- }
-
- @Test
- public void testGetPath() {
- Assert.assertTrue(transition.getPaths().size() > 0);
+
+ Assert.assertEquals(1, transition.getTargets().size());
+ Assert.assertEquals("1", transition.getTargets().iterator().next().getId());
}
}
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/parallel-03.xml Thu Apr 3 07:13:42 2014
@@ -101,7 +101,7 @@
</state>
- <transition event="para.done" target="end"/>
+ <transition event="done.state.para" target="end"/>
<onexit>
<assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/stateless-parallel-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/stateless-parallel-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/stateless-parallel-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/stateless-parallel-01.xml Thu Apr 3 07:13:42 2014
@@ -41,7 +41,7 @@
<final id="state2.final"/>
</state>
- <transition event="main.done" target="next" />
+ <transition event="done.state.main" target="next" />
</parallel>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/prefix-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/prefix-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/prefix-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/prefix-01.xml Thu Apr 3 07:13:42 2014
@@ -20,7 +20,7 @@
initial="ten">
<scxml:state id="ten">
- <scxml:transition event="ten.done" target="twenty"/>
+ <scxml:transition event="done.state.ten" target="twenty"/>
</scxml:state>
<scxml:final id="twenty"/>
Added: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImplTest.java?rev=1584272&view=auto
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImplTest.java (added)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImplTest.java Thu Apr 3 07:13:42 2014
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml2.semantics;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.scxml2.env.MockErrorReporter;
+import org.apache.commons.scxml2.env.SimpleErrorReporter;
+import org.apache.commons.scxml2.model.EnterableState;
+import org.apache.commons.scxml2.model.Parallel;
+import org.apache.commons.scxml2.model.State;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SCXMLSemanticsImplTest {
+
+ @Test
+ public void testIsLegalConfigNoStates() {
+ Set<EnterableState> states = new HashSet<EnterableState>();
+
+ Assert.assertTrue(new SCXMLSemanticsImpl().isLegalConfig(states, new SimpleErrorReporter()));
+ }
+
+ @Test
+ public void testIsLegalConfigInvalidParallel() {
+ Set<EnterableState> states = new HashSet<EnterableState>();
+ Parallel parallel = new Parallel();
+
+ Parallel parent = new Parallel();
+ parent.setId("4");
+
+ State state1 = new State();
+ state1.setId("1");
+ State state2 = new State();
+ state2.setId("2");
+
+ parent.addChild(state1);
+ parent.addChild(state2);
+
+ parallel.setParent(parent);
+
+ states.add(parallel);
+
+ MockErrorReporter errorReporter = new MockErrorReporter();
+
+ Assert.assertFalse(new SCXMLSemanticsImpl().isLegalConfig(states, errorReporter));
+ Assert.assertEquals(ErrorConstants.ILLEGAL_CONFIG, errorReporter.getErrCode());
+ Assert.assertEquals("Not all AND states active for parallel 4", errorReporter.getErrDetail());
+ }
+
+ @Test
+ public void testIsLegalConfigMultipleTopLevel() {
+ Set<EnterableState> states = new HashSet<EnterableState>();
+
+ State state1 = new State();
+ state1.setId("1");
+ State state2 = new State();
+ state2.setId("2");
+
+ states.add(state1);
+ states.add(state2);
+
+ MockErrorReporter errorReporter = new MockErrorReporter();
+
+ Assert.assertTrue(new SCXMLSemanticsImpl().isLegalConfig(states, errorReporter));
+ Assert.assertEquals(ErrorConstants.ILLEGAL_CONFIG, errorReporter.getErrCode());
+ Assert.assertEquals("Multiple top-level OR states active!", errorReporter.getErrDetail());
+ }
+
+ @Test
+ public void testIsLegalConfigMultipleStatesActive() {
+ Set<EnterableState> states = new HashSet<EnterableState>();
+
+ State state1 = new State();
+ state1.setId("1");
+
+ State state2 = new State();
+ state2.setId("2");
+
+ State parent = new State();
+ parent.setId("parentid");
+
+ state2.setParent(parent);
+ state1.setParent(parent);
+
+ states.add(state1);
+ states.add(state2);
+
+ MockErrorReporter errorReporter = new MockErrorReporter();
+
+ Assert.assertFalse(new SCXMLSemanticsImpl().isLegalConfig(states, errorReporter));
+ Assert.assertEquals(ErrorConstants.ILLEGAL_CONFIG, errorReporter.getErrCode());
+ Assert.assertEquals("Multiple OR states active for state parentid", errorReporter.getErrDetail());
+ }
+}
Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImplTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImplTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/send-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/send-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/send-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/send-01.xml Thu Apr 3 07:13:42 2014
@@ -20,7 +20,7 @@
initial="ten">
<state id="ten">
- <transition event="ten.done" target="twenty">
+ <transition event="done.state.ten" target="twenty">
<send sendid="send1" delay="'0'"
target="'http://localhost:8080/VXMLInterpreter'" type="'v3'"
xmlns:v3="http://foo.bar.com/vxml3"
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/send-02.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/send-02.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/send-02.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/send-02.xml Thu Apr 3 07:13:42 2014
@@ -25,56 +25,56 @@
the state "seventy", then hop over and end up in "ninety" -->
<state id="ten">
<onentry>
- <send event="'ten.' + 'done'" />
+ <send event="'done.state.' + 'ten'" />
</onentry>
- <transition event="ten.done" target="twenty" />
+ <transition event="done.state.ten" target="twenty" />
</state>
<state id="twenty">
<onentry>
- <send event="'twenty.done'" type="'scxml'" />
+ <send event="'done.state.twenty'" type="'scxml'" />
</onentry>
- <transition event="twenty.done" target="thirty" />
+ <transition event="done.state.twenty" target="thirty" />
</state>
<state id="thirty">
<onentry>
- <send event="'thirty.done'" type="' sCxML '" />
+ <send event="'done.state.thirty'" type="' sCxML '" />
</onentry>
- <transition event="thirty.done" target="forty" />
+ <transition event="done.state.thirty" target="forty" />
</state>
<state id="forty">
<onentry>
- <send event="'forty.done'" type=" " target=" " />
+ <send event="'done.state.forty'" type=" " target=" " />
</onentry>
- <transition event="forty.done" target="fifty" />
+ <transition event="done.state.forty" target="fifty" />
</state>
<state id="fifty">
<onentry>
- <send event="'fifty.done'" target="' '" />
+ <send event="'done.state.fifty'" target="' '" />
</onentry>
- <transition event="fifty.done" target="sixty" />
+ <transition event="done.state.fifty" target="sixty" />
</state>
<state id="sixty">
<onentry>
- <send event="'sixty.done'" type="'scxml'" target=" " />
+ <send event="'done.state.sixty'" type="'scxml'" target=" " />
</onentry>
- <transition event="sixty.done" target="seventy" />
+ <transition event="done.state.sixty" target="seventy" />
</state>
<state id="seventy">
<onentry>
- <send event="'seventy.done'" type="'scxml'" target="'foo'" />
+ <send event="'done.state.seventy'" type="'scxml'" target="'foo'" />
</onentry>
<!-- This transition should not be followed since
target "foo" is unavailable (any target other
than an empty target is unavailable, empty target
is current execution i.e. this state machine) -->
- <transition event="seventy.done" target="eighty" />
+ <transition event="done.state.seventy" target="eighty" />
<!-- Since "foo" it not available, the event
"error.send.targetunavailable" should be raised -->
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-01.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-01.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-01.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-01.xml Thu Apr 3 07:13:42 2014
@@ -24,8 +24,8 @@
<state id="ten">
<!-- twenty should win, document order -->
- <transition event="ten.done" target="twenty" />
- <transition event="ten.done" target="thirty" />
+ <transition event="done.state.ten" target="twenty" />
+ <transition event="done.state.ten" target="thirty" />
</state>
<final id="twenty"/>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-02.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-02.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-02.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-02.xml Thu Apr 3 07:13:42 2014
@@ -27,12 +27,12 @@
<transition target="eleven"/>
</initial>
- <transition event="ten.done" target="twenty" />
+ <transition event="done.state.ten" target="twenty" />
<state id="eleven">
<!-- thirty wins since eleven trumps
- ten in the state heirarchy -->
- <transition event="ten.done" target="thirty" />
+ ten in the state hierarchy -->
+ <transition event="done.state.ten" target="thirty" />
</state>
</state>
Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-03.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-03.xml?rev=1584272&r1=1584271&r2=1584272&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-03.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/tie-breaker-03.xml Thu Apr 3 07:13:42 2014
@@ -27,18 +27,18 @@
<transition target="eleven"/>
</initial>
- <transition event="ten.done" target="twenty" />
+ <transition event="done.state.ten" target="twenty" />
- <transition event="ten.done" target="thirty" />
+ <transition event="done.state.ten" target="thirty" />
<state id="eleven">
<!-- forty wins due to document order and the fact
that since eleven trumps ten in the state
- heirarchy -->
- <transition event="ten.done" target="forty" />
+ hierarchy -->
+ <transition event="done.state.ten" target="forty" />
- <transition event="ten.done" target="fifty" />
+ <transition event="done.state.ten" target="fifty" />
</state>