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 11:38:20 UTC

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

Author: kelvingoodson
Date: Mon May 14 02:38:19 2007
New Revision: 537762

URL: http://svn.apache.org/viewvc?view=rev&rev=537762
Log:
move parameterized DataGraphTest to non junit parameterized approach

Added:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/
    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
Removed:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.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/CTSGeneralSuite.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=537762&r1=537761&r2=537762
==============================================================================
--- 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 02:38:19 2007
@@ -23,6 +23,8 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
+import test.sdo21.tests.api.DataGraph.DataGraphConsistencySuite;
+
 
 /**
  * This suite of tests is for new test cases, or test cases that are currently
@@ -43,7 +45,9 @@
                       test.sdo21.paramatizedTests.conversion.TypeConversionTest.class,
                       test.sdo21.tests.conversion.StringConversionTest.class,
                       test.sdo21.tests.api.XMLWithoutSchemaTest.class,
-                      test.sdo21.tests.general.XMLHelperTest.class
+                      test.sdo21.tests.general.XMLHelperTest.class,
+                      DataGraphConsistencySuite.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=537762&r1=537761&r2=537762
==============================================================================
--- 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 02:38:19 2007
@@ -24,15 +24,14 @@
 import org.junit.runners.Suite;
 
 import test.sdo21.paramatizedTests.api.DataFactoryTest;
-import test.sdo21.paramatizedTests.api.DataGraphTest;
 import test.sdo21.paramatizedTests.api.PropertyTest;
 import test.sdo21.paramatizedTests.api.SequenceTest;
 import test.sdo21.paramatizedTests.api.TypeHelperTest;
 import test.sdo21.paramatizedTests.api.TypeTest;
 import test.sdo21.paramatizedTests.api.XMLHelperTest;
 import test.sdo21.paramatizedTests.conversion.TypeConversionTest;
-import test.sdo21.paramatizedTests.general.ContainmentTest;
 import test.sdo21.paramatizedTests.general.ContainmentCycleSerializationTest;
+import test.sdo21.paramatizedTests.general.ContainmentTest;
 import test.sdo21.paramatizedTests.general.DeleteTest;
 import test.sdo21.tests.api.CopyHelper.CopyEqualityTest;
 import test.sdo21.tests.api.DataObject.ActiveUpdatingTest;
@@ -42,7 +41,7 @@
  * CTS which includes the following classes:<br>
  * <ul>
  * <LI>{@link test.sdo21.tests.api.CopyHelper.CopyEqualityTest}</LI>
- * <LI>{@link test.sdo21.paramatizedTests.api.DataFactoryTest}</LI>
+ * <LI>{@link test.sdo21.paramatizedTests.api.DataFactoryTestBase}</LI>
  * <LI>{@link test.sdo21.paramatizedTests.api.PropertyTest}</LI>
  * <LI>{@link test.sdo21.paramatizedTests.api.SequenceTest}</LI>
  * <LI>{@link test.sdo21.paramatizedTests.api.TypeHelperTest}</LI>
@@ -59,7 +58,7 @@
  */
 @RunWith(Suite.class)
 @Suite.SuiteClasses( {ActiveUpdatingTest.class, ContainmentTest.class, CopyEqualityTest.class, DataFactoryTest.class,
-                      DataGraphTest.class, DeleteTest.class, PropertyTest.class, SequenceTest.class,
+                      DeleteTest.class, PropertyTest.class, SequenceTest.class,
                       TypeConversionTest.class, TypeHelperTest.class, TypeTest.class, XMLHelperTest.class,
                       ContainmentCycleSerializationTest.class})
 public class CTSParamatizedSuite {

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java?view=diff&rev=537762&r1=537761&r2=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java Mon May 14 02:38:19 2007
@@ -26,6 +26,7 @@
 import test.sdo21.tests.api.DynamicTypesFromSchemaTestCase;
 import test.sdo21.tests.api.SequenceAddOpenTest;
 import test.sdo21.tests.api.SequenceAddTypedTest;
+import test.sdo21.tests.api.DataGraph.DataGraphConsistencySuite;
 import test.sdo21.tests.api.DataObject.ActiveUpdatingTest;
 import test.sdo21.tests.api.DataObject.DataObjectTest;
 import test.sdo21.tests.conversion.DateConversionTest;
@@ -62,7 +63,7 @@
                       XSDSimpleTypeTest.class,
                       SequenceAddOpenTest.class,
                       SequenceAddTypedTest.class,
-                      ActiveUpdatingTest.class 
+                      ActiveUpdatingTest.class
                       })
 public class CTSGeneralSuite {
 

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java?view=auto&rev=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java Mon May 14 02:38:19 2007
@@ -0,0 +1,218 @@
+package test.sdo21.tests.TestData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+
+public class StandardDynamicFactory extends StandardFactory {
+
+  public void defineMetaData(HelperContext hc) {
+    TypeHelper types = hc.getTypeHelper();
+    Type stringType = types.getType("commonj.sdo", "String");
+    Type intType = types.getType("commonj.sdo", "Int");
+    Type booleanType = types.getType("commonj.sdo", "Boolean");
+    Type byteType = types.getType("commonj.sdo", "Byte");
+    Type decimalType = types.getType("commonj.sdo", "Decimal");
+    Type floatType = types.getType("commonj.sdo", "Float");
+    Type doubleType = types.getType("commonj.sdo", "Double");
+    Type dateType = types.getType("commonj.sdo", "Date");
+    Type shortType = types.getType("commonj.sdo", "Short");
+    Type longType = types.getType("commonj.sdo", "Long");
+    Type bytesType = types.getType("commonj.sdo", "Bytes");
+    Type integerType = types.getType("commonj.sdo", "Integer");
+    Type charType = types.getType("commonj.sdo", "Character");
+
+    DataObject abstractTypeDO = hc.getDataFactory().create("commonj.sdo", "Type");
+    abstractTypeDO.set("uri", TEST_NAMESPACE);
+    abstractTypeDO.set("name", "Abstract");
+    // abstractTypeDO.setBoolean("abstract", true);
+
+    DataObject firstProperty = abstractTypeDO.createDataObject("property");
+    firstProperty.set("name", "firstName");
+    firstProperty.set("type", stringType);
+
+    DataObject lastProperty = abstractTypeDO.createDataObject("property");
+    lastProperty.set("name", "lastName");
+    lastProperty.set("type", stringType);
+
+    Type abstractType = types.define(abstractTypeDO);
+
+    DataObject extendedTypeDO = hc.getDataFactory().create("commonj.sdo", "Type");
+    extendedTypeDO.set("uri", TEST_NAMESPACE);
+    extendedTypeDO.set("name", EXT_TYPE);
+    
+    List baseTypes = new ArrayList();
+    baseTypes.add(abstractType);
+    extendedTypeDO.setList("baseType", baseTypes);
+    
+    DataObject middleName = extendedTypeDO.createDataObject("property");
+    middleName.set("name", "middleName");
+    middleName.set("type", stringType);
+    
+    DataObject nickName = extendedTypeDO.createDataObject("property");
+    nickName.set("name", "nickName");
+    nickName.set("type", stringType);
+    
+    Type extendedType = types.define(extendedTypeDO);
+    
+    DataObject sequenceTypeDO = hc.getDataFactory().create("commonj.sdo", "Type");
+    sequenceTypeDO.set("uri", TEST_NAMESPACE);
+    sequenceTypeDO.set("name", SEQ_TYPE);
+    sequenceTypeDO.setBoolean("sequenced", true);
+    
+    // TODO: Uncomment the following when SDOUtil.addAliasName is
+    // implemented
+    /*
+     * aliases.clear(); aliases.add("Seq2"); sequenceTypeDO.set("aliasName",
+     * aliases);
+     */
+
+    DataObject Letters = sequenceTypeDO.createDataObject("property");
+    Letters.set("name", "Letters");
+    Letters.set("type", stringType);
+    Letters.setBoolean("many", true);
+
+    DataObject Numbers = sequenceTypeDO.createDataObject("property");
+    Numbers.set("name", "Numbers");
+    Numbers.set("type", intType);
+    Numbers.setBoolean("many", true);
+    
+    DataObject containManySeq = sequenceTypeDO.createDataObject("property");
+    containManySeq.set("name", "containMany");
+    containManySeq.set("type", sequenceTypeDO);
+    containManySeq.setBoolean("many", true);
+    containManySeq.setBoolean("containment", true);
+    
+    DataObject containSeq = sequenceTypeDO.createDataObject("property");
+    containSeq.set("name", "contain");
+    containSeq.set("type", sequenceTypeDO);
+    containSeq.setBoolean("containment", true);
+
+    Type sequenceType = types.define(sequenceTypeDO);
+
+    DataObject openTypeDO = hc.getDataFactory().create("commonj.sdo", "Type");
+    openTypeDO.set("uri", TEST_NAMESPACE);
+    openTypeDO.set("name", "Open");
+    openTypeDO.setBoolean("open", true);
+    
+    DataObject definedElem = openTypeDO.createDataObject("property");
+    definedElem.set("name", "defined");
+    definedElem.set("type", stringType);
+    
+    Type openType = types.define(openTypeDO);
+    
+    DataObject testType = hc.getDataFactory().create("commonj.sdo", "Type");
+    testType.set("uri", TEST_NAMESPACE);
+    testType.set("name", API_TYPE);
+
+    DataObject stringProperty = testType.createDataObject("property");
+    stringProperty.set("name", "stringVal");
+    stringProperty.set("type", stringType);
+
+    DataObject booleanProperty = testType.createDataObject("property");
+    booleanProperty.set("name", "booleanVal");
+    booleanProperty.set("type", booleanType);
+
+    DataObject boolean2Property = testType.createDataObject("property");
+    boolean2Property.set("name", "booleanVal2");
+    boolean2Property.set("type", booleanType);
+
+    DataObject byteProperty = testType.createDataObject("property");
+    byteProperty.set("name", "byteVal");
+    byteProperty.set("type", byteType);
+
+    DataObject string2Property = testType.createDataObject("property");
+    string2Property.set("name", "stringVal2");
+    string2Property.set("type", stringType);
+
+    DataObject decimalProperty = testType.createDataObject("property");
+    decimalProperty.set("name", "decimalVal");
+    decimalProperty.set("type", decimalType);
+
+    DataObject decimal2Property = testType.createDataObject("property");
+    decimal2Property.set("name", "decimalVal2");
+    decimal2Property.set("type", decimalType);
+
+    // TODO: Uncomment the following when SDOUtil.addAliasName is
+    // implemented
+    /*
+     * aliases.clear(); aliases.add("Dec2");
+     * decimal2Property.set("aliasName", aliases);
+     */
+    DataObject intProperty = testType.createDataObject("property");
+    intProperty.set("name", "intVal");
+    intProperty.set("type", intType);
+
+    DataObject floatProperty = testType.createDataObject("property");
+    floatProperty.set("name", "floatVal");
+    floatProperty.set("type", floatType);
+
+    DataObject doubleProperty = testType.createDataObject("property");
+    doubleProperty.set("name", "doubleVal");
+    doubleProperty.set("type", doubleType);
+
+    DataObject dateProperty = testType.createDataObject("property");
+    dateProperty.set("name", "dateVal");
+    dateProperty.set("type", dateType);
+
+    DataObject shortProperty = testType.createDataObject("property");
+    shortProperty.set("name", "shortVal");
+    shortProperty.set("type", shortType);
+
+    DataObject longProperty = testType.createDataObject("property");
+    longProperty.set("name", "longVal");
+    longProperty.set("type", longType);
+
+    DataObject containManyProperty = testType.createDataObject("property");
+    containManyProperty.set("name", "containMany");
+    containManyProperty.setBoolean("many", true);
+    containManyProperty.setBoolean("containment", true);
+    containManyProperty.set("type", testType);
+
+    DataObject bytesProperty = testType.createDataObject("property");
+    bytesProperty.set("name", "bytesVal");
+    bytesProperty.set("type", bytesType);
+
+    DataObject integerProperty = testType.createDataObject("property");
+    integerProperty.set("name", "integerVal");
+    integerProperty.set("type", integerType);
+
+    DataObject charProperty = testType.createDataObject("property");
+    charProperty.set("name", "charVal");
+    charProperty.set("type", charType);
+
+    DataObject readOnlyProperty = testType.createDataObject("property");
+    readOnlyProperty.set("name", "readOnlyVal");
+    readOnlyProperty.set("type", stringType);
+    readOnlyProperty.setBoolean("readOnly", true);
+   
+    DataObject sequenceProperty = testType.createDataObject("property");
+    sequenceProperty.set("name", "sequencedElem");
+    sequenceProperty.set("type", sequenceType);
+    sequenceProperty.setBoolean("containment", true);
+
+    DataObject extendProperty = testType.createDataObject("property");
+    extendProperty.set("name", "extendedElem");
+    extendProperty.set("type", extendedType);
+    extendProperty.setBoolean("containment", true);
+    
+    DataObject openProperty = testType.createDataObject("property");
+    openProperty.set("name", "openElem");
+    openProperty.set("type", openType);
+    openProperty.setBoolean("containment", true);
+    
+    DataObject containProperty = testType.createDataObject("property");
+    containProperty.set("name", "contain");
+    containProperty.setBoolean("containment", true);
+    containProperty.set("type", testType); 
+    
+    types.define(testType);
+    
+  }
+  
+
+}

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java?view=auto&rev=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java Mon May 14 02:38:19 2007
@@ -0,0 +1,30 @@
+package test.sdo21.tests.TestData;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * Abstract base class for creating tests data of an specific nature.
+ * Concrete specializations of this class may create the metadata by various means,
+ * e.g. the SDO Dynamic API or XSD to SDO conversion,  or some other implementation
+ * specific means, e.g. generation of static classes.
+ * 
+ * All derived classes must create equivalent metatdata by whatever means is chosen.
+ *
+ */
+public abstract class StandardFactory implements TestDataFactory {
+  
+  public static final String TEST_NAMESPACE = "http://www.example.com/api_test";
+  public static final String API_TYPE = "APITest";
+  public final static String SEQ_TYPE = "Sequenced";
+  public final static String EXT_TYPE = "Extended";
+
+  /**
+   * this factory currently simple makes the assumption that the variant string is the
+   * name of a type for which an empty instance is required
+   */
+  public DataObject createTestData(HelperContext scope, String variantString) throws Exception {
+    return scope.getDataFactory().create(TEST_NAMESPACE, variantString);
+  }
+
+}

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java?view=auto&rev=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java Mon May 14 02:38:19 2007
@@ -0,0 +1,32 @@
+package test.sdo21.tests.TestData;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import test.sdo21.paramatizedTests.util.TypeCreateUtility;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * 
+ * Concrete specialization of the StandardFactory test data creation factory
+ * which uses an XSD to create the required metadata.
+ *
+ */
+public class StandardXSDFactory extends StandardFactory {
+
+  public final static String TEST_MODEL = "/api_test.xsd";
+
+  
+  public void defineMetaData(HelperContext hc) throws IOException {
+    // Populate the meta data for the test model (APITest)
+    URL url = TypeCreateUtility.class.getResource(TEST_MODEL);
+    InputStream inputStream = url.openStream();
+    hc.getXSDHelper().define(inputStream, url.toString());
+    inputStream.close();
+    
+  }
+  
+
+}

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java?view=auto&rev=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java Mon May 14 02:38:19 2007
@@ -0,0 +1,9 @@
+package test.sdo21.tests.TestData;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+public interface TestDataFactory { 
+  public void defineMetaData(HelperContext scope)  throws Exception;
+  public DataObject createTestData(HelperContext scope, String variant) throws Exception;
+}

Added: 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=auto&rev=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyBase.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyBase.java Mon May 14 02:38:19 2007
@@ -0,0 +1,185 @@
+/*
+ *  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: 536535 $  $Date: 2007-05-09 15:04:49 +0100 (Wed, 09 May 2007) $
+ */
+package test.sdo21.tests.api.DataGraph;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import test.sdo21.framework.CTSTestCase;
+import test.sdo21.tests.TestData.StandardFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataGraph;
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+
+public abstract class DataGraphConsistencyBase extends CTSTestCase {
+    
+	  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
+    public void tearDown() throws Exception {
+      super.tearDown();
+    }
+    
+    /**
+     * Verify the proper function of DataGraph.createRootObject(Type).
+     */
+    @Test
+    public void testCreateRootObjectByType() {
+        Type testType = testDO.getType();
+
+        DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+        DataObject rootDO = dataGraph.createRootObject(testType);
+
+        assertEquals("DataObject.getDataGraph() did not return the expected DataGraph.",
+                     rootDO.getDataGraph(),
+                     dataGraph);
+
+        assertEquals("DataGraph.getRootObject() did not return the expected DataObject.",
+                     dataGraph.getRootObject(),
+                     rootDO);
+    }
+
+    /**
+     * Verify the proper function of DataGraph.createRootObject(URI,Name).
+     */
+    @Test
+    // FIXME I don't think we should be removing tests because they will in the future be deprecated
+    // This suite tests against the 2.1 spec as it stands -- so we may need to have some
+    // tests running against the default helper context if the API doesn't support selection of scope
+    @Ignore("(Uri,name) methods of DataGraph should be deprecated due to absence of HelperContext.")
+    public void testCreateRootObjectByURI() {
+        Type testType = testDO.getType();
+
+        DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+        DataObject rootDO = dataGraph.createRootObject(testType.getURI(), testType.getName());
+
+        assertEquals("DataObject.getDataGraph() did not return the expected DataGraph.",
+                     rootDO.getDataGraph(),
+                     dataGraph);
+
+        assertEquals("DataGraph.getRootObject() did not return the expected DataObject.",
+                     dataGraph.getRootObject(),
+                     rootDO);
+    }
+
+    /**
+     * Verify the proper function of DataGraph.getChangeSummary() when the
+     * DataGraph RootObject was created by Type
+     */
+    @Test
+    public void testDataGraphGetChangeSummaryType() {
+        Type testType = testDO.getType();
+
+        DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+        dataGraph.createRootObject(testType);
+
+        runChangeSummaryTests(dataGraph);
+    }
+
+    /**
+     * Verify the proper function of DataGraph.getChangeSummary() when the
+     * DataGraph RootObject was created by URI
+     */
+    @Test
+    @Ignore("(Uri,name) methods of DataGraph should be deprecated due to absence of HelperContext.")
+    public void testDataGraphGetChangeSummaryURI() {
+        Type testType = testDO.getType();
+
+        DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+        dataGraph.createRootObject(testType.getURI(), testType.getName());
+
+        runChangeSummaryTests(dataGraph);
+    }
+
+    /**
+     * Verify the proper function of DataGraph.getType(URI, Name) when the
+     * DataGraph RootObject was created by Type
+     */
+    @Test
+    @Ignore("(Uri,name) methods of DataGraph should be deprecated due to absence of HelperContext.")
+    public void testDataGraphGetType() {
+        Type testType = testDO.getType();
+
+        DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+        dataGraph.createRootObject(testType);
+
+        assertEquals("DataGraph.getType() did not return the expected Type.",
+                     dataGraph.getType(testType.getURI(), testType.getName()),
+                     testType);
+    }
+
+    /**
+     * Verify the proper function of DataGraph.getType(URI, Name) when the
+     * DataGraph RootObject was created by URI
+     */
+    @Test
+    @Ignore("(Uri,name) methods of DataGraph should be deprecated due to absence of HelperContext.")
+    public void testDataGraphGetURI() {
+        Type testType = testDO.getType();
+
+        DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+        dataGraph.createRootObject(testType.getURI(), testType.getName());
+
+        assertEquals("DataGraph.getType() did not return the expected Type.",
+                     dataGraph.getType(testType.getURI(), testType.getName()),
+                     testType);
+    }
+
+    /**
+     * testGetChangeSummary performs some verification on the ChangeSummary
+     * returned by DataGraph.getChangeSummary()
+     */
+    private void runChangeSummaryTests(DataGraph generatingDG) {
+        ChangeSummary generatedCS = generatingDG.getChangeSummary();
+
+        assertNotNull("DataGraph.getChangeSummary() returned a null ChangeSummary.", generatedCS);
+
+        assertEquals("The ChangeSummary returned by DataGraph.getChangeSummary() did not return refer to the generating DataGraph.",
+                     generatedCS.getDataGraph(),
+                     generatingDG);
+
+        assertEquals("The ChangeSummary returned by DataGraph.getChangeSummary() and the DataGraph have different root Objects. ",
+                     generatedCS.getRootObject(),
+                     generatingDG.getRootObject());
+    }
+}

Added: 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=auto&rev=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyDynamic.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyDynamic.java Mon May 14 02:38:19 2007
@@ -0,0 +1,14 @@
+package test.sdo21.tests.api.DataGraph;
+
+import test.sdo21.tests.TestData.StandardDynamicFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+
+public class DataGraphConsistencyDynamic extends DataGraphConsistencyBase {
+
+  public TestDataFactory createTestDataFactory() {
+
+    return new StandardDynamicFactory();
+  }
+
+  
+}

Added: 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=auto&rev=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencySuite.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencySuite.java Mon May 14 02:38:19 2007
@@ -0,0 +1,11 @@
+package test.sdo21.tests.api.DataGraph;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {DataGraphConsistencyDynamic.class,
+                      DataGraphConsistencyXSD.class})
+public class DataGraphConsistencySuite {
+
+}

Added: 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=auto&rev=537762
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyXSD.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyXSD.java Mon May 14 02:38:19 2007
@@ -0,0 +1,14 @@
+package test.sdo21.tests.api.DataGraph;
+
+import test.sdo21.tests.TestData.StandardXSDFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+
+public class DataGraphConsistencyXSD extends DataGraphConsistencyBase {
+
+  public TestDataFactory createTestDataFactory() {
+
+    return new StandardXSDFactory();
+  }
+
+  
+}



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