diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-30 05:38:01 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-30 05:38:01 +0000 |
commit | ea66dbe56f131834dc6d71a00e7c0bea93e9404b (patch) | |
tree | 9c37aea19f1132c8229eb9483cf4ebdf238c316c /sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache | |
parent | 3fed38d9212456b95c410b0e1b9d7275dadb0b5d (diff) |
TUSCANY-3516 - Merging changes from 2.x to enable calling services exposed with JSON-RPC binding using GET method and properly handling HTTP Headers such eTags when usig GET method
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@928999 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache')
-rw-r--r-- | sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java b/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java index 67d3eda6b2..5f902fd40c 100644 --- a/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java +++ b/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java @@ -19,15 +19,18 @@ 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.host.embedded.SCADomain; import org.json.JSONObject; import org.junit.After; import org.junit.Before; import org.junit.Test; +import com.meterware.httpunit.GetMethodWebRequest; import com.meterware.httpunit.PostMethodWebRequest; import com.meterware.httpunit.WebConversation; import com.meterware.httpunit.WebRequest; @@ -66,5 +69,20 @@ 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¶ms=" + 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 |