From 051cc5a4b4076997335312b016c0326d0935f9b3 Mon Sep 17 00:00:00 2001 From: nash Date: Thu, 9 Jun 2011 09:58:11 +0000 Subject: TUSCANY-3869: Add tests to 1.x for POJO type in different package than the interface git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1133760 13f79535-47bb-0310-9956-ffa450edef68 --- .../jaxws/src/main/java/jtest/TestWebService.java | 8 +++- .../main/java/jtest/impl/TestWebServiceImpl.java | 11 +++-- .../jaxws/src/main/java/jtest/other/TestOther.java | 37 +++++++++++++++++ .../src/main/java/jtest/other/package-info.java | 23 +++++++++++ .../src/main/java/wsdlgen/other/OtherPojo.java | 48 ++++++++++++++++++++++ .../src/main/java/wsdlgen/other/package-info.java | 23 +++++++++++ .../src/main/java/wsdlgen/verify/DataTypes.java | 3 ++ .../java/wsdlgen/verify/impl/DataTypesImpl.java | 4 ++ .../java/wsdlgen/verify/DataTypesTestCase.java | 17 +++++++- 9 files changed, 167 insertions(+), 7 deletions(-) create mode 100644 sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/other/TestOther.java create mode 100644 sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/other/package-info.java create mode 100644 sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/other/OtherPojo.java create mode 100644 sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/other/package-info.java (limited to 'sca-java-1.x') diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java index 6ec23d9cb0..0f61efbbbc 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import javax.jws.WebMethod; import javax.jws.WebService; +import jtest.other.TestOther; @WebService public interface TestWebService { @@ -32,14 +33,17 @@ public interface TestWebService { @WebMethod String sendConcrete(TestConcrete1 testData); + @WebMethod + void sendOtherPackage(TestOther testData); + @WebMethod void throwAbstract() throws AbstractException; @WebMethod void sendList(List data); - @WebMethod - Map returnMap(); + //@WebMethod + //Map returnMap(); @WebMethod void sendWildcardExtends(Bean1 arg); diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java index eb089e8be1..c510163009 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java @@ -28,6 +28,7 @@ import jtest.Bean2; import jtest.ConcreteException; import jtest.TestAbstract; import jtest.TestConcrete1; +import jtest.other.TestOther; import jtest.TestWebService; @WebService(endpointInterface = "jtest.TestWebService") @@ -42,6 +43,10 @@ public class TestWebServiceImpl implements TestWebService { return "Hi!"; } + public void sendOtherPackage(TestOther testData) { + System.out.println(testData.getGreeting()); + } + public void throwAbstract() throws AbstractException { throw new ConcreteException(); } @@ -50,9 +55,9 @@ public class TestWebServiceImpl implements TestWebService { System.out.println(data.get(0) + " " + data.get(1)); } - public Map returnMap() { - return null; - } + //public Map returnMap() { + // return null; + //} public void sendWildcardExtends(Bean1 arg) { System.out.println(arg); diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/other/TestOther.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/other/TestOther.java new file mode 100644 index 0000000000..870f4990ff --- /dev/null +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/other/TestOther.java @@ -0,0 +1,37 @@ +/* + * 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 jtest.other; + +import javax.xml.bind.annotation.XmlSchema; + +/** + * A test class in a different package than the interface + */ +public class TestOther { + private String greeting; + + public TestOther() { + greeting = "Hello Stranger"; + } + + public String getGreeting() { + return greeting; + } +} diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/other/package-info.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/other/package-info.java new file mode 100644 index 0000000000..9fb7e9829a --- /dev/null +++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/other/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +@XmlSchema(namespace = "http://other.jtest/") +package jtest.other; + +import javax.xml.bind.annotation.XmlSchema; diff --git a/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/other/OtherPojo.java b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/other/OtherPojo.java new file mode 100644 index 0000000000..08e866036d --- /dev/null +++ b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/other/OtherPojo.java @@ -0,0 +1,48 @@ +/* + * 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 wsdlgen.other; + +public class OtherPojo { + private double real, imaginary; + + public OtherPojo(double real, double imaginary) { + this.real = real; + this.imaginary = imaginary; + } + + public OtherPojo() { + } + + public double getReal() { + return real; + } + + public void setReal(double real) { + this.real = real; + } + + public double getImaginary() { + return imaginary; + } + + public void setImaginary(double imaginary) { + this.imaginary = imaginary; + } +} diff --git a/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/other/package-info.java b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/other/package-info.java new file mode 100644 index 0000000000..852ccd2300 --- /dev/null +++ b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/other/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +@XmlSchema(namespace = "http://other.jtest/") +package wsdlgen.other; + +import javax.xml.bind.annotation.XmlSchema; diff --git a/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/verify/DataTypes.java b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/verify/DataTypes.java index 58c5f3df69..2c6fb8a2c1 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/verify/DataTypes.java +++ b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/verify/DataTypes.java @@ -25,6 +25,7 @@ import javax.jws.soap.SOAPBinding; import commonj.sdo.DataObject; import org.osoa.sca.ServiceReference; import org.osoa.sca.annotations.Remotable; +import wsdlgen.other.OtherPojo; @Remotable public interface DataTypes { @@ -49,6 +50,8 @@ public interface DataTypes { void testComplex(ComplexNumber complex); + void testOtherPackage(OtherPojo pojo); + void testByteArray(byte[] byteArray); void testBaseExtension(ExtClass ext); diff --git a/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/verify/impl/DataTypesImpl.java b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/verify/impl/DataTypesImpl.java index cdb8c6e0a1..4ffdaa8152 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/verify/impl/DataTypesImpl.java +++ b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/main/java/wsdlgen/verify/impl/DataTypesImpl.java @@ -24,6 +24,7 @@ import javax.jws.WebParam; import javax.jws.soap.SOAPBinding; import commonj.sdo.DataObject; import org.osoa.sca.ServiceReference; +import wsdlgen.other.OtherPojo; import wsdlgen.verify.BaseClass; import wsdlgen.verify.ComplexNumber; import wsdlgen.verify.DataTypes; @@ -62,6 +63,9 @@ public class DataTypesImpl implements DataTypes { public void testComplex(ComplexNumber complex) { } + public void testOtherPackage(OtherPojo pojo) { + } + public void testByteArray(byte[] byteArray) { } diff --git a/sca-java-1.x/trunk/itest/wsdlgen-verify/src/test/java/wsdlgen/verify/DataTypesTestCase.java b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/test/java/wsdlgen/verify/DataTypesTestCase.java index 2accda0a6a..ba0dafad16 100644 --- a/sca-java-1.x/trunk/itest/wsdlgen-verify/src/test/java/wsdlgen/verify/DataTypesTestCase.java +++ b/sca-java-1.x/trunk/itest/wsdlgen-verify/src/test/java/wsdlgen/verify/DataTypesTestCase.java @@ -48,14 +48,18 @@ public class DataTypesTestCase extends BaseFramework { @Test public void testSimpleMultiArrayInt() throws Exception { Element paramElement = parameterElement("testSimpleMultiArrayInt"); - assertEquals("ns1:intArray", paramElement.getAttribute("type")); + // prefix name can vary, so compare only the fixed parts + assertEquals("ns", paramElement.getAttribute("type").substring(0, 2)); + assertEquals(":intArray", paramElement.getAttribute("type").substring(3)); assertEquals("unbounded", paramElement.getAttribute("maxOccurs")); } @Test public void testSimpleMulti3ArrayInt() throws Exception { Element paramElement = parameterElement("testSimpleMulti3ArrayInt"); - assertEquals("ns1:intArrayArray", paramElement.getAttribute("type")); + // prefix name can vary, so compare only the fixed parts + assertEquals("ns", paramElement.getAttribute("type").substring(0, 2)); + assertEquals(":intArrayArray", paramElement.getAttribute("type").substring(3)); assertEquals("unbounded", paramElement.getAttribute("maxOccurs")); } @@ -101,6 +105,15 @@ public class DataTypesTestCase extends BaseFramework { assertEquals("xs:double", firstChild(typeDefinition(paramType)).getAttribute("type")); } + @Test + public void testOtherPackage() throws Exception { + String paramType = parameterType("testOtherPackage"); + // prefix name can vary, so compare only the fixed parts + assertEquals("ns", paramType.substring(0, 2)); + assertEquals(":otherPojo", paramType.substring(3)); + assertEquals("xs:double", firstChild(typeDefinition(paramType)).getAttribute("type")); + } + @Test public void testByteArray() throws Exception { assertEquals("xs:base64Binary", parameterType("testByteArray")); -- cgit v1.2.3