You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2011/02/09 14:06:09 UTC

svn commit: r1068877 - in /cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs: BookStore.java JAXRSClientServerBookTest.java

Author: sergeyb
Date: Wed Feb  9 13:06:09 2011
New Revision: 1068877

URL: http://svn.apache.org/viewvc?rev=1068877&view=rev
Log:
[CXF-3304] Disabling the chunking lets retrieve the text of the 401 response

Modified:
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1068877&r1=1068876&r2=1068877&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Wed Feb  9 13:06:09 2011
@@ -224,6 +224,12 @@ public class BookStore {
     }
     
     @POST
+    @Path("post401")
+    public Response get401WithText() throws Exception {
+        return Response.status(401).entity("This is 401").build();
+    }
+    
+    @POST
     @Path("/collections")
     @Produces({"application/xml", "application/json" })
     @Consumes({"application/xml", "application/json" })

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1068877&r1=1068876&r2=1068877&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Wed Feb  9 13:06:09 2011
@@ -66,6 +66,17 @@ public class JAXRSClientServerBookTest e
                    launchServer(BookServer.class));
     }
     
+    @Test
+    public void testPostAnd401WithText() throws Exception {
+        
+        String endpointAddress =
+            "http://localhost:" + PORT + "/bookstore/post401"; 
+        WebClient wc = WebClient.create(endpointAddress);
+        WebClient.getConfig(wc).getHttpConduit().getClient().setAllowChunking(false);
+        Response r = wc.post(null);
+        assertEquals(401, r.getStatus());
+        assertEquals("This is 401", getStringFromInputStream((InputStream)r.getEntity()));
+    }
 
     @Test
     public void testGetCollectionOfBooks() throws Exception {