tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r689394 - in /tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java: bean/TestBean.java echo/Echo.java echo/EchoComponentImpl.java org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java
Date Wed, 27 Aug 2008 07:19:01 GMT
Author: lresende
Date: Wed Aug 27 00:19:01 2008
New Revision: 689394

URL: http://svn.apache.org/viewvc?rev=689394&view=rev
Log:
Updating json-rpc binding test case to reproduce problems when passing an array to a function
invocation

Modified:
    tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.java
    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

Modified: tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.java?rev=689394&r1=689393&r2=689394&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.java (original)
+++ tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.java Wed
Aug 27 00:19:01 2008
@@ -20,7 +20,9 @@
 
 public class TestBean {
     private String testString;
+    private String[] testStringArray;
     private int testInt;
+    
 
     public String getTestString() {
         return testString;
@@ -30,6 +32,14 @@
         this.testString = testString;
     }
 
+    public String[] getTestStringArray() {
+    	return testStringArray;
+    }
+    
+    public void setStringArray(String[] stringArray) {
+    	this.testStringArray = stringArray;
+    }
+    
     public int getTestInt() {
         return testInt;
     }

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=689394&r1=689393&r2=689394&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 Wed Aug
27 00:19:01 2008
@@ -53,6 +53,8 @@
     
     List echoList(ArrayList list);
     
+    String [] echoArray(String[] stringArray);
+    
     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=689394&r1=689393&r2=689394&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
Wed Aug 27 00:19:01 2008
@@ -28,9 +28,6 @@
 
 import bean.TestBean;
 
-
-
-
 /**
  * A simple client component that uses a reference with an JSONRPC binding.
  * 
@@ -84,6 +81,10 @@
 		return list;
 	}
 	
+	public String[] echoArray(String[] stringArray) {
+		return stringArray;
+	}
+	
 	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=689394&r1=689393&r2=689394&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
Wed Aug 27 00:19:01 2008
@@ -26,6 +26,7 @@
 import org.json.JSONObject;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.meterware.httpunit.PostMethodWebRequest;
@@ -102,6 +103,23 @@
 
 		Assert.assertEquals("JSON-RPC", jsonResp.getJSONObject("result").getJSONObject("map").getString("Binding"));
 	}
+	
+	@Test
+	public void testBean() throws Exception {
+		JSONObject jsonRequest = new JSONObject(
+				"{ \"method\": \"echoBean\", \"params\": [ {\"javaClass\": \"bean.TestBean\", \"testString\":
\"JSON-RPC\", \"testInt\":1234}], \"id\": 7}");
+
+		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("JSON-RPC", jsonResp.getJSONObject("result").getString("testString"));
+	}	
 
 	@Test
 	public void testList() throws Exception {
@@ -119,11 +137,12 @@
 
 		Assert.assertEquals(0, jsonResp.getJSONObject("result").getJSONArray("list").get(0));
 	}
-
-	@Test
-	public void testSet() throws Exception {
+	
+	//@Test
+	@Ignore("TUSCANY-2565")
+	public void testArray() throws Exception {
 		JSONObject jsonRequest = new JSONObject(
-				"{ \"method\": \"echoSet\", \"params\": [ {\"javaClass\": \"java.util.HashSet\", \"set\":
{\"1\": \"red\", \"2\": \"blue\"}}],\"id\": 9}");
+				"{\"params\":[\"1\",\"2\"],\"method\":\"echoArray\",\"id\":9}");
 
 		WebConversation wc = new WebConversation();
 		WebRequest request = new PostMethodWebRequest(SERVICE_URL,
@@ -134,13 +153,13 @@
 
 		JSONObject jsonResp = new JSONObject(response.getText());
 
-		Assert.assertEquals("red", jsonResp.getJSONObject("result").getJSONObject("set").getString("red"));
-	}
+		Assert.assertEquals(0, jsonResp.getJSONObject("result").getJSONArray("list").get(0));
+	}	
 
 	@Test
-	public void testBean() throws Exception {
+	public void testSet() throws Exception {
 		JSONObject jsonRequest = new JSONObject(
-				"{ \"method\": \"echoBean\", \"params\": [ {\"javaClass\": \"bean.TestBean\", \"testString\":
\"JSON-RPC\", \"testInt\":1234}], \"id\": 7}");
+				"{ \"method\": \"echoSet\", \"params\": [ {\"javaClass\": \"java.util.HashSet\", \"set\":
{\"1\": \"red\", \"2\": \"blue\"}}],\"id\": 10}");
 
 		WebConversation wc = new WebConversation();
 		WebRequest request = new PostMethodWebRequest(SERVICE_URL,
@@ -151,7 +170,6 @@
 
 		JSONObject jsonResp = new JSONObject(response.getText());
 
-		Assert.assertEquals("JSON-RPC", jsonResp.getJSONObject("result").getString("testString"));
+		Assert.assertEquals("red", jsonResp.getJSONObject("result").getJSONObject("set").getString("red"));
 	}
-
 }
\ No newline at end of file



Mime
View raw message