summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-03-29 05:29:23 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-03-29 05:29:23 +0000
commit0b7e1327b4c79940f7626e9127ae213a76540eb4 (patch)
tree345b6bb68448755c937b08d81395a102addbd960 /sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany
parent3f309fc3c335346e601458b65949f5efcba467c2 (diff)
TUSCANY-3516 - Adding support for invoking JSON-RPC services via GET HTTP method
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@928594 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java24
1 files changed, 23 insertions, 1 deletions
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 946cd60745..7c6ba6a99f 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
@@ -19,9 +19,11 @@
package org.apache.tuscany.sca.binding.jsonrpc;
import java.io.ByteArrayInputStream;
+import java.net.URLEncoder;
import junit.framework.Assert;
+import org.apache.axiom.om.util.Base64;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
@@ -31,6 +33,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.PostMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
@@ -75,5 +78,24 @@ 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());
+ String queryString = "?method=echo&params=" + URLEncoder.encode(params,"UTF-8") + "&id=1";
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest(SERVICE_URL + queryString);
+ WebResponse response = wc.getResource(request);
+
+ Assert.assertEquals(200, response.getResponseCode());
+
+ JSONObject jsonResp = new JSONObject(response.getText());
+ Assert.assertEquals("echo: Hello JSON-RPC", jsonResp.getString("result"));
+ }
+
+
+
+
} \ No newline at end of file