Author: lresende
Date: Tue May  5 23:13:19 2009
New Revision: 772008

URL: http://svn.apache.org/viewvc?rev=772008&view=rev
Log:
Small clean up and formatting on tests

Modified:
    
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCDataTypeTestCase.java
    
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCExceptionTestCase.java
    
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java

Modified: 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCDataTypeTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCDataTypeTestCase.java?rev=772008&r1=772007&r2=772008&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCDataTypeTestCase.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCDataTypeTestCase.java
 Tue May  5 23:13:19 2009
@@ -26,7 +26,6 @@
 import org.json.JSONObject;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import com.meterware.httpunit.PostMethodWebRequest;
@@ -39,169 +38,156 @@
  */
 public class JSONRPCDataTypeTestCase {
 
-       private static final String SERVICE_PATH = "/EchoService";
-       private static final String SERVICE_URL = "http://localhost:8085/"; + 
SERVICE_PATH;
-       
-       private static SCADomain domain;
-
-       @BeforeClass
-       public static void setUp() throws Exception {
-           domain = 
SCADomain.newInstance("org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCBinding.composite");
-       }
-
-       @AfterClass
-       public static void tearDown() throws Exception {
-               domain.close();
-       }
-
-       @Test
-       //@Ignore("Work in progress")
-       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
-        //@Ignore("Work in progress")
-       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
-        //@Ignore("Work in progress")
-       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
-        //@Ignore("Work in progress")
-       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
-        //@Ignore("Work in progress")
-       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
-        //@Ignore("Work in progress")
-       public void testArrayString() throws Exception {
-               JSONObject jsonRequest = new JSONObject(
-                               
"{\"params\":[[\"1\",\"2\"]],\"method\":\"echoArrayString\",\"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(1, 
jsonResp.getJSONArray("result").getInt(0));
-       }       
-
-       
-        @Test
-        //@Ignore("Work in progress")
-       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
-        //@Ignore("Work in progress")
-       public void testSet() throws Exception {
-               JSONObject jsonRequest = new JSONObject(
-                               "{ \"method\": \"echoSet\", \"params\": [ 
{\"javaClass\": \"java.util.HashSet\", \"set\": {\"1\": \"red\", \"2\": 
\"blue\"}}],\"id\": 11}");
-
-               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 testDummy() throws Exception {
-            
-        }
+    private static final String SERVICE_PATH = "/EchoService";
+    private static final String SERVICE_URL = "http://localhost:8085/"; + 
SERVICE_PATH;
+
+    private static SCADomain domain;
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        domain = 
SCADomain.newInstance("org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCBinding.composite");
+    }
+
+    @AfterClass
+    public static 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"));
+    }
+
+    @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 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 {
+        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 testArrayString() throws Exception {
+        JSONObject jsonRequest = new JSONObject(
+            
"{\"params\":[[\"1\",\"2\"]],\"method\":\"echoArrayString\",\"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(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\": 
11}");
+
+        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"));
+    }
 }
\ No newline at end of file

Modified: 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCExceptionTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCExceptionTestCase.java?rev=772008&r1=772007&r2=772008&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCExceptionTestCase.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCExceptionTestCase.java
 Tue May  5 23:13:19 2009
@@ -26,7 +26,6 @@
 import org.json.JSONObject;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import com.meterware.httpunit.PostMethodWebRequest;
@@ -56,7 +55,6 @@
     }
     
     @Test
-    //@Ignore("Work in progress")
     public void testRuntimeException() throws Exception{
        JSONObject jsonRequest = new JSONObject("{ \"method\": 
\"echoRuntimeException\", \"params\": [], \"id\": 2}");
        
@@ -72,7 +70,6 @@
     }
     
     @Test
-    //@Ignore("Work in progress")
     public void testBusinessException() throws Exception{
        JSONObject jsonRequest = new JSONObject("{ \"method\": 
\"echoBusinessException\", \"params\": [], \"id\": 3}");
        
@@ -85,10 +82,5 @@
         JSONObject jsonErr = new 
JSONObject(response.getText()).getJSONObject("error");
         
         Assert.assertEquals("Business Exception", jsonErr.getString("msg"));
-    }   
-    
-    @Test
-    public void testDummy() throws Exception {
-        
-    }    
+    }
 }
\ No newline at end of file

Modified: 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java?rev=772008&r1=772007&r2=772008&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/itest/http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCServiceTestCase.java
 Tue May  5 23:13:19 2009
@@ -26,7 +26,6 @@
 import org.json.JSONObject;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import com.meterware.httpunit.PostMethodWebRequest;
@@ -56,7 +55,6 @@
     }
 
     @Test
-    //@Ignore("Work in progress")
     public void testJSONRPCBinding() throws Exception {
         JSONObject jsonRequest = new JSONObject("{ \"method\": \"echo\", 
\"params\": [\"Hello JSON-RPC\"], \"id\": 1}");
 
@@ -68,10 +66,5 @@
 
         JSONObject jsonResp = new JSONObject(response.getText());
         Assert.assertEquals("echo: Hello JSON-RPC", 
jsonResp.getString("result"));
-    }   
-
-    @Test
-    public void testDummy() throws Exception {
-
-    }    
+    }
 }
\ No newline at end of file


Reply via email to