cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1519442 - in /cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs: BookServer20.java JAXRS20ClientServerBookTest.java
Date Mon, 02 Sep 2013 14:07:31 GMT
Author: sergeyb
Date: Mon Sep  2 14:07:30 2013
New Revision: 1519442

URL: http://svn.apache.org/r1519442
Log:
[CXF-5249] Adding a test where the request method is checked in container filter

Modified:
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java?rev=1519442&r1=1519441&r2=1519442&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer20.java
Mon Sep  2 14:07:30 2013
@@ -143,6 +143,10 @@ public class BookServer20 extends Abstra
             
             MediaType mt = context.getMediaType();
             if (mt != null && mt.toString().equals("text/xml")) {
+                String method = context.getMethod();
+                if ("PUT".equals(method)) {
+                    context.setMethod("POST");
+                }
                 context.getHeaders().putSingle("Content-Type", "application/xml");
             }
             List<MediaType> acceptTypes = context.getAcceptableMediaTypes();

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java?rev=1519442&r1=1519441&r2=1519442&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
Mon Sep  2 14:07:30 2013
@@ -289,6 +289,18 @@ public class JAXRS20ClientServerBookTest
     }
     
     @Test
+    public void testReplaceBookMistypedCTAndHttpVerb() throws Exception {
+        
+        String endpointAddress = "http://localhost:" + PORT + "/bookstore/books2"; 
+        WebClient wc = WebClient.create(endpointAddress,
+                                        Collections.singletonList(new ReplaceBodyFilter()));
+        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(1000000L);
+        wc.accept("text/mistypedxml").type("text/xml");
+        Book book = wc.put(new Book("book", 555L), Book.class);
+        assertEquals(561L, book.getId());
+    }
+    
+    @Test
     public void testPostGetCollectionGenericEntityAndType() throws Exception {
         
         String endpointAddress =



Mime
View raw message