Search in sources :

Example 1 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class CompletableConcatWithCompletablesTest method setUp.

@BeforeEach
void setUp() {
    subscriber = new TestCompletableSubscriber();
    source = new TestCompletable();
}
Also used : TestCompletable(io.servicetalk.concurrent.api.TestCompletable) TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class CompletableConcatWithCompletableTest method setUp.

@BeforeEach
void setUp() {
    subscriber = new TestCompletableSubscriber();
    source = new TestCompletable();
    next = new TestCompletable();
}
Also used : TestCompletable(io.servicetalk.concurrent.api.TestCompletable) TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber 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();
}
Also used : Completable(io.servicetalk.concurrent.api.Completable) TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) Test(org.junit.jupiter.api.Test)

Example 4 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class ChannelSetTest method testCloseAsyncGracefullyTwice.

@Test
void testCloseAsyncGracefullyTwice() throws Exception {
    Completable gracefulCompletable1 = closeAsyncGracefully(fixture, 60, SECONDS);
    Completable gracefulCompletable2 = closeAsyncGracefully(fixture, 60, SECONDS);
    TestCompletableSubscriber subscriber = new TestCompletableSubscriber();
    toSource(gracefulCompletable1).subscribe(subscriber);
    verify(nettyConnection).closeAsyncGracefullyNoOffload();
    TestCompletableSubscriber subscriber2 = new TestCompletableSubscriber();
    toSource(gracefulCompletable2).subscribe(subscriber2);
    verify(nettyConnection, times(1)).closeAsyncGracefullyNoOffload();
    assertThat(subscriber.pollTerminal(10, MILLISECONDS), is(nullValue()));
    closeAsyncGracefullyCompletable.onComplete();
    assertThat(subscriber.pollTerminal(10, MILLISECONDS), is(nullValue()));
    listener.operationComplete(channelCloseFuture);
    fixture.onClose().toFuture().get();
    subscriber.awaitOnComplete();
    subscriber2.awaitOnComplete();
}
Also used : Completable(io.servicetalk.concurrent.api.Completable) TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) Test(org.junit.jupiter.api.Test)

Example 5 with TestCompletableSubscriber

use of io.servicetalk.concurrent.test.internal.TestCompletableSubscriber in project servicetalk by apple.

the class DefaultNettyConnectionTest method testSequentialPubAndPub.

@Test
void testSequentialPubAndPub() {
    testWritePublisher();
    writeListener = new TestCompletableSubscriber();
    testWritePublisher();
}
Also used : TestCompletableSubscriber(io.servicetalk.concurrent.test.internal.TestCompletableSubscriber) Test(org.junit.jupiter.api.Test)

Aggregations

TestCompletableSubscriber (io.servicetalk.concurrent.test.internal.TestCompletableSubscriber)59 Test (org.junit.jupiter.api.Test)53 Completable (io.servicetalk.concurrent.api.Completable)10 BeforeEach (org.junit.jupiter.api.BeforeEach)5 TestCompletable (io.servicetalk.concurrent.api.TestCompletable)3 Channel (io.netty.channel.Channel)1 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelFutureListener (io.netty.channel.ChannelFutureListener)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 ChannelOutboundHandlerAdapter (io.netty.channel.ChannelOutboundHandlerAdapter)1 ChannelPromise (io.netty.channel.ChannelPromise)1 EventLoop (io.netty.channel.EventLoop)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1 ReferenceCountUtil (io.netty.util.ReferenceCountUtil)1 Cancellable (io.servicetalk.concurrent.Cancellable)1 TestSubscription (io.servicetalk.concurrent.api.TestSubscription)1 DeliberateException (io.servicetalk.concurrent.internal.DeliberateException)1 DELIBERATE_EXCEPTION (io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION)1 ContextAwareRetryingHttpClientFilter (io.servicetalk.http.netty.RetryingHttpRequesterFilter.ContextAwareRetryingHttpClientFilter)1 UNSUPPORTED_PROTOCOL_CLOSE_HANDLER (io.servicetalk.transport.netty.internal.CloseHandler.UNSUPPORTED_PROTOCOL_CLOSE_HANDLER)1