tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r690089 - in /tuscany/java/sca/modules: binding-jsonrpc-runtime/src/test/java/echo/ binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/ databinding-json/src/main/resources/META-INF/services/
Date Fri, 29 Aug 2008 03:19:47 GMT
Author: lresende
Date: Thu Aug 28 20:19:47 2008
New Revision: 690089

URL: http://svn.apache.org/viewvc?rev=690089&view=rev
Log:
TUSCANY-2565 - Fixing issues when passing array parameter using json-rpc binding

Modified:
    tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
    tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
    tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java
    tuscany/java/sca/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer

Modified: tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java?rev=690089&r1=690088&r2=690089&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java (original)
+++ tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java Thu Aug
28 20:19:47 2008
@@ -53,7 +53,9 @@
     
     List echoList(ArrayList list);
     
-    String [] echoArray(String[] stringArray);
+    String [] echoArrayString(String[] stringArray);
+    
+    int [] echoArrayInt(int[] intArray);
     
     Set echoSet(HashSet set);
     

Modified: tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java?rev=690089&r1=690088&r2=690089&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
(original)
+++ tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
Thu Aug 28 20:19:47 2008
@@ -81,10 +81,14 @@
 		return list;
 	}
 	
-	public String[] echoArray(String[] stringArray) {
+	public String[] echoArrayString(String[] stringArray) {
 		return stringArray;
 	}
 	
+	public int[] echoArrayInt(int[] intArray) {
+		return intArray;
+	}
+	
 	public Set echoSet(HashSet param){
 		Set set = new HashSet();
 		set  = param;

Modified: tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java?rev=690089&r1=690088&r2=690089&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java
(original)
+++ tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java
Thu Aug 28 20:19:47 2008
@@ -138,11 +138,10 @@
 		Assert.assertEquals(0, jsonResp.getJSONObject("result").getJSONArray("list").get(0));
 	}
 	
-	//@Test
-	@Ignore("TUSCANY-2565")
-	public void testArray() throws Exception {
+	@Test
+	public void testArrayString() throws Exception {
 		JSONObject jsonRequest = new JSONObject(
-				"{\"params\":[\"1\",\"2\"],\"method\":\"echoArray\",\"id\":9}");
+				"{\"params\":[[\"1\",\"2\"]],\"method\":\"echoArrayString\",\"id\":9}");
 
 		WebConversation wc = new WebConversation();
 		WebRequest request = new PostMethodWebRequest(SERVICE_URL,
@@ -153,13 +152,32 @@
 
 		JSONObject jsonResp = new JSONObject(response.getText());
 
-		Assert.assertEquals(0, jsonResp.getJSONObject("result").getJSONArray("list").get(0));
+		Assert.assertEquals(1, jsonResp.getJSONArray("result").getInt(0));
+	}	
+
+	
+	@Test
+	public void testArrayInt() throws Exception {
+		JSONObject jsonRequest = new JSONObject(
+				"{\"params\":[[1,2]],\"method\":\"echoArrayInt\",\"id\":10}");
+
+		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(1, jsonResp.getJSONArray("result").getInt(0));
 	}	
 
+	
 	@Test
 	public void testSet() throws Exception {
 		JSONObject jsonRequest = new JSONObject(
-				"{ \"method\": \"echoSet\", \"params\": [ {\"javaClass\": \"java.util.HashSet\", \"set\":
{\"1\": \"red\", \"2\": \"blue\"}}],\"id\": 10}");
+				"{ \"method\": \"echoSet\", \"params\": [ {\"javaClass\": \"java.util.HashSet\", \"set\":
{\"1\": \"red\", \"2\": \"blue\"}}],\"id\": 11}");
 
 		WebConversation wc = new WebConversation();
 		WebRequest request = new PostMethodWebRequest(SERVICE_URL,

Modified: tuscany/java/sca/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer?rev=690089&r1=690088&r2=690089&view=diff
==============================================================================
--- tuscany/java/sca/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
(original)
+++ tuscany/java/sca/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
Thu Aug 28 20:19:47 2008
@@ -28,3 +28,4 @@
 org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=java:simpleType,weight=80000,public=false
 org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=commonj.sdo.DataObject,weight=80000,public=false
 org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=javax.xml.bind.JAXBElement,weight=80000,public=false
+org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=java:array,weight=80000,public=false



Mime
View raw message