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-6252] Adding one more test
Date Wed, 11 Feb 2015 10:12:44 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 28e7c51cf -> a94b303ed


[CXF-6252] Adding one more test


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

Branch: refs/heads/3.0.x-fixes
Commit: a94b303ed95772b5bb49d2d04511bc02c576e2c8
Parents: 28e7c51
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Feb 11 10:00:58 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Feb 11 10:12:12 2015 +0000

----------------------------------------------------------------------
 .../cxf/systest/jaxrs/JAXRSAsyncClientTest.java | 35 ++++++++++++++++++++
 1 file changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a94b303e/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 b46d054..b671056 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,6 +24,7 @@ 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;
@@ -32,9 +33,15 @@ import java.util.concurrent.Future;
 import javax.ws.rs.NotFoundException;
 import javax.ws.rs.ProcessingException;
 import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.client.InvocationCallback;
 import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
@@ -143,6 +150,24 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
             wc.close();
         }
     }
+    @Test
+    public void testNonExistentJaxrs20() throws Exception {
+        String address = "http://localhost/bookstore";
+        Client c = ClientBuilder.newClient();
+        c.register(new TestResponseFilter());
+        WebTarget t1 = c.target(address);
+        Future<Response> future = t1.request().async().get();
+        try {
+            future.get();
+            fail("Exception expected");
+        } catch (ExecutionException ex) {
+            Throwable cause = ex.getCause();
+            assertTrue(cause instanceof ProcessingException);
+            assertTrue(ex.getCause().getCause() instanceof ConnectException);
+        } finally {
+            c.close();
+        }
+    }
     
     @Test
     public void testPostBookProcessingException() throws Exception {
@@ -250,4 +275,14 @@ public class JAXRSAsyncClientTest 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