Skip to content

Commit 76ff80a

Browse files
onobcphilwebb
authored andcommitted
Add samples back into the build
Many of the samples are still failing and the tests have been marked with `@Disabled("Need to migrate to Spring Boot 4.1.x")`. See #234 Signed-off-by: onobc <chris.bono@gmail.com>
1 parent ba38651 commit 76ff80a

31 files changed

Lines changed: 220 additions & 151 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<module>spring-grpc-core</module>
2020
<module>spring-grpc-dependencies</module>
2121
<module>spring-grpc-docs</module>
22-
<!-- <module>samples</module>-->
22+
<module>samples</module>
2323
</modules>
2424

2525
<organization>

samples/grpc-client/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-M1</version>
9+
<version>4.1.0-GRPC-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -49,13 +49,13 @@
4949

5050
<dependencies>
5151
<dependency>
52-
<groupId>org.springframework.grpc</groupId>
53-
<artifactId>spring-grpc-client-spring-boot-starter</artifactId>
52+
<groupId>org.springframework.boot</groupId>
53+
<artifactId>spring-boot-starter-grpc-client</artifactId>
5454
</dependency>
5555

5656
<dependency>
57-
<groupId>org.springframework.grpc</groupId>
58-
<artifactId>spring-grpc-test</artifactId>
57+
<groupId>org.springframework.boot</groupId>
58+
<artifactId>spring-boot-starter-grpc-test</artifactId>
5959
<scope>test</scope>
6060
</dependency>
6161
<dependency>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
spring.application.name=grpc-client
2-
spring.grpc.client.default-channel.address=static://0.0.0.0:${launched.grpc.port:9090}
2+
spring.grpc.client.channel.default.target=static://0.0.0.0:${launched.grpc.port:9090}
33

44
#logging.level.org.springframework.experimental.boot.server.exec=debug

samples/grpc-client/src/test/java/org/springframework/grpc/sample/DefaultDeadlineSetupTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.io.File;
77

88
import org.junit.jupiter.api.Assertions;
9+
import org.junit.jupiter.api.Disabled;
910
import org.junit.jupiter.api.Nested;
1011
import org.junit.jupiter.api.Test;
1112
import org.junit.jupiter.api.condition.EnabledIf;
@@ -18,17 +19,20 @@
1819
import org.springframework.experimental.boot.server.exec.MavenClasspathEntry;
1920
import org.springframework.experimental.boot.test.context.DynamicProperty;
2021
import org.springframework.experimental.boot.test.context.EnableDynamicProperty;
22+
import org.springframework.grpc.client.ImportGrpcClients;
2123
import org.springframework.grpc.sample.proto.HelloRequest;
2224
import org.springframework.grpc.sample.proto.SimpleGrpc;
2325
import org.springframework.test.annotation.DirtiesContext;
2426

2527
import io.grpc.Status;
2628
import io.grpc.StatusRuntimeException;
2729

