Skip to content

Commit 23bf2f3

Browse files
committed
Resole code review comments
- Removed POC experimental code
1 parent 318138b commit 23bf2f3

5 files changed

Lines changed: 4 additions & 15 deletions

File tree

basic/grpc-client/src/main/java/org/springframework/integration/samples/grpc/configuration/ClientHelloWorldConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ IntegrationFlow grpcOutboundFlowSingleResponse(ManagedChannel managedChannel,
189189
IntegrationFlow grpcOutboundFlowStreamResponse(ManagedChannel managedChannel,
190190
MessageChannel grpcInputChannelStreamResponse,
191191
FluxMessageChannel grpcStreamOutputChannel) {
192-
//TODO: Need advice, there has to be a better way than what I have below (or is this a bug in the
193-
// GrpcOutboundGateway?
194192
GrpcOutboundGateway gateway = new GrpcOutboundGateway(managedChannel, HelloWorldServiceGrpc.class);
195193
gateway.setMethodName("StreamSayHello");
196194

basic/grpc-client/src/test/java/org/springframework/integration/samples/grpc/GrpcClientTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.springframework.boot.test.context.SpringBootTest;
3535
import org.springframework.boot.test.context.TestConfiguration;
3636
import org.springframework.context.annotation.Bean;
37-
import org.springframework.context.annotation.Primary;
3837
import org.springframework.integration.channel.FluxMessageChannel;
3938
import org.springframework.integration.channel.QueueChannel;
4039
import org.springframework.integration.grpc.proto.HelloReply;
@@ -51,10 +50,7 @@
5150
/**
5251
* @author Glenn Renfro
5352
*/
54-
@SpringBootTest(properties = {
55-
"spring.main.web-application-type=none",
56-
"spring.main.allow-bean-definition-overriding=true"
57-
})
53+
@SpringBootTest
5854
class GrpcClientTests {
5955

6056
private static Server mockGrpcServer;
@@ -173,15 +169,13 @@ public void streamSayHello(HelloRequest request, StreamObserver<HelloReply> resp
173169
private static class GrpcClientTestConfiguration {
174170

175171
@Bean
176-
@Primary
177172
public ApplicationRunner grpcClientSingleResponse() {
178173
return args -> {
179174
// No-op for tests
180175
};
181176
}
182177

183178
@Bean
184-
@Primary
185179
public ApplicationRunner grpcClientStreamResponse() {
186180
return args -> {
187181
// No-op for tests

basic/grpc-server/src/test/java/org/springframework/integration/samples/grpc/GrpcServerTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,18 @@
3030

3131
import org.springframework.beans.factory.annotation.Autowired;
3232
import org.springframework.boot.test.context.SpringBootTest;
33-
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
3433
import org.springframework.grpc.server.lifecycle.GrpcServerLifecycle;
3534
import org.springframework.integration.grpc.proto.HelloReply;
3635
import org.springframework.integration.grpc.proto.HelloRequest;
3736
import org.springframework.integration.grpc.proto.HelloWorldServiceGrpc;
3837
import org.springframework.test.context.TestPropertySource;
39-
import org.springframework.test.util.ReflectionTestUtils;
4038

4139
import static org.assertj.core.api.Assertions.assertThat;
4240

4341
/**
4442
* @author Glenn Renfro
4543
*/
46-
@SpringBootTest(webEnvironment = WebEnvironment.NONE)
44+
@SpringBootTest
4745
@TestPropertySource(properties = "spring.grpc.server.port=0")
4846
class GrpcServerTests {
4947

@@ -60,8 +58,7 @@ class GrpcServerTests {
6058

6159
@BeforeEach
6260
void setUp() {
63-
Object server = ReflectionTestUtils.getField(this.grpcServerLifecycle, "server");
64-
this.grpcServerPort = ReflectionTestUtils.invokeMethod(server, "getPort");
61+
this.grpcServerPort = this.grpcServerLifecycle.getPort();
6562

6663
this.channel = ManagedChannelBuilder.forAddress("localhost", this.grpcServerPort)
6764
.usePlaintext()

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ subprojects { subproject ->
329329
mongoDriverVersion = '5.6.2'
330330
oracleDriverVersion = '23.26.0.0.0'
331331
postgresVersion = '42.7.9'
332+
protobufVersion = '4.29.4'
332333
slf4jVersion = '2.0.17'
333334
springCloudVersion = '2025.1.0'
334335
springIntegrationVersion = '7.1.0-SNAPSHOT'

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
version=7.1.0
22
springBootVersion=4.1.0-SNAPSHOT
3-
protobufVersion=4.29.4
43
org.gradle.jvmargs=-Xmx1536M -Dfile.encoding=UTF-8
54
org.gradle.caching=true
65
org.gradle.parallel=true

0 commit comments

Comments
 (0)