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
This commit is contained in:
18
build.gradle
18
build.gradle
@@ -49,7 +49,7 @@ ext {
|
||||
|
||||
apacheSshdVersion = '2.8.0'
|
||||
artemisVersion = '2.20.0'
|
||||
aspectjVersion = '1.9.8.RC3'
|
||||
aspectjVersion = '1.9.8'
|
||||
assertjVersion = '3.22.0'
|
||||
assertkVersion = '0.25'
|
||||
avroVersion = '1.11.0'
|
||||
@@ -83,9 +83,9 @@ ext {
|
||||
lettuceVersion = '6.1.6.RELEASE'
|
||||
log4jVersion = '2.17.1'
|
||||
mailVersion = '2.0.1'
|
||||
micrometerVersion = '2.0.0-M1'
|
||||
micrometerVersion = '2.0.0-SNAPSHOT'
|
||||
mockitoVersion = '4.2.0'
|
||||
mongoDriverVersion = '4.4.1'
|
||||
mongoDriverVersion = '4.5.0'
|
||||
mysqlVersion = '8.0.28'
|
||||
pahoMqttClientVersion = '1.2.5'
|
||||
postgresVersion = '42.3.1'
|
||||
@@ -97,14 +97,14 @@ ext {
|
||||
saajVersion = '2.0.1'
|
||||
servletApiVersion = '5.0.0'
|
||||
smackVersion = '4.3.5'
|
||||
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0-M1'
|
||||
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.0.0-M1'
|
||||
springGraphqlVersion = '1.0.0-M5'
|
||||
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '3.0.0-SNAPSHOT'
|
||||
springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : '2022.0.0-SNAPSHOT'
|
||||
springGraphqlVersion = '1.0.0-SNAPSHOT'
|
||||
springKafkaVersion = '3.0.0-M1'
|
||||
springRetryVersion = '1.3.1'
|
||||
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0-M1'
|
||||
springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0-M2'
|
||||
springWsVersion = '4.0.0-M1'
|
||||
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '6.0.0-SNAPSHOT'
|
||||
springVersion = project.hasProperty('springVersion') ? project.springVersion : '6.0.0-SNAPSHOT'
|
||||
springWsVersion = '4.0.0-SNAPSHOT'
|
||||
testcontainersVersion = '1.16.2'
|
||||
tomcatVersion = '10.0.14'
|
||||
xmlUnitVersion = '2.8.4'
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
output-channel="outputA"
|
||||
ref="person"/>
|
||||
|
||||
<bean id="conversionService" name="integrationConversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
|
||||
<bean id="integrationConversionService" name="integrationConversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
|
||||
<property name="converters">
|
||||
<list>
|
||||
<bean class="org.springframework.integration.config.xml.MapToObjectTransformerParserTests$StringToAddressConverter" />
|
||||
|
||||
@@ -139,6 +139,7 @@ public class DelayHandlerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void errorFlowAndRetries() throws Exception {
|
||||
delayHandler.setDefaultDelay(10);
|
||||
delayHandler.setRetryDelay(15);
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.util.Assert;
|
||||
* GraphQL Query, Mutation and Subscription requests.
|
||||
*
|
||||
* @author Daniel Frey
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 6.0
|
||||
*/
|
||||
@@ -145,7 +146,7 @@ public class GraphQlMessageHandler extends AbstractReplyProducingMessageHandler
|
||||
String operationName = evaluateOperationNameExpression(requestMessage);
|
||||
Map<String, Object> variables = evaluateVariablesExpression(requestMessage);
|
||||
String id = evaluateExecutionIdExpression(requestMessage);
|
||||
requestInput = new RequestInput(query, operationName, variables, this.locale, id);
|
||||
requestInput = new RequestInput(query, operationName, variables, id, this.locale);
|
||||
}
|
||||
|
||||
return this.graphQlService.execute(requestInput);
|
||||
|
||||
@@ -64,6 +64,7 @@ import reactor.test.StepVerifier;
|
||||
/**
|
||||
*
|
||||
* @author Daniel Frey
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 6.0
|
||||
*/
|
||||
@@ -104,7 +105,7 @@ public class GraphQlMessageHandlerTests {
|
||||
.thenCancel()
|
||||
.verifyLater();
|
||||
|
||||
RequestInput payload = new RequestInput("{ testQuery { id } }", null, null, null, UUID.randomUUID().toString());
|
||||
RequestInput payload = new RequestInput("{ testQuery { id } }", null, null, UUID.randomUUID().toString(), null);
|
||||
this.inputChannel.send(MessageBuilder.withPayload(payload).build());
|
||||
|
||||
verifier.verify(Duration.ofSeconds(10));
|
||||
@@ -156,8 +157,8 @@ public class GraphQlMessageHandlerTests {
|
||||
.verifyLater();
|
||||
|
||||
RequestInput payload =
|
||||
new RequestInput("mutation { update(id: \"" + fakeId + "\") { id } }", null, null, null,
|
||||
UUID.randomUUID().toString());
|
||||
new RequestInput("mutation { update(id: \"" + fakeId + "\") { id } }", null, null,
|
||||
UUID.randomUUID().toString(), null);
|
||||
this.inputChannel.send(MessageBuilder.withPayload(payload).build());
|
||||
|
||||
verifier.verify(Duration.ofSeconds(10));
|
||||
@@ -195,7 +196,7 @@ public class GraphQlMessageHandlerTests {
|
||||
.verifyLater();
|
||||
|
||||
RequestInput payload =
|
||||
new RequestInput("subscription { results { id } }", null, null, null, UUID.randomUUID().toString());
|
||||
new RequestInput("subscription { results { id } }", null, null, UUID.randomUUID().toString(), null);
|
||||
this.inputChannel.send(MessageBuilder.withPayload(payload).build());
|
||||
|
||||
verifier.verify(Duration.ofSeconds(10));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2021 the original author or authors.
|
||||
* Copyright 2016-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,13 +63,14 @@ import org.springframework.mock.web.MockPart;
|
||||
import org.springframework.security.access.AccessDecisionManager;
|
||||
import org.springframework.security.access.vote.AffirmativeBased;
|
||||
import org.springframework.security.access.vote.RoleVoter;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
|
||||
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
|
||||
import org.springframework.test.web.client.MockMvcClientHttpRequestFactory;
|
||||
@@ -124,15 +125,15 @@ public class HttpDslTests {
|
||||
this.serviceInternalGatewayHandler.setRequestFactory(mockRequestFactory);
|
||||
|
||||
this.mockMvc.perform(
|
||||
get("/service")
|
||||
.with(httpBasic("admin", "admin"))
|
||||
.param("name", "foo"))
|
||||
get("/service")
|
||||
.with(httpBasic("admin", "admin"))
|
||||
.param("name", "foo"))
|
||||
.andExpect(content().string("FOO"));
|
||||
|
||||
this.mockMvc.perform(
|
||||
get("/service")
|
||||
.with(httpBasic("user", "user"))
|
||||
.param("name", "name"))
|
||||
get("/service")
|
||||
.with(httpBasic("user", "user"))
|
||||
.param("name", "name"))
|
||||
.andExpect(status().isForbidden())
|
||||
.andExpect(content().string("Error"));
|
||||
}
|
||||
@@ -141,8 +142,8 @@ public class HttpDslTests {
|
||||
public void testDynamicHttpEndpoint() throws Exception {
|
||||
IntegrationFlow flow =
|
||||
IntegrationFlows.from(Http.inboundGateway("/dynamic")
|
||||
.requestMapping(r -> r.params("name"))
|
||||
.payloadExpression("#requestParams.name[0]"))
|
||||
.requestMapping(r -> r.params("name"))
|
||||
.payloadExpression("#requestParams.name[0]"))
|
||||
.<String, String>transform(String::toLowerCase)
|
||||
.get();
|
||||
|
||||
@@ -150,17 +151,17 @@ public class HttpDslTests {
|
||||
this.integrationFlowContext.registration(flow).register();
|
||||
|
||||
this.mockMvc.perform(
|
||||
get("/dynamic")
|
||||
.with(httpBasic("user", "user"))
|
||||
.param("name", "BAR"))
|
||||
get("/dynamic")
|
||||
.with(httpBasic("user", "user"))
|
||||
.param("name", "BAR"))
|
||||
.andExpect(content().string("bar"));
|
||||
|
||||
flowRegistration.destroy();
|
||||
|
||||
this.mockMvc.perform(
|
||||
get("/dynamic")
|
||||
.with(httpBasic("user", "user"))
|
||||
.param("name", "BAZ"))
|
||||
get("/dynamic")
|
||||
.with(httpBasic("user", "user"))
|
||||
.param("name", "BAZ"))
|
||||
.andExpect(status().isNotFound());
|
||||
}
|
||||
|
||||
@@ -176,9 +177,9 @@ public class HttpDslTests {
|
||||
MockPart mockPart2 = new MockPart("a1", "file2", "DEF".getBytes(StandardCharsets.UTF_8));
|
||||
mockPart2.getHeaders().setContentType(MediaType.TEXT_PLAIN);
|
||||
this.mockMvc.perform(
|
||||
multipart("/multiPartFiles")
|
||||
.part(mockPart1, mockPart2)
|
||||
.with(httpBasic("user", "user")))
|
||||
multipart("/multiPartFiles")
|
||||
.part(mockPart1, mockPart2)
|
||||
.with(httpBasic("user", "user")))
|
||||
.andExpect(status().isOk());
|
||||
|
||||
Message<?> result = this.multiPartFilesChannel.receive(10_000);
|
||||
@@ -214,12 +215,12 @@ public class HttpDslTests {
|
||||
public void testValidation() throws Exception {
|
||||
IntegrationFlow flow =
|
||||
IntegrationFlows.from(
|
||||
Http.inboundChannelAdapter("/validation")
|
||||
.requestMapping((mapping) -> mapping
|
||||
.methods(HttpMethod.POST)
|
||||
.consumes(MediaType.APPLICATION_JSON_VALUE))
|
||||
.requestPayloadType(TestModel.class)
|
||||
.validator(this.validator))
|
||||
Http.inboundChannelAdapter("/validation")
|
||||
.requestMapping((mapping) -> mapping
|
||||
.methods(HttpMethod.POST)
|
||||
.consumes(MediaType.APPLICATION_JSON_VALUE))
|
||||
.requestPayloadType(TestModel.class)
|
||||
.validator(this.validator))
|
||||
.bridge()
|
||||
.get();
|
||||
|
||||
@@ -227,10 +228,10 @@ public class HttpDslTests {
|
||||
this.integrationFlowContext.registration(flow).register();
|
||||
|
||||
this.mockMvc.perform(
|
||||
post("/validation")
|
||||
.with(httpBasic("user", "user"))
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"name\": \"\"}"))
|
||||
post("/validation")
|
||||
.with(httpBasic("user", "user"))
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"name\": \"\"}"))
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(status().reason("Validation failure"));
|
||||
|
||||
@@ -241,21 +242,21 @@ public class HttpDslTests {
|
||||
public void testBadRequest() throws Exception {
|
||||
IntegrationFlow flow =
|
||||
IntegrationFlows.from(
|
||||
Http.inboundGateway("/badRequest")
|
||||
.errorChannel((message, timeout) -> {
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
|
||||
"Not valid request param", ((ErrorMessage) message).getPayload());
|
||||
})
|
||||
.payloadExpression("#requestParams.p1"))
|
||||
Http.inboundGateway("/badRequest")
|
||||
.errorChannel((message, timeout) -> {
|
||||
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
|
||||
"Not valid request param", ((ErrorMessage) message).getPayload());
|
||||
})
|
||||
.payloadExpression("#requestParams.p1"))
|
||||
.get();
|
||||
|
||||
IntegrationFlowContext.IntegrationFlowRegistration flowRegistration =
|
||||
this.integrationFlowContext.registration(flow).register();
|
||||
|
||||
this.mockMvc.perform(
|
||||
get("/badRequest")
|
||||
.with(httpBasic("user", "user"))
|
||||
.param("p2", "P2"))
|
||||
get("/badRequest")
|
||||
.with(httpBasic("user", "user"))
|
||||
.param("p2", "P2"))
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(status().reason("Not valid request param"));
|
||||
|
||||
@@ -266,16 +267,16 @@ public class HttpDslTests {
|
||||
public void testErrorChannelFlow() throws Exception {
|
||||
IntegrationFlow flow =
|
||||
IntegrationFlows.from(
|
||||
Http.inboundGateway("/errorFlow")
|
||||
.errorChannel(new FixedSubscriberChannel(
|
||||
new AbstractReplyProducingMessageHandler() {
|
||||
Http.inboundGateway("/errorFlow")
|
||||
.errorChannel(new FixedSubscriberChannel(
|
||||
new AbstractReplyProducingMessageHandler() {
|
||||
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
return "Error Response";
|
||||
}
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
return "Error Response";
|
||||
}
|
||||
|
||||
})))
|
||||
})))
|
||||
.transform((payload) -> {
|
||||
throw new RuntimeException("Error!");
|
||||
})
|
||||
@@ -285,8 +286,8 @@ public class HttpDslTests {
|
||||
this.integrationFlowContext.registration(flow).register();
|
||||
|
||||
this.mockMvc.perform(
|
||||
get("/errorFlow")
|
||||
.with(httpBasic("user", "user")))
|
||||
get("/errorFlow")
|
||||
.with(httpBasic("user", "user")))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().string("Error Response"));
|
||||
|
||||
@@ -296,9 +297,8 @@ public class HttpDslTests {
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableIntegration
|
||||
public static class ContextConfiguration extends WebSecurityConfigurerAdapter {
|
||||
public static class ContextConfiguration {
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public UserDetailsService userDetailsService() {
|
||||
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
|
||||
@@ -320,16 +320,18 @@ public class HttpDslTests {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests()
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
return http.
|
||||
authorizeRequests()
|
||||
.antMatchers("/service/internal/**").hasRole("ADMIN")
|
||||
.anyRequest().permitAll()
|
||||
.and()
|
||||
.httpBasic()
|
||||
.and()
|
||||
.csrf().disable()
|
||||
.anonymous().disable();
|
||||
.anonymous().disable()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -397,10 +399,11 @@ public class HttpDslTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ChannelSecurityInterceptor channelSecurityInterceptor(AccessDecisionManager accessDecisionManager)
|
||||
throws Exception {
|
||||
public ChannelSecurityInterceptor channelSecurityInterceptor(AccessDecisionManager accessDecisionManager,
|
||||
AuthenticationManagerBuilder authenticationManagerBuilder) {
|
||||
|
||||
ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor();
|
||||
channelSecurityInterceptor.setAuthenticationManager(authenticationManager());
|
||||
channelSecurityInterceptor.setAuthenticationManager(authenticationManagerBuilder.getOrBuild());
|
||||
channelSecurityInterceptor.setAccessDecisionManager(accessDecisionManager);
|
||||
return channelSecurityInterceptor;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2021 the original author or authors.
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -297,8 +297,7 @@ public class ConfigurableMongoDbMessageStore extends AbstractConfigurableMongoDb
|
||||
Query query = groupOrderQuery(groupId);
|
||||
Stream<MessageDocument> documents =
|
||||
getMongoTemplate()
|
||||
.stream(query, MessageDocument.class, this.collectionName)
|
||||
.stream();
|
||||
.stream(query, MessageDocument.class, this.collectionName);
|
||||
|
||||
return documents.map(MessageDocument::getMessage);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,7 @@ import java.util.UUID;
|
||||
|
||||
import org.springframework.data.annotation.AccessType;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -77,7 +77,7 @@ public class MessageDocument {
|
||||
* @param messageId the id of the {@link Message} as a separate persistent property.
|
||||
* @since 5.1
|
||||
*/
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
MessageDocument(Message<?> message, UUID messageId) {
|
||||
Assert.notNull(message, "'message' must not be null");
|
||||
Assert.notNull(messageId, "'message' ID header must not be null");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -442,8 +442,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
Assert.notNull(groupId, GROUP_ID_MUST_NOT_BE_NULL);
|
||||
Query query = whereGroupIdOrder(groupId);
|
||||
Stream<MessageWrapper> messageWrappers =
|
||||
this.template.stream(query, MessageWrapper.class, this.collectionName)
|
||||
.stream();
|
||||
this.template.stream(query, MessageWrapper.class, this.collectionName);
|
||||
|
||||
return messageWrappers.map(MessageWrapper::getMessage);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.history.MessageHistory;
|
||||
import org.springframework.integration.message.AdviceMessage;
|
||||
@@ -324,8 +324,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT
|
||||
this("baz");
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
Baz(String name) {
|
||||
@PersistenceCreator Baz(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -345,8 +344,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT
|
||||
this("abx");
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
Abc(String name) {
|
||||
@PersistenceCreator Abc(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -368,8 +366,7 @@ public abstract class AbstractMongoDbMessageStoreTests extends MongoDbAvailableT
|
||||
this("xyz");
|
||||
}
|
||||
|
||||
@PersistenceConstructor
|
||||
Xyz(String name) {
|
||||
@PersistenceCreator Xyz(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2020 the original author or authors.
|
||||
* Copyright 2007-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -135,7 +135,9 @@ public class RedisInboundChannelAdapter extends MessageProducerSupport {
|
||||
}
|
||||
adapter.afterPropertiesSet();
|
||||
this.container.addMessageListener(adapter, topicList);
|
||||
this.container.afterPropertiesSet();
|
||||
if (!this.container.isActive()) {
|
||||
this.container.afterPropertiesSet();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public final class RedisAvailableRule implements MethodRule {
|
||||
.build();
|
||||
|
||||
connectionFactory = new LettuceConnectionFactory(redisStandaloneConfiguration, clientConfiguration);
|
||||
connectionFactory.setEagerInitialization(true);
|
||||
connectionFactory.afterPropertiesSet();
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public final class RedisAvailableRule implements MethodRule {
|
||||
if (redisAvailable != null) {
|
||||
if (connectionFactory != null) {
|
||||
try {
|
||||
connectionFactory.afterPropertiesSet();
|
||||
connectionFactory.initConnection();
|
||||
initialized = true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,7 +68,7 @@ public abstract class RedisAvailableTests {
|
||||
int n = 0;
|
||||
while (n++ < 300 &&
|
||||
(connection =
|
||||
TestUtils.getPropertyValue(container, "subscriptionTask.connection", RedisConnection.class))
|
||||
TestUtils.getPropertyValue(container, "subscriber.connection", RedisConnection.class))
|
||||
== null) {
|
||||
|
||||
Thread.sleep(100);
|
||||
@@ -84,7 +84,7 @@ public abstract class RedisAvailableTests {
|
||||
|
||||
protected void awaitContainerSubscribedWithPatterns(RedisMessageListenerContainer container) throws Exception {
|
||||
this.awaitContainerSubscribed(container);
|
||||
RedisConnection connection = TestUtils.getPropertyValue(container, "subscriptionTask.connection",
|
||||
RedisConnection connection = TestUtils.getPropertyValue(container, "subscriber.connection",
|
||||
RedisConnection.class);
|
||||
|
||||
int n = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2021 the original author or authors.
|
||||
* Copyright 2016-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,9 +62,7 @@ import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.security.access.AccessDecisionManager;
|
||||
import org.springframework.security.access.vote.AffirmativeBased;
|
||||
import org.springframework.security.access.vote.RoleVoter;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
|
||||
import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
|
||||
@@ -208,9 +206,9 @@ public class WebFluxDslTests {
|
||||
.setPropertyValue("webClient", webClient);
|
||||
|
||||
this.mockMvc.perform(
|
||||
get("/service2")
|
||||
.with(httpBasic("guest", "guest"))
|
||||
.param("name", "foo"))
|
||||
get("/service2")
|
||||
.with(httpBasic("guest", "guest"))
|
||||
.param("name", "foo"))
|
||||
.andExpect(
|
||||
content()
|
||||
.string("FOO"));
|
||||
@@ -269,8 +267,8 @@ public class WebFluxDslTests {
|
||||
public void testDynamicHttpEndpoint() {
|
||||
IntegrationFlow flow =
|
||||
IntegrationFlows.from(WebFlux.inboundGateway("/dynamic")
|
||||
.requestMapping(r -> r.params("name"))
|
||||
.payloadExpression("#requestParams.name[0]"))
|
||||
.requestMapping(r -> r.params("name"))
|
||||
.payloadExpression("#requestParams.name[0]"))
|
||||
.<String, String>transform(String::toLowerCase)
|
||||
.get();
|
||||
|
||||
@@ -299,13 +297,13 @@ public class WebFluxDslTests {
|
||||
public void testValidation() {
|
||||
IntegrationFlow flow =
|
||||
IntegrationFlows.from(
|
||||
WebFlux.inboundGateway("/validation")
|
||||
.requestMapping((mapping) -> mapping
|
||||
.methods(HttpMethod.POST)
|
||||
.consumes(MediaType.APPLICATION_JSON_VALUE))
|
||||
.requestPayloadType(
|
||||
ResolvableType.forClassWithGenerics(Flux.class, TestModel.class))
|
||||
.validator(this.validator))
|
||||
WebFlux.inboundGateway("/validation")
|
||||
.requestMapping((mapping) -> mapping
|
||||
.methods(HttpMethod.POST)
|
||||
.consumes(MediaType.APPLICATION_JSON_VALUE))
|
||||
.requestPayloadType(
|
||||
ResolvableType.forClassWithGenerics(Flux.class, TestModel.class))
|
||||
.validator(this.validator))
|
||||
.bridge()
|
||||
.get();
|
||||
|
||||
@@ -326,16 +324,16 @@ public class WebFluxDslTests {
|
||||
public void testErrorChannelFlow() {
|
||||
IntegrationFlow flow =
|
||||
IntegrationFlows.from(
|
||||
WebFlux.inboundGateway("/errorFlow")
|
||||
.errorChannel(new FixedSubscriberChannel(
|
||||
new AbstractReplyProducingMessageHandler() {
|
||||
WebFlux.inboundGateway("/errorFlow")
|
||||
.errorChannel(new FixedSubscriberChannel(
|
||||
new AbstractReplyProducingMessageHandler() {
|
||||
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
return "Error Response";
|
||||
}
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
return "Error Response";
|
||||
}
|
||||
|
||||
})))
|
||||
})))
|
||||
.channel(MessageChannels.flux())
|
||||
.transform((payload) -> {
|
||||
throw new RuntimeException("Error!");
|
||||
@@ -361,7 +359,7 @@ public class WebFluxDslTests {
|
||||
@EnableWebSecurity
|
||||
@EnableWebFluxSecurity
|
||||
@EnableIntegration
|
||||
public static class ContextConfiguration extends WebSecurityConfigurerAdapter implements WebFluxConfigurer {
|
||||
public static class ContextConfiguration implements WebFluxConfigurer {
|
||||
|
||||
@Override
|
||||
public Validator getValidator() {
|
||||
@@ -377,7 +375,6 @@ public class WebFluxDslTests {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public UserDetailsService userDetailsService() {
|
||||
return new InMemoryUserDetailsManager(userDetails());
|
||||
@@ -400,17 +397,6 @@ public class WebFluxDslTests {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests()
|
||||
.anyRequest().hasRole("ADMIN")
|
||||
.and()
|
||||
.httpBasic()
|
||||
.and()
|
||||
.csrf().disable()
|
||||
.anonymous().disable();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IntegrationFlow webFluxFlowWithReplyPayloadToFlux() {
|
||||
return f -> f
|
||||
@@ -437,10 +423,10 @@ public class WebFluxDslTests {
|
||||
.from(Http.inboundGateway("/service2")
|
||||
.requestMapping(r -> r.params("name")))
|
||||
.handle(WebFlux.<MultiValueMap<String, String>>outboundGateway(m ->
|
||||
UriComponentsBuilder.fromUriString("https://www.springsource.org/spring-integration")
|
||||
.queryParams(m.getPayload())
|
||||
.build()
|
||||
.toUri())
|
||||
UriComponentsBuilder.fromUriString("https://www.springsource.org/spring-integration")
|
||||
.queryParams(m.getPayload())
|
||||
.build()
|
||||
.toUri())
|
||||
.httpMethod(HttpMethod.GET)
|
||||
.expectedResponseType(String.class))
|
||||
.get();
|
||||
|
||||
Reference in New Issue
Block a user