|
27 | 27 | import org.junit.jupiter.api.Disabled; |
28 | 28 | import org.junit.jupiter.api.Test; |
29 | 29 | import org.reactivestreams.Publisher; |
30 | | -import reactor.core.publisher.*; |
| 30 | +import reactor.core.publisher.DirectProcessor; |
| 31 | +import reactor.core.publisher.EmitterProcessor; |
| 32 | +import reactor.core.publisher.Flux; |
| 33 | +import reactor.core.publisher.Hooks; |
| 34 | +import reactor.core.publisher.Mono; |
| 35 | +import reactor.core.publisher.UnicastProcessor; |
31 | 36 | import reactor.test.StepVerifier; |
32 | 37 |
|
33 | 38 | public class ServiceRemoteTest extends BaseTest { |
@@ -374,15 +379,18 @@ public void test_remote_bidi_greeting_message_expect_IllegalArgumentException() |
374 | 379 |
|
375 | 380 | // call the service. bidiThrowingGreeting |
376 | 381 | Flux<GreetingResponse> responses = |
377 | | - service.bidiGreetingIllegalArgumentExceptionMessage( |
378 | | - Mono.just(ServiceMessage.builder() |
379 | | - .data(new GreetingRequest("IllegalArgumentException")).build())) |
| 382 | + service |
| 383 | + .bidiGreetingIllegalArgumentExceptionMessage( |
| 384 | + Mono.just( |
| 385 | + ServiceMessage.builder() |
| 386 | + .data(new GreetingRequest("IllegalArgumentException")) |
| 387 | + .build())) |
380 | 388 | .map(ServiceMessage::data); |
381 | 389 |
|
382 | 390 | // call the service. |
383 | 391 | StepVerifier.create(responses) |
384 | | - .expectErrorMessage("IllegalArgumentException") |
385 | | - .verify(Duration.ofSeconds(3)); |
| 392 | + .expectErrorMessage("IllegalArgumentException") |
| 393 | + .verify(Duration.ofSeconds(3)); |
386 | 394 | } |
387 | 395 |
|
388 | 396 | @Test |
@@ -414,14 +422,16 @@ public void test_remote_bidi_greeting_message_expect_NotAuthorized() { |
414 | 422 | DirectProcessor<GreetingRequest> requests = DirectProcessor.create(); |
415 | 423 |
|
416 | 424 | // call the service. |
417 | | - Flux<GreetingResponse> responses = service.bidiGreetingNotAuthorizedMessage( |
418 | | - requests.map(request -> ServiceMessage.builder().data(request).build())) |
| 425 | + Flux<GreetingResponse> responses = |
| 426 | + service |
| 427 | + .bidiGreetingNotAuthorizedMessage( |
| 428 | + requests.map(request -> ServiceMessage.builder().data(request).build())) |
419 | 429 | .map(ServiceMessage::data); |
420 | 430 |
|
421 | 431 | StepVerifier.create(responses) |
422 | | - .then(() -> requests.onNext(new GreetingRequest("joe-1"))) |
423 | | - .expectErrorMessage("Not authorized") |
424 | | - .verify(Duration.ofSeconds(3)); |
| 432 | + .then(() -> requests.onNext(new GreetingRequest("joe-1"))) |
| 433 | + .expectErrorMessage("Not authorized") |
| 434 | + .verify(Duration.ofSeconds(3)); |
425 | 435 | } |
426 | 436 |
|
427 | 437 | @Test |
@@ -459,20 +469,22 @@ public void test_remote_bidi_greeting_message_expect_GreetingResponse() { |
459 | 469 | UnicastProcessor<GreetingRequest> requests = UnicastProcessor.create(); |
460 | 470 |
|
461 | 471 | // call the service. |
462 | | - Flux<GreetingResponse> responses = service.bidiGreetingMessage(requests |
463 | | - .map(request -> ServiceMessage.builder().data(request).build())) |
| 472 | + Flux<GreetingResponse> responses = |
| 473 | + service |
| 474 | + .bidiGreetingMessage( |
| 475 | + requests.map(request -> ServiceMessage.builder().data(request).build())) |
464 | 476 | .map(ServiceMessage::data); |
465 | 477 |
|
466 | 478 | StepVerifier.create(responses) |
467 | | - .then(() -> requests.onNext(new GreetingRequest("joe-1"))) |
468 | | - .expectNextMatches(resp -> resp.getResult().equals(" hello to: joe-1")) |
469 | | - .then(() -> requests.onNext(new GreetingRequest("joe-2"))) |
470 | | - .expectNextMatches(resp -> resp.getResult().equals(" hello to: joe-2")) |
471 | | - .then(() -> requests.onNext(new GreetingRequest("joe-3"))) |
472 | | - .expectNextMatches(resp -> resp.getResult().equals(" hello to: joe-3")) |
473 | | - .then(() -> requests.onComplete()) |
474 | | - .expectComplete() |
475 | | - .verify(Duration.ofSeconds(3)); |
| 479 | + .then(() -> requests.onNext(new GreetingRequest("joe-1"))) |
| 480 | + .expectNextMatches(resp -> resp.getResult().equals(" hello to: joe-1")) |
| 481 | + .then(() -> requests.onNext(new GreetingRequest("joe-2"))) |
| 482 | + .expectNextMatches(resp -> resp.getResult().equals(" hello to: joe-2")) |
| 483 | + .then(() -> requests.onNext(new GreetingRequest("joe-3"))) |
| 484 | + .expectNextMatches(resp -> resp.getResult().equals(" hello to: joe-3")) |
| 485 | + .then(() -> requests.onComplete()) |
| 486 | + .expectComplete() |
| 487 | + .verify(Duration.ofSeconds(3)); |
476 | 488 | } |
477 | 489 |
|
478 | 490 | @Test |
|
0 commit comments