cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6798] Adding a test
Date Wed, 12 Oct 2016 15:35:04 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 91a0cf895 -> 56267745c


[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/56267745
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/56267745
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/56267745

Branch: refs/heads/3.0.x-fixes
Commit: 56267745c76d4bf3c1f2c6cfefd0e2c680359f1b
Parents: 91a0cf8
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Oct 12 16:27:53 2016 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Oct 12 16:34:47 2016 +0100

----------------------------------------------------------------------
 .../jaxrs/JAXRS20ClientServerBookTest.java      | 34 ++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/56267745/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 52279ec..77ed5ee 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");
-        Invocation.Builder builder = client.target(address)
-            .request("application/xml").header("a", "b");
+        WebTarget webTarget = client.target(address);
+        Invocation.Builder builder = webTarget.request("application/xml").header("a", new
BType());
         Response r = builder.get();
         Book book = r.readEntity(Book.class);
         assertEquals(124L, book.getId());
@@ -898,4 +902,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();
+        }
+        
+    }
 }


Mime
View raw message