Skip to content

Commit 80e129a

Browse files
authored
Remove Netty dependency exclude from tests
To disable the activation of the Netty server when using the inprocess server add `@AutoConfigureTestGrpcTransport` to the test. * Remove explicit in-process flags from tests. With the use of the `@AutoConfigureTestGrpcTransport` these are no longer necessary
1 parent 7ac33ea commit 80e129a

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.junit.jupiter.api.Test;
2222
import org.junit.jupiter.api.extension.ExtendWith;
2323

24+
import org.springframework.boot.grpc.test.autoconfigure.AutoConfigureTestGrpcTransport;
2425
import org.springframework.boot.test.context.SpringBootTest;
2526
import org.springframework.boot.test.context.TestConfiguration;
2627
import org.springframework.boot.test.system.CapturedOutput;
@@ -36,12 +37,10 @@
3637
*
3738
* @author Glenn Renfro
3839
*/
39-
@SpringBootTest(properties = {
40-
"spring.grpc.server.inprocess.name=test",
41-
"spring.grpc.client.channels.spring-integration.address=in-process:test"
42-
})
40+
@SpringBootTest
4341
@DirtiesContext
4442
@ExtendWith(OutputCaptureExtension.class)
43+
@AutoConfigureTestGrpcTransport
4544
public class GrpcClientTests {
4645

4746
/**

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.junit.jupiter.api.Test;
2929

3030
import org.springframework.beans.factory.annotation.Autowired;
31+
import org.springframework.boot.grpc.test.autoconfigure.AutoConfigureTestGrpcTransport;
3132
import org.springframework.boot.test.context.SpringBootTest;
3233
import org.springframework.grpc.client.ImportGrpcClients;
3334

@@ -38,16 +39,13 @@
3839
*
3940
* @author Glenn Renfro
4041
*/
41-
@SpringBootTest({
42-
"spring.grpc.server.inprocess.name=test"
43-
})
42+
@SpringBootTest
4443
@ImportGrpcClients(
4544
types = {
4645
SimpleGrpc.SimpleBlockingStub.class,
4746
SimpleGrpc.SimpleStub.class
48-
},
49-
target = "in-process:test"
50-
)
47+
})
48+
@AutoConfigureTestGrpcTransport
5149
class GrpcServerTests {
5250

5351
private static final Log LOGGER = LogFactory.getLog(GrpcServerTests.class);

build.gradle

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -891,9 +891,7 @@ project('grpc-client') {
891891
implementation 'org.springframework.integration:spring-integration-grpc'
892892

893893
//Test
894-
testImplementation ('org.springframework.boot:spring-boot-starter-grpc-test') {
895-
exclude group: 'io.grpc', module: 'grpc-netty' //TODO Review this exclusion prior to 7.1.0 release
896-
}
894+
testImplementation ('org.springframework.boot:spring-boot-starter-grpc-test')
897895
}
898896

899897

@@ -946,9 +944,7 @@ project('grpc-server') {
946944
implementation 'org.springframework.integration:spring-integration-grpc'
947945

948946
//Test
949-
testImplementation ('org.springframework.boot:spring-boot-starter-grpc-test') {
950-
exclude group: 'io.grpc', module: 'grpc-netty' //TODO Review this exclusion prior to 7.1.0 release
951-
}
947+
testImplementation ('org.springframework.boot:spring-boot-starter-grpc-test')
952948
}
953949

954950
protobuf {

0 commit comments

Comments
 (0)