Author: rahul Date: Wed Dec 13 14:03:46 2006 New Revision: 486855 URL: http://svn.apache.org/viewvc?view=rev&rev=486855 Log: Couple more test cases, for simple document having SCXML elements with prefixes.
Added: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/prefix-01.xml (with props) 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/io/SCXMLDigesterTest.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=486855&r1=486854&r2=486855 ============================================================================== --- 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 Dec 13 14:03:46 2006 @@ -47,7 +47,7 @@ // Test data private URL microwave01jsp, microwave02jsp, microwave01jexl, - microwave02jexl, transitions01, transitions02, send02; + microwave02jexl, transitions01, transitions02, prefix01, send01, send02; private SCXMLExecutor exec; /** @@ -66,6 +66,10 @@ getResource("org/apache/commons/scxml/transitions-01.xml"); transitions02 = this.getClass().getClassLoader(). getResource("org/apache/commons/scxml/transitions-02.xml"); + prefix01 = this.getClass().getClassLoader(). + getResource("org/apache/commons/scxml/prefix-01.xml"); + send01 = this.getClass().getClassLoader(). + getResource("org/apache/commons/scxml/send-01.xml"); send02 = this.getClass().getClassLoader(). getResource("org/apache/commons/scxml/send-02.xml"); } @@ -75,7 +79,7 @@ */ public void tearDown() { microwave01jsp = microwave02jsp = microwave01jexl = microwave02jexl = - transitions01 = transitions02 = send02 = null; + transitions01 = transitions02 = prefix01 = send01 = send02 = null; } /** @@ -107,6 +111,19 @@ checkMicrowave02Sample(); } + public void testSCXMLExecutorPrefix01Sample() { + exec = SCXMLTestHelper.getExecutor(prefix01); + assertNotNull(exec); + Set currentStates = exec.getCurrentStatus().getStates(); + assertEquals(1, currentStates.size()); + assertEquals("ten", ((State)currentStates.iterator(). + next()).getId()); + currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done"); + assertEquals(1, currentStates.size()); + assertEquals("twenty", ((State)currentStates.iterator(). + next()).getId()); + } + public void testSCXMLExecutorTransitions01Sample() { exec = SCXMLTestHelper.getExecutor(transitions01); assertNotNull(exec); @@ -148,7 +165,24 @@ } } - public void testSendTargettypeSCXMLSample() { + public void testSend01Sample() { + exec = SCXMLTestHelper.getExecutor(send01); + assertNotNull(exec); + try { + Set currentStates = exec.getCurrentStatus().getStates(); + assertEquals(1, currentStates.size()); + assertEquals("ten", ((State)currentStates.iterator(). + next()).getId()); + currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done"); + assertEquals(1, currentStates.size()); + assertEquals("twenty", ((State)currentStates.iterator(). + next()).getId()); + } catch (Exception e) { + fail(e.getMessage()); + } + } + + public void testSend02TargettypeSCXMLSample() { exec = SCXMLTestHelper.getExecutor(send02); assertNotNull(exec); try { 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=486855&r1=486854&r2=486855 ============================================================================== --- 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 Dec 13 14:03:46 2006 @@ -48,7 +48,7 @@ } // Test data - private URL microwave01, microwave02, transitions01, send01; + private URL microwave01, microwave02, transitions01, send01, prefix01; private SCXML scxml; private String scxmlAsString; @@ -64,13 +64,15 @@ getResource("org/apache/commons/scxml/transitions-01.xml"); send01 = this.getClass().getClassLoader(). getResource("org/apache/commons/scxml/send-01.xml"); + prefix01 = this.getClass().getClassLoader(). + getResource("org/apache/commons/scxml/prefix-01.xml"); } /** * Tear down instance variables required by this test case. */ public void tearDown() { - microwave01 = microwave02 = transitions01 = send01 = null; + microwave01 = microwave02 = transitions01 = prefix01 = send01 = null; scxml = null; scxmlAsString = null; } @@ -80,17 +82,30 @@ */ public void testSCXMLDigesterMicrowave01Sample() { scxml = SCXMLTestHelper.digest(microwave01); + assertNotNull(scxml); scxmlAsString = serialize(scxml); + assertNotNull(scxmlAsString); } public void testSCXMLDigesterMicrowave02Sample() { scxml = SCXMLTestHelper.digest(microwave02); + assertNotNull(scxml); scxmlAsString = serialize(scxml); + assertNotNull(scxmlAsString); } public void testSCXMLDigesterTransitions01Sample() { scxml = SCXMLTestHelper.digest(transitions01); + assertNotNull(scxml); scxmlAsString = serialize(scxml); + assertNotNull(scxmlAsString); + } + + public void testSCXMLDigesterPrefix01Sample() { + scxml = SCXMLTestHelper.digest(prefix01); + assertNotNull(scxml); + scxmlAsString = serialize(scxml); + assertNotNull(scxmlAsString); } public void testSCXMLDigesterSend01Sample() { Added: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/prefix-01.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/prefix-01.xml?view=auto&rev=486855 ============================================================================== --- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/prefix-01.xml (added) +++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/prefix-01.xml Wed Dec 13 14:03:46 2006 @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml:scxml xmlns:scxml="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <scxml:state id="ten"> + <scxml:transition event="ten.done" target="twenty"/> + </scxml:state> + + <scxml:state id="twenty" final="true" /> + +</scxml:scxml> + Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/prefix-01.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/prefix-01.xml ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]