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/15 14:06:43 UTC

svn commit: r538143 - in /incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21: ./ paramatizedTests/ tests/api/XMLHelper/ tests/util/

Author: kelvingoodson
Date: Tue May 15 05:06:40 2007
New Revision: 538143

URL: http://svn.apache.org/viewvc?view=rev&rev=538143
Log:
finish move of xml helper to non parameterized mode

Added:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyBase.java
      - copied, changed from r538139, incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperTestBase.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyDynamic.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencySuite.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyXSD.java   (with props)
Removed:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperTestBase.java
Modified:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/util/CTSUtil.java

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java?view=diff&rev=538143&r1=538142&r2=538143
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java Tue May 15 05:06:40 2007
@@ -28,6 +28,7 @@
 import test.sdo21.tests.api.DataFactory.DataFactoryConsistencySuite;
 import test.sdo21.tests.api.DataGraph.DataGraphConsistencySuite;
 import test.sdo21.tests.api.Sequence.SequenceConsistencySuite;
+import test.sdo21.tests.api.XMLHelper.XMLHelperConsistencySuite;
 
 
 /**
@@ -53,7 +54,8 @@
                       DataFactoryConsistencySuite.class,
                       SequenceConsistencySuite.class,
                       TypeHelperTest.class,
-                      TypeTest.class
+                      TypeTest.class,
+                      XMLHelperConsistencySuite.class
                       
                       })
 public class UnderReviewSuite {

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java?view=diff&rev=538143&r1=538142&r2=538143
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java Tue May 15 05:06:40 2007
@@ -29,14 +29,13 @@
 import test.sdo21.paramatizedTests.general.DeleteTest;
 import test.sdo21.tests.api.PropertyTest;
 import test.sdo21.tests.api.CopyHelper.CopyEqualityTest;
-import test.sdo21.tests.api.XMLHelper.XMLHelperTestBase;
+
 
 /**
  * Declares paramatized test classes to be run within Junit 4.1 Suite for SDO
  * CTS which includes the following classes:<br>
  * <ul>
  * <LI>{@link test.sdo21.tests.api.CopyHelper.CopyEqualityTest}</LI>
- * <LI>{@link test.sdo21.tests.api.XMLHelper.XMLHelperTestBase}</LI>
  * <LI>{@link test.sdo21.paramatizedTests.conversion.TypeConversionTest}</LI>
  * <LI>{@link test.sdo21.paramatizedTests.general.ContainmentTest}</LI>
  * <LI>{@link test.sdo21.paramatizedTests.general.ContainmentCycleSerializationTest}</LI>
@@ -48,7 +47,7 @@
 @RunWith(Suite.class)
 @Suite.SuiteClasses( {ContainmentTest.class, CopyEqualityTest.class,
                       DeleteTest.class, PropertyTest.class,
-                      TypeConversionTest.class, XMLHelperTestBase.class,
+                      TypeConversionTest.class,
                       ContainmentCycleSerializationTest.class})
 public class CTSParamatizedSuite {
 

Copied: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyBase.java (from r538139, incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperTestBase.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyBase.java?view=diff&rev=538143&p1=incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperTestBase.java&r1=538139&p2=incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyBase.java&r2=538143
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperTestBase.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyBase.java Tue May 15 05:06:40 2007
@@ -20,8 +20,8 @@
  */
 package test.sdo21.tests.api.XMLHelper;
 
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
@@ -30,15 +30,8 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
 
-import test.sdo21.framework.DataObjectFactory;
-import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
-import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
-import test.sdo21.tests.TestData.StandardDynamicFactory;
 import test.sdo21.tests.TestData.StandardFactory;
-import test.sdo21.tests.TestData.TestDataFactory;
 import test.sdo21.tests.api.CTSConsistencyBase;
 import test.sdo21.tests.util.CTSUtil;
 
@@ -46,7 +39,7 @@
 import commonj.sdo.helper.HelperContext;
 
 
