use of reactor.core.Scannable in project reactor-core by reactor.
the class DefaultStepVerifierBuilder method expectNoAccessibleContext.
@Override
public DefaultStepVerifierBuilder<T> expectNoAccessibleContext() {
return consumeSubscriptionWith(sub -> {
Scannable lowest = Scannable.from(sub);
Scannable verifierSubscriber = Scannable.from(lowest.scan(Scannable.Attr.ACTUAL));
Context c = Flux.fromStream(verifierSubscriber.parents()).ofType(CoreSubscriber.class).map(CoreSubscriber::currentContext).blockLast();
if (c != null) {
throw errorFormatter.assertionError("Expected no accessible Context, got " + c);
}
});
}
use of reactor.core.Scannable in project reactor-core by reactor.
the class BaseOperatorTest method touchInner.
final void touchInner(@Nullable Object t) {
if (t == null)
return;
Scannable o = Scannable.from(t);
o.scan(Scannable.Attr.ACTUAL);
o.scan(Scannable.Attr.BUFFERED);
o.scan(Scannable.Attr.CANCELLED);
o.scan(Scannable.Attr.CAPACITY);
o.scan(Scannable.Attr.DELAY_ERROR);
o.scan(Scannable.Attr.ERROR);
o.scan(Scannable.Attr.PREFETCH);
o.scan(Scannable.Attr.PARENT);
o.scan(Scannable.Attr.REQUESTED_FROM_DOWNSTREAM);
o.scan(Scannable.Attr.TERMINATED);
o.inners();
}
use of reactor.core.Scannable in project reactor-core by reactor.
the class BaseOperatorTest method fluxState.
final PO fluxState(OperatorScenario<I, PI, O, PO> scenario, boolean conditional) {
Flux<I> source = Flux.from(s -> {
Scannable t = Scannable.from(s);
assertThat(t.scan(Scannable.Attr.ERROR)).isNull();
assertThat(t.scanOrDefault(Scannable.Attr.TERMINATED, false)).isFalse();
if (scenario.prefetch() != -1) {
assertThat(t.scan(Scannable.Attr.PREFETCH)).isEqualTo(scenario.prefetch());
}
touchTreeState(s);
s.onSubscribe(Operators.emptySubscription());
// noop path
s.onSubscribe(Operators.emptySubscription());
// noop path
s.onSubscribe(Operators.cancelledSubscription());
s.onComplete();
touchTreeState(s);
if (scenario.shouldAssertPostTerminateState()) {
assertThat(t.scanOrDefault(Scannable.Attr.TERMINATED, true)).isTrue();
}
});
return applyStateScenario(scenario, conditional, source);
}
use of reactor.core.Scannable in project reactor-core by reactor.
the class FluxOnBackpressureBufferTimeoutTest method scanOperator.
@Test
public void scanOperator() {
Scannable test = (Scannable) Flux.never().onBackpressureBuffer(Duration.ofSeconds(1), 123, v -> {
}, Schedulers.single());
assertThat(test.scan(Scannable.Attr.RUN_ON)).isSameAs(Schedulers.single());
}
use of reactor.core.Scannable in project reactor-core by reactor.
the class FluxPublishOnTest method scanRunOn.
@Test
public void scanRunOn() {
Scannable publishOnScannable = Scannable.from(Flux.just(1).hide().publishOn(Schedulers.elastic()));
Scannable runOnScannable = publishOnScannable.scan(Scannable.Attr.RUN_ON);
Assertions.assertThat(runOnScannable).isNotNull().matches(Scannable::isScanAvailable, "isScanAvailable");
System.out.println(runOnScannable + " isScannable " + runOnScannable.isScanAvailable());
System.out.println(runOnScannable.scan(Scannable.Attr.NAME));
runOnScannable.parents().forEach(System.out::println);
System.out.println(runOnScannable.scan(Scannable.Attr.BUFFERED));
}
Aggregations