cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Adding a disabled JAXRSAsyncTest
Date Tue, 10 Feb 2015 16:07:13 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 824234e62 -> 4c9cc32f7


Adding a disabled JAXRSAsyncTest


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

Branch: refs/heads/master
Commit: 4c9cc32f7bba136b3970c91f15a7f24c94c94c89
Parents: 824234e
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Feb 10 16:06:51 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Feb 10 16:06:51 2015 +0000

----------------------------------------------------------------------
 .../cxf/systest/jaxrs/JAXRSAsyncClientTest.java | 36 +++++++++++++++++++-
 .../jaxrs/JAXRSClientServerBookTest.java        | 27 +++++++++++++++
 2 files changed, 62 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4c9cc32f/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 225743c..7bd8d27 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,6 +33,9 @@ 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.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;
@@ -48,6 +52,7 @@ import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase {
@@ -68,7 +73,6 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
             Thread.sleep(Long.valueOf(property));
         }
     }
-    
     @Test
     public void testRetrieveBookCustomMethodAsyncSync() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/retrieve";
@@ -126,6 +130,26 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase
{
     }
     
     @Test
+    @Ignore
+    public void testNonExistent() throws Exception {
+        String address = "http://localhost/bookstore";
+        List<Object> providers = new ArrayList<Object>();
+        providers.add(new TestResponseFilter());
+        WebClient wc =  WebClient.create(address, providers);
+        Future<Book> future = wc.async().get(Book.class);
+        try {
+            future.get();
+            fail("Exception expected");
+        } catch (ExecutionException ex) {
+            Throwable cause = ex.getCause();
+            assertTrue(cause instanceof ProcessingException);
+            assertTrue(ex.getCause().getCause() instanceof ConnectException);
+        } finally {
+            wc.close();
+        }
+    }
+    
+    @Test
     public void testPostBookProcessingException() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/";
         List<Object> providers = new ArrayList<Object>();
@@ -231,4 +255,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
+            
+        }
+        
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/4c9cc32f/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 fde6d40..2dd23ab 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,7 +21,9 @@ 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.ConnectException;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLEncoder;
@@ -39,6 +41,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 +109,18 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase
{
         assertEquals("root", book.getName());
     }
     @Test
+    public void testNonExistent() throws Exception {
+        String address = "http://localhost/bookstore";
+        WebClient wc = WebClient.create(address, 
+                                        Collections.singletonList(new TestResponseFilter()));
+        try {
+            wc.get();
+            fail();
+        } catch (ProcessingException ex) {
+            assertTrue(ex.getCause() instanceof ConnectException);
+        }
+    }
+    @Test
     public void testGetBookQueryGZIP() throws Exception {
         String address = "http://localhost:" + PORT + "/bookstore/";
         WebClient wc = WebClient.create(address);
@@ -2724,4 +2741,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