Java Code Examples for reactor.core.publisher.Signal#isOnError()
The following examples show how to use
reactor.core.publisher.Signal#isOnError() .
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: DefaultStepVerifierBuilder.java From reactor-core with Apache License 2.0 | 6 votes |
boolean onSignal(Signal<T> actualSignal) { SignalEvent<T> signalEvent = (SignalEvent<T>) this.script.poll(); Optional<AssertionError> error = signalEvent.test(actualSignal); if (error.isPresent()) { Exceptions.addThrowable(ERRORS, this, error.get()); // #55 ensure the onError is added as a suppressed to the AssertionError if(actualSignal.isOnError()) { error.get().addSuppressed(actualSignal.getThrowable()); } maybeCancel(actualSignal); this.completeLatch.countDown(); return true; } if (actualSignal.isOnNext()) { unasserted--; } return false; }
Example 2
Source File: DefaultStepVerifierBuilder.java From reactor-core with Apache License 2.0 | 6 votes |
final boolean onSignalCount(Signal<T> actualSignal, SignalCountEvent<T> event) { if (unasserted >= event.count) { this.script.poll(); unasserted -= event.count; } else { if (event.count != 0) { Optional<AssertionError> error = this.checkCountMismatch(event, actualSignal); if (error.isPresent()) { Exceptions.addThrowable(ERRORS, this, error.get()); if(actualSignal.isOnError()) { // #55 ensure the onError is added as a suppressed to the AssertionError error.get().addSuppressed(actualSignal.getThrowable()); } maybeCancel(actualSignal); this.completeLatch.countDown(); } } return true; } return false; }
Example 3
Source File: DefaultStepVerifierBuilder.java From reactor-core with Apache License 2.0 | 6 votes |
Optional<AssertionError> test(Signal<T> signal, Iterator<? extends T> iterator) { if (signal.isOnNext()) { if (!iterator.hasNext()) { return Optional.empty(); } T d2 = iterator.next(); if (!Objects.equals(signal.get(), d2)) { return messageFormatter.failOptional(this, "expected : onNext(%s); actual: %s; iterable: %s", d2, signal.get(), iterable); } return iterator.hasNext() ? EXPECT_MORE : Optional.empty(); } if (iterator.hasNext() || signal.isOnError()) { return messageFormatter.failOptional(this, "expected next value: %s; actual signal: %s; iterable: %s", iterator.hasNext() ? iterator.next() : "none", signal, iterable); } return Optional.empty(); }
Example 4
Source File: EventBroker.java From linstor-server with GNU General Public License v3.0 | 5 votes |
private <T> byte[] serializeSignal( Integer peerWatchId, EventSerializer.Serializer<T> eventSerializer, String eventName, ObjectSignal<T> objectSignal ) { EventIdentifier eventIdentifier = new EventIdentifier(eventName, objectSignal.getObjectIdentifier()); Signal<T> signal = objectSignal.getSignal(); CommonSerializer.CommonSerializerBuilder builder = commonSerializer.onewayBuilder(ApiConsts.API_EVENT); if (signal.isOnNext()) { builder .event(peerWatchId, eventIdentifier, InternalApiConsts.EVENT_STREAM_VALUE) .bytes(eventSerializer.writeEventValue(signal.get())); } else if (signal.isOnComplete()) { builder.event(peerWatchId, eventIdentifier, InternalApiConsts.EVENT_STREAM_CLOSE_REMOVED); } else if (signal.isOnError() && signal.getThrowable() instanceof PeerNotConnectedException) { builder.event(peerWatchId, eventIdentifier, InternalApiConsts.EVENT_STREAM_CLOSE_NO_CONNECTION); } else { throw new ImplementationError("Unexpected event signal " + signal); } return builder.build(); }
Example 5
Source File: DefaultStepVerifierBuilder.java From reactor-core with Apache License 2.0 | 5 votes |
boolean onSignalSequence(Signal<T> actualSignal, SignalSequenceEvent<T> sequenceEvent) { Iterator<? extends T> currentNextAs = this.currentNextAs; if (currentNextAs == null) { currentNextAs = sequenceEvent.iterable.iterator(); this.currentNextAs = currentNextAs; } Optional<AssertionError> error = sequenceEvent.test(actualSignal, currentNextAs); if (error == EXPECT_MORE) { if (actualSignal.isOnNext()) { unasserted--; } return false; } if (!error.isPresent()) { this.currentNextAs = null; this.script.poll(); if (actualSignal.isOnNext()) { unasserted--; } } else { Exceptions.addThrowable(ERRORS, this, error.get()); if(actualSignal.isOnError()) { // #55 ensure the onError is added as a suppressed to the AssertionError error.get().addSuppressed(actualSignal.getThrowable()); } maybeCancel(actualSignal); this.completeLatch.countDown(); return true; } return false; }
Example 6
Source File: DefaultStepVerifierBuilder.java From reactor-core with Apache License 2.0 | 4 votes |
/** Cancels this subscriber if the actual signal is null or not a complete/error */ final void maybeCancel(@Nullable Signal<T> actualSignal) { if (actualSignal == null || (!actualSignal.isOnComplete() && !actualSignal.isOnError())) { cancel(); } }