Skip to content

Commit 4a63ddc

Browse files
authored
Merge pull request #59 from 4PointSolutions/20251129_SpringBoot_4
Update to Spring Boot 4
2 parents f632233 + 5051949 commit 4a63ddc

20 files changed

Lines changed: 378 additions & 232 deletions

File tree

spring/fluentforms-jersey-spring-boot-autoconfigure/pom.xml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.springframework.boot</groupId>
55
<artifactId>spring-boot-starter-parent</artifactId>
6-
<version>3.5.7</version>
6+
<version>4.0.0</version>
77
<relativePath /> <!-- lookup parent from repository -->
88
</parent>
99
<groupId>com._4point.aem.fluentforms</groupId>
@@ -20,7 +20,8 @@
2020

2121
<!-- Testing Dependencies -->
2222
<fp.hamcrest.matchers.version>0.0.4-SNAPSHOT</fp.hamcrest.matchers.version>
23-
<wiremock.version>4.0.0-beta.16</wiremock.version>
23+
<wiremock.version>4.0.0-beta.22</wiremock.version>
24+
<wiremock-spring-boot.version>4.0.8</wiremock-spring-boot.version>
2425
<pitest.maven.plugin.version>1.20.2</pitest.maven.plugin.version>
2526
<pitest.junit5.maven.plugin.version>1.2.3</pitest.junit5.maven.plugin.version>
2627
</properties>
@@ -94,7 +95,7 @@
9495
<!-- Testing Dependencies -->
9596
<dependency>
9697
<groupId>org.springframework.boot</groupId>
97-
<artifactId>spring-boot-starter-test</artifactId>
98+
<artifactId>spring-boot-starter-jersey-test</artifactId>
9899
<scope>test</scope>
99100
</dependency>
100101
<dependency>
@@ -105,10 +106,22 @@
105106
</dependency>
106107
<dependency>
107108
<groupId>org.wiremock</groupId>
108-
<artifactId>wiremock-standalone</artifactId>
109+
<artifactId>wiremock</artifactId>
109110
<version>${wiremock.version}</version>
110111
<scope>test</scope>
111112
</dependency>
113+
<dependency>
114+
<groupId>org.wiremock</groupId>
115+
<artifactId>wiremock-junit5</artifactId>
116+
<version>${wiremock.version}</version>
117+
<scope>test</scope>
118+
</dependency>
119+
<dependency>
120+
<groupId>org.wiremock.integrations</groupId>
121+
<artifactId>wiremock-spring-boot</artifactId>
122+
<version>${wiremock-spring-boot.version}</version>
123+
<scope>test</scope>
124+
</dependency>
112125
<dependency>
113126
<groupId>org.pitest</groupId>
114127
<artifactId>pitest-junit5-plugin</artifactId>

spring/fluentforms-jersey-spring-boot-autoconfigure/src/main/java/com/_4point/aem/fluentforms/spring/AemProxyJerseyAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
1313
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
1414
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
15-
import org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer;
1615
import org.springframework.boot.context.properties.EnableConfigurationProperties;
16+
import org.springframework.boot.jersey.autoconfigure.ResourceConfigCustomizer;
1717
import org.springframework.boot.ssl.SslBundles;
1818
import org.springframework.boot.system.JavaVersion;
1919
import org.springframework.context.annotation.Bean;

spring/fluentforms-jersey-spring-boot-autoconfigure/src/main/java/com/_4point/aem/fluentforms/spring/AemProxyJerseyEndpoint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ public Response proxyPost(@PathParam("remainder") String remainder, @HeaderParam
204204
.log("Returning POST response from target '{}'.");
205205
}
206206

207-
return Response.fromResponse(result).build();
207+
return Response.fromResponse(result)
208+
.header("Transfer-Encoding", null) // Remove the Transfer-Encoding header
209+
.build();
208210
}
209211

