You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2022/02/02 00:59:23 UTC
[cxf] branch 3.5.x-fixes updated: CXF-8650: Fix org.apache.cxf.systest.jaxrs.JAXRSContinuationsServlet3Test.testSuspendSetTimeout (#897)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.5.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.5.x-fixes by this push:
new 195ab0e CXF-8650: Fix org.apache.cxf.systest.jaxrs.JAXRSContinuationsServlet3Test.testSuspendSetTimeout (#897)
195ab0e is described below
commit 195ab0ea7066c2ab7084fb61a9457d6b3ca5d527
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Tue Feb 1 18:37:41 2022 -0500
CXF-8650: Fix org.apache.cxf.systest.jaxrs.JAXRSContinuationsServlet3Test.testSuspendSetTimeout (#897)
(cherry picked from commit 452623776ba494624a0cf0031ca40ad195e898e9)
---
.../java/org/apache/cxf/systest/jaxrs/AsyncResource2.java | 14 ++++++++++++--
.../cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java | 1 -
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource2.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource2.java
index 82ac8a7..ed0f200 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource2.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource2.java
@@ -19,15 +19,17 @@
package org.apache.cxf.systest.jaxrs;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.LockSupport;
import javax.ws.rs.GET;
+import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.Path;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
@Path("resource2")
public class AsyncResource2 {
- static AsyncResponse asyncResponse;
+ private volatile AsyncResponse asyncResponse;
@GET
@Path("/suspend")
@@ -38,7 +40,15 @@ public class AsyncResource2 {
@GET
@Path("/setTimeOut")
public boolean setTimeOut() {
+ int i = 0;
+ while (asyncResponse == null && ++i < 20) {
+ LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
+ }
+
+ if (asyncResponse == null) {
+ throw new InternalServerErrorException("Unable to retrieve the AsyncResponse, was it suspended?");
+ }
+
return asyncResponse.setTimeout(2L, TimeUnit.SECONDS);
}
-
}
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 1d120d1..4106c9e 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
@@ -87,7 +87,6 @@ public class JAXRSContinuationsServlet3Test extends AbstractJAXRSContinuationsTe
}
@Test
- // FIXME: standalone test run failed, eg -Dtest=JAXRSContinuationsServlet3Test#testSuspendSetTimeout
public void testSuspendSetTimeout() throws Exception {
final String base = "http://localhost:" + getPort() + "/async/resource2/";
Future<Response> suspend = invokeRequest(base + "suspend");