Skip to content

Commit

Permalink
Fix ChainedCallIntegrationTest
Browse files Browse the repository at this point in the history
  • Loading branch information
rmichela committed Jul 10, 2018
1 parent 43c7ae2 commit 137bb6f
Showing 1 changed file with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,30 @@ public void stopServer() throws InterruptedException {
public void servicesCanCallOtherServices() throws InterruptedException {
ReactorGreeterGrpc.ReactorGreeterStub stub = ReactorGreeterGrpc.newReactorStub(channel);

Mono<HelloRequest> input = Mono.just(request("X"));
Mono<HelloRequest> one = stub.sayHello(input)
Mono<String> chain = Mono.just(request("X"))
// one -> one
.compose(stub::sayHello)
.map(ChainedCallIntegrationTest::bridge)
.doOnSuccess(System.out::println);
Flux<HelloRequest> two = stub.sayHelloRespStream(one)
.doOnSuccess(System.out::println)
// one -> many
.as(stub::sayHelloRespStream)
.map(ChainedCallIntegrationTest::bridge)
.doOnNext(System.out::println);
Flux<HelloRequest> three = stub.sayHelloBothStream(two)
.doOnNext(System.out::println)
// many -> many
.compose(stub::sayHelloBothStream)
.map(ChainedCallIntegrationTest::bridge)
.doOnNext(System.out::println);
Mono<HelloRequest> four = stub.sayHelloReqStream(three)
.doOnNext(System.out::println)
// many -> one
.as(stub::sayHelloReqStream)
.map(ChainedCallIntegrationTest::bridge)
.doOnSuccess(System.out::println);
Mono<String> five = stub.sayHello(four)
.doOnSuccess(System.out::println)
// one -> one
.compose(stub::sayHello)
.map(HelloResponse::getMessage)
.doOnSuccess(System.out::println);

StepVerifier.create(five)

StepVerifier.create(chain)
.expectNext("[<{[X]}> :: </[X]/> :: <\\[X]\\> :: <([X])>]")
.expectComplete()
.verify(Duration.ofSeconds(2));
Expand Down

0 comments on commit 137bb6f

Please sign in to comment.