Repository: cxf
Updated Branches:
  refs/heads/master c206267e6 -> 1304bc2ff


[CXF-6798] Adding a test


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1304bc2f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1304bc2f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1304bc2f

Branch: refs/heads/master
Commit: 1304bc2ffbe6b4c3bfdc4e4f47e5e224e52fd808
Parents: c206267
Author: Sergey Beryozkin <sberyoz...@gmail.com>
Authored: Wed Oct 12 16:27:53 2016 +0100
Committer: Sergey Beryozkin <sberyoz...@gmail.com>
Committed: Wed Oct 12 16:27:53 2016 +0100

----------------------------------------------------------------------
 .../jaxrs/JAXRS20ClientServerBookTest.java      | 32 +++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1304bc2f/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
----------------------------------------------------------------------
diff --git 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
index 7e0f930..ba1f2a3 100644
--- 
a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
+++ 
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRS20ClientServerBookTest.java
@@ -50,6 +50,8 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.ParamConverter;
+import javax.ws.rs.ext.ParamConverterProvider;
 import javax.ws.rs.ext.ReaderInterceptor;
 import javax.ws.rs.ext.ReaderInterceptorContext;
 import javax.ws.rs.ext.WriterInterceptor;
@@ -73,6 +75,7 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class JAXRS20ClientServerBookTest extends 
AbstractBusClientServerTestBase {
+    
     public static final String PORT = BookServer20.PORT;
     
     @BeforeClass
@@ -151,9 +154,10 @@ public class JAXRS20ClientServerBookTest extends 
AbstractBusClientServerTestBase
         String address = "http://localhost:"; + PORT + 
"/bookstore/bookheaders/simple";
         Client client = ClientBuilder.newClient();
         client.register((Object)ClientFilterClientAndConfigCheck.class);
+        client.register(new BTypeParamConverterProvider());
         client.property("clientproperty", "somevalue");
         WebTarget webTarget = client.target(address);
-        Invocation.Builder builder = 
webTarget.request("application/xml").header("a", "b");
+        Invocation.Builder builder = 
webTarget.request("application/xml").header("a", new BType());
         
         Response r = builder.get();
         Book book = r.readEntity(Book.class);
@@ -899,4 +903,30 @@ public class JAXRS20ClientServerBookTest extends 
AbstractBusClientServerTestBase
         }
         
     }
+    
+    static class BType {
+        public String b() {
+            return "b";
+        }
+    }
+    
+    static class BTypeParamConverterProvider implements 
ParamConverterProvider, ParamConverter<BType> {
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public <T> ParamConverter<T> getConverter(Class<T> cls, Type t, 
Annotation[] anns) {
+            return cls == BType.class ? (ParamConverter<T>)this : null;
+        }
+
+        @Override
+        public BType fromString(String s) {
+            return null;
+        }
+
+        @Override
+        public String toString(BType bType) {
+            return bType.b();
+        }
+        
+    }
 }

Reply via email to