diff options
author | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2010-11-25 12:02:58 +0000 |
---|---|---|
committer | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2010-11-25 12:02:58 +0000 |
commit | f1c1be59f2a31efd90a8e33524aa02fa23dd3d4b (patch) | |
tree | 742692f48f7f28fad26fd292b24f458c13ded9c4 /sca-java-1.x/trunk/itest/jaxws | |
parent | 1b68f70a4084371fd68e54429dce10b96ae61888 (diff) |
Add test for abstract exception (marked @Ignore) and add test for List type
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1039012 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/itest/jaxws')
11 files changed, 123 insertions, 11 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 index 7cde84af51..dd12939e6f 100644 --- 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 @@ -24,8 +24,10 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /**
* 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/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/AbstractExceptionImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/AbstractExceptionImpl.java new file mode 100644 index 0000000000..e8e80e430c --- /dev/null +++ b/sca-java-1.x/trunk/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/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 index 82862b3b16..930f2cc67e 100644 --- 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 @@ -37,4 +37,8 @@ public class ConcreteException extends AbstractException { public String getGreeting() {
return greeting;
}
+
+ public void setGreeting(String greeting) {
+ this.greeting = greeting;
+ }
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/ExceptionAdapter.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/ExceptionAdapter.java new file mode 100644 index 0000000000..0ff98c9492 --- /dev/null +++ b/sca-java-1.x/trunk/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/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 9839e980c8..f9cd464d4c 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 @@ -26,7 +26,7 @@ public interface TestClient { void runAbstractTypeTest();
-/*
void runAbstractExceptionTest();
-*/
+
+ void runListTypeTest();
}
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 ac5a01cd15..4ade8d85af 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 @@ -19,6 +19,8 @@ package jtest;
+import java.util.List;
+
import org.osoa.sca.annotations.Remotable;
import jtest.AbstractException;
@@ -32,7 +34,7 @@ public interface TestService { void sendAbstract(TestAbstract data);
-/*
void throwAbstract() throws AbstractException;
-*/
+
+ void sendList(List<String> data);
}
diff --git a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java index cd7b1f3ecc..6891b04e13 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/TestWebService.java +++ b/sca-java-1.x/trunk/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 @@ public interface TestWebService { @WebMethod
void sendAbstract(TestAbstract testData);
+
+ @WebMethod
+ void throwAbstract() throws AbstractException;
+
+ @WebMethod
+ void sendList(List<String> data);
}
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 278f94f8fc..12fd257b54 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 @@ -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 @@ public class TestClientImpl implements TestClient { ref.sendAbstract(data2);
}
-/*
public void runAbstractExceptionTest() {
try {
ref.throwAbstract();
@@ -57,5 +57,11 @@ public class TestClientImpl implements TestClient { 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/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 356b32dfab..8537635590 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 @@ -19,6 +19,8 @@ package jtest.impl;
+import java.util.List;
+
import org.osoa.sca.annotations.Service;
import jtest.AbstractException;
@@ -39,9 +41,11 @@ public class TestServiceImpl implements TestService { 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/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java b/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java index 974279c7ef..2c429358f3 100644 --- a/sca-java-1.x/trunk/itest/jaxws/src/main/java/jtest/impl/TestWebServiceImpl.java +++ b/sca-java-1.x/trunk/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 class TestWebServiceImpl implements TestWebService { 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/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 7ffcbebfd8..ffa9ac03aa 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 @@ -47,15 +47,21 @@ public class DatatypesTestCase { 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) {
|