diff options
Diffstat (limited to 'sca-java-1.x/trunk/itest')
7 files changed, 105 insertions, 4 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();
+ }
}
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 7a9f27d32e..6886d17a6a 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 @@ -25,6 +25,7 @@ import org.apache.tuscany.sca.node.SCANode; 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 @@ public class DatatypesTestCase { }
@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
|