Author: lresende
Date: Mon Aug  4 12:21:37 2008
New Revision: 682472

URL: http://svn.apache.org/viewvc?rev=682472&view=rev
Log:
TUSCANY-2487 - Making interfaces remotable and other small fixes.

Modified:
    
tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.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/echo/Echo.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java?rev=682472&r1=682471&r2=682472&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 
Mon Aug  4 12:21:37 2008
@@ -25,6 +25,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.osoa.sca.annotations.Remotable;
+
 import bean.TestBean;
 
 /**
@@ -32,6 +34,7 @@
  * 
  * @version $Rev$ $Date$
  */
[EMAIL PROTECTED]
 public interface Echo {
     
     String echo(String msg);

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=682472&r1=682471&r2=682472&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
 Mon Aug  4 12:21:37 2008
@@ -26,7 +26,6 @@
 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;
@@ -37,113 +36,122 @@
 /**
  * @version $Rev$ $Date$
  */
-public class JSONRPCDataTypeTestCase{
+public class JSONRPCDataTypeTestCase {
 
-    private static final String SERVICE_PATH = "/EchoService";
+       private static final String SERVICE_PATH = "/EchoService";
+       private static final String SERVICE_URL = 
"http://localhost:8085/SCADomain"; + SERVICE_PATH;
+       private SCADomain domain;
 
-    private static final String SERVICE_URL = 
"http://localhost:8085/SCADomain"; + SERVICE_PATH;
+       @Before
+       public void setUp() throws Exception {
+               domain = SCADomain.newInstance("JSONRPCBinding.composite");
+       }
 
-    private SCADomain domain;
+       @After
+       public void tearDown() throws Exception {
+               domain.close();
+       }
 
-    @Before
-    public void setUp() throws Exception {
-        domain = SCADomain.newInstance("JSONRPCBinding.composite");
-    }
-
-    @After
-    public void tearDown() throws Exception {
-       domain.close();
-    }    
-    
-   @Test
-    public void testInt() throws Exception {
-        JSONObject jsonRequest = new JSONObject("{ \"method\": \"echoInt\", 
\"params\": [12345], \"id\": 4}");
-        
-        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(12345, jsonResp.getInt("result"));
-    }
-    
-   @Test 
-   public void testBoolean() throws Exception {
-        JSONObject jsonRequest = new JSONObject("{ \"method\": 
\"echoBoolean\", \"params\": [true], \"id\": 5}");
-        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(true, jsonResp.getBoolean("result"));
-    }
-    
-    @Ignore("TUSCANY-2488")
-    public void testMap() throws Exception {
-       JSONObject jsonRequest = new JSONObject("{ \"method\": \"echoMap\", 
\"params\": [ {\"javaClass\": \"java.util.HashMap\", \"map\": { \"Binding\": 
\"JSON-RPC\"}}], \"id\": 6}");
-       
-       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").getJSONObject("map").getString("name"));
-    }
-    
-    @Ignore("TUSCANY-2488")
-    public void testList() throws Exception {
-       JSONObject jsonRequest = new JSONObject("{ \"method\": \"echoList\", 
\"params\": [ {\"javaClass\": \"java.util.ArrayList\", \"list\": [0,1,2,3,4]}], 
\"id\": 8}");      
-       
-       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.getJSONObject("result").getJSONArray("list").get(0));
-    }
-    
-    @Ignore("TUSCANY-2488")
-    public void testSet() throws Exception {
-       JSONObject jsonRequest = new JSONObject("{ \"method\": \"echoSet\", 
\"params\": [ {\"javaClass\": \"java.util.HashSet\", \"set\": {\"1\": \"red\", 
\"2\": \"blue\"}}],\"id\": 9}");     
-       
-       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.getJSONObject("result").getJSONObject("set").getString("red"));
-    }
-        
-    @Ignore("TUSCANY-2488")
-    public void testBean() throws Exception {
-       JSONObject jsonRequest = new JSONObject("{ \"method\": \"echoBean\", 
\"params\": [ {\"javaClass\": 
\"org.apache.tuscany.sca.binding.jsonrpc.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 testInt() throws Exception {
+               JSONObject jsonRequest = new JSONObject(
+                               "{ \"method\": \"echoInt\", \"params\": 
[12345], \"id\": 4}");
+
+               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(12345, jsonResp.getInt("result"));
+       }
+
+       @Test
+       public void testBoolean() throws Exception {
+               JSONObject jsonRequest = new JSONObject(
+                               "{ \"method\": \"echoBoolean\", \"params\": 
[true], \"id\": 5}");
+               
+               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(true, jsonResp.getBoolean("result"));
+       }
+
+       @Test
+       public void testMap() throws Exception {
+               JSONObject jsonRequest = new JSONObject(
+                               "{ \"method\": \"echoMap\", \"params\": [ 
{\"javaClass\": \"java.util.HashMap\", \"map\": { \"Binding\": \"JSON-RPC\"}}], 
\"id\": 6}");
+
+               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").getJSONObject("map").getString("Binding"));
+       }
+
+       @Test
+       public void testList() throws Exception {
+               JSONObject jsonRequest = new JSONObject(
+                               "{ \"method\": \"echoList\", \"params\": [ 
{\"javaClass\": \"java.util.ArrayList\", \"list\": [0,1,2,3,4]}], \"id\": 8}");
+
+               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.getJSONObject("result").getJSONArray("list").get(0));
+       }
+
+       @Test
+       public void testSet() throws Exception {
+               JSONObject jsonRequest = new JSONObject(
+                               "{ \"method\": \"echoSet\", \"params\": [ 
{\"javaClass\": \"java.util.HashSet\", \"set\": {\"1\": \"red\", \"2\": 
\"blue\"}}],\"id\": 9}");
+
+               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("red", 
jsonResp.getJSONObject("result").getJSONObject("set").getString("red"));
+       }
+
+       @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"));
+       }
 
-    
 }
\ No newline at end of file


Reply via email to