tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gw...@apache.org
Subject svn commit: r501803 [1/5] - in /incubator/tuscany/java/cts/sdo2.1/src/main: java/test/sdo21/ java/test/sdo21/framework/ java/test/sdo21/paramatizedTests/ java/test/sdo21/paramatizedTests/api/ java/test/sdo21/paramatizedTests/conversion/ java/test/sdo21...
Date Wed, 31 Jan 2007 11:18:48 GMT
Author: gwinn
Date: Wed Jan 31 03:18:45 2007
New Revision: 501803

URL: http://svn.apache.org/viewvc?view=rev&rev=501803
Log:
TUSCANY-1048

Added:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/CopyEqualityTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/SequenceTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/TypeHelperTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/TypeTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/XMLHelperTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/conversion/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/conversion/TypeConversionTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/conversion/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ActiveUpdatingTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/DeleteTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/TypeCreateUtility.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/XSDSerializationTest.java   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/package.html   (with props)
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/package.html   (with props)
Removed:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/DefaultTestHelper.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ExpectedConditionError.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ExpectedExceptionError.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ReturnValueError.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/scenarios/
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/scenarios/DynamicTestCase.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/scenarios/DynamicWithStaticResourceTestCase.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/typeconv/
Modified:
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java
    incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java
    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/scenarios/DataObjectListTest.java
    incubator/tuscany/java/cts/sdo2.1/src/main/resources/api_test.xsd

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java?view=diff&rev=501803&r1=501802&r2=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java Wed Jan 31 03:18:45 2007
@@ -1,5 +1,4 @@
-/**
- *
+/*
  *  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
@@ -16,75 +15,106 @@
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
  *  under the License.
+ *  
+ *  $Rev$  $Date$
  */
 package test.sdo21;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
 import test.sdo21.framework.TestHelper;
-import test.sdo21.tests.api.DataObjectTest;
-import test.sdo21.tests.typeconv.TypeConversionTest;
 
 /**
- * This is the main entry point into the CTS. This class can be run as a JUnit TestCase
- * or as a Java application using the command-line.
- *
- * The SDO implementation being tested must be on the classpath before running this.
+ * The main "root" CTS test suite which includes execution of the
+ * following sub-categorized CTS within Junit 4.1 environment:
+ * <ul>
+ *   <li>test.sdo21.paramatizedTests.CTSParamatizedSuite</li>
+ *   <li>test.sdo21.tests.CTSGeneralSuite</li>
+ * </ul>
  */
