summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-10-01 04:04:27 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-10-01 04:04:27 +0000
commit2b352583c7661d623835194472a0ad8c0cd1bb61 (patch)
tree0ad2dbafc4d2c7f25f6d49e3bcb15ddfb5739740 /java
parent7c16d60836afd8196d68fdb979dec7bfd1330942 (diff)
Bringin up JSON-RPC binding test cases
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@820527 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/META-INF/MANIFEST.MF1
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/pom.xml7
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java34
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java34
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java34
-rw-r--r--java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java32
6 files changed, 94 insertions, 48 deletions
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
@@ -106,6 +106,13 @@
<!-- Test Dependencies -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>test</scope>
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
/**