summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org')
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java27
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java40
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java40
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterface.java28
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterfaceImpl.java35
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGeneratorTestCase.java65
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessorTestCase.java89
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java121
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JavaReflectionHelperTestCase.java47
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyException.java62
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java52
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/StockQuote.java44
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestAdapter.java39
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestGenericClass.java40
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java70
-rw-r--r--sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGeneratorTestCase.java80
16 files changed, 879 insertions, 0 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java
new file mode 100644
index 0000000000..1b07e25bad
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java
@@ -0,0 +1,27 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Bean<T> {
+ T getP1();
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java
new file mode 100644
index 0000000000..d38a21ba52
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class Bean1 {
+ private String p1;
+ private int p2;
+ public String getP1() {
+ return p1;
+ }
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+ public int getP2() {
+ return p2;
+ }
+ public void setP2(int p2) {
+ this.p2 = p2;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java
new file mode 100644
index 0000000000..7b9375063d
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class Bean2 implements Bean<String>{
+ private String p1;
+ private int p2;
+ public String getP1() {
+ return p1;
+ }
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+ public int getP2() {
+ return p2;
+ }
+ public void setP2(int p2) {
+ this.p2 = p2;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterface.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterface.java
new file mode 100644
index 0000000000..67b9c84399
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterface.java
@@ -0,0 +1,28 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+/**
+ * Bean Interface
+ */
+public interface BeanInterface {
+ String getAttr();
+ void setAttr(String attr);
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterfaceImpl.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterfaceImpl.java
new file mode 100644
index 0000000000..f964ea374b
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterfaceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.interfacedef.java.jaxws;
+
+/**
+ * Impl of BeanInterface
+ */
+public class BeanInterfaceImpl implements BeanInterface {
+ private String attr;
+
+ public String getAttr() {
+ return attr;
+ }
+
+ public void setAttr(String attr) {
+ this.attr = attr;
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGeneratorTestCase.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGeneratorTestCase.java
new file mode 100644
index 0000000000..3ea1427494
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGeneratorTestCase.java
@@ -0,0 +1,65 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.annotation.Annotation;
+
+import javax.xml.bind.JAXBContext;
+
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
+import org.junit.Assert;
+import org.junit.Test;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.util.CheckClassAdapter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FaultBeanGeneratorTestCase {
+
+ @Test
+ public void testGenerate() throws IOException {
+ byte[] content = new FaultBeanGenerator().generate(MyException.class);
+ ClassReader cr = new ClassReader(content);
+ PrintWriter pw = new PrintWriter(System.out);
+ CheckClassAdapter.verify(cr, false, pw);
+ }
+
+ @Test
+ public void testGenerateClass() throws Exception {
+ Class<?> cls = FaultBeanGenerator.generateFaultBeanClass(MyException.class);
+ Assert.assertEquals("org.apache.tuscany.sca.interfacedef.java.jaxws.jaxws.MyExceptionBean", cls.getName());
+ for (Annotation a : cls.getAnnotations()) {
+ System.out.println(a);
+ }
+ // XmlType xmlType = cls.getAnnotation(XmlType.class);
+ // System.out.println(xmlType);
+ Object bean = cls.newInstance();
+ JAXBContext context = new JAXBContextHelper(new DefaultExtensionPointRegistry()).createJAXBContext(cls);
+ StringWriter sw = new StringWriter();
+ context.createMarshaller().marshal(bean, sw);
+ System.out.println(sw.toString());
+
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessorTestCase.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessorTestCase.java
new file mode 100644
index 0000000000..c53521db00
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSAsyncInterfaceProcessorTestCase.java
@@ -0,0 +1,89 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.example.stock.async.StockExceptionTest;
+
+public class JAXWSAsyncInterfaceProcessorTestCase {
+ private ExtensionPointRegistry registry;
+
+ @Before
+ public void setUp() throws Exception {
+ registry = new DefaultExtensionPointRegistry();
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSAsyncInterfaceProcessor#visitInterface(JavaInterface)}.
+ */
+ @Test
+ public final void testProcessor() throws Exception {
+ DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory(registry);
+ JavaInterface contract = iFactory.createJavaInterface(StockQuote.class);
+
+ assertTrue(contract.isRemotable());
+
+ Assert.assertEquals(1,contract.getOperations().size());
+
+ List<Operation> asyncOperations = (List<Operation>) contract.getAttributes().get("JAXWS-ASYNC-OPERATIONS");
+ Assert.assertEquals(2,asyncOperations.size());
+
+ //list operation
+ System.out.println(">>> Filtered Operations");
+ for(Operation o : contract.getOperations()) {
+ System.out.println(">>>>>>" + o);
+ }
+
+ }
+
+ @Test
+ public final void testProcessorGenerated() throws Exception {
+ DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory(registry);
+ JavaInterface contract = iFactory.createJavaInterface(StockExceptionTest.class);
+
+ assertTrue(contract.isRemotable());
+
+ Assert.assertEquals(1,contract.getOperations().size());
+
+ List<Operation> asyncOperations = (List<Operation>) contract.getAttributes().get("JAXWS-ASYNC-OPERATIONS");
+ Assert.assertEquals(2,asyncOperations.size());
+
+ //list operation
+ System.out.println(">>> Filtered Operations");
+ for(Operation o : contract.getOperations()) {
+ System.out.println(">>>>>>" + o);
+ }
+
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
new file mode 100644
index 0000000000..5f3114a67c
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
@@ -0,0 +1,121 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.example.stock.StockExceptionTest;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class JAXWSJavaInterfaceProcessorTestCase {
+ private ExtensionPointRegistry registry;
+ // private JAXWSJavaInterfaceProcessor interfaceProcessor;
+
+ @Before
+ public void setUp() throws Exception {
+ registry = new DefaultExtensionPointRegistry();
+// DataBindingExtensionPoint db = new DefaultDataBindingExtensionPoint(registry);
+// XMLAdapterExtensionPoint xa = new DefaultXMLAdapterExtensionPoint();
+ // interfaceProcessor = new JAXWSJavaInterfaceProcessor(db, new JAXWSFaultExceptionMapper(db, xa), xa);
+ }
+
+ @Test
+ public void testWrapper() throws Exception {
+ DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory(registry);
+ JavaInterface contract = iFactory.createJavaInterface(StockExceptionTest.class);
+
+ // interfaceProcessor.visitInterface(contract);
+ Operation op = contract.getOperations().get(0);
+ Assert.assertTrue(!op.isWrapperStyle());
+ Assert.assertEquals(new QName("http://www.example.com/stock", "stockQuoteOffer"), op.getWrapper().getInputWrapperElement().getQName());
+ Assert.assertEquals(new QName("http://www.example.com/stock", "stockQuoteOfferResponse"), op.getWrapper().getOutputWrapperElement().getQName());
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor#visitInterface(JavaInterface)}.
+ */
+ @Test
+ public final void testProcessor() throws Exception {
+ DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory(registry);
+ JavaInterface contract = iFactory.createJavaInterface(WebServiceInterfaceWithoutAnnotation.class);
+
+ // interfaceProcessor.visitInterface(contract);
+ assertFalse(contract.isRemotable());
+
+ contract = iFactory.createJavaInterface(WebServiceInterfaceWithAnnotation.class);
+ // interfaceProcessor.visitInterface(contract);
+ assertTrue(contract.isRemotable());
+
+ Operation op1 = contract.getOperations().get(0);
+ Operation op2 = contract.getOperations().get(1);
+
+ Operation op = null;
+ if ("m1".equals(op1.getName())) {
+ op = op1;
+ } else {
+ op = op2;
+ }
+
+ assertTrue(!op.isWrapperStyle() && op.getWrapper() == null);
+
+ if ("M2".equals(op2.getName())) {
+ op = op2;
+ } else {
+ op = op1;
+ }
+ assertTrue(!op.isWrapperStyle() && op.getWrapper() != null);
+
+ }
+
+ @WebService
+ private static interface WebServiceInterfaceWithAnnotation {
+
+ @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+ @WebMethod(operationName = "m1")
+ String m1(String str);
+
+ @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+ @WebMethod(operationName = "M2")
+ String m2(String str, int i);
+ }
+
+ private static interface WebServiceInterfaceWithoutAnnotation {
+
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JavaReflectionHelperTestCase.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JavaReflectionHelperTestCase.java
new file mode 100644
index 0000000000..6315e12ff8
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JavaReflectionHelperTestCase.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import java.lang.reflect.Field;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaReflectionHelperTestCase {
+ @Test
+ public void testErasure() throws Exception {
+ for (Field f : TestGenericClass.class.getDeclaredFields()) {
+ Class<?> cls = CodeGenerationHelper.getErasure(f.getGenericType());
+ System.out.println(cls.getName());
+ Assert.assertSame(f.getType(), cls);
+ }
+ }
+
+ @Test
+ public void testSignature() throws Exception {
+ for (Field f : TestGenericClass.class.getDeclaredFields()) {
+ String sig = CodeGenerationHelper.getSignature(f.getGenericType());
+ System.out.println(sig);
+ }
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyException.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyException.java
new file mode 100644
index 0000000000..4df0517de6
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyException.java
@@ -0,0 +1,62 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class MyException extends Exception {
+ private String error;
+ private int code;
+
+ public MyException() {
+ super();
+ }
+
+ public MyException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public MyException(String message) {
+ super(message);
+ }
+
+ public MyException(Throwable cause) {
+ super(cause);
+ }
+
+ public String getError() {
+ return error;
+ }
+
+ public void setError(String error) {
+ this.error = error;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int code) {
+ this.code = code;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java
new file mode 100644
index 0000000000..78527193d5
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import java.util.List;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@WebService
+public class MyServiceImpl {
+
+ public MyServiceImpl() {
+ super();
+ }
+
+ @WebMethod
+ public <T extends Bean1> T getBean(T b, Bean2 b2) {
+ return null;
+ }
+
+ @WebMethod
+ public List<? extends Bean1> getBeans() {
+ return null;
+ }
+
+ @WebMethod
+ public String convert(String str, int i) throws MyException {
+ return "ME";
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/StockQuote.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/StockQuote.java
new file mode 100644
index 0000000000..d1259e9120
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/StockQuote.java
@@ -0,0 +1,44 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+/**
+ * JAX-WS Async style interface
+ *
+ * @version $Rev$ $Date$
+ */
+
+@WebService
+public interface StockQuote {
+
+ float getPrice(String ticker);
+
+ Response<Float> getPriceAsync(String ticker);
+
+ Future<?> getPriceAsync(String ticker, AsyncHandler<Float> callback);
+
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestAdapter.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestAdapter.java
new file mode 100644
index 0000000000..fb319a3b0f
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestAdapter.java
@@ -0,0 +1,39 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * Test XML Adapter
+ */
+public class TestAdapter extends XmlAdapter<BeanInterfaceImpl, BeanInterface> {
+
+ @Override
+ public BeanInterfaceImpl marshal(BeanInterface v) throws Exception {
+ return (BeanInterfaceImpl)v;
+ }
+
+ @Override
+ public BeanInterface unmarshal(BeanInterfaceImpl v) throws Exception {
+ return v;
+ }
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestGenericClass.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestGenericClass.java
new file mode 100644
index 0000000000..2ecf822904
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestGenericClass.java
@@ -0,0 +1,40 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestGenericClass <T extends Serializable & List<String>, S> {
+ public TestGenericClass<?, S> i;
+ public T f1;
+ public T[] f2;
+ public S f3;
+ public List<? extends T> list1;
+ public List<?> list2;
+ public List<? extends Serializable> list3;
+ public int f4;
+ public int[] f5;
+ public Map<? super T, S> map;
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java
new file mode 100644
index 0000000000..1f8e6cb445
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java
@@ -0,0 +1,70 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.ws.Holder;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface TestInterface {
+ int convert(String currency1, String currency2);
+
+ List<Double> getRates(String currency);
+
+ void check(boolean flag);
+
+ String[] list(int[] list);
+
+ int[][] map(String[][] strs);
+
+ String getGreetings(String name);
+
+ String[] getGreetingsArray(String[] names);
+
+ List<String> getGreetingsList(List<String> names);
+
+ ArrayList<String> getGreetingsArrayList(ArrayList<String> names);
+
+ Map<String, String> getGreetingsMap(Map<String, String> namesMap);
+
+ HashMap<String, String> getGreetingsHashMap(HashMap<String, String> namesMap);
+
+ @WebMethod
+ @WebResult(name = "output")
+ String webMethod(@WebParam(name = "input", mode = WebParam.Mode.IN) String in,
+ @WebParam(name = "holder", mode = WebParam.Mode.INOUT) Holder<String> holder);
+
+ @XmlJavaTypeAdapter(type = BeanInterface.class, value = TestAdapter.class)
+ BeanInterface beanMethod(@XmlJavaTypeAdapter(type = BeanInterface.class, value = TestAdapter.class) BeanInterface in,
+ String str);
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGeneratorTestCase.java b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGeneratorTestCase.java
new file mode 100644
index 0000000000..f83c27e10a
--- /dev/null
+++ b/sca-java-2.x/branches/2.0-Beta2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGeneratorTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * 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.sca.interfacedef.java.jaxws;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBTypeHelper;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WrapperBeanGeneratorTestCase {
+ @Test
+ public void testGenerate() throws Exception {
+ List<Class<?>> classes = new WrapperBeanGenerator().generateWrapperBeans(TestInterface.class);
+ for (Class<?> cls : classes) {
+ for (Field f : cls.getDeclaredFields()) {
+ System.out.println(f.getName());
+ System.out.println(f.getGenericType());
+ for (Annotation a : f.getAnnotations()) {
+ System.out.println(a);
+ }
+ }
+ for (Method m : cls.getDeclaredMethods()) {
+ System.out.println(m);
+ for (Annotation a : m.getAnnotations()) {
+ System.out.println(a);
+ }
+ }
+ }
+ JAXBContext context = new JAXBContextHelper(new DefaultExtensionPointRegistry()).createJAXBContext(classes.toArray(new Class<?>[classes.size()]));
+ for (Class<?> cls : classes) {
+ Object obj = cls.newInstance();
+ StringWriter sw = new StringWriter();
+ context.createMarshaller().marshal(obj, sw);
+ // System.out.println(sw.toString());
+ StringReader sr = new StringReader(sw.toString());
+ context.createUnmarshaller().unmarshal(new StreamSource(sr), cls);
+ }
+ }
+
+ @Test
+ public void testGenerateSchema() throws Exception {
+ List<Class<?>> classes = new WrapperBeanGenerator().generateWrapperBeans(TestInterface.class);
+ JAXBContext context = new JAXBContextHelper(new DefaultExtensionPointRegistry()).createJAXBContext(classes.toArray(new Class<?>[classes.size()]));
+ Map<String, String> results = JAXBTypeHelper.generateSchema(context);
+ for (String xsd : results.values()) {
+ System.out.println(xsd);
+ }
+ }
+}