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
This commit is contained in:
nash 2011-06-09 09:58:11 +00:00
parent d9e0a73826
commit 051cc5a4b4
9 changed files with 167 additions and 7 deletions

View file

@ -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<String> data);
@WebMethod
Map<String, String> returnMap();
//@WebMethod
//Map<String, String> returnMap();
@WebMethod
void sendWildcardExtends(Bean1<Bean2> arg);

View file

@ -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<String, String> returnMap() {
return null;
}
//public Map<String, String> returnMap() {
// return null;
//}
public void sendWildcardExtends(Bean1<Bean2> arg) {
System.out.println(arg);

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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);

View file

@ -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) {
}

View file

@ -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"));