Add more tests

git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk@1041988 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/itest/jaxws/src/main/java/jtest/Bean1.java b/itest/jaxws/src/main/java/jtest/Bean1.java
new file mode 100644
index 0000000..c93b7d8
--- /dev/null
+++ b/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/itest/jaxws/src/main/java/jtest/Bean2.java b/itest/jaxws/src/main/java/jtest/Bean2.java
new file mode 100644
index 0000000..ff2d334
--- /dev/null
+++ b/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/itest/jaxws/src/main/java/jtest/TestClient.java b/itest/jaxws/src/main/java/jtest/TestClient.java
index f9cd464..576df24 100644
--- a/itest/jaxws/src/main/java/jtest/TestClient.java
+++ b/itest/jaxws/src/main/java/jtest/TestClient.java
@@ -29,4 +29,12 @@
     void runAbstractExceptionTest();

 

     void runListTypeTest();

+

+    void runMapTypeTest();

+

+    void runWrapMapTypeTest();

+

+    void runWildcardExtendsTest();

+

+    void runWrapBeanTest();

 }

diff --git a/itest/jaxws/src/main/java/jtest/TestService.java b/itest/jaxws/src/main/java/jtest/TestService.java
index 4ade8d8..6810ed7 100644
--- a/itest/jaxws/src/main/java/jtest/TestService.java
+++ b/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 @@
  * The test service interface

  */

 @Remotable

+//@XmlSeeAlso(Bean2.class)

 public interface TestService {

 

     void sendAbstract(TestAbstract data);

@@ -37,4 +41,12 @@
     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/itest/jaxws/src/main/java/jtest/TestWebService.java b/itest/jaxws/src/main/java/jtest/TestWebService.java
index 6891b04..6ec23d9 100644
--- a/itest/jaxws/src/main/java/jtest/TestWebService.java
+++ b/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 @@
     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/itest/jaxws/src/main/java/jtest/WrapBean.java b/itest/jaxws/src/main/java/jtest/WrapBean.java
new file mode 100644
index 0000000..d364555
--- /dev/null
+++ b/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/itest/jaxws/src/main/java/jtest/WrapMap.java b/itest/jaxws/src/main/java/jtest/WrapMap.java
new file mode 100644
index 0000000..7c43944
--- /dev/null
+++ b/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/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java b/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
index 12fd257..7461d18 100644
--- a/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
+++ b/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 @@
         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/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java b/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
index 8537635..77a7cfb 100644
--- a/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
+++ b/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 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/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java b/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java
index 2c42935..eb089e8 100644
--- a/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java
+++ b/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 @@
         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 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/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java b/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
index ffa9ac0..0445098 100644
--- a/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
+++ b/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
@@ -54,7 +54,7 @@
         TestClient testClient = client.getService(TestClient.class, "TestClient");

         testClient.runAbstractExceptionTest();

     }

-    

+

     @Test

     public void runListTypeTest() {

         SCAClient client = (SCAClient)node;

@@ -62,6 +62,34 @@
         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) {