You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/11/02 05:38:54 UTC

svn commit: r591221 - in /incubator/cxf/trunk: distribution/manifest/ systests/src/test/java/org/apache/cxf/systest/jaxrs/

Author: jliu
Date: Thu Nov  1 21:38:53 2007
New Revision: 591221

URL: http://svn.apache.org/viewvc?rev=591221&view=rev
Log:
Some trivial updates

Modified:
    incubator/cxf/trunk/distribution/manifest/pom.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerFromResourceInstanceBookTest.java

Modified: incubator/cxf/trunk/distribution/manifest/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/manifest/pom.xml?rev=591221&r1=591220&r2=591221&view=diff
==============================================================================
--- incubator/cxf/trunk/distribution/manifest/pom.xml (original)
+++ incubator/cxf/trunk/distribution/manifest/pom.xml Thu Nov  1 21:38:53 2007
@@ -230,9 +230,8 @@
             <artifactId>asm</artifactId>
         </dependency>
         <dependency>
-	    <groupId>commons-httpclient</groupId>
-	    <artifactId>commons-httpclient</artifactId>
-	    <version>3.1-rc1</version>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
         </dependency>        
     </dependencies>
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=591221&r1=591220&r2=591221&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Thu Nov  1 21:38:53 2007
@@ -20,14 +20,12 @@
 package org.apache.cxf.systest.jaxrs;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
 import java.net.URL;
 
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.FileRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.PutMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.cxf.helpers.IOUtils;
@@ -59,49 +57,6 @@
     }
     
     @Test
-    public void testAddBookHTTPURL() throws Exception {        
-        String endpointAddress =
-            "http://localhost:9080/bookstore/books";
-
-        URL url = new URL(endpointAddress);   
-        HttpURLConnection httpUrlConnection = (HttpURLConnection)url.openConnection();  
-             
-        httpUrlConnection.setUseCaches(false);   
-        httpUrlConnection.setDefaultUseCaches(false);   
-        httpUrlConnection.setDoOutput(true);   
-        httpUrlConnection.setDoInput(true);   
-        httpUrlConnection.setRequestMethod("POST");   
-        httpUrlConnection.setRequestProperty("Accept",   "text/html");   
-        httpUrlConnection.setRequestProperty("Content-type",   "text/html");   
-        httpUrlConnection.setRequestProperty("Connection",   "close");   
-        //httpurlconnection.setRequestProperty("Content-Length",   String.valueOf(is.available()));   
-
-        OutputStream outputstream = httpUrlConnection.getOutputStream();
-        String inputFile = getClass().getResource("resources/add_book.txt").getFile();         
-         
-        byte[] tmp = new byte[4096];
-        int i = 0;
-        InputStream instream = new FileInputStream(inputFile);
-        try {
-            while ((i = instream.read(tmp)) >= 0) {
-                outputstream.write(tmp, 0, i);
-            }
-        } finally {
-            instream.close();
-        }
-
-        outputstream.flush();
-
-        int responseCode = httpUrlConnection.getResponseCode();   
-        assertEquals(200, responseCode);
-        
-        InputStream expected = getClass().getResourceAsStream("resources/expected_add_book.txt"); 
-        assertEquals(getStringFromInputStream(expected), getStringFromInputStream(httpUrlConnection
-            .getInputStream()));  
-        httpUrlConnection.disconnect();        
-    }  
-    
-/*    @Test
     public void testAddBook() throws Exception {
         String endpointAddress =
             "http://localhost:9080/bookstore/books";
@@ -127,7 +82,7 @@
             // Release current connection to the connection pool once you are done
             post.releaseConnection();
         }               
-    }*/  
+    }  
     
     @Test
     public void testUpdateBook() throws Exception {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerFromResourceInstanceBookTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerFromResourceInstanceBookTest.java?rev=591221&r1=591220&r2=591221&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerFromResourceInstanceBookTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerFromResourceInstanceBookTest.java Thu Nov  1 21:38:53 2007
@@ -19,7 +19,10 @@
 
 package org.apache.cxf.systest.jaxrs;
 
+import java.io.FileInputStream;
 import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
 import java.net.URL;
 
 import org.apache.cxf.helpers.IOUtils;
@@ -49,7 +52,50 @@
 
         assertEquals(getStringFromInputStream(expected), getStringFromInputStream(in)); 
     }
+    
+    @Test
+    public void testAddBookHTTPURL() throws Exception {        
+        String endpointAddress =
+            "http://localhost:9080/bookstore/books";
+
+        URL url = new URL(endpointAddress);   
+        HttpURLConnection httpUrlConnection = (HttpURLConnection)url.openConnection();  
+             
+        httpUrlConnection.setUseCaches(false);   
+        httpUrlConnection.setDefaultUseCaches(false);   
+        httpUrlConnection.setDoOutput(true);   
+        httpUrlConnection.setDoInput(true);   
+        httpUrlConnection.setRequestMethod("POST");   
+        httpUrlConnection.setRequestProperty("Accept",   "text/html");   
+        httpUrlConnection.setRequestProperty("Content-type",   "text/html");   
+        httpUrlConnection.setRequestProperty("Connection",   "close");   
+        //httpurlconnection.setRequestProperty("Content-Length",   String.valueOf(is.available()));   
+
+        OutputStream outputstream = httpUrlConnection.getOutputStream();
+        String inputFile = getClass().getResource("resources/add_book.txt").getFile();         
+         
+        byte[] tmp = new byte[4096];
+        int i = 0;
+        InputStream is = new FileInputStream(inputFile);
+        try {
+            while ((i = is.read(tmp)) >= 0) {
+                outputstream.write(tmp, 0, i);
+            }
+        } finally {
+            is.close();
+        }
 
+        outputstream.flush();
+
+        int responseCode = httpUrlConnection.getResponseCode();   
+        assertEquals(200, responseCode);
+        
+        InputStream expected = getClass().getResourceAsStream("resources/expected_add_book.txt"); 
+        assertEquals(getStringFromInputStream(expected), getStringFromInputStream(httpUrlConnection
+            .getInputStream()));  
+        httpUrlConnection.disconnect();        
+    } 
+    
     private String getStringFromInputStream(InputStream in) throws Exception {        
         CachedOutputStream bos = new CachedOutputStream();
         IOUtils.copy(in, bos);