-public abstract class XMLHelperTestBase extends CTSConsistencyBase {
+public abstract class XMLHelperConsistencyBase extends CTSConsistencyBase {
 	private DataObject testDO;
 	private HelperContext helperContext;
   
@@ -131,7 +124,7 @@
 
         assertNotNull("Deserialization returned a null value.", tempDO);
         assertTrue("Serialization and deserialization resulted in a nonequivalent DataObject.",
-                CTSUtil.equalDataObjects(testDO, tempDO));
+                helperContext.getEqualityHelper().equal(testDO, tempDO));
     }
 
     /**
@@ -141,7 +134,7 @@
     @Test
     public void testFaultyXML() {
         try {
-           helperContext.getXMLHelper().load(XMLHelperTestBase.class.getResourceAsStream("/faulty.xml"));
+           helperContext.getXMLHelper().load(XMLHelperConsistencyBase.class.getResourceAsStream("/faulty.xml"));
            fail("Attempting to load a faulty XML file should result in an Exception.");
         } catch (Exception e) {
     	   // success
@@ -154,7 +147,7 @@
     @Test
     public void testXMLWrongXSD() {
         try {
-            helperContext.getXMLHelper().load(XMLHelperTestBase.class.getResourceAsStream("/wrongNamespace.xml"));
+            helperContext.getXMLHelper().load(XMLHelperConsistencyBase.class.getResourceAsStream("/wrongNamespace.xml"));
             fail("Attempting to load an XML specifying the wrong namespace file should result in an Exception.");
         } catch (Exception e) {
             // success

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyDynamic.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyDynamic.java?view=auto&rev=538143
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyDynamic.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyDynamic.java Tue May 15 05:06:40 2007
@@ -0,0 +1,34 @@
+/*
+ *  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.
+ *  
+ *  $Rev$  $Date$
+ */
+package test.sdo21.tests.api.XMLHelper;
+
+import test.sdo21.tests.TestData.StandardDynamicFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+
+public class XMLHelperConsistencyDynamic extends XMLHelperConsistencyBase {
+
+  public TestDataFactory createTestDataFactory() {
+
+    return new StandardDynamicFactory();
+  }
+
+  
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyDynamic.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyDynamic.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencySuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencySuite.java?view=auto&rev=538143
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencySuite.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencySuite.java Tue May 15 05:06:40 2007
@@ -0,0 +1,31 @@
+/*
+ *  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.
+ *  
+ *  $Rev$  $Date$
+ */
+package test.sdo21.tests.api.XMLHelper;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {XMLHelperConsistencyDynamic.class,
+                      XMLHelperConsistencyXSD.class})
+public class XMLHelperConsistencySuite {
+
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencySuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencySuite.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyXSD.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyXSD.java?view=auto&rev=538143
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyXSD.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyXSD.java Tue May 15 05:06:40 2007
@@ -0,0 +1,34 @@
+/*
+ *  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.
+ *  
+ *  $Rev$  $Date$
+ */
+package test.sdo21.tests.api.XMLHelper;
+
+import test.sdo21.tests.TestData.StandardXSDFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+
+public class XMLHelperConsistencyXSD extends XMLHelperConsistencyBase {
+
+  public TestDataFactory createTestDataFactory() {
+
+    return new StandardXSDFactory();
+  }
+
+  
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyXSD.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyXSD.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/util/CTSUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/util/CTSUtil.java?view=diff&rev=538143&r1=538142&r2=538143
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/util/CTSUtil.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/util/CTSUtil.java Tue May 15 05:06:40 2007
@@ -168,100 +168,6 @@
       return helperContext.getXMLHelper().load(bais).getRootObject();
   }
 
-  /**
-   * Compares two DataObjects Property by Property. Returns true if they have
-   * the same values assigned to each Property, but does not require that the
-   * Properties appear in the same order.
-   * @deprecated
-   */
-  public static boolean equalDataObjects(DataObject dataObj1, DataObject dataObj2) {
-      // FIXME -- change to equality helper
-      if (dataObj1 == null && dataObj2 == null)
-          return true;
-      else if (dataObj1 == null || dataObj2 == null)
-          return false;
 
-      if (!areEqualTypes(dataObj1.getType(), dataObj2.getType()))
-          return false;
-
-      List properties1 = dataObj1.getType().getProperties();
-      List properties2 = dataObj2.getType().getProperties();
-      Property property;
-
-      if (properties1.size() != properties2.size())
-          return false;
-
-      for (int i = 0; i < properties1.size(); i++) {
-          property = (Property)properties1.get(i);
-          if (property.isContainment()) {
-              if (property.isMany()) {
-                  List dataObjList1 = (List)dataObj1.get(property.getName());
-                  List dataObjList2 = (List)dataObj2.get(property.getName());
-
-                  if (dataObjList1 == null && dataObjList2 == null)
-                      return true;
-                  else if (dataObjList1 == null || dataObjList2 == null)
-                      return false;
-                  else if (dataObjList1.size() != dataObjList2.size())
-                      return false;
-                  else {
-                      for (int j = 0; j < dataObjList1.size(); j++) {
-                          if (!(equalDObjects(dataObjList1.get(j), dataObjList2.get(j))))
-                              return false;
-                      }
-                  }
-              } else {
-                  if (!(equalDObjects(dataObj1.get(property.getName()), dataObj2.get(property.getName()))))
-                      return false;
-              }
-          } else if (property.getType().isDataType()) {
-              if (property.getName().equals("mixed")) {
-                  // do nothing - this Property should not be visible and
-                  // there is a Jira to make that so
-              } else if (property.getType().getInstanceClass() != null && property.getType().getInstanceClass()
-                  .toString().indexOf('[') != -1) {
-                  byte[] bytes1 = dataObj1.getBytes(property.getName());
-                  byte[] bytes2 = dataObj2.getBytes(property.getName());
-
-                  if (bytes1 == null && bytes2 == null)
-                      ; // do nothing
-                  else if (bytes1 == null || bytes2 == null)
-                      return false;
-                  else {
-                      for (int j = 0; j < bytes1.length; j++) {
-                          if (bytes1[j] != bytes2[j])
-                              return false;
-                      }
-                  }
-              } else if (dataObj1.get(property.getName()) != null) {
-                  if (!(dataObj1.get(property.getName()).equals(dataObj2.get(property.getName()))))
-                      return false;
-              } else if (dataObj2.get(property.getName()) != null)
-                  return false;
-          } else {
-              if (!(equalDObjects(dataObj1.get(property.getName()), dataObj2.get(property.getName()))))
-                  return false;
-          }
-      }
-      return true;
-  }
-  
-  /**
-   * Calls equalDataObjects only after it has been verified that the two
-   * Objects are instanceof DataObject.
-   */
-  public static boolean equalDObjects(Object object1, Object object2) {
-      if (object1 == null && object2 == null)
-          return true;
-      else if (object1 == null || object2 == null)
-          return false;
-
-      if (!(object1 instanceof DataObject) && !(object2 instanceof DataObject))
-          return false; // not equal DataObjects since not DataObjects
-      else if (!(object1 instanceof DataObject) || !(object2 instanceof DataObject))
-          return false;
-      else
-          return equalDataObjects((DataObject)object1, (DataObject)object2);
-  }
   
 }



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