diff options
Diffstat (limited to 'sdo-java/trunk-cts/sdo2.1-tuscany')
8 files changed, 455 insertions, 0 deletions
diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/pom.xml b/sdo-java/trunk-cts/sdo2.1-tuscany/pom.xml new file mode 100644 index 0000000000..283d3fbdac --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/pom.xml @@ -0,0 +1,81 @@ +<?xml version="1.0"?><project> + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>tuscany-sdo-cts</artifactId> + <groupId>org.apache.tuscany</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + + <groupId>org.apache.tuscany.cts</groupId> + <artifactId>tuscany-sdo-cts-tuscany</artifactId> + <name>Tuscany SDO 2.1 CTS</name> + <version>1.0-SNAPSHOT</version> + + <properties> + <specVersion>2.1</specVersion> + </properties> + + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <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> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.1</version> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-api-r${specVersion}</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.tuscany.cts</groupId> + <artifactId>tuscany-sdo-cts-standard</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-impl</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>stax</groupId> + <artifactId>stax-api</artifactId> + <version>1.0.1</version> + <scope>provided</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.codehaus.woodstox</groupId> + <artifactId>wstx-asl</artifactId> + <version>3.2.0</version> + <scope>runtime</scope> + </dependency> + </dependencies> + +</project> diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/dataObjectFactory/package.html b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/dataObjectFactory/package.html new file mode 100644 index 0000000000..414d58e830 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/dataObjectFactory/package.html @@ -0,0 +1,5 @@ +<html> +<body> +Contains implementation of DataObject Factory from Tuscany. +</body> +</html> diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/TuscanyTestHelper.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/TuscanyTestHelper.java new file mode 100644 index 0000000000..24e29704ed --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/TuscanyTestHelper.java @@ -0,0 +1,148 @@ +/** + * + * 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.testHelper; + +import static org.junit.Assert.fail; + +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.util.Collection; +import java.util.List; +import java.util.logging.Logger; + +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sdo.util.SDOUtil; + +import test.sdo21.framework.DataObjectFactory; +import test.sdo21.framework.TestHelper; + +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.TypeHelper; + +/** + * Implementation of TestHelper for Tuscany. + */ +public class TuscanyTestHelper implements TestHelper { + + private static List staticArtifacts = null; + private static final Logger logger = Logger.getLogger(TuscanyTestHelper.class.getName()); + + public void init() { + } + + public DataObject createTypeDef(String uri, String name, boolean open, HelperContext helperContext) { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + + public DataObject createPropertyDef(DataObject typeDef, + String propertyName, + Type type, + boolean isMany, + boolean isContainment) { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + + public DataObject createPropertyDef(DataObject typeDef, + String propertyName, + String typeName, + boolean isMany, + boolean isContainment, + HelperContext helperContext) { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + + public String createUniqueName() { + return "name-" + System.currentTimeMillis() + "-" + ((int)(1000 * Math.random())); + } + + + + /** + * Create an empty data graph. + * + * @return the new data graph instance. + */ + public DataGraph createDataGraph() { + return SDOUtil.createDataGraph(); + } + + /** + * Create a new HelperContext, a new scope + * @return the new HelperContext instance. + */ + public HelperContext createHelperContext() { + return SDOUtil.createHelperContext(); + } + + + /** + * Create a new ObjectOutputStream + * + * @return the new ObjectOutputStream instance. + */ + public ObjectOutputStream createObjectOutputStream(OutputStream os, HelperContext helperContext) { + try { + return SDOUtil.createObjectOutputStream(os, helperContext); + } catch (java.io.IOException e) { + fail("IOException during createObjectOutputStream."); + return null; + } + } + + /** + * Create a new ObjectInputStream + * + * @return the new ObjectInputStream instance. + */ + public ObjectInputStream createObjectInputStream(InputStream is, HelperContext helperContext) { + try { + return SDOUtil.createObjectInputStream(is, helperContext); + } catch (java.io.IOException e) { + fail("IOException during createObjectOutputStream."); + return null; + } + } + + /** + * Serialize a DataObject using an XMLStreamHelper + */ + public void serializeViaXMLStreamHelper(TypeHelper typeHelper, DataObject dataObject, XMLStreamWriter serializer) { + try { + SDOUtil.createXMLStreamHelper(typeHelper).saveObject(dataObject, serializer); + } catch (javax.xml.stream.XMLStreamException e) { + fail("XMLStreamException during saveObject."); + } + } + + public DataObjectFactory createDataObjectFactory(String factory, HelperContext helperContext) { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + + public Collection getParamatizedDataObject() { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + +} diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/package.html b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/package.html new file mode 100644 index 0000000000..71f356ab14 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/package.html @@ -0,0 +1,5 @@ +<html> +<body> +Contains implementation of test helpers from Tuscany. +</body> +</html> diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/tests/sdo21/vendor/tuscany/api/TypeTest.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/tests/sdo21/vendor/tuscany/api/TypeTest.java new file mode 100644 index 0000000000..1558a6341e --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/tests/sdo21/vendor/tuscany/api/TypeTest.java @@ -0,0 +1,102 @@ +/*
+ * 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: 537885 $ $Date: 2007-05-14 16:39:47 +0100 (Mon, 14 May 2007) $
+ */
+package tests.sdo21.vendor.tuscany.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import test.sdo21.framework.CTSTestCase;
+import test.sdo21.tests.ConsistencyTestTemplate;
+import test.sdo21.tests.TestData.StandardDynamicFactory;
+import test.sdo21.tests.TestData.StandardFactory;
+import test.sdo21.tests.TestData.StandardXSDFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
+import test.sdo21.tests.api.CTSConsistencyBase;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+
+
+public abstract class TypeTest extends CTSConsistencyBase {
+ public TypeTest() {
+ }
+
+ public static class DynamicMetadata extends TypeTest {
+ public DynamicMetadata() {
+
+ }
+ public TestDataFactory createTestDataFactory() {
+
+ return new StandardDynamicFactory();
+ }
+ }
+
+ public static class XSDMetadata extends TypeTest {
+
+ public XSDMetadata() {
+ }
+
+ public TestDataFactory createTestDataFactory() {
+
+ return new StandardXSDFactory();
+ }
+ }
+
+
+ @Before
+ public void setUp () throws Exception {
+ super.setUp();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+ /**
+ * Verify the value returned by Type.getAliasNames() when there are alias
+ * names to return
+ */
+ @Ignore("typeGetAliasNames test case is suppressed until SDOUtil.addAliasName is implemented.")
+ @Test
+ public void typeGetAliasNames() {
+ Type sequencedType = testDO.getInstanceProperty("sequencedElem").getType();
+ List aliases = sequencedType.getAliasNames();
+
+ assertEquals("The List returned by Type.getAliasNames was not of the expected size.", 1, aliases.size());
+
+ String aliasName = (String)aliases.get(1);
+ assertEquals("The alias returned by Type.getAliasNames was not the expected name.", "Seq2", aliasName);
+ }
+
+}
diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java new file mode 100644 index 0000000000..52f4f783e9 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java @@ -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 { + + +} diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java new file mode 100644 index 0000000000..ea98f5f37f --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java @@ -0,0 +1,36 @@ +/* + * 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, + test.sdo21.vendor.tuscany.tests.TuscanyOptionalTestSuite.class}) +public class OptionalCtsTestSuite { + +} diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/TuscanyOptionalTestSuite.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/TuscanyOptionalTestSuite.java new file mode 100644 index 0000000000..0704643b4c --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/TuscanyOptionalTestSuite.java @@ -0,0 +1,36 @@ +/*
+ * 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( {tests.sdo21.vendor.tuscany.api.TypeTest.DynamicMetadata.class,
+ tests.sdo21.vendor.tuscany.api.TypeTest.XSDMetadata.class})
+public class TuscanyOptionalTestSuite {
+
+}
|