Skip to content

Commit 3e4600d

Browse files
committed
Boot 4 migration
1 parent 219707e commit 3e4600d

36 files changed

+103
-47
lines changed

spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/test/java/org/springframework/cloud/function/adapter/aws/CustomRuntimeEventLoopTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ private void testDefaultFunctionLookup(String handler, Class<?> context) throws
143143

144144
AWSCustomRuntime aws = userContext.getBean(AWSCustomRuntime.class);
145145
Message<String> replyMessage = aws.exchange("\"ricky\"");
146-
assertThat(replyMessage.getHeaders()).containsKey("user-agent");
147-
assertThat(((String) replyMessage.getHeaders().get("user-agent"))).startsWith("spring-cloud-function");
146+
assertThat(replyMessage.getHeaders()).containsKey("User-Agent");
147+
assertThat(((String) replyMessage.getHeaders().get("User-Agent"))).startsWith("spring-cloud-function");
148148
assertThat(aws.exchange("\"ricky\"").getPayload()).isEqualTo("\"RICKY\"");
149149
assertThat(aws.exchange("\"julien\"").getPayload()).isEqualTo("\"JULIEN\"");
150150
assertThat(aws.exchange("\"bubbles\"").getPayload()).isEqualTo("\"BUBBLES\"");
@@ -177,6 +177,7 @@ public void test_HANDLERlookupAndPojoFunction() throws Exception {
177177

178178
AWSCustomRuntime aws = userContext.getBean(AWSCustomRuntime.class);
179179

180+
aws.exchange("\"ricky\"");
180181
assertThat(aws.exchange("\"ricky\"").getPayload()).isEqualTo("{\"name\":\"RICKY\"}");
181182
assertThat(aws.exchange("\"julien\"").getPayload()).isEqualTo("{\"name\":\"JULIEN\"}");
182183
assertThat(aws.exchange("\"bubbles\"").getPayload()).isEqualTo("{\"name\":\"BUBBLES\"}");

spring-cloud-function-adapters/spring-cloud-function-adapter-gcp/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,17 @@
4040
<dependency>
4141
<groupId>org.springframework.boot</groupId>
4242
<artifactId>spring-boot-loader-tools</artifactId>
43+
<version>4.0.0-M3</version>
4344
</dependency>
4445
<dependency>
4546
<groupId>org.springframework.boot</groupId>
4647
<artifactId>spring-boot-loader-classic</artifactId>
48+
<version>4.0.0-M3</version>
4749
</dependency>
4850
<dependency>
4951
<groupId>org.springframework.boot</groupId>
5052
<artifactId>spring-boot-loader</artifactId>
53+
<version>4.0.0-M3</version>
5154
</dependency>
5255

5356
<!-- Test-only dependencies -->

spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/FunctionTypeProcessor.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor;
3232
import org.springframework.beans.factory.aot.BeanFactoryInitializationCode;
3333
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
34-
import org.springframework.boot.http.client.ClientHttpRequestFactorySettings;
3534
import org.springframework.boot.web.server.Ssl;
3635
import org.springframework.boot.web.server.Ssl.ServerNameSslBundle;
3736
import org.springframework.cloud.function.context.catalog.FunctionTypeUtils;
@@ -111,8 +110,6 @@ public void applyTo(GenerationContext generationContext, BeanFactoryInitializati
111110

112111

113112
// temporary due to bug in boot
114-
runtimeHints.reflection().registerType(ClientHttpRequestFactorySettings.class,
115-
MemberCategory.INVOKE_PUBLIC_METHODS);
116113
runtimeHints.reflection().registerType(Ssl.class,
117114
MemberCategory.INVOKE_PUBLIC_METHODS);
118115
runtimeHints.reflection().registerType(ServerNameSslBundle.class,

spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/config/ContextFunctionCatalogAutoConfiguration.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.commons.logging.LogFactory;
3131
import org.joda.time.DateTimeZone;
3232
import org.joda.time.tz.UTCProvider;
33+
import tools.jackson.core.StreamReadFeature;
3334
import tools.jackson.databind.DeserializationFeature;
3435
import tools.jackson.databind.JacksonModule;
3536
import tools.jackson.databind.ObjectMapper;
@@ -275,6 +276,9 @@ private JsonMapper jackson(ApplicationContext context) {
275276
}
276277
builder = builder.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
277278
builder = builder.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
279+
builder = builder.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false);
280+
builder = builder.configure(StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION, false);
281+
278282
mapper = builder.build();
279283
return new JacksonMapper(mapper);
280284
}

spring-cloud-function-context/src/test/java/org/springframework/cloud/function/context/catalog/BeanFactoryAwareFunctionRegistryTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,7 @@ public Function<Map<String, Date>, String> echoToString() {
14021402

14031403
public static class Person {
14041404
private String name;
1405+
14051406
private int id;
14061407
public Person() {
14071408

spring-cloud-function-web/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@
9494
<artifactId>httpclient5</artifactId>
9595
<scope>test</scope>
9696
</dependency>
97+
<dependency>
98+
<groupId>org.springframework.boot</groupId>
99+
<artifactId>spring-boot-resttestclient</artifactId>
100+
<scope>test</scope>
101+
</dependency>
102+
<!-- <dependency>-->
103+
<!-- <groupId>org.springframework.boot</groupId>-->
104+
<!-- <artifactId>spring-boot-starter-restclient</artifactId>-->
105+
<!-- <scope>test</scope>-->
106+
<!-- </dependency>-->
107+
108+
<dependency>
109+
<groupId>org.springframework.boot</groupId>
110+
<artifactId>spring-boot-webmvc-test</artifactId>
111+
<scope>test</scope>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.springframework.boot</groupId>
115+
<artifactId>spring-boot-webtestclient</artifactId>
116+
</dependency>
97117
</dependencies>
98118

99119
<build>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
import org.springframework.beans.factory.annotation.Autowired;
2626
import org.springframework.boot.autoconfigure.SpringBootApplication;
27+
import org.springframework.boot.resttestclient.TestRestTemplate;
2728
import org.springframework.boot.test.context.SpringBootTest;
2829
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
29-
import org.springframework.boot.web.server.test.LocalServerPort;
30-
import org.springframework.boot.web.server.test.client.TestRestTemplate;
30+
import org.springframework.boot.test.web.server.LocalServerPort;
3131
import org.springframework.context.annotation.ComponentScan;
3232
import org.springframework.http.HttpStatus;
3333
import org.springframework.http.MediaType;

spring-cloud-function-web/src/test/java/org/springframework/cloud/function/flux/FluxRestApplicationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@
3434

3535
import org.springframework.beans.factory.annotation.Autowired;
3636
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
37+
import org.springframework.boot.resttestclient.TestRestTemplate;
38+
import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate;
3739
import org.springframework.boot.test.context.SpringBootTest;
3840
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
39-
import org.springframework.boot.web.server.test.LocalServerPort;
40-
import org.springframework.boot.web.server.test.client.TestRestTemplate;
41+
import org.springframework.boot.test.web.server.LocalServerPort;
4142
import org.springframework.cloud.function.flux.FluxRestApplicationTests.TestConfiguration;
4243
import org.springframework.context.annotation.Configuration;
4344
import org.springframework.http.HttpStatus;
@@ -64,6 +65,7 @@
6465
// @checkstyle:off
6566
@SpringBootTest(classes = TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=reactive")
6667
// @checkstyle:on
68+
@AutoConfigureTestRestTemplate
6769
public class FluxRestApplicationTests {
6870

6971
private static final MediaType EVENT_STREAM = MediaType.valueOf("text/event-stream");

spring-cloud-function-web/src/test/java/org/springframework/cloud/function/mvc/MvcRestApplicationTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333

3434
import org.springframework.beans.factory.annotation.Autowired;
3535
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
36+
import org.springframework.boot.resttestclient.TestRestTemplate;
37+
import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate;
3638
import org.springframework.boot.test.context.SpringBootTest;
3739
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
38-
import org.springframework.boot.web.server.test.LocalServerPort;
39-
import org.springframework.boot.web.server.test.client.TestRestTemplate;
40+
import org.springframework.boot.test.web.server.LocalServerPort;
4041
import org.springframework.cloud.function.mvc.MvcRestApplicationTests.TestConfiguration;
4142
import org.springframework.context.annotation.Configuration;
4243
import org.springframework.http.HttpStatus;
@@ -63,6 +64,7 @@
6364
// @checkstyle:off
6465
@SpringBootTest(classes = TestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "spring.main.web-application-type=servlet")
6566
// @checkstyle:on
67+
@AutoConfigureTestRestTemplate
6668
public class MvcRestApplicationTests {
6769

6870
private static final MediaType EVENT_STREAM = MediaType.valueOf("text/event-stream");

spring-cloud-function-web/src/test/java/org/springframework/cloud/function/test/ExplicitNonFunctionalTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import org.springframework.beans.factory.annotation.Autowired;
2626
import org.springframework.boot.SpringBootConfiguration;
2727
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
28-
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
2928
import org.springframework.boot.test.context.SpringBootTest;
29+
import org.springframework.boot.webtestclient.AutoConfigureWebTestClient;
3030
import org.springframework.context.annotation.Configuration;
3131
import org.springframework.test.annotation.DirtiesContext;
3232
import org.springframework.test.web.reactive.server.WebTestClient;

0 commit comments

Comments
 (0)