You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ra...@apache.org on 2007/04/25 23:06:12 UTC
svn commit: r532486 - in
/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml:
./ io/ semantics/
Author: rahul
Date: Wed Apr 25 14:06:11 2007
New Revision: 532486
URL: http://svn.apache.org/viewvc?view=rev&rev=532486
Log:
JUnit test cases update:
- Remove deprecated API usage
- Wire up the tests added in r522070 for the new parser
Modified:
jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/IOTestSuite.java
jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLDigesterTest.java
jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLSerializerTest.java
jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/semantics/TransitionTargetComparatorTest.java
Modified: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java?view=diff&rev=532486&r1=532485&r2=532486
==============================================================================
--- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java (original)
+++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java Wed Apr 25 14:06:11 2007
@@ -28,6 +28,7 @@
import org.apache.commons.scxml.env.SimpleContext;
import org.apache.commons.scxml.env.jsp.ELEvaluator;
+import org.apache.commons.scxml.model.SCXML;
import org.apache.commons.scxml.model.State;
import org.apache.commons.scxml.model.TransitionTarget;
/**
@@ -50,8 +51,8 @@
// Test data
private URL microwave01jsp, microwave02jsp, microwave01jexl,
- microwave02jexl, transitions01, transitions02, transitions03,
- prefix01, send01, send02;
+ microwave02jexl, microwave03jexl, microwave04jexl, transitions01,
+ transitions02, transitions03, transitions04, prefix01, send01, send02;
private SCXMLExecutor exec;
/**
@@ -66,12 +67,18 @@
getResource("org/apache/commons/scxml/env/jexl/microwave-01.xml");
microwave02jexl = this.getClass().getClassLoader().
getResource("org/apache/commons/scxml/env/jexl/microwave-02.xml");
+ microwave03jexl = this.getClass().getClassLoader().
+ getResource("org/apache/commons/scxml/env/jexl/microwave-03.xml");
+ microwave04jexl = this.getClass().getClassLoader().
+ getResource("org/apache/commons/scxml/env/jexl/microwave-04.xml");
transitions01 = this.getClass().getClassLoader().
getResource("org/apache/commons/scxml/transitions-01.xml");
transitions02 = this.getClass().getClassLoader().
getResource("org/apache/commons/scxml/transitions-02.xml");
transitions03 = this.getClass().getClassLoader().
getResource("org/apache/commons/scxml/transitions-03.xml");
+ transitions04 = this.getClass().getClassLoader().
+ getResource("org/apache/commons/scxml/transitions-04.xml");
prefix01 = this.getClass().getClassLoader().
getResource("org/apache/commons/scxml/prefix-01.xml");
send01 = this.getClass().getClassLoader().
@@ -85,8 +92,8 @@
*/
public void tearDown() {
microwave01jsp = microwave02jsp = microwave01jexl = microwave02jexl =
- transitions01 = transitions02 = transitions03 = prefix01 =
- send01 = send02 = null;
+ microwave04jexl = transitions01 = transitions02 = transitions03 =
+ transitions04 = prefix01 = send01 = send02 = null;
}
/**
@@ -118,6 +125,24 @@
checkMicrowave02Sample();
}
+ // Uses SCXMLParser (latest WD)
+ public void testSCXMLExecutorMicrowave03JexlSample() {
+ SCXML scxml = SCXMLTestHelper.parse(microwave03jexl);
+ assertNotNull(scxml);
+ exec = SCXMLTestHelper.getExecutor(scxml);
+ assertNotNull(exec);
+ checkMicrowave01Sample();
+ }
+
+ // Uses SCXMLParser (latest WD)
+ public void testSCXMLExecutorMicrowave04JexlSample() {
+ SCXML scxml = SCXMLTestHelper.parse(microwave04jexl);
+ assertNotNull(scxml);
+ exec = SCXMLTestHelper.getExecutor(scxml);
+ assertNotNull(exec);
+ checkMicrowave02Sample();
+ }
+
public void testSCXMLExecutorPrefix01Sample() {
exec = SCXMLTestHelper.getExecutor(prefix01);
assertNotNull(exec);
@@ -193,6 +218,36 @@
fail(e.getMessage());
}
}
+
+ // Uses SCXMLParser (latest WD)
+ public void testSCXMLExecutorTransitions04Sample() {
+ SCXML scxml = SCXMLTestHelper.parse(transitions04);
+ assertNotNull(scxml);
+ exec = SCXMLTestHelper.getExecutor(scxml);
+ assertNotNull(exec);
+ try {
+ Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+ assertEquals(3, currentStates.size());
+ Set expected = new HashSet();
+ expected.add("twenty_one_1");
+ expected.add("twenty_two_1");
+ expected.add("twenty_three_1");
+ for (Iterator i = currentStates.iterator(); i.hasNext(); ) {
+ TransitionTarget tt = (TransitionTarget) i.next();
+ if (!expected.remove(tt.getId())) {
+ fail("'" + tt.getId()
+ + "' is not an expected current state ID");
+ }
+ }
+ currentStates = SCXMLTestHelper.fireEvent(exec, "bar");
+ assertEquals(1, currentStates.size());
+ assertEquals("thirty", ((State)currentStates.iterator().
+ next()).getId());
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
public void testSend01Sample() {
exec = SCXMLTestHelper.getExecutor(send01);
assertNotNull(exec);
Modified: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java?view=diff&rev=532486&r1=532485&r2=532486
==============================================================================
--- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java (original)
+++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java Wed Apr 25 14:06:11 2007
@@ -147,8 +147,8 @@
State state2 = new State();
state2.setId("2");
- parent.addState(state1);
- parent.addState(state2);
+ parent.addChild(state1);
+ parent.addChild(state2);
parallel.setParent(parent);
Modified: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/IOTestSuite.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/IOTestSuite.java?view=diff&rev=532486&r1=532485&r2=532486
==============================================================================
--- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/IOTestSuite.java (original)
+++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/IOTestSuite.java Wed Apr 25 14:06:11 2007
@@ -49,6 +49,7 @@
TestSuite suite = new TestSuite();
suite.setName("Commons-SCXML IO Tests");
suite.addTest(SCXMLDigesterTest.suite());
+ suite.addTest(SCXMLParserTest.suite());
suite.addTest(SCXMLSerializerTest.suite());
suite.addTest(StateSrcTest.suite());
return suite;
Modified: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLDigesterTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLDigesterTest.java?view=diff&rev=532486&r1=532485&r2=532486
==============================================================================
--- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLDigesterTest.java (original)
+++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLDigesterTest.java Wed Apr 25 14:06:11 2007
@@ -111,7 +111,7 @@
public void testSCXMLDigesterSend01Sample() {
// Digest
scxml = SCXMLTestHelper.digest(send01);
- State ten = scxml.getInitialState();
+ State ten = (State) scxml.getInitialTarget();
assertEquals("ten", ten.getId());
List ten_done = ten.getTransitionsList("ten.done");
assertEquals(1, ten_done.size());
Modified: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLSerializerTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLSerializerTest.java?view=diff&rev=532486&r1=532485&r2=532486
==============================================================================
--- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLSerializerTest.java (original)
+++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/SCXMLSerializerTest.java Wed Apr 25 14:06:11 2007
@@ -58,7 +58,7 @@
scxml.setXmlns("namespace");
scxml.setVersion("version1");
scxml.setInitialstate("off");
- scxml.addState(new State());
+ scxml.addChild(new State());
String assertValue = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<scxml xmlns=\"namespace\" version=\"version1\" "
Modified: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/semantics/TransitionTargetComparatorTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/semantics/TransitionTargetComparatorTest.java?view=diff&rev=532486&r1=532485&r2=532486
==============================================================================
--- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/semantics/TransitionTargetComparatorTest.java (original)
+++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/semantics/TransitionTargetComparatorTest.java Wed Apr 25 14:06:11 2007
@@ -105,11 +105,11 @@
State target1 = new State();
Parallel parent = new Parallel();
target1.setParent(parent);
- parent.addState(target1);
+ parent.addChild(target1);
State target2 = new State();
target2.setParent(parent);
- parent.addState(target2);
+ parent.addChild(target2);
assertEquals(1, comparator.compare(target1, target2));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org