summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /branches/sca-java-M2/sca/services/databinding/databinding-test/src/test
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-M2/sca/services/databinding/databinding-test/src/test')
-rwxr-xr-xbranches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.java119
-rwxr-xr-xbranches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java250
-rwxr-xr-xbranches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java110
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/Client.java26
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.java50
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTest.java115
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/Echo.java42
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.java43
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/sca/default.scdl34
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.axiom.scdl52
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.jaxb.scdl43
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.sdo.scdl58
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.xmlbeans.scdl43
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/interface.wsdl.scdl44
-rw-r--r--branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/test-extensions.scdl30
-rwxr-xr-xbranches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xml51
-rwxr-xr-xbranches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xsd136
-rwxr-xr-xbranches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xsdconfig21
18 files changed, 1267 insertions, 0 deletions
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.java b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.java
new file mode 100755
index 0000000000..894bee16e4
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/JAXBTestCase.java
@@ -0,0 +1,119 @@
+/*
+ * 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 org.apache.tuscany.databinding;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.databinding.jaxb.JAXB2Node;
+import org.apache.tuscany.databinding.jaxb.JAXBContextHelper;
+import org.apache.tuscany.databinding.jaxb.XMLStreamReader2JAXB;
+import org.apache.tuscany.databinding.xmlbeans.Node2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2XMLStreamReader;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+public class JAXBTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private String contextPath = "com.example.ipo.jaxb";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ // URL/Stream/Reader to XmlObject
+ XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
+
+ // XmlObject to XMLStreamReader
+ XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(object, null);
+
+ DataType targetDataType = new DataType<Class>(Object.class, null);
+ targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ // XMLStreamReader to JAXB
+ XMLStreamReader2JAXB t2 = new XMLStreamReader2JAXB();
+ Object object2 = t2.transform(reader, tContext);
+
+ DataType sourceDataType = new DataType<Class>(Object.class, null);
+ sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t3 = new JAXB2Node();
+ Node node = t3.transform(object2, tContext1);
+
+ Node2XmlObject t4 = new Node2XmlObject();
+ XmlObject object3 = t4.transform(node, null);
+
+ Assert.assertNotNull(object3);
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java
new file mode 100755
index 0000000000..a181c80b87
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java
@@ -0,0 +1,250 @@
+/*
+ * 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 org.apache.tuscany.databinding;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.io.StringReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.databinding.impl.TransformerRegistryImpl;
+import org.apache.tuscany.core.databinding.xml.Node2String;
+import org.apache.tuscany.core.databinding.xml.String2Node;
+import org.apache.tuscany.core.databinding.xml.String2XMLStreamReader;
+import org.apache.tuscany.core.databinding.xml.XMLStreamReader2String;
+import org.apache.tuscany.databinding.axiom.OMElement2String;
+import org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader;
+import org.apache.tuscany.databinding.axiom.String2OMElement;
+import org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement;
+import org.apache.tuscany.databinding.jaxb.JAXB2Node;
+import org.apache.tuscany.databinding.jaxb.JAXBContextHelper;
+import org.apache.tuscany.databinding.jaxb.Node2JAXB;
+import org.apache.tuscany.databinding.jaxb.XMLStreamReader2JAXB;
+import org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader;
+import org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader;
+import org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject;
+import org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument;
+import org.apache.tuscany.databinding.sdo.ImportSDOLoader.SDOType;
+import org.apache.tuscany.databinding.xmlbeans.Node2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2Node;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2XMLStreamReader;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.tuscany.spi.databinding.PullTransformer;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.Transformer;
+import org.apache.tuscany.spi.databinding.TransformerRegistry;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+
+public class TransformationTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private TransformerRegistry registry;
+
+ private String contextPath = "com.example.ipo.jaxb";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new TransformerRegistryImpl();
+
+ List<Transformer> transformers = new ArrayList<Transformer>();
+
+ // Adding JAXB transformers
+ transformers.add(new JAXB2Node());
+ transformers.add(new Node2JAXB());
+ transformers.add(new XMLStreamReader2JAXB());
+
+ // Adding XMLBeans transformers
+ transformers.add(new XmlObject2Node());
+ transformers.add(new XmlObject2XMLStreamReader());
+ transformers.add(new Node2XmlObject());
+ transformers.add(new XMLStreamReader2XmlObject());
+
+ transformers.add(new DataObject2XMLStreamReader());
+ transformers.add(new XMLStreamReader2DataObject());
+
+ transformers.add(new XMLDocument2XMLStreamReader());
+ transformers.add(new XMLStreamReader2XMLDocument());
+
+ transformers.add(new String2XMLStreamReader());
+ transformers.add(new XMLStreamReader2String());
+
+ transformers.add(new String2Node());
+ transformers.add(new Node2String());
+
+ transformers.add(new OMElement2String());
+ transformers.add(new String2OMElement());
+
+ transformers.add(new XMLStreamReader2OMElement());
+ transformers.add(new OMElement2XMLStreamReader());
+
+ for (Transformer transformer : transformers) {
+ registry.registerTransformer(transformer);
+ }
+
+ // System.out.println(registry);
+
+ URL xsdFile = getClass().getClassLoader().getResource("ipo.xsd");
+ XSDHelper.INSTANCE.define(xsdFile.openStream(), null);
+ }
+
+ @SuppressWarnings("unchecked")
+ // XMLBeans --> SDO
+ public void testTransformation1() throws Exception {
+ URL xsdFile = getClass().getClassLoader().getResource("ipo.xsd");
+ TypeHelper typeHelper = SDOUtil.createTypeHelper();
+ XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
+ xsdHelper.define(xsdFile.openStream(), xsdFile.toExternalForm());
+
+ // URL/Stream/Reader to XmlObject
+ XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
+
+ List<Transformer> path =
+ registry.getTransformerChain(XmlObject.class.getName(), DataObject.class.getName());
+ System.out.println("Path: " + path);
+
+ TransformationContext tContext = createTransformationContext();
+ tContext.getMetadata().put(SDOType.class, new SDOType(typeHelper));
+
+ Object result = object;
+ for (Transformer transformer : path) {
+ result = ((PullTransformer)transformer).transform(result, tContext);
+ }
+ System.out.println("Result: " + result);
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result instanceof DataObject);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ // SDO --> DOM
+ public void testTransformation2() throws Exception {
+ // System.out.println(registry);
+
+ URL xmlFile = getClass().getClassLoader().getResource("ipo.xml");
+ // URL/Stream/Reader to XmlObject
+ XMLDocument object = XMLHelper.INSTANCE.load(xmlFile.openStream());
+
+ List<Transformer> path =
+ registry.getTransformerChain(XMLDocument.class.getName(), Node.class.getName());
+ System.out.println("Path: " + path);
+
+ TransformationContext tContext = createTransformationContext();
+
+ Object result = object;
+ for (Transformer transformer : path) {
+ result = ((PullTransformer)transformer).transform(result, tContext);
+ }
+ System.out.println("Result: " + result);
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result instanceof Node);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ // SDO --> JAXB
+ public void testTransformation3() throws Exception {
+ // System.out.println(registry);
+
+ URL xmlFile = getClass().getClassLoader().getResource("ipo.xml");
+ // URL/Stream/Reader to XmlObject
+ XMLDocument object = XMLHelper.INSTANCE.load(xmlFile.openStream());
+
+ List<Transformer> path =
+ registry.getTransformerChain(XMLDocument.class.getName(), JAXBElement.class.getName());
+ System.out.println("Path: " + path);
+
+ TransformationContext tContext = createTransformationContext();
+
+ Object result = object;
+ for (Transformer transformer : path) {
+ result = ((PullTransformer)transformer).transform(result, tContext);
+ }
+ System.out.println("Result: " + result);
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result instanceof Object);
+
+ }
+
+ private TransformationContext createTransformationContext() {
+ DataType dataType = new DataType<Class>(Object.class, null);
+ dataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(dataType).anyTimes();
+
+ expect(tContext.getSourceDataType()).andReturn(dataType).anyTimes();
+ Map<Class<?>, Object> metadata = new HashMap<Class<?>, Object>();
+ expect(tContext.getMetadata()).andReturn(metadata).anyTimes();
+ replay(tContext);
+ return tContext;
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java
new file mode 100755
index 0000000000..78d51352cb
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/XmlObjectTestCase.java
@@ -0,0 +1,110 @@
+/*
+ * 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 org.apache.tuscany.databinding;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.databinding.xmlbeans.Node2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2Node;
+import org.apache.tuscany.databinding.xmlbeans.XmlObject2XMLStreamReader;
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+public class XmlObjectTestCase extends TestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
+
+ // XmlObject to XMLStreamReader
+ XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(object, null);
+
+ // XMLStreamReader to XmlObject
+ XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
+ XmlObject object2 = t2.transform(reader, null);
+
+ // XmlObject to Node
+ XmlObject2Node t3 = new XmlObject2Node();
+ Node node = t3.transform(object2, null);
+
+ // Node to XmlObject
+ Node2XmlObject t4 = new Node2XmlObject();
+ XmlObject object3 = t4.transform(node, null);
+ Assert.assertNotNull(object3);
+ }
+
+ /*
+ * public void testGeneratedXmlObject() throws Exception { URL xmlFile =
+ * getClass().getClassLoader().getResource("ipo.xml"); // URL/Stream/Reader
+ * to XmlObject PurchaseOrderDocument object =
+ * PurchaseOrderDocument.Factory.parse(xmlFile); // XmlObject to
+ * XMLStreamReader XmlObject2XMLStreamReader t1 = new
+ * XmlObject2XMLStreamReader(); XMLStreamReader reader =
+ * t1.transform(object, null); // XMLStreamReader to XmlObject
+ * XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject(); XmlObject
+ * object2 = t2.transform(reader, null); // XmlObject to Node XmlObject2Node
+ * t3 = new XmlObject2Node(); Node node = t3.transform(object2, null); //
+ * Node to XmlObject Node2XmlObject t4 = new Node2XmlObject(); XmlObject
+ * object3 = t4.transform(node, null); Assert.assertNotNull(object3); }
+ */
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/Client.java b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/Client.java
new file mode 100644
index 0000000000..8ddc625d66
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/Client.java
@@ -0,0 +1,26 @@
+/*
+ * 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 org.apache.tuscany.databinding.sample;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Client {
+ void call(Object po);
+}
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.java b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.java
new file mode 100644
index 0000000000..2d33a8666b
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/ClientImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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 org.apache.tuscany.databinding.sample;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClientImpl implements Client {
+
+ private Echo echoReference;
+
+ @Constructor
+ public ClientImpl(@Reference(name = "echoReference", required = true)
+ Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public void call(Object po) {
+ Object ret = null;
+ if (po instanceof PurchaseOrderType) {
+ ret = echoReference.echoJAXB((PurchaseOrderType)po);
+ } else if (po instanceof com.example.ipo.sdo.PurchaseOrderType) {
+ ret = echoReference.echoSDO((com.example.ipo.sdo.PurchaseOrderType)po);
+ } else if (po instanceof com.example.ipo.xmlbeans.PurchaseOrderType) {
+ ret = echoReference.echoXMLBeans((com.example.ipo.xmlbeans.PurchaseOrderType)po);
+ }
+ System.out.println("Returned message: " + ret);
+ }
+}
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTest.java b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTest.java
new file mode 100644
index 0000000000..ff44dfb68d
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/DataBindingBootStrapTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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 org.apache.tuscany.databinding.sample;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.databinding.jaxb.JAXBContextHelper;
+import org.apache.tuscany.databinding.jaxb.Reader2JAXB;
+import org.apache.tuscany.databinding.sdo.String2DataObject;
+import org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+import com.example.ipo.xmlbeans.PurchaseOrderDocument;
+import commonj.sdo.DataObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataBindingBootStrapTest extends SCATestCase {
+ private static final String IPO_XML =
+ "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:ipo=\"http://www.example.com/IPO\""
+ + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
+ + " orderDate=\"1999-12-01\">"
+ + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
+ + " <name>Helen Zoe</name>"
+ + " <street>47 Eden Street</street>"
+ + " <city>Cambridge</city>"
+ + " <postcode>CB1 1JR</postcode>"
+ + " </shipTo>"
+ + " <billTo xsi:type=\"ipo:USAddress\">"
+ + " <name>Robert Smith</name>"
+ + " <street>8 Oak Avenue</street>"
+ + " <city>Old Town</city>"
+ + " <state>PA</state>"
+ + " <zip>95819</zip>"
+ + " </billTo>"
+ + " <items>"
+ + " <item partNum=\"833-AA\">"
+ + " <productName>Lapis necklace</productName>"
+ + " <quantity>1</quantity>"
+ + " <USPrice>99.95</USPrice>"
+ + " <ipo:comment>Want this for the holidays</ipo:comment>"
+ + " <shipDate>1999-12-05</shipDate>"
+ + " </item>"
+ + " </items>"
+ + "</ipo:purchaseOrder>";
+
+ private Client client;
+ private String contextPath = "com.example.ipo.jaxb";
+
+ @SuppressWarnings("unchecked")
+ public void testDataBindingBootstrap() throws Exception {
+ DataType targetDataType = new DataType<Class>(Object.class, null);
+ targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ String2DataObject t1 = new String2DataObject();
+ DataObject po1 = t1.transform(IPO_XML, null);
+ client.call(po1);
+
+ XMLStreamReader reader =
+ XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
+ PurchaseOrderDocument po2 = (PurchaseOrderDocument)t2.transform(reader, null);
+ client.call(po2.getPurchaseOrder());
+
+ Reader2JAXB t3 = new Reader2JAXB();
+ JAXBElement<PurchaseOrderType> po3 =
+ (JAXBElement<PurchaseOrderType>)t3.transform(new StringReader(IPO_XML), tContext);
+ client.call(po3.getValue());
+
+ }
+
+ protected void setUp() throws Exception {
+ setApplicationSCDL(getClass(), "META-INF/sca/default.scdl");
+ addExtension("test-extensions", getClass().getClassLoader()
+ .getResource("META-INF/tuscany/test-extensions.scdl"));
+ super.setUp();
+ CompositeContext context = CurrentCompositeContext.getContext();
+ client = context.locateService(Client.class, "Client");
+ }
+}
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/Echo.java b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/Echo.java
new file mode 100644
index 0000000000..c44e575e26
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/Echo.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.
+ */
+package org.apache.tuscany.databinding.sample;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+@Service
+public interface Echo {
+ @DataType(name="javax.xml.bind.JAXBElement")
+ PurchaseOrderType echoJAXB(PurchaseOrderType po);
+
+ @DataType(name="commonj.sdo.DataObject")
+ com.example.ipo.sdo.PurchaseOrderType echoSDO(com.example.ipo.sdo.PurchaseOrderType po);
+
+ @DataType(name="org.apache.xmlbeans.XmlObject")
+ com.example.ipo.xmlbeans.PurchaseOrderType echoXMLBeans(com.example.ipo.xmlbeans.PurchaseOrderType po);
+} \ No newline at end of file
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.java b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.java
new file mode 100644
index 0000000000..775c0317a4
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/sample/EchoImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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 org.apache.tuscany.databinding.sample;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoImpl implements Echo {
+
+ public PurchaseOrderType echoJAXB(PurchaseOrderType po) {
+ System.out.println("JAXB: " + po);
+ return po;
+ }
+
+ public com.example.ipo.sdo.PurchaseOrderType echoSDO(com.example.ipo.sdo.PurchaseOrderType po) {
+ System.out.println("SDO: " + po);
+ return po;
+ }
+
+ public com.example.ipo.xmlbeans.PurchaseOrderType echoXMLBeans(com.example.ipo.xmlbeans.PurchaseOrderType po) {
+ System.out.println("XMLBeans: " + po);
+ return po;
+ }
+
+}
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/sca/default.scdl b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..611acdb919
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/sca/default.scdl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:db="http://incubator.apache.org/tuscany/xmlns/databinding/1.0-incubator-M2"
+ name="org.apache.tuscany.databinding.sample">
+
+ <dbsdo:import.sdo xmlns:dbsdo="http://incubator.apache.org/tuscany/xmlns/databinding/sdo/1.0-incubator-M2" factory="com.example.ipo.sdo.SdoFactory"/>
+
+ <component name="Client">
+ <implementation.java class="org.apache.tuscany.databinding.sample.ClientImpl" />
+ <reference name="echoReference">Echo</reference>
+ </component>
+
+ <component name="Echo">
+ <implementation.java class="org.apache.tuscany.databinding.sample.EchoImpl" />
+ </component>
+
+</composite>
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.axiom.scdl b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.axiom.scdl
new file mode 100644
index 0000000000..a21da8c6e2
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.axiom.scdl
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
+ name="org.apache.tuscany.databinding.Axiom">
+
+ <component name="databinding.axiom">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.AxiomDataBinding" />
+ </component>
+
+ <!-- Transformers -->
+ <component name="transformer.XMLStreamReader2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.XMLStreamReader2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2XMLStreamReader" />
+ </component>
+
+ <component name="transformer.String2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.String2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2String" />
+ </component>
+
+ <component name="transformer.Object2OMElement">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.Object2OMElement" />
+ </component>
+
+ <component name="transformer.OMElement2Object">
+ <system:implementation.system class="org.apache.tuscany.databinding.axiom.OMElement2Object" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.jaxb.scdl b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.jaxb.scdl
new file mode 100644
index 0000000000..2b86e506eb
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.jaxb.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
+ name="org.apache.tuscany.databinding.JAXB">
+
+ <component name="databinding.jaxb">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.JAXBDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.XMLStreamReader2JAXB" />
+ </component>
+
+ <component name="transformer.Node2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.Node2JAXB" />
+ </component>
+
+ <component name="transformer.JAXB2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.JAXB2Node" />
+ </component>
+
+ <component name="transformer.Reader2JAXB">
+ <system:implementation.system class="org.apache.tuscany.databinding.jaxb.Reader2JAXB" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.sdo.scdl b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
new file mode 100644
index 0000000000..dabab7c687
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<!--
+ import.sdo configuration
+
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
+ name="org.apache.tuscany.databinding.sdo">
+
+ <!-- import.sdo element loader implementations -->
+ <component name="elementLoader.import.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
+
+</composite>
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.xmlbeans.scdl b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.xmlbeans.scdl
new file mode 100644
index 0000000000..55c7363cba
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/databinding.xmlbeans.scdl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
+ name="org.apache.tuscany.databinding.XMLBeans">
+
+ <component name="databinding.XMLBeans">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLBeansDataBinding" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject" />
+ </component>
+
+ <component name="transformer.Node2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.Node2XmlObject" />
+ </component>
+
+ <component name="transformer.XmlObject2Node">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XmlObject2Node" />
+ </component>
+
+ <component name="transformer.XMLStreamReader2XmlObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.xmlbeans.XMLStreamReader2XmlObject" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/interface.wsdl.scdl b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/interface.wsdl.scdl
new file mode 100644
index 0000000000..fe9a635747
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/interface.wsdl.scdl
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 440894 $ $Date: 2006-09-06 15:52:01 -0700 (Wed, 06 Sep 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
+ name="org.apache.tuscany.idl.WSDL">
+
+ <component name="interface.wsdl.Loader">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLLoader" />
+ </component>
+
+ <component name="wsdl.Registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistryImpl" initLevel="40" />
+ </component>
+
+ <component name="xmlSchema.registry">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.XMLSchemaRegistryImpl" initLevel="35" />
+ </component>
+
+ <component name="interface.wsdl.Introspector">
+ <system:implementation.system class="org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospectorImpl" initLevel="40" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/test-extensions.scdl b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/test-extensions.scdl
new file mode 100644
index 0000000000..193bd7a3f6
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/META-INF/tuscany/test-extensions.scdl
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://incubator.apache.org/tuscany/xmlns/system/1.0-incubator-M2"
+ name="test.extensions">
+
+ <include name="org.apache.tuscany.databinding.axiom" scdlLocation="databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlLocation="databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.databinding.jaxb" scdlLocation="databinding.jaxb.scdl"/>
+ <include name="org.apache.tuscany.databinding.xmlbeans" scdlLocation="databinding.xmlbeans.scdl"/>
+ <include name="org.apache.tuscany.interface.wsdl" scdlLocation="interface.wsdl.scdl"/>
+
+
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xml b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xml
new file mode 100755
index 0000000000..df901d183d
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+ * 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.
+-->
+<ipo:purchaseOrder
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ipo="http://www.example.com/IPO"
+ xsi:schemaLocation="http://www.example.com/IPO ipo.xsd"
+ orderDate="1999-12-01">
+
+ <shipTo exportCode="1" xsi:type="ipo:UKAddress">
+ <name>Helen Zoe</name>
+ <street>47 Eden Street</street>
+ <city>Cambridge</city>
+ <postcode>CB1 1JR</postcode>
+ </shipTo>
+
+ <billTo xsi:type="ipo:USAddress">
+ <name>Robert Smith</name>
+ <street>8 Oak Avenue</street>
+ <city>Old Town</city>
+ <state>PA</state>
+ <zip>95819</zip>
+ </billTo>
+
+ <items>
+ <item partNum="833-AA">
+ <productName>Lapis necklace</productName>
+ <quantity>1</quantity>
+ <USPrice>99.95</USPrice>
+ <ipo:comment>Want this for the holidays</ipo:comment>
+ <shipDate>1999-12-05</shipDate>
+ </item>
+ </items>
+</ipo:purchaseOrder>
+
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xsd b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..241ec15d36
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xsd
@@ -0,0 +1,136 @@
+<!--
+ * 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.
+-->
+<schema targetNamespace="http://www.example.com/IPO"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <annotation>
+ <documentation xml:lang="en">
+ International Purchase order schema for Example.com
+ Copyright 2000 Example.com. All rights reserved.
+ </documentation>
+ </annotation>
+
+
+ <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
+
+ <element name="comment" type="string" />
+
+ <complexType name="PurchaseOrderType">
+ <sequence>
+ <element name="shipTo" type="ipo:Address" />
+ <element name="billTo" type="ipo:Address" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="items" type="ipo:Items" />
+ </sequence>
+ <attribute name="orderDate" type="date" />
+ </complexType>
+
+ <complexType name="Items">
+ <sequence>
+ <element name="item" minOccurs="0" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element name="productName" type="string" />
+ <element name="quantity">
+ <simpleType>
+ <restriction base="positiveInteger">
+ <maxExclusive value="100" />
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="USPrice" type="decimal" />
+ <element ref="ipo:comment" minOccurs="0" />
+ <element name="shipDate" type="date"
+ minOccurs="0" />
+ </sequence>
+ <attribute name="partNum" type="ipo:SKU"
+ use="required" />
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <simpleType name="SKU">
+ <restriction base="string">
+ <pattern value="\d{3}-[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string" />
+ <element name="street" type="string" />
+ <element name="city" type="string" />
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="state" type="ipo:USState" />
+ <element name="zip" type="positiveInteger" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="ipo:Address">
+ <sequence>
+ <element name="postcode" type="ipo:UKPostcode" />
+ </sequence>
+ <attribute name="exportCode" type="positiveInteger"
+ fixed="1" />
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- other Address derivations for more countries -->
+
+ <simpleType name="USState">
+ <restriction base="string">
+ <enumeration value="AK" />
+ <enumeration value="AL" />
+ <enumeration value="AR" />
+ <enumeration value="CA" />
+ <enumeration value="PA" />
+ <!-- and so on ... -->
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Postcode">
+ <restriction base="string">
+ <length value="7" fixed="true" />
+ </restriction>
+ </simpleType>
+
+
+ <simpleType name="UKPostcode">
+ <restriction base="ipo:Postcode">
+ <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
+ </restriction>
+ </simpleType>
+
+
+
+</schema>
+
diff --git a/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xsdconfig b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xsdconfig
new file mode 100755
index 0000000000..a397182672
--- /dev/null
+++ b/branches/sca-java-M2/sca/services/databinding/databinding-test/src/test/resources/ipo.xsdconfig
@@ -0,0 +1,21 @@
+<!-- Copyright 2004 The Apache Software Foundation
+
+ Licensed 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. -->
+<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
+ xmlns:ipo="http://www.example.com/IPO">
+
+ <xb:namespace uri="http://www.example.com/IPO">
+ <xb:package>com.example.ipo.xmlbeans</xb:package>
+ </xb:namespace>
+
+</xb:config>