Java Code Examples for reactor.core.publisher.Hooks#onOperatorDebug()
The following examples show how to use
reactor.core.publisher.Hooks#onOperatorDebug() .
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: TransactionalServiceIntegrationTests.java From spring-data-examples with Apache License 2.0 | 6 votes |
@Before public void setUp() { Hooks.onOperatorDebug(); List<String> statements = Arrays.asList(// "DROP TABLE IF EXISTS customer;", "CREATE TABLE customer ( id SERIAL PRIMARY KEY, firstname VARCHAR(100) NOT NULL, lastname VARCHAR(100) NOT NULL);"); statements.forEach(it -> database.execute(it) // .fetch() // .rowsUpdated() // .as(StepVerifier::create) // .expectNextCount(1) // .verifyComplete()); }
Example 2
Source File: CustomerRepositoryIntegrationTests.java From spring-data-examples with Apache License 2.0 | 6 votes |
@Before public void setUp() { Hooks.onOperatorDebug(); List<String> statements = Arrays.asList(// "DROP TABLE IF EXISTS customer;", "CREATE TABLE customer ( id SERIAL PRIMARY KEY, firstname VARCHAR(100) NOT NULL, lastname VARCHAR(100) NOT NULL);"); statements.forEach(it -> database.execute(it) // .fetch() // .rowsUpdated() // .as(StepVerifier::create) // .expectNextCount(1) // .verifyComplete()); }
Example 3
Source File: ReactivePostRepositoryTest.java From POC with Apache License 2.0 | 6 votes |
@BeforeEach void setUp() { Hooks.onOperatorDebug(); List<String> statements = Arrays.asList(// "DROP TABLE IF EXISTS reactive_posts;", "CREATE TABLE reactive_posts ( id SERIAL PRIMARY KEY, title VARCHAR(100) NOT NULL, content VARCHAR(100) NOT NULL);"); statements.forEach(it -> this.databaseClient.execute(it) // .fetch() // .rowsUpdated() // .as(StepVerifier::create) // .expectNextCount(1) // .verifyComplete()); }
Example 4
Source File: HooksTraceTest.java From reactor-core with Apache License 2.0 | 6 votes |
@Test public void testTraceComposed2() { Hooks.onOperatorDebug(); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> Flux.just(1) .flatMap(d -> { throw new RuntimeException(); }) .filter(d -> true) .doOnNext(d -> System.currentTimeMillis()) .map(d -> d) .blockLast() ).satisfies(e -> assertThat(e.getSuppressed()[0]) .hasMessageContaining("HooksTraceTest.java:") .hasMessageContaining("|_ Flux.flatMap ⇢ at reactor.HooksTraceTest.lambda$testTraceComposed2$31(HooksTraceTest.java:") ); }
Example 5
Source File: R080_Backpressure.java From reactor-workshop with GNU General Public License v3.0 | 6 votes |
@Test public void whatIsBackpressure() throws Exception { //given Hooks.onOperatorDebug(); final Flux<Long> flux = Flux .interval(Duration.ofMillis(10)) .doOnNext(x -> log.info("Emitting {}", x)) .onBackpressureError() .onBackpressureDrop(x -> log.warn("Dropped {}", x)) .publishOn(newElastic("Two")); //when flux.subscribe(x -> { log.info("Handling {}", x); Sleeper.sleep(Duration.ofMillis(1110)); }, e -> { log.error("Opps", e); } ); //then TimeUnit.SECONDS.sleep(50); }
Example 6
Source File: R2dbcApplicationIntegrationTest.java From tutorials with MIT License | 6 votes |
@Before public void setup() { Hooks.onOperatorDebug(); List<String> statements = Arrays.asList(// "DROP TABLE IF EXISTS player;", "CREATE table player (id INT AUTO_INCREMENT NOT NULL, name VARCHAR2, age INT NOT NULL);"); statements.forEach(it -> client.execute(it) // .fetch() // .rowsUpdated() // .as(StepVerifier::create) // .expectNextCount(1) // .verifyComplete()); }
Example 7
Source File: ReactiveRequestProcessingTest.java From crnk-framework with Apache License 2.0 | 6 votes |
@Test public void getTasks() throws IOException { Mockito.when(requestContextBase.getMethod()).thenReturn("GET"); Mockito.when(requestContextBase.getPath()).thenReturn("/reactive/task/"); Mockito.when(requestContextBase.getRequestHeader("Accept")).thenReturn("*"); Hooks.onOperatorDebug(); HttpResponse response = processor.processAsync(requestContext).get(); String json = new String(response.getBody()); Assert.assertEquals(200, response.getStatusCode()); Document document = boot.getObjectMapper().readerFor(Document.class).readValue(json); Assert.assertTrue(document.getData().isPresent()); List<Resource> resources = document.getCollectionData().get(); Assert.assertEquals(1, resources.size()); Resource resource = resources.get(0); Assert.assertEquals("http://localhost:8080/reactive/task/1", resource.getLinks().get("self").asText()); Assert.assertNotNull(resource.getLinks().get("value")); }
Example 8
Source File: ApiController.java From Learning-Spring-Boot-2.0-Second-Edition with MIT License | 5 votes |
@GetMapping(API_BASE_PATH + "/images") Flux<Image> images() { Hooks.onOperatorDebug(); return Flux.just( new Image(1, "learning-spring-boot-cover.jpg"), new Image(2, "learning-spring-boot-2nd-edition-cover.jpg"), new Image(3, "bazinga.png") ); }
Example 9
Source File: GuideTests.java From reactor-core with Apache License 2.0 | 5 votes |
@Before public void populateDebug() { if (testName.getMethodName().equals("debuggingCommonStacktrace")) { toDebug = scatterAndGather(urls()); } else if (testName.getMethodName().startsWith("debuggingActivated")) { Hooks.onOperatorDebug(); toDebug = scatterAndGather(urls()); } }
Example 10
Source File: ScannableTest.java From reactor-core with Apache License 2.0 | 5 votes |
@Test public void operatorChainWithDebugMode() { Hooks.onOperatorDebug(); List<String> downstream = new ArrayList<>(); List<String> upstream = new ArrayList<>(); Mono<?> m= Flux.from(s -> { Scannable thisSubscriber = Scannable.from(s); assertThat(thisSubscriber.isScanAvailable()).as("thisSubscriber.isScanAvailable").isTrue(); thisSubscriber.steps().forEach(downstream::add); }) .map(a -> a) .delayElements(Duration.ofMillis(10)) .filter(a -> true) .reduce((a, b) -> b); m.subscribe(); Scannable thisOperator = Scannable.from(m); assertThat(thisOperator.isScanAvailable()).as("thisOperator.isScanAvailable").isTrue(); thisOperator.steps().forEach(upstream::add); assertThat(downstream).containsExactly( "Flux.from ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:537)", "Flux.map ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:542)", "Flux.delayElements ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:543)", "Flux.filter ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:544)", "Flux.reduce ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:545)", "lambda"); assertThat(upstream).containsExactly( "Flux.from ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:537)", "Flux.map ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:542)", "Flux.delayElements ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:543)", "Flux.filter ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:544)", "Flux.reduce ⇢ at reactor.core.ScannableTest.operatorChainWithDebugMode(ScannableTest.java:545)"); }
Example 11
Source File: ApiController.java From Learning-Spring-Boot-2.0-Second-Edition with MIT License | 5 votes |
@PostMapping(API_BASE_PATH + "/images") Mono<Void> create(@RequestPart Flux<FilePart> images) { Hooks.onOperatorDebug(); return images .map(image -> { log.info("We will save " + image + " to a Reactive database soon!"); return image; }) .then(); }
Example 12
Source File: ReactorProbe.java From Hands-On-Reactive-Programming-with-Reactor with MIT License | 5 votes |
@Test public void testPublisherStub() throws Exception { Hooks.onOperatorDebug(); TestPublisher<Long> numberGenerator= TestPublisher.<Long>create(); StringWriter out = new StringWriter(); new PrintService().printEventNumbers(numberGenerator.flux(),new PrintWriter(out)); numberGenerator.next(1L,2L,3L,4L); numberGenerator.complete(); assertTrue(out.getBuffer().length() >0); }
Example 13
Source File: HooksTraceTest.java From reactor-core with Apache License 2.0 | 5 votes |
@Test public void testTraceComposed() { Hooks.onOperatorDebug(); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> Mono.just(1) .flatMap(d -> Mono.error(new RuntimeException())) .filter(d -> true) .doOnNext(d -> System.currentTimeMillis()) .map(d -> d) .block() ).satisfies(e -> assertThat(e.getSuppressed()[0]) .hasMessageContaining("HooksTraceTest.java:") .hasMessageContaining("|_ Mono.flatMap ⇢ at reactor.HooksTraceTest.lambda$testTraceComposed$25(HooksTraceTest.java:") ); }
Example 14
Source File: GatewayApplication.java From rsocket-routing-sample with Apache License 2.0 | 4 votes |
public static void main(String[] args) { Hooks.onOperatorDebug(); //ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID); SpringApplication.run(GatewayApplication.class, args); }
Example 15
Source File: LearningSpringBootImagesApplication.java From Learning-Spring-Boot-2.0-Second-Edition with MIT License | 4 votes |
@Autowired protected void initialize(ReactorCoreProperties properties) { if (properties.getStacktraceMode().isEnabled()) { Hooks.onOperatorDebug(); } }
Example 16
Source File: DemoApplication.java From Hands-On-Reactive-Programming-in-Spring-5 with MIT License | 4 votes |
public static void main(String[] args) { Hooks.onOperatorDebug(); SpringApplication.run(DemoApplication.class, args); }
Example 17
Source File: ConsumerDebuggingApplication.java From tutorials with MIT License | 4 votes |
public static void main(String[] args) { Hooks.onOperatorDebug(); SpringApplication app = new SpringApplication(ConsumerDebuggingApplication.class); app.setDefaultProperties(Collections.singletonMap("server.port", "8082")); app.run(args); }
Example 18
Source File: PingPongApp.java From spring-cloud-rsocket with Apache License 2.0 | 4 votes |
public static void main(String[] args) { Hooks.onOperatorDebug(); SpringApplication.run(PingPongApp.class, args); }
Example 19
Source File: BrokerActuatorIntegrationTests.java From spring-cloud-rsocket with Apache License 2.0 | 4 votes |
@BeforeClass public static void init() { Hooks.onOperatorDebug(); port = SocketUtils.findAvailableTcpPort(); System.setProperty("spring.rsocket.server.port", String.valueOf(port)); }
Example 20
Source File: OwnerControllerTests.java From spring-graalvm-native with Apache License 2.0 | 4 votes |
@Test public void testInitUpdateOwnerForm() throws Exception { Hooks.onOperatorDebug(); client.get().uri("/owners/{ownerId}/edit", TEST_OWNER_ID).exchange() .expectStatus().isOk(); }