You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2016/01/13 18:11:30 UTC
[2/3] cxf git commit: CXF-6744: throwing from @Suspended method does
not result in response.
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/aac51e79
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/aac51e79
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/aac51e79
Branch: refs/heads/3.0.x-fixes
Commit: aac51e79a92cb1c6b8722fe1f27f6537e2728c20
Parents: 84187a3
Author: Benson Margulies <be...@basistech.com>
Authored: Tue Jan 12 13:20:15 2016 -0500
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed Jan 13 17:08:39 2016 +0000
----------------------------------------------------------------------
.../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/aac51e79/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/aac51e79/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/";