You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2007/05/10 12:32:06 UTC

svn commit: r536814 - in /incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests: api/DataObjectTest.java general/XMLHelperTest.java

Author: kelvingoodson
Date: Thu May 10 03:32:05 2007
New Revision: 536814

URL: http://svn.apache.org/viewvc?view=rev&rev=536814
Log:
documentation improvements and added TODOs for refactoring

Modified:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/XMLHelperTest.java

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java?view=diff&rev=536814&r1=536813&r2=536814
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java Thu May 10 03:32:05 2007
@@ -20,17 +20,10 @@
  */
 package test.sdo21.tests.api;
 
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import test.sdo21.CTSSuite;
-import test.sdo21.framework.TestHelper;
-
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -41,7 +34,6 @@
 import commonj.sdo.DataObject;
 import commonj.sdo.Property;
 import commonj.sdo.Type;
-import commonj.sdo.helper.HelperContext;
 import commonj.sdo.helper.HelperContext;
 
 /**

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/XMLHelperTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/XMLHelperTest.java?view=diff&rev=536814&r1=536813&r2=536814
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/XMLHelperTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/XMLHelperTest.java Thu May 10 03:32:05 2007
@@ -32,13 +32,10 @@
 import java.math.BigDecimal;
 import java.net.URL;
 
-import test.sdo21.framework.CTSTestCase;
-import test.sdo21.tests.util.XMLEqualityChecker;
-
 import org.junit.Before;
 import org.junit.Test;
 
-import test.sdo21.CTSSuite;
+import test.sdo21.framework.CTSTestCase;
 import test.sdo21.tests.util.XMLEqualityChecker;
 
 import commonj.sdo.ChangeSummary;
@@ -53,7 +50,15 @@
 import commonj.sdo.helper.XSDHelper;
 
 /**
- * Junit 4.1 test case. Tests various concepts against the XMLHelper.
+ * Tests various concepts against the XMLHelper, including
+ * <ul>
+ * <li> Verification of change summary serialization before and after undoChanges()
+ * <li> Round tripping of serialization
+ * <li> Definition of types using dynamic API
+ * <li> Handling of sequenced types
+ * <li> Handling of open sequenced types
+ * </ul>
+ * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=45">2.1 spec section 3.11</a>
  */
 public class XMLHelperTest extends CTSTestCase {
     private static final String CUSTOMER1_XML = "/customer1.xml";
@@ -62,7 +67,10 @@
     private static final String MIXEDOPEN_XML = "/mixedopen.xml";
 
     /**
-     * Verify how the XMLHelper handles ChangeSummary.
+     * Verify how the XMLHelper handles serialization of a DataObject which includes a ChangeSummary.<br/>
+     * Checks are made before and after an {@link ChangeSummary#undoChanges()} call
+     * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=28">2.1 spec section 3.3.5</a>
+     * @see XMLHelper#save(DataObject, String, String)
      */
     @Test
     public void testChangeSummary() throws Exception {
@@ -85,7 +93,7 @@
         ChangeSummary cs = quote.getChangeSummary();
         ChangeSummary csp = (ChangeSummary)quote.get("changes");
 
-        assertSame("The ChangeSummay Property should be returned by getChangeSummary.", cs, csp);
+        assertSame("The ChangeSummary Property should be returned by getChangeSummary.", cs, csp);
 
         quote.setString("symbol", "fbnt");
         quote.setString("companyName", "FlyByNightTechnology");
@@ -138,7 +146,14 @@
     }
 
     /**
-     * Verify how the XMLHelper handles open content
+     * Verify how the XMLHelper handles open content.<br/>
+     * Ensures that the open content is serialized properly.
+     * Uses global properties from the XSD, and open content properties
+     * defined by the dynamic API.<br/>
+     * TODO -- is this primarily a TypeHelper test? Consider moving.
+     * 
+     * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=38">2.1 spec section 3.6.6</a>
+     * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=41">2.1 spec section 3.8.3</a>
      */
     @Test
     public void testDefineOpenContentProperty() throws IOException {
@@ -219,7 +234,19 @@
 
     /**
      * Verify how the XMLHelper handles Types defined using the TypeHelper. Save
-     * and load the Dataobject with the XMLHelper as an intermediate step.
+     * and load the Dataobject with the XMLHelper as an intermediate step.<br/>
+     * TODO this is a hybrid test that needs some refactoring.  It implicitly tests
+     * dynamic type creation, creation of dynamic types, xml round tripping and the
+     * dataObject API without a great deal of structure.  Some assertions are 
+     * irrelevant since the tests would throw NPEs before performing the
+     * tests.  Other assertions could be stronger than checking for non-null. See also
+     * testDefineTypes for similar issues.<br/>
+     * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=41">SDO spec 2..1 section 3.8.4</a>
+     * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=46">SDO spec 2..1 section 3.11.3</a>
+     * @see TypeHelper#define(DataObject)
+     * @see XMLHelper#save(DataObject, String, String, java.io.OutputStream)
+     * @see XMLHelper#load(InputStream, String, Object)
+     * 
      */
     @Test
     public void testDefineTypeRoundTrip() throws Exception {
@@ -302,6 +329,11 @@
 
     /**
      * Verify how the XMLHelper handles Types defined using the TypeHelper.
+     * TODO this is the same as {@link XMLHelperTest#testDefineTypeRoundTrip()} without
+     * the round tripping of the metametadata. See the issues described in the doc for that method.
+     * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=41">SDO spec 2..1 section 3.8.4</a>
+     * @see TypeHelper#define(DataObject)
+
      */
     @Test
     public void testDefineType() throws Exception {
@@ -375,6 +407,10 @@
 
     /**
      * Verify how the XMLHelper handles defined Sequence types.
+     * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=18">SDO spec 2..1 section 3.1.8</a>
+     * @see DataObject#getSequence()
+     * @see Sequence#addText(String)
+     * @see Sequence#add(Property, Object)
      */
     @Test
     public void testDefineSequencedType() throws Exception {
@@ -446,6 +482,12 @@
 
     /**
      * Verify how the XMLHelper handles Types which are Sequenced and Open.
+     * @see <a href="http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1#page=18">SDO spec 2..1 section 3.1.8</a>
+     * @see DataObject#getSequence()
+     * @see Sequence#addText(String)
+     * @see Sequence#add(Property, Object)
+     * @see TypeHelper#defineOpenContentProperty(String, DataObject)
+     * @see TypeHelper#getOpenContentProperty(String, String)
      */
     @Test
     public void testDefineSequencedOpenType() throws Exception {
@@ -532,5 +574,4 @@
     public void setUp() throws Exception {
       super.setUp();
     }
-    
 }



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