Author: jbeard
Date: Mon Jun 28 15:54:45 2010
New Revision: 958611

URL: http://svn.apache.org/viewvc?rev=958611&view=rev
Log:
Created new unit test to test _event.name and _event.data system properties. 
Test passes.

Added:
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/TestEventSystemProperties.xml
   (with props)
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/scripts/
    
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/scripts/unitTest.js
   (with props)
Modified:
    commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/build.js

Modified: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/build.js
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/build.js?rev=958611&r1=958610&r2=958611&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/build.js 
(original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/build.js Mon Jun 
28 15:54:45 2010
@@ -73,12 +73,15 @@ require.def("build",
 
                        //paths to all of the SCXML files we want to compile
                        var scxmlTests = {
+/*
                                KitchenSink_dataModule 
:"test/kitchen_sink/KitchenSink_dataModule.xml",
                                KitchenSink 
:"test/kitchen_sink/KitchenSink.xml",
                                KitchenSink_performance 
:"test/kitchen_sink/KitchenSink_performance.xml",
                                KitchenSink_executableContent 
:"test/kitchen_sink/KitchenSink_executableContent.xml",
                                ConditionalTransition 
:"test/conditional_transition/TestConditionalTransition.xml",
                                InPredicate 
:"test/in_predicate/TestInPredicate.xml",
+*/
+                               EventSystemProperties 
:"test/event_system_properties/TestEventSystemProperties.xml",
                        }
 
                        //FIXME: this violates Don't Repeat Yourself; these 
paths are written here and in the module
@@ -105,11 +108,14 @@ require.def("build",
 
 
                        var unitTestScripts = [
+/*
                                        
"test/kitchen_sink/scripts/unitTest_dataModel",
                                        "test/kitchen_sink/scripts/unitTest",
                                        
"test/kitchen_sink/scripts/unitTest_executableContent",
                                        
"test/conditional_transition/scripts/unitTest",
-                                       "test/in_predicate/scripts/unitTest"
+                                       "test/in_predicate/scripts/unitTest",
+*/
+                                       
"test/event_system_properties/scripts/unitTest"
                        ]
 
                        //gets populated at run-time

Added: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/TestEventSystemProperties.xml
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/TestEventSystemProperties.xml?rev=958611&view=auto
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/TestEventSystemProperties.xml
 (added)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/TestEventSystemProperties.xml
 Mon Jun 28 15:54:45 2010
@@ -0,0 +1,58 @@
+<?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 the use of _event.name and _event.data system properties.
+-->
+<scxml 
+       xmlns="http://www.w3.org/2005/07/scxml";
+       version="1.0"
+       profile="ecmascript"
+       initial="basic1">
+
+       <state id="basic1">
+               <transition target="basic2" event="t1"/> 
+       </state>
+
+       <state id="basic2">
+               <!-- sanity check -->
+               <transition target="basic3" event="t2" 
cond="_event.name=='t2'"/> 
+       </state>
+
+       <state id="basic3">
+               <!-- _event.name still set from the previous microstep, so this 
should fire -->
+               <transition target="basic4" cond="_event.name=='t2'"/> 
+       </state>
+
+       <state id="basic4">
+               <transition target="basic5" event="t3" 
cond="_event.data.foo=='ok'"/> 
+       </state>
+
+       <state id="basic5">
+               <transition target="basic6" event="t4" 
cond="_event.data.foo=='ok2'"/> 
+       </state>
+
+       <state id="basic6">
+               <!-- _event.data still set from the previous microstep, so this 
should fire -->
+               <transition target="basic7" cond="_event.data.foo=='ok2'"/> 
+       </state>
+
+       <state id="basic7"/>
+</scxml>
+
+
+

Propchange: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/TestEventSystemProperties.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/scripts/unitTest.js
URL: 
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/scripts/unitTest.js?rev=958611&view=auto
==============================================================================
--- 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/scripts/unitTest.js
 (added)
+++ 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/scripts/unitTest.js
 Mon Jun 28 15:54:45 2010
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+require.def( "test/event_system_properties/scripts/unitTest",
+{
+
+       scxmlTest : 
"test/event_system_properties/TestEventSystemProperties.xml",
+
+       register:function(scConstructor){
+
+               //TODO: can load this using RequireJS, so we don't need to use 
the dojo module system?
+               dojo.require("doh.runner");
+               var sc;
+               doh.register("testEventSystemPropertiesSuite",[
+                               {
+                                       name:"testAll",
+                                       //timeout:5000,
+                                       setUp:function(){
+                                               sc = new scConstructor()
+                                               sc.initialize();
+                                       },
+                                       runTest:function(){
+                                               var $ = function(conf){return 
conf.map(function(s){return s.toString()})};
+
+                                               //sanity tests
+                                               var conf0 = 
sc.getCurrentConfiguration();
+                                               console.log($(conf0));
+                                               
doh.assertTrue(setwiseEqual(conf0,[sc._states.basic1]));
+
+                                               console.info("sending event t1")
+                                               sc.t1()
+                                               var conf1 = 
sc.getCurrentConfiguration();
+                                               console.log($(conf1));
+                                               
doh.assertTrue(setwiseEqual(conf1,[sc._states.basic2]));
+
+                                               console.info("sending event t2")
+                                               sc.t2()
+                                               var conf2 = 
sc.getCurrentConfiguration();
+                                               console.log($(conf2));
+                                               
doh.assertTrue(setwiseEqual(conf2,[sc._states.basic4]));
+
+                                               console.info("sending event t3")
+                                               sc.t3({foo:"ok"})
+                                               var conf3 = 
sc.getCurrentConfiguration();
+                                               console.log($(conf3));
+                                               
doh.assertTrue(setwiseEqual(conf3,[sc._states.basic5]));
+
+                                               console.info("sending event t4")
+                                               sc.t4({foo:"ok2"})
+                                               var conf4 = 
sc.getCurrentConfiguration();
+                                               console.log($(conf4));
+                                               
doh.assertTrue(setwiseEqual(conf4,[sc._states.basic7]));
+
+                                       },
+                                       tearDown:function(){
+                                                sc.destroy();
+                                       }
+                               }
+               ]);
+       }
+})
+
+

Propchange: 
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-141-148/test/event_system_properties/scripts/unitTest.js
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to