From 2b352583c7661d623835194472a0ad8c0cd1bb61 Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 1 Oct 2009 04:04:27 +0000 Subject: Bringin up JSON-RPC binding test cases git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820527 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding-jsonrpc-runtime/META-INF/MANIFEST.MF | 1 + java/sca/modules/binding-jsonrpc-runtime/pom.xml | 7 +++++ .../binding/jsonrpc/JSONRPCDataTypeTestCase.java | 34 ++++++++++++++-------- .../binding/jsonrpc/JSONRPCExceptionTestCase.java | 34 ++++++++++++++-------- .../binding/jsonrpc/JSONRPCServiceTestCase.java | 34 ++++++++++++++-------- .../sca/binding/jsonrpc/JSONRPCSmdTestCase.java | 32 ++++++++++++-------- 6 files changed, 94 insertions(+), 48 deletions(-) (limited to 'java') diff --git a/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF b/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF index 83eacb797d..856417a3ca 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF +++ b/java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF @@ -26,6 +26,7 @@ Import-Package: com.metaparadigm.jsonrpc;version="1.0.0", org.apache.tuscany.sca.interfacedef.java;version="2.0.0", org.apache.tuscany.sca.invocation, org.apache.tuscany.sca.monitor;version="2.0", + org.apache.tuscany.sca.node;version="2.0.0", org.apache.tuscany.sca.provider, org.apache.tuscany.sca.runtime, org.json;version="1.0.0", diff --git a/java/sca/modules/binding-jsonrpc-runtime/pom.xml b/java/sca/modules/binding-jsonrpc-runtime/pom.xml index f5eba7af6a..34f620068e 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/pom.xml +++ b/java/sca/modules/binding-jsonrpc-runtime/pom.xml @@ -104,6 +104,13 @@ + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + test + + org.apache.tuscany.sca tuscany-implementation-java-runtime diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java b/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java index 6d156fcdf5..80694484d9 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java +++ b/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java @@ -22,11 +22,13 @@ import java.io.ByteArrayInputStream; import junit.framework.Assert; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; import org.json.JSONObject; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import com.meterware.httpunit.PostMethodWebRequest; @@ -41,16 +43,24 @@ public class JSONRPCDataTypeTestCase { private static final String SERVICE_PATH = "/EchoService"; private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH; - private SCADomain domain; - - @Before - public void setUp() throws Exception { - domain = SCADomain.newInstance("JSONRPCBinding.composite"); + + private static Node node; + + @BeforeClass + public static void setUp() throws Exception { + try { + String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCDataTypeTestCase.class); + node = NodeFactory.newInstance().createNode("JSONRPCBinding.composite", new Contribution("test", contribution)); + node.start(); + } catch (Exception e) { + e.printStackTrace(); + } } - @After - public void tearDown() throws Exception { - domain.close(); + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + node.destroy(); } @Test diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java b/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java index 52518e1bbc..42fb446aee 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java +++ b/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java @@ -22,10 +22,13 @@ import java.io.ByteArrayInputStream; import junit.framework.Assert; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; import org.json.JSONObject; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import com.meterware.httpunit.PostMethodWebRequest; @@ -42,17 +45,24 @@ public class JSONRPCExceptionTestCase{ private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH; - private SCADomain domain; + private static Node node; - @Before - public void setUp() throws Exception { - domain = SCADomain.newInstance("JSONRPCBinding.composite"); - } + @BeforeClass + public static void setUp() throws Exception { + try { + String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCExceptionTestCase.class); + node = NodeFactory.newInstance().createNode("JSONRPCBinding.composite", new Contribution("test", contribution)); + node.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } - @After - public void tearDown() throws Exception { - domain.close(); - } + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + node.destroy(); + } @Test public void testRuntimeException() throws Exception{ diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java b/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java index 67d3eda6b2..e0c8acd120 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java +++ b/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java @@ -22,10 +22,13 @@ import java.io.ByteArrayInputStream; import junit.framework.Assert; -import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; import org.json.JSONObject; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import com.meterware.httpunit.PostMethodWebRequest; @@ -42,17 +45,24 @@ public class JSONRPCServiceTestCase{ private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH; - private SCADomain domain; + private static Node node; - @Before - public void setUp() throws Exception { - domain = SCADomain.newInstance("JSONRPCBinding.composite"); - } + @BeforeClass + public static void setUp() throws Exception { + try { + String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCServiceTestCase.class); + node = NodeFactory.newInstance().createNode("JSONRPCBinding.composite", new Contribution("test", contribution)); + node.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } - @After - public void tearDown() throws Exception { - domain.close(); - } + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + node.destroy(); + } @Test public void testJSONRPCBinding() throws Exception { diff --git a/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java b/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java index 64c2dd31f2..bbaddb5fbb 100644 --- a/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java +++ b/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java @@ -21,10 +21,11 @@ package org.apache.tuscany.sca.binding.jsonrpc; import junit.framework.Assert; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; import org.junit.AfterClass; -import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -44,17 +45,24 @@ public class JSONRPCSmdTestCase { private static final String SMD_URL = SERVICE_URL + "?smd"; - private static SCADomain domain; + private static Node node; - @Before - public void setUp() throws Exception { - domain = SCADomain.newInstance("JSONRPCBinding.composite"); - } + @BeforeClass + public static void setUp() throws Exception { + try { + String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCSmdTestCase.class); + node = NodeFactory.newInstance().createNode("JSONRPCBinding.composite", new Contribution("test", contribution)); + node.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } - @After - public void tearDown() throws Exception { - domain.close(); - } + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + node.destroy(); + } @Test /** -- cgit v1.2.3