Author: jbeard
Date: Fri Jun 25 14:16:51 2010
New Revision: 957967

URL: http://svn.apache.org/viewvc?rev=957967&view=rev
Log:
Added another test for conditional transitions that also made use of executable 
content.

Added:
    
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/TestConditionalTransition_executableContent.xml
   (with props)
Modified:
    commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js
    
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/scripts/unitTest.js

Modified: 
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js?rev=957967&r1=957966&r2=957967&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js 
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/build.js 
Fri Jun 25 14:16:51 2010
@@ -78,7 +78,8 @@ require.def("build",
                                KitchenSink_performance 
:"test/kitchen_sink/KitchenSink_performance.xml",
                                KitchenSink_executableContent 
:"test/kitchen_sink/KitchenSink_executableContent.xml",
 */
-                               ConditionalTransition 
:"test/conditional_transition/TestConditionalTransition.xml"
+                               ConditionalTransition 
:"test/conditional_transition/TestConditionalTransition.xml",
+                               ConditionalTransition_executableContent 
:"test/conditional_transition/TestConditionalTransition_executableContent.xml"
                        }
 
                        //FIXME: this violates Don't Repeat Yourself; these 
paths are written here and in the module
@@ -120,7 +121,12 @@ require.def("build",
                                { 
                                        path : 
"test/conditional_transition/scripts/unitTest.js",
                                        scxmlTest : 
scxmlTests.ConditionalTransition            //back-link
-                               }                               
+                               },
+                               { 
+                                       path : 
"test/conditional_transition/scripts/unitTest.js",
+                                       scxmlTest : 
scxmlTests.ConditionalTransition_executableContent          //back-link
+                               }
+                               
                        ]
 
                        //gets populated at run-time

Added: 
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/TestConditionalTransition_executableContent.xml
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/TestConditionalTransition_executableContent.xml?rev=957967&view=auto
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/TestConditionalTransition_executableContent.xml
 (added)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/TestConditionalTransition_executableContent.xml
 Fri Jun 25 14:16:51 2010
@@ -0,0 +1,122 @@
+<?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.
+-->
+<!-- 
+This is to test transitions with guard conditions, and multiple
+transitions originating from the same state. 
+-->
+<scxml 
+       xmlns="http://www.w3.org/2005/07/scxml";
+       version="1.0"
+       profile="ecmascript">
+
+       <script>
+               self.x=0;
+       </script>
+
+       <initial>
+               <transition target="a"/>
+       </initial>
+
+       <!-- default transition -->
+       <state id="a">
+               <transition target="b"/>
+       </state>
+
+       <!-- regular transition -->
+       <state id="b">
+               <transition target="c" event="t1"/>
+       </state>
+
+       <!-- two default transitions, first should get priority (based on 
document order), end in d1 -->
+       <state id="c">
+               <transition target="d1"/>
+               <transition target="d2"/>
+       </state>
+
+       <!-- two regular transitions, first should get priority, end in e1 -->
+       <state id="d1">
+               <transition target="e1" event="t2"/>
+               <transition target="e2" event="t2"/>
+       </state>
+
+       <state id="d2"/>
+
+       <!-- two transitions with guard conditions; 
+               first has priority, but will fail, so second transition should 
be taken,
+               end in f2 -->
+       <state id="e1">
+               <transition target="f1" event="t3" cond="self.x !== 0"/>
+               <transition target="f2" event="t3" cond="self.x === 0">
+                       <script>
+                               self.x++;
+                       </script>
+               </transition> 
+       </state>
+
+       <state id="e2"/>
+
+       <state id="f1"/>
+
+       <!-- like above, but with three transitions -->
+       <state id="f2">
+               <transition target="g1" event="t4" cond="self.x &lt; 1"/>
+               <transition target="g2" event="t4" cond="self.x &gt; 1"/>
+               <transition target="g3" event="t4" cond="self.x == 1">
+                       <script>
+                               self.x++;
+                       </script>
+               </transition>
+       </state>
+
+       <state id="g1"/>
+
+       <state id="g2"/>
+
+       <state id="g3">
+
+               <onentry>
+                       <script>
+                               self.x*=2;
+                       </script>       
+               </onentry>
+
+               <initial>
+                       <transition target="h"/>
+               </initial>
+
+               <!-- this one should pass -->
+               <!-- x should now be 4 -->
+               <state id="h">
+                       <transition target="i" event="t5" cond="self.x==4"/>
+               </state>
+
+               <!-- this one should not pass, and the outer transition should 
be taken -->
+               <state id="i">
+                       <transition target="j" event="t5" cond="self.x!=4"/>
+               </state>
+
+               <state id="j"/>
+
+               <transition target="last" event="t5" cond="self.x==4"/>
+       </state>
+
+       <state id="last"/>
+</scxml>
+
+
+

Propchange: 
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/TestConditionalTransition_executableContent.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/scripts/unitTest.js
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/scripts/unitTest.js?rev=957967&r1=957966&r2=957967&view=diff
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/scripts/unitTest.js
 (original)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/core-module.SCXML-137/test/conditional_transition/scripts/unitTest.js
 Fri Jun 25 14:16:51 2010
@@ -51,7 +51,7 @@ dojo.require("doh.runner");
                                        console.log($(conf2));
                                        
doh.assertTrue(setwiseEqual(conf2,[sc._states.e1]));
 
-
+debugger;
                                        console.info("sending event t3")
                                        sc.t3()
                                        var conf3 = 
sc.getCurrentConfiguration();


Reply via email to