210212
private InputStream debugInput(InputStream in, String target) {

spring/fluentforms-jersey-spring-boot-autoconfigure/src/test/java/com/_4point/aem/fluentforms/spring/AemProxyJerseyAutoConfigurationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import org.springframework.beans.factory.annotation.Autowired;
77
import org.springframework.boot.SpringApplication;
88
import org.springframework.boot.autoconfigure.SpringBootApplication;
9-
import org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer;
109
import org.springframework.boot.context.properties.EnableConfigurationProperties;
10+
import org.springframework.boot.jersey.autoconfigure.ResourceConfigCustomizer;
1111
import org.springframework.boot.test.context.SpringBootTest;
1212

13-
@SpringBootTest(classes = {com._4point.aem.fluentforms.spring.FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class, AemProxyAutoConfiguration.class},
13+
@SpringBootTest(classes = {com._4point.aem.fluentforms.spring.FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class},
1414
properties = {
1515
"fluentforms.aem.servername=localhost",
1616
"fluentforms.aem.port=4502",

spring/fluentforms-jersey-spring-boot-autoconfigure/src/test/java/com/_4point/aem/fluentforms/spring/AemProxyJerseyEndpointTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@
2323
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
2424
import org.springframework.boot.test.web.server.LocalServerPort;
2525
import org.springframework.web.client.RestClient;
26+
import org.wiremock.spring.ConfigureWireMock;
27+
import org.wiremock.spring.EnableWireMock;
2628

2729
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
2830
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
2931

30-
@WireMockTest(httpPort = AemProxyJerseyEndpointTest.WIREMOCK_PORT)
32+
@WireMockTest()
3133
@SpringBootTest(classes = {com._4point.aem.fluentforms.spring.AemProxyJerseyEndpointTest.TestApplication.class},
3234
webEnvironment = WebEnvironment.RANDOM_PORT,
3335
properties = {
3436
"fluentforms.aem.servername=localhost",
35-
"fluentforms.aem.port=" + AemProxyJerseyEndpointTest.WIREMOCK_PORT,
3637
"fluentforms.aem.user=ENC(7FgD3ZsSExfUGRYlXNc++6C1upPBURNKq6HouzagnNZW4FsBwFs5+crawv+djhw6)",
3738
"fluentforms.aem.password=ENC(QmQ6iTm/+TOO8U3dDuBzJWH129vReWgYNdgqQwWhjWaQy6j8sMnk2/Auhehmlh3v)",
3839
//"fluentforms.aem.useSsl=true",
@@ -41,13 +42,18 @@
4142
"jasypt.encryptor.password=4Point",
4243
"jasypt.encryptor.iv-generator-classname=org.jasypt.iv.RandomIvGenerator",
4344
"jasypt.encryptor.salt-generator-classname=org.jasypt.salt.RandomSaltGenerator",
44-
"logging.level.com._4point.aem.fluentforms.spring.AemProxyEndpoint=DEBUG"
45+
"logging.level.com._4point.aem.fluentforms.spring.AemProxyEndpoint=DEBUG",
46+
// Wiremock produces a lot of output, the following entries reduce that output. They can be removed for debugging.
47+
"logging.level.org.wiremock.spring=WARN", "logging.level.WireMock.wiremock=WARN",
4548
})
46-
@Timeout(value = 5, unit = TimeUnit.MINUTES) // Fail tests that take longer than this to prevent hanging.
49+
@EnableWireMock(@ConfigureWireMock(
50+
portProperties = "fluentforms.aem.port"
51+
)
52+
)
53+
@Timeout(value = 30, unit = TimeUnit.SECONDS) // Fail tests that take longer than this to prevent hanging.
4754
class AemProxyJerseyEndpointTest {
4855
private final static Logger logger = LoggerFactory.getLogger(AemProxyJerseyEndpointTest.class);
4956

50-
static final int WIREMOCK_PORT = 5504;
5157
static final String AF_BASE_LOCATION = "/aem";
5258

5359
// The following is a string that contains all possible values that may be modified by the AemProxyEndpoint.

spring/fluentforms-jersey-spring-boot-autoconfigure/src/test/java/com/_4point/aem/fluentforms/spring/FluentFormsJerseyAutoConfigurationTest.java

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import com._4point.aem.fluentforms.api.generatePDF.GeneratePDFService;
3333
import com._4point.aem.fluentforms.api.output.OutputService;
3434
import com._4point.aem.fluentforms.api.pdfUtility.PdfUtilityService;
35-
import com._4point.aem.fluentforms.spring.rest_services.client.SpringRestClientRestClient;
3635

3736
@SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsJerseyAutoConfiguration.class, FluentFormsAutoConfiguration.class},
3837
properties = {
@@ -158,40 +157,42 @@ private static String inputStreamToString(InputStream inputStream) throws IOExce
158157
return result;
159158
}
160159

161-
@SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class},
162-
properties = {
163-
"fluentforms.aem.servername=localhost",
164-
"fluentforms.aem.port=4502",
165-
"fluentforms.aem.user=admin",
166-
"fluentforms.aem.password=admin",
167-
"fluentforms.restclient=springrestclient" // Configure for Spring RestClient
168-
})
169-
public static class SpringRestClientTest {
170-
171-
@Test
172-
void testRestClientFactory(@Autowired RestClientFactory factory, @Autowired AemConfiguration config) {
173-
RestClient client = factory.apply(toAemConfig(config) , "testRestClientFactory", ()->"correlationId");
174-
assertTrue(client instanceof SpringRestClientRestClient, "RestClientFactory should return a SpringRestClientRestClient when configured to do so");
175-
}
176-
}
160+
// TODO: For now we are going to ignore mixed scenarios (where we are using one starter with a different rest client
161+
// @SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class},
162+
// properties = {
163+
// "fluentforms.aem.servername=localhost",
164+
// "fluentforms.aem.port=4502",
165+
// "fluentforms.aem.user=admin",
166+
// "fluentforms.aem.password=admin",
167+
// "fluentforms.restclient=springrestclient" // Configure for Spring RestClient
168+
// })
169+
// public static class SpringRestClientTest {
170+
//
171+
// @Test
172+
// void testRestClientFactory(@Autowired RestClientFactory factory, @Autowired AemConfiguration config) {
173+
// RestClient client = factory.apply(toAemConfig(config) , "testRestClientFactory", ()->"correlationId");
174+
// assertTrue(client instanceof SpringRestClientRestClient, "RestClientFactory should return a SpringRestClientRestClient when configured to do so");
175+
// }
176+
// }
177177

178-
@SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class},
179-
properties = {
180-
"fluentforms.aem.servername=localhost",
181-
"fluentforms.aem.port=4502",
182-
"fluentforms.aem.user=admin",
183-
"fluentforms.aem.password=admin",
184-
"fluentforms.aem.usessl=true",
185-
"fluentforms.restclient=springrestclient" // Configure for Spring RestClient
186-
})
187-
public static class SpringRestClient_SslNoBundleNameTest {
188-
189-
@Test
190-
void testRestClientFactory(@Autowired RestClientFactory factory, @Autowired AemConfiguration config) {
191-
RestClient client = factory.apply(toAemConfig(config) , "testRestClientFactory", ()->"correlationId");
192-
assertTrue(client instanceof SpringRestClientRestClient, "RestClientFactory should return a SpringRestClientRestClient when configured to do so");
193-
}
194-
}
178+
// TODO: For now we are going to ignore mixed scenarios (where we are using one starter with a different rest client
179+
// @SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class},
180+
// properties = {
181+
// "fluentforms.aem.servername=localhost",
182+
// "fluentforms.aem.port=4502",
183+
// "fluentforms.aem.user=admin",
184+
// "fluentforms.aem.password=admin",
185+
// "fluentforms.aem.usessl=true",
186+
// "fluentforms.restclient=springrestclient" // Configure for Spring RestClient
187+
// })
188+
// public static class SpringRestClient_SslNoBundleNameTest {
189+
//
190+
// @Test
191+
// void testRestClientFactory(@Autowired RestClientFactory factory, @Autowired AemConfiguration config) {
192+
// RestClient client = factory.apply(toAemConfig(config) , "testRestClientFactory", ()->"correlationId");
193+
// assertTrue(client instanceof SpringRestClientRestClient, "RestClientFactory should return a SpringRestClientRestClient when configured to do so");
194+
// }
195+
// }
195196

