Add test for abstract exception (marked @Ignore) and add test for List type

git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk@1039012 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/itest/jaxws/src/main/java/jtest/AbstractException.java b/itest/jaxws/src/main/java/jtest/AbstractException.java
index 7cde84a..dd12939 100644
--- a/itest/jaxws/src/main/java/jtest/AbstractException.java
+++ b/itest/jaxws/src/main/java/jtest/AbstractException.java
@@ -24,8 +24,10 @@
 /**

  * The abstract exception class

  */

-@XmlJavaTypeAdapter(TestAdapter.class)

+@XmlJavaTypeAdapter(ExceptionAdapter.class)

 public abstract class AbstractException extends Exception {

 

     public abstract String getGreeting();

+

+    public abstract void setGreeting(String greeting);

 }

diff --git a/itest/jaxws/src/main/java/jtest/AbstractExceptionImpl.java b/itest/jaxws/src/main/java/jtest/AbstractExceptionImpl.java
new file mode 100644
index 0000000..e8e80e4
--- /dev/null
+++ b/itest/jaxws/src/main/java/jtest/AbstractExceptionImpl.java
@@ -0,0 +1,31 @@
+/*

+ * 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;

+

+/**

+ * The test abstract exception class on-the-wire representation

+ */

+public class AbstractExceptionImpl {

+

+    public String className;

+

+    public String testGreeting;

+

+}

diff --git a/itest/jaxws/src/main/java/jtest/ConcreteException.java b/itest/jaxws/src/main/java/jtest/ConcreteException.java
index 82862b3..930f2cc 100644
--- a/itest/jaxws/src/main/java/jtest/ConcreteException.java
+++ b/itest/jaxws/src/main/java/jtest/ConcreteException.java
@@ -37,4 +37,8 @@
     public String getGreeting() {

         return greeting;

     }

+

+    public void setGreeting(String greeting) {

+        this.greeting = greeting;

+    }

 }

diff --git a/itest/jaxws/src/main/java/jtest/ExceptionAdapter.java b/itest/jaxws/src/main/java/jtest/ExceptionAdapter.java
new file mode 100644
index 0000000..0ff98c9
--- /dev/null
+++ b/itest/jaxws/src/main/java/jtest/ExceptionAdapter.java
@@ -0,0 +1,39 @@
+/*

+ * 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.adapters.XmlAdapter;

+

+/**

+ * The test XML exception adapter class

+ */

+public class ExceptionAdapter extends XmlAdapter<AbstractExceptionImpl, AbstractException> {

+    public AbstractException unmarshal(AbstractExceptionImpl ai) throws Exception {

+        AbstractException a = (AbstractException)this.getClass().getClassLoader().loadClass(ai.className).newInstance();

+        a.setGreeting(ai.testGreeting);

+        return a;

+    }

+    public AbstractExceptionImpl marshal(AbstractException v) throws Exception {

+        AbstractExceptionImpl ai = new AbstractExceptionImpl();

+        ai.className = v.getClass().getName();

+        ai.testGreeting = "Hi there!";

+        return ai;

+    }

+}

diff --git a/itest/jaxws/src/main/java/jtest/TestClient.java b/itest/jaxws/src/main/java/jtest/TestClient.java
index 9839e98..f9cd464 100644
--- a/itest/jaxws/src/main/java/jtest/TestClient.java
+++ b/itest/jaxws/src/main/java/jtest/TestClient.java
@@ -26,7 +26,7 @@
 

     void runAbstractTypeTest();

 

-/*

     void runAbstractExceptionTest();

-*/

+

+    void runListTypeTest();

 }

diff --git a/itest/jaxws/src/main/java/jtest/TestService.java b/itest/jaxws/src/main/java/jtest/TestService.java
index ac5a01c..4ade8d8 100644
--- a/itest/jaxws/src/main/java/jtest/TestService.java
+++ b/itest/jaxws/src/main/java/jtest/TestService.java
@@ -19,6 +19,8 @@
 

 package jtest;

 

+import java.util.List;

