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-6793] Actually defaulting to Response.class if InvocationCallback does not offer the type info
Date Mon, 22 Feb 2016 16:57:50 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes dd1fe4ed3 -> c38f61f4c


[CXF-6793] Actually defaulting to Response.class if InvocationCallback does not offer the
type info


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

Branch: refs/heads/3.0.x-fixes
Commit: c38f61f4c6ab1ee2dcce9d99488adcf2db8f3e7c
Parents: dd1fe4e
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Feb 22 15:48:57 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Feb 22 16:57:37 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/client/WebClient.java |  6 +++++-
 .../cxf/systest/jaxrs/JAXRSAsyncClientTest.java     | 16 +++++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c38f61f4/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
index 4b1ab4d..b54bee8 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
@@ -942,7 +942,11 @@ public class WebClient extends AbstractClient {
             if (pt.getRawType() instanceof Class) {
                 respClass = (Class<?>)pt.getRawType();
             }
-        } 
+        } else if (outType == null) { 
+            respClass = Response.class;
+        }
+        
+       
         
         return doInvokeAsync(httpMethod, body, requestClass, inType, respClass, outType,
callback);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/c38f61f4/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
index 53e982c..8d0b837 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
@@ -257,15 +257,13 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
     public void testGenericInvocationCallback() throws Exception {
         InvocationCallback<?> callback = createGenericInvocationCallback();
         String address = "http://localhost:" + PORT + "/bookstore/books/check/123";
-        Future<?> f = ClientBuilder.newBuilder().register(new BookServerAsyncClient.BooleanReaderWriter())
+        ClientBuilder.newBuilder().register(new BookServerAsyncClient.BooleanReaderWriter())
             .build().target(address)
-            .request().accept("text/boolean").async().get(callback);
-        Object o = f.get();
-        assertTrue((Boolean)o);
-        assertTrue(((GenericInvocationCallback)callback).getResult());
+            .request().accept("text/boolean").async().get(callback).get();
+        assertTrue(((GenericInvocationCallback)callback).getResult().readEntity(Boolean.class));
     }
     
-    private InvocationCallback<?> createGenericInvocationCallback() {
+    private static <T> InvocationCallback<T> createGenericInvocationCallback()
{
         return new GenericInvocationCallback();
     }
 
@@ -352,7 +350,7 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
         }
         
     }
-    private static class GenericInvocationCallback implements InvocationCallback<Object>
{
+    private static class GenericInvocationCallback<T> implements InvocationCallback<T>
{
         private Object result;
 
         @Override
@@ -365,8 +363,8 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
             // complete
         }
 
-        public Boolean getResult() {
-            return (Boolean)result;
+        public Response getResult() {
+            return (Response)result;
         }
 
         


Mime
View raw message