196197
@SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsJerseyAutoConfiguration.class, FluentFormsAutoConfiguration.class},
197198
properties = {
@@ -212,26 +213,27 @@ void testRestClientFactory(@Autowired RestClientFactory factory, @Autowired AemC
212213
}
213214
}
214215

215-
@SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class},
216-
properties = {
217-
"fluentforms.aem.servername=localhost",
218-
"fluentforms.aem.port=4502",
219-
"fluentforms.aem.user=admin",
220-
"fluentforms.aem.password=admin",
221-
"fluentforms.aem.usessl=true",
222-
"spring.ssl.bundle.jks.aem.truststore.location=file:src/test/resources/aemforms.p12",
223-
"spring.ssl.bundle.jks.aem.truststore.password=Pa$$123",
224-
"spring.ssl.bundle.jks.aem.truststore.type=PKCS12",
225-
"fluentforms.restclient=springrestclient" // Configure for Spring RestClient
226-
})
227-
public static class SpringRestClient_SslBundleTest {
228-
229-
@Test
230-
void testRestClientFactory(@Autowired RestClientFactory factory, @Autowired AemConfiguration config) {
231-
RestClient client = factory.apply(toAemConfig(config) , "testRestClientFactory", ()->"correlationId");
232-
assertTrue(client instanceof SpringRestClientRestClient, "RestClientFactory should return a SpringRestClientRestClient when configured to do so");
233-
}
234-
}
216+
// TODO: For now we are going to ignore mixed scenarios (where we are using one starter with a different rest client
217+
// @SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class},
218+
// properties = {
219+
// "fluentforms.aem.servername=localhost",
220+
// "fluentforms.aem.port=4502",
221+
// "fluentforms.aem.user=admin",
222+
// "fluentforms.aem.password=admin",
223+
// "fluentforms.aem.usessl=true",
224+
// "spring.ssl.bundle.jks.aem.truststore.location=file:src/test/resources/aemforms.p12",
225+
// "spring.ssl.bundle.jks.aem.truststore.password=Pa$$123",
226+
// "spring.ssl.bundle.jks.aem.truststore.type=PKCS12",
227+
// "fluentforms.restclient=springrestclient" // Configure for Spring RestClient
228+
// })
229+
// public static class SpringRestClient_SslBundleTest {
230+
//
231+
// @Test
232+
// void testRestClientFactory(@Autowired RestClientFactory factory, @Autowired AemConfiguration config) {
233+
// RestClient client = factory.apply(toAemConfig(config) , "testRestClientFactory", ()->"correlationId");
234+
// assertTrue(client instanceof SpringRestClientRestClient, "RestClientFactory should return a SpringRestClientRestClient when configured to do so");
235+
// }
236+
// }
235237

236238
@SpringBootTest(classes = {FluentFormsJerseyAutoConfigurationTest.TestApplication.class, FluentFormsAutoConfiguration.class},
237239
properties = {

0 commit comments

Comments
 (0)