+

 import org.osoa.sca.annotations.Remotable;

 

 import jtest.AbstractException;

@@ -32,7 +34,7 @@
 

     void sendAbstract(TestAbstract data);

 

-/*

     void throwAbstract() throws AbstractException;

-*/

+

+    void sendList(List<String> data);

 }

diff --git a/itest/jaxws/src/main/java/jtest/TestWebService.java b/itest/jaxws/src/main/java/jtest/TestWebService.java
index cd7b1f3..6891b04 100644
--- a/itest/jaxws/src/main/java/jtest/TestWebService.java
+++ b/itest/jaxws/src/main/java/jtest/TestWebService.java
@@ -18,6 +18,7 @@
  */

 package jtest;

 

+import java.util.List;

 import javax.jws.WebMethod;

 import javax.jws.WebService;

 

@@ -26,4 +27,10 @@
 

     @WebMethod

     void sendAbstract(TestAbstract testData);

+

+    @WebMethod

+    void throwAbstract() throws AbstractException;

+

+    @WebMethod

+    void sendList(List<String> data);

 }

diff --git a/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java b/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
index 278f94f..12fd257 100644
--- a/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
+++ b/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
@@ -19,6 +19,7 @@
 

 package jtest.impl;

 

+import java.util.ArrayList;

 import org.osoa.sca.annotations.Reference;

 import org.osoa.sca.annotations.Service;

 

@@ -48,7 +49,6 @@
         ref.sendAbstract(data2);

     }

 

-/*

     public void runAbstractExceptionTest() {

         try {

             ref.throwAbstract();

@@ -57,5 +57,11 @@
             System.out.println(e.getGreeting());

         }

     }

-*/

+

+    public void runListTypeTest() {

+        ArrayList<String> data = new ArrayList<String>();

+        data.add("Hello,");

+        data.add("World!");

+        ref.sendList(data);

+    }

 }

diff --git a/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java b/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
index 356b32d..8537635 100644
--- a/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
+++ b/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
@@ -19,6 +19,8 @@
 

 package jtest.impl;

 

+import java.util.List;

+

 import org.osoa.sca.annotations.Service;

 

 import jtest.AbstractException;

@@ -39,9 +41,11 @@
         System.out.println(data.getGreeting());

     }

 

-/*

     public void throwAbstract() throws AbstractException {

         throw new ConcreteException();

     }

-*/

+

+    public void sendList(List<String> data) {

+        System.out.println(data.get(0) + " " + data.get(1));

+    }

 }

diff --git a/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java b/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java
index 974279c..2c42935 100644
--- a/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java
+++ b/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java
@@ -18,8 +18,11 @@
  */

 package jtest.impl;

 

+import java.util.List;

 import javax.jws.WebService;

 

+import jtest.AbstractException;

+import jtest.ConcreteException;

 import jtest.TestAbstract;

 import jtest.TestWebService;

 

@@ -29,4 +32,12 @@
     public void sendAbstract(TestAbstract testData) {

         System.out.println(testData.getGreeting());

     }

+

+    public void throwAbstract() throws AbstractException {

+        throw new ConcreteException();

+    }    

+

+    public void sendList(List<String> data) {

+        System.out.println(data.get(0) + " " + data.get(1));

+    }

 }

diff --git a/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java b/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
index 7ffcbeb..ffa9ac0 100644
--- a/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
+++ b/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
@@ -47,15 +47,21 @@
         testClient.runAbstractTypeTest();

     }

 

-/*

     @Test

+    @Ignore

     public void runAbstractExceptionTest() {

         SCAClient client = (SCAClient)node;

         TestClient testClient = client.getService(TestClient.class, "TestClient");

         testClient.runAbstractExceptionTest();

     }

-*/

     

+    @Test

+    public void runListTypeTest() {

+        SCAClient client = (SCAClient)node;

+        TestClient testClient = client.getService(TestClient.class, "TestClient");

+        testClient.runListTypeTest();

+    }

+

     @AfterClass

     public static void tearDownAfterClass() throws Exception {

         if (node != null) {