use of reactor.core.publisher.FluxOnAssembly.AssemblySnapshot in project reactor-core by reactor.
the class FluxCallableOnAssemblyTest method stepNameAndToString.
@Test
public void stepNameAndToString() {
AssemblySnapshot stacktrace = new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get());
FluxCallableOnAssembly<?> test = new FluxCallableOnAssembly<>(Flux.empty(), stacktrace);
assertThat(test.toString()).isEqualTo(test.stepName()).startsWith("reactor.core.publisher.FluxCallableOnAssemblyTest.stepNameAndToString(FluxCallableOnAssemblyTest.java:");
}
use of reactor.core.publisher.FluxOnAssembly.AssemblySnapshot in project reactor-core by reactor.
the class Mono method onAssembly.
/**
* To be used by custom operators: invokes assembly {@link Hooks} pointcut given a
* {@link Mono}, potentially returning a new {@link Mono}. This is for example useful
* to activate cross-cutting concerns at assembly time, eg. a generalized
* {@link #checkpoint()}.
*
* @param <T> the value type
* @param source the source to apply assembly hooks onto
*
* @return the source, potentially wrapped with assembly time cross-cutting behavior
*/
@SuppressWarnings("unchecked")
protected static <T> Mono<T> onAssembly(Mono<T> source) {
Function<Publisher, Publisher> hook = Hooks.onEachOperatorHook;
if (hook != null) {
source = (Mono<T>) hook.apply(source);
}
if (Hooks.GLOBAL_TRACE) {
AssemblySnapshot stacktrace = new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get());
source = (Mono<T>) Hooks.addAssemblyInfo(source, stacktrace);
}
return source;
}
use of reactor.core.publisher.FluxOnAssembly.AssemblySnapshot in project reactor-core by reactor.
the class FluxOnAssemblyTest method stepNameAndToString.
@Test
void stepNameAndToString() {
int baseline = getBaseline();
FluxOnAssembly<?> test = new FluxOnAssembly<>(Flux.empty(), new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get()));
assertThat(test.toString()).isEqualTo(test.stepName()).isEqualTo("reactor.core.publisher.FluxOnAssemblyTest.stepNameAndToString(FluxOnAssemblyTest.java:" + (baseline + 1) + ")");
}
use of reactor.core.publisher.FluxOnAssembly.AssemblySnapshot in project reactor-core by reactor.
the class FluxOnAssemblyTest method scanOperator.
@Test
void scanOperator() {
Flux<?> source = Flux.empty();
FluxOnAssembly<?> test = new FluxOnAssembly<>(source, new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get()));
assertThat(test.scan(Scannable.Attr.ACTUAL_METADATA)).as("ACTUAL_METADATA").isTrue();
assertThat(test.scan(Scannable.Attr.PREFETCH)).as("PREFETCH").isEqualTo(-1);
assertThat(test.scan(Scannable.Attr.PARENT)).as("PARENT").isSameAs(source);
assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC);
}
Aggregations