Add more tests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1041988 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e313856933
commit
035f871e8e
11 changed files with 333 additions and 1 deletions
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version $Rev: 832193 $ $Date: 2009-11-02 23:31:15 +0000 (Mon, 02 Nov 2009) $
|
||||||
|
*/
|
||||||
|
public class Bean1<T> {
|
||||||
|
private T item;
|
||||||
|
|
||||||
|
public Bean1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bean1(T item) {
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItem(T item) {
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getItem() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object that) {
|
||||||
|
if(that == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(that.getClass() != this.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bean1<?> that1 = (Bean1<?>)that;
|
||||||
|
if(this == that1) {
|
||||||
|
return true;
|
||||||
|
} else if(this.item != null) {
|
||||||
|
return this.item.equals(that1.item);
|
||||||
|
} else {
|
||||||
|
return that1.item == null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return this.getClass().getSimpleName()+"[item = "+item+"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
//import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version $Rev: 832193 $ $Date: 2009-11-02 23:31:15 +0000 (Mon, 02 Nov 2009) $
|
||||||
|
*/
|
||||||
|
//@XmlSeeAlso({Bean3.class, Bean3[].class, Bean31.class, Bean31[].class})
|
||||||
|
public class Bean2 {
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object that) {
|
||||||
|
if(that == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.getClass() != that.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this == that) {
|
||||||
|
return true;
|
||||||
|
} else if(this.name != null) {
|
||||||
|
return this.name.equals(((Bean2)that).name);
|
||||||
|
} else {
|
||||||
|
return ((Bean2)that).name == null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return this.getClass().getSimpleName()+"[name = "+name+"]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,4 +29,12 @@ public interface TestClient {
|
||||||
void runAbstractExceptionTest();
|
void runAbstractExceptionTest();
|
||||||
|
|
||||||
void runListTypeTest();
|
void runListTypeTest();
|
||||||
|
|
||||||
|
void runMapTypeTest();
|
||||||
|
|
||||||
|
void runWrapMapTypeTest();
|
||||||
|
|
||||||
|
void runWildcardExtendsTest();
|
||||||
|
|
||||||
|
void runWrapBeanTest();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
|
|
||||||
package jtest;
|
package jtest;
|
||||||
|
|
||||||
|
//import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
//import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
import org.osoa.sca.annotations.Remotable;
|
import org.osoa.sca.annotations.Remotable;
|
||||||
|
|
||||||
|
@ -30,6 +33,7 @@ import jtest.TestAbstract;
|
||||||
* The test service interface
|
* The test service interface
|
||||||
*/
|
*/
|
||||||
@Remotable
|
@Remotable
|
||||||
|
//@XmlSeeAlso(Bean2.class)
|
||||||
public interface TestService {
|
public interface TestService {
|
||||||
|
|
||||||
void sendAbstract(TestAbstract data);
|
void sendAbstract(TestAbstract data);
|
||||||
|
@ -37,4 +41,12 @@ public interface TestService {
|
||||||
void throwAbstract() throws AbstractException;
|
void throwAbstract() throws AbstractException;
|
||||||
|
|
||||||
void sendList(List<String> data);
|
void sendList(List<String> data);
|
||||||
|
|
||||||
|
Map<String, String> returnMap();
|
||||||
|
|
||||||
|
WrapMap returnWrapMap();
|
||||||
|
|
||||||
|
void sendWildcardExtends(Bean1</*? extends*/ Bean2> arg);
|
||||||
|
|
||||||
|
void sendWrapBean(WrapBean arg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
package jtest;
|
package jtest;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import javax.jws.WebMethod;
|
import javax.jws.WebMethod;
|
||||||
import javax.jws.WebService;
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@ -28,9 +29,18 @@ public interface TestWebService {
|
||||||
@WebMethod
|
@WebMethod
|
||||||
void sendAbstract(TestAbstract testData);
|
void sendAbstract(TestAbstract testData);
|
||||||
|
|
||||||
|
@WebMethod
|
||||||
|
String sendConcrete(TestConcrete1 testData);
|
||||||
|
|
||||||
@WebMethod
|
@WebMethod
|
||||||
void throwAbstract() throws AbstractException;
|
void throwAbstract() throws AbstractException;
|
||||||
|
|
||||||
@WebMethod
|
@WebMethod
|
||||||
void sendList(List<String> data);
|
void sendList(List<String> data);
|
||||||
|
|
||||||
|
@WebMethod
|
||||||
|
Map<String, String> returnMap();
|
||||||
|
|
||||||
|
@WebMethod
|
||||||
|
void sendWildcardExtends(Bean1<Bean2> arg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The wrapped bean class
|
||||||
|
*/
|
||||||
|
@XmlSeeAlso(Bean2.class)
|
||||||
|
public class WrapBean {
|
||||||
|
private Bean1<Bean2> bean;
|
||||||
|
|
||||||
|
public Bean1<Bean2> getBean() {
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBean(Bean1<Bean2> bean) {
|
||||||
|
this.bean = bean;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The wrapped map class
|
||||||
|
*/
|
||||||
|
public class WrapMap {
|
||||||
|
private Map<String, String> map;
|
||||||
|
|
||||||
|
public Map<String, String> getMap() {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap(Map<String, String> map) {
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,14 +20,19 @@
|
||||||
package jtest.impl;
|
package jtest.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
import org.osoa.sca.annotations.Reference;
|
import org.osoa.sca.annotations.Reference;
|
||||||
import org.osoa.sca.annotations.Service;
|
import org.osoa.sca.annotations.Service;
|
||||||
|
|
||||||
import jtest.AbstractException;
|
import jtest.AbstractException;
|
||||||
|
import jtest.Bean1;
|
||||||
|
import jtest.Bean2;
|
||||||
import jtest.TestClient;
|
import jtest.TestClient;
|
||||||
import jtest.TestConcrete1;
|
import jtest.TestConcrete1;
|
||||||
import jtest.TestConcrete2;
|
import jtest.TestConcrete2;
|
||||||
import jtest.TestService;
|
import jtest.TestService;
|
||||||
|
import jtest.WrapBean;
|
||||||
|
import jtest.WrapMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The test client implementation
|
* The test client implementation
|
||||||
|
@ -64,4 +69,31 @@ public class TestClientImpl implements TestClient {
|
||||||
data.add("World!");
|
data.add("World!");
|
||||||
ref.sendList(data);
|
ref.sendList(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void runMapTypeTest() {
|
||||||
|
Map<String, String> myMap = ref.returnMap();
|
||||||
|
System.out.println(myMap.get("greeting"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runWrapMapTypeTest() {
|
||||||
|
WrapMap myWrapMap = ref.returnWrapMap();
|
||||||
|
Map<String, String> myMap = myWrapMap.getMap();
|
||||||
|
System.out.println(myMap.get("greeting"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runWildcardExtendsTest() {
|
||||||
|
Bean2 temp = new Bean2();
|
||||||
|
temp.setName("Me");
|
||||||
|
Bean1<Bean2> arg = new Bean1<Bean2>(temp);
|
||||||
|
ref.sendWildcardExtends(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void runWrapBeanTest() {
|
||||||
|
Bean2 temp = new Bean2();
|
||||||
|
temp.setName("Me");
|
||||||
|
Bean1<Bean2> arg = new Bean1<Bean2>(temp);
|
||||||
|
WrapBean bean = new WrapBean();
|
||||||
|
bean.setBean(arg);
|
||||||
|
ref.sendWrapBean(bean);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,20 @@
|
||||||
|
|
||||||
package jtest.impl;
|
package jtest.impl;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.osoa.sca.annotations.Service;
|
import org.osoa.sca.annotations.Service;
|
||||||
|
|
||||||
import jtest.AbstractException;
|
import jtest.AbstractException;
|
||||||
|
import jtest.Bean1;
|
||||||
|
import jtest.Bean2;
|
||||||
import jtest.ConcreteException;
|
import jtest.ConcreteException;
|
||||||
import jtest.TestAbstract;
|
import jtest.TestAbstract;
|
||||||
import jtest.TestService;
|
import jtest.TestService;
|
||||||
|
import jtest.WrapBean;
|
||||||
|
import jtest.WrapMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The test service implementation
|
* The test service implementation
|
||||||
|
@ -48,4 +54,26 @@ public class TestServiceImpl implements TestService {
|
||||||
public void sendList(List<String> data) {
|
public void sendList(List<String> data) {
|
||||||
System.out.println(data.get(0) + " " + data.get(1));
|
System.out.println(data.get(0) + " " + data.get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, String> returnMap() {
|
||||||
|
Map<String, String> yourMap = new HashMap<String, String>();
|
||||||
|
yourMap.put("greeting", "Hello, World Map!");
|
||||||
|
return yourMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WrapMap returnWrapMap() {
|
||||||
|
Map<String, String> yourMap = new HashMap<String, String>();
|
||||||
|
yourMap.put("greeting", "Hello, World Map!");
|
||||||
|
WrapMap wrapped = new WrapMap();
|
||||||
|
wrapped.setMap(yourMap);
|
||||||
|
return wrapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendWildcardExtends(Bean1</*? extends*/ Bean2> arg) {
|
||||||
|
System.out.println("TestServiceImpl received generic bean " + arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendWrapBean(WrapBean arg) {
|
||||||
|
System.out.println("TestServiceImpl received wrapped bean " + arg.getBean());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,15 @@
|
||||||
package jtest.impl;
|
package jtest.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import javax.jws.WebService;
|
import javax.jws.WebService;
|
||||||
|
|
||||||
import jtest.AbstractException;
|
import jtest.AbstractException;
|
||||||
|
import jtest.Bean1;
|
||||||
|
import jtest.Bean2;
|
||||||
import jtest.ConcreteException;
|
import jtest.ConcreteException;
|
||||||
import jtest.TestAbstract;
|
import jtest.TestAbstract;
|
||||||
|
import jtest.TestConcrete1;
|
||||||
import jtest.TestWebService;
|
import jtest.TestWebService;
|
||||||
|
|
||||||
@WebService(endpointInterface = "jtest.TestWebService")
|
@WebService(endpointInterface = "jtest.TestWebService")
|
||||||
|
@ -33,6 +37,11 @@ public class TestWebServiceImpl implements TestWebService {
|
||||||
System.out.println(testData.getGreeting());
|
System.out.println(testData.getGreeting());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String sendConcrete(TestConcrete1 testData) {
|
||||||
|
System.out.println(testData.getGreeting());
|
||||||
|
return "Hi!";
|
||||||
|
}
|
||||||
|
|
||||||
public void throwAbstract() throws AbstractException {
|
public void throwAbstract() throws AbstractException {
|
||||||
throw new ConcreteException();
|
throw new ConcreteException();
|
||||||
}
|
}
|
||||||
|
@ -40,4 +49,12 @@ public class TestWebServiceImpl implements TestWebService {
|
||||||
public void sendList(List<String> data) {
|
public void sendList(List<String> data) {
|
||||||
System.out.println(data.get(0) + " " + data.get(1));
|
System.out.println(data.get(0) + " " + data.get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, String> returnMap() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendWildcardExtends(Bean1<Bean2> arg) {
|
||||||
|
System.out.println(arg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class DatatypesTestCase {
|
||||||
TestClient testClient = client.getService(TestClient.class, "TestClient");
|
TestClient testClient = client.getService(TestClient.class, "TestClient");
|
||||||
testClient.runAbstractExceptionTest();
|
testClient.runAbstractExceptionTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void runListTypeTest() {
|
public void runListTypeTest() {
|
||||||
SCAClient client = (SCAClient)node;
|
SCAClient client = (SCAClient)node;
|
||||||
|
@ -62,6 +62,34 @@ public class DatatypesTestCase {
|
||||||
testClient.runListTypeTest();
|
testClient.runListTypeTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runWrapMapTypeTest() {
|
||||||
|
SCAClient client = (SCAClient)node;
|
||||||
|
TestClient testClient = client.getService(TestClient.class, "TestClient");
|
||||||
|
testClient.runWrapMapTypeTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runMapTypeTest() {
|
||||||
|
SCAClient client = (SCAClient)node;
|
||||||
|
TestClient testClient = client.getService(TestClient.class, "TestClient");
|
||||||
|
testClient.runMapTypeTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runWildcardExtendsTest() {
|
||||||
|
SCAClient client = (SCAClient)node;
|
||||||
|
TestClient testClient = client.getService(TestClient.class, "TestClient");
|
||||||
|
testClient.runWildcardExtendsTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void runWrapBeanTest() {
|
||||||
|
SCAClient client = (SCAClient)node;
|
||||||
|
TestClient testClient = client.getService(TestClient.class, "TestClient");
|
||||||
|
testClient.runWrapBeanTest();
|
||||||
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void tearDownAfterClass() throws Exception {
|
public static void tearDownAfterClass() throws Exception {
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
|
|
Loading…
Reference in a new issue