summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany
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-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany
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-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany')
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java129
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java81
-rwxr-xr-xbranches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java163
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java72
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessorTestCase.java102
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyBean.java158
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterface.java29
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterfaceImpl.java67
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/POJOTestCase.java219
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java78
-rw-r--r--branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java64
11 files changed, 1162 insertions, 0 deletions
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java
new file mode 100644
index 0000000000..b121e2c99f
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java
@@ -0,0 +1,129 @@
+/*
+ * 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.jaxb;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+import com.example.ipo.jaxb.USAddress;
+import com.example.ipo.jaxb.USState;
+
+/**
+ *
+ */
+public class JAXBDataBindingTestCase extends TestCase {
+ private JAXBDataBinding binding;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ binding = new JAXBDataBinding();
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding#introspect(java.lang.Class, Annotation)}.
+ */
+ public final void testIntrospect() {
+ DataType dataType = new DataTypeImpl<Class>(JAXBElement.class, null);
+ boolean yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertTrue(dataType.getDataBinding().equals(binding.getName()));
+ assertTrue(dataType.getPhysical() == JAXBElement.class && dataType.getLogical() == XMLType.UNKNOWN);
+ dataType = new DataTypeImpl<Class>(MockJAXBElement.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(MockJAXBElement.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ dataType = new DataTypeImpl<Class>(USAddress.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(USAddress.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "USAddress"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ dataType = new DataTypeImpl<Class>(USState.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertTrue(dataType.getDataBinding().equals(binding.getName()));
+ assertEquals(USState.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "USState"), ((XMLType)dataType.getLogical()).getTypeName());
+
+ }
+
+ private static class MockJAXBElement extends JAXBElement<PurchaseOrderType> {
+
+ private static final long serialVersionUID = -2767569071002707973L;
+
+ /**
+ * @param elementName
+ * @param type
+ * @param value
+ */
+ public MockJAXBElement(QName elementName, Class<PurchaseOrderType> type, PurchaseOrderType value) {
+ super(elementName, type, value);
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopy() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType poType = factory.createPurchaseOrderType();
+ JAXBElement<PurchaseOrderType> po = factory.createPurchaseOrder(poType);
+ JAXBElement<PurchaseOrderType> copy = (JAXBElement<PurchaseOrderType>)binding.copy(po);
+ assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getName());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopyNonElement() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType poType = factory.createPurchaseOrderType();
+ poType.setComment("Comment");
+ PurchaseOrderType copy = (PurchaseOrderType)binding.copy(poType);
+ assertTrue(copy instanceof PurchaseOrderType);
+ assertEquals("Comment", (copy).getComment());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopyNonRoot() {
+ ObjectFactory factory = new ObjectFactory();
+ USAddress address = factory.createUSAddress();
+ address.setCity("San Jose");
+ USAddress copy = (USAddress)binding.copy(address);
+ assertTrue(copy instanceof USAddress);
+ assertEquals("San Jose", (copy).getCity());
+
+ }
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java
new file mode 100644
index 0000000000..9cf40ee9a6
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java
@@ -0,0 +1,81 @@
+/*
+ * 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.jaxb;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.databinding.jaxb.fault.InvalidSymbolFault;
+import org.apache.tuscany.databinding.jaxb.fault.InvalidSymbolFault_Exception;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBExceptionHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Test case for JAXBExceptionHandler
+ */
+public class JAXBExceptionHandlerTestCase extends TestCase {
+ private static final QName ELEMENT = new QName("http://www.example.com/stock", "InvalidSymbolFault");
+ private JAXBExceptionHandler handler;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new JAXBExceptionHandler();
+ }
+
+ public void testGetFaultType() {
+ DataType exType = new DataTypeImpl<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> dataType = handler.getFaultType(exType);
+ assertEquals(InvalidSymbolFault.class, dataType.getPhysical());
+ assertEquals(ELEMENT, ((XMLType) dataType.getLogical()).getElementName());
+ assertEquals(JAXBDataBinding.NAME, dataType.getDataBinding());
+ }
+
+ public void testCreate() {
+ DataType execType = new DataTypeImpl<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> faultType = handler.getFaultType(execType);
+ InvalidSymbolFault fault = new InvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ DataType<DataType> exType = new DataTypeImpl<DataType>(InvalidSymbolFault_Exception.class, faultType);
+ Exception ex = handler.createException(exType, "Invalid symbol", fault, null);
+ assertTrue(ex instanceof InvalidSymbolFault_Exception);
+ InvalidSymbolFault_Exception exception = (InvalidSymbolFault_Exception)ex;
+ assertEquals("Invalid symbol", exception.getMessage());
+ assertSame(fault, exception.getFaultInfo());
+ }
+
+ public void testGetFaultInfo() {
+ InvalidSymbolFault fault = new InvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ InvalidSymbolFault_Exception exception = new InvalidSymbolFault_Exception("Invalid symbol", fault);
+ Object faultInfo = handler.getFaultInfo(exception);
+ assertSame(fault, faultInfo);
+ }
+
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java
new file mode 100755
index 0000000000..512e1c625f
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java
@@ -0,0 +1,163 @@
+/*
+ * 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.jaxb;
+
+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.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;
+import org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;
+import org.apache.tuscany.sca.databinding.jaxb.Reader2JAXB;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Node;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+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>";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ Reader2JAXB t0 = new Reader2JAXB();
+
+ DataType targetDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ Object object1 = t0.transform(new StringReader(IPO_XML), tContext);
+
+ DataType sourceDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ expect(tContext1.getTargetDataType()).andReturn(null).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ Node node = t1.transform(object1, tContext1);
+
+ Assert.assertNotNull(node);
+
+ Node2JAXB t2 = new Node2JAXB();
+ Object object2 = t2.transform(node, tContext);
+ Assert.assertNotNull(object2);
+
+ }
+
+ public void testTransform2() throws Exception {
+ Reader2JAXB t0 = new Reader2JAXB();
+
+ QName root = new QName("http://www.example.com/IPO", "purchaseOrder");
+ DataType targetDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(root, null));
+ // targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ Object object1 = t0.transform(new StringReader(IPO_XML), tContext);
+
+ DataType sourceDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(root, null));
+ // sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ expect(tContext1.getTargetDataType()).andReturn(null).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ Node node = t1.transform(object1, tContext1);
+
+ Assert.assertNotNull(node);
+
+ Node2JAXB t2 = new Node2JAXB();
+ Object object2 = t2.transform(node, tContext);
+ Assert.assertNotNull(object2);
+
+ }
+
+ public void testTransform3() throws Exception {
+
+ DataType sourceDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ expect(tContext1.getTargetDataType()).andReturn(null).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ PurchaseOrderType po = new ObjectFactory().createPurchaseOrderType();
+ Node node = t1.transform(po, tContext1);
+
+ Assert.assertNotNull(node);
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java
new file mode 100644
index 0000000000..563d6232b1
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java
@@ -0,0 +1,72 @@
+/*
+ * 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.jaxb;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.jaxb.JAXBWrapperHandler;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+/**
+ * Test case for JAXBExceptionHandler
+ */
+public class JAXBWrapperHandlerTestCase extends TestCase {
+ // private static final QName ELEMENT = new QName("http://www.example.com/IPO", "purchaseOrder");
+ private JAXBWrapperHandler handler;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new JAXBWrapperHandler();
+ }
+
+ public void testCreate() {
+ // ElementInfo element = new ElementInfo(ELEMENT, null);
+ // JAXBElement<?> jaxbElement = handler.create(element, null);
+ }
+
+ public void testSetChild() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType po = factory.createPurchaseOrderType();
+ JAXBElement<PurchaseOrderType> wrapper = factory.createPurchaseOrder(po);
+ handler.setChild(wrapper, 2, null, "Comment");
+ }
+
+ public void testGetChildren() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType po = factory.createPurchaseOrderType();
+ po.setComment("Comment");
+ JAXBElement<PurchaseOrderType> wrapper = factory.createPurchaseOrder(po);
+ List children = handler.getChildren(wrapper, null, null);
+ assertNotNull(children);
+ assertEquals(4, children.size());
+ assertEquals("Comment", children.get(2));
+ assertNull(children.get(0));
+ }
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessorTestCase.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessorTestCase.java
new file mode 100644
index 0000000000..83abdc29f5
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXWSJavaInterfaceProcessorTestCase.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.
+ */
+
+package org.apache.tuscany.databinding.jaxb;
+
+import javax.jws.WebService;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.jaxb.JAXWSJavaInterfaceProcessor;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+
+/**
+ *
+ */
+public class JAXWSJavaInterfaceProcessorTestCase extends TestCase {
+ private JAXWSJavaInterfaceProcessor interfaceProcessor;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ interfaceProcessor = new JAXWSJavaInterfaceProcessor();
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.tuscany.sca.databinding.jaxb.JAXWSJavaInterfaceProcessor#visitInterface(JavaInterface)}.
+ */
+ public final void testProcessor() throws Exception {
+ JavaInterface contract = new MockJavaInterfaceImpl();
+ contract.setJavaClass(WebServiceInterfaceWithoutAnnotation.class);
+
+ interfaceProcessor.visitInterface(contract);
+ assertFalse(contract.isRemotable());
+
+ contract.setJavaClass(WebServiceInterfaceWithAnnotation.class);
+ interfaceProcessor.visitInterface(contract);
+ assertTrue(contract.isRemotable());
+ }
+
+ @WebService
+ private static interface WebServiceInterfaceWithAnnotation {
+
+ }
+
+ private static interface WebServiceInterfaceWithoutAnnotation {
+
+ }
+
+ private class MockJavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
+ private Class<?> javaClass;
+
+ public Class<?> getCallbackClass() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Class<?> getJavaClass() {
+ // TODO Auto-generated method stub
+ return javaClass;
+ }
+
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setCallbackClass(Class<?> callbackClass) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+ public void setName(String className) {
+ // TODO Auto-generated method stub
+
+ }
+ }
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyBean.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyBean.java
new file mode 100644
index 0000000000..49fb38b1fa
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyBean.java
@@ -0,0 +1,158 @@
+/*
+ * 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.jaxb;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MyBean {
+ private int age;
+ private String name;
+ private float[] rates = new float[] {1.0f, 2.0f};
+ private List<String> notes = new ArrayList<String>();
+ private Map<String, Integer> map = new HashMap<String, Integer>();
+ private Object service;
+ private Object otherService;
+ private boolean good;
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<String> getNotes() {
+ return notes;
+ }
+
+ public void setNotes(List<String> notes) {
+ this.notes = notes;
+ }
+
+ public float[] getRates() {
+ return rates;
+ }
+
+ public void setRates(float[] rates) {
+ this.rates = rates;
+ }
+
+ public Map<String, Integer> getMap() {
+ return map;
+ }
+
+ public void setMap(Map<String, Integer> map) {
+ this.map = map;
+ }
+
+ public Object getService() {
+ return service;
+ }
+
+ public void setService(Object service) {
+ this.service = service;
+ }
+
+ public Object getOtherService() {
+ return otherService;
+ }
+
+ public void setOtherService(Object otherService) {
+ this.otherService = otherService;
+ }
+
+ public boolean isGood() {
+ return good;
+ }
+
+ public void setGood(boolean good) {
+ this.good = good;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + age;
+ result = prime * result + (good ? 1231 : 1237);
+ result = prime * result + ((map == null) ? 0 : map.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((notes == null) ? 0 : notes.hashCode());
+ result = prime * result + ((otherService == null) ? 0 : otherService.hashCode());
+ result = prime * result + Arrays.hashCode(rates);
+ result = prime * result + ((service == null) ? 0 : service.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MyBean other = (MyBean)obj;
+ if (age != other.age)
+ return false;
+ if (good != other.good)
+ return false;
+ if (map == null) {
+ if (other.map != null)
+ return false;
+ } else if (!map.equals(other.map))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (notes == null) {
+ if (other.notes != null)
+ return false;
+ } else if (!notes.equals(other.notes))
+ return false;
+ if (otherService == null) {
+ if (other.otherService != null)
+ return false;
+ } else if (!otherService.equals(other.otherService))
+ return false;
+ if (!Arrays.equals(rates, other.rates))
+ return false;
+ if (service == null) {
+ if (other.service != null)
+ return false;
+ } else if (!service.equals(other.service))
+ return false;
+ return true;
+ }
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterface.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterface.java
new file mode 100644
index 0000000000..2fc561b577
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterface.java
@@ -0,0 +1,29 @@
+/*
+ * 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.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface MyInterface {
+ public void setId(String id);
+
+ public String getId();
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterfaceImpl.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterfaceImpl.java
new file mode 100644
index 0000000000..928acb9f3c
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterfaceImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MyInterfaceImpl implements MyInterface {
+ private String id;
+
+ /**
+ * @see org.apache.tuscany.databinding.jaxb.MyInterface#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.jaxb.MyInterface#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MyInterfaceImpl other = (MyInterfaceImpl)obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/POJOTestCase.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/POJOTestCase.java
new file mode 100644
index 0000000000..9758292aea
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/POJOTestCase.java
@@ -0,0 +1,219 @@
+/*
+ * 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.jaxb;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.databinding.jaxb.JAXB2XMLStreamReader;
+
+import com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader;
+import com.sun.xml.bind.v2.model.core.Ref;
+import com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder;
+import com.sun.xml.bind.v2.model.runtime.RuntimeClassInfo;
+import com.sun.xml.bind.v2.model.runtime.RuntimePropertyInfo;
+import com.sun.xml.bind.v2.model.runtime.RuntimeTypeInfoSet;
+import com.sun.xml.bind.v2.runtime.IllegalAnnotationsException;
+import com.sun.xml.bind.v2.runtime.JAXBContextImpl;
+
+public class POJOTestCase extends TestCase {
+ public void testPOJO() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(MyBean.class, MyInterfaceImpl.class);
+ StringWriter writer = new StringWriter();
+ MyBean bean = new MyBean();
+ bean.setName("Test");
+ bean.setAge(20);
+ bean.getNotes().add("1");
+ bean.getNotes().add("2");
+ bean.getMap().put("1", 1);
+ MyInterface service = new MyInterfaceImpl();
+ service.setId("ID001");
+ bean.setService(service);
+ bean.setOtherService(service);
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, bean);
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof MyBean);
+ MyBean newBean = (MyBean)e2.getValue();
+ assertEquals(bean, newBean);
+ }
+
+ public void testXMLStreamReader() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(MyBean.class, MyInterfaceImpl.class);
+
+ MyBean bean = new MyBean();
+ bean.setName("Test");
+ bean.setAge(20);
+ bean.getNotes().add("1");
+ bean.getNotes().add("2");
+ bean.getMap().put("1", 1);
+ MyInterface service = new MyInterfaceImpl();
+ service.setId("ID001");
+ bean.setService(service);
+ bean.setOtherService(service);
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, bean);
+ TransformationContext tContext = new TransformationContextImpl();
+ XMLStreamReader reader = new JAXB2XMLStreamReader().transform(element, tContext);
+
+// XMLStreamReader2String t2 = new XMLStreamReader2String();
+// String xml = t2.transform(reader, null);
+ // System.out.println(xml);
+ Object result = context.createUnmarshaller().unmarshal(reader, MyBean.class);
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof MyBean);
+ MyBean newBean = (MyBean)e2.getValue();
+ // FIXME :To be implemented
+ // assertEquals(bean, newBean);
+ }
+
+ public void testString() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(String.class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, "ABC");
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertEquals("ABC", e2.getValue());
+ }
+
+ public void testNull() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(String.class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, null);
+ element.setNil(true);
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+ StreamSource source = new StreamSource(new StringReader(writer.toString()));
+ Object result = context.createUnmarshaller().unmarshal(source, String.class);
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertNull(e2.getValue());
+ }
+
+ public void testArray() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(String[].class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element =
+ new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, new String[] {"ABC", "123"});
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof String[]);
+ }
+
+ public void testByteArray() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(byte[].class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element =
+ new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, "ABC".getBytes());
+ context.createMarshaller().marshal(element, writer);
+ String xml = writer.toString();
+ assertTrue(xml.contains("QUJD"));
+ assertTrue(xml.contains("base64Binary"));
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(xml));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof byte[]);
+ }
+
+ public void testPrimitive() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(int.class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, 1);
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertEquals(1, e2.getValue());
+ }
+
+ /*
+ public void testException() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(IllegalArgumentException.class);
+ StringWriter writer = new StringWriter();
+ Exception e = new IllegalArgumentException("123");
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, e);
+ context.createMarshaller().marshal(element, writer);
+ System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof Exception);
+ }
+ */
+
+ private static RuntimeTypeInfoSet create(Class... classes) throws Exception {
+ IllegalAnnotationsException.Builder errorListener = new IllegalAnnotationsException.Builder();
+ RuntimeInlineAnnotationReader reader = new RuntimeInlineAnnotationReader();
+ JAXBContextImpl context =
+ new JAXBContextImpl(classes, null, Collections.<Class, Class> emptyMap(), null, false, reader, false, false);
+ RuntimeModelBuilder builder =
+ new RuntimeModelBuilder(context, reader, Collections.<Class, Class> emptyMap(), null);
+ builder.setErrorHandler(errorListener);
+ for (Class c : classes)
+ builder.getTypeInfo(new Ref<Type, Class>(c));
+
+ RuntimeTypeInfoSet r = builder.link();
+ errorListener.check();
+ return r;
+ }
+
+ public void testReflection() throws Exception {
+ MyBean bean = new MyBean();
+ RuntimeTypeInfoSet model = create(MyBean.class);
+ RuntimeClassInfo clsInfo = (RuntimeClassInfo)model.getTypeInfo(MyBean.class);
+ for (RuntimePropertyInfo p : clsInfo.getProperties()) {
+ // System.out.print(p.getName());
+ // System.out.println(" " + p.isCollection());
+ if (p.getName().equals("notes")) {
+ Collection c = (Collection)p.getAccessor().get(bean);
+ c.add("123");
+ }
+ }
+
+ }
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java
new file mode 100644
index 0000000000..fd21d72337
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java
@@ -0,0 +1,78 @@
+/*
+ * 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.jaxb.fault;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * <p>
+ * Java class for anonymous complex type.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {"message", "symbol"})
+@XmlRootElement(name = "InvalidSymbolFault")
+public class InvalidSymbolFault {
+
+ @XmlElement(required = true)
+ protected String message;
+ @XmlElement(required = true)
+ protected String symbol;
+
+ /**
+ * Gets the value of the message property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setMessage(String value) {
+ this.message = value;
+ }
+
+ /**
+ * Gets the value of the symbol property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getSymbol() {
+ return symbol;
+ }
+
+ /**
+ * Sets the value of the symbol property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setSymbol(String value) {
+ this.symbol = value;
+ }
+
+}
diff --git a/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java
new file mode 100644
index 0000000000..e78889aee0
--- /dev/null
+++ b/branches/sca-java-1.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java
@@ -0,0 +1,64 @@
+/*
+ * 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.jaxb.fault;
+
+import javax.xml.ws.WebFault;
+
+/**
+ * This class was generated by the JAXWS SI. JAX-WS RI 2.1-02/02/2007 09:55
+ * AM(vivekp)-FCS Generated source version: 2.1
+ */
+@WebFault(name = "InvalidSymbolFault", targetNamespace = "http://www.example.com/stock")
+public class InvalidSymbolFault_Exception extends Exception {
+ private static final long serialVersionUID = -4618497501663457633L;
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @param faultInfo
+ * @param message
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param faultInfo
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}