You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by fr...@apache.org on 2007/01/06 00:09:53 UTC

svn commit: r493227 - in /incubator/tuscany/java/sdo/impl/src/test: java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java resources/simpleWithChangeSummary.xml resources/simpleWithChangeSummaryUndone.xml

Author: frankb
Date: Fri Jan  5 15:09:52 2007
New Revision: 493227

URL: http://svn.apache.org/viewvc?view=rev&rev=493227
Log:
More for serialization support in TUSCANY-153

Added:
    incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml
    incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml
Modified:
    incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java

Modified: incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java?view=diff&rev=493227&r1=493226&r2=493227
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java (original)
+++ incubator/tuscany/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryPropertyTestCase.java Fri Jan  5 15:09:52 2007
@@ -19,10 +19,14 @@
  */
 package org.apache.tuscany.sdo.test;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.math.BigDecimal;
 import java.net.URL;
 
+import org.apache.tuscany.sdo.util.SDOUtil;
+
 import junit.framework.TestCase;
 
 import commonj.sdo.ChangeSummary;
@@ -37,6 +41,9 @@
     private final String TEST_MODEL = "/simpleWithChangeSummary.xsd";
     private final String TEST_NAMESPACE = "http://www.example.com/simpleCS";
 
+    private final String TEST_DATA_BEFORE_UNDO = "/simpleWithChangeSummary.xml";
+    private final String TEST_DATA_AFTER_UNDO = "/simpleWithChangeSummaryUndone.xml";
+    
     /**
      * Simple ChangeSummary test.
      */
@@ -80,12 +87,19 @@
         //
         cs.endLogging();
 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "rootQuote", baos);
         //XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "rootQuote", System.out);
-               
+
+        //assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA_BEFORE_UNDO)));
+        
         cs.undoChanges();
         
-        //System.out.println("\nAfter Undo Changes:");
+        baos = new ByteArrayOutputStream();
+        XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "rootQuote", baos);
         //XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "rootQuote", System.out);
+        
+        assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA_AFTER_UNDO)));
     }
 
     protected void setUp() throws Exception {

Added: incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml?view=auto&rev=493227
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml (added)
+++ incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummary.xml Fri Jan  5 15:09:52 2007
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ASCII"?>
+<cs:rootQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cs="http://www.example.com/simpleCS" xsi:type="cs:RootQuote">
+  <symbol>FBNT</symbol>
+  <companyName>FlyByNightTechnology</companyName>
+  <price>999.0</price>
+  <volume>1000.0</volume>
+  <quotes>
+    <price>1500.0</price>
+  </quotes>
+  <quotes>
+    <price>2500.0</price>
+  </quotes>
+  <quotes>
+    <price>3000.0</price>
+  </quotes>
+  <quotes>
+    <price>4000.0</price>
+  </quotes>
+  <changes create="#//quotes[3] #//quotes[4]" delete="#//changes/rootQuote[1]/quotes[2]" logging="false" xmlns:sdo="commonj.sdo">
+    <cs:rootQuote sdo:ref="#/rootQuote" sdo:unset="volume">
+      <symbol>fbnt</symbol>
+      <price>1000.0</price>
+      <quotes sdo:ref="#//quotes[1]" />
+      <quotes>
+        <price>2000.0</price>
+      </quotes>
+      <quotes sdo:ref="#//quotes[2]" />
+    </cs:rootQuote>
+  </changes>
+</cs:rootQuote>

Added: incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml?view=auto&rev=493227
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml (added)
+++ incubator/tuscany/java/sdo/impl/src/test/resources/simpleWithChangeSummaryUndone.xml Fri Jan  5 15:09:52 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="ASCII"?>
+<cs:rootQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cs="http://www.example.com/simpleCS" xsi:type="cs:RootQuote">
+  <symbol>fbnt</symbol>
+  <companyName>FlyByNightTechnology</companyName>
+  <price>1000.0</price>
+  <quotes>
+    <price>1500.0</price>
+  </quotes>
+  <quotes>
+    <price>2000.0</price>
+  </quotes>
+  <quotes>
+    <price>2500.0</price>
+  </quotes>
+  <changes logging="false" />
+</cs:rootQuote>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org