Skip to content

Commit 2c49f92

Browse files
committed
asynchronous timeout
Signed-off-by: Maxim Nesen <[email protected]>
1 parent 45c6ac1 commit 2c49f92

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/e2e-entity/src/test/java/org/glassfish/jersey/tests/e2e/sse/BroadcasterTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public class BroadcasterTest extends JerseyTest {
5353
static final CountDownLatch txLatch = new CountDownLatch(4);
5454
private static boolean isSingleton = false;
5555

56+
private static int LATCH_WAIT_TIMEOUT = 16000; //timeout to be waited for asynchronous events to be completed
57+
5658
@Path("sse")
5759
@Singleton
5860
public static class SseResource {
@@ -142,14 +144,14 @@ public void test() throws InterruptedException {
142144
target().path("sse/push/secondBroadcast").request().get(String.class);
143145

144146
Assert.assertTrue("Waiting for resultsA1 to be complete failed.",
145-
a1Latch.await(3000, TimeUnit.MILLISECONDS));
147+
a1Latch.await(LATCH_WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
146148
Assert.assertTrue("Waiting for resultsA2 to be complete failed.",
147-
a2Latch.await(3000, TimeUnit.MILLISECONDS));
149+
a2Latch.await(LATCH_WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
148150

149151
Assert.assertTrue("Waiting for resultsB1 to be complete failed.",
150-
b1Latch.await(3000, TimeUnit.MILLISECONDS));
152+
b1Latch.await(LATCH_WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
151153
Assert.assertTrue("Waiting for resultsB2 to be complete failed.",
152-
b2Latch.await(3000, TimeUnit.MILLISECONDS));
154+
b2Latch.await(LATCH_WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
153155

154156
Assert.assertTrue(txLatch.await(5000, TimeUnit.MILLISECONDS));
155157

@@ -184,7 +186,7 @@ public void test() throws InterruptedException {
184186
&& resultsB2.get(2).equals("Event3")
185187
&& resultsB2.get(3).equals("secondBroadcast"));
186188
target().path("sse/close").request().get();
187-
Assert.assertTrue(closeLatch.await(3000, TimeUnit.MILLISECONDS));
189+
Assert.assertTrue(closeLatch.await(LATCH_WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
188190
Assert.assertTrue("Sse instances injected into resource and constructor differ. Sse should have been injected"
189191
+ "as a singleton", isSingleton);
190192
}

0 commit comments

Comments
 (0)