Author: rahul Date: Mon Jun 6 22:49:05 2011 New Revision: 1132823 URL: http://svn.apache.org/viewvc?rev=1132823&view=rev Log: Port r1132819 from trunk. 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/branches/J6/src/test/java/org/apache/commons/scxml/transitions-06.xml (with props) Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/SCXMLHelper.java commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/SCXMLHelper.java URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/SCXMLHelper.java?rev=1132823&r1=1132822&r2=1132823&view=diff ============================================================================== --- commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/SCXMLHelper.java (original) +++ commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/SCXMLHelper.java Mon Jun 6 22:49:05 2011 @@ -250,7 +250,7 @@ public final class SCXMLHelper { for (TransitionTarget tt : par.getChildren()) { State s = (State) tt; for (TransitionTarget a : currentStates) { - if (isDescendant(a, s)) { + if (isDescendant(a, s) || a == s) { //a is affected boolean added = false; added = allStates.add(a); Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java?rev=1132823&r1=1132822&r2=1132823&view=diff ============================================================================== --- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java (original) +++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java Mon Jun 6 22:49:05 2011 @@ -41,7 +41,7 @@ public class SCXMLExecutorTest extends T // Test data private URL microwave01jsp, microwave02jsp, microwave01jexl, microwave02jexl, microwave03jexl, microwave04jexl, microwave05jexl, transitions01, - transitions02, transitions03, transitions04, transitions05, prefix01, send01, send02; + transitions02, transitions03, transitions04, transitions05, transitions06, prefix01, send01, send02; private SCXMLExecutor exec; /** @@ -73,6 +73,8 @@ public class SCXMLExecutorTest extends T getResource("org/apache/commons/scxml/transitions-04.xml"); transitions05 = this.getClass().getClassLoader(). getResource("org/apache/commons/scxml/transitions-05.xml"); + transitions06 = this.getClass().getClassLoader(). + getResource("org/apache/commons/scxml/transitions-06.xml"); prefix01 = this.getClass().getClassLoader(). getResource("org/apache/commons/scxml/prefix-01.xml"); send01 = this.getClass().getClassLoader(). @@ -88,7 +90,7 @@ public class SCXMLExecutorTest extends T public void tearDown() { microwave01jsp = microwave02jsp = microwave01jexl = microwave02jexl = microwave04jexl = microwave05jexl = transitions01 = transitions02 = transitions03 = - transitions04 = transitions05 = prefix01 = send01 = send02 = null; + transitions04 = transitions05 = transitions06 = prefix01 = send01 = send02 = null; } /** @@ -235,6 +237,17 @@ public class SCXMLExecutorTest extends T SCXMLTestHelper.assertPostTriggerState(exec, "foo", "end"); } + public void testSCXMLExecutorTransitions06Sample() throws Exception { + SCXML scxml = SCXMLTestHelper.parse(transitions06); + 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/branches/J6/src/test/java/org/apache/commons/scxml/transitions-06.xml URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/transitions-06.xml?rev=1132823&view=auto ============================================================================== --- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/transitions-06.xml (added) +++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/transitions-06.xml Mon Jun 6 22:49:05 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/branches/J6/src/test/java/org/apache/commons/scxml/transitions-06.xml ------------------------------------------------------------------------------ svn:eol-style = native