From 65c3feca2a71d47333d4aa53db482a07f6f4cf0f Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 10 Dec 2009 11:50:26 +0000 Subject: Add exceptions back into test case so that runtime errors are reported back to the outside world. Change the two nodes test case back to how it was to take account of it. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@889211 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/itest/nodes/HelloworldImpl.java | 9 ++------- .../helloworld-iface/src/main/java/itest/nodes/Helloworld.java | 2 +- .../src/test/java/itest/StopStartNodesTestCase.java | 8 +++++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/sca-java-2.x/trunk/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java b/sca-java-2.x/trunk/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java index c9bd11b3d9..2619dc269b 100644 --- a/sca-java-2.x/trunk/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java +++ b/sca-java-2.x/trunk/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java @@ -32,17 +32,12 @@ public class HelloworldImpl implements Helloworld { public Helloworld service; @Init - public void initialize(){ + public void initialize() throws Exception{ System.out.println(">>>>>> " + sayHello("init")); } - public String sayHello(String name) { - try { + public String sayHello(String name) throws Exception { return "Hi " + service.sayHello(name); - } catch (Exception e) { - e.printStackTrace(); - return e.getMessage(); - } } } diff --git a/sca-java-2.x/trunk/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java b/sca-java-2.x/trunk/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java index 76f8d4400d..a0710281c9 100644 --- a/sca-java-2.x/trunk/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java +++ b/sca-java-2.x/trunk/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java @@ -24,6 +24,6 @@ import org.oasisopen.sca.annotation.Remotable; @Remotable public interface Helloworld { - String sayHello(String name); + String sayHello(String name) throws Exception; } diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java b/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java index beb38929ca..998492734b 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java @@ -61,7 +61,13 @@ public class StopStartNodesTestCase { client = clientNode.getService(Helloworld.class, "HelloworldClient"); assertNotNull(client); - assertEquals(true, client.sayHello("Petra").startsWith("Unable to bind")); + try { + client.sayHello("Petra"); + fail(); + } catch (Exception e) { + // expected + // TODO: better exception than NPE + } serviceNode = factory.createNode(new Contribution("service", getJar("../helloworld-service/target"))); serviceNode.start(); -- cgit v1.2.3