cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1497789 - in /cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs: BookStore.java JAXRSClientServerBookTest.java
Date Fri, 28 Jun 2013 14:29:37 GMT
Author: sergeyb
Date: Fri Jun 28 14:29:37 2013
New Revision: 1497789

URL: http://svn.apache.org/r1497789
Log:
[CXF-5050] Adding a test which posts an empty form

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=1497789&r1=1497788&r2=1497789&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 Fri
Jun 28 14:29:37 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;
@@ -150,6 +151,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/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=1497789&r1=1497788&r2=1497789&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
Fri Jun 28 14:29:37 2013
@@ -38,6 +38,7 @@ import javax.ws.rs.ProcessingException;
 import javax.ws.rs.ServerErrorException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.core.Form;
 import javax.ws.rs.core.GenericEntity;
 import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.HttpHeaders;
@@ -91,7 +92,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() {



Mime
View raw message