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/14 12:10:21 UTC

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

Author: kelvingoodson
Date: Mon May 14 03:10:20 2007
New Revision: 537768

URL: http://svn.apache.org/viewvc?view=rev&rev=537768
Log:
move data factory parameterized tests  to non junit parameterized infrastructure,  and introduce consistency intermediate class

Added:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/CTSConsistencyBase.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyBase.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyDynamic.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencySuite.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyXSD.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/paramatizedTests/util/ParamatizedTestUtil.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyBase.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyDynamic.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencySuite.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyXSD.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=537768&r1=537767&r2=537768
==============================================================================
--- 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 Mon May 14 03:10:20 2007
@@ -23,6 +23,7 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
+import test.sdo21.tests.api.DataFactory.DataFactoryConsistencySuite;
 import test.sdo21.tests.api.DataGraph.DataGraphConsistencySuite;
 
 
@@ -46,7 +47,8 @@
                       test.sdo21.tests.conversion.StringConversionTest.class,
                       test.sdo21.tests.api.XMLWithoutSchemaTest.class,
                       test.sdo21.tests.general.XMLHelperTest.class,
-                      DataGraphConsistencySuite.class
+                      DataGraphConsistencySuite.class,
+                      DataFactoryConsistencySuite.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=537768&r1=537767&r2=537768
==============================================================================
--- 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 Mon May 14 03:10:20 2007
@@ -57,7 +57,7 @@
  * should be placed in the {@link test.sdo21.UnderReviewSuite} suite.
  */
 @RunWith(Suite.class)
