summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java4
-rw-r--r--sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java5
-rw-r--r--sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java5
-rw-r--r--sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTestCase.java16
-rw-r--r--sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java22
5 files changed, 44 insertions, 8 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
index 65c2cd3bf6..bb47b9e795 100644
--- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
+++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
@@ -39,7 +39,9 @@ import bean.TestBean;
public interface Echo {
String echo(String msg);
-
+
+ void echoVoid();
+
void echoRuntimeException() throws RuntimeException;
void echoBusinessException() throws EchoBusinessException;
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java
index 66c82aaba3..9a2d41146e 100644
--- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java
+++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoClientImpl.java
@@ -38,6 +38,10 @@ public class EchoClientImpl implements Echo {
public String echo(String msg) {
return echoReference.echo(msg);
}
+
+ public void echoVoid() {
+ echoReference.echoVoid();
+ }
public int[] echoArrayInt(int[] intArray) {
throw new UnsupportedOperationException("UNsupported !");
@@ -90,5 +94,4 @@ public class EchoClientImpl implements Echo {
public BigDecimal echoBigDecimal(BigDecimal param) {
throw new UnsupportedOperationException("UNsupported !");
}
-
}
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
index 8214d7ad70..b8b63906b9 100644
--- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
+++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
@@ -41,6 +41,11 @@ public class EchoComponentImpl implements Echo {
return "echo: " + msg;
}
+
+ public void echoVoid() {
+ System.out.println("Echo: VOID");
+ }
+
public void echoBusinessException() throws EchoBusinessException {
throw new EchoBusinessException("Business Exception");
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 efdb0a23db..c639d3eef7 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
@@ -67,4 +67,20 @@ public class JSONRPCReferenceTestCase {
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();
+ }
+ }
}
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
index 7c6ba6a99f..8b8d689b0e 100644
--- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
+++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
@@ -42,7 +42,7 @@ import com.meterware.httpunit.WebResponse;
/**
* @version $Rev$ $Date$
*/
-public class JSONRPCServiceTestCase{
+public class JSONRPCServiceTestCase {
private static final String SERVICE_PATH = "/EchoService";
@@ -67,7 +67,7 @@ public class JSONRPCServiceTestCase{
}
@Test
- public void testJSONRPCBinding() throws Exception {
+ public void testEchoWithJSONRPCBinding() throws Exception {
JSONObject jsonRequest = new JSONObject("{ \"method\": \"echo\", \"params\": [\"Hello JSON-RPC\"], \"id\": 1}");
WebConversation wc = new WebConversation();
@@ -79,7 +79,7 @@ public class JSONRPCServiceTestCase{
JSONObject jsonResp = new JSONObject(response.getText());
Assert.assertEquals("echo: Hello JSON-RPC", jsonResp.getString("result"));
}
-
+
@Test
public void testJSONRPCBindingGET() throws Exception {
String params = Base64.encode("[\"Hello JSON-RPC\"]".getBytes());
@@ -95,7 +95,17 @@ public class JSONRPCServiceTestCase{
Assert.assertEquals("echo: Hello JSON-RPC", jsonResp.getString("result"));
}
-
-
-
+ @Test
+ public void testEchoVoidWithJSONRPCBinding() throws Exception {
+ JSONObject jsonRequest = new JSONObject("{ \"method\": \"echoVoid\", \"params\": [], \"id\": 1}");
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new PostMethodWebRequest( SERVICE_URL, new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json");
+ WebResponse response = wc.getResource(request);
+
+ Assert.assertEquals(200, response.getResponseCode());
+
+ JSONObject jsonResp = new JSONObject(response.getText());
+ Assert.assertEquals(0, jsonResp.getString("result").length());
+ }
} \ No newline at end of file