Increase SignalR Java client test timeouts to 30 seconds (#25639)
This commit is contained in:
parent
ecc2ba16b8
commit
b3f4a32d23
File diff suppressed because it is too large
Load Diff
|
|
@ -27,7 +27,7 @@ public class LongPollingTransportTest {
|
||||||
|
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
LongPollingTransport transport = new LongPollingTransport(headers, client, Single.just(""));
|
LongPollingTransport transport = new LongPollingTransport(headers, client, Single.just(""));
|
||||||
Throwable exception = assertThrows(RuntimeException.class, () -> transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait());
|
Throwable exception = assertThrows(RuntimeException.class, () -> transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait());
|
||||||
assertEquals(Exception.class, exception.getCause().getClass());
|
assertEquals(Exception.class, exception.getCause().getClass());
|
||||||
assertEquals("Failed to connect.", exception.getCause().getMessage());
|
assertEquals("Failed to connect.", exception.getCause().getMessage());
|
||||||
assertFalse(transport.isActive());
|
assertFalse(transport.isActive());
|
||||||
|
|
@ -41,7 +41,7 @@ public class LongPollingTransportTest {
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
LongPollingTransport transport = new LongPollingTransport(headers, client, Single.just(""));
|
LongPollingTransport transport = new LongPollingTransport(headers, client, Single.just(""));
|
||||||
ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("First");
|
ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("First");
|
||||||
Throwable exception = assertThrows(RuntimeException.class, () -> transport.send(sendBuffer).timeout(1, TimeUnit.SECONDS).blockingAwait());
|
Throwable exception = assertThrows(RuntimeException.class, () -> transport.send(sendBuffer).timeout(30, TimeUnit.SECONDS).blockingAwait());
|
||||||
assertEquals(Exception.class, exception.getCause().getClass());
|
assertEquals(Exception.class, exception.getCause().getClass());
|
||||||
assertEquals("Cannot send unless the transport is active.", exception.getCause().getMessage());
|
assertEquals("Cannot send unless the transport is active.", exception.getCause().getMessage());
|
||||||
assertFalse(transport.isActive());
|
assertFalse(transport.isActive());
|
||||||
|
|
@ -69,7 +69,7 @@ public class LongPollingTransportTest {
|
||||||
});
|
});
|
||||||
|
|
||||||
assertFalse(onClosedRan.get());
|
assertFalse(onClosedRan.get());
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
assertTrue(block.blockingAwait(1, TimeUnit.SECONDS));
|
assertTrue(block.blockingAwait(1, TimeUnit.SECONDS));
|
||||||
assertTrue(onClosedRan.get());
|
assertTrue(onClosedRan.get());
|
||||||
assertFalse(transport.isActive());
|
assertFalse(transport.isActive());
|
||||||
|
|
@ -98,7 +98,7 @@ public class LongPollingTransportTest {
|
||||||
blocker.onComplete();
|
blocker.onComplete();
|
||||||
});
|
});
|
||||||
|
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
assertTrue(blocker.blockingAwait(1, TimeUnit.SECONDS));
|
assertTrue(blocker.blockingAwait(1, TimeUnit.SECONDS));
|
||||||
assertFalse(transport.isActive());
|
assertFalse(transport.isActive());
|
||||||
assertTrue(onClosedRan.get());
|
assertTrue(onClosedRan.get());
|
||||||
|
|
@ -155,7 +155,7 @@ public class LongPollingTransportTest {
|
||||||
|
|
||||||
transport.setOnClose((error) -> {});
|
transport.setOnClose((error) -> {});
|
||||||
|
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
assertTrue(block.blockingAwait(1,TimeUnit.SECONDS));
|
assertTrue(block.blockingAwait(1,TimeUnit.SECONDS));
|
||||||
assertTrue(onReceiveCalled.get());
|
assertTrue(onReceiveCalled.get());
|
||||||
assertEquals("TEST", message.get());
|
assertEquals("TEST", message.get());
|
||||||
|
|
@ -200,7 +200,7 @@ public class LongPollingTransportTest {
|
||||||
|
|
||||||
transport.setOnClose((error) -> {});
|
transport.setOnClose((error) -> {});
|
||||||
|
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
assertTrue(blocker.blockingAwait(1, TimeUnit.SECONDS));
|
assertTrue(blocker.blockingAwait(1, TimeUnit.SECONDS));
|
||||||
assertTrue(onReceiveCalled.get());
|
assertTrue(onReceiveCalled.get());
|
||||||
assertEquals("FIRSTSECONDTHIRD", message.get());
|
assertEquals("FIRSTSECONDTHIRD", message.get());
|
||||||
|
|
@ -230,7 +230,7 @@ public class LongPollingTransportTest {
|
||||||
LongPollingTransport transport = new LongPollingTransport(headers, client, Single.just(""));
|
LongPollingTransport transport = new LongPollingTransport(headers, client, Single.just(""));
|
||||||
transport.setOnClose((error) -> {});
|
transport.setOnClose((error) -> {});
|
||||||
|
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST");
|
ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST");
|
||||||
assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS));
|
assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS));
|
||||||
close.onComplete();
|
close.onComplete();
|
||||||
|
|
@ -262,7 +262,7 @@ public class LongPollingTransportTest {
|
||||||
LongPollingTransport transport = new LongPollingTransport(headers, client, tokenProvider);
|
LongPollingTransport transport = new LongPollingTransport(headers, client, tokenProvider);
|
||||||
transport.setOnClose((error) -> {});
|
transport.setOnClose((error) -> {});
|
||||||
|
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST");
|
ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST");
|
||||||
assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS));
|
assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS));
|
||||||
assertEquals(headerValue.get(), "Bearer TOKEN");
|
assertEquals(headerValue.get(), "Bearer TOKEN");
|
||||||
|
|
@ -298,7 +298,7 @@ public class LongPollingTransportTest {
|
||||||
LongPollingTransport transport = new LongPollingTransport(headers, client, tokenProvider);
|
LongPollingTransport transport = new LongPollingTransport(headers, client, tokenProvider);
|
||||||
transport.setOnClose((error) -> {});
|
transport.setOnClose((error) -> {});
|
||||||
|
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
secondGet.blockingAwait(1, TimeUnit.SECONDS);
|
secondGet.blockingAwait(1, TimeUnit.SECONDS);
|
||||||
ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST");
|
ByteBuffer sendBuffer = TestUtils.stringToByteBuffer("TEST");
|
||||||
assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS));
|
assertTrue(transport.send(sendBuffer).blockingAwait(1, TimeUnit.SECONDS));
|
||||||
|
|
@ -333,7 +333,7 @@ public class LongPollingTransportTest {
|
||||||
});
|
});
|
||||||
|
|
||||||
assertFalse(onClosedRan.get());
|
assertFalse(onClosedRan.get());
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
assertTrue(block.blockingAwait(1, TimeUnit.SECONDS));
|
assertTrue(block.blockingAwait(1, TimeUnit.SECONDS));
|
||||||
assertEquals(1, onCloseCount.get());
|
assertEquals(1, onCloseCount.get());
|
||||||
assertTrue(onClosedRan.get());
|
assertTrue(onClosedRan.get());
|
||||||
|
|
@ -371,7 +371,7 @@ public class LongPollingTransportTest {
|
||||||
});
|
});
|
||||||
|
|
||||||
assertEquals(0, onCloseCount.get());
|
assertEquals(0, onCloseCount.get());
|
||||||
transport.start("http://example.com").timeout(1, TimeUnit.SECONDS).blockingAwait();
|
transport.start("http://example.com").timeout(30, TimeUnit.SECONDS).blockingAwait();
|
||||||
assertTrue(transport.stop().blockingAwait(1, TimeUnit.SECONDS));
|
assertTrue(transport.stop().blockingAwait(1, TimeUnit.SECONDS));
|
||||||
assertEquals(1, onCloseCount.get());
|
assertEquals(1, onCloseCount.get());
|
||||||
assertFalse(transport.isActive());
|
assertFalse(transport.isActive());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue