diff --git a/samples/grpc-reactive/build.gradle b/samples/grpc-reactive/build.gradle
index fc48a41..eea289b 100644
--- a/samples/grpc-reactive/build.gradle
+++ b/samples/grpc-reactive/build.gradle
@@ -17,9 +17,9 @@ java {
repositories {
mavenCentral()
+ mavenLocal()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
- mavenLocal()
}
dependencyManagement {
diff --git a/samples/grpc-reactive/pom.xml b/samples/grpc-reactive/pom.xml
index 0e51c20..1cbf323 100644
--- a/samples/grpc-reactive/pom.xml
+++ b/samples/grpc-reactive/pom.xml
@@ -74,6 +74,10 @@
io.projectreactor
reactor-core
+
+ io.projectreactor
+ reactor-test
+
com.salesforce.servicelibs
reactor-grpc-stub
diff --git a/samples/grpc-reactive/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java b/samples/grpc-reactive/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java
index 1e1642d..494c8d8 100644
--- a/samples/grpc-reactive/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java
+++ b/samples/grpc-reactive/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java
@@ -14,11 +14,16 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.grpc.client.GrpcChannelFactory;
import org.springframework.grpc.sample.proto.HelloReply;
import org.springframework.grpc.sample.proto.HelloRequest;
+import org.springframework.grpc.sample.proto.ReactorSimpleGrpc;
+import org.springframework.grpc.sample.proto.ReactorSimpleGrpc.ReactorSimpleStub;
import org.springframework.grpc.sample.proto.SimpleGrpc;
import org.springframework.grpc.test.AutoConfigureInProcessTransport;
import org.springframework.grpc.test.LocalGrpcPort;
import org.springframework.test.annotation.DirtiesContext;
+import reactor.core.publisher.Mono;
+import reactor.test.StepVerifier;
+
@SpringBootTest
@AutoConfigureInProcessTransport
public class GrpcServerApplicationTests {
@@ -30,7 +35,7 @@ public class GrpcServerApplicationTests {
}
@Autowired
- private SimpleGrpc.SimpleBlockingStub stub;
+ private ReactorSimpleStub stub;
@Test
@DirtiesContext
@@ -41,8 +46,10 @@ public class GrpcServerApplicationTests {
@DirtiesContext
void serverResponds() {
log.info("Testing");
- HelloReply response = stub.sayHello(HelloRequest.newBuilder().setName("Alien").build());
- assertEquals("Hello ==> Alien", response.getMessage());
+ Mono reply = stub.sayHello(HelloRequest.newBuilder().setName("Alien").build());
+ StepVerifier.create(reply.map(response -> response.getMessage()))
+ .expectNext("Hello ==> Alien")
+ .verifyComplete();
}
@TestConfiguration
@@ -50,8 +57,8 @@ public class GrpcServerApplicationTests {
@Bean
@Lazy
- SimpleGrpc.SimpleBlockingStub stub(GrpcChannelFactory channels, @LocalGrpcPort int port) {
- return SimpleGrpc.newBlockingStub(channels.createChannel("0.0.0.0:" + port));
+ ReactorSimpleStub stub(GrpcChannelFactory channels, @LocalGrpcPort int port) {
+ return ReactorSimpleGrpc.newReactorStub(channels.createChannel("0.0.0.0:" + port));
}
}