Java Code Examples for org.eclipse.microprofile.reactive.streams.operators.CompletionSubscriber#of()
The following examples show how to use
org.eclipse.microprofile.reactive.streams.operators.CompletionSubscriber#of() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompletionSubscriberVerification.java From microprofile-reactive-streams-operators with Apache License 2.0 | 5 votes |
@Test public void completionSubscriberShouldDelegateToSubscriber() { Deque<Object> calls = new ArrayDeque<>(); CompletionSubscriber subscriber = CompletionSubscriber.of(new Subscriber() { @Override public void onSubscribe(Subscription s) { calls.add(s); } @Override public void onNext(Object o) { calls.add(o); } @Override public void onError(Throwable t) { calls.add(t); } @Override public void onComplete() { calls.add("onComplete"); } }, new CompletableFuture<>()); subscriber.onSubscribe(Mocks.SUBSCRIPTION); assertSame(calls.removeFirst(), Mocks.SUBSCRIPTION); subscriber.onNext("element"); assertEquals(calls.removeFirst(), "element"); Exception e = new Exception(); subscriber.onError(e); assertSame(calls.removeFirst(), e); subscriber.onComplete(); assertEquals(calls.removeFirst(),"onComplete"); assertTrue(calls.isEmpty()); }
Example 2
Source File: DefaultSubscriberWithCompletionStage.java From smallrye-mutiny with Apache License 2.0 | 4 votes |
public DefaultSubscriberWithCompletionStage(Processor<T, T> processor, CompletionStage<R> result) { subscriber = CompletionSubscriber.of(processor, result); }
Example 3
Source File: CompletionSubscriberVerification.java From microprofile-reactive-streams-operators with Apache License 2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void completionSubscriberShouldNotAcceptNullSubscriber() { CompletionSubscriber.of(null, new CompletableFuture<>()); }
Example 4
Source File: CompletionSubscriberVerification.java From microprofile-reactive-streams-operators with Apache License 2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void completionSubscriberShouldNotAcceptNullCompletionStage() { CompletionSubscriber.of(Mocks.SUBSCRIBER, null); }
Example 5
Source File: SubscriberBuilderImpl.java From microprofile-reactive-streams-operators with Apache License 2.0 | 4 votes |
@Override public CompletionSubscriber<T, R> build(ReactiveStreamsEngine engine) { Objects.requireNonNull(engine, "Engine must not be null"); SubscriberWithCompletionStage<T, R> subscriberWithCompletionStage = engine.buildSubscriber(toGraph()); return CompletionSubscriber.of(subscriberWithCompletionStage.getSubscriber(), subscriberWithCompletionStage.getCompletion()); }
Example 6
Source File: DefaultSubscriberWithCompletionStage.java From smallrye-reactive-streams-operators with Apache License 2.0 | 4 votes |
public DefaultSubscriberWithCompletionStage(Processor<T, T> processor, CompletionStage<R> result) { subscriber = CompletionSubscriber.of(processor, result); }