summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/itest
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-05-15 20:44:49 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-05-15 20:44:49 +0000
commit08e6d577358362d8da1172a47da4ace6916e6d2e (patch)
tree952bfda2ecf48191f94531e975e99035f0f8d88a /branches/sca-java-1.x/itest
parent73ffdb3c639f918474bc0df9dac57af8b121f3ab (diff)
TUSCANY-2967 Fix up just jmsBytes wire format to return exceptions as bytes to see if this is what we want
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@775324 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/itest')
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java28
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java16
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java4
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java7
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java35
-rw-r--r--branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java2
6 files changed, 88 insertions, 4 deletions
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java
new file mode 100644
index 0000000000..e8a7102afd
--- /dev/null
+++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java
@@ -0,0 +1,28 @@
+/*
+ * 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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld;
+
+public class CheckedException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public CheckedException(String s) {
+ super(s);
+ }
+}
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java
index 878fdb4fe4..febf918d9d 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java
+++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java
@@ -24,11 +24,23 @@ import org.osoa.sca.annotations.Reference;
public class HelloWorldReferenceImpl implements HelloWorldReference {
@Reference
- protected HelloWorldService helloWorldService1;
+ protected HelloWorldServiceReference helloWorldService1;
public String getGreetings(String name){
byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes());
- String stringValue = new String(bytesValue);
+ String stringValue = new String(bytesValue);
+
+ try {
+ helloWorldService1.throwChecked(null);
+ } catch (Exception e) {
+ stringValue += " CheckedException";
+ }
+
+ try {
+ helloWorldService1.throwUnChecked(null);
+ } catch (Exception e) {
+ stringValue += " UncheckedException";
+ }
return stringValue;
}
}
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java
index 82c57dfe75..5ae7032993 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java
+++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java
@@ -18,7 +18,6 @@
*/
package org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld;
-import org.osoa.sca.annotations.OneWay;
import org.osoa.sca.annotations.Remotable;
/**
@@ -29,5 +28,8 @@ public interface HelloWorldService {
public byte[] getByteArrayGreetings(byte[] msg);
+ public void throwChecked(byte[] msg) throws CheckedException;
+ public void throwUnChecked(byte[] msg);
+
}
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java
index f0b7819c3b..803be4cbe6 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java
+++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld;
+
public class HelloWorldServiceImpl implements HelloWorldService {
public byte[] getByteArrayGreetings(byte[] msg){
@@ -28,6 +29,12 @@ public class HelloWorldServiceImpl implements HelloWorldService {
return name.getBytes();
}
+ public void throwChecked(byte[] msg) throws CheckedException {
+ throw new CheckedException("foo");
+ }
+ public void throwUnChecked(byte[] msg) {
+ throw new RuntimeException("bla");
+ }
}
diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java
new file mode 100644
index 0000000000..5fad413ebe
--- /dev/null
+++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java
@@ -0,0 +1,35 @@
+/*
+ * 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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldServiceReference {
+
+ public byte[] getByteArrayGreetings(byte[] msg);
+
+ public void throwChecked(byte[] msg) ;
+ public void throwUnChecked(byte[] msg);
+
+}
+
diff --git a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java
index a242206080..8b03049f5a 100644
--- a/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java
+++ b/branches/sca-java-1.x/itest/jms-format/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java
@@ -51,7 +51,7 @@ public class FormatJMSBytesTestCase {
HelloWorldReference helloWorldService = ((SCAClient)node).getService(HelloWorldReference.class, "HelloWorldReferenceComponent");
System.out.println(helloWorldService.getGreetings("Fred Bloggs"));
- assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs"));
+ assertEquals("Hello Fred Bloggs CheckedException UncheckedException", helloWorldService.getGreetings("Fred Bloggs"));
}