-@Suite.SuiteClasses( {ActiveUpdatingTest.class, ContainmentTest.class, CopyEqualityTest.class, DataFactoryTest.class,
+@Suite.SuiteClasses( {ActiveUpdatingTest.class, ContainmentTest.class, CopyEqualityTest.class,
                       DeleteTest.class, PropertyTest.class, SequenceTest.class,
                       TypeConversionTest.class, TypeHelperTest.class, TypeTest.class, XMLHelperTest.class,
                       ContainmentCycleSerializationTest.class})

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java?view=diff&rev=537768&r1=537767&r2=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java Mon May 14 03:10:20 2007
@@ -49,6 +49,8 @@
 /**
  * Utility methods for SDO Tests. Provides methods to populate fields of
  * DataObjects, serializing DataObjects etc.
+ * @deprecated -- moving away from parameterized/non-parameterized split -- function should be
+ * ported elsewhere
  */
 public class ParamatizedTestUtil {
     public final static String TEST_TYPE = "APITest";

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/CTSConsistencyBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/CTSConsistencyBase.java?view=auto&rev=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/CTSConsistencyBase.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/CTSConsistencyBase.java Mon May 14 03:10:20 2007
@@ -0,0 +1,57 @@
+/*
+ *  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: 537762 $  $Date: 2007-05-14 10:38:19 +0100 (Mon, 14 May 2007) $
+ */
+package test.sdo21.tests.api;
+
+import org.junit.After;
+import org.junit.Before;
+
+import test.sdo21.framework.CTSTestCase;
+import test.sdo21.tests.TestData.StandardFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+
+import commonj.sdo.DataObject;
+
+/**
+ * A class which supports the set of test classes which test for consistent behaviour of
+ * the APIs when the metadata in use has been created by various means.
+ *
+ */
+public abstract class CTSConsistencyBase extends CTSTestCase  {
+  protected  DataObject testDO;
+  TestDataFactory factory;
+  public abstract TestDataFactory createTestDataFactory();
+  
+  public CTSConsistencyBase() {
+    factory = createTestDataFactory();
+  }
+
+  @Before
+  public void setUp () throws Exception {
+    super.setUp();
+    factory.defineMetaData(getScope());
+    testDO = factory.createTestData(getScope(), StandardFactory.API_TYPE);
+  }
+  
+  @After
+  public void tearDown() throws Exception {
+    super.tearDown();
+  }
+}

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyBase.java?view=auto&rev=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyBase.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyBase.java Mon May 14 03:10:20 2007
@@ -0,0 +1,139 @@
+/*
+ *  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: 537762 $  $Date: 2007-05-14 10:38:19 +0100 (Mon, 14 May 2007) $
+ */
+package test.sdo21.tests.api.DataFactory;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import test.sdo21.tests.TestData.StandardFactory;
+import test.sdo21.tests.api.CTSConsistencyBase;
+import test.sdo21.tests.util.CTSUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+
+public abstract class  DataFactoryConsistencyBase extends CTSConsistencyBase {
+
+  
+  @Before
+  public void setUp () throws Exception {
+    super.setUp();
+  }
+  
+  @After
+  public void tearDown() throws Exception {
+    super.tearDown();
+  }
+  
+  /**
+   * Verify the proper operation of DataFactory.create(Type).
+   */
+  @Test
+  public void testDataFactoryCreateByType() {
+      Type type = testDO.getType();
+
+      DataObject typeDO = getScope().getDataFactory().create(type);
+
+      assertNotNull("DataFactory.create(Type) did not return a DataObject as expected", typeDO);
+
+      assertTrue("DataFactory.create(Type) did not return a DataObject of the expected Type.", CTSUtil.areEqualTypes(typeDO.getType(), type));
+  }
+
+  /**
+   * Verify the proper operation of DataFactory.create(URI, Name).
+   */
+  @Test
+  public void testDataFactoryCreateByURI() {
+      Type type = testDO.getType();
+
+      DataObject uriDO = getScope().getDataFactory().create(type.getURI(), type.getName());
+
+      assertNotNull("DataFactory.create(URI, Name) did not return a DataObject as expected.", uriDO);
+
+      assertTrue("DataFactory.create(URI, Name) did not return a DataObject of the expected Type.",
+                 CTSUtil.areEqualTypes(uriDO.getType(), type));
+  }
+
+  /**
+   * Verify the proper operation of DataFactory.create(Class).
+   */
+  @Test
+  public void testDataFactoryCreateByClass() {
+      Type type = testDO.getType();
+
+      if (type.getInstanceClass() != null) {
+          DataObject classDO = getScope().getDataFactory().create(type.getInstanceClass());
+
+          assertNotNull("DataFactory.create(Class) did not return a DataObject as expected.", classDO);
+
+          assertTrue("DataFactory.create(Class) did not return a DataObject of the expected Type.",
+                     CTSUtil.areEqualTypes(classDO.getType(), type));
+      }
+  }
+
+  /**
+   * Verify that DataFactory.create with DataType results in
+   * IllegalArgumentException
+   */
+  @Test
+  public void testDataFactoryCreateDataTypeException() {
+      try {
+          Type dataType = getScope().getTypeHelper().getType("commonj.sdo", "Int");
+          assertTrue("Could not test DataFactory.create(dataType) because dataType.isDataType = false", dataType
+              .isDataType());
+          getScope().getDataFactory().create(dataType);
+          fail("DataFactory.create(dataType) did not throw an Exception.");
+      } catch (IllegalArgumentException e) {
+          // Do nothing
+      } catch (Exception e) {
+          fail("DataFactory.create(dataType) did not throw the expected IllegalArgumentException Exception.");
+      }
+  }
+
+  /**
+   * Verify that DataFactory.create with Abstract Type results in
+   * IllegalArgumentException.
+   */
+  @Test
+  public void testDataFactoryCreateAbstractException() {
+      try {
+          Type abstractType =
+              getScope().getTypeHelper().getType(StandardFactory.TEST_NAMESPACE, "Abstract");
+
+          assertTrue("Could not test DataFactory.create(abstractType) because abstractType.isAbstract = false",
+                     abstractType.isAbstract());
+          getScope().getDataFactory().create(abstractType);
+          fail("DataFactory.create(abstractType) did not throw an Exception.");
+
+      } catch (IllegalArgumentException e) {
+          // Do nothing
+      } catch (Exception e) {
+          fail("DataFactory.create(abstractType) did not throw the expected IllegalArgumentException Exception.");
+      }
+  }
+  
+  
+}

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyDynamic.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyDynamic.java?view=auto&rev=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyDynamic.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyDynamic.java Mon May 14 03:10:20 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: 537762 $  $Date: 2007-05-14 10:38:19 +0100 (Mon, 14 May 2007) $
+ */
+package test.sdo21.tests.api.DataFactory;
+
+import test.sdo21.tests.TestData.StandardDynamicFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+
+public class DataFactoryConsistencyDynamic extends DataFactoryConsistencyBase {
+
+  public TestDataFactory createTestDataFactory() {
+
+    return new StandardDynamicFactory();
+  }
+
+  
+}

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencySuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencySuite.java?view=auto&rev=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencySuite.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencySuite.java Mon May 14 03:10:20 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: 537762 $  $Date: 2007-05-14 10:38:19 +0100 (Mon, 14 May 2007) $
+ */
+package test.sdo21.tests.api.DataFactory;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {DataFactoryConsistencyDynamic.class,
+                      DataFactoryConsistencyXSD.class})
+public class DataFactoryConsistencySuite {
+
+}

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyXSD.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyXSD.java?view=auto&rev=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyXSD.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyXSD.java Mon May 14 03:10:20 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: 537762 $  $Date: 2007-05-14 10:38:19 +0100 (Mon, 14 May 2007) $
+ */
+package test.sdo21.tests.api.DataFactory;
+
+import test.sdo21.tests.TestData.StandardXSDFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+
+public class DataFactoryConsistencyXSD extends DataFactoryConsistencyBase {
+
+  public TestDataFactory createTestDataFactory() {
+
+    return new StandardXSDFactory();
+  }
+
+  
+}

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyBase.java?view=diff&rev=537768&r1=537767&r2=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyBase.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyBase.java Mon May 14 03:10:20 2007
@@ -31,28 +31,24 @@
 import test.sdo21.framework.CTSTestCase;
 import test.sdo21.tests.TestData.StandardFactory;
 import test.sdo21.tests.TestData.TestDataFactory;
+import test.sdo21.tests.api.CTSConsistencyBase;
 
 import commonj.sdo.ChangeSummary;
 import commonj.sdo.DataGraph;
 import commonj.sdo.DataObject;
 import commonj.sdo.Type;
 
-public abstract class DataGraphConsistencyBase extends CTSTestCase {
+public abstract class DataGraphConsistencyBase extends CTSConsistencyBase {
     
 	  private DataObject testDO;
     TestDataFactory factory;
     public abstract TestDataFactory createTestDataFactory();
     
-    public DataGraphConsistencyBase()
-    {
-      factory = createTestDataFactory();
-    }
+
     
     @Before
     public void setUp () throws Exception {
       super.setUp();
-      factory.defineMetaData(getScope());
-    	testDO = factory.createTestData(getScope(), StandardFactory.API_TYPE);
     }
     
     @After

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyDynamic.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyDynamic.java?view=diff&rev=537768&r1=537767&r2=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyDynamic.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyDynamic.java Mon May 14 03:10:20 2007
@@ -1,3 +1,23 @@
+/*
+ *  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: 537762 $  $Date: 2007-05-14 10:38:19 +0100 (Mon, 14 May 2007) $
+ */
 package test.sdo21.tests.api.DataGraph;
 
 import test.sdo21.tests.TestData.StandardDynamicFactory;

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencySuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencySuite.java?view=diff&rev=537768&r1=537767&r2=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencySuite.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencySuite.java Mon May 14 03:10:20 2007
@@ -1,3 +1,23 @@
+/*
+ *  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: 537762 $  $Date: 2007-05-14 10:38:19 +0100 (Mon, 14 May 2007) $
+ */
 package test.sdo21.tests.api.DataGraph;
 
 import org.junit.runner.RunWith;

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyXSD.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyXSD.java?view=diff&rev=537768&r1=537767&r2=537768
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyXSD.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyXSD.java Mon May 14 03:10:20 2007
@@ -1,3 +1,23 @@
+/*
+ *  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: 537762 $  $Date: 2007-05-14 10:38:19 +0100 (Mon, 14 May 2007) $
+ */
 package test.sdo21.tests.api.DataGraph;
 
 import test.sdo21.tests.TestData.StandardXSDFactory;

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=537768&r1=537767&r2=537768
==============================================================================
--- 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 Mon May 14 03:10:20 2007
@@ -19,7 +19,10 @@
  */
 package test.sdo21.tests.util;
 
+import java.util.List;
+
 import commonj.sdo.DataObject;
+import commonj.sdo.Property;
 import commonj.sdo.Type;
 import commonj.sdo.helper.HelperContext;
 
@@ -70,5 +73,69 @@
   public static String createUniqueName() {
     return "name-" + System.currentTimeMillis() + "-"
         + ((int) (1000 * Math.random()));
+  }
+  
+  /**
+   * areEqualTypes is used to determine of two Types are equivalent even if
+   * not identically equal. The names of the Types are compared, as well as
+   * the Types of each of the Properties making up the Type.
+   * 
+   * @param type1
+   * @param type2
+   * @return
+   */
+  public static boolean areEqualTypes(Type type1, Type type2) {
+      List properties1, properties2;
+      Property property1, property2;
+      int size = 0, j = 0, k;
+      boolean found;
+
+      // Equivalent Types have the same name
+
+      if (!(type1.getName().equals(type2.getName())))
+          return false;
+
+      // Equivalent Types have the same number of Properties
+
+      properties1 = type1.getProperties();
+      properties2 = type2.getProperties();
+      size = properties1.size();
+
+      if (size != properties2.size())
+          return false;
+
+      // Equivalent Types have Properties of the same name and Type
+
+      for (int i = 0; i < size; i++) {
+          property1 = (Property)properties1.get(i);
+          k = 0;
+          found = false;
+
+          while (k < size && !found) {
+              // j is used to prevent the initial Properties in properties2
+              // from being checked every time
+              // j is particularly useful when the Types have Properties in
+              // the order
+
+              property2 = (Property)properties2.get((k + j) % size);
+
+              if (property1.getName().equals(property2.getName())) {
+                  j++;
+                  found = true;
+
+                  // Should not use recursion here to compare the Types of the
+                  // Properties, because
+                  // it is possible that a Type may recursively contain
+                  // itself.
+
+                  if (!(property1.getType().getName().equals(property2.getType().getName())))
+                      return false;
+              }
+              k++;
+          }
+          if (!found)
+              return false;
+      }
+      return true;
   }
 }



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