From 08ba6e53202a2b2f20dd8ea6e2a315fb80ff818a Mon Sep 17 00:00:00 2001 From: slaws Date: Tue, 19 May 2009 16:45:52 +0000 Subject: TUSCANY-2967 - to aid investigation of possible exception processing refactoring enhance format tests to test checked and unchecked exceptions. Also add a wf.jmsText test. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@776381 13f79535-47bb-0310-9956-ffa450edef68 --- .../jmsobject/helloworld/CheckedException.java | 28 ++++++++++++++++++++++ .../helloworld/HelloWorldReferenceImpl.java | 16 +++++++++++-- .../jmsobject/helloworld/HelloWorldService.java | 3 +++ .../helloworld/HelloWorldServiceImpl.java | 9 ++++++- 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java (limited to 'branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject') diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java new file mode 100644 index 0000000000..da82b2fd5c --- /dev/null +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/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.jmsobject.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/jmsobject/helloworld/HelloWorldReferenceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java index d0e10c97e3..bb853673e8 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java @@ -58,7 +58,7 @@ public class HelloWorldReferenceImpl implements HelloWorldReference { returnString += " " + returnGreeting; returnGreeting = helloWorldServiceWrapSingle.getObjectArrayGreeting(new Object[]{person}); - returnString += " " + returnGreeting; + returnString += " " + returnGreeting; return returnString; } @@ -92,7 +92,19 @@ public class HelloWorldReferenceImpl implements HelloWorldReference { returnString += " " + returnGreeting; returnGreeting = helloWorldServiceDontWrapSingle.getObjectArrayGreeting(new Object[]{person}); - returnString += " " + returnGreeting; + returnString += " " + returnGreeting; + + try { + helloWorldServiceDontWrapSingle.throwChecked(person); + } catch (CheckedException e) { + returnString += " " + e.getMessage(); + } + + try { + helloWorldServiceDontWrapSingle.throwUnChecked(person); + } catch (Exception e) { + returnString += " " + e.getCause().getMessage(); + } return returnString; } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java index 43a4f9d4bd..8976887daa 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java @@ -33,6 +33,9 @@ public interface HelloWorldService { public String getMultiGreetings(String firstName, String lastName); public String getObjectGreeting(Object person); public String getObjectArrayGreeting(Object[] pearson); + + public void throwChecked(Person person) throws CheckedException; + public void throwUnChecked(Person person); } diff --git a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java index 1c8a27d772..0c76c01362 100644 --- a/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java +++ b/branches/sca-java-1.x/itest/jms-format/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java @@ -18,7 +18,6 @@ */ package org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; - public class HelloWorldServiceImpl implements HelloWorldService { public Person getPersonGreetings(Person person){ @@ -52,5 +51,13 @@ public class HelloWorldServiceImpl implements HelloWorldService { public String getObjectArrayGreeting(Object[] person) { return "Hello7 " + ((Person)person[0]).getFirstName() + " " + ((Person)person[0]).getLastName(); } + + public void throwChecked(Person person) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(Person person) { + throw new RuntimeException("bla"); + } } -- cgit v1.2.3