Search in sources :

Example 1 with LOAD_BALANCER_READY_EVENT

use of io.servicetalk.client.api.LoadBalancerReadyEvent.LOAD_BALANCER_READY_EVENT in project servicetalk by apple.

the class RetryingHttpRequesterFilterAutoRetryStrategiesTest method disableRetryAllRetryableExWithNoAvailableHost.

@Test
void disableRetryAllRetryableExWithNoAvailableHost() {
    final ContextAwareRetryingHttpClientFilter filter = newFilter(new RetryingHttpRequesterFilter.Builder().retryRetryableExceptions((__, ___) -> ofNoRetries()));
    Completable retry = applyRetry(filter, 1, NO_AVAILABLE_HOST);
    toSource(retry).subscribe(retrySubscriber);
    assertThat(retrySubscriber.pollTerminal(10, MILLISECONDS), is(nullValue()));
    lbEvents.onNext(LOAD_BALANCER_READY_EVENT);
    verifyRetryResultCompleted();
}
Also used : FilterableStreamingHttpClient(io.servicetalk.http.api.FilterableStreamingHttpClient) DEFAULT_ALLOCATOR(io.servicetalk.buffer.netty.BufferAllocators.DEFAULT_ALLOCATOR) TestPublisher(io.servicetalk.concurrent.api.TestPublisher) TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) Answer(org.mockito.stubbing.Answer) BackOffPolicy.ofNoRetries(io.servicetalk.http.netty.RetryingHttpRequesterFilter.BackOffPolicy.ofNoRetries) Executor(io.servicetalk.concurrent.Executor) IsNull.nullValue(org.hamcrest.core.IsNull.nullValue) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) DELIBERATE_EXCEPTION(io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION) Nonnull(javax.annotation.Nonnull) HttpExecutionContext(io.servicetalk.http.api.HttpExecutionContext) Executors.immediate(io.servicetalk.concurrent.api.Executors.immediate) RetryableConnectException(io.servicetalk.client.api.RetryableConnectException) Completable(io.servicetalk.concurrent.api.Completable) ContextAwareRetryingHttpClientFilter(io.servicetalk.http.netty.RetryingHttpRequesterFilter.ContextAwareRetryingHttpClientFilter) LOAD_BALANCER_READY_EVENT(io.servicetalk.client.api.LoadBalancerReadyEvent.LOAD_BALANCER_READY_EVENT) NoAvailableHostException(io.servicetalk.client.api.NoAvailableHostException) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Mockito.when(org.mockito.Mockito.when) UnknownHostException(java.net.UnknownHostException) SourceAdapters.toSource(io.servicetalk.concurrent.api.SourceAdapters.toSource) GET(io.servicetalk.http.api.HttpRequestMethod.GET) StreamingHttpRequests.newRequest(io.servicetalk.http.api.StreamingHttpRequests.newRequest) HttpRequestMetaData(io.servicetalk.http.api.HttpRequestMetaData) Test(org.junit.jupiter.api.Test) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) RetryingHttpRequesterFilter.disableAutoRetries(io.servicetalk.http.netty.RetryingHttpRequesterFilter.disableAutoRetries) Matchers.sameInstance(org.hamcrest.Matchers.sameInstance) TestCompletable(io.servicetalk.concurrent.api.TestCompletable) Matchers.is(org.hamcrest.Matchers.is) Matchers.anyOf(org.hamcrest.Matchers.anyOf) INSTANCE(io.servicetalk.http.api.DefaultHttpHeadersFactory.INSTANCE) HTTP_1_1(io.servicetalk.http.api.HttpProtocolVersion.HTTP_1_1) Mockito.mock(org.mockito.Mockito.mock) Completable(io.servicetalk.concurrent.api.Completable) TestCompletable(io.servicetalk.concurrent.api.TestCompletable) ContextAwareRetryingHttpClientFilter(io.servicetalk.http.netty.RetryingHttpRequesterFilter.ContextAwareRetryingHttpClientFilter) Test(org.junit.jupiter.api.Test)

Aggregations

DEFAULT_ALLOCATOR (io.servicetalk.buffer.netty.BufferAllocators.DEFAULT_ALLOCATOR)1 LOAD_BALANCER_READY_EVENT (io.servicetalk.client.api.LoadBalancerReadyEvent.LOAD_BALANCER_READY_EVENT)1 NoAvailableHostException (io.servicetalk.client.api.NoAvailableHostException)1 RetryableConnectException (io.servicetalk.client.api.RetryableConnectException)1 Executor (io.servicetalk.concurrent.Executor)1 Completable (io.servicetalk.concurrent.api.Completable)1 Executors.immediate (io.servicetalk.concurrent.api.Executors.immediate)1 SourceAdapters.toSource (io.servicetalk.concurrent.api.SourceAdapters.toSource)1 TestCompletable (io.servicetalk.concurrent.api.TestCompletable)1 TestPublisher (io.servicetalk.concurrent.api.TestPublisher)1 DELIBERATE_EXCEPTION (io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION)1 TestCompletableSubscriber (io.servicetalk.concurrent.test.internal.TestCompletableSubscriber)1 INSTANCE (io.servicetalk.http.api.DefaultHttpHeadersFactory.INSTANCE)1 FilterableStreamingHttpClient (io.servicetalk.http.api.FilterableStreamingHttpClient)1 HttpExecutionContext (io.servicetalk.http.api.HttpExecutionContext)1 HTTP_1_1 (io.servicetalk.http.api.HttpProtocolVersion.HTTP_1_1)1 HttpRequestMetaData (io.servicetalk.http.api.HttpRequestMetaData)1 GET (io.servicetalk.http.api.HttpRequestMethod.GET)1 StreamingHttpRequests.newRequest (io.servicetalk.http.api.StreamingHttpRequests.newRequest)1 BackOffPolicy.ofNoRetries (io.servicetalk.http.netty.RetryingHttpRequesterFilter.BackOffPolicy.ofNoRetries)1