diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-16 17:34:05 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-16 17:34:05 +0000 |
commit | 510339785280a70836958a2bf06354f576c7e322 (patch) | |
tree | a54f2748465e7da0644e33a87a41a6793e888dfb /sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java | |
parent | 562a484efbe0259642737f835cd6ece3c9ec7c17 (diff) |
Improved the SMD and error handling
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1171688 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java index c639d3eef7..3d817354bc 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java @@ -35,6 +35,7 @@ public class JSONRPCReferenceTestCase { private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH; private static Node nodeServer; + private static Node node; @BeforeClass public static void setUp() throws Exception { @@ -42,6 +43,11 @@ public class JSONRPCReferenceTestCase { String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCReferenceTestCase.class); nodeServer = NodeFactory.newInstance().createNode("JSONRPCBinding.composite", new Contribution("testServer", contribution)); nodeServer.start(); + + contribution = ContributionLocationHelper.getContributionLocation(JSONRPCReferenceTestCase.class); + node = NodeFactory.newInstance().createNode("JSONRPCReference.composite", new Contribution("testClient", contribution)); + node.start(); + } catch (Exception e) { e.printStackTrace(); } @@ -50,37 +56,31 @@ public class JSONRPCReferenceTestCase { @AfterClass public static void tearDown() throws Exception { nodeServer.stop(); + node.stop(); } @Test public void testInvokeReference() throws Exception { - Node node = null; - - String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCReferenceTestCase.class); - node = NodeFactory.newInstance().createNode("JSONRPCReference.composite", new Contribution("testClient", contribution)); - node.start(); - Echo echoComponent = node.getService(Echo.class,"EchoComponentWithReference"); String result = echoComponent.echo("ABC"); Assert.assertEquals("echo: ABC", result); - if (node != null) { - node.stop(); - } } @Test public void testInvokeReferenceVoidOperation() throws Exception { - Node node = null; - - String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCReferenceTestCase.class); - node = NodeFactory.newInstance().createNode("JSONRPCReference.composite", new Contribution("testClient", contribution)); - node.start(); - Echo echoComponent = node.getService(Echo.class,"EchoComponentWithReference"); echoComponent.echoVoid(); - - if (node != null) { - node.stop(); + } + + @Test(expected = Exception.class) + public void testInvokeReferenceException() throws Exception { + Echo echoComponent = node.getService(Echo.class, "EchoComponentWithReference"); + try { + echoComponent.echoBusinessException(); + } catch (Exception e) { + System.err.println(e); + throw e; } } + } |