You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2016/01/12 19:20:36 UTC

cxf git commit: CXF-6744: throwing from @Suspended method does not result in response.

Repository: cxf
Updated Branches:
  refs/heads/master 273e294c8 -> fa0eea884


CXF-6744: throwing from @Suspended method does not result in response.


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

Branch: refs/heads/master
Commit: fa0eea884adf49a0a6f990e15a0e69d17800156e
Parents: 273e294
Author: Benson Margulies <be...@basistech.com>
Authored: Tue Jan 12 13:20:15 2016 -0500
Committer: Benson Margulies <be...@basistech.com>
Committed: Tue Jan 12 13:20:15 2016 -0500

----------------------------------------------------------------------
 .../java/org/apache/cxf/systest/jaxrs/AsyncResource.java |  7 +++++++
 .../systest/jaxrs/JAXRSContinuationsServlet3Test.java    | 11 +++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/fa0eea88/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java
index c5b9530..13856c4 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java
@@ -25,6 +25,7 @@ import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.container.AsyncResponse;
 import javax.ws.rs.container.Suspended;
 import javax.ws.rs.core.Response;
@@ -46,6 +47,12 @@ public class AsyncResource {
     public void suspend(@Suspended AsyncResponse asyncResponse) { 
         ASYNC_RESPONSES[0].add(asyncResponse); 
     }
+
+    @GET
+    @Path("suspendthrow")
+    public void suspendthrow(@Suspended AsyncResponse asyncResponse) {
+        throw new WebApplicationException("Oh Dear", 502);
+    }
     
     @GET
     @Path("cancelvoid")

http://git-wip-us.apache.org/repos/asf/cxf/blob/fa0eea88/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
index a8f5641..283a3e0 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.systest.jaxrs;
 
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 
 import javax.ws.rs.client.AsyncInvoker;
 import javax.ws.rs.client.ClientBuilder;
@@ -81,6 +82,16 @@ public class JAXRSContinuationsServlet3Test extends AbstractJAXRSContinuationsTe
         Future<Response> cancel = invokeRequest(base + "cancelvoid?stage=1"); 
         assertString(cancel, AsyncResource.FALSE); 
     }
+
+    @org.junit.Ignore
+    @Test
+    public void testLostThrowFromSuspendedCall() throws Exception {
+        String base = "http://localhost:" + getPort() + "/async/resource/";
+        Future<Response> suspend = invokeRequest(base + "suspendthrow");
+        Response response = suspend.get(10, TimeUnit.SECONDS);
+        assertEquals(502, response.getStatus());
+    }
+
     @Test
     public void testSuspendSetTimeoutt() throws Exception { 
         final String base = "http://localhost:" + getPort() + "/async/resource2/";