use of io.servicetalk.concurrent.CompletableSource in project servicetalk by apple.
the class CompletableConcatWithCompletablesTest method testSourceSuccessReentrant.
@ParameterizedTest
@ValueSource(ints = { 1, 2, 10000 })
void testSourceSuccessReentrant(int num) {
Completable[] mockCompletables = new Completable[num];
for (int i = 0; i < mockCompletables.length; ++i) {
CompletableSource mockCompletable = mock(CompletableSource.class);
doAnswer((Answer<Void>) invocation -> {
CompletableSource.Subscriber sub = invocation.getArgument(0);
sub.onSubscribe(IGNORE_CANCEL);
sub.onComplete();
return null;
}).when(mockCompletable).subscribe(any());
mockCompletables[i] = fromSource(mockCompletable);
}
toSource(source.concat(mockCompletables)).subscribe(subscriber);
source.onComplete();
subscriber.awaitOnComplete();
}
use of io.servicetalk.concurrent.CompletableSource in project servicetalk by apple.
the class ReactiveStreamsAdaptersTest method completableToRSFromSourceError.
@Test
void completableToRSFromSourceError() {
CompletableSource source = s -> {
s.onSubscribe(EMPTY_SUBSCRIPTION);
s.onError(DELIBERATE_EXCEPTION);
};
verifyRSError(toRSPublisherFromSourceAndSubscribe(source));
}
use of io.servicetalk.concurrent.CompletableSource in project servicetalk by apple.
the class ReactiveStreamsAdaptersTest method completableToRSFromSourceSuccess.
@Test
void completableToRSFromSourceSuccess() {
CompletableSource source = s -> {
s.onSubscribe(IGNORE_CANCEL);
s.onComplete();
};
verifyRSSuccess(toRSPublisherFromSourceAndSubscribe(source), false);
}
use of io.servicetalk.concurrent.CompletableSource in project servicetalk by apple.
the class SourceAdaptersTest method completableFromSourceSuccess.
@Test
void completableFromSourceSuccess() throws Exception {
CompletableSource src = s -> {
s.onSubscribe(IGNORE_CANCEL);
s.onComplete();
};
fromSource(src).toFuture().get();
}
use of io.servicetalk.concurrent.CompletableSource in project servicetalk by apple.
the class SourceAdaptersTest method toSourceAndSubscribe.
private CompletableSource.Subscriber toSourceAndSubscribe(Completable completable) {
CompletableSource src = toSource(completable);
CompletableSource.Subscriber subscriber = mock(CompletableSource.Subscriber.class);
src.subscribe(subscriber);
verify(subscriber).onSubscribe(any());
return subscriber;
}
Aggregations