Skip to content

Commit 70587f5

Browse files
committed
Upgrade some deps; fix compatibility with them
* Upgrade to the latest Spring portfolio stack; fix tests and effected classes * The move to the latest Micrometer does not affect code base
1 parent f09c665 commit 70587f5

File tree

14 files changed

+126
-137
lines changed

14 files changed

+126
-137
lines changed

build.gradle

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ext {
4949

5050
apacheSshdVersion = '2.8.0'
5151
artemisVersion = '2.20.0'
52-
aspectjVersion = '1.9.8.RC3'
52+
aspectjVersion = '1.9.8'
5353
assertjVersion = '3.22.0'
5454
assertkVersion = '0.25'
5555
avroVersion = '1.11.0'
@@ -83,9 +83,9 @@ ext {
8383
lettuceVersion = '6.1.6.RELEASE'
8484
log4jVersion = '2.17.1'
8585
mailVersion = '2.0.1'
86-
micrometerVersion = '2.0.0-M1'
86+
micrometerVersion = '2.0.0-SNAPSHOT'
8787
mockitoVersion = '4.2.0'
88-
mongoDriverVersion = '4.4.1'
88+
mongoDriverVersion = '4.5.0'
8989
mysqlVersion = '8.0.28'
9090
pahoMqttClientVersion = '1.2.5'
9191
postgresVersion = '42.3.1'
@@ -97,14 +97,14 @@ ext {
9797
saajVersion = '2.0.1'
9898
servletApiVersion = '5.0.0'
9999
smackVersion = '4.3.5'
100-
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0-M1'
101-
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.0.0-M1'
102-
springGraphqlVersion = '1.0.0-M5'
100+
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0-SNAPSHOT'
101+
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.0.0-SNAPSHOT'
102+
springGraphqlVersion = '1.0.0-SNAPSHOT'
103103
springKafkaVersion = '3.0.0-M1'
104104
springRetryVersion = '1.3.1'
105-
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0-M1'
106-
springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0-M2'
107-
springWsVersion = '4.0.0-M1'
105+
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0-SNAPSHOT'
106+
springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0-SNAPSHOT'
107+
springWsVersion = '4.0.0-SNAPSHOT'
108108
testcontainersVersion = '1.16.2'
109109
tomcatVersion = '10.0.14'
110110
xmlUnitVersion = '2.8.4'

spring-integration-core/src/test/java/org/springframework/integration/config/xml/MapToObjectTransformerParserTests-context.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
output-channel="outputA"
2424
ref="person"/>
2525

26-
<bean id="conversionService" name="integrationConversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
26+
<bean id="integrationConversionService" name="integrationConversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
2727
<property name="converters">
2828
<list>
2929
<bean class="org.springframework.integration.config.xml.MapToObjectTransformerParserTests$StringToAddressConverter" />

spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public void noDelayHeaderAndDefaultDelayIsPositive() {
139139
}
140140

141141
@Test
142+
@SuppressWarnings("unchecked")
142143
public void errorFlowAndRetries() throws Exception {
143144
delayHandler.setDefaultDelay(10);
144145
delayHandler.setRetryDelay(15);

spring-integration-graphql/src/main/java/org/springframework/integration/graphql/outbound/GraphQlMessageHandler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* GraphQL Query, Mutation and Subscription requests.
3939
*
4040
* @author Daniel Frey
41+
* @author Artem Bilan
4142
*
4243
* @since 6.0
4344
*/
@@ -145,7 +146,7 @@ protected Object handleRequestMessage(Message<?> requestMessage) {
145146
String operationName = evaluateOperationNameExpression(requestMessage);
146147
Map<String, Object> variables = evaluateVariablesExpression(requestMessage);
147148
String id = evaluateExecutionIdExpression(requestMessage);
148-
requestInput = new RequestInput(query, operationName, variables, this.locale, id);
149+
requestInput = new RequestInput(query, operationName, variables, id, this.locale);
149150
}
150151

151152
return this.graphQlService.execute(requestInput);

spring-integration-graphql/src/test/java/org/springframework/integration/graphql/outbound/GraphQlMessageHandlerTests.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
/**
6565
*
6666
* @author Daniel Frey
67+
* @author Artem Bilan
6768
*
6869
* @since 6.0
6970
*/
@@ -104,7 +105,7 @@ void testHandleMessageForQueryWithRequestInputProvided() {
104105
.thenCancel()
105106
.verifyLater();
106107

107-
RequestInput payload = new RequestInput("{ testQuery { id } }", null, null, null, UUID.randomUUID().toString());
108+
RequestInput payload = new RequestInput("{ testQuery { id } }", null, null, UUID.randomUUID().toString(), null);
108109
this.inputChannel.send(MessageBuilder.withPayload(payload).build());
109110

110111
verifier.verify(Duration.ofSeconds(10));
@@ -156,8 +157,8 @@ void testHandleMessageForMutationWithRequestInputProvided() {
156157
.verifyLater();
157158

158159
RequestInput payload =
159-
new RequestInput("mutation { update(id: \"" + fakeId + "\") { id } }", null, null, null,
160-
UUID.randomUUID().toString());
160+
new RequestInput("mutation { update(id: \"" + fakeId + "\") { id } }", null, null,
161+
UUID.randomUUID().toString(), null);
161162
this.inputChannel.send(MessageBuilder.withPayload(payload).build());
162163

163164
verifier.verify(Duration.ofSeconds(10));
@@ -195,7 +196,7 @@ void testHandleMessageForSubscriptionWithRequestInputProvided() {
195196
.verifyLater();
196197

197198
RequestInput payload =
198-
new RequestInput("subscription { results { id } }", null, null, null, UUID.randomUUID().toString());
199+
new RequestInput("subscription { results { id } }", null, null, UUID.randomUUID().toString(), null);
199200
this.inputChannel.send(MessageBuilder.withPayload(payload).build());
200201

201202
verifier.verify(Duration.ofSeconds(10));

spring-integration-http/src/test/java/org/springframework/integration/http/dsl/HttpDslTests.java

+60-57
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 the original author or authors.
2+
* Copyright 2016-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,13 +63,14 @@
6363
import org.springframework.security.access.AccessDecisionManager;
6464
import org.springframework.security.access.vote.AffirmativeBased;
6565
import org.springframework.security.access.vote.RoleVoter;
66+
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
6667
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
6768
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
68-
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
6969
import org.springframework.security.core.userdetails.User;
7070
import org.springframework.security.core.userdetails.UserDetailsService;
7171
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
7272
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
73+
import org.springframework.security.web.SecurityFilterChain;
7374
import org.springframework.test.annotation.DirtiesContext;
7475
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
7576
import org.springframework.test.web.client.MockMvcClientHttpRequestFactory;
@@ -124,15 +125,15 @@ public void testHttpProxyFlow() throws Exception {
124125
this.serviceInternalGatewayHandler.setRequestFactory(mockRequestFactory);
125126

126127
this.mockMvc.perform(
127-
get("/service")
128-
.with(httpBasic("admin", "admin"))
129-
.param("name", "foo"))
128+
get("/service")
129+
.with(httpBasic("admin", "admin"))
130+
.param("name", "foo"))
130131
.andExpect(content().string("FOO"));
131132

132133
this.mockMvc.perform(
133-
get("/service")
134-
.with(httpBasic("user", "user"))
135-
.param("name", "name"))
134+
get("/service")
135+
.with(httpBasic("user", "user"))
136+
.param("name", "name"))
136137
.andExpect(status().isForbidden())
137138
.andExpect(content().string("Error"));
138139
}
@@ -141,26 +142,26 @@ public void testHttpProxyFlow() throws Exception {
141142
public void testDynamicHttpEndpoint() throws Exception {
142143
IntegrationFlow flow =
143144
IntegrationFlows.from(Http.inboundGateway("/dynamic")
144-
.requestMapping(r -> r.params("name"))
145-
.payloadExpression("#requestParams.name[0]"))
145+
.requestMapping(r -> r.params("name"))
146+
.payloadExpression("#requestParams.name[0]"))
146147
.<String, String>transform(String::toLowerCase)
147148
.get();
148149

149150
IntegrationFlowContext.IntegrationFlowRegistration flowRegistration =
150151
this.integrationFlowContext.registration(flow).register();
151152

152153
this.mockMvc.perform(
153-
get("/dynamic")
154-
.with(httpBasic("user", "user"))
155-
.param("name", "BAR"))
154+
get("/dynamic")
155+
.with(httpBasic("user", "user"))
156+
.param("name", "BAR"))
156157
.andExpect(content().string("bar"));
157158

158159
flowRegistration.destroy();
159160

160161
this.mockMvc.perform(
161-
get("/dynamic")
162-
.with(httpBasic("user", "user"))
163-
.param("name", "BAZ"))
162+
get("/dynamic")
163+
.with(httpBasic("user", "user"))
164+
.param("name", "BAZ"))
164165
.andExpect(status().isNotFound());
165166
}
166167

@@ -176,9 +177,9 @@ public void testMultiPartFiles() throws Exception {
176177
MockPart mockPart2 = new MockPart("a1", "file2", "DEF".getBytes(StandardCharsets.UTF_8));
177178
mockPart2.getHeaders().setContentType(MediaType.TEXT_PLAIN);
178179
this.mockMvc.perform(
179-
multipart("/multiPartFiles")
180-
.part(mockPart1, mockPart2)
181-
.with(httpBasic("user", "user")))
180+
multipart("/multiPartFiles")
181+
.part(mockPart1, mockPart2)
182+
.with(httpBasic("user", "user")))
182183
.andExpect(status().isOk());
183184

184185
Message<?> result = this.multiPartFilesChannel.receive(10_000);
@@ -214,23 +215,23 @@ public void testMultiPartFiles() throws Exception {
214215
public void testValidation() throws Exception {
215216
IntegrationFlow flow =
216217
IntegrationFlows.from(
217-
Http.inboundChannelAdapter("/validation")
218-
.requestMapping((mapping) -> mapping
219-
.methods(HttpMethod.POST)
220-
.consumes(MediaType.APPLICATION_JSON_VALUE))
221-
.requestPayloadType(TestModel.class)
222-
.validator(this.validator))
218+
Http.inboundChannelAdapter("/validation")
219+
.requestMapping((mapping) -> mapping
220+
.methods(HttpMethod.POST)
221+
.consumes(MediaType.APPLICATION_JSON_VALUE))
222+
.requestPayloadType(TestModel.class)
223+
.validator(this.validator))
223224
.bridge()
224225
.get();
225226

226227
IntegrationFlowContext.IntegrationFlowRegistration flowRegistration =
227228
this.integrationFlowContext.registration(flow).register();
228229

229230
this.mockMvc.perform(
230-
post("/validation")
231-
.with(httpBasic("user", "user"))
232-
.contentType(MediaType.APPLICATION_JSON)
233-
.content("{\"name\": \"\"}"))
231+
post("/validation")
232+
.with(httpBasic("user", "user"))
233+
.contentType(MediaType.APPLICATION_JSON)
234+
.content("{\"name\": \"\"}"))
234235
.andExpect(status().isBadRequest())
235236
.andExpect(status().reason("Validation failure"));
236237

@@ -241,21 +242,21 @@ public void testValidation() throws Exception {
241242
public void testBadRequest() throws Exception {
242243
IntegrationFlow flow =
243244
IntegrationFlows.from(
244-
Http.inboundGateway("/badRequest")
245-
.errorChannel((message, timeout) -> {
246-
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
247-
"Not valid request param", ((ErrorMessage) message).getPayload());
248-
})
249-
.payloadExpression("#requestParams.p1"))
245+
Http.inboundGateway("/badRequest")
246+
.errorChannel((message, timeout) -> {
247+
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
248+
"Not valid request param", ((ErrorMessage) message).getPayload());
249+
})
250+
.payloadExpression("#requestParams.p1"))
250251
.get();
251252

252253
IntegrationFlowContext.IntegrationFlowRegistration flowRegistration =
253254
this.integrationFlowContext.registration(flow).register();
254255

255256
this.mockMvc.perform(
256-
get("/badRequest")
257-
.with(httpBasic("user", "user"))
258-
.param("p2", "P2"))
257+
get("/badRequest")
258+
.with(httpBasic("user", "user"))
259+
.param("p2", "P2"))
259260
.andExpect(status().isBadRequest())
260261
.andExpect(status().reason("Not valid request param"));
261262

@@ -266,16 +267,16 @@ public void testBadRequest() throws Exception {
266267
public void testErrorChannelFlow() throws Exception {
267268
IntegrationFlow flow =
268269
IntegrationFlows.from(
269-
Http.inboundGateway("/errorFlow")
270-
.errorChannel(new FixedSubscriberChannel(
271-
new AbstractReplyProducingMessageHandler() {
270+
Http.inboundGateway("/errorFlow")
271+
.errorChannel(new FixedSubscriberChannel(
272+
new AbstractReplyProducingMessageHandler() {
272273

273-
@Override
274-
protected Object handleRequestMessage(Message<?> requestMessage) {
275-
return "Error Response";
276-
}
274+
@Override
275+
protected Object handleRequestMessage(Message<?> requestMessage) {
276+
return "Error Response";
277+
}
277278

278-
})))
279+
})))
279280
.transform((payload) -> {
280281
throw new RuntimeException("Error!");
281282
})
@@ -285,8 +286,8 @@ protected Object handleRequestMessage(Message<?> requestMessage) {
285286
this.integrationFlowContext.registration(flow).register();
286287

287288
this.mockMvc.perform(
288-
get("/errorFlow")
289-
.with(httpBasic("user", "user")))
289+
get("/errorFlow")
290+
.with(httpBasic("user", "user")))
290291
.andExpect(status().isOk())
291292
.andExpect(content().string("Error Response"));
292293

@@ -296,9 +297,8 @@ protected Object handleRequestMessage(Message<?> requestMessage) {
296297
@Configuration
297298
@EnableWebSecurity
298299
@EnableIntegration
299-
public static class ContextConfiguration extends WebSecurityConfigurerAdapter {
300+
public static class ContextConfiguration {
300301

301-
@Override
302302
@Bean
303303
public UserDetailsService userDetailsService() {
304304
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
@@ -320,16 +320,18 @@ public UserDetailsService userDetailsService() {
320320
return manager;
321321
}
322322

323-
@Override
324-
protected void configure(HttpSecurity http) throws Exception {
325-
http.authorizeRequests()
323+
@Bean
324+
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
325+
return http.
326+
authorizeRequests()
326327
.antMatchers("/service/internal/**").hasRole("ADMIN")
327328
.anyRequest().permitAll()
328329
.and()
329330
.httpBasic()
330331
.and()
331332
.csrf().disable()
332-
.anonymous().disable();
333+
.anonymous().disable()
334+
.build();
333335
}
334336

335337
@Bean
@@ -397,10 +399,11 @@ public AccessDecisionManager accessDecisionManager() {
397399
}
398400

399401
@Bean
400-
public ChannelSecurityInterceptor channelSecurityInterceptor(AccessDecisionManager accessDecisionManager)
401-
throws Exception {
402+
public ChannelSecurityInterceptor channelSecurityInterceptor(AccessDecisionManager accessDecisionManager,
403+
AuthenticationManagerBuilder authenticationManagerBuilder) {
404+
402405
ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor();
403-
channelSecurityInterceptor.setAuthenticationManager(authenticationManager());
406+
channelSecurityInterceptor.setAuthenticationManager(authenticationManagerBuilder.getOrBuild());
404407
channelSecurityInterceptor.setAccessDecisionManager(accessDecisionManager);
405408
return channelSecurityInterceptor;
406409
}

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/ConfigurableMongoDbMessageStore.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2021 the original author or authors.
2+
* Copyright 2013-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -297,8 +297,7 @@ public Stream<Message<?>> streamMessagesForGroup(Object groupId) {
297297
Query query = groupOrderQuery(groupId);
298298
Stream<MessageDocument> documents =
299299
getMongoTemplate()
300-
.stream(query, MessageDocument.class, this.collectionName)
301-
.stream();
300+
.stream(query, MessageDocument.class, this.collectionName);
302301

303302
return documents.map(MessageDocument::getMessage);
304303
}

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MessageDocument.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2021 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
2020

2121
import org.springframework.data.annotation.AccessType;
2222
import org.springframework.data.annotation.Id;
23-
import org.springframework.data.annotation.PersistenceConstructor;
23+
import org.springframework.data.annotation.PersistenceCreator;
2424
import org.springframework.data.mongodb.core.mapping.Document;
2525
import org.springframework.lang.Nullable;
2626
import org.springframework.messaging.Message;
@@ -77,7 +77,7 @@ public MessageDocument(Message<?> message) {
7777
* @param messageId the id of the {@link Message} as a separate persistent property.
7878
* @since 5.1
7979
*/
80-
@PersistenceConstructor
80+
@PersistenceCreator
8181
MessageDocument(Message<?> message, UUID messageId) {
8282
Assert.notNull(message, "'message' must not be null");
8383
Assert.notNull(messageId, "'message' ID header must not be null");

0 commit comments

Comments
 (0)