30+
@ImportGrpcClients
31+
@Disabled("Need to migrate to Spring Boot 4.1.x")
2832
public class DefaultDeadlineSetupTests {
2933

3034
@Nested
31-
@SpringBootTest(properties = "spring.grpc.client.default-channel.default-deadline=1s")
35+
@SpringBootTest(properties = "spring.grpc.client.channel.default.default-deadline=1s")
3236
@DirtiesContext
3337
@EnabledIf("serverJarAvailable")
3438
class Deadline {
@@ -76,7 +80,7 @@ public CommandLineRunner otherRunner(SimpleGrpc.SimpleBlockingStub stub) {
7680
}
7781

7882
@Nested
79-
@SpringBootTest(properties = "spring.grpc.client.default-channel.default-deadline=1s")
83+
@SpringBootTest(properties = "spring.grpc.client.channel.default.default-deadline=1s")
8084
@DirtiesContext
8185
@EnabledIf("serverJarAvailable")
8286
class WithoutDeadline {

samples/grpc-client/src/test/java/org/springframework/grpc/sample/GrpcClientApplicationTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
import org.springframework.experimental.boot.server.exec.MavenClasspathEntry;
1515
import org.springframework.experimental.boot.test.context.DynamicProperty;
1616
import org.springframework.experimental.boot.test.context.EnableDynamicProperty;
17+
import org.springframework.grpc.client.ImportGrpcClients;
1718
import org.springframework.test.annotation.DirtiesContext;
1819

1920
@SpringBootTest
2021
@DirtiesContext
2122
@EnabledIf("serverJarAvailable")
23+
@ImportGrpcClients
2224
public class GrpcClientApplicationTests {
2325

2426
public static void main(String[] args) {

samples/grpc-oauth2/pom.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-M1</version>
9+
<version>4.1.0-GRPC-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -46,17 +46,21 @@
4646
</dependencyManagement>
4747
<dependencies>
4848
<dependency>
49-
<groupId>org.springframework.grpc</groupId>
50-
<artifactId>spring-grpc-spring-boot-starter</artifactId>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter-grpc-client</artifactId>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.springframework.boot</groupId>
54+
<artifactId>spring-boot-starter-grpc-server</artifactId>
5155
</dependency>
5256
<dependency>
5357
<groupId>org.springframework.boot</groupId>
5458
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
5559
</dependency>
5660

5761
<dependency>
58-
<groupId>org.springframework.grpc</groupId>
59-
<artifactId>spring-grpc-test</artifactId>
62+
<groupId>org.springframework.boot</groupId>
63+
<artifactId>spring-boot-starter-grpc-test</artifactId>
6064
<scope>test</scope>
6165
</dependency>
6266
<dependency>

samples/grpc-oauth2/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.concurrent.atomic.AtomicReference;
88

99
import org.awaitility.Awaitility;
10+
import org.junit.jupiter.api.Disabled;
1011
import org.junit.jupiter.api.Test;
1112
import org.springframework.beans.factory.ObjectProvider;
1213
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,9 +39,10 @@
3839
import io.grpc.reflection.v1.ServerReflectionResponse;
3940
import io.grpc.stub.StreamObserver;
4041

41-
@SpringBootTest(properties = { "spring.grpc.server.port=0",
42-
"spring.grpc.client.default-channel.address=static://0.0.0.0:${local.grpc.port}" })
42+
@SpringBootTest(properties = { "spring.grpc.server.address=0.0.0.0:0",
43+
"spring.grpc.client.channel.default.target=static://0.0.0.0:${local.grpc.sever.port}" })
4344
@DirtiesContext
45+
@Disabled("Need to migrate to Spring Boot 4.1.x")
4446
public class GrpcServerApplicationTests {
4547

4648
public static void main(String[] args) {

samples/grpc-reactive/pom.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-M1</version>
9+
<version>4.1.0-GRPC-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -46,8 +46,12 @@
4646
</dependencyManagement>
4747
<dependencies>
4848
<dependency>
49-
<groupId>org.springframework.grpc</groupId>
50-
<artifactId>spring-grpc-spring-boot-starter</artifactId>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter-grpc-client</artifactId>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.springframework.boot</groupId>
54+
<artifactId>spring-boot-starter-grpc-server</artifactId>
5155
</dependency>
5256
<dependency>
5357
<groupId>org.springframework.boot</groupId>
@@ -71,8 +75,8 @@
7175
</dependency>
7276

7377
<dependency>
74-
<groupId>org.springframework.grpc</groupId>
75-
<artifactId>spring-grpc-test</artifactId>
78+
<groupId>org.springframework.boot</groupId>
79+
<artifactId>spring-boot-starter-grpc-test</artifactId>
7680
<scope>test</scope>
7781
</dependency>
7882
<dependency>

samples/grpc-reactive/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.junit.jupiter.api.Test;
66
import org.springframework.beans.factory.annotation.Autowired;
77
import org.springframework.boot.builder.SpringApplicationBuilder;
8-
import org.springframework.boot.grpc.test.autoconfigure.AutoConfigureInProcessTransport;
8+
import org.springframework.boot.grpc.test.autoconfigure.AutoConfigureTestGrpcTransport;
99
import org.springframework.boot.test.context.SpringBootTest;
1010
import org.springframework.boot.test.context.TestConfiguration;
1111
import org.springframework.grpc.client.ImportGrpcClients;
@@ -20,7 +20,7 @@
2020

2121
@SpringBootTest
2222
@DirtiesContext
23-
@AutoConfigureInProcessTransport
23+
@AutoConfigureTestGrpcTransport
2424
public class GrpcServerApplicationTests {
2525

2626
private static Log log = LogFactory.getLog(GrpcServerApplicationTests.class);

samples/grpc-secure/pom.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-M1</version>
9+
<version>4.1.0-GRPC-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -46,17 +46,21 @@
4646
</dependencyManagement>
4747
<dependencies>
4848
<dependency>
49-
<groupId>org.springframework.grpc</groupId>
50-
<artifactId>spring-grpc-spring-boot-starter</artifactId>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter-grpc-client</artifactId>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.springframework.boot</groupId>
54+
<artifactId>spring-boot-starter-grpc-server</artifactId>
5155
</dependency>
5256
<dependency>
5357
<groupId>org.springframework.boot</groupId>
5458
<artifactId>spring-boot-starter-security</artifactId>
5559
</dependency>
5660

5761
<dependency>
58-
<groupId>org.springframework.grpc</groupId>
59-
<artifactId>spring-grpc-test</artifactId>
62+
<groupId>org.springframework.boot</groupId>
63+
<artifactId>spring-boot-starter-grpc-test</artifactId>
6064
<scope>test</scope>
6165
</dependency>
6266
</dependencies>

0 commit comments

Comments
 (0)