cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Minor update to JAXRS AbstractClient
Date Wed, 11 Feb 2015 22:00:12 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes bd9c0fd1d -> ffab0b893


Minor update to JAXRS AbstractClient


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

Branch: refs/heads/3.0.x-fixes
Commit: ffab0b89327c381a539dc2618ee850135c99d9aa
Parents: bd9c0fd
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Feb 11 21:29:48 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Feb 11 21:39:17 2015 +0000

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/client/AbstractClient.java |  4 +--
 .../cxf/systest/jaxrs/JAXRSAsyncClientTest.java |  9 +++----
 .../jaxrs/JAXRSClientServerBookTest.java        | 26 ++++++++++++++++++++
 3 files changed, 31 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ffab0b89/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
index f87498d..62d725b 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
@@ -25,7 +25,6 @@ import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Type;
-import java.net.ConnectException;
 import java.net.HttpURLConnection;
 import java.net.URI;
 import java.text.SimpleDateFormat;
@@ -1065,8 +1064,7 @@ public abstract class AbstractClient implements Client {
 
         public void handleMessage(Message message) throws Fault {
             Exception ex = message.getContent(Exception.class);
-            if (!message.getExchange().isSynchronous() 
-                && ex instanceof ConnectException) {
+            if (!message.getExchange().isSynchronous()) {
                 //TODO: make sure it works with the failover feature
                 JaxrsClientCallback<?> cb = message.getExchange().get(JaxrsClientCallback.class);
                 cb.handleException(message, new ProcessingException(ex));

http://git-wip-us.apache.org/repos/asf/cxf/blob/ffab0b89/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 b671056..4cf617e 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
@@ -24,7 +24,6 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
-import java.net.ConnectException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
@@ -134,7 +133,7 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
     
     @Test
     public void testNonExistent() throws Exception {
-        String address = "http://localhost/bookstore";
+        String address = "http://localhostt/bookstore";
         List<Object> providers = new ArrayList<Object>();
         providers.add(new TestResponseFilter());
         WebClient wc =  WebClient.create(address, providers);
@@ -145,14 +144,14 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
         } catch (ExecutionException ex) {
             Throwable cause = ex.getCause();
             assertTrue(cause instanceof ProcessingException);
-            assertTrue(ex.getCause().getCause() instanceof ConnectException);
+            assertTrue(ex.getCause().getCause() instanceof IOException);
         } finally {
             wc.close();
         }
     }
     @Test
     public void testNonExistentJaxrs20() throws Exception {
-        String address = "http://localhost/bookstore";
+        String address = "http://localhostt/bookstore";
         Client c = ClientBuilder.newClient();
         c.register(new TestResponseFilter());
         WebTarget t1 = c.target(address);
@@ -163,7 +162,7 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
         } catch (ExecutionException ex) {
             Throwable cause = ex.getCause();
             assertTrue(cause instanceof ProcessingException);
-            assertTrue(ex.getCause().getCause() instanceof ConnectException);
+            assertTrue(ex.getCause().getCause() instanceof IOException);
         } finally {
             c.close();
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/ffab0b89/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
index 6bc712e..2249bbf 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
@@ -21,6 +21,7 @@ package org.apache.cxf.systest.jaxrs;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
@@ -39,6 +40,9 @@ import javax.ws.rs.NotAcceptableException;
 import javax.ws.rs.ProcessingException;
 import javax.ws.rs.ServerErrorException;
 import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
 import javax.ws.rs.client.ResponseProcessingException;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.GenericEntity;
@@ -104,6 +108,18 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase
{
         assertEquals("root", book.getName());
     }
     @Test
+    public void testNonExistent() throws Exception {
+        String address = "http://localhostt/bookstore";
+        WebClient wc = WebClient.create(address, 
+                                        Collections.singletonList(new TestResponseFilter()));
+        try {
+            wc.get();
+            fail();
+        } catch (ProcessingException ex) {
+            assertTrue(ex.getCause() instanceof IOException);
+        }
+    }
+    @Test
     public void testGetBookQueryGZIP() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/";
         WebClient wc = WebClient.create(address);
@@ -2712,4 +2728,14 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase
{
         }
         
     }
+    public static class TestResponseFilter implements ClientResponseFilter {
+
+        @Override
+        public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext)
+            throws IOException {
+            // TODO Auto-generated method stub
+            
+        }
+        
+    }
 }


Mime
View raw message