commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r1132819 - in /commons/proper/scxml/trunk/src: main/java/org/apache/commons/scxml/SCXMLHelper.java test/java/org/apache/commons/scxml/SCXMLExecutorTest.java test/java/org/apache/commons/scxml/transitions-05.xml
Date Mon, 06 Jun 2011 22:47:09 GMT
Author: rahul
Date: Mon Jun  6 22:47:09 2011
New Revision: 1132819

URL: http://svn.apache.org/viewvc?rev=1132819&view=rev
Log:
SCXML-161 Transition leaving a child state of parallel incorrect. Fix by accounting for non-composite
regions.
Test case provided by Enrico Nardelli <nardelli at mat dot uniroma2 dot it>.

Added:
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-05.xml 
 (with props)
Modified:
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java?rev=1132819&r1=1132818&r2=1132819&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLHelper.java Mon
Jun  6 22:47:09 2011
@@ -259,7 +259,7 @@ public final class SCXMLHelper {
                     for (Iterator act = currentStates.iterator();
                             act.hasNext();) {
                         TransitionTarget a = (TransitionTarget) act.next();
-                        if (isDescendant(a, s)) {
+                        if (isDescendant(a, s) || a == s) {
                             //a is affected
                             boolean added = false;
                             added = allStates.add(a);

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java?rev=1132819&r1=1132818&r2=1132819&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
(original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
Mon Jun  6 22:47:09 2011
@@ -43,7 +43,7 @@ public class SCXMLExecutorTest extends T
     // Test data
     private URL microwave01jsp, microwave02jsp, microwave01jexl,
         microwave02jexl, microwave03jexl, microwave04jexl, microwave05jexl, transitions01,
-        transitions02, transitions03, transitions04, prefix01, send01, send02;
+        transitions02, transitions03, transitions04, transitions05, prefix01, send01, send02;
     private SCXMLExecutor exec;
 
     /**
@@ -72,6 +72,8 @@ public class SCXMLExecutorTest extends T
             getResource("org/apache/commons/scxml/transitions-03.xml");
         transitions04 = this.getClass().getClassLoader().
             getResource("org/apache/commons/scxml/transitions-04.xml");
+        transitions05 = this.getClass().getClassLoader().
+            getResource("org/apache/commons/scxml/transitions-05.xml");
         prefix01 = this.getClass().getClassLoader().
             getResource("org/apache/commons/scxml/prefix-01.xml");
         send01 = this.getClass().getClassLoader().
@@ -86,7 +88,7 @@ public class SCXMLExecutorTest extends T
     public void tearDown() {
         microwave01jsp = microwave02jsp = microwave01jexl = microwave02jexl =
             microwave04jexl = microwave05jexl = transitions01 = transitions02 = transitions03
=
-            transitions04 = prefix01 = send01 = send02 = null;
+            transitions04 = transitions05 = prefix01 = send01 = send02 = null;
     }
 
     /**
@@ -234,6 +236,17 @@ public class SCXMLExecutorTest extends T
             next()).getId());
     }
 
+    public void testSCXMLExecutorTransitions05Sample() throws Exception {
+        SCXML scxml = SCXMLTestHelper.parse(transitions05);
+        assertNotNull(scxml);
+        exec = SCXMLTestHelper.getExecutor(scxml);
+        assertNotNull(exec);
+        SCXMLTestHelper.assertPostTriggerStates(exec, "start", new String[]{"one", "two"});
+        SCXMLTestHelper.assertPostTriggerState(exec, "onetwo_three", "three");
+        SCXMLTestHelper.assertPostTriggerStates(exec, "three_one", new String[]{"one", "two"});
+        SCXMLTestHelper.assertPostTriggerState(exec, "two_four", "four");
+    }
+
     public void testSend01Sample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(send01);
         assertNotNull(exec);

Added: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-05.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-05.xml?rev=1132819&view=auto
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-05.xml (added)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-05.xml Mon
Jun  6 22:47:09 2011
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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 xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="init">
+       <state id="init">
+               <transition event="start" target="onetwo" />
+       </state>
+       <parallel id="onetwo">
+               <transition event="onetwo_three" target="three" />
+               <state id="one">
+               </state>
+               <state id="two">
+                       <transition event="two_four" target="four" />
+               </state>
+       </parallel>
+       <state id="three">
+               <transition event="three_one" target="one" />
+               <transition event="three_four" target="four" />
+       </state>
+       <state id="four">
+               <transition event="four_onetwo" target="onetwo" />
+               <transition event="four_three" target="three" />
+       </state>
+</scxml>

Propchange: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/transitions-05.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message