Upgrade to the latest dependencies

Fix compatibility and deprecations
This commit is contained in:
abilan
2022-11-29 16:02:47 -05:00
parent 217c675caa
commit f5b31d2495
9 changed files with 44 additions and 30 deletions

View File

@@ -26,18 +26,18 @@ repositories {
}
ext {
assertjVersion = '3.22.0'
assertjVersion = '3.23.1'
awaitilityVersion = '4.2.0'
dynamodbLockClientVersion = '1.1.0'
jacksonVersion = '2.13.3'
junitVersion = '5.8.2'
servletApiVersion = '5.0.0'
log4jVersion = '2.17.2'
junitVersion = '5.9.1'
servletApiVersion = '6.0.0'
log4jVersion = '2.19.0'
springCloudAwsVersion = '2.4.2'
springIntegrationVersion = '6.0.0-M3'
springIntegrationVersion = '6.0.0'
kinesisClientVersion = '1.14.8'
kinesisProducerVersion = '0.14.12'
testcontainersVersion = '1.17.1'
kinesisProducerVersion = '0.14.13'
testcontainersVersion = '1.17.6'
idPrefix = 'aws'
@@ -98,7 +98,7 @@ jacoco {
checkstyle {
configDirectory.set(rootProject.file('src/checkstyle'))
toolVersion = '10.2'
toolVersion = '10.4'
}
dependencies {

View File

@@ -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.
@@ -51,6 +51,7 @@ import io.awspring.cloud.messaging.listener.SqsMessageDeletionPolicy;
*
* @author Artem Bilan
* @author Patrick Fitzsimons
*
* @see SimpleMessageListenerContainerFactory
* @see SimpleMessageListenerContainer
* @see QueueMessageHandler
@@ -59,7 +60,8 @@ import io.awspring.cloud.messaging.listener.SqsMessageDeletionPolicy;
@IntegrationManagedResource
public class SqsMessageDrivenChannelAdapter extends MessageProducerSupport implements DisposableBean {
private final SimpleMessageListenerContainerFactory simpleMessageListenerContainerFactory = new SimpleMessageListenerContainerFactory();
private final SimpleMessageListenerContainerFactory simpleMessageListenerContainerFactory =
new SimpleMessageListenerContainerFactory();
private final String[] queues;

View File

@@ -21,6 +21,9 @@ import org.testcontainers.containers.localstack.LocalStackContainer;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.cloudwatch.AmazonCloudWatch;
import com.amazonaws.services.cloudwatch.AmazonCloudWatchClientBuilder;
@@ -37,7 +40,6 @@ import com.amazonaws.services.kinesis.AmazonKinesisAsyncClientBuilder;
* started only once per JVM, therefore the target Docker container is reused automatically.
*
* @author Artem Bilan
*
* @since 3.0
*/
@Testcontainers(disabledWithoutDocker = true)
@@ -45,7 +47,7 @@ public interface LocalstackContainerTest {
LocalStackContainer LOCAL_STACK_CONTAINER =
new LocalStackContainer(
DockerImageName.parse("localstack/localstack:0.14.2"))
DockerImageName.parse("localstack/localstack:1.2.0"))
.withServices(
LocalStackContainer.Service.DYNAMODB,
LocalStackContainer.Service.KINESIS,
@@ -68,11 +70,21 @@ public interface LocalstackContainerTest {
return applyAwsClientOptions(AmazonCloudWatchClientBuilder.standard(), LocalStackContainer.Service.CLOUDWATCH);
}
static AWSCredentialsProvider credentialsProvider() {
return new AWSStaticCredentialsProvider(
new BasicAWSCredentials(
LOCAL_STACK_CONTAINER.getAccessKey(),
LOCAL_STACK_CONTAINER.getSecretKey()));
}
private static <B extends AwsClientBuilder<B, T>, T> T applyAwsClientOptions(B clientBuilder,
LocalStackContainer.Service serviceToBuild) {
return clientBuilder.withEndpointConfiguration(LOCAL_STACK_CONTAINER.getEndpointConfiguration(serviceToBuild))
.withCredentials(LOCAL_STACK_CONTAINER.getDefaultCredentialsProvider())
return clientBuilder.withEndpointConfiguration(
new AwsClientBuilder.EndpointConfiguration(
LOCAL_STACK_CONTAINER.getEndpointOverride(serviceToBuild).toString(),
LOCAL_STACK_CONTAINER.getRegion()))
.withCredentials(credentialsProvider())
.build();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2021 the original author or authors.
* Copyright 2015-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.
@@ -105,7 +105,7 @@ public class SqsMessageDrivenChannelAdapterTests {
assertThatThrownBy(
() -> this.controlBusInput.send(new GenericMessage<>("@sqsMessageDrivenChannelAdapter.start('foo')")))
.hasCauseExactlyInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Queue with name 'foo' does not exist");
.hasStackTraceContaining("Queue with name 'foo' does not exist");
assertThat(this.sqsMessageDrivenChannelAdapter.getQueues()).isEqualTo(new String[] {"testQueue"});
}

View File

@@ -151,7 +151,7 @@ public class KplKclIntegrationTests implements LocalstackContainerTest {
LocalstackContainerTest.LOCAL_STACK_CONTAINER.getEndpointOverride(LocalStackContainer.Service.CLOUDWATCH);
return new KinesisProducerConfiguration()
.setCredentialsProvider(LocalstackContainerTest.LOCAL_STACK_CONTAINER.getDefaultCredentialsProvider())
.setCredentialsProvider(LocalstackContainerTest.credentialsProvider())
.setRegion(LocalstackContainerTest.LOCAL_STACK_CONTAINER.getRegion())
.setKinesisEndpoint(kinesisUri.getHost())
.setKinesisPort(kinesisUri.getPort())
@@ -175,7 +175,7 @@ public class KplKclIntegrationTests implements LocalstackContainerTest {
KclMessageDrivenChannelAdapter adapter =
new KclMessageDrivenChannelAdapter(
TEST_STREAM, AMAZON_KINESIS, CLOUD_WATCH, DYNAMO_DB,
LocalstackContainerTest.LOCAL_STACK_CONTAINER.getDefaultCredentialsProvider());
LocalstackContainerTest.credentialsProvider());
adapter.setOutputChannel(kinesisReceiveChannel());
adapter.setErrorChannel(errorChannel());
adapter.setErrorMessageStrategy(new KinesisMessageHeaderErrorMessageStrategy());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 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.
@@ -86,14 +86,14 @@ public class KinesisMessageHandlerTests {
assertThatExceptionOfType(MessageHandlingException.class)
.isThrownBy(() -> this.kinesisSendChannel.send(message))
.withCauseInstanceOf(IllegalStateException.class)
.withMessageContaining("'stream' must not be null for sending a Kinesis record");
.withStackTraceContaining("'stream' must not be null for sending a Kinesis record");
this.kinesisMessageHandler.setStream("foo");
assertThatExceptionOfType(MessageHandlingException.class)
.isThrownBy(() -> this.kinesisSendChannel.send(message))
.withCauseInstanceOf(IllegalStateException.class)
.withMessageContaining("'partitionKey' must not be null for sending a Kinesis record");
.withStackTraceContaining("'partitionKey' must not be null for sending a Kinesis record");
Message<?> message2 = MessageBuilder.fromMessage(message).setHeader(AwsHeaders.PARTITION_KEY, "fooKey")
.setHeader(AwsHeaders.SEQUENCE_NUMBER, "10").setHeader("foo", "bar").build();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2019 the original author or authors.
* Copyright 2017-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.
@@ -86,14 +86,14 @@ public class KinesisProducingMessageHandlerTests {
assertThatExceptionOfType(MessageHandlingException.class)
.isThrownBy(() -> this.kinesisSendChannel.send(message))
.withCauseInstanceOf(IllegalStateException.class)
.withMessageContaining("'stream' must not be null for sending a Kinesis record");
.withStackTraceContaining("'stream' must not be null for sending a Kinesis record");
this.kinesisMessageHandler.setStream("foo");
assertThatExceptionOfType(MessageHandlingException.class)
.isThrownBy(() -> this.kinesisSendChannel.send(message))
.withCauseInstanceOf(IllegalStateException.class)
.withMessageContaining("'partitionKey' must not be null for sending a Kinesis record");
.withStackTraceContaining("'partitionKey' must not be null for sending a Kinesis record");
Message<?> message2 = MessageBuilder.fromMessage(message).setHeader(AwsHeaders.PARTITION_KEY, "fooKey")
.setHeader(AwsHeaders.SEQUENCE_NUMBER, "10").build();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 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.
@@ -200,7 +200,7 @@ public class S3MessageHandlerTests {
assertThatThrownBy(() -> this.s3SendChannel.send(message))
.hasCauseExactlyInstanceOf(IllegalStateException.class)
.hasMessageContaining("Specify a 'keyExpression' for non-java.io.File payloads");
.hasStackTraceContaining("Specify a 'keyExpression' for non-java.io.File payloads");
this.s3MessageHandler.setKeyExpression(actualKeyExpression);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 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.
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
@@ -43,7 +44,6 @@ import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.PollableChannel;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
@@ -60,7 +60,7 @@ import com.amazonaws.services.sns.model.PublishResult;
@DirtiesContext
public class SnsMessageHandlerTests {
private static SpelExpressionParser PARSER = new SpelExpressionParser();
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
@Autowired
private MessageChannel sendToSnsChannel;
@@ -120,7 +120,7 @@ public class SnsMessageHandlerTests {
PublishResult publishResult = new PublishResult().withMessageId("111");
AsyncHandler<PublishRequest, PublishResult> asyncHandler = invocation.getArgument(1);
asyncHandler.onSuccess(invocation.getArgument(0), publishResult);
return new AsyncResult<>(publishResult);
return CompletableFuture.completedFuture(publishResult);
}).given(mock).publishAsync(any(PublishRequest.class), any(AsyncHandler.class));
return mock;