-public class CTSSuite extends TestCase {
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {test.sdo21.paramatizedTests.CTSParamatizedSuite.class, test.sdo21.tests.CTSGeneralSuite.class})
+public class CTSSuite {
 
-
-    public CTSSuite(String string) {
-        super(string);
-    }
+    private static TestHelper testHelper;
+    private static boolean initialized = false;
 
     /**
-     * JUnit suite() method allows all test to be run.
-     *
-     * @return Test suite
+     * Name of environment variable for vendor specific implementation for
+     * implementation of {@link test.sdo21.framework.TestHelper}
      */
-    public static Test suite() {
+    public static final String SDO_CTS_TESTHELPER_CLASS = "CTS_TEST_HELPER";
 
-        // validate the setup first
-        try {
-            getTestHelper().getTypeHelper();
-        } catch (Exception e) {
-            throw new RuntimeException( "Failed to load SDO implementation", e );
+    /**
+     * Called before SDO CTS is executed. Provides the means for implementation
+     * specific initialization of SDO infrastructure.
+     */
+    @BeforeClass
+    public static void init() {
+        if (!initialized) {
+            try {
+                String helperClassName = System.getenv(SDO_CTS_TESTHELPER_CLASS);               
+                
+                if ((helperClassName == null) || (helperClassName.equals(""))) {
+                    System.out.println(SDO_CTS_TESTHELPER_CLASS + " was not set - attempting Tuscany implementation : " + helperClassName );
+                    
+                    Map<String, String> map = System.getenv();
+                    Set s = map.keySet();
+                    for (Iterator i=s.iterator();i.hasNext();){
+                        String key = (String) i.next();
+                        System.out.println(key +":" + map.get(key));
+                    }                    
+                    helperClassName = "test.sdo21.vendor.tuscany.testHelper.TuscanyTestHelper";
+                }
+
+                testHelper = (TestHelper)Class.forName(helperClassName).newInstance();
+                System.out.println("Loaded " + helperClassName);
+                // initialize SDO implementation
+                testHelper.init();
+                initialized = true;
+
+            } catch (Exception e) {
+                System.out.println("Could not initialize test cases correct " + e.toString());
+                e.printStackTrace();
+            }
         }
-
-        // create the test suite
-        TestSuite suite = new TestSuite();
-
-        // add the individual tests to the test suite (later on we should provide configuration
-        // options so user can choose between mandatory/optional/proposed/mandatory tests
-        suite.addTest( new TestSuite(DataObjectTest.class ) );
-        suite.addTest( new TestSuite(TypeConversionTest.class ) );
-
-        // return the test suite
-        return suite;
     }
 
     /**
      * Main method allows tests to be run directly from command-line.
-     *
+     * 
      * @param args
      */
+    // TODO: add some usefull paramaters here such as helper class or junit
+    // runner
     public static void main(String[] args) {
-        junit.textui.TestRunner.run(suite());
+        try {
+            // TODO: provide vender specific initialization
+            org.junit.runner.JUnitCore.runClasses(Class.forName("test.sdo21.CTSSuite"));
+        } catch (ClassNotFoundException e) {
+            System.out.println("Exception " + e.toString());
+            e.printStackTrace();
+        }
     }
 
     /**
-     * Load the vendor's TestHelper implementation (or the default generic one).
-     *
+     * Get the vendor's TestHelper implementation (or the default generic one).
+     * 
      * @return
      * @throws Exception
      */
-    public static TestHelper getTestHelper() throws Exception {
-        // we should load the class name from a properties file or make it a parameter
-        String helperClassName = "test.sdo21.framework.DefaultTestHelper";
-        return (TestHelper) Class.forName(helperClassName).newInstance();
-    }
+    public static TestHelper getTestHelper() {
+        if (!initialized) {
+            init();
+        }
+        return testHelper;
 
+    }
 
 }

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java?view=diff&rev=501803&r1=501802&r2=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java Wed Jan 31 03:18:45 2007
@@ -1,5 +1,4 @@
-/**
- *
+/*
  *  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
@@ -16,35 +15,97 @@
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
  *  under the License.
+ *  
+ *  $Rev$  $Date$
  */
 package test.sdo21.framework;
 
+import java.util.Collection;
+
+import commonj.sdo.DataGraph;
 import commonj.sdo.DataObject;
 import commonj.sdo.Type;
+import commonj.sdo.helper.CopyHelper;
 import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.DataHelper;
+import commonj.sdo.helper.EqualityHelper;
 import commonj.sdo.helper.TypeHelper;
 import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
 
 /**
- * Vendors can provide an implementation of this interface to bootstrap their SDO implementation.
- *
+ * Vendors can provide an implementation of this interface to bootstrap their
+ * SDO implementation.
  */
 public interface TestHelper {
 
-    /**
+	public static final String INCOMPLETE_TEST_CASE_FAILURE = "The following test cases is incomplete";
+    
+	/**
      * Initialize the SDO implementation being tests.
      */
     public void init();
 
+    /**
+     *
+     * @return XMLHelper
+     */
     public XMLHelper getXMLHelper();
+    
+    /**
+     *
+     * @return XSDHelper
+     */
+    public XSDHelper getXSDHelper();
 
+    /**
+     *
+     * @return TypeHelper
+     */
     public TypeHelper getTypeHelper();
 
+    /**
+     *
+     * @return DataFactory
+     */
     public DataFactory getDataFactory();
+    
+    /**
+     *
+     * @return DataHelper
+     */
+    public DataHelper getDataHelper();
+    
+    /**
+     *
+     * @return EqualityHelper
+     */
+    public EqualityHelper getEqualityHelper();
+    
+    /**
+     *
+     * @return CopyHelper
+     */
+    public CopyHelper getCopyHelper();
+    
+    
+    
+    
+
+    /**
+     * Returns collection containing DataObject, String pairs to be used as
+     * arguments to paramatized test cases. DataObjects should adhere to
+     * api_test.xsd and should be populated. The String should be a description
+     * of the mechanism used to create and populate the DataObject. See
+     * {@link test.sdo21.vendorSpecific.tuscany.testHelper.TuscanyTestHelper} for examples.
+     * 
+     * @return
+     */
+    public Collection getParamatizedDataObject();
 
     /**
      * Convenience method for creating a type definition.
-     *
+     * 
      * @param uri
      * @param name
      * @return
@@ -53,6 +114,7 @@
 
     /**
      * Convenience method for creating a property definition
+     * 
      * @param typeDef The type definition that this property should be added to
      * @param name The name for the property
      * @param type The type to assign to the property
@@ -60,23 +122,52 @@
      * @param isContainment
      * @return
      */
-    public DataObject createPropertyDef(DataObject typeDef, String name, Type type, boolean isMany, boolean isContainment);
+    public DataObject createPropertyDef(DataObject typeDef,
+                                        String name,
+                                        Type type,
+                                        boolean isMany,
+                                        boolean isContainment);
 
     /**
      * Convenience method for creating a property definition
+     * 
      * @param typeDef The type definition that this property should be added to
      * @param name The name for the property
-     * @param type The type to assign to the property e.g. "commonj.sdo#DataObject"
+     * @param type The type to assign to the property e.g.
+     *            "commonj.sdo#DataObject"
      * @param isMany
      * @param isContainment
      * @return
      */
-    public DataObject createPropertyDef(DataObject typeDef, String name, String type, boolean isMany, boolean isContainment);
+    public DataObject createPropertyDef(DataObject typeDef,
+                                        String name,
+                                        String type,
+                                        boolean isMany,
+                                        boolean isContainment);
 
     /**
-     * Convenience method for creating a unique name that can be used for a property or type.
-     *
+     * Convenience method for creating a unique name that can be used for a
+     * property or type.
+     * 
      * @return String containing a unique name
      */
     public String createUniqueName();
+    
+    
+    /**
+     * Create an empty data graph.
+     * @return the new data graph instance.
+     */
+    public DataGraph createDataGraph();
+  
+    
+    /**
+     * Register and initialize the SDO types supported by the specified generated factory class.
+     *  This function must be called before instances of the generated types can be created/used.
+     *  The registered types will be visible in all TypeHelper's created in the same classLoader
+     *  scope as the call to this function.
+     * @param factoryClass the generated factory class.
+     */
+     public void registerStaticTypes(Class factoryClass);
+
 }

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/package.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/package.html?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/package.html (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/package.html Wed Jan 31 03:18:45 2007
@@ -0,0 +1,25 @@
+<html>
+<!--
+  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$
+-->
+<body>
+Contains framework of this test suite.
+</body>
+</html>

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/package.html
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/package.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/package.html?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/package.html (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/package.html Wed Jan 31 03:18:45 2007
@@ -0,0 +1,25 @@
+<html>
+<!--
+  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$
+-->
+<body>
+Contains main CTS test file.
+</body>
+</html>

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/package.html
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java Wed Jan 31 03:18:45 2007
@@ -0,0 +1,126 @@
+/*
+ *  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.paramatizedTests;
+
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.junit.runners.Parameterized.Parameters;
+
+import test.sdo21.CTSSuite;
+import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
+import test.sdo21.paramatizedTests.util.TypeCreateUtility;
+
+import commonj.sdo.DataObject;
+
+/**
+ * BaseSDOParamatizedTest provides a DataObject and String instance variable
+ * which are populated by Junit Paramaatized Test Runner prior to tests being
+ * run. The data method provides a Collection of DataObject/String pairs which
+ * should be used to populate these instance variables. This allows for test
+ * cases to be executed using a variety of Type registration and DataObject
+ * population combinations which is essentual for good SDO test coverage.
+ * 
+ */
+public class BaseSDOParamatizedTest {
+
+	public DataObject testDO;
+
+	public String description;
+
+	public BaseSDOParamatizedTest(DataObject testDO, String description) {
+		this.testDO = testDO;
+		this.description = description;
+	}
+
+	/**
+	 * Returns a collection of data populated DataObjects which are used during
+	 * the test.
+	 */
+	@Parameters
+	public static Collection data() {
+
+		// TODO: use properties file and TestHelper to populate this Collection
+		// with desired DataObjects
+		ArrayList list = new ArrayList();
+		list.add(new Object[] { createDynamicDO(), new String("Dynamic") });
+		list.add(new Object[] { createMixedDO(), new String("Mixed") });
+
+		// add vendor specific paramaters
+		try {
+			test.sdo21.CTSSuite.init();
+			Collection c = test.sdo21.CTSSuite.getTestHelper()
+					.getParamatizedDataObject();
+			list.addAll(c);
+
+		} catch (Exception e) {
+			System.out.println("Could not add vendor specific paramaters");
+			e.printStackTrace();
+		}
+		return list;
+	}
+
+	/**
+	 * Creates and populates a dynamic DataObject
+	 */
+	private static DataObject createDynamicDO() {
+		TypeCreateUtility.createDynamically();
+		DataObject testDO = CTSSuite.getTestHelper().getDataFactory().create(
+				ParamatizedTestUtil.TEST_NAMESPACE, "APITest");
+		try {
+			ParamatizedTestUtil.populateFields(testDO);
+		} catch (Exception e) {
+			fail("Exception caught " + e.toString());
+			e.printStackTrace();
+		}
+		return testDO;
+	}
+
+	/**
+	 * Creates and populates a DataObject that has Type define by an XSD but is
+	 * dynamically populated.
+	 */
+	private static DataObject createMixedDO() {
+
+		try {
+			TypeCreateUtility.createDynamicWithStaticResources();
+			DataObject testDO = CTSSuite.getTestHelper().getDataFactory()
+					.create(ParamatizedTestUtil.TEST_NAMESPACE,
+							ParamatizedTestUtil.TEST_TYPE);
+
+			try {
+				ParamatizedTestUtil.populateFields(testDO);
+			} catch (Exception e) {
+				fail("Exception caught " + e.toString());
+				e.printStackTrace();
+			}
+			return testDO;
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 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=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java Wed Jan 31 03:18:45 2007
@@ -0,0 +1,63 @@
+/*
+ *  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.paramatizedTests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import test.sdo21.paramatizedTests.api.CopyEqualityTest;
+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.ActiveUpdatingTest;
+import test.sdo21.paramatizedTests.general.ContainmentTest;
+import test.sdo21.paramatizedTests.general.DeleteTest;
+
+/**
+ * Declares paramatized test classes to be run within Junit 4.1 Suite for SDO CTS
+ * which includes the following classes:<br>
+ * <ul>
+ *   <li>test.sdo21.paramatizedTests.api.CopyEqualityTest</li>
+ *   <li>test.sdo21.paramatizedTests.api.DataFactoryTest</li>
+ *   <li>test.sdo21.paramatizedTests.api.PropertyTest</li>
+ *   <li>test.sdo21.paramatizedTests.api.SequenceTest</li>
+ *   <li>test.sdo21.paramatizedTests.api.TypeHelperTest</li>
+ *   <li>test.sdo21.paramatizedTests.api.TypeTest</li>
+ *   <li>test.sdo21.paramatizedTests.api.XMLHelperTest</li>
+ *   <li>test.sdo21.paramatizedTests.conversion.TypeConversionTest</li>
+ *   <li>test.sdo21.paramatizedTests.general.ActiveUpdatingTest</li>
+ *   <li>test.sdo21.paramatizedTests.general.ContainmentTest</li>
+ *   <li>test.sdo21.paramatizedTests.general.DeleteTest</li>
+ * </ul>
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {ActiveUpdatingTest.class, ContainmentTest.class, CopyEqualityTest.class, DataFactoryTest.class,
+                      //DataGraphTest.class, 
+                        DeleteTest.class, PropertyTest.class, SequenceTest.class,
+                      TypeConversionTest.class, TypeHelperTest.class, TypeTest.class, XMLHelperTest.class})
+public class CTSParamatizedSuite {
+
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java Wed Jan 31 03:18:45 2007
@@ -0,0 +1,159 @@
+/*
+ *  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.paramatizedTests;
+
+// static imports simply allow you to call assertTrue rather than
+// Assert.assertTrue
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.junit.Ignore;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.CTSSuite;
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Example test class to be used as a template for paramatized SDO test cases.
+ * This class extends {@link test.sdo21.paramatizedTest.BaseSDOParamatizedTest}
+ * which simply will populate a DataObject called testSDO, that adheres to
+ * api_test.xsd using a variety of means. The test methods will be called once
+ * for every instance of testDO. <br>
+ * <br>
+ * The test case can be run using Junit within eclipse, from normal command line
+ * junit, or within a WebSphere build environment by adding an target such as
+ * sampleTestTarget that is contained within the build.xml file of the
+ * WAS.soa.sdo.cts component. <br>
+ * <br>
+ * Once a test case has been completed and reviewed it can be added into the
+ * appropiate CTS Suite.<br>
+ * <br>
+ * Test cases that are poorly suited to testing on DataObjects that adhere to
+ * api_test.xsd can easily be written as non paramatized tests and created
+ * within the {@link test.sdo21.tests} package structure.<br>
+ * <br>
+ * This test class should make every effort to only use methods that are defined
+ * within the current SDO Specification. If utility methods are required they
+ * should be added to {@link test.sdo21.framework.TestHelper} or
+ * {@link test.sdo21.paramatizedTests.util.ParamatizedTestUtil}. <br>
+ * <br>
+ * Please Document the overall intention of the test case and provide detailed
+ * javadoc for each test method. Please create modular test methods rather than
+ * single large test methods<br>
+ * <br>
+ * Resources:
+ * <UL>
+ * <LI><a href="http://www.junit.org/">Junit Fondation</a>
+ * <LI><a
+ * href="https://issues.apache.org/jira/browse/TUSCANY-1048">TUSCANY-1048</a>
+ * </UL>
+ * 
+ * Change History:
+ * <UL>
+ * <LI>Initial implementation
+ * </UL>
+ * 
+ */
+@RunWith(Parameterized.class)
+public class TestTemplate extends BaseSDOParamatizedTest {
+
+	public TestTemplate(DataObject testDO, String description) {
+		super(testDO, description);
+	}
+
+	/**
+	 * Example test method. Please provide good description of the test case in
+	 * javadoc including the intention, reference to the specification, etc.
+	 */
+	@Test
+	public void myTestMethod() {
+
+		String expected = new String("bla bla bla");
+		String actual = new String("bla bla bla");
+		assertEquals("Your Message", expected, actual);
+	}
+
+	/**
+	 * Sometimes you want to temporarily disable a test. Methods annotated with
+	 * {@link org.junit.Test} that are also annotated with <code>@Ignore</code> will not be executed as tests. Native JUnit 4 test
+	 *         runners should report the number of ignored tests along with the
+	 *         number of tests that ran and the number of tests that failed.
+	 *         <code>@Ignore</code> takes an optional default parameter if you want to record
+	 *         why a test is being ignored:<br>
+	 */
+	@Test
+	@Ignore("Function Foo is not clearly defined within the SDO 2.1 specification and is currently being defined as a part of the x.x specification.")
+	public void exampleIngoredTestCase() {
+		// test method here
+	}
+
+	/**
+	 * Sometimes you may not have the resources to implement a test case. If is
+	 * very very valuable to create method signatures in the appropiate classes
+	 * for test cases that are currently not covered. In cases such as these
+	 * please define and checkin method signatures with the following failure
+	 * message.
+	 * <br><br>
+	 * In this case you should ensure that the class that contains the test method is 
+	 * added to a testSuite such as {@link test.sdo21.paramatizedTests.CTSParamatizedSuite} 
+	 * so that it will be completed, or open a defect/JIRA to complete the test case.
+	 */
+	@Test
+	public void exampleUnimplementedTestCase() {
+		fail("The following test case has been defined but not implemented.  TestName.  Brief test description");
+		// test method here
+	}
+
+	/**
+	 * When writing tests, it is common to find that several tests need similar
+	 * objects created before they can run. Annotating a
+	 * <code>public void</code> method with <code>@Before</code> causes that method to be run before the
+	 *         {@link org.junit.Test} method. The <code>@Before</code> methods of superclasses will be run before those of the
+	 *         current class. There is also an <code>@After</code> annotation
+	 * 
+	 */
+	public void testCaseInit() {
+		//initMethod
+	}
+
+	/**
+	 * Sometimes several tests need to share computationally expensive setup
+	 * (like logging into a database). While this can compromise the
+	 * independence of tests, sometimes it is a necessary optimization.
+	 * Annotating a <code>public static void</code> no-arg method with
+	 * <code>@BeforeClass</code> causes it to be run once before any of the test
+	 *              methods in the class. The <code>@BeforeClass</code> methods of superclasses will be run before those the
+	 *              current class.
+	 */
+	public static void init() {
+		//init
+	}
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/CopyEqualityTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/CopyEqualityTest.java?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/CopyEqualityTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/CopyEqualityTest.java Wed Jan 31 03:18:45 2007
@@ -0,0 +1,80 @@
+/*
+ *  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.paramatizedTests.api;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.CTSSuite;
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.EqualityHelper;
+
+/**
+ * TestCase tests shallow and deep copy functions of CopyHelper utilizing the
+ * EqualityHelper class. Can be used to test dynamic, mixed and static
+ * DataObjects
+ * 
+ */
+@RunWith(Parameterized.class)
+public class CopyEqualityTest extends BaseSDOParamatizedTest {
+
+    public CopyEqualityTest(DataObject testDO, String description) {
+        super(testDO, description);
+    }
+
+    /**
+     * testCopyEqualityShallow performs a shallow copy. Between the source and
+     * output for the copy - Shallow equality should be true, deep equality
+     * should be false (assuming passed DO includes a containment reference).
+     */
+    @Test
+    public void testCopyEqualityShallow() {
+        DataObject shallowCopy = CTSSuite.getTestHelper().getCopyHelper().copyShallow(testDO);        
+        
+        EqualityHelper equalityH = CTSSuite.getTestHelper().getEqualityHelper();
+        
+        assertTrue("Shallow copy did not result in shallow equality", equalityH.equalShallow(testDO,
+                                                                                                           shallowCopy));
+
+        // TODO: Determine why Deep equality results when Type is sequenced.
+
+        assertFalse("Shallow copy should not result in deep equality for this Type.", equalityH
+            .equal(testDO, shallowCopy));
+    }
+
+    /**
+     * testCopyEqualityDeep performs a deep copy. Between the source and output
+     * for the copy - Both shallow and deep equality should be true.
+     */
+    @Test
+    public void testCopyEqualityDeep() {
+        DataObject deepCopy = CTSSuite.getTestHelper().getCopyHelper().copy(testDO);
+        assertTrue("Deep copy did not result in shallow equality.", CTSSuite.getTestHelper().getEqualityHelper().equalShallow(testDO,
+                                                                                                         deepCopy));
+        assertTrue("Deep copy did not result in deep equality.", CTSSuite.getTestHelper().getEqualityHelper().equal(testDO, deepCopy));
+    }
+}

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

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

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java Wed Jan 31 03:18:45 2007
@@ -0,0 +1,137 @@
+/*
+ *  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.paramatizedTests.api;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.CTSSuite;
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+
+/**
+ * Junit 4.1 test case. Tests DataFactory APIs.
+ * 
+ */
+@RunWith(Parameterized.class)
+public class DataFactoryTest extends BaseSDOParamatizedTest {
+    public DataFactoryTest(DataObject testDO, String description) {
+        super(testDO, description);
+    }
+
+    /**
+     * testDataFactoryAPI calls each of the methods in the DataFactory class and
+     * verifies their proper operation.
+     */
+    @Test
+    public void testDataFactoryAPI() {
+        Type type = testDO.getType();
+        boolean errorCaught;
+
+        DataObject typeDO = CTSSuite.getTestHelper().getDataFactory().create(type);
+
+        /**
+         * Verify the proper operation of DataFactory.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.", ParamatizedTestUtil
+            .areEqualTypes(typeDO.getType(), type));
+
+        /**
+         * Verify the proper operation of DataFactory.create(URI, Name).
+         */
+
+        DataObject uriDO = CTSSuite.getTestHelper().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.", ParamatizedTestUtil
+            .areEqualTypes(uriDO.getType(), type));
+
+        /**
+         * Verify the proper operation of DataFactory.create(Class).
+         */
+
+        if (type.getInstanceClass() != null) {
+            DataObject classDO = CTSSuite.getTestHelper().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.", ParamatizedTestUtil
+                .areEqualTypes(classDO.getType(), type));
+
+        }
+
+        /**
+         * Verify that DataFactory.create with DataType results in
+         * IllegalArgumentException
+         */
+
+        errorCaught = false;
+        try {
+            Type dataType = CTSSuite.getTestHelper().getTypeHelper().getType("commonj.sdo", "Int");
+            assertTrue("Could not test DataFactory.create(dataType) because dataType.isDataType = false", dataType
+                .isDataType());
+            CTSSuite.getTestHelper().getDataFactory().create(dataType);
+
+        } catch (IllegalArgumentException e) {
+            errorCaught = true;
+        } catch (Exception e) {
+            fail("DataFactory.create(dataType) did not throw the expected IllegalArgumentException Exception.");
+        }
+        assertTrue("DataFactory.create(dataType) did not throw the an Exception.", errorCaught);
+
+        /**
+         * Verify that DataFactory.create with Abstract Type results in
+         * IllegalArgumentException Currently commented out due to this test
+         * case failing.
+         */
+
+        // TODO: Uncomment the following (and edit the documentation just above)
+        // TODO: JIRA ?
+        /*
+         * try { errorCaught = false; Type abstractType =
+         * CTSSuite.getTestHelper().getTypeHelper.getType(FVTUtil.TEST_NAMESPACE, "Abstract"); if
+         * (abstractType.isAbstract())
+         * CTSSuite.getTestHelper().getDataFactory().create(abstractType); else throw new
+         * ExpectedConditionError("Could not test
+         * DataFactory.create(abstractType) because abstractType.isAbstract =
+         * false"); } catch (IllegalArgumentException e) { errorCaught = true; }
+         * catch (Exception e) { throw new
+         * ExpectedExceptionError("DataFactory.create(abstractType) did not
+         * throw the expected Exception.", IllegalArgumentException.class,
+         * e.getClass()); } if (!errorCaught) throw new
+         * ExpectedExceptionError("DataFactory.create(abstractType) did not
+         * throw an Exception.");
+         */
+    }
+
+}

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

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

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.java?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.java Wed Jan 31 03:18:45 2007
@@ -0,0 +1,122 @@
+/*
+ *  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.paramatizedTests.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+
+import commonj.sdo.ChangeSummary;
+import commonj.sdo.DataGraph;
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+
+/**
+ * Junit 4.1 test case. Tests DataGraph APIs Extends
+ * 
+ */
+@RunWith(Parameterized.class)
+public class DataGraphTest extends BaseSDOParamatizedTest {
+
+    public DataGraphTest(DataObject testDO, String description) {
+        super(testDO, description);
+    }
+
+    /**
+     * testDataGraphAPI is used to test the methods of the DataGraph object
+     */
+    @Test
+    public void testDataGraphAPI() {
+        Type testType = testDO.getType();
+
+        /**
+         * Verify the proper function of DataGraph.createRootObject(Type).
+         */
+
+        DataGraph dataGraph1 = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+        DataObject rootDO1 = dataGraph1.createRootObject(testType);
+
+        assertEquals("DataObject.getDataGraph() did not return the expected DataGraph.",
+                     rootDO1.getDataGraph(),
+                     dataGraph1);
+
+        assertEquals("DataGraph.getRootObject() did not return the expected DataObject.",
+                     dataGraph1.getRootObject(),
+                     rootDO1);
+
+        /**
+         * Verify the proper function of DataGraph.createRootObject(URI,Name).
+         */
+
+        DataGraph dataGraph2 = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+        DataObject rootDO2 = dataGraph2.createRootObject(testType.getURI(), testType.getName());
+
+        assertEquals("DataObject.getDataGraph() did not return the expected DataGraph.",
+                     rootDO2.getDataGraph(),
+                     dataGraph2);
+
+        assertEquals("DataGraph.getRootObject() did not return the expected DataObject.",
+                     dataGraph2.getRootObject(),
+                     rootDO2);
+
+        /**
+         * Verify the proper function of DataGraph.getChangeSummary()
+         */
+
+        testGetChangeSummary(dataGraph1);
+        testGetChangeSummary(dataGraph2);
+
+        /**
+         * Verify the proper function of DataGraph.getType(URI, Name).
+         */
+        assertEquals("DataGraph.getType() did not return the expected Type.",
+                     dataGraph1.getType(testType.getURI(), testType.getName()),
+                     testType);
+
+        assertEquals("DataGraph.getType() did not return the expected Type.",
+                     dataGraph2.getType(testType.getURI(), testType.getName()),
+                     testType);
+    }
+
+    /**
+     * testGetChangeSummary performs some verification on the ChangeSummary
+     * returned by DataGraph.getChangeSummary()
+     */
+    private void testGetChangeSummary(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());
+
+    }
+}

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

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

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java Wed Jan 31 03:18:45 2007
@@ -0,0 +1,173 @@
+/*
+ *  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.paramatizedTests.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.CTSSuite;
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+
+/**
+ * Junit 4.1 test case.  Tests API for Property.
+ * 
+ */
+@RunWith(Parameterized.class)
+public class PropertyTest extends BaseSDOParamatizedTest {
+
+    public PropertyTest(DataObject testDO, String description) {
+        super(testDO, description);
+    }
+    /**
+     * testPropertyAPI is used to test the methods of the Property API:
+     * <ul>
+     *   <li>getName()</li>
+     *   <li>getType()</li>
+     *   <li>isMany()</li>
+     *   <li>isContainment()</li>
+     *   <li>isReadOnly()</li>
+     *   <li>getContainingType()</li>
+     *   <li>getAliasNames()</li>
+     *   <li>getOpposite()</li>
+     * </ul>
+     */
+    @Test
+    public void testPropertyAPI() {
+        Property property;
+
+        /**
+         * Verify Property.getDefault() for both a newly created DataObject and
+         * a cleared DataObject.
+         */
+
+        verifyGetDefault(CTSSuite.getTestHelper().getDataFactory().create(testDO.getType()));
+
+        // Set the values for each Property using populateFields, then unset
+        // them using unsetFields.
+
+        try{
+        	ParamatizedTestUtil.populateFields(testDO);
+        }catch(Exception e){
+        	fail("Exception caught " + e.toString());
+        	e.printStackTrace();
+        }
+        unsetFields(testDO);
+        verifyGetDefault(testDO);
+
+        property = testDO.getProperty("children");
+
+        /**
+         * Verify getName, getType, isMany==true, isContainment==true
+         */
+        assertEquals("Property.getName() returned an unexpected value.", property.getName(), "children");
+        assertEquals("Property.getType() returned an unexpected value.", property.getType(), testDO.getType());
+        assertTrue("Property.isMany() returned an unexpected value.", property.isMany());
+        assertTrue("Property.isContainment() returned an unexpected value.", property.isContainment());
+
+        property = testDO.getProperty("booleanVal");
+
+        /**
+         * Verify isMany==false, isReadOnly==false, isCtonainment==false,
+         * getContainingType, getAliasNames, getOpposite
+         */
+
+        assertEquals("Property.getName() returned an unexpected value.", property.getName(), "booleanVal");
+
+        assertFalse("Property.isMany() returned an unexpected value.", property.isMany());
+
+        assertFalse("Property.isReadOnly() returned an unexpected value.", property.isReadOnly());
+
+        assertFalse("Property.isContainment() returned an unexpected value.", property.isContainment());
+
+        assertEquals("Property.getContainingType() returned an unexpected value.", property.getContainingType(), testDO
+            .getType());
+
+        assertEquals("Property.getAliasNames() returned a List of unexpected size.", property.getAliasNames().size(), 0);
+
+        // TODO: Uncomment the following when SDOUtil.addAliasName is
+        // implemented
+        /*
+         * List aliasNames = testDO.getProperty("decimalVal2").getAliasNames();
+         * if (aliasNames.size() != 1) throw new
+         * ReturnValueError("Property.getAliasNames() returned a List of
+         * unexpected size.", Integer.valueOf(1),
+         * Integer.valueOf(property.getAliasNames().size())); else if
+         * (!(aliasNames.get(0).equals("Dec2"))) throw new
+         * ReturnValueError("Property.getAliasNames() returned a List with
+         * unexpected contents.", "Dec2", aliasNames.get(0));
+         */
+        assertNull("Property.getOpposite() did not return null as expected.", property.getOpposite());
+    }
+
+    /**
+     * verifyGetDefault is a private method that loops through each Property in
+     * the passed DataObject and verifies that the value is equal to the value
+     * returned by getDefault for each Property. The precondition is that unset
+     * has been called for any Property for which a value has been set.
+     * 
+     * @param testedDO
+     */
+
+    private void verifyGetDefault(DataObject testedDO) {
+        List properties = testedDO.getInstanceProperties();
+        Property property;
+
+        for (int i = 0; i < properties.size(); i++) {
+            property = (Property)properties.get(i);
+
+            if (property.isMany()) {
+                assertNull("Property.getDefault() did not return null for many-valued Property " + property.getName()
+                    + "'.", property.getDefault());
+            } else {
+                assertEquals("Property.getDefault() did not return the correct default value for Property '" + property
+                    .getName()
+                    + "'.", testedDO.get(property), property.getDefault());
+            }
+        }
+    }
+
+    /**
+     * unsetFields() is a private method that loops through the Properties in
+     * the passed DataObject and unsets each Property.
+     * 
+     * @param unsetDO
+     */
+
+    private void unsetFields(DataObject unsetDO) {
+        List properties = unsetDO.getInstanceProperties();
+
+        for (int i = 0; i < properties.size(); i++)
+            unsetDO.unset(i);
+    }
+}

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

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

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/SequenceTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/SequenceTest.java?view=auto&rev=501803
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/SequenceTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/SequenceTest.java Wed Jan 31 03:18:45 2007
@@ -0,0 +1,487 @@
+/*
+ *  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.paramatizedTests.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+
+/**
+ * Junit 4.1 test case. Tests tests methods of Sequence API
+ * 
+ */
+@RunWith(Parameterized.class)
+public class SequenceTest extends BaseSDOParamatizedTest {
+
+    public SequenceTest(DataObject testDO, String description) {
+        super(testDO, description);
+    }
+
+    /**
+     * testSequenceAPI tests the methods of the Sequence API
+     */
+    @Test
+    public void testSequenceAPI() {
+        DataObject sequenceDO = testDO.getDataObject("sequencedElem");
+        Property numberProp = sequenceDO.getProperty("Numbers");
+        Property letterProp = sequenceDO.getProperty("Letters");
+        Property invalidProp = testDO.getProperty("dateVal");
+
+        int numberIndex = 0, letterIndex = 0, invalidIndex, sequenceSize = 0, sequenceIndex;
+
+        List properties = sequenceDO.getType().getProperties();
+
+        invalidIndex = properties.size();
+
+        for (int i = 0; i < properties.size(); i++) {
+            if (((Property)properties.get(i)).equals(numberProp))
+                numberIndex = i;
+            else if (((Property)properties.get(i)).equals(letterProp))
+                letterIndex = i;
+        }
+
+        /**
+         * Ensure that the DataObject is sequenced as expected.
+         */
+
+        assertTrue("The created Type 'Sequenced' has Type.isSequenced() == false.  The test case may not proceed.",
+                   sequenceDO.getType().isSequenced());
+
+        Sequence sequence = sequenceDO.getSequence();
+        boolean errorCaught;
+
+        assertEquals("Sequence.size() returned an unexpected value.", sequence.size(), 0);
+
+        /**
+         * Verify that the index specified methods throw an Exception for an
+         * invalid index.
+         */
+
+        try {
+            errorCaught = false;
+            sequence.getProperty(0);
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+
+        assertTrue("Sequence.getProperty() should throw an Exception when an invalid index is given.", errorCaught);
+
+        try {
+            errorCaught = false;
+            sequence.remove(0);
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.remove() should throw an Exception when an invalid index is given.", errorCaught);
+
+        try {
+            errorCaught = false;
+            sequence.getValue(0);
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.getValue() should throw an Exception when an invalid index is given.", errorCaught);
+
+        try {
+            errorCaught = false;
+            sequence.setValue(0, "attempt");
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+
+        assertTrue("Sequence.setValue() should throw an Exception when an invalid index is given.", errorCaught);
+
+        // Add elements to the Sequence by updating the DataObject
+
+        List letterList = sequenceDO.getList("Letters");
+        List numberList = sequenceDO.getList("Numbers");
+
+        letterList.add("A");
+        letterList.add("B");
+        numberList.add(Integer.valueOf(5));
+        letterList.add("C");
+        numberList.add(Integer.valueOf(16));
+
+        sequenceSize = 5;
+
+        // The expected arrangement of sequence is as follows
+        // {<Letters, "A">, <Letters, "B">, <Numbers, 5>, <Lettes, "C">,
+        // <Numbers, 16>}
+
+        /**
+         * Verify performance of size, getProperty, and getValue
+         */
+
+        assertEquals("Sequence.size() returned an unexpected value.", sequence.size(), sequenceSize);
+
+        assertEquals("Sequence.getProperty() returned an unexpected Property.", sequence.getProperty(1), letterProp);
+
+        assertEquals("Sequence.getProperty() returned an unexpected Property.", sequence.getProperty(4), numberProp);
+
+        assertEquals("Sequence.getValue() returned an unexpected value.", sequence.getValue(0), "A");
+
+        assertEquals("Sequence.getValue() returned an unexpected value.", sequence.getValue(2), 5);
+
+        /**
+         * Use setValue to modify the Sequence, then verify the outcome
+         */
+
+        sequence.setValue(1, "F");
+
+        // Expect: {<Letters, "A">, <Letters, "F">, <Numbers, 5>, <Lettes, "C">,
+        // <Numbers, 16>}
+
+        assertEquals("Sequence.setValue() did not have the intended effect.", sequence.getValue(1), "F");
+
+        /**
+         * Use Sequence.remove() to modify the Sequence, then verify the outcome
+         */
+
+        sequence.remove(1);
+        sequenceSize--;
+
+        // Expect: {<Letters, "A">, <Numbers, 5>, <Lettes, "C">, <Numbers, 16>}
+        assertEquals("Sequence.remove() did not decrement the size of the Sequence.", sequence.size(), sequenceSize);
+
+        assertEquals("Sequence.remove() did not shift the elements as expected.", sequence.getValue(1), 5);
+
+        // TODO: Change the following to addText when the API is changed.
+
+        /**
+         * Use Sequence.add() to modify the Sequence, then verify the outcome
+         */
+
+        sequence.add("Structured text at the end.");
+        sequenceSize++;
+
+        // Expect: {<Letters, "A">, <Numbers, 5>, <Lettes, "C">, <Numbers, 16>,
+        // "Structured text at the end"}
+
+        assertEquals("Sequence.add(String) did not increment the size of the Sequence.", sequence.size(), sequenceSize);
+
+        assertEquals("Sequence.add(String) did not place the correct value at the correct index.", sequence
+            .getValue(sequenceSize - 1), "Structured text at the end.");
+
+        assertNull("Sequence.add(String) should result in a null Property in the final index.", sequence
+            .getProperty(sequenceSize - 1));
+
+        /**
+         * Use Sequence.move() to modify the Sequence, then verify the outcome
+         */
+
+        sequence.move(1, 3);
+
+        // Expect: {<Letters, "A">, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">,
+        // "Structured text at the end"}
+        assertEquals("Sequence.move() had an unexpected effect on the size of the Sequence.",
+                     sequence.size(),
+                     sequenceSize);
+
+        assertEquals("Sequence.move() did not place the expected value at the expected location.",
+                     sequence.getValue(1),
+                     16);
+
+        assertEquals("Sequence.move() had an unexpected effect on the index following the move-to index.", sequence
+            .getValue(2), 5);
+
+        /**
+         * Attempt move with an invalid index and verify the error handling.
+         */
+
+        try {
+            errorCaught = false;
+            sequence.move(0, 5);
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.move() should throw an Exception when an invalid Exception is given.", errorCaught);
+
+        /**
+         * Use Sequence.add(Property, Object) to modify the Sequence, then
+         * verify the outcome
+         */
+
+        sequence.add(numberProp, Integer.valueOf(8));
+        sequenceSize++;
+
+        // Expect: {<Letters, "A">, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">,
+        // "Structured text at the end", <Numbers, 8>}
+
+        assertEquals("Sequence.add(Property, Object) did not increment the size of the Sequence.",
+                     sequence.size(),
+                     sequenceSize);
+        assertEquals("Sequence.add(Property, Object) did not place the expected value at the expected index.", sequence
+            .getValue(sequenceSize - 1), 8);
+
+        assertEquals("Sequence.add(Property, Object) did not place the expected Property at the expected index.",
+                     sequence.getProperty(sequenceSize - 1),
+                     numberProp);
+        assertEquals("Sequence.add(Property, Object) did not place the expected Property at the expected index.",
+                     sequence.getProperty(sequenceSize - 1),
+                     numberProp);
+
+        /**
+         * Attempt add(Property, Object) with an invalid Property and verify the
+         * error handling
+         */
+
+        try {
+            errorCaught = false;
+            sequence.add(invalidProp, "A");
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.add(Property, Object) should throw an Exception when an invalid Property is given.",
+                   errorCaught);
+
+        /**
+         * Use Sequence.add(String, Object) to modify the Sequence, then verify
+         * the outcome
+         */
+
+        sequence.add("Letters", "K");
+        sequenceSize++;
+
+        // Expect: {<Letters, "A">, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">,
+        // "Structured text at the end", <Numbers, 8>, <Letters, "K">}
+
+        assertEquals("Sequence.add(String, Object) did not increment the size of the Sequence.",
+                     sequence.size(),
+                     sequenceSize);
+
+        assertEquals("Sequence.add(String, Object) did not place the expected value at the expected index.", sequence
+            .getValue(sequenceSize - 1), "K");
+
+        assertEquals("Sequence.add(String, Object) did not place the expected Property at the expected index.",
+                     sequence.getProperty(sequenceSize - 1),
+                     letterProp);
+
+        /**
+         * Attempt add(String, Object) with an invalid String and verify the
+         * error handling
+         */
+
+        try {
+            errorCaught = false;
+            sequence.add("NoSuchProperty", "A");
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.add(String, Object) should throw an Exception when an invalid Property is given.",
+                   errorCaught);
+
+        /**
+         * Attempt add(String, Object) with an invalid Object and verify the
+         * error handling
+         */
+
+        try {
+            errorCaught = false;
+            sequence.add("Numbers", "A");
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.add(String, Object) should throw an Exception when an invalid Object is given.",
+                   errorCaught);
+
+        /**
+         * Use Sequence.add(int, Object) to modify the Sequence, then verify the
+         * outcome
+         */
+
+        sequence.add(numberIndex, Integer.valueOf(10));
+        sequenceSize++;
+
+        // Expect: {<Letters, "A">, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">,
+        // "Structured text at the end", <Numbers, 8>, <Letters, "K">, <Numbers,
+        // 10>}
+
+        assertEquals("Sequence.add(int, Object) did not increment the size of the Sequence.",
+                     sequence.size(),
+                     sequenceSize);
+        assertEquals("Sequence.add(int, Object) did not place the expected value at the expected index.", sequence
+            .getValue(sequenceSize - 1), 10);
+
+        assertEquals("Sequence.add(int, Object) did not place the expected Property at the expected index.", sequence
+            .getProperty(sequenceSize - 1), numberProp);
+
+        /**
+         * Attempt add(int, Object) with an invalid Object and verify the error
+         * handling
+         */
+
+        try {
+            errorCaught = false;
+            sequence.add(invalidIndex, Integer.valueOf(16));
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+
+        assertTrue("Sequence.add(int, Object) should throw an Exception when an invalid index is given.", errorCaught);
+
+        /**
+         * Use Sequence.add(int, String, Object) to modify the Sequence, then
+         * verify the outcome TODO This section is commented out until
+         * Tuscany-931 is resolved.
+         */
+
+        /*
+         * sequenceIndex = 1; sequence.add(sequenceIndex, "Numbers",
+         * Integer.valueOf(-4)); sequenceSize++; // Expect: {<Letters, "A">,
+         * <Numbers, -4>, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">,
+         * "Structured text at the end", // <Numbers, 8>, <Letters, "K">,
+         * <Numbers, 10>} if (sequence.size() != sequenceSize) throw new
+         * ExpectedConditionError("Sequence.add(int, String, Object) did not
+         * increment the size of the Sequence.", Integer.valueOf(sequenceSize),
+         * Integer.valueOf(sequence.size())); if
+         * (!(sequence.getValue(sequenceIndex).equals(Integer.valueOf(-4))))
+         * throw new ExpectedConditionError("Sequence.add(int, String, Object)
+         * did not place the expected value at the expected index.",
+         * Integer.valueOf(-4), sequence.getValue(sequenceIndex)); if
+         * (!(sequence.getProperty(sequenceIndex).equals(numberProp))) throw new
+         * ExpectedConditionError("Sequence.add(int, String, Object) did not
+         * place the expected Property at the expected index.", numberProp,
+         * sequence.getProperty(sequenceIndex));
+         */
+        /**
+         * Use Sequence.add(int, Property, Object) to modify the Sequence, then
+         * verify the outcome TODO This section is commented out until
+         * Tuscany-931 is resolved.
+         */
+        /*
+         * sequenceIndex = 0; sequence.add(sequenceIndex, numberProp,
+         * Integer.valueOf(17)); sequenceSize++; // Expect: {<Numbers, 17>,
+         * <Letters, "A">, <Numbers, -4>, <Numbers, 16>, <Numbers, 5>, <Lettes,
+         * "C">, "Structured text at the end", // <Numbers, 8>, <Letters, "K">,
+         * <Numbers, 10>} if (sequence.size() != sequenceSize) throw new
+         * ExpectedConditionError("Sequence.add(int, Property, Object) did not
+         * increment the size of the Sequence.", Integer.valueOf(sequenceSize),
+         * Integer.valueOf(sequence.size())); if
+         * (!(sequence.getValue(sequenceIndex).equals(Integer.valueOf(17))))
+         * throw new ExpectedConditionError("Sequence.add(int, Property, Object)
+         * did not place the expected value at the expected index.",
+         * Integer.valueOf(17), sequence.getValue(sequenceIndex)); if
+         * (!(sequence.getProperty(sequenceIndex).equals(numberProp))) throw new
+         * ExpectedConditionError("Sequence.add(int, Property, Object) did not
+         * place the expected Property at the expected index.", numberProp,
+         * sequence.getProperty(sequenceIndex));
+         */
+        /**
+         * Use Sequence.add(int, int, Object) to modify the Sequence, then
+         * verify the outcome TODO This section is commented out until
+         * Tuscany-931 is resolved.
+         */
+        /*
+         * sequenceIndex = 9; sequence.add(sequenceIndex, letterIndex, "S");
+         * sequenceSize++; // Expect: {<Numbers, 17>, <Letters, "A">, <Numbers,
+         * -4>, <Numbers, 16>, <Numbers, 5>, <Lettes, "C">, "Structured text at
+         * the end", // <Numbers, 8>, <Letters, "K">, <Letters, "S">, <Numbers,
+         * 10>} if (sequence.size() != sequenceSize) throw new
+         * ExpectedConditionError("Sequence.add(int, Property, Object) did not
+         * increment the size of the Sequence.", Integer.valueOf(sequenceSize),
+         * Integer.valueOf(sequence.size())); if
+         * (!(sequence.getValue(sequenceIndex).equals("S"))) throw new
+         * ExpectedConditionError("Sequence.add(int, Property, Object) did not
+         * place the expected value at the expected index.", "S",
+         * sequence.getValue(sequenceIndex)); if
+         * (!(sequence.getProperty(sequenceIndex).equals(letterProp))) throw new
+         * ExpectedConditionError("Sequence.add(int, Property, Object) did not
+         * place the expected Property at the expected index.", letterProp,
+         * sequence.getProperty(sequenceIndex));
+         */
+
+        /**
+         * Attempt Sequnce.add(int, int, Object) with an invalid Sequence index
+         * and verify proper error handling.
+         */
+
+        try {
+            errorCaught = false;
+            sequence.add(sequence.size(), letterIndex, "Z");
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.add(int, int, Object) should throw an Exception when an invalid Sequence index is given.",
+                   errorCaught);
+
+        /**
+         * Attempt Sequnce.add(int, int, Object) with an invalid Property index
+         * and verify proper error handling.
+         */
+
+        sequenceIndex = 0;
+        try {
+            errorCaught = false;
+            sequence.add(sequenceIndex, invalidIndex, "Z");
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.add(int, int, Object) should throw an Exception when an invalid Property index is given.",
+                   errorCaught);
+
+        /**
+         * Attempt Sequnce.add(int, Property, Object) with an invalid Property
+         * and verify proper error handling.
+         */
+
+        sequenceIndex = 0;
+        try {
+            errorCaught = false;
+            sequence.add(sequenceIndex, invalidProp, "Z");
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+
+        assertTrue("Sequence.add(int, int, Object) should throw an Exception when an invalid Property is given.",
+                   errorCaught);
+
+        /**
+         * Attempt Sequnce.add(int, int, Object) with an invalid Property name
+         * and verify proper error handling.
+         */
+
+        sequenceIndex = 0;
+        try {
+            errorCaught = false;
+            sequence.add(sequenceIndex, "notAValidProperty", "Z");
+        } catch (Exception e) {
+            errorCaught = true;
+        }
+        assertTrue("Sequence.add(int, int, Object) should throw an Exception when an invalid Property name is given.",
+                   errorCaught);
+
+        // TODO: Test add(int, Object instaceof String) after add(int, String)
+        // is changed to addText(int, String).
+    }
+
+}

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

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



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


Mime
View raw message