summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-12-03 20:52:19 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-12-03 20:52:19 +0000
commit035f871e8e7be71f83420056194d7855962947a2 (patch)
tree16bf3e35de875fa6bc5fdb9450ca44fe43280041 /sca-java-1.x/trunk
parente31385693322b1833882f383785b461a53e7617f (diff)
Add more tests
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1041988 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk')
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/Bean1.java63
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/Bean2.java59
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java8
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java12
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java10
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/WrapBean.java38
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/WrapMap.java37
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java32
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java28
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java17
-rw-r--r--sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java30
11 files changed, 333 insertions, 1 deletions
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/Bean1.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/Bean1.java
new file mode 100644
index 0000000000..c93b7d8d65
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/Bean1.java
@@ -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+"]";
+ }
+}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/Bean2.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/Bean2.java
new file mode 100644
index 0000000000..ff2d334a12
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/Bean2.java
@@ -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+"]";
+ }
+}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java
index f9cd464d4c..576df240bb 100644
--- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java
+++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestClient.java
@@ -29,4 +29,12 @@ public interface TestClient {
void runAbstractExceptionTest();
void runListTypeTest();
+
+ void runMapTypeTest();
+
+ void runWrapMapTypeTest();
+
+ void runWildcardExtendsTest();
+
+ void runWrapBeanTest();
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java
index 4ade8d85af..6810ed7826 100644
--- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java
+++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestService.java
@@ -19,7 +19,10 @@
package jtest;
+//import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+//import javax.xml.bind.annotation.XmlSeeAlso;
import org.osoa.sca.annotations.Remotable;
@@ -30,6 +33,7 @@ import jtest.TestAbstract;
* The test service interface
*/
@Remotable
+//@XmlSeeAlso(Bean2.class)
public interface TestService {
void sendAbstract(TestAbstract data);
@@ -37,4 +41,12 @@ public interface TestService {
void throwAbstract() throws AbstractException;
void sendList(List<String> data);
+
+ Map<String, String> returnMap();
+
+ WrapMap returnWrapMap();
+
+ void sendWildcardExtends(Bean1</*? extends*/ Bean2> arg);
+
+ void sendWrapBean(WrapBean arg);
}
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 6891b04e13..6ec23d9cb0 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
@@ -19,6 +19,7 @@
package jtest;
import java.util.List;
+import java.util.Map;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -29,8 +30,17 @@ public interface TestWebService {
void sendAbstract(TestAbstract testData);
@WebMethod
+ String sendConcrete(TestConcrete1 testData);
+
+ @WebMethod
void throwAbstract() throws AbstractException;
@WebMethod
void sendList(List<String> data);
+
+ @WebMethod
+ Map<String, String> returnMap();
+
+ @WebMethod
+ void sendWildcardExtends(Bean1<Bean2> arg);
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/WrapBean.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/WrapBean.java
new file mode 100644
index 0000000000..d364555e72
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/WrapBean.java
@@ -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;
+ }
+}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/WrapMap.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/WrapMap.java
new file mode 100644
index 0000000000..7c4394413a
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/WrapMap.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;
+
+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;
+ }
+}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
index 12fd257b54..7461d18af8 100644
--- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
+++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
@@ -20,14 +20,19 @@
package jtest.impl;
import java.util.ArrayList;
+import java.util.Map;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
import jtest.AbstractException;
+import jtest.Bean1;
+import jtest.Bean2;
import jtest.TestClient;
import jtest.TestConcrete1;
import jtest.TestConcrete2;
import jtest.TestService;
+import jtest.WrapBean;
+import jtest.WrapMap;
/**
* The test client implementation
@@ -64,4 +69,31 @@ public class TestClientImpl implements TestClient {
data.add("World!");
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);
+ }
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
index 8537635590..77a7cfb6cf 100644
--- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
+++ b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
@@ -19,14 +19,20 @@
package jtest.impl;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.osoa.sca.annotations.Service;
import jtest.AbstractException;
+import jtest.Bean1;
+import jtest.Bean2;
import jtest.ConcreteException;
import jtest.TestAbstract;
import jtest.TestService;
+import jtest.WrapBean;
+import jtest.WrapMap;
/**
* The test service implementation
@@ -48,4 +54,26 @@ public class TestServiceImpl implements TestService {
public void sendList(List<String> data) {
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());
+ }
}
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 2c429358f3..eb089e8be1 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
@@ -19,11 +19,15 @@
package jtest.impl;
import java.util.List;
+import java.util.Map;
import javax.jws.WebService;
import jtest.AbstractException;
+import jtest.Bean1;
+import jtest.Bean2;
import jtest.ConcreteException;
import jtest.TestAbstract;
+import jtest.TestConcrete1;
import jtest.TestWebService;
@WebService(endpointInterface = "jtest.TestWebService")
@@ -33,6 +37,11 @@ public class TestWebServiceImpl implements TestWebService {
System.out.println(testData.getGreeting());
}
+ public String sendConcrete(TestConcrete1 testData) {
+ System.out.println(testData.getGreeting());
+ return "Hi!";
+ }
+
public void throwAbstract() throws AbstractException {
throw new ConcreteException();
}
@@ -40,4 +49,12 @@ public class TestWebServiceImpl implements TestWebService {
public void sendList(List<String> data) {
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);
+ }
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java b/sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
index ffa9ac03aa..04450986c0 100644
--- a/sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
+++ b/sca-java-1.x/trunk/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
@@ -54,7 +54,7 @@ public class DatatypesTestCase {
TestClient testClient = client.getService(TestClient.class, "TestClient");
testClient.runAbstractExceptionTest();
}
-
+
@Test
public void runListTypeTest() {
SCAClient client = (SCAClient)node;
@@ -62,6 +62,34 @@ public class DatatypesTestCase {
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
public static void tearDownAfterClass() throws Exception {
if (node != null) {