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 2013/06/28 16:32:58 UTC

svn commit: r1497791 - in /cxf/branches/2.7.x-fixes: ./ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Author: sergeyb
Date: Fri Jun 28 14:32:58 2013
New Revision: 1497791

URL: http://svn.apache.org/r1497791
Log:
Merged revisions 1497789 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1497789 | sergeyb | 2013-06-28 15:29:37 +0100 (Fri, 28 Jun 2013) | 1 line
  
  [CXF-5050] Adding a test which posts an empty form
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1497789

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=1497791&r1=1497790&r2=1497791&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Fri Jun 28 14:32:58 2013
@@ -59,6 +59,7 @@ import javax.ws.rs.container.ResourceCon
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Cookie;
 import javax.ws.rs.core.EntityTag;
+import javax.ws.rs.core.Form;
 import javax.ws.rs.core.GenericEntity;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
@@ -149,6 +150,17 @@ public class BookStore {
         return doGetBook("123");
     }
     
+    @POST
+    @Path("/emptyform")
+    @Produces("text/plain")
+    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+    public String postEmptyForm(Form form) {
+        if (!form.asMap().isEmpty()) {
+            throw new WebApplicationException(400);
+        }
+        return "empty form";
+    }
+    
     @GET
     @Path("/booknames/123")
     @Produces("application/bar")

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1497791&r1=1497790&r2=1497791&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Fri Jun 28 14:32:58 2013
@@ -37,6 +37,7 @@ import javax.ws.rs.NotAcceptableExceptio
 import javax.ws.rs.ServerErrorException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.client.ClientException;
+import javax.ws.rs.core.Form;
 import javax.ws.rs.core.GenericEntity;
 import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.HttpHeaders;
@@ -90,7 +91,13 @@ public class JAXRSClientServerBookTest e
         createStaticBus();
     }
     
-
+    @Test
+    public void testPostEmptyForm() throws Exception {
+        String address = "http://localhost:" + PORT + "/bookstore/emptyform";
+        WebClient wc = WebClient.create(address);
+        Response r = wc.form(new Form());
+        assertEquals("empty form", r.readEntity(String.class));
+    }
 
     @Test
     public void testGetCustomBookResponse() {