Add test for abstract exceptions

git-svn-id: https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk@1032313 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
new file mode 100644
index 0000000..7cde84a
--- /dev/null
+++ b/itest/jaxws/src/main/java/jtest/AbstractException.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;

+

+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

+

+/**

+ * The abstract exception class

+ */

+@XmlJavaTypeAdapter(TestAdapter.class)

+public abstract class AbstractException extends Exception {

+

+    public abstract String getGreeting();

+}

diff --git a/itest/jaxws/src/main/java/jtest/ConcreteException.java b/itest/jaxws/src/main/java/jtest/ConcreteException.java
new file mode 100644
index 0000000..82862b3
--- /dev/null
+++ b/itest/jaxws/src/main/java/jtest/ConcreteException.java
@@ -0,0 +1,40 @@
+/*

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

+

+/**

+ * The concrete exception class

+ */

+@XmlJavaTypeAdapter(TestAdapter.class)

+public class ConcreteException extends AbstractException {

+

+    private String greeting;

+

+    public ConcreteException() {

+        super();

+        this.greeting = "Goodbye...";

+    }

+

+    public String getGreeting() {

+        return greeting;

+    }

+}

diff --git a/itest/jaxws/src/main/java/jtest/TestClient.java b/itest/jaxws/src/main/java/jtest/TestClient.java
index 6eedfc1..7a54553 100644
--- a/itest/jaxws/src/main/java/jtest/TestClient.java
+++ b/itest/jaxws/src/main/java/jtest/TestClient.java
@@ -24,5 +24,7 @@
  */

 public interface TestClient {

 

-    void runTest();

+    void runAbstractTypeTest();

+

+    void runAbstractExceptionTest();

 }

diff --git a/itest/jaxws/src/main/java/jtest/TestService.java b/itest/jaxws/src/main/java/jtest/TestService.java
index 90b2e01..69488bb 100644
--- a/itest/jaxws/src/main/java/jtest/TestService.java
+++ b/itest/jaxws/src/main/java/jtest/TestService.java
@@ -21,6 +21,7 @@
 

 import org.osoa.sca.annotations.Remotable;

 

+import jtest.AbstractException;

 import jtest.TestAbstract;

 

 /**

@@ -30,4 +31,6 @@
 public interface TestService {

 

     void sendAbstract(TestAbstract data1, TestAbstract data2);

+

+    void throwAbstract() throws AbstractException;

 }

diff --git a/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java b/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
index 7249cfc..2eadd43 100644
--- a/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
+++ b/itest/jaxws/src/main/java/jtest/impl/TestClientImpl.java
@@ -22,6 +22,7 @@
 import org.osoa.sca.annotations.Reference;

 import org.osoa.sca.annotations.Service;

 

+import jtest.AbstractException;

 import jtest.TestClient;

 import jtest.TestConcrete1;

 import jtest.TestConcrete2;

@@ -36,9 +37,18 @@
     @Reference

     protected TestService ref;

 

-    public void runTest() {

+    public void runAbstractTypeTest() {

         TestConcrete1 data1 = new TestConcrete1();

         TestConcrete2 data2 = new TestConcrete2();

         ref.sendAbstract(data1, data2);

     }

+

+    public void runAbstractExceptionTest() {

+        try {

+            ref.throwAbstract();

+        } catch (AbstractException e) {

+            System.out.println("Caught exception " + e);

+            System.out.println(e.getGreeting());

+        }

+    }

 }

diff --git a/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java b/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
index 3cc8ca0..dc51ae0 100644
--- a/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
+++ b/itest/jaxws/src/main/java/jtest/impl/TestServiceImpl.java
@@ -21,6 +21,8 @@
 

 import org.osoa.sca.annotations.Service;

 

+import jtest.AbstractException;

+import jtest.ConcreteException;

 import jtest.TestAbstract;

 import jtest.TestService;

 

@@ -35,4 +37,8 @@
         System.out.println("data2 is instance of class " + data2.getClass().getName());

         System.out.println(data1.getGreeting() + " " + data2.getGreeting());

     }

+

+    public void throwAbstract() throws AbstractException {

+        throw new ConcreteException();

+    }

 }

diff --git a/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java b/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
index 7a9f27d..6886d17 100644
--- a/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
+++ b/itest/jaxws/src/test/java/jtest/DatatypesTestCase.java
@@ -25,6 +25,7 @@
 import org.apache.tuscany.sca.node.SCANodeFactory;

 import org.junit.AfterClass;

 import org.junit.BeforeClass;

+import org.junit.Ignore;

 import org.junit.Test;

 

 public class DatatypesTestCase {

@@ -38,10 +39,18 @@
     }

     

     @Test

-    public void runTest() {

+    public void runAbstractTypeTest() {

         SCAClient client = (SCAClient)node;

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

-        testClient.runTest();

+        testClient.runAbstractTypeTest();

+    }

+

+    @Test

+    @Ignore

+    public void runAbstractExceptionTest() {

+        SCAClient client = (SCAClient)node;

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

+        testClient.runAbstractExceptionTest();

     }

     

     @AfterClass