Java Code Examples for reactor.core.publisher.Signal#next()
The following examples show how to use
reactor.core.publisher.Signal#next() .
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 |
@Override public void onNext(T t) { if (establishedFusionMode == Fuseable.ASYNC) { serializeDrainAndSubscriptionEvent(); } else { produced++; unasserted++; if (currentCollector != null) { currentCollector.add(t); } Signal<T> signal = Signal.next(t); if (!checkRequestOverflow(signal)) { onExpectation(signal); } } }
Example 2
Source File: ValueFormattersTest.java From reactor-core with Apache License 2.0 | 6 votes |
@Test public void convertVarargsSignalNotExtractedIfConverterMatches() { Extractor<Signal> extractor = ValueFormatters.signalExtractor(); ToStringConverter converter = ValueFormatters.forClass(Object.class, o -> o.getClass().getSimpleName() + "=>" + o); Signal<Obscure> target = Signal.next(Obscure.OB1); Object[] converted = ValueFormatters.convertVarArgs(converter, Collections.singleton(extractor), target); assertThat(converted) .hasSize(1) .allSatisfy(o -> assertThat(o) .isInstanceOf(String.class) .isNotEqualTo(target.toString()) .isNotEqualTo("onNext(foo)") .isEqualTo("ImmutableSignal=>onNext(OB1)") ); }
Example 3
Source File: ValueFormattersTest.java From reactor-core with Apache License 2.0 | 5 votes |
@Test public void signalDoesntConsiderNonMatchingContent() { Extractor<Signal> extractor = ValueFormatters.signalExtractor(); ToStringConverter converter = ValueFormatters.forClass(String.class, String::toUpperCase); Signal<Object> target = Signal.next(Obscure.OB1); assertThat(extractor.apply(target, converter)).isEqualTo(target.toString()); }
Example 4
Source File: ValueFormattersTest.java From reactor-core with Apache License 2.0 | 5 votes |
@Test public void signalConvertsOnNextContentMatching() { Extractor<Signal> extractor = ValueFormatters.signalExtractor(); ToStringConverter converter = ValueFormatters.forClass(Obscure.class, Obscure::getAlternative); Signal<Obscure> target = Signal.next(Obscure.OB1); assertThat(extractor.apply(target, converter)) .isNotEqualTo(target.toString()) .isEqualTo("onNext(foo)"); }
Example 5
Source File: DefaultStepVerifierBuilder.java From reactor-core with Apache License 2.0 | 4 votes |
void drainAsyncLoop(){ T t; long r = requested; for( ; ;) { boolean d = done; if (d && qs.isEmpty()) { if(get() == Operators.cancelledSubscription()){ return; } if(errors != null){ onExpectation(Signal.complete()); } this.completeLatch.countDown(); return; } if (r == 0L) { return; } long p = 0L; while (p != r) { if(get() == Operators.cancelledSubscription()){ return; } try { t = qs.poll(); if (t == null) { break; } p++; produced++; unasserted++; } catch (Throwable e) { Exceptions.throwIfFatal(e); cancel(); onError(Exceptions.unwrap(e)); return; } if (currentCollector != null) { currentCollector.add(t); } Signal<T> signal = Signal.next(t); if (!checkRequestOverflow(signal)) { onExpectation(signal); if (d && qs.isEmpty()) { if(get() == Operators.cancelledSubscription()){ return; } if(errors != null){ onExpectation(Signal.complete()); } this.completeLatch.countDown(); return; } } else { return; } } if (p != 0) { r = REQUESTED.addAndGet(this, -p); } if(r == 0L || qs.isEmpty()){ break; } } }