Author: rahul
Date: Mon Jan 26 22:22:11 2009
New Revision: 737905

URL: http://svn.apache.org/viewvc?rev=737905&view=rev
Log:
Add a test case illustrating data subtree copy behavior when using <assign>.

Added:
    
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/datamodel-05.xml
   (with props)
Modified:
    
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java

Added: 
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/datamodel-05.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/datamodel-05.xml?rev=737905&view=auto
==============================================================================
--- 
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/datamodel-05.xml
 (added)
+++ 
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/datamodel-05.xml
 Mon Jan 26 22:22:11 2009
@@ -0,0 +1,69 @@
+<?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.
+-->
+<!-- A fictitious state machine used by test cases. -->
+<scxml xmlns="http://www.w3.org/2005/07/scxml";
+       version="1.0"
+       initial="start">
+
+    <datamodel>
+
+      <data id="airline">
+        <flight xmlns="">
+          <origin/>
+          <destination/>
+          <trip>round</trip>
+          <class>economy</class>
+          <meal/>
+          <dates>
+            <startdate>01/01/2009</startdate>
+            <enddate>01/05/2009</enddate>
+          </dates>
+          <dates>
+            <startdate>01/26/2009</startdate>
+            <enddate>01/31/2009</enddate>
+          </dates>
+        </flight>
+      </data>
+
+      <data id="hotel">
+        <hotel xmlns="">
+          <stay>
+            <delete>foo</delete>
+          </stay>
+          <adults>1</adults>
+          <children>0</children>
+          <rooms>1</rooms>
+          <rate/>
+        </hotel>
+      </data>
+
+    </datamodel>
+
+    <state id="start">
+        <onentry>
+            <log label="XML subtree copy - delete (should be foo)" 
expr="Data(hotel, 'hotel/stay/delete')"/>
+            <assign location="Data(hotel, 'hotel/stay')" expr="Data(airline, 
'flight/dates[2]')"/>
+            <log label="XML subtree copy - delete (should be empty)" 
expr="Data(hotel, 'hotel/stay/delete')"/>
+        </onentry>
+        <transition cond="Data(hotel, 'hotel/stay/startdate') eq '01/26/2009'" 
target="end" />
+    </state>
+
+    <final id="end"/>
+
+</scxml>
+

Propchange: 
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/datamodel-05.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/datamodel-05.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: 
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java?rev=737905&r1=737904&r2=737905&view=diff
==============================================================================
--- 
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java
 (original)
+++ 
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java
 Mon Jan 26 22:22:11 2009
@@ -52,7 +52,7 @@
     }
 
     // Test data
-    private URL datamodel01jexl, datamodel02jexl, datamodel04jexl, 
datamodel01jsp, datamodel02jsp;
+    private URL datamodel01jexl, datamodel02jexl, datamodel04jexl, 
datamodel05jexl, datamodel01jsp, datamodel02jsp;
     private SCXMLExecutor exec01, exec02;
 
     /**
@@ -63,9 +63,11 @@
         datamodel01jexl = this.getClass().getClassLoader().
             getResource("org/apache/commons/scxml/env/jexl/datamodel-01.xml");
         datamodel02jexl = this.getClass().getClassLoader().
-           getResource("org/apache/commons/scxml/env/jexl/datamodel-02.xml");
+            getResource("org/apache/commons/scxml/env/jexl/datamodel-02.xml");
         datamodel04jexl = this.getClass().getClassLoader().
-           getResource("org/apache/commons/scxml/env/jexl/datamodel-04.xml");
+            getResource("org/apache/commons/scxml/env/jexl/datamodel-04.xml");
+        datamodel05jexl = this.getClass().getClassLoader().
+            getResource("org/apache/commons/scxml/env/jexl/datamodel-05.xml");
         datamodel01jsp = this.getClass().getClassLoader().
             getResource("org/apache/commons/scxml/env/jsp/datamodel-01.xml");
         datamodel02jsp = this.getClass().getClassLoader().
@@ -77,7 +79,7 @@
      */
     @Override
     public void tearDown() {
-        datamodel01jexl = datamodel02jexl = datamodel01jsp = datamodel02jsp = 
null;
+        datamodel01jexl = datamodel02jexl = datamodel04jexl = datamodel05jexl 
= datamodel01jsp = datamodel02jsp = null;
     }
 
     /**
@@ -137,6 +139,12 @@
         assertEquals("thirty", currentStates.iterator().next().getId());
     }
 
+    public void testDatamodel05Jexl() throws Exception {
+        exec01 = SCXMLTestHelper.getExecutor(datamodel05jexl);
+        assertNotNull(exec01);
+        SCXMLTestHelper.assertState(exec01, "end");
+    }
+
     private void runtest() throws Exception {
         //// Interleaved
         // exec01


Reply via email to