cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1533052 - /cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
Date Thu, 17 Oct 2013 11:32:21 GMT
Author: sergeyb
Date: Thu Oct 17 11:32:21 2013
New Revision: 1533052

URL: http://svn.apache.org/r1533052
Log:
Updating JAXRS20 test to check methods in client filters

Modified:
    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/JAXRS20ClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java?rev=1533052&r1=1533051&r2=1533052&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
Thu Oct 17 11:32:21 2013
@@ -295,7 +295,7 @@ public class JAXRS20ClientServerBookTest
         WebClient wc = WebClient.create(endpointAddress,
                                         Collections.singletonList(new ReplaceBodyFilter()));
         WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(1000000L);
-        wc.accept("text/mistypedxml").type("text/xml");
+        wc.accept("text/mistypedxml").type("text/xml").header("THEMETHOD", "PUT");
         Book book = wc.put(new Book("book", 555L), Book.class);
         assertEquals(561L, book.getId());
     }
@@ -567,6 +567,19 @@ public class JAXRS20ClientServerBookTest
 
         @Override
         public void filter(ClientRequestContext rc) throws IOException {
+            String method = rc.getMethod();
+            String expectedMethod = null; 
+            if (rc.getAcceptableMediaTypes().contains(MediaType.valueOf("text/mistypedxml"))
+                && rc.getHeaders().getFirst("THEMETHOD") != null) {
+                expectedMethod = "PUT";
+            } else {
+                expectedMethod = "POST";
+            }
+            
+                
+            if (!expectedMethod.equals(method)) {
+                throw new RuntimeException();
+            }
             rc.setEntity(new Book("book", ((Book)rc.getEntity()).getId() + 5));
         }
 



Mime
View raw message