You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by gw...@apache.org on 2007/02/27 13:54:59 UTC
svn commit: r512241 [1/5] - in /incubator/tuscany/java/cts: sdo2.1-tuscany/
sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/ sdo2.1/
sdo2.1/src/main/java/test/sdo21/ sdo2.1/src/main/java/test/sdo21/framework/
sdo2.1/src/main/java/test/sdo2...
Author: gwinn
Date: Tue Feb 27 04:54:57 2007
New Revision: 512241
URL: http://svn.apache.org/viewvc?view=rev&rev=512241
Log:
TUSCANY-1117
Added:
incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java (with props)
incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java (with props)
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java (with props)
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/XMLHelperTest.java (with props)
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/util/
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/util/XMLEqualityChecker.java (with props)
Removed:
incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/SniffTest.java
Modified:
incubator/tuscany/java/cts/sdo2.1-tuscany/pom.xml
incubator/tuscany/java/cts/sdo2.1/pom.xml
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/paramatizedTests/BaseSDOParamatizedTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/CopyEqualityTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/SequenceTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/TypeHelperTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/TypeTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/XMLHelperTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/conversion/TypeConversionTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ActiveUpdatingTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/DeleteTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/TypeCreateUtility.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.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/api/DynamicTypesFromSchemaTestCase.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/general/XSDSerializationTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/scenarios/DataObjectListTest.java
Modified: incubator/tuscany/java/cts/sdo2.1-tuscany/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1-tuscany/pom.xml?view=diff&rev=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1-tuscany/pom.xml (original)
+++ incubator/tuscany/java/cts/sdo2.1-tuscany/pom.xml Tue Feb 27 04:54:57 2007
@@ -25,6 +25,20 @@
<target>1.5</target>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/AdoptedCtsTestSuite.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/OptionalCtsTestSuite.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
Added: incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java?view=auto&rev=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java (added)
+++ incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java Tue Feb 27 04:54:57 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.vendor.tuscany.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+/**
+ * <P>
+ * Provided to execute the SDO CTS for tuscany environment.
+ * </P><P>
+ * {@link test.sdo21.CTSSuite} contains all adopted test cases for the CTS.
+ * New test cases, or test cases that do not have consencus by the community
+ * should be placed in the {@link test.sdo21.UnderReviewSuite} suite.
+ * </P>
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {test.sdo21.CTSSuite.class})
+public class AdoptedCtsTestSuite {
+
+
+}
Propchange: incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java?view=auto&rev=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java (added)
+++ incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java Tue Feb 27 04:54:57 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package test.sdo21.vendor.tuscany.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Provided to execute the non adopted test cases in the SDO CTS within tuscany
+ * environment using the maven plugin. The {@link test.sdo21.CTSSuite} suite contains
+ * test cases that have been 'adopted' by the community, {@link test.sdo21.UnderReviewSuite}
+ * contains new test cases under review for inclusion.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {test.sdo21.UnderReviewSuite.class})
+public class OptionalCtsTestSuite {
+
+}
Propchange: incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/cts/sdo2.1/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/pom.xml?view=diff&rev=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/pom.xml (original)
+++ incubator/tuscany/java/cts/sdo2.1/pom.xml Tue Feb 27 04:54:57 2007
@@ -18,6 +18,13 @@
<target>1.5</target>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
<dependencies>
@@ -40,4 +47,4 @@
<properties>
<specVersion>2.1</specVersion>
</properties>
-</project>
\ No newline at end of file
+</project>
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=512241&r1=512240&r2=512241
==============================================================================
--- 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 Tue Feb 27 04:54:57 2007
@@ -20,10 +20,6 @@
*/
package test.sdo21;
-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;
@@ -31,15 +27,22 @@
import test.sdo21.framework.TestHelper;
/**
- * The main "root" CTS test suite which includes execution of the
- * following sub-categorized CTS within Junit 4.1 environment:
+ * 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>
+ * <li>{@link test.sdo21.paramatizedTests.CTSParamatizedSuite}: has been
+ * removed due to errors when executing.</li>
+ * <li>{@link test.sdo21.tests.CTSGeneralSuite}</li>
* </ul>
+ * In general vendors will simply execute their junit 4.1 harness with this
+ * class in order to run the CTS. They can optionally include the individual
+ * test cases that they wish to use. New test cases, or test cases that do not
+ * have consencus by the community should be placed in the
+ * {@link test.sdo21.UnderReviewSuite} suite.
*/
+
@RunWith(Suite.class)
-@Suite.SuiteClasses( {test.sdo21.paramatizedTests.CTSParamatizedSuite.class, test.sdo21.tests.CTSGeneralSuite.class})
+@Suite.SuiteClasses( {test.sdo21.tests.CTSGeneralSuite.class})
public class CTSSuite {
private static TestHelper testHelper;
@@ -59,17 +62,11 @@
public static void init() {
if (!initialized) {
try {
- String helperClassName = System.getenv(SDO_CTS_TESTHELPER_CLASS);
-
+ 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));
- }
+ System.out.println(SDO_CTS_TESTHELPER_CLASS + " was not set - attempting Tuscany implementation : "
+ + helperClassName);
helperClassName = "test.sdo21.vendor.tuscany.testHelper.TuscanyTestHelper";
}
Added: 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=auto&rev=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java Tue Feb 27 04:54:57 2007
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * This suite of tests is for new test cases, or test cases that are currently
+ * under review by the community. Once a test has been adopted it can be moved
+ * into {@link test.sdo21.tests.CTSGeneralSuite} or
+ * {@link test.sdo21.paramatizedTests.CTSParamatizedSuite} for inclusion into
+ * the CTS. Currently this includes :
+ * <UL>
+ * <LI>{@link test.sdo21.paramatizedTests.CTSParamatizedSuite} has been added
+ * temporarly while errors are resolved
+ * <LI>{@link test.sdo21.paramatizedTests.conversion.TypeConversionTest}
+ * <LI>{@link test.sdo21.tests.general.XMLHelperTest}
+ * <LI>{@link test.sdo21.tests.scenarios.DataObjectListTest}
+ * </UL>
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {test.sdo21.paramatizedTests.CTSParamatizedSuite.class,
+ test.sdo21.paramatizedTests.conversion.TypeConversionTest.class,
+ test.sdo21.tests.general.XMLHelperTest.class, test.sdo21.tests.scenarios.DataObjectListTest.class})
+public class UnderReviewSuite {
+
+}
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
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=512241&r1=512240&r2=512241
==============================================================================
--- 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 Tue Feb 27 04:54:57 2007
@@ -40,65 +40,55 @@
*/
public interface TestHelper {
- public static final String INCOMPLETE_TEST_CASE_FAILURE = "The following test cases is incomplete";
-
- /**
+ public static final String INCOMPLETE_TEST_CASE_FAILURE = "The following test case 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.
+ * {@link test.sdo21.vendorSpecific.tuscany.testHelper.TuscanyTestHelper}
+ * for examples.
*
* @return
*/
@@ -153,27 +143,30 @@
* @return String containing a unique name
*/
public String createUniqueName();
-
-
+
/**
* Create an empty data graph.
+ *
* @return the new data graph instance.
*/
public DataGraph createDataGraph();
-
+
/**
* Create a new HelperContext, a new scope
+ *
* @return the new HelperContext instance.
*/
public HelperContext createHelperContext();
-
+
/**
- * 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.
+ * 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);
+ public void registerStaticTypes(Class factoryClass);
}
Modified: 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=diff&rev=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java Tue Feb 27 04:54:57 2007
@@ -38,89 +38,87 @@
/**
* BaseSDOParamatizedTest provides a DataObject and String instance variable
- * which are populated by Junit Paramaatized Test Runner prior to tests being
+ * which are populated by Junit Paramatized 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 DataObject testDO;
- public String description;
+ 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;
- }
+ 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;
+ }
}
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=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java Tue Feb 27 04:54:57 2007
@@ -37,26 +37,27 @@
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>
+ * 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>
+ * <LI>{@link test.sdo21.paramatizedTests.api.CopyEqualityTest}</LI>
+ * <LI>{@link test.sdo21.paramatizedTests.api.DataFactoryTest}</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>
+ * <LI>{@link test.sdo21.paramatizedTests.api.TypeTest}</LI>
+ * <LI>{@link test.sdo21.paramatizedTests.api.XMLHelperTest}</LI>
+ * <LI>{@link test.sdo21.paramatizedTests.conversion.TypeConversionTest}</LI>
+ * <LI>{@link test.sdo21.paramatizedTests.general.ActiveUpdatingTest}</LI>
+ * <LI>{@link test.sdo21.paramatizedTests.general.ContainmentTest}</LI>
+ * <LI>{@link test.sdo21.paramatizedTests.general.DeleteTest}</LI>
* </ul>
+ * New test cases, or test cases that do not have consencus by the community
+ * should be placed in the {@link test.sdo21.UnderReviewSuite} suite.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses( {ActiveUpdatingTest.class, ContainmentTest.class, CopyEqualityTest.class, DataFactoryTest.class,
- //DataGraphTest.class,
- DeleteTest.class, PropertyTest.class, SequenceTest.class,
+ DataGraphTest.class, DeleteTest.class, PropertyTest.class, SequenceTest.class,
TypeConversionTest.class, TypeHelperTest.class, TypeTest.class, XMLHelperTest.class})
public class CTSParamatizedSuite {
Modified: 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=diff&rev=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/TestTemplate.java Tue Feb 27 04:54:57 2007
@@ -36,6 +36,7 @@
import org.junit.runners.Parameterized;
import test.sdo21.CTSSuite;
+import test.sdo21.framework.TestHelper;
import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
@@ -75,85 +76,83 @@
* <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
- }
+ 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(TestHelper.INCOMPLETE_TEST_CASE_FAILURE);
+ // 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
+ }
}
Modified: 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=diff&rev=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/CopyEqualityTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/CopyEqualityTest.java Tue Feb 27 04:54:57 2007
@@ -37,44 +37,66 @@
* 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).
+ * Performs a shallow copy and verifies that shallow equality is true
+ * between the source and output for the copy.
*/
@Test
- public void testCopyEqualityShallow() {
- DataObject shallowCopy = CTSSuite.getTestHelper().getCopyHelper().copyShallow(testDO);
-
+ public void testShallowCopyShallowEquality() {
+ 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));
+ }
+
+ /**
+ * Performs a shallow copy and verifies that deep equality is false
+ * (assuming passed DO includes a containment reference) between the source
+ * and output for the copy.
+ */
+ @Test
+ public void testShallowCopyDeepEquality() {
+ 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));
+ assertFalse("Shallow copy should not result in deep equality for this Type.", equalityH.equal(testDO,
+ shallowCopy));
+ }
+
+ /**
+ * Performs a deep copy and verifies that shallow equality exists between
+ * the source and output from the copy.
+ */
+ @Test
+ public void testDeepCopyShallowEquality() {
+ DataObject deepCopy = CTSSuite.getTestHelper().getCopyHelper().copy(testDO);
+
+ EqualityHelper equalityH = CTSSuite.getTestHelper().getEqualityHelper();
+
+ assertTrue("Deep copy did not result in shallow equality.", equalityH.equalShallow(testDO, deepCopy));
}
/**
- * testCopyEqualityDeep performs a deep copy. Between the source and output
- * for the copy - Both shallow and deep equality should be true.
+ * Performs a deep copy and verifies that deep equality exists between the
+ * source and output from the copy.
*/
@Test
- public void testCopyEqualityDeep() {
+ public void testDeepCopyDeepEquality() {
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));
+
+ EqualityHelper equalityH = CTSSuite.getTestHelper().getEqualityHelper();
+
+ assertTrue("Deep copy did not result in deep equality.", equalityH.equal(testDO, deepCopy));
}
}
Modified: 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=diff&rev=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java Tue Feb 27 04:54:57 2007
@@ -37,7 +37,6 @@
/**
* Junit 4.1 test case. Tests DataFactory APIs.
- *
*/
@RunWith(Parameterized.class)
public class DataFactoryTest extends BaseSDOParamatizedTest {
@@ -46,92 +45,90 @@
}
/**
- * testDataFactoryAPI calls each of the methods in the DataFactory class and
- * verifies their proper operation.
+ * Verify the proper operation of DataFactory.create(Type).
*/
@Test
- public void testDataFactoryAPI() {
+ public void testDataFactoryCreateByType() {
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).
- */
+ /**
+ * Verify the proper operation of DataFactory.create(URI, Name).
+ */
+ @Test
+ public void testDataFactoryCreateByURI() {
+ Type type = testDO.getType();
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));
+ 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).
- */
+ /**
+ * Verify the proper operation of DataFactory.create(Class).
+ */
+ @Test
+ public void testDataFactoryCreateByClass() {
+ Type type = testDO.getType();
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));
-
+ 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;
+ /**
+ * Verify that DataFactory.create with DataType results in
+ * IllegalArgumentException
+ */
+ @Test
+ public void testDataFactoryCreateDataTypeException() {
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);
-
+ fail("DataFactory.create(dataType) did not throw an Exception.");
} catch (IllegalArgumentException e) {
- errorCaught = true;
+ // Do nothing
} 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.");
- */
}
+ /**
+ * Verify that DataFactory.create with Abstract Type results in
+ * IllegalArgumentException.
+ */
+ @Test
+ public void testDataFactoryCreateAbstractException() {
+ try {
+ Type abstractType =
+ CTSSuite.getTestHelper().getTypeHelper().getType(ParamatizedTestUtil.TEST_NAMESPACE, "Abstract");
+
+ assertTrue("Could not test DataFactory.create(abstractType) because abstractType.isAbstract = false",
+ abstractType.isAbstract());
+ CTSSuite.getTestHelper().getDataFactory().create(abstractType);
+ fail("DataFactory.create(abstractType) did not throw an Exception.");
+
+ } catch (IllegalArgumentException e) {
+ // Do nothing
+ } catch (Exception e) {
+ fail("DataFactory.create(abstractType) did not throw the expected IllegalArgumentException Exception.");
+ }
+ }
}
Modified: 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=diff&rev=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataGraphTest.java Tue Feb 27 04:54:57 2007
@@ -36,68 +36,108 @@
/**
* 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
+ * Verify the proper function of DataGraph.createRootObject(Type).
*/
@Test
- public void testDataGraphAPI() {
+ public void testCreateRootObjectByType() {
Type testType = testDO.getType();
- /**
- * Verify the proper function of DataGraph.createRootObject(Type).
- */
-
- DataGraph dataGraph1 = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
- DataObject rootDO1 = dataGraph1.createRootObject(testType);
+ DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+ DataObject rootDO = dataGraph.createRootObject(testType);
assertEquals("DataObject.getDataGraph() did not return the expected DataGraph.",
- rootDO1.getDataGraph(),
- dataGraph1);
+ rootDO.getDataGraph(),
+ dataGraph);
assertEquals("DataGraph.getRootObject() did not return the expected DataObject.",
- dataGraph1.getRootObject(),
- rootDO1);
+ dataGraph.getRootObject(),
+ rootDO);
+ }
- /**
- * Verify the proper function of DataGraph.createRootObject(URI,Name).
- */
+ /**
+ * Verify the proper function of DataGraph.createRootObject(URI,Name).
+ */
+ @Test
+ public void testCreateRootObjectByURI() {
+ Type testType = testDO.getType();
- DataGraph dataGraph2 = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
- DataObject rootDO2 = dataGraph2.createRootObject(testType.getURI(), testType.getName());
+ DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+ DataObject rootDO = dataGraph.createRootObject(testType.getURI(), testType.getName());
assertEquals("DataObject.getDataGraph() did not return the expected DataGraph.",
- rootDO2.getDataGraph(),
- dataGraph2);
+ rootDO.getDataGraph(),
+ dataGraph);
assertEquals("DataGraph.getRootObject() did not return the expected DataObject.",
- dataGraph2.getRootObject(),
- rootDO2);
+ 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();
+ DataObject rootDO = dataGraph.createRootObject(testType);
+
+ runChangeSummaryTests(dataGraph);
+ }
+
+ /**
+ * Verify the proper function of DataGraph.getChangeSummary() when the
+ * DataGraph RootObject was created by URI
+ */
+ @Test
+ public void testDataGraphGetChangeSummaryURI() {
+ Type testType = testDO.getType();
+
+ DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+ DataObject rootDO = 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
+ public void testDataGraphGetType() {
+ Type testType = testDO.getType();
+
+ DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+ DataObject rootDO = dataGraph.createRootObject(testType);
- /**
- * 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()),
+ 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
+ public void testDataGraphGetURI() {
+ Type testType = testDO.getType();
+
+ DataGraph dataGraph = test.sdo21.CTSSuite.getTestHelper().createDataGraph();
+ DataObject rootDO = dataGraph.createRootObject(testType.getURI(), testType.getName());
assertEquals("DataGraph.getType() did not return the expected Type.",
- dataGraph2.getType(testType.getURI(), testType.getName()),
+ dataGraph.getType(testType.getURI(), testType.getName()),
testType);
}
@@ -105,7 +145,7 @@
* testGetChangeSummary performs some verification on the ChangeSummary
* returned by DataGraph.getChangeSummary()
*/
- private void testGetChangeSummary(DataGraph generatingDG) {
+ private void runChangeSummaryTests(DataGraph generatingDG) {
ChangeSummary generatedCS = generatingDG.getChangeSummary();
assertNotNull("DataGraph.getChangeSummary() returned a null ChangeSummary.", generatedCS);
@@ -117,6 +157,5 @@
assertEquals("The ChangeSummary returned by DataGraph.getChangeSummary() and the DataGraph have different root Objects. ",
generatedCS.getRootObject(),
generatingDG.getRootObject());
-
}
}
Modified: 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=diff&rev=512241&r1=512240&r2=512241
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java Tue Feb 27 04:54:57 2007
@@ -29,19 +29,20 @@
import java.util.List;
import org.junit.Test;
+import org.junit.Ignore;
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 test.sdo21.framework.TestHelper;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
/**
- * Junit 4.1 test case. Tests API for Property.
- *
+ * Junit 4.1 test case. Tests API for Property.
*/
@RunWith(Parameterized.class)
public class PropertyTest extends BaseSDOParamatizedTest {
@@ -49,85 +50,152 @@
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.
- */
+ /**
+ * Verify Property.getDefault() for a newly created DataObject.
+ */
+ @Test
+ public void testGetDefaultNewDO() {
verifyGetDefault(CTSSuite.getTestHelper().getDataFactory().create(testDO.getType()));
+ }
+ /**
+ * Verify Property.getDefault() for a cleared DataObject.
+ */
+ @Test
+ public void testGetDefaultClearedDO() {
// Set the values for each Property using populateFields, then unset
// them using unsetFields.
+ try {
- try{
- ParamatizedTestUtil.populateFields(testDO);
- }catch(Exception e){
- fail("Exception caught " + e.toString());
- e.printStackTrace();
+ ParamatizedTestUtil.populateFields(testDO);
+ } catch (Exception e) {
+ fail("could not populate DataObject fields");
}
unsetFields(testDO);
verifyGetDefault(testDO);
+ }
- property = testDO.getProperty("children");
-
- /**
- * Verify getName, getType, isMany==true, isContainment==true
- */
+ /**
+ * Verify Property.getName()
+ */
+ @Test
+ public void testPropertyGetName() {
+ Property property = testDO.getProperty("children");
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 Property.getType()
+ */
+ @Test
+ public void testPropertyGetType() {
+ Property property = testDO.getProperty("children");
- /**
- * Verify isMany==false, isReadOnly==false, isCtonainment==false,
- * getContainingType, getAliasNames, getOpposite
- */
+ assertEquals("Property.getType() returned an unexpected value.", property.getType(), testDO.getType());
+ }
- assertEquals("Property.getName() returned an unexpected value.", property.getName(), "booleanVal");
+ /**
+ * Verify Property.isMany()==true
+ */
+ @Test
+ public void testPropertyIsManyTrue() {
+ Property property = testDO.getProperty("children");
+ assertTrue("Property.isMany() returned an unexpected value.", property.isMany());
+ }
+ /**
+ * Verify Property.isMany()==false
+ */
+ @Test
+ public void testPropertyIsManyFalse() {
+ Property property = testDO.getProperty("booleanVal");
assertFalse("Property.isMany() returned an unexpected value.", property.isMany());
+ }
- assertFalse("Property.isReadOnly() returned an unexpected value.", property.isReadOnly());
+ /**
+ * Verify Property.isContainment()==true
+ */
+ @Test
+ public void testPropertyIsContainmentTrue() {
+ Property property = testDO.getProperty("children");
+ assertTrue("Property.isContainment() returned an unexpected value.", property.isContainment());
+ }
+ /**
+ * Verify Property.isContainment()==false
+ */
+ @Test
+ public void testPropertyIsContainmentFalse() {
+ Property property = testDO.getProperty("booleanVal");
assertFalse("Property.isContainment() returned an unexpected value.", property.isContainment());
+ }
+
+ /**
+ * Verify Property.isReadOnly()==true
+ */
+ @Test
+ public void testPropertyIsReadOnlyTrue() {
+ fail(TestHelper.INCOMPLETE_TEST_CASE_FAILURE);
+ }
+
+ /**
+ * Verify Property.isReadOnly()==false
+ */
+ @Test
+ public void testPropertyIsReadOnlyFalse() {
+ Property property = testDO.getProperty("booleanVal");
+ assertFalse("Property.isReadOnly() returned an unexpected value.", property.isReadOnly());
+ }
+
+ /**
+ * Verify Property.getContainingType
+ */
+ @Test
+ public void testPropertyGetContainingType() {
+ Property property = testDO.getProperty("booleanVal");
assertEquals("Property.getContainingType() returned an unexpected value.", property.getContainingType(), testDO
.getType());
+ }
- assertEquals("Property.getAliasNames() returned a List of unexpected size.", property.getAliasNames().size(), 0);
+ /**
+ * Verify Property.getAliasNames() == empty List
+ */
+ @Test
+ public void testPropertyGetAliasNamesEmpty() {
+ Property property = testDO.getProperty("booleanVal");
+ assertEquals("Property.getAliasNames() returned a List of unexpected size.", 0, property.getAliasNames().size());
+ }
+
+ /**
+ * Verify Property.getAliasNames() == populated List
+ */
+ @Ignore("Awaiting implementation of SDOUtil.addAliasName")
+ @Test
+ public void testPropertyGetAliasNames() {
+ List aliasNames = testDO.getProperty("decimalVal2").getAliasNames();
+ assertEquals("Property.getAliasNames() returned a List of unexpected size.", 1, aliasNames.size());
+
+ String alias = (String)aliasNames.get(0);
+ assertEquals("Property.getAliasNames() returned a List with unexpected contents.", "Dec2", alias);
+ }
- // 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));
- */
+ /**
+ * Verify Property.getOpposite() == null
+ */
+ @Test
+ public void testPropertyGetOppositeNull() {
+ Property property = testDO.getProperty("booleanVal");
assertNull("Property.getOpposite() did not return null as expected.", property.getOpposite());
+ }
+
+ /**
+ * Verify Property.getOpposite() != null
+ */
+ @Test
+ public void testPropertyGetOpposite() {
+ fail(TestHelper.INCOMPLETE_TEST_CASE_FAILURE);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org