use of io.servicetalk.concurrent.api.Completable in project servicetalk by apple.
the class RetryingHttpRequesterFilterAutoRetryStrategiesTest method defaultForNoAvailableHostOnServiceDiscovererError.
@ParameterizedTest
@ValueSource(booleans = { false, true })
void defaultForNoAvailableHostOnServiceDiscovererError(boolean offloading) {
final ContextAwareRetryingHttpClientFilter filter = newFilter(new RetryingHttpRequesterFilter.Builder(), offloading);
Completable retry = applyRetry(filter, 1, NO_AVAILABLE_HOST);
toSource(retry).subscribe(retrySubscriber);
assertThat(retrySubscriber.pollTerminal(10, MILLISECONDS), is(nullValue()));
sdStatus.onError(DELIBERATE_EXCEPTION);
verifyRetryResultError(DELIBERATE_EXCEPTION);
}
use of io.servicetalk.concurrent.api.Completable in project servicetalk by apple.
the class RetryWhenTest method setUp.
@SuppressWarnings("unchecked")
@BeforeEach
void setUp() {
source = new LegacyTestSingle<>(false, false);
shouldRetry = (BiIntFunction<Throwable, Completable>) mock(BiIntFunction.class);
retrySignal = new LegacyTestCompletable();
when(shouldRetry.apply(anyInt(), any())).thenAnswer(invocation -> {
retrySignal = new LegacyTestCompletable();
return retrySignal;
});
toSource(source.retryWhen(shouldRetry)).subscribe(subscriberRule);
}
use of io.servicetalk.concurrent.api.Completable in project servicetalk by apple.
the class ChannelSetTest method closeAsync.
@Test
void closeAsync() {
Completable completable = fixture.closeAsync();
verify(channel, never()).close();
TestCompletableSubscriber subscriber = new TestCompletableSubscriber();
toSource(completable).subscribe(subscriber);
verify(channel).close();
subscriber.awaitOnComplete();
}
use of io.servicetalk.concurrent.api.Completable in project servicetalk by apple.
the class ChannelSetTest method testCloseAsyncThenCloseAsyncGracefully.
@Test
void testCloseAsyncThenCloseAsyncGracefully() throws Exception {
Completable closeCompletable = fixture.closeAsync();
Completable gracefulCompletable = closeAsyncGracefully(fixture, 100, SECONDS);
TestCompletableSubscriber subscriber = new TestCompletableSubscriber();
toSource(closeCompletable).subscribe(subscriber);
verify(channel).close();
TestCompletableSubscriber subscriber2 = new TestCompletableSubscriber();
toSource(gracefulCompletable).subscribe(subscriber2);
fixture.onClose().toFuture().get();
subscriber.awaitOnComplete();
subscriber2.awaitOnComplete();
}
use of io.servicetalk.concurrent.api.Completable in project servicetalk by apple.
the class ChannelSetTest method closeAsyncGracefullyWithoutNettyConnectionChannelHandler.
@Test
void closeAsyncGracefullyWithoutNettyConnectionChannelHandler() {
when(mockClosableAttribute.getAndSet(any())).thenReturn(null);
Completable completable = closeAsyncGracefully(fixture, 100, SECONDS);
verify(channel, never()).close();
TestCompletableSubscriber subscriber = new TestCompletableSubscriber();
toSource(completable).subscribe(subscriber);
verify(channel).close();
subscriber.awaitOnComplete();
}
Aggregations