diff options
author | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2010-11-07 17:12:30 +0000 |
---|---|---|
committer | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2010-11-07 17:12:30 +0000 |
commit | 7a70aef7362feb8e8a86933853f42258d3b0694c (patch) | |
tree | 3c440148f2cb45492ed0dfb3120e97cc0dd7fe47 /sca-java-1.x/trunk/itest/jaxws/src/main/java | |
parent | 48c5ba9688ac64c3824aaa25fbe07d14046942ea (diff) |
Add test for abstract exceptions
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1032313 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/itest/jaxws/src/main/java')
6 files changed, 94 insertions, 2 deletions
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/AbstractException.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/AbstractException.java new file mode 100644 index 0000000000..7cde84af51 --- /dev/null +++ b/sca-java-1.x/trunk/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/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/ConcreteException.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/ConcreteException.java new file mode 100644 index 0000000000..82862b3b16 --- /dev/null +++ b/sca-java-1.x/trunk/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/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 6eedfc14ae..7a54553a68 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 @@ -24,5 +24,7 @@ package jtest; */
public interface TestClient {
- void runTest();
+ void runAbstractTypeTest();
+
+ void runAbstractExceptionTest();
}
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 90b2e011ca..69488bbd14 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 @@ -21,6 +21,7 @@ package jtest; import org.osoa.sca.annotations.Remotable;
+import jtest.AbstractException;
import jtest.TestAbstract;
/**
@@ -30,4 +31,6 @@ import jtest.TestAbstract; public interface TestService {
void sendAbstract(TestAbstract data1, TestAbstract data2);
+
+ void throwAbstract() throws AbstractException;
}
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 7249cfc7d1..2eadd43a86 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 @@ -22,6 +22,7 @@ package jtest.impl; 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 @@ public class TestClientImpl implements TestClient { @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/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 3cc8ca0bce..dc51ae0bd9 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 @@ -21,6 +21,8 @@ package jtest.impl; import org.osoa.sca.annotations.Service;
+import jtest.AbstractException;
+import jtest.ConcreteException;
import jtest.TestAbstract;
import jtest.TestService;
@@ -35,4 +37,8 @@ public class TestServiceImpl implements TestService { 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();
+ }
}
|