diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..2e64b6a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,35 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'type: bug, status: waiting-for-triage' +assignees: '' + +--- + +**In what version(s) of Spring Integration AWS are you seeing this issue?** + +For example: + +2.5.3 + +Between 2.5.0 and 3.0.0 + +**Describe the bug** + +A clear and concise description of what the bug is. + +**To Reproduce** + +Steps to reproduce the behavior. + +**Expected behavior** + +A clear and concise description of what you expected to happen. + +**Sample** + +A link to a GitHub repository with a [minimal, reproducible sample](https://stackoverflow.com/help/minimal-reproducible-example). + +Reports that include a sample will take priority over reports that do not. +At times, we may require a sample, so it is good to try and include a sample up front. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..dee93ce --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Community Support + url: https://stackoverflow.com/questions/tagged/spring-integration + about: Please ask and answer questions on StackOverflow with the tag spring-integration diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..381a897 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,25 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'status: waiting-for-triage, type: enhancement' +assignees: '' + +--- + +**Expected Behavior** + + + +**Current Behavior** + + + +**Context** + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..f46ea11 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,6 @@ + diff --git a/.github/release-files-spec.json b/.github/release-files-spec.json new file mode 100644 index 0000000..be01238 --- /dev/null +++ b/.github/release-files-spec.json @@ -0,0 +1,34 @@ +{ + "files": [ + { + "aql": { + "items.find": { + "$and": [ + { + "@build.name": "${buildname}", + "@build.number": "${buildnumber}", + "path": { + "$match": "org*" + } + }, + { + "$or": [ + { + "name": { + "$match": "*.pom" + } + }, + { + "name": { + "$match": "*.jar" + } + } + ] + } + ] + } + }, + "target": "nexus/" + } + ] +} diff --git a/.github/workflows/pr-build-workflow.yml b/.github/workflows/pr-build-workflow.yml new file mode 100644 index 0000000..4b28aa4 --- /dev/null +++ b/.github/workflows/pr-build-workflow.yml @@ -0,0 +1,33 @@ +name: Pull Request build + +on: + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v3 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + + - name: Run Gradle + uses: gradle/gradle-build-action@v2 + with: + arguments: check + + - name: Capture Test Results + if: failure() + uses: actions/upload-artifact@v3 + with: + name: test-results + path: '*/build/reports/tests/**/*.*' + retention-days: 3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index db68a60..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -dist: trusty -language: java -jdk: oraclejdk8 -install: true -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ -script: - - ./gradlew check --no-daemon diff --git a/build.gradle b/build.gradle index d2ac8ad..7a06910 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,17 @@ +buildscript { + ext.isCI = System.getenv('GITHUB_ACTION') || System.getenv('bamboo_buildKey') +} + plugins { id 'java-library' id 'eclipse' id 'idea' id 'jacoco' - id 'org.sonarqube' version '3.1.1' + id 'org.sonarqube' version '3.3' id 'checkstyle' id 'org.ajoberstar.grgit' version '4.1.1' - id "io.spring.dependency-management" version '1.0.11.RELEASE' - id 'com.jfrog.artifactory' version '4.28.0' + id 'io.spring.dependency-management' version '1.1.0' + id 'com.jfrog.artifactory' version '4.30.1' } description = 'Spring Integration AWS Support' @@ -29,13 +33,13 @@ ext { assertjVersion = '3.23.1' awaitilityVersion = '4.2.0' dynamodbLockClientVersion = '1.1.0' - jacksonVersion = '2.13.3' + jacksonVersion = '2.14.1' junitVersion = '5.9.1' servletApiVersion = '6.0.0' log4jVersion = '2.19.0' springCloudAwsVersion = '2.4.2' - springIntegrationVersion = '6.0.0' - kinesisClientVersion = '1.14.8' + springIntegrationVersion = '6.0.1' + kinesisClientVersion = '1.14.9' kinesisProducerVersion = '0.14.13' testcontainersVersion = '1.17.6' @@ -98,7 +102,7 @@ jacoco { checkstyle { configDirectory.set(rootProject.file('src/checkstyle')) - toolVersion = '10.4' + toolVersion = '10.5.0' } dependencies { @@ -190,7 +194,7 @@ build.dependsOn jacocoTestReport task updateCopyrights { - onlyIf { !System.getenv('TRAVIS') && !System.getenv('bamboo_buildKey') } + onlyIf { !isCI } inputs.files(modifiedFiles) outputs.dir("$buildDir/classes") diff --git a/gradle.properties b/gradle.properties index cd92d6b..30f8d7f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,3 @@ version=3.0.0-SNAPSHOT +org.gradle.caching=true +org.gradle.parallel=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927..943f0cb 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 00e33ed..c1051b0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionSha256Sum=7ba68c54029790ab444b39d7e293d3236b2632631fb5f2e012bb28b4ff669e4b \ No newline at end of file diff --git a/gradlew b/gradlew index 1b6c787..65dcd68 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index cd161ef..3f79348 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -92,10 +92,10 @@ - + - + diff --git a/src/main/java/org/springframework/integration/aws/inbound/S3InboundFileSynchronizer.java b/src/main/java/org/springframework/integration/aws/inbound/S3InboundFileSynchronizer.java index 0175c0f..180144b 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/S3InboundFileSynchronizer.java +++ b/src/main/java/org/springframework/integration/aws/inbound/S3InboundFileSynchronizer.java @@ -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. @@ -19,6 +19,9 @@ package org.springframework.integration.aws.inbound; import java.io.File; import java.io.IOException; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.model.S3ObjectSummary; + import org.springframework.expression.EvaluationContext; import org.springframework.expression.common.LiteralExpression; import org.springframework.integration.aws.support.S3Session; @@ -30,9 +33,6 @@ import org.springframework.integration.file.remote.synchronizer.AbstractInboundF import org.springframework.integration.metadata.SimpleMetadataStore; import org.springframework.lang.Nullable; -import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.model.S3ObjectSummary; - /** * An implementation of {@link AbstractInboundFileSynchronizer} for Amazon S3. * diff --git a/src/main/java/org/springframework/integration/aws/inbound/S3InboundFileSynchronizingMessageSource.java b/src/main/java/org/springframework/integration/aws/inbound/S3InboundFileSynchronizingMessageSource.java index cc848ea..75d69bd 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/S3InboundFileSynchronizingMessageSource.java +++ b/src/main/java/org/springframework/integration/aws/inbound/S3InboundFileSynchronizingMessageSource.java @@ -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. @@ -19,11 +19,11 @@ package org.springframework.integration.aws.inbound; import java.io.File; import java.util.Comparator; +import com.amazonaws.services.s3.model.S3ObjectSummary; + import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer; import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource; -import com.amazonaws.services.s3.model.S3ObjectSummary; - /** * A {@link org.springframework.integration.core.MessageSource} implementation for the * Amazon S3. diff --git a/src/main/java/org/springframework/integration/aws/inbound/S3StreamingMessageSource.java b/src/main/java/org/springframework/integration/aws/inbound/S3StreamingMessageSource.java index 4a14bba..53c28b1 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/S3StreamingMessageSource.java +++ b/src/main/java/org/springframework/integration/aws/inbound/S3StreamingMessageSource.java @@ -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. @@ -21,6 +21,8 @@ import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; +import com.amazonaws.services.s3.model.S3ObjectSummary; + import org.springframework.integration.aws.support.S3FileInfo; import org.springframework.integration.aws.support.S3Session; import org.springframework.integration.aws.support.filters.S3PersistentAcceptOnceFileListFilter; @@ -29,8 +31,6 @@ import org.springframework.integration.file.remote.AbstractRemoteFileStreamingMe import org.springframework.integration.file.remote.RemoteFileTemplate; import org.springframework.integration.metadata.SimpleMetadataStore; -import com.amazonaws.services.s3.model.S3ObjectSummary; - /** * A {@link AbstractRemoteFileStreamingMessageSource} implementation for the Amazon S3. * diff --git a/src/main/java/org/springframework/integration/aws/inbound/SnsInboundChannelAdapter.java b/src/main/java/org/springframework/integration/aws/inbound/SnsInboundChannelAdapter.java index 96b9a66..7dd6947 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/SnsInboundChannelAdapter.java +++ b/src/main/java/org/springframework/integration/aws/inbound/SnsInboundChannelAdapter.java @@ -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. @@ -22,6 +22,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import com.amazonaws.services.sns.AmazonSNS; +import com.fasterxml.jackson.databind.JsonNode; +import io.awspring.cloud.messaging.endpoint.NotificationStatus; +import io.awspring.cloud.messaging.endpoint.NotificationStatusHandlerMethodArgumentResolver; + import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.http.HttpHeaders; @@ -40,11 +45,6 @@ import org.springframework.messaging.Message; import org.springframework.util.Assert; import org.springframework.web.multipart.MultipartResolver; -import com.amazonaws.services.sns.AmazonSNS; -import com.fasterxml.jackson.databind.JsonNode; -import io.awspring.cloud.messaging.endpoint.NotificationStatus; -import io.awspring.cloud.messaging.endpoint.NotificationStatusHandlerMethodArgumentResolver; - /** * The {@link HttpRequestHandlingMessagingGateway} extension for the Amazon WS SNS HTTP(S) * endpoints. Accepts all {@code x-amz-sns-message-type}s, converts the received Topic diff --git a/src/main/java/org/springframework/integration/aws/inbound/SqsMessageDrivenChannelAdapter.java b/src/main/java/org/springframework/integration/aws/inbound/SqsMessageDrivenChannelAdapter.java index 3fb1ba6..122f6e1 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/SqsMessageDrivenChannelAdapter.java +++ b/src/main/java/org/springframework/integration/aws/inbound/SqsMessageDrivenChannelAdapter.java @@ -22,6 +22,13 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import com.amazonaws.services.sqs.AmazonSQSAsync; +import io.awspring.cloud.core.env.ResourceIdResolver; +import io.awspring.cloud.messaging.config.SimpleMessageListenerContainerFactory; +import io.awspring.cloud.messaging.listener.QueueMessageHandler; +import io.awspring.cloud.messaging.listener.SimpleMessageListenerContainer; +import io.awspring.cloud.messaging.listener.SqsMessageDeletionPolicy; + import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.DisposableBean; import org.springframework.core.task.AsyncTaskExecutor; @@ -37,13 +44,6 @@ import org.springframework.messaging.core.DestinationResolver; import org.springframework.messaging.handler.HandlerMethod; import org.springframework.util.Assert; -import com.amazonaws.services.sqs.AmazonSQSAsync; -import io.awspring.cloud.core.env.ResourceIdResolver; -import io.awspring.cloud.messaging.config.SimpleMessageListenerContainerFactory; -import io.awspring.cloud.messaging.listener.QueueMessageHandler; -import io.awspring.cloud.messaging.listener.SimpleMessageListenerContainer; -import io.awspring.cloud.messaging.listener.SqsMessageDeletionPolicy; - /** * The {@link MessageProducerSupport} implementation for the Amazon SQS * {@code receiveMessage}. Works in 'listener' manner and delegates hard to the diff --git a/src/main/java/org/springframework/integration/aws/inbound/kinesis/KclMessageDrivenChannelAdapter.java b/src/main/java/org/springframework/integration/aws/inbound/kinesis/KclMessageDrivenChannelAdapter.java index 1aab4ac..e521571 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/kinesis/KclMessageDrivenChannelAdapter.java +++ b/src/main/java/org/springframework/integration/aws/inbound/kinesis/KclMessageDrivenChannelAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-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. @@ -25,24 +25,6 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; -import org.springframework.core.AttributeAccessor; -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.serializer.support.DeserializingConverter; -import org.springframework.core.task.SimpleAsyncTaskExecutor; -import org.springframework.core.task.TaskExecutor; -import org.springframework.core.task.support.ExecutorServiceAdapter; -import org.springframework.integration.IntegrationMessageHeaderAccessor; -import org.springframework.integration.aws.support.AwsHeaders; -import org.springframework.integration.endpoint.MessageProducerSupport; -import org.springframework.integration.mapping.InboundMessageMapper; -import org.springframework.integration.support.AbstractIntegrationMessageBuilder; -import org.springframework.integration.support.ErrorMessageStrategy; -import org.springframework.integration.support.ErrorMessageUtils; -import org.springframework.integration.support.management.IntegrationManagedResource; -import org.springframework.jmx.export.annotation.ManagedResource; -import org.springframework.messaging.Message; -import org.springframework.util.Assert; - import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; @@ -69,6 +51,24 @@ import com.amazonaws.services.kinesis.clientlibrary.lib.worker.SimpleRecordsFetc import com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker; import com.amazonaws.services.kinesis.model.Record; +import org.springframework.core.AttributeAccessor; +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.serializer.support.DeserializingConverter; +import org.springframework.core.task.SimpleAsyncTaskExecutor; +import org.springframework.core.task.TaskExecutor; +import org.springframework.core.task.support.ExecutorServiceAdapter; +import org.springframework.integration.IntegrationMessageHeaderAccessor; +import org.springframework.integration.aws.support.AwsHeaders; +import org.springframework.integration.endpoint.MessageProducerSupport; +import org.springframework.integration.mapping.InboundMessageMapper; +import org.springframework.integration.support.AbstractIntegrationMessageBuilder; +import org.springframework.integration.support.ErrorMessageStrategy; +import org.springframework.integration.support.ErrorMessageUtils; +import org.springframework.integration.support.management.IntegrationManagedResource; +import org.springframework.jmx.export.annotation.ManagedResource; +import org.springframework.messaging.Message; +import org.springframework.util.Assert; + /** * The {@link MessageProducerSupport} implementation for receiving data from Amazon * Kinesis stream(s) using AWS KCL. diff --git a/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java b/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java index 34d6c35..35f4986 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java +++ b/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java @@ -44,6 +44,19 @@ import java.util.concurrent.locks.Lock; import java.util.function.Function; import java.util.stream.Collectors; +import com.amazonaws.services.kinesis.AmazonKinesis; +import com.amazonaws.services.kinesis.model.ExpiredIteratorException; +import com.amazonaws.services.kinesis.model.GetRecordsRequest; +import com.amazonaws.services.kinesis.model.GetRecordsResult; +import com.amazonaws.services.kinesis.model.GetShardIteratorRequest; +import com.amazonaws.services.kinesis.model.LimitExceededException; +import com.amazonaws.services.kinesis.model.ListShardsRequest; +import com.amazonaws.services.kinesis.model.ListShardsResult; +import com.amazonaws.services.kinesis.model.ProvisionedThroughputExceededException; +import com.amazonaws.services.kinesis.model.Record; +import com.amazonaws.services.kinesis.model.Shard; +import com.amazonaws.services.kinesis.model.ShardIteratorType; + import org.springframework.beans.factory.DisposableBean; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; @@ -71,19 +84,6 @@ import org.springframework.scheduling.concurrent.CustomizableThreadFactory; import org.springframework.util.Assert; import org.springframework.util.StringUtils; -import com.amazonaws.services.kinesis.AmazonKinesis; -import com.amazonaws.services.kinesis.model.ExpiredIteratorException; -import com.amazonaws.services.kinesis.model.GetRecordsRequest; -import com.amazonaws.services.kinesis.model.GetRecordsResult; -import com.amazonaws.services.kinesis.model.GetShardIteratorRequest; -import com.amazonaws.services.kinesis.model.LimitExceededException; -import com.amazonaws.services.kinesis.model.ListShardsRequest; -import com.amazonaws.services.kinesis.model.ListShardsResult; -import com.amazonaws.services.kinesis.model.ProvisionedThroughputExceededException; -import com.amazonaws.services.kinesis.model.Record; -import com.amazonaws.services.kinesis.model.Shard; -import com.amazonaws.services.kinesis.model.ShardIteratorType; - /** * The {@link MessageProducerSupport} implementation for receiving data from Amazon Kinesis * stream(s). diff --git a/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisShardOffset.java b/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisShardOffset.java index 3b7b229..b1ea534 100644 --- a/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisShardOffset.java +++ b/src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisShardOffset.java @@ -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. @@ -19,11 +19,11 @@ package org.springframework.integration.aws.inbound.kinesis; import java.util.Date; import java.util.Objects; -import org.springframework.util.Assert; - import com.amazonaws.services.kinesis.model.GetShardIteratorRequest; import com.amazonaws.services.kinesis.model.ShardIteratorType; +import org.springframework.util.Assert; + /** * A model to represent a sequence in the shard for particular {@link ShardIteratorType}. * diff --git a/src/main/java/org/springframework/integration/aws/lock/DynamoDbLockRegistry.java b/src/main/java/org/springframework/integration/aws/lock/DynamoDbLockRegistry.java index b862f5c..e6c427d 100644 --- a/src/main/java/org/springframework/integration/aws/lock/DynamoDbLockRegistry.java +++ b/src/main/java/org/springframework/integration/aws/lock/DynamoDbLockRegistry.java @@ -33,19 +33,6 @@ import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.beans.DirectFieldAccessor; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.dao.CannotAcquireLockException; -import org.springframework.dao.DataAccessResourceFailureException; -import org.springframework.integration.support.locks.ExpirableLockRegistry; -import org.springframework.scheduling.concurrent.CustomizableThreadFactory; -import org.springframework.util.Assert; -import org.springframework.util.ReflectionUtils; - import com.amazonaws.services.dynamodbv2.AcquireLockOptions; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBLockClient; @@ -62,6 +49,18 @@ import com.amazonaws.services.dynamodbv2.model.LockTableDoesNotExistException; import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput; import com.amazonaws.services.dynamodbv2.model.ResourceInUseException; import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.springframework.beans.DirectFieldAccessor; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.dao.CannotAcquireLockException; +import org.springframework.dao.DataAccessResourceFailureException; +import org.springframework.integration.support.locks.ExpirableLockRegistry; +import org.springframework.scheduling.concurrent.CustomizableThreadFactory; +import org.springframework.util.Assert; +import org.springframework.util.ReflectionUtils; /** * An {@link ExpirableLockRegistry} implementation for the AWS DynamoDB. The algorithm is diff --git a/src/main/java/org/springframework/integration/aws/metadata/DynamoDbMetadataStore.java b/src/main/java/org/springframework/integration/aws/metadata/DynamoDbMetadataStore.java index 81edac3..6e388bb 100644 --- a/src/main/java/org/springframework/integration/aws/metadata/DynamoDbMetadataStore.java +++ b/src/main/java/org/springframework/integration/aws/metadata/DynamoDbMetadataStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 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. @@ -19,13 +19,6 @@ package org.springframework.integration.aws.metadata; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.springframework.beans.factory.InitializingBean; -import org.springframework.integration.metadata.ConcurrentMetadataStore; -import org.springframework.util.Assert; - import com.amazonaws.handlers.AsyncHandler; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsync; @@ -57,6 +50,12 @@ import com.amazonaws.waiters.PollingStrategy; import com.amazonaws.waiters.Waiter; import com.amazonaws.waiters.WaiterHandler; import com.amazonaws.waiters.WaiterParameters; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.springframework.beans.factory.InitializingBean; +import org.springframework.integration.metadata.ConcurrentMetadataStore; +import org.springframework.util.Assert; /** * The {@link ConcurrentMetadataStore} for the {@link AmazonDynamoDB}. diff --git a/src/main/java/org/springframework/integration/aws/outbound/AbstractAwsMessageHandler.java b/src/main/java/org/springframework/integration/aws/outbound/AbstractAwsMessageHandler.java index b01d23d..1c3b49b 100644 --- a/src/main/java/org/springframework/integration/aws/outbound/AbstractAwsMessageHandler.java +++ b/src/main/java/org/springframework/integration/aws/outbound/AbstractAwsMessageHandler.java @@ -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. @@ -21,6 +21,9 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import com.amazonaws.AmazonWebServiceRequest; +import com.amazonaws.handlers.AsyncHandler; + import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.integration.MessageTimeoutException; @@ -38,9 +41,6 @@ import org.springframework.messaging.MessageChannel; import org.springframework.messaging.support.ErrorMessage; import org.springframework.util.Assert; -import com.amazonaws.AmazonWebServiceRequest; -import com.amazonaws.handlers.AsyncHandler; - /** * The base {@link AbstractMessageProducingHandler} for AWS services. Utilizes common * logic ({@link AsyncHandler}, {@link ErrorMessageStrategy}, {@code failureChannel} etc.) diff --git a/src/main/java/org/springframework/integration/aws/outbound/KinesisMessageHandler.java b/src/main/java/org/springframework/integration/aws/outbound/KinesisMessageHandler.java index ef70d69..73e8479 100644 --- a/src/main/java/org/springframework/integration/aws/outbound/KinesisMessageHandler.java +++ b/src/main/java/org/springframework/integration/aws/outbound/KinesisMessageHandler.java @@ -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. @@ -19,6 +19,14 @@ package org.springframework.integration.aws.outbound; import java.nio.ByteBuffer; import java.util.concurrent.Future; +import com.amazonaws.AmazonWebServiceRequest; +import com.amazonaws.handlers.AsyncHandler; +import com.amazonaws.services.kinesis.AmazonKinesisAsync; +import com.amazonaws.services.kinesis.model.PutRecordRequest; +import com.amazonaws.services.kinesis.model.PutRecordResult; +import com.amazonaws.services.kinesis.model.PutRecordsRequest; +import com.amazonaws.services.kinesis.model.PutRecordsResult; + import org.springframework.core.convert.converter.Converter; import org.springframework.core.serializer.support.SerializingConverter; import org.springframework.expression.Expression; @@ -36,14 +44,6 @@ import org.springframework.messaging.converter.MessageConverter; import org.springframework.util.Assert; import org.springframework.util.StringUtils; -import com.amazonaws.AmazonWebServiceRequest; -import com.amazonaws.handlers.AsyncHandler; -import com.amazonaws.services.kinesis.AmazonKinesisAsync; -import com.amazonaws.services.kinesis.model.PutRecordRequest; -import com.amazonaws.services.kinesis.model.PutRecordResult; -import com.amazonaws.services.kinesis.model.PutRecordsRequest; -import com.amazonaws.services.kinesis.model.PutRecordsResult; - /** * The {@link AbstractMessageHandler} implementation for the Amazon Kinesis * {@code putRecord(s)}. diff --git a/src/main/java/org/springframework/integration/aws/outbound/KplMessageHandler.java b/src/main/java/org/springframework/integration/aws/outbound/KplMessageHandler.java index 47c39b1..052f666 100644 --- a/src/main/java/org/springframework/integration/aws/outbound/KplMessageHandler.java +++ b/src/main/java/org/springframework/integration/aws/outbound/KplMessageHandler.java @@ -23,26 +23,6 @@ import java.util.concurrent.Future; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.atomic.AtomicInteger; -import org.springframework.context.Lifecycle; -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.serializer.support.SerializingConverter; -import org.springframework.expression.Expression; -import org.springframework.expression.common.LiteralExpression; -import org.springframework.integration.aws.support.AwsHeaders; -import org.springframework.integration.aws.support.AwsRequestFailureException; -import org.springframework.integration.expression.ValueExpression; -import org.springframework.integration.handler.AbstractMessageHandler; -import org.springframework.integration.mapping.HeaderMapper; -import org.springframework.integration.mapping.OutboundMessageMapper; -import org.springframework.integration.support.AbstractIntegrationMessageBuilder; -import org.springframework.integration.support.MutableMessage; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageHeaders; -import org.springframework.messaging.converter.MessageConversionException; -import org.springframework.messaging.converter.MessageConverter; -import org.springframework.util.Assert; -import org.springframework.util.StringUtils; - import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.handlers.AsyncHandler; import com.amazonaws.services.kinesis.AmazonKinesisAsync; @@ -63,6 +43,26 @@ import com.google.common.util.concurrent.SettableFuture; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import org.springframework.context.Lifecycle; +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.serializer.support.SerializingConverter; +import org.springframework.expression.Expression; +import org.springframework.expression.common.LiteralExpression; +import org.springframework.integration.aws.support.AwsHeaders; +import org.springframework.integration.aws.support.AwsRequestFailureException; +import org.springframework.integration.expression.ValueExpression; +import org.springframework.integration.handler.AbstractMessageHandler; +import org.springframework.integration.mapping.HeaderMapper; +import org.springframework.integration.mapping.OutboundMessageMapper; +import org.springframework.integration.support.AbstractIntegrationMessageBuilder; +import org.springframework.integration.support.MutableMessage; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageHeaders; +import org.springframework.messaging.converter.MessageConversionException; +import org.springframework.messaging.converter.MessageConverter; +import org.springframework.util.Assert; +import org.springframework.util.StringUtils; + /** * The {@link AbstractMessageHandler} implementation for the Amazon Kinesis Producer * Library {@code putRecord(s)}. diff --git a/src/main/java/org/springframework/integration/aws/outbound/S3MessageHandler.java b/src/main/java/org/springframework/integration/aws/outbound/S3MessageHandler.java index 4eed3bf..619c483 100644 --- a/src/main/java/org/springframework/integration/aws/outbound/S3MessageHandler.java +++ b/src/main/java/org/springframework/integration/aws/outbound/S3MessageHandler.java @@ -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. @@ -21,19 +21,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import org.springframework.expression.EvaluationContext; -import org.springframework.expression.Expression; -import org.springframework.expression.common.LiteralExpression; -import org.springframework.integration.expression.ExpressionUtils; -import org.springframework.integration.expression.ValueExpression; -import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; -import org.springframework.messaging.Message; -import org.springframework.messaging.MessageHandlingException; -import org.springframework.messaging.MessageHeaders; -import org.springframework.messaging.support.MessageBuilder; -import org.springframework.util.Assert; -import org.springframework.util.DigestUtils; - import com.amazonaws.AmazonClientException; import com.amazonaws.event.ProgressEvent; import com.amazonaws.event.ProgressEventType; @@ -57,6 +44,19 @@ import com.amazonaws.util.Base64; import com.amazonaws.util.Md5Utils; import io.awspring.cloud.core.env.ResourceIdResolver; +import org.springframework.expression.EvaluationContext; +import org.springframework.expression.Expression; +import org.springframework.expression.common.LiteralExpression; +import org.springframework.integration.expression.ExpressionUtils; +import org.springframework.integration.expression.ValueExpression; +import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageHandlingException; +import org.springframework.messaging.MessageHeaders; +import org.springframework.messaging.support.MessageBuilder; +import org.springframework.util.Assert; +import org.springframework.util.DigestUtils; + /** * The {@link AbstractReplyProducingMessageHandler} implementation for the Amazon S3 * services. diff --git a/src/main/java/org/springframework/integration/aws/outbound/SnsMessageHandler.java b/src/main/java/org/springframework/integration/aws/outbound/SnsMessageHandler.java index 07bc4d5..a8c8b49 100644 --- a/src/main/java/org/springframework/integration/aws/outbound/SnsMessageHandler.java +++ b/src/main/java/org/springframework/integration/aws/outbound/SnsMessageHandler.java @@ -20,6 +20,14 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.Future; +import com.amazonaws.AmazonWebServiceRequest; +import com.amazonaws.handlers.AsyncHandler; +import com.amazonaws.services.sns.AmazonSNSAsync; +import com.amazonaws.services.sns.model.MessageAttributeValue; +import com.amazonaws.services.sns.model.PublishRequest; +import com.amazonaws.services.sns.model.PublishResult; +import io.awspring.cloud.core.env.ResourceIdResolver; + import org.springframework.core.log.LogMessage; import org.springframework.expression.Expression; import org.springframework.expression.TypeLocator; @@ -33,14 +41,6 @@ import org.springframework.integration.support.AbstractIntegrationMessageBuilder import org.springframework.messaging.Message; import org.springframework.util.Assert; -import com.amazonaws.AmazonWebServiceRequest; -import com.amazonaws.handlers.AsyncHandler; -import com.amazonaws.services.sns.AmazonSNSAsync; -import com.amazonaws.services.sns.model.MessageAttributeValue; -import com.amazonaws.services.sns.model.PublishRequest; -import com.amazonaws.services.sns.model.PublishResult; -import io.awspring.cloud.core.env.ResourceIdResolver; - /** * The {@link AbstractAwsMessageHandler} implementation to send SNS Notifications * ({@link AmazonSNSAsync#publishAsync(PublishRequest)}) to the provided {@code topicArn} diff --git a/src/main/java/org/springframework/integration/aws/outbound/SqsMessageHandler.java b/src/main/java/org/springframework/integration/aws/outbound/SqsMessageHandler.java index b24ee05..4d34872 100644 --- a/src/main/java/org/springframework/integration/aws/outbound/SqsMessageHandler.java +++ b/src/main/java/org/springframework/integration/aws/outbound/SqsMessageHandler.java @@ -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. @@ -20,6 +20,17 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.Future; +import com.amazonaws.AmazonWebServiceRequest; +import com.amazonaws.handlers.AsyncHandler; +import com.amazonaws.services.sqs.AmazonSQSAsync; +import com.amazonaws.services.sqs.model.MessageAttributeValue; +import com.amazonaws.services.sqs.model.SendMessageBatchRequest; +import com.amazonaws.services.sqs.model.SendMessageBatchResult; +import com.amazonaws.services.sqs.model.SendMessageRequest; +import com.amazonaws.services.sqs.model.SendMessageResult; +import io.awspring.cloud.core.env.ResourceIdResolver; +import io.awspring.cloud.messaging.support.destination.DynamicQueueUrlDestinationResolver; + import org.springframework.expression.Expression; import org.springframework.expression.common.LiteralExpression; import org.springframework.integration.aws.support.AwsHeaders; @@ -35,17 +46,6 @@ import org.springframework.messaging.core.DestinationResolver; import org.springframework.util.Assert; import org.springframework.util.StringUtils; -import com.amazonaws.AmazonWebServiceRequest; -import com.amazonaws.handlers.AsyncHandler; -import com.amazonaws.services.sqs.AmazonSQSAsync; -import com.amazonaws.services.sqs.model.MessageAttributeValue; -import com.amazonaws.services.sqs.model.SendMessageBatchRequest; -import com.amazonaws.services.sqs.model.SendMessageBatchResult; -import com.amazonaws.services.sqs.model.SendMessageRequest; -import com.amazonaws.services.sqs.model.SendMessageResult; -import io.awspring.cloud.core.env.ResourceIdResolver; -import io.awspring.cloud.messaging.support.destination.DynamicQueueUrlDestinationResolver; - /** * The {@link AbstractMessageHandler} implementation for the Amazon SQS * {@code sendMessage}. diff --git a/src/main/java/org/springframework/integration/aws/support/AbstractMessageAttributesHeaderMapper.java b/src/main/java/org/springframework/integration/aws/support/AbstractMessageAttributesHeaderMapper.java index f0bc1a8..defaf46 100644 --- a/src/main/java/org/springframework/integration/aws/support/AbstractMessageAttributesHeaderMapper.java +++ b/src/main/java/org/springframework/integration/aws/support/AbstractMessageAttributesHeaderMapper.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Map; import java.util.UUID; +import io.awspring.cloud.messaging.core.MessageAttributeDataTypes; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,12 +33,10 @@ import org.springframework.util.Assert; import org.springframework.util.MimeType; import org.springframework.util.NumberUtils; -import io.awspring.cloud.messaging.core.MessageAttributeDataTypes; - /** * Base {@link HeaderMapper} implementation for common logic in SQS and SNS around message * attributes mapping. - * + *

* The {@link #toHeaders(Map)} is not supported. * * @param the target message attribute type. @@ -68,7 +67,7 @@ public abstract class AbstractMessageAttributesHeaderMapper implements Header * {@code \} symbol in the pattern definition. Defaults to map all ({@code *}) if the * type is supported by SQS. The {@link MessageHeaders#ID}, * {@link MessageHeaders#TIMESTAMP}, - * {@link NativeMessageHeaderAccessor.NATIVE_HEADERS}, + * {@link NativeMessageHeaderAccessor#NATIVE_HEADERS}, * {@link AwsHeaders#MESSAGE_ID}, {@link AwsHeaders#QUEUE}, and * {@link AwsHeaders#TOPIC} are ignored by default. * @param outboundHeaderNames The inbound header names. diff --git a/src/main/java/org/springframework/integration/aws/support/AwsRequestFailureException.java b/src/main/java/org/springframework/integration/aws/support/AwsRequestFailureException.java index 7f594f9..e0fde1f 100644 --- a/src/main/java/org/springframework/integration/aws/support/AwsRequestFailureException.java +++ b/src/main/java/org/springframework/integration/aws/support/AwsRequestFailureException.java @@ -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. @@ -16,11 +16,11 @@ package org.springframework.integration.aws.support; +import com.amazonaws.AmazonWebServiceRequest; + import org.springframework.messaging.Message; import org.springframework.messaging.MessagingException; -import com.amazonaws.AmazonWebServiceRequest; - /** * An exception that is the payload of an {@code ErrorMessage} when a send fails. * diff --git a/src/main/java/org/springframework/integration/aws/support/S3FileInfo.java b/src/main/java/org/springframework/integration/aws/support/S3FileInfo.java index 6dd64a0..e8012ec 100644 --- a/src/main/java/org/springframework/integration/aws/support/S3FileInfo.java +++ b/src/main/java/org/springframework/integration/aws/support/S3FileInfo.java @@ -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. @@ -18,11 +18,11 @@ package org.springframework.integration.aws.support; import java.util.Date; +import com.amazonaws.services.s3.model.S3ObjectSummary; + import org.springframework.integration.file.remote.AbstractFileInfo; import org.springframework.util.Assert; -import com.amazonaws.services.s3.model.S3ObjectSummary; - /** * An Amazon S3 {@link org.springframework.integration.file.remote.FileInfo} * implementation. diff --git a/src/main/java/org/springframework/integration/aws/support/S3RemoteFileTemplate.java b/src/main/java/org/springframework/integration/aws/support/S3RemoteFileTemplate.java index 82a74c5..ebdcb5f 100644 --- a/src/main/java/org/springframework/integration/aws/support/S3RemoteFileTemplate.java +++ b/src/main/java/org/springframework/integration/aws/support/S3RemoteFileTemplate.java @@ -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. @@ -18,14 +18,14 @@ package org.springframework.integration.aws.support; import java.io.IOException; -import org.springframework.integration.file.remote.ClientCallback; -import org.springframework.integration.file.remote.RemoteFileTemplate; -import org.springframework.integration.file.remote.session.SessionFactory; - import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.model.AmazonS3Exception; import com.amazonaws.services.s3.model.S3ObjectSummary; +import org.springframework.integration.file.remote.ClientCallback; +import org.springframework.integration.file.remote.RemoteFileTemplate; +import org.springframework.integration.file.remote.session.SessionFactory; + /** * An Amazon S3 specific {@link RemoteFileTemplate} extension. * diff --git a/src/main/java/org/springframework/integration/aws/support/S3Session.java b/src/main/java/org/springframework/integration/aws/support/S3Session.java index d8bffed..42a74bd 100644 --- a/src/main/java/org/springframework/integration/aws/support/S3Session.java +++ b/src/main/java/org/springframework/integration/aws/support/S3Session.java @@ -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. @@ -22,13 +22,6 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; -import org.apache.http.HttpStatus; - -import org.springframework.integration.file.remote.session.Session; -import org.springframework.util.Assert; -import org.springframework.util.StreamUtils; -import org.springframework.util.StringUtils; - import com.amazonaws.regions.Region; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.model.AmazonS3Exception; @@ -40,6 +33,12 @@ import com.amazonaws.services.s3.model.S3Object; import com.amazonaws.services.s3.model.S3ObjectInputStream; import com.amazonaws.services.s3.model.S3ObjectSummary; import io.awspring.cloud.core.env.ResourceIdResolver; +import org.apache.http.HttpStatus; + +import org.springframework.integration.file.remote.session.Session; +import org.springframework.util.Assert; +import org.springframework.util.StreamUtils; +import org.springframework.util.StringUtils; /** * An Amazon S3 {@link Session} implementation. diff --git a/src/main/java/org/springframework/integration/aws/support/S3SessionFactory.java b/src/main/java/org/springframework/integration/aws/support/S3SessionFactory.java index 0a5c17b..9a2b9a6 100644 --- a/src/main/java/org/springframework/integration/aws/support/S3SessionFactory.java +++ b/src/main/java/org/springframework/integration/aws/support/S3SessionFactory.java @@ -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. @@ -16,15 +16,15 @@ package org.springframework.integration.aws.support; -import org.springframework.integration.file.remote.session.SessionFactory; -import org.springframework.integration.file.remote.session.SharedSessionCapable; -import org.springframework.util.Assert; - import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.S3ObjectSummary; import io.awspring.cloud.core.env.ResourceIdResolver; +import org.springframework.integration.file.remote.session.SessionFactory; +import org.springframework.integration.file.remote.session.SharedSessionCapable; +import org.springframework.util.Assert; + /** * An Amazon S3 specific {@link SessionFactory} implementation. Also this class implements * {@link SharedSessionCapable} around the single instance, since the {@link S3Session} is diff --git a/src/main/java/org/springframework/integration/aws/support/SqsHeaderMapper.java b/src/main/java/org/springframework/integration/aws/support/SqsHeaderMapper.java index 37a3458..cda8308 100644 --- a/src/main/java/org/springframework/integration/aws/support/SqsHeaderMapper.java +++ b/src/main/java/org/springframework/integration/aws/support/SqsHeaderMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2021 the original author or authors. + * Copyright 2018-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. @@ -18,10 +18,10 @@ package org.springframework.integration.aws.support; import java.nio.ByteBuffer; -import org.springframework.messaging.MessageHeaders; - import com.amazonaws.services.sqs.model.MessageAttributeValue; +import org.springframework.messaging.MessageHeaders; + /** * The {@link AbstractMessageAttributesHeaderMapper} implementation for the mapping from * headers to SQS message attributes. diff --git a/src/main/java/org/springframework/integration/aws/support/filters/S3PersistentAcceptOnceFileListFilter.java b/src/main/java/org/springframework/integration/aws/support/filters/S3PersistentAcceptOnceFileListFilter.java index 63f1cc4..0151891 100644 --- a/src/main/java/org/springframework/integration/aws/support/filters/S3PersistentAcceptOnceFileListFilter.java +++ b/src/main/java/org/springframework/integration/aws/support/filters/S3PersistentAcceptOnceFileListFilter.java @@ -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. @@ -16,11 +16,11 @@ package org.springframework.integration.aws.support.filters; +import com.amazonaws.services.s3.model.S3ObjectSummary; + import org.springframework.integration.file.filters.AbstractPersistentAcceptOnceFileListFilter; import org.springframework.integration.metadata.ConcurrentMetadataStore; -import com.amazonaws.services.s3.model.S3ObjectSummary; - /** * Persistent file list filter using the server's file timestamp to detect if we've * already 'seen' this file. diff --git a/src/main/java/org/springframework/integration/aws/support/filters/S3RegexPatternFileListFilter.java b/src/main/java/org/springframework/integration/aws/support/filters/S3RegexPatternFileListFilter.java index 65c9815..7cda383 100644 --- a/src/main/java/org/springframework/integration/aws/support/filters/S3RegexPatternFileListFilter.java +++ b/src/main/java/org/springframework/integration/aws/support/filters/S3RegexPatternFileListFilter.java @@ -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. @@ -18,10 +18,10 @@ package org.springframework.integration.aws.support.filters; import java.util.regex.Pattern; -import org.springframework.integration.file.filters.AbstractRegexPatternFileListFilter; - import com.amazonaws.services.s3.model.S3ObjectSummary; +import org.springframework.integration.file.filters.AbstractRegexPatternFileListFilter; + /** * Implementation of {@link AbstractRegexPatternFileListFilter} for Amazon S3. * diff --git a/src/main/java/org/springframework/integration/aws/support/filters/S3SimplePatternFileListFilter.java b/src/main/java/org/springframework/integration/aws/support/filters/S3SimplePatternFileListFilter.java index e2548e1..27366a9 100644 --- a/src/main/java/org/springframework/integration/aws/support/filters/S3SimplePatternFileListFilter.java +++ b/src/main/java/org/springframework/integration/aws/support/filters/S3SimplePatternFileListFilter.java @@ -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. @@ -16,10 +16,10 @@ package org.springframework.integration.aws.support.filters; -import org.springframework.integration.file.filters.AbstractSimplePatternFileListFilter; - import com.amazonaws.services.s3.model.S3ObjectSummary; +import org.springframework.integration.file.filters.AbstractSimplePatternFileListFilter; + /** * Implementation of {@link AbstractSimplePatternFileListFilter} for Amazon S3. * diff --git a/src/test/java/org/springframework/integration/aws/LocalstackContainerTest.java b/src/test/java/org/springframework/integration/aws/LocalstackContainerTest.java index ac1c20e..788f746 100644 --- a/src/test/java/org/springframework/integration/aws/LocalstackContainerTest.java +++ b/src/test/java/org/springframework/integration/aws/LocalstackContainerTest.java @@ -16,11 +16,6 @@ package org.springframework.integration.aws; -import org.junit.jupiter.api.BeforeAll; -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; @@ -31,6 +26,10 @@ import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsync; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsyncClientBuilder; import com.amazonaws.services.kinesis.AmazonKinesisAsync; import com.amazonaws.services.kinesis.AmazonKinesisAsyncClientBuilder; +import org.junit.jupiter.api.BeforeAll; +import org.testcontainers.containers.localstack.LocalStackContainer; +import org.testcontainers.junit.jupiter.Testcontainers; +import org.testcontainers.utility.DockerImageName; /** * The base contract for JUnit tests based on the container for Localstack. diff --git a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests-context.xml b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests-context.xml index 84824a0..5cb8d62 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests-context.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests-context.xml @@ -8,7 +8,7 @@ http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd"> - + @@ -16,7 +16,7 @@ - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests.java b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests.java index 1949200..8fb3d5e 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests.java +++ b/src/test/java/org/springframework/integration/aws/config/xml/S3InboundChannelAdapterParserTests.java @@ -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. @@ -16,8 +16,6 @@ package org.springframework.integration.aws.config.xml; -import static org.assertj.core.api.Assertions.assertThat; - import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; @@ -50,6 +48,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.ReflectionUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Artem Bilan */ diff --git a/src/test/java/org/springframework/integration/aws/config/xml/S3MessageHandlerParserTests-context.xml b/src/test/java/org/springframework/integration/aws/config/xml/S3MessageHandlerParserTests-context.xml index 4ba2d40..f57f05a 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/S3MessageHandlerParserTests-context.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/S3MessageHandlerParserTests-context.xml @@ -6,19 +6,21 @@ http://www.springframework.org/schema/integration/aws https://www.springframework.org/schema/integration/aws/spring-integration-aws.xsd"> - + - + - + - + - + @@ -16,7 +16,7 @@ - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/S3StreamingInboundChannelAdapterParserTests.java b/src/test/java/org/springframework/integration/aws/config/xml/S3StreamingInboundChannelAdapterParserTests.java index 593a9ef..9d2be22 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/S3StreamingInboundChannelAdapterParserTests.java +++ b/src/test/java/org/springframework/integration/aws/config/xml/S3StreamingInboundChannelAdapterParserTests.java @@ -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. @@ -16,8 +16,6 @@ package org.springframework.integration.aws.config.xml; -import static org.assertj.core.api.Assertions.assertThat; - import java.lang.reflect.Method; import java.util.Comparator; import java.util.concurrent.atomic.AtomicReference; @@ -37,6 +35,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.ReflectionUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Christian Tzolov * @author Artem Bilan diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SnsInboundChannelAdapterParserTests-context.xml b/src/test/java/org/springframework/integration/aws/config/xml/SnsInboundChannelAdapterParserTests-context.xml index 450936d..c2f87a6 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SnsInboundChannelAdapterParserTests-context.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/SnsInboundChannelAdapterParserTests-context.xml @@ -6,7 +6,7 @@ http://www.springframework.org/schema/integration/aws https://www.springframework.org/schema/integration/aws/spring-integration-aws.xsd"> - + - + - + - + - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SnsOutboundChannelAdapterParserTests.java b/src/test/java/org/springframework/integration/aws/config/xml/SnsOutboundChannelAdapterParserTests.java index 94bffc3..3693451 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SnsOutboundChannelAdapterParserTests.java +++ b/src/test/java/org/springframework/integration/aws/config/xml/SnsOutboundChannelAdapterParserTests.java @@ -16,8 +16,9 @@ package org.springframework.integration.aws.config.xml; -import static org.assertj.core.api.Assertions.assertThat; - +import com.amazonaws.handlers.AsyncHandler; +import com.amazonaws.services.sns.AmazonSNSAsync; +import io.awspring.cloud.core.env.ResourceIdResolver; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -30,9 +31,7 @@ import org.springframework.messaging.MessageHandler; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import com.amazonaws.handlers.AsyncHandler; -import com.amazonaws.services.sns.AmazonSNSAsync; -import io.awspring.cloud.core.env.ResourceIdResolver; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Artem Bilan diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageDrivenChannelAdapterParserTests-context.xml b/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageDrivenChannelAdapterParserTests-context.xml index 51815aa..1ccff6d 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageDrivenChannelAdapterParserTests-context.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageDrivenChannelAdapterParserTests-context.xml @@ -2,21 +2,19 @@ + http://www.springframework.org/schema/integration/aws https://www.springframework.org/schema/integration/aws/spring-integration-aws.xsd"> - + - + - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageDrivenChannelAdapterParserTests.java b/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageDrivenChannelAdapterParserTests.java index 2a056d9..c058650 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageDrivenChannelAdapterParserTests.java +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageDrivenChannelAdapterParserTests.java @@ -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. @@ -16,10 +16,12 @@ package org.springframework.integration.aws.config.xml; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.BDDMockito.any; -import static org.mockito.BDDMockito.given; - +import com.amazonaws.services.sqs.AmazonSQS; +import com.amazonaws.services.sqs.AmazonSQSAsync; +import com.amazonaws.services.sqs.model.GetQueueAttributesResult; +import io.awspring.cloud.core.env.ResourceIdResolver; +import io.awspring.cloud.messaging.listener.SimpleMessageListenerContainer; +import io.awspring.cloud.messaging.listener.SqsMessageDeletionPolicy; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -34,12 +36,9 @@ import org.springframework.messaging.core.DestinationResolver; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import com.amazonaws.services.sqs.AmazonSQS; -import com.amazonaws.services.sqs.AmazonSQSAsync; -import com.amazonaws.services.sqs.model.GetQueueAttributesResult; -import io.awspring.cloud.core.env.ResourceIdResolver; -import io.awspring.cloud.messaging.listener.SimpleMessageListenerContainer; -import io.awspring.cloud.messaging.listener.SqsMessageDeletionPolicy; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.any; +import static org.mockito.BDDMockito.given; /** * @author Artem Bilan diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageHandlerParserTests-context.xml b/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageHandlerParserTests-context.xml index f93c865..f43c5a7 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageHandlerParserTests-context.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageHandlerParserTests-context.xml @@ -12,19 +12,19 @@ - + - + - + - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageHandlerParserTests.java b/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageHandlerParserTests.java index cbf2a2a..0fdeecb 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageHandlerParserTests.java +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsMessageHandlerParserTests.java @@ -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. @@ -16,8 +16,9 @@ package org.springframework.integration.aws.config.xml; -import static org.assertj.core.api.Assertions.assertThat; - +import com.amazonaws.handlers.AsyncHandler; +import com.amazonaws.services.sqs.AmazonSQS; +import io.awspring.cloud.core.env.ResourceIdResolver; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -31,9 +32,7 @@ import org.springframework.messaging.converter.MessageConverter; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import com.amazonaws.handlers.AsyncHandler; -import com.amazonaws.services.sqs.AmazonSQS; -import io.awspring.cloud.core.env.ResourceIdResolver; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Artem Bilan diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad.xml b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad.xml index c9e212c..2b29b00 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad.xml @@ -10,7 +10,7 @@ - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad2.xml b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad2.xml index 29a3428..08c3e17 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad2.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad2.xml @@ -10,7 +10,7 @@ - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad3.xml b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad3.xml index 0bae6fb..5de0f55 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad3.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad3.xml @@ -10,7 +10,7 @@ - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad4.xml b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad4.xml index de0720f..5a51549 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad4.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-bad4.xml @@ -10,7 +10,7 @@ - + diff --git a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-good.xml b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-good.xml index 45d6b1b..af2e26e 100644 --- a/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-good.xml +++ b/src/test/java/org/springframework/integration/aws/config/xml/SqsOutboundChannelAdapterParserTests-context-good.xml @@ -10,7 +10,7 @@ - +