cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r519815 - in /cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src: cayenne/java/org/apache/cayenne/xml/ tests/java/org/apache/cayenne/xml/ tests/resources/xmlcoding/
Date Mon, 19 Mar 2007 03:30:25 GMT
Author: kmenard
Date: Sun Mar 18 20:30:24 2007
New Revision: 519815

URL: http://svn.apache.org/viewvc?view=rev&rev=519815
Log:
CAY-597: XML Encoder with Mapping outputs incorrect XML.
Added the analogous fix for encoded collections.  This should handle all the problem cases
reported in CAY-597 now.

Modified:
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/xml/SerializableEntity.java
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLDecoderTst.java
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLEncoderTst.java
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapped.xml
    cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapping.xml

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/xml/SerializableEntity.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/xml/SerializableEntity.java?view=diff&rev=519815&r1=519814&r2=519815
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/xml/SerializableEntity.java
(original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/xml/SerializableEntity.java
Sun Mar 18 20:30:24 2007
@@ -68,6 +68,9 @@
                 while (it.hasNext()) {
                     encodeObject(encoder, it.next(), false);
                 }
+                
+                // Make sure we pop the node we just pushed -- needed for fix to CAY-597.
+                encoder.pop();
             }
         }
         else {

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLDecoderTst.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLDecoderTst.java?view=diff&rev=519815&r1=519814&r2=519815
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLDecoderTst.java
(original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLDecoderTst.java
Sun Mar 18 20:30:24 2007
@@ -123,6 +123,7 @@
         TestObject decoded = (TestObject) object;
 
         TestObject george = new TestObject();
+        george.setAge(76);
         george.setName("George");
         assertEquals(decoded, george);
 
@@ -130,10 +131,12 @@
         assertEquals(children.size(), 2);
 
         TestObject bill = new TestObject();
+        bill.setAge(34);
         bill.setName("Bill");
         assertEquals(children.get(0), bill);
 
         TestObject sue = new TestObject();
+        sue.setAge(31);
         sue.setName("Sue");
         assertEquals(children.get(1), sue);
 

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLEncoderTst.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLEncoderTst.java?view=diff&rev=519815&r1=519814&r2=519815
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLEncoderTst.java
(original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/xml/XMLEncoderTst.java
Sun Mar 18 20:30:24 2007
@@ -184,6 +184,7 @@
         XMLEncoder encoder = new XMLEncoder(CayenneTestResources.getResourceURL(
                 XML_DATA_DIR + "collection-mapping.xml").toExternalForm());
         TestObject george = new TestObject();
+        george.setAge(76);
         george.setName("George");
         george.addChild(new TestObject("Bill", 34, true));
 

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapped.xml
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapped.xml?view=diff&rev=519815&r1=519814&r2=519815
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapped.xml
(original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapped.xml
Sun Mar 18 20:30:24 2007
@@ -2,6 +2,7 @@
 <Name>George</Name>
 <Child>
 <Name>Bill</Name>
+<Age>34</Age>
 </Child>
 <Child>
 <Name>Sue</Name>
@@ -9,5 +10,7 @@
 <Name>Mike</Name>
 <Age>3</Age>
 </Grandchild>
+<Age>31</Age>
 </Child>
+<Age>76</Age>
 </Family>

Modified: cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapping.xml
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapping.xml?view=diff&rev=519815&r1=519814&r2=519815
==============================================================================
--- cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapping.xml
(original)
+++ cayenne/main/branches/STABLE-2.0/cayenne/cayenne-java/src/tests/resources/xmlcoding/collection-mapping.xml
Sun Mar 18 20:30:24 2007
@@ -1,12 +1,19 @@
+<!--
+Make sure that "simple" properties surround aggregate ones
+in order to fully test nested element problems found in CAY-597.
+-->
+
 <model>
     <entity name="org.apache.cayenne.xml.TestObject" xmlTag="Family">
-        <property name="name" xmlTag="Name"/>
+    	<property name="name" xmlTag="Name"/>
         <property name="children" xmlTag="Child"/>
+        <property name="age" xmlTag="Age"/>
     </entity>
 	
 	<entity name="org.apache.cayenne.xml.TestObject" xmlTag="Child">
 		<property name="name" xmlTag="Name"/>
 		<property name="children" xmlTag="Grandchild"/>
+		<property name="age" xmlTag="Age"/>
 	</entity>
 	
 	<entity name="org.apache.cayenne.xml.TestObject" xmlTag="Grandchild">



Mime
View raw message