diff options
Diffstat (limited to 'sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor')
3 files changed, 158 insertions, 0 deletions
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> |