diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c1de3dab..36c664548 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: name: "Test with ${{ matrix.version }}" strategy: matrix: - version: [ 8.0.312-tem, 11.0.13-tem, 17.0.1-tem ] + version: [ 8.0.312-tem, 11.0.13-tem ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -34,3 +34,30 @@ jobs: jdkFile: ${{ steps.sdkman.outputs.file }} - name: Build with Maven run: ./mvnw -V -B verify + build-java-17: + name: "Test with ${{ matrix.version }}" + strategy: + matrix: + version: [ 17.0.1-tem ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + - name: Download ${{ matrix.version }} + uses: sdkman/sdkman-action@master + id: sdkman + with: + candidate: java + version: ${{ matrix.version }} + - name: Set up ${{ matrix.version }} + uses: actions/setup-java@v1 + with: + java-version: 8 + jdkFile: ${{ steps.sdkman.outputs.file }} + - name: Build with Maven + run: ./mvnw -V -B verify -Dspotless.check.skip=true -Dspotless.apply.skip=true diff --git a/.mvn/jvm.config b/.mvn/jvm.config index 0e7dabeff..23acc6ad8 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -1 +1 @@ --Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom \ No newline at end of file +-Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom diff --git a/.settings.xml b/.settings.xml index c5dc6b58d..a729ede1b 100644 --- a/.settings.xml +++ b/.settings.xml @@ -70,7 +70,4 @@ - - io.spring.javaformat - diff --git a/.springformat b/.springformat deleted file mode 100644 index e69de29bb..000000000 diff --git a/Makefile b/Makefile index 5b4251157..64571e9bb 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ -.PHONY: format build +.PHONY: format build docs format: - mvnd spring-javaformat:apply + mvnd spotless:apply build: - mvnd spring-javaformat:apply verify + mvnd spotless:apply verify clean: mvnd clean + +docs: + mvnd verify -Pdocs -DskipTests=true diff --git a/README.adoc b/README.adoc index b76dd85b6..732e586df 100644 --- a/README.adoc +++ b/README.adoc @@ -48,299 +48,3 @@ Or reach out directly to individual team members: * Maciej Walkowiak https://twitter.com/maciejwalkowiak[Twitter] * Eddú Meléndez https://twitter.com/EdduMelendez[Twitter] * Matej Nedic https://twitter.com/MatejNedic1[Twitter] - -= Using IntelliJ IDEA - -Spring Cloud AWS development is done with -https://www.jetbrains.com/idea/[IntelliJ IDEA]. In order to create all -https://www.jetbrains.com/idea/[IntelliJ IDEA] project files, you have to -import the file within idea as a maven project. - -_Note:_ Please make sure to revert all changes in the .idea config file -directory, as the maven plugin overwrites the configuration files kept -in the scm. - -= Running integration tests - -Spring Cloud AWS contains a test-suite which runs integration tests to -ensure compatibility with the Amazon Web Services. In order to run the -integration tests, the build process has to create different resources -on the Amazon Webservice platform (Amazon EC2 instances, Amazon RDS -instances, Amazon S3 Buckets, Amazon SQS Queues). Creating these -resources takes time and costs money, because every instance creation is -charged with a one hour usage. Therefore Spring Cloud AWS does not -execute the integration tests by default. - -In order to run integration tests you must prepare three properties named accessKey, secretKey and rdsPassword. These two -properties accessKey and secretKey are account/user specific and should -never be shared to anyone. To retrieve these settings you have to open -your account inside the AWS console and retrieve them through the -https://portal.aws.amazon.com/gp/aws/securityCredentials[Security -Credentials Page]. _Note:_ In general we recommend that you use an -https://aws.amazon.com/iam/[Amazon IAM] user instead of the account -itself. The last password rdsPassword is used to access the database -inside the integration tests. This password has a minimum length of 8 -characters. - -Also you must prepare the sender and recipient mail addresses to test the -https://aws.amazon.com/ses/[Amazon Simple E-Mail Service]. These two -addresses must be verified for the Amazon SES Service. - -To build with the integration tests you must execute - ------------------------------------------------------------------------------------------------------ -mvn verify -Daws-integration-tests.access-key= -Daws-integration-tests.secret-key= -DrdsPassword= -DsenderAddress= -DrecipientAddress= ------------------------------------------------------------------------------------------------------ - -The integration test will create an -https://aws.amazon.com/de/cloudformation/[Amazon Web Services -CloudFormation] stack and execute the tests. The stack is destroyed -after executing the tests (either successful or failed) to ensure that -there are no unnecessary costs. - -= Costs of integration tests - -The costs for one integration test run should not be more than 0.40 $ -per hour (excl. VAT). - -= Developing using Amazon Web Services - -During the development, it might be time-consuming to run the integration -tests regularly. In order to create a stack only once, and reuse them -for the tests run, you have to create the stack manually using the -template found in /spring-cloud-aws-integration-test/src/test/resources. -You will need to create the stack with the name "IntegrationTestStack" -to ensure that the integration tests will re-use the stack. - -== Contributing - -:spring-cloud-build-branch: master - -Spring Cloud is released under the non-restrictive Apache 2.0 license, -and follows a very standard Github development process, using Github -tracker for issues and merging pull requests into master. If you want -to contribute even something trivial please do not hesitate, but -follow the guidelines below. - -=== Sign the Contributor License Agreement -Before we accept a non-trivial patch or pull request we will need you to sign the -https://cla.pivotal.io/sign/spring[Contributor License Agreement]. -Signing the contributor's agreement does not grant anyone commit rights to the main -repository, but it does mean that we can accept your contributions, and you will get an -author credit if we do. Active contributors might be asked to join the core team, and -given the ability to merge pull requests. - -=== Code of Conduct -This project adheres to the Contributor Covenant https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc[code of -conduct]. By participating, you are expected to uphold this code. Please report -unacceptable behavior to spring-code-of-conduct@pivotal.io. - -=== Code Conventions and Housekeeping -None of these is essential for a pull request, but they will all help. They can also be -added after the original pull request but before a merge. - -* Use the Spring Framework code format conventions. If you use Eclipse - you can import formatter settings using the - `eclipse-code-formatter.xml` file from the - https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring - Cloud Build] project. If using IntelliJ, you can use the - https://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter - Plugin] to import the same file. -* Make sure all new `.java` files to have a simple Javadoc class comment with at least an - `@author` tag identifying you, and preferably at least a paragraph on what the class is - for. -* Add the ASF license header comment to all new `.java` files (copy from existing files - in the project) -* Add yourself as an `@author` to the .java files that you modify substantially (more - than cosmetic changes). -* Add some Javadocs and, if you change the namespace, some XSD doc elements. -* A few unit tests would help a lot as well -- someone has to do it. -* If no-one else is using your branch, please rebase it against the current master (or - other target branch in the main project). -* When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], - if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit - message (where XXXX is the issue number). - -=== Checkstyle - -Spring Cloud Build comes with a set of checkstyle rules. You can find them in the `spring-cloud-build-tools` module. The most notable files under the module are: - -.spring-cloud-build-tools/ ----- -└── src -    ├── checkstyle -    │   └── checkstyle-suppressions.xml <3> -    └── main -    └── resources -    ├── checkstyle-header.txt <2> -    └── checkstyle.xml <1> ----- -<1> Default Checkstyle rules -<2> File header setup -<3> Default suppression rules - -==== Checkstyle configuration - -Checkstyle rules are *disabled by default*. To add checkstyle to your project just define the following properties and plugins. - -.pom.xml ----- - -true <1> - true - <2> - true - <3> - - - - - <4> - io.spring.javaformat - spring-javaformat-maven-plugin - - <5> - org.apache.maven.plugins - maven-checkstyle-plugin - - - - - - <5> - org.apache.maven.plugins - maven-checkstyle-plugin - - - - ----- -<1> Fails the build upon Checkstyle errors -<2> Fails the build upon Checkstyle violations -<3> Checkstyle analyzes also the test sources -<4> Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules -<5> Add checkstyle plugin to your build and reporting phases - -If you need to suppress some rules (e.g. line length needs to be longer), then it's enough for you to define a file under `${project.root}/src/checkstyle/checkstyle-suppressions.xml` with your suppressions. Example: - -.projectRoot/src/checkstyle/checkstyle-suppresions.xml ----- - - - - - - ----- - -It's advisable to copy the `${spring-cloud-build.rootFolder}/.editorconfig` and `${spring-cloud-build.rootFolder}/.springformat` to your project. That way, some default formatting rules will be applied. You can do so by running this script: - -```bash -$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/.editorconfig -o .editorconfig -$ touch .springformat -``` - -=== IDE setup - -==== Intellij IDEA - -In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. -The following files can be found in the https://github.com/spring-cloud/spring-cloud-build/tree/master/spring-cloud-build-tools[Spring Cloud Build] project. - -.spring-cloud-build-tools/ ----- -└── src -    ├── checkstyle -    │   └── checkstyle-suppressions.xml <3> -    └── main -    └── resources -    ├── checkstyle-header.txt <2> -    ├── checkstyle.xml <1> -    └── intellij -       ├── Intellij_Project_Defaults.xml <4> -       └── Intellij_Spring_Boot_Java_Conventions.xml <5> ----- -<1> Default Checkstyle rules -<2> File header setup -<3> Default suppression rules -<4> Project defaults for Intellij that apply most of Checkstyle rules -<5> Project style conventions for Intellij that apply most of Checkstyle rules - -.Code style - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-code-style.png[Code style] - -Go to `File` -> `Settings` -> `Editor` -> `Code style`. There click on the icon next to the `Scheme` section. There, click on the `Import Scheme` value and pick the `Intellij IDEA code style XML` option. Import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml` file. - -.Inspection profiles - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-inspections.png[Code style] - -Go to `File` -> `Settings` -> `Editor` -> `Inspections`. There click on the icon next to the `Profile` section. There, click on the `Import Profile` and import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml` file. - -.Checkstyle - -To have Intellij work with Checkstyle, you have to install the `Checkstyle` plugin. It's advisable to also install the `Assertions2Assertj` to automatically convert the JUnit assertions - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-checkstyle.png[Checkstyle] - -Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on the `+` icon in the `Configuration file` section. There, you'll have to define where the checkstyle rules should be picked from. In the image above, we've picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build's GitHub repository (e.g. for the `checkstyle.xml` : `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml`). We need to provide the following variables: - -- `checkstyle.header.file` - please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` URL. -- `checkstyle.suppressions.file` - default suppressions. Please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` URL. -- `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`. - -IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources. - -=== Duplicate Finder - -Spring Cloud Build brings along the `basepom:duplicate-finder-maven-plugin`, that enables flagging duplicate and conflicting classes and resources on the java classpath. - -==== Duplicate Finder configuration - -Duplicate finder is *enabled by default* and will run in the `verify` phase of your Maven build, but it will only take effect in your project if you add the `duplicate-finder-maven-plugin` to the `build` section of the projecst's `pom.xml`. - -.pom.xml -[source,xml] ----- - - - - org.basepom.maven - duplicate-finder-maven-plugin - - - ----- - -For other properties, we have set defaults as listed in the https://github.com/basepom/duplicate-finder-maven-plugin/wiki[plugin documentation]. - -You can easily override them but setting the value of the selected property prefixed with `duplicate-finder-maven-plugin`. For example, set `duplicate-finder-maven-plugin.skip` to `true` in order to skip duplicates check in your build. - -If you need to add `ignoredClassPatterns` or `ignoredResourcePatterns` to your setup, make sure to add them in the plugin configuration section of your project: - -[source,xml] ----- - - - - org.basepom.maven - duplicate-finder-maven-plugin - - - org.joda.time.base.BaseDateTime - .*module-info - - - changelog.txt - - - - - - - ----- - diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index 18461c8a4..3a4fd48de 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -41,70 +41,3 @@ Or reach out directly to individual team members: * Maciej Walkowiak https://twitter.com/maciejwalkowiak[Twitter] * Eddú Meléndez https://twitter.com/EdduMelendez[Twitter] * Matej Nedic https://twitter.com/MatejNedic1[Twitter] - -= Using IntelliJ IDEA - -Spring Cloud AWS development is done with -https://www.jetbrains.com/idea/[IntelliJ IDEA]. In order to create all -https://www.jetbrains.com/idea/[IntelliJ IDEA] project files, you have to -import the file within idea as a maven project. - -_Note:_ Please make sure to revert all changes in the .idea config file -directory, as the maven plugin overwrites the configuration files kept -in the scm. - -= Running integration tests - -Spring Cloud AWS contains a test-suite which runs integration tests to -ensure compatibility with the Amazon Web Services. In order to run the -integration tests, the build process has to create different resources -on the Amazon Webservice platform (Amazon EC2 instances, Amazon RDS -instances, Amazon S3 Buckets, Amazon SQS Queues). Creating these -resources takes time and costs money, because every instance creation is -charged with a one hour usage. Therefore Spring Cloud AWS does not -execute the integration tests by default. - -In order to run integration tests you must prepare three properties named accessKey, secretKey and rdsPassword. These two -properties accessKey and secretKey are account/user specific and should -never be shared to anyone. To retrieve these settings you have to open -your account inside the AWS console and retrieve them through the -https://portal.aws.amazon.com/gp/aws/securityCredentials[Security -Credentials Page]. _Note:_ In general we recommend that you use an -https://aws.amazon.com/iam/[Amazon IAM] user instead of the account -itself. The last password rdsPassword is used to access the database -inside the integration tests. This password has a minimum length of 8 -characters. - -Also you must prepare the sender and recipient mail addresses to test the -https://aws.amazon.com/ses/[Amazon Simple E-Mail Service]. These two -addresses must be verified for the Amazon SES Service. - -To build with the integration tests you must execute - ------------------------------------------------------------------------------------------------------ -mvn verify -Daws-integration-tests.access-key= -Daws-integration-tests.secret-key= -DrdsPassword= -DsenderAddress= -DrecipientAddress= ------------------------------------------------------------------------------------------------------ - -The integration test will create an -https://aws.amazon.com/de/cloudformation/[Amazon Web Services -CloudFormation] stack and execute the tests. The stack is destroyed -after executing the tests (either successful or failed) to ensure that -there are no unnecessary costs. - -= Costs of integration tests - -The costs for one integration test run should not be more than 0.40 $ -per hour (excl. VAT). - -= Developing using Amazon Web Services - -During the development, it might be time-consuming to run the integration -tests regularly. In order to create a stack only once, and reuse them -for the tests run, you have to create the stack manually using the -template found in /spring-cloud-aws-integration-test/src/test/resources. -You will need to create the stack with the name "IntegrationTestStack" -to ensure that the integration tests will re-use the stack. - -== Contributing - -include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[] diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index ed01a2fb2..487b625ee 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -10,6 +10,15 @@ |spring.cloud.aws.region.instance-profile | `false` | Configures an instance profile region provider with no further configuration. |spring.cloud.aws.region.profile | | The AWS profile. |spring.cloud.aws.region.static | | +|spring.cloud.aws.s3.accelerate-mode-enabled | | Option to enable using the accelerate enedpoint when accessing S3. Accelerate endpoints allow faster transfer of objects by using Amazon CloudFront's globally distributed edge locations. +|spring.cloud.aws.s3.checksum-validation-enabled | | Option to disable doing a validation of the checksum of an object stored in S3. +|spring.cloud.aws.s3.chunked-encoding-enabled | | Option to enable using chunked encoding when signing the request payload for {@link software.amazon.awssdk.services.s3.model.PutObjectRequest} and {@link software.amazon.awssdk.services.s3.model.UploadPartRequest}. +|spring.cloud.aws.s3.dualstack-enabled | | Option to enable using the dualstack endpoints when accessing S3. Dualstack should be enabled if you want to use IPv6. +|spring.cloud.aws.s3.enabled | `true` | Enables S3 integration. +|spring.cloud.aws.s3.endpoint | | Overrides the default endpoint. +|spring.cloud.aws.s3.path-style-access-enabled | | Option to enable using path style access for accessing S3 objects instead of DNS style access. DNS style access is preferred as it will result in better load balancing when accessing S3. +|spring.cloud.aws.s3.region | | Overrides the default region. +|spring.cloud.aws.s3.use-arn-region-enabled | | If an S3 resource ARN is passed in as the target of an S3 operation that has a different region to the one the client was configured with, this flag must be set to 'true' to permit the client to make a cross-region call to the region specified in the ARN otherwise an exception will be thrown. |spring.cloud.aws.secretsmanager.endpoint | | Overrides the default endpoint. |spring.cloud.aws.secretsmanager.region | | Overrides the default region. |spring.cloud.aws.ses.enabled | `true` | Enables Simple Email Service integration. diff --git a/eclipse-code-formatter.xml b/eclipse-code-formatter.xml new file mode 100644 index 000000000..a9fd9cd38 --- /dev/null +++ b/eclipse-code-formatter.xml @@ -0,0 +1,755 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/license-header.txt b/license-header.txt new file mode 100644 index 000000000..f7fe86dd3 --- /dev/null +++ b/license-header.txt @@ -0,0 +1,15 @@ +/* + * Copyright 2013-$YEAR 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/pom.xml b/pom.xml index 5762ccb11..759c1b7f9 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,6 @@ 2.8.2 1.2.0 3.1.0 - 0.0.25 @@ -148,26 +147,26 @@ aws-integration-test + + com.diffplug.spotless + spotless-maven-plugin + 2.22.0 + + + + + ${maven.multiModuleProjectDirectory}/eclipse-code-formatter.xml + + + + ${maven.multiModuleProjectDirectory}/license-header.txt + + + + - - org.apache.maven.plugins - maven-checkstyle-plugin - - - io.spring.javaformat - spring-javaformat-maven-plugin - - - validate - true - - validate - - - - org.apache.maven.plugins maven-javadoc-plugin @@ -185,17 +184,24 @@ ${project.build.directory}/site/${project.version}/apidocs - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin + com.diffplug.spotless + spotless-maven-plugin + + + validate + + ${disable.checks} + + + apply + check + + + - + diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/AwsClientProperties.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/AwsClientProperties.java index ba7183065..1a15ac1e3 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/AwsClientProperties.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/AwsClientProperties.java @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure; import java.net.URI; - import org.springframework.lang.Nullable; /** diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/AbstractAwsConfigDataLocationResolver.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/AbstractAwsConfigDataLocationResolver.java index 4aa6dd8ff..77ffaf8e0 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/AbstractAwsConfigDataLocationResolver.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/AbstractAwsConfigDataLocationResolver.java @@ -13,15 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config; +import io.awspring.cloud.autoconfigure.core.CredentialsProperties; import java.util.Arrays; import java.util.Collections; import java.util.List; - -import io.awspring.cloud.autoconfigure.core.CredentialsProperties; - import org.springframework.boot.BootstrapRegistry; import org.springframework.boot.ConfigurableBootstrapContext; import org.springframework.boot.context.config.ConfigDataLocation; diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/BootstrapLoggingHelper.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/BootstrapLoggingHelper.java index 3c00d711e..e99c93eb6 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/BootstrapLoggingHelper.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/BootstrapLoggingHelper.java @@ -13,24 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; - import org.apache.commons.logging.Log; - import org.springframework.boot.BootstrapRegistry; import org.springframework.boot.logging.DeferredLogFactory; import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; /** - * Utility class for setting up logging in objects registered in - * {@link BootstrapRegistry}. + * Utility class for setting up logging in objects registered in {@link BootstrapRegistry}. * * @author Maciej Walkowiak * @since 3.0 diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/package-info.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/package-info.java index b2c76835d..0b7da731e 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/package-info.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/package-info.java @@ -15,8 +15,7 @@ */ /** - * {@link org.springframework.boot.context.config.ConfigDataLoader} implementations for - * AWS services. + * {@link org.springframework.boot.context.config.ConfigDataLoader} implementations for AWS services. */ @org.springframework.lang.NonNullApi @org.springframework.lang.NonNullFields diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLoader.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLoader.java index fc6a8584a..9a33e47e8 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLoader.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLoader.java @@ -13,21 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.parameterstore; -import java.util.Collections; - import io.awspring.cloud.autoconfigure.config.BootstrapLoggingHelper; import io.awspring.cloud.parameterstore.ParameterStorePropertySource; -import software.amazon.awssdk.services.ssm.SsmClient; - +import java.util.Collections; import org.springframework.boot.context.config.ConfigData; import org.springframework.boot.context.config.ConfigDataLoader; import org.springframework.boot.context.config.ConfigDataLoaderContext; import org.springframework.boot.context.config.ConfigDataResourceNotFoundException; import org.springframework.boot.logging.DeferredLogFactory; import org.springframework.lang.Nullable; +import software.amazon.awssdk.services.ssm.SsmClient; /** * {@link ConfigDataLoader} for AWS Parameter Store. diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLocationResolver.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLocationResolver.java index 546eecfa0..cbfe5d3d1 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLocationResolver.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLocationResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2020 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. @@ -13,21 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.parameterstore; -import java.util.ArrayList; -import java.util.List; - import io.awspring.cloud.autoconfigure.config.AbstractAwsConfigDataLocationResolver; import io.awspring.cloud.autoconfigure.core.CredentialsProperties; import io.awspring.cloud.autoconfigure.core.CredentialsProviderAutoConfiguration; import io.awspring.cloud.core.SpringCloudClientConfiguration; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.ssm.SsmClient; -import software.amazon.awssdk.services.ssm.SsmClientBuilder; - +import java.util.ArrayList; +import java.util.List; import org.springframework.boot.BootstrapContext; import org.springframework.boot.context.config.ConfigDataLocation; import org.springframework.boot.context.config.ConfigDataLocationNotFoundException; @@ -36,6 +29,10 @@ import org.springframework.boot.context.properties.bind.Bindable; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.util.StringUtils; +import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.ssm.SsmClient; +import software.amazon.awssdk.services.ssm.SsmClientBuilder; /** * @author Eddú Meléndez diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataResource.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataResource.java index ec3be5dca..54fb9d05a 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataResource.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2020 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. @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.parameterstore; import java.util.Objects; - import org.springframework.boot.context.config.ConfigDataResource; import org.springframework.core.style.ToStringCreator; diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreKeysMissingException.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreKeysMissingException.java index c030df675..9b33a53d1 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreKeysMissingException.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreKeysMissingException.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.parameterstore; /** - * Thrown when configuration provided to ConfigDataLoader is missing parameter store keys, - * for example `spring.config.import=aws-parameterstore:`. + * Thrown when configuration provided to ConfigDataLoader is missing parameter store keys, for example + * `spring.config.import=aws-parameterstore:`. * * @author Maciej Walkowiak * @since 3.0.0 diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreMissingKeysFailureAnalyzer.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreMissingKeysFailureAnalyzer.java index 9052221c3..30781d7a8 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreMissingKeysFailureAnalyzer.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreMissingKeysFailureAnalyzer.java @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.parameterstore; import org.springframework.boot.diagnostics.AbstractFailureAnalyzer; import org.springframework.boot.diagnostics.FailureAnalysis; /** - * An {@link AbstractFailureAnalyzer} that performs analysis of a Parameter Store - * configuration failure caused by not providing a Parameter Store key to - * `spring.config.import` property. + * An {@link AbstractFailureAnalyzer} that performs analysis of a Parameter Store configuration failure caused by not + * providing a Parameter Store key to `spring.config.import` property. * * @author Maciej Walkowiak * @since 3.0.0 diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreProperties.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreProperties.java index cfe5332cc..6430947cb 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreProperties.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.parameterstore; import io.awspring.cloud.autoconfigure.AwsClientProperties; - import org.springframework.boot.context.properties.ConfigurationProperties; /** - * Configuration properties for the AWS Parameter Store integration. Mostly based on the - * Spring Cloud Consul Configuration equivalent. + * Configuration properties for the AWS Parameter Store integration. Mostly based on the Spring Cloud Consul + * Configuration equivalent. * * @author Joris Kuipers * @author Matej Nedic diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStorePropertySources.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStorePropertySources.java index 120a0d931..a6df942c6 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStorePropertySources.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStorePropertySources.java @@ -13,15 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.parameterstore; import io.awspring.cloud.parameterstore.ParameterStorePropertySource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import software.amazon.awssdk.services.ssm.SsmClient; - import org.springframework.lang.Nullable; +import software.amazon.awssdk.services.ssm.SsmClient; /** * @author Eddú Meléndez @@ -34,11 +32,9 @@ public class ParameterStorePropertySources { /** * Creates property source for given context. * @param context property source context equivalent to the parameter name - * @param optional if creating context should fail with exception if parameter cannot - * be loaded + * @param optional if creating context should fail with exception if parameter cannot be loaded * @param client System Manager Management client - * @return a property source or null if parameter could not be loaded and optional is - * set to true + * @return a property source or null if parameter could not be loaded and optional is set to true */ @Nullable public ParameterStorePropertySource createPropertySource(String context, boolean optional, SsmClient client) { diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/package-info.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/package-info.java index c3c4897f3..e679bae26 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/package-info.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/parameterstore/package-info.java @@ -15,8 +15,7 @@ */ /** - * {@link org.springframework.boot.context.config.ConfigDataLoader} implementation for AWS - * Parameter Store. + * {@link org.springframework.boot.context.config.ConfigDataLoader} implementation for AWS Parameter Store. */ @org.springframework.lang.NonNullApi @org.springframework.lang.NonNullFields diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLoader.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLoader.java index fa86ac59a..769e46fe5 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLoader.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLoader.java @@ -13,21 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.secretsmanager; -import java.util.Collections; - import io.awspring.cloud.autoconfigure.config.BootstrapLoggingHelper; import io.awspring.cloud.secretsmanager.SecretsManagerPropertySource; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; - +import java.util.Collections; import org.springframework.boot.context.config.ConfigData; import org.springframework.boot.context.config.ConfigDataLoader; import org.springframework.boot.context.config.ConfigDataLoaderContext; import org.springframework.boot.context.config.ConfigDataResourceNotFoundException; import org.springframework.boot.logging.DeferredLogFactory; import org.springframework.lang.Nullable; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; /** * Loads config data from AWS Secret Manager. diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLocationResolver.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLocationResolver.java index 3d06866b1..3638f2c97 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLocationResolver.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLocationResolver.java @@ -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. @@ -13,21 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.secretsmanager; -import java.util.ArrayList; -import java.util.List; - import io.awspring.cloud.autoconfigure.config.AbstractAwsConfigDataLocationResolver; import io.awspring.cloud.autoconfigure.core.CredentialsProperties; import io.awspring.cloud.autoconfigure.core.CredentialsProviderAutoConfiguration; import io.awspring.cloud.core.SpringCloudClientConfiguration; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerClientBuilder; - +import java.util.ArrayList; +import java.util.List; import org.springframework.boot.BootstrapContext; import org.springframework.boot.context.config.ConfigDataLocation; import org.springframework.boot.context.config.ConfigDataLocationNotFoundException; @@ -36,6 +29,10 @@ import org.springframework.boot.context.properties.bind.Bindable; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.util.StringUtils; +import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClientBuilder; /** * Resolves config data locations in AWS Secrets Manager. diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataResource.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataResource.java index 095b0c8d7..598d6aa21 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataResource.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataResource.java @@ -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. @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.secretsmanager; import java.util.Objects; - import org.springframework.boot.context.config.ConfigDataResource; import org.springframework.core.style.ToStringCreator; diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerKeysMissingException.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerKeysMissingException.java index 5f3c95618..ccf394668 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerKeysMissingException.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerKeysMissingException.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.secretsmanager; /** - * Thrown when configuration provided to ConfigDataLoader is missing Secrets Manager keys, - * for example `spring.config.import=aws-secretsmanager:`. + * Thrown when configuration provided to ConfigDataLoader is missing Secrets Manager keys, for example + * `spring.config.import=aws-secretsmanager:`. * * @author Maciej Walkowiak * @since 3.0.0 diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerMissingKeysFailureAnalyzer.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerMissingKeysFailureAnalyzer.java index abb3b4a8d..013688d23 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerMissingKeysFailureAnalyzer.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerMissingKeysFailureAnalyzer.java @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.secretsmanager; import org.springframework.boot.diagnostics.AbstractFailureAnalyzer; import org.springframework.boot.diagnostics.FailureAnalysis; /** - * An {@link AbstractFailureAnalyzer} that performs analysis of a Secrets Manager - * configuration failure caused by not providing a Secrets Manager key to - * `spring.config.import` property. + * An {@link AbstractFailureAnalyzer} that performs analysis of a Secrets Manager configuration failure caused by not + * providing a Secrets Manager key to `spring.config.import` property. * * @author Maciej Walkowiak * @since 3.0.0 diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerProperties.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerProperties.java index 7610125a4..70c7040f7 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerProperties.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerProperties.java @@ -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. @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.secretsmanager; import io.awspring.cloud.autoconfigure.AwsClientProperties; - import org.springframework.boot.context.properties.ConfigurationProperties; /** - * Configuration properties for the AWS Secrets Manager integration. Mostly based on the - * Spring Cloud Consul Configuration equivalent. + * Configuration properties for the AWS Secrets Manager integration. Mostly based on the Spring Cloud Consul + * Configuration equivalent. * * @author Fabio Maia * @author Matej Nedic diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerPropertySources.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerPropertySources.java index f93781b36..415615f54 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerPropertySources.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerPropertySources.java @@ -13,15 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.secretsmanager; import io.awspring.cloud.secretsmanager.SecretsManagerPropertySource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; - import org.springframework.lang.Nullable; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; /** * Provides prefix config import support. @@ -37,11 +35,9 @@ public class SecretsManagerPropertySources { /** * Creates property source for given context. * @param context property source context equivalent to the secret name - * @param optional if creating context should fail with exception if secret cannot be - * loaded + * @param optional if creating context should fail with exception if secret cannot be loaded * @param client Secret Manager client - * @return a property source or null if secret could not be loaded and optional is set - * to true + * @return a property source or null if secret could not be loaded and optional is set to true */ @Nullable public SecretsManagerPropertySource createPropertySource(String context, boolean optional, diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/package-info.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/package-info.java index b5854f5a1..3fec2dbf4 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/package-info.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/config/secretsmanager/package-info.java @@ -15,8 +15,7 @@ */ /** - * {@link org.springframework.boot.context.config.ConfigDataLoader} implementation for AWS - * Secrets Manager. + * {@link org.springframework.boot.context.config.ConfigDataLoader} implementation for AWS Secrets Manager. */ @org.springframework.lang.NonNullApi @org.springframework.lang.NonNullFields diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/CredentialsProperties.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/CredentialsProperties.java index 10a8aaa1f..c5c1b25b5 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/CredentialsProperties.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/CredentialsProperties.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.core; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfiguration.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfiguration.java index 4549f7153..0c0a6e94f 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfiguration.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfiguration.java @@ -13,13 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.core; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; - +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.util.StringUtils; import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; import software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain; @@ -29,13 +33,6 @@ import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; import software.amazon.awssdk.profiles.ProfileFile; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.util.StringUtils; - /** * {@link EnableAutoConfiguration} for {@link AwsCredentialsProvider}. * diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/Profile.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/Profile.java index d7177bc7e..61e3d1796 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/Profile.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/Profile.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.core; import org.springframework.lang.Nullable; diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/RegionProperties.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/RegionProperties.java index 45c1af4cc..cc99189cb 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/RegionProperties.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/RegionProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2012 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. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.core; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -36,10 +35,9 @@ public class RegionProperties { public static final String PREFIX = "spring.cloud.aws.region"; /** - * Configures a static region for the application. Possible regions are (currently) - * us-east-1, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, - * ap-southeast-1, ap-northeast-1, sa-east-1, cn-north-1 and any custom region - * configured with own region meta data. + * Configures a static region for the application. Possible regions are (currently) us-east-1, us-west-1, us-west-2, + * eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-1, ap-northeast-1, sa-east-1, cn-north-1 and any custom + * region configured with own region meta data. */ @Nullable private String staticRegion; diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/RegionProviderAutoConfiguration.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/RegionProviderAutoConfiguration.java index 391be61c5..45a404ec2 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/RegionProviderAutoConfiguration.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/core/RegionProviderAutoConfiguration.java @@ -13,15 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.core; +import io.awspring.cloud.core.region.StaticRegionProvider; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; - -import io.awspring.cloud.core.region.StaticRegionProvider; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import software.amazon.awssdk.profiles.ProfileFile; import software.amazon.awssdk.regions.providers.AwsProfileRegionProvider; import software.amazon.awssdk.regions.providers.AwsRegionProvider; @@ -29,12 +32,6 @@ import software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain; import software.amazon.awssdk.regions.providers.InstanceProfileRegionProvider; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - /** * {@link EnableAutoConfiguration} for {@link AwsRegionProvider}. * diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfiguration.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfiguration.java index 5e5447eba..6c8f4b2f0 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfiguration.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfiguration.java @@ -13,23 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.s3; -import java.util.Optional; - import io.awspring.cloud.core.SpringCloudClientConfiguration; import io.awspring.cloud.s3.DiskBufferingS3OutputStreamProvider; import io.awspring.cloud.s3.S3OutputStreamProvider; import io.awspring.cloud.s3.S3ProtocolResolver; import io.awspring.cloud.s3.crossregion.CrossRegionS3Client; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.regions.providers.AwsRegionProvider; -import software.amazon.awssdk.services.s3.S3Client; -import software.amazon.awssdk.services.s3.S3ClientBuilder; -import software.amazon.awssdk.services.s3.S3Configuration; - +import java.util.Optional; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -41,6 +32,12 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.util.StringUtils; +import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.regions.providers.AwsRegionProvider; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.S3ClientBuilder; +import software.amazon.awssdk.services.s3.S3Configuration; /** * {@link EnableAutoConfiguration} for {@link S3Client} and {@link S3ProtocolResolver}. diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3Properties.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3Properties.java index 4cdbb03c2..5dc65c4c3 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3Properties.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/s3/S3Properties.java @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.s3; import io.awspring.cloud.autoconfigure.AwsClientProperties; - import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.lang.Nullable; @@ -35,9 +33,8 @@ public class S3Properties extends AwsClientProperties { public static final String PREFIX = "spring.cloud.aws.s3"; /** - * Option to enable using the accelerate enedpoint when accessing S3. Accelerate - * endpoints allow faster transfer of objects by using Amazon CloudFront's globally - * distributed edge locations. + * Option to enable using the accelerate enedpoint when accessing S3. Accelerate endpoints allow faster transfer of + * objects by using Amazon CloudFront's globally distributed edge locations. */ @Nullable private Boolean accelerateModeEnabled; @@ -57,25 +54,23 @@ public class S3Properties extends AwsClientProperties { private Boolean chunkedEncodingEnabled; /** - * Option to enable using the dualstack endpoints when accessing S3. Dualstack should - * be enabled if you want to use IPv6. + * Option to enable using the dualstack endpoints when accessing S3. Dualstack should be enabled if you want to use + * IPv6. */ @Nullable private Boolean dualstackEnabled; /** - * Option to enable using path style access for accessing S3 objects instead of DNS - * style access. DNS style access is preferred as it will result in better load - * balancing when accessing S3. + * Option to enable using path style access for accessing S3 objects instead of DNS style access. DNS style access + * is preferred as it will result in better load balancing when accessing S3. */ @Nullable private Boolean pathStyleAccessEnabled; /** - * If an S3 resource ARN is passed in as the target of an S3 operation that has a - * different region to the one the client was configured with, this flag must be set - * to 'true' to permit the client to make a cross-region call to the region specified - * in the ARN otherwise an exception will be thrown. + * If an S3 resource ARN is passed in as the target of an S3 operation that has a different region to the one the + * client was configured with, this flag must be set to 'true' to permit the client to make a cross-region call to + * the region specified in the ARN otherwise an exception will be thrown. */ @Nullable private Boolean useArnRegionEnabled; diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/ses/SesAutoConfiguration.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/ses/SesAutoConfiguration.java index 1b40d7e63..c8bd09262 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/ses/SesAutoConfiguration.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/ses/SesAutoConfiguration.java @@ -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. @@ -13,24 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.ses; -import java.util.Optional; - -import javax.mail.Session; - import io.awspring.cloud.autoconfigure.core.CredentialsProviderAutoConfiguration; import io.awspring.cloud.autoconfigure.core.RegionProviderAutoConfiguration; import io.awspring.cloud.core.SpringCloudClientConfiguration; import io.awspring.cloud.ses.SimpleEmailServiceJavaMailSender; import io.awspring.cloud.ses.SimpleEmailServiceMailSender; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.regions.providers.AwsRegionProvider; -import software.amazon.awssdk.services.ses.SesClient; -import software.amazon.awssdk.services.ses.SesClientBuilder; - +import java.util.Optional; +import javax.mail.Session; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -43,6 +34,11 @@ import org.springframework.mail.MailSender; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.util.StringUtils; +import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.regions.providers.AwsRegionProvider; +import software.amazon.awssdk.services.ses.SesClient; +import software.amazon.awssdk.services.ses.SesClientBuilder; /** * {@link EnableAutoConfiguration} for {@link SimpleEmailServiceMailSender} and diff --git a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/ses/SesProperties.java b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/ses/SesProperties.java index e4f6842b7..1138ab2b8 100644 --- a/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/ses/SesProperties.java +++ b/spring-cloud-aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/ses/SesProperties.java @@ -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. @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.ses; import io.awspring.cloud.autoconfigure.AwsClientProperties; - import org.springframework.boot.context.properties.ConfigurationProperties; /** diff --git a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLoaderIntegrationTests.java b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLoaderIntegrationTests.java index 000c05bfe..2a8cab1cb 100644 --- a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLoaderIntegrationTests.java +++ b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/config/parameterstore/ParameterStoreConfigDataLoaderIntegrationTests.java @@ -13,14 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.parameterstore; -import java.io.IOException; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SSM; +import java.io.IOException; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; +import org.springframework.context.ConfigurableApplicationContext; import org.testcontainers.containers.localstack.LocalStackContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -32,21 +44,6 @@ import software.amazon.awssdk.services.ssm.model.GetParametersByPathResponse; import software.amazon.awssdk.services.ssm.model.Parameter; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.WebApplicationType; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.test.system.CapturedOutput; -import org.springframework.boot.test.system.OutputCaptureExtension; -import org.springframework.context.ConfigurableApplicationContext; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.fail; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SSM; - /** * Integration tests for loading configuration properties from AWS Parameter Store. * diff --git a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLoaderIntegrationTests.java b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLoaderIntegrationTests.java index fd90c3ca0..d355af9e3 100644 --- a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLoaderIntegrationTests.java +++ b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/config/secretsmanager/SecretsManagerConfigDataLoaderIntegrationTests.java @@ -13,14 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.config.secretsmanager; -import java.io.IOException; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SECRETSMANAGER; +import java.io.IOException; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.test.system.CapturedOutput; +import org.springframework.boot.test.system.OutputCaptureExtension; +import org.springframework.context.ConfigurableApplicationContext; import org.testcontainers.containers.localstack.LocalStackContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -31,21 +43,6 @@ import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest; import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.WebApplicationType; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.test.system.CapturedOutput; -import org.springframework.boot.test.system.OutputCaptureExtension; -import org.springframework.context.ConfigurableApplicationContext; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.fail; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SECRETSMANAGER; - /** * Integration tests for loading configuration properties from AWS Secrets Manager. * diff --git a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfigurationTests.java b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfigurationTests.java index 693ed1d59..0d105e9bf 100644 --- a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfigurationTests.java +++ b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfigurationTests.java @@ -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. @@ -13,28 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.core; +import static org.assertj.core.api.Assertions.assertThat; + import java.io.IOException; import java.util.List; - import org.junit.jupiter.api.Test; -import software.amazon.awssdk.auth.credentials.AwsCredentials; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; -import software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider; -import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; - import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.test.util.ReflectionTestUtils; - -import static org.assertj.core.api.Assertions.assertThat; +import software.amazon.awssdk.auth.credentials.AwsCredentials; +import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; +import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; +import software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider; +import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; +import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; class CredentialsProviderAutoConfigurationTests { diff --git a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/core/RegionProviderAutoConfigurationTests.java b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/core/RegionProviderAutoConfigurationTests.java index 59258e49d..9748bcaf9 100644 --- a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/core/RegionProviderAutoConfigurationTests.java +++ b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/core/RegionProviderAutoConfigurationTests.java @@ -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. @@ -13,28 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.core; -import java.io.IOException; -import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; import io.awspring.cloud.core.region.StaticRegionProvider; +import java.io.IOException; +import java.util.List; import org.junit.jupiter.api.Test; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.regions.providers.AwsProfileRegionProvider; -import software.amazon.awssdk.regions.providers.AwsRegionProvider; -import software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain; -import software.amazon.awssdk.regions.providers.InstanceProfileRegionProvider; - import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.test.util.ReflectionTestUtils; - -import static org.assertj.core.api.Assertions.assertThat; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.regions.providers.AwsProfileRegionProvider; +import software.amazon.awssdk.regions.providers.AwsRegionProvider; +import software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain; +import software.amazon.awssdk.regions.providers.InstanceProfileRegionProvider; class RegionProviderAutoConfigurationTests { diff --git a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfigurationTests.java b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfigurationTests.java index 96c977222..4a70d66a2 100644 --- a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfigurationTests.java +++ b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/s3/S3AutoConfigurationTests.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.s3; -import java.io.IOException; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; import io.awspring.cloud.autoconfigure.core.CredentialsProviderAutoConfiguration; import io.awspring.cloud.autoconfigure.core.RegionProviderAutoConfiguration; @@ -25,19 +25,16 @@ import io.awspring.cloud.s3.S3OutputStream; import io.awspring.cloud.s3.S3OutputStreamProvider; import io.awspring.cloud.s3.crossregion.CrossRegionS3Client; +import java.io.IOException; import org.junit.jupiter.api.Test; -import software.amazon.awssdk.services.s3.S3Client; -import software.amazon.awssdk.services.s3.S3ClientBuilder; - import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.lang.Nullable; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.S3ClientBuilder; /** * Tests for {@link S3AutoConfiguration}. diff --git a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/ses/SesAutoConfigurationTest.java b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/ses/SesAutoConfigurationTest.java index 8696af614..f55027af0 100644 --- a/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/ses/SesAutoConfigurationTest.java +++ b/spring-cloud-aws-autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/ses/SesAutoConfigurationTest.java @@ -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. @@ -13,29 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.autoconfigure.ses; -import java.net.URI; -import java.util.Objects; +import static org.assertj.core.api.Assertions.assertThat; import io.awspring.cloud.autoconfigure.core.CredentialsProviderAutoConfiguration; import io.awspring.cloud.autoconfigure.core.RegionProviderAutoConfiguration; +import java.net.URI; +import java.util.Objects; import org.junit.jupiter.api.Test; -import software.amazon.awssdk.core.SdkClient; -import software.amazon.awssdk.core.client.config.SdkClientConfiguration; -import software.amazon.awssdk.core.client.config.SdkClientOption; -import software.amazon.awssdk.services.ses.SesClient; -import software.amazon.awssdk.utils.AttributeMap; - import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.mail.MailSender; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.test.util.ReflectionTestUtils; - -import static org.assertj.core.api.Assertions.assertThat; +import software.amazon.awssdk.core.SdkClient; +import software.amazon.awssdk.core.client.config.SdkClientConfiguration; +import software.amazon.awssdk.core.client.config.SdkClientOption; +import software.amazon.awssdk.services.ses.SesClient; +import software.amazon.awssdk.utils.AttributeMap; /** * Tests for class {@link SesAutoConfiguration} diff --git a/spring-cloud-aws-core/src/main/java/io/awspring/cloud/core/SpringCloudClientConfiguration.java b/spring-cloud-aws-core/src/main/java/io/awspring/cloud/core/SpringCloudClientConfiguration.java index cea2d359d..cc51f1a57 100644 --- a/spring-cloud-aws-core/src/main/java/io/awspring/cloud/core/SpringCloudClientConfiguration.java +++ b/spring-cloud-aws-core/src/main/java/io/awspring/cloud/core/SpringCloudClientConfiguration.java @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.core; import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; import software.amazon.awssdk.core.client.config.SdkAdvancedClientOption; /** - * Utility class for creating {@link ClientOverrideConfiguration} containing "Spring Cloud - * AWS" user agent. When used, server side (AWS or AWS-compatible service) can measure how - * many requests to its services come from Spring Cloud AWS. + * Utility class for creating {@link ClientOverrideConfiguration} containing "Spring Cloud AWS" user agent. When used, + * server side (AWS or AWS-compatible service) can measure how many requests to its services come from Spring Cloud AWS. * * @author Eddú Meléndez */ diff --git a/spring-cloud-aws-core/src/main/java/io/awspring/cloud/core/region/StaticRegionProvider.java b/spring-cloud-aws-core/src/main/java/io/awspring/cloud/core/region/StaticRegionProvider.java index ea074f464..946f6029a 100644 --- a/spring-cloud-aws-core/src/main/java/io/awspring/cloud/core/region/StaticRegionProvider.java +++ b/spring-cloud-aws-core/src/main/java/io/awspring/cloud/core/region/StaticRegionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.core.region; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.regions.providers.AwsRegionProvider; /** - * Static {@link AwsRegionProvider} implementation that can used to statically configure a - * region. The region could be provided through a configuration file at configuration - * time. + * Static {@link AwsRegionProvider} implementation that can used to statically configure a region. The region could be + * provided through a configuration file at configuration time. * * @author Agim Emruli * @author Maciej Walkowiak @@ -34,8 +32,7 @@ public class StaticRegionProvider implements AwsRegionProvider { /** * Constructs and configures the static region for this RegionProvider implementation. - * @param configuredRegion - the region that will be statically returned in - * {@link #getRegion()} + * @param configuredRegion - the region that will be statically returned in {@link #getRegion()} */ public StaticRegionProvider(String configuredRegion) { try { diff --git a/spring-cloud-aws-dependencies/pom.xml b/spring-cloud-aws-dependencies/pom.xml index 3a9b2fb41..d7ff67dbe 100644 --- a/spring-cloud-aws-dependencies/pom.xml +++ b/spring-cloud-aws-dependencies/pom.xml @@ -127,4 +127,21 @@ + + + + + com.diffplug.spotless + spotless-maven-plugin + + + validate + + true + + + + + + diff --git a/spring-cloud-aws-parameter-store/src/main/java/io/awspring/cloud/parameterstore/ParameterStorePropertySource.java b/spring-cloud-aws-parameter-store/src/main/java/io/awspring/cloud/parameterstore/ParameterStorePropertySource.java index 738d12402..0c3d2bbc9 100644 --- a/spring-cloud-aws-parameter-store/src/main/java/io/awspring/cloud/parameterstore/ParameterStorePropertySource.java +++ b/spring-cloud-aws-parameter-store/src/main/java/io/awspring/cloud/parameterstore/ParameterStorePropertySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2012 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. @@ -13,26 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.parameterstore; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.core.env.EnumerablePropertySource; +import org.springframework.lang.Nullable; import software.amazon.awssdk.services.ssm.SsmClient; import software.amazon.awssdk.services.ssm.model.GetParametersByPathRequest; import software.amazon.awssdk.services.ssm.model.GetParametersByPathResponse; import software.amazon.awssdk.services.ssm.model.Parameter; -import org.springframework.core.env.EnumerablePropertySource; -import org.springframework.lang.Nullable; - /** - * Recursively retrieves all parameters under the given context / path with decryption - * from the AWS Parameter Store using the provided SSM client. + * Recursively retrieves all parameters under the given context / path with decryption from the AWS Parameter Store + * using the provided SSM client. * * @author Joris Kuipers * @author Eddú Meléndez diff --git a/spring-cloud-aws-parameter-store/src/test/java/io/awspring/cloud/parameterstore/ParameterStorePropertySourceTest.java b/spring-cloud-aws-parameter-store/src/test/java/io/awspring/cloud/parameterstore/ParameterStorePropertySourceTest.java index abefbf808..11b35f982 100644 --- a/spring-cloud-aws-parameter-store/src/test/java/io/awspring/cloud/parameterstore/ParameterStorePropertySourceTest.java +++ b/spring-cloud-aws-parameter-store/src/test/java/io/awspring/cloud/parameterstore/ParameterStorePropertySourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,20 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.parameterstore; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import org.junit.jupiter.api.Test; import software.amazon.awssdk.services.ssm.SsmClient; import software.amazon.awssdk.services.ssm.model.GetParametersByPathRequest; import software.amazon.awssdk.services.ssm.model.GetParametersByPathResponse; import software.amazon.awssdk.services.ssm.model.Parameter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - class ParameterStorePropertySourceTest { private SsmClient ssmClient = mock(SsmClient.class); diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-codegen/src/main/java/io/awspring/cloud/s3/codegen/CrossRegionS3ClientGenerator.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-codegen/src/main/java/io/awspring/cloud/s3/codegen/CrossRegionS3ClientGenerator.java index f99d0c84a..34cedcfdd 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-codegen/src/main/java/io/awspring/cloud/s3/codegen/CrossRegionS3ClientGenerator.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-codegen/src/main/java/io/awspring/cloud/s3/codegen/CrossRegionS3ClientGenerator.java @@ -13,20 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3.codegen; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.function.Function; - import com.github.javaparser.StaticJavaParser; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.Modifier; @@ -38,6 +26,16 @@ import com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration; import com.github.javaparser.symbolsolver.model.resolution.TypeSolver; import com.github.javaparser.symbolsolver.resolution.typesolvers.ClassLoaderTypeSolver; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.function.Function; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.exception.SdkClientException; import software.amazon.awssdk.services.s3.S3Client; diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-codegen/src/main/java/io/awspring/cloud/s3/codegen/CrossRegionS3ClientTemplate.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-codegen/src/main/java/io/awspring/cloud/s3/codegen/CrossRegionS3ClientTemplate.java index 95e3522d8..281ad1365 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-codegen/src/main/java/io/awspring/cloud/s3/codegen/CrossRegionS3ClientTemplate.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-codegen/src/main/java/io/awspring/cloud/s3/codegen/CrossRegionS3ClientTemplate.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3.codegen; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.util.ConcurrentLruCache; +import org.springframework.util.StringUtils; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.exception.SdkClientException; import software.amazon.awssdk.core.sync.RequestBody; @@ -36,9 +36,6 @@ import software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse; import software.amazon.awssdk.utils.SdkAutoCloseable; -import org.springframework.util.ConcurrentLruCache; -import org.springframework.util.StringUtils; - public class CrossRegionS3ClientTemplate implements S3Client { private static final Logger LOGGER = LoggerFactory.getLogger("io.awspring.cloud.s3.CrossRegionS3Client"); diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/pom.xml b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/pom.xml index 0c4a3f8f1..15c36bbb7 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/pom.xml +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/pom.xml @@ -54,27 +54,6 @@ - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - checkstyle-validation - none - - - - - - io.spring.javaformat - spring-javaformat-maven-plugin - - - none - - - diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/CrossRegionS3Client.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/CrossRegionS3Client.java index c7aa8b25c..f153813b8 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/CrossRegionS3Client.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/CrossRegionS3Client.java @@ -20,6 +20,8 @@ import java.util.function.Function; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.util.ConcurrentLruCache; +import org.springframework.util.StringUtils; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.exception.SdkClientException; import software.amazon.awssdk.core.sync.RequestBody; @@ -33,8 +35,6 @@ import software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest; import software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse; import software.amazon.awssdk.utils.SdkAutoCloseable; -import org.springframework.util.ConcurrentLruCache; -import org.springframework.util.StringUtils; public class CrossRegionS3Client implements S3Client { @@ -330,18 +330,18 @@ public software.amazon.awssdk.services.s3.model.GetBucketWebsiteResponse getBuck } @Override - public software.amazon.awssdk.services.s3.model.GetObjectResponse getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); + public software.amazon.awssdk.core.ResponseInputStream getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0)); } @Override - public ReturnT getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, software.amazon.awssdk.core.sync.ResponseTransformer p1) throws AwsServiceException, SdkClientException { + public software.amazon.awssdk.services.s3.model.GetObjectResponse getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); } @Override - public software.amazon.awssdk.core.ResponseInputStream getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0)); + public ReturnT getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, software.amazon.awssdk.core.sync.ResponseTransformer p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); } @Override @@ -379,11 +379,6 @@ public software.amazon.awssdk.services.s3.model.GetObjectTaggingResponse getObje return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTagging(p0)); } - @Override - public software.amazon.awssdk.services.s3.model.GetObjectTorrentResponse getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); - } - @Override public ReturnT getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, software.amazon.awssdk.core.sync.ResponseTransformer p1) throws AwsServiceException, SdkClientException { return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); @@ -394,6 +389,11 @@ public software.amazon.awssdk.core.ResponseInputStream s3Client.getObjectTorrent(p0)); } + @Override + public software.amazon.awssdk.services.s3.model.GetObjectTorrentResponse getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); + } + @Override public software.amazon.awssdk.core.ResponseBytes getObjectTorrentAsBytes(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) throws AwsServiceException, SdkClientException { return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrentAsBytes(p0)); @@ -570,12 +570,12 @@ public software.amazon.awssdk.services.s3.model.PutBucketWebsiteResponse putBuck } @Override - public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject(software.amazon.awssdk.services.s3.model.PutObjectRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { + public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject(software.amazon.awssdk.services.s3.model.PutObjectRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); } @Override - public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject(software.amazon.awssdk.services.s3.model.PutObjectRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { + public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject(software.amazon.awssdk.services.s3.model.PutObjectRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); } @@ -615,12 +615,12 @@ public software.amazon.awssdk.services.s3.model.RestoreObjectResponse restoreObj } @Override - public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart(software.amazon.awssdk.services.s3.model.UploadPartRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { + public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart(software.amazon.awssdk.services.s3.model.UploadPartRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); } @Override - public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart(software.amazon.awssdk.services.s3.model.UploadPartRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { + public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart(software.amazon.awssdk.services.s3.model.UploadPartRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); } diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/test/java/io/awspring/cloud/s3/crossregion/CrossRegionS3ClientTests.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/test/java/io/awspring/cloud/s3/crossregion/CrossRegionS3ClientTests.java index de656de88..1ffc89715 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/test/java/io/awspring/cloud/s3/crossregion/CrossRegionS3ClientTests.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/test/java/io/awspring/cloud/s3/crossregion/CrossRegionS3ClientTests.java @@ -13,13 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3.crossregion; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; + import java.util.HashMap; import java.util.Map; - -import io.awspring.cloud.s3.crossregion.CrossRegionS3Client; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Answers; @@ -32,17 +37,9 @@ import software.amazon.awssdk.services.s3.model.ListObjectsRequest; import software.amazon.awssdk.services.s3.model.S3Exception; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; - /** - * Unit tests for {@link CrossRegionS3Client}. Integration testing with Localstack is not - * possible due to: https://github.com/localstack/localstack/issues/5748 + * Unit tests for {@link CrossRegionS3Client}. Integration testing with Localstack is not possible due to: + * https://github.com/localstack/localstack/issues/5748 * * @author Maciej Walkowiak */ diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/DiskBufferingS3OutputStream.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/DiskBufferingS3OutputStream.java index 23b0b3053..7080e3348 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/DiskBufferingS3OutputStream.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/DiskBufferingS3OutputStream.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import java.io.BufferedOutputStream; @@ -26,24 +25,21 @@ import java.security.NoSuchAlgorithmException; import java.util.Base64; import java.util.UUID; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import software.amazon.awssdk.core.sync.RequestBody; -import software.amazon.awssdk.services.s3.S3Client; -import software.amazon.awssdk.services.s3.model.PutObjectRequest; - import org.springframework.lang.NonNull; import org.springframework.lang.Nullable; import org.springframework.util.Assert; +import software.amazon.awssdk.core.sync.RequestBody; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.model.PutObjectRequest; /** - * {@link S3OutputStream} implementation, that first uploads to a local file in tmp folder - * and then flushes file to S3. + * {@link S3OutputStream} implementation, that first uploads to a local file in tmp folder and then flushes file to S3. * * Originally developed in - * https://github.com/Alluxio/alluxio/blob/master/underfs/s3a/src/main/java/alluxio/underfs/s3a/S3AOutputStream.java - * and adopted to Spring Cloud AWS needs. + * https://github.com/Alluxio/alluxio/blob/master/underfs/s3a/src/main/java/alluxio/underfs/s3a/S3AOutputStream.java and + * adopted to Spring Cloud AWS needs. * * @author Maciej Walkowiak * @since 3.0 diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/DiskBufferingS3OutputStreamProvider.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/DiskBufferingS3OutputStreamProvider.java index 8dde3ee1f..9422052a4 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/DiskBufferingS3OutputStreamProvider.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/DiskBufferingS3OutputStreamProvider.java @@ -13,14 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import java.io.IOException; - -import software.amazon.awssdk.services.s3.S3Client; - import org.springframework.lang.Nullable; +import software.amazon.awssdk.services.s3.S3Client; /** * Creates {@link DiskBufferingS3OutputStream}. diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/Location.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/Location.java index e590352a5..38bf7799a 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/Location.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/Location.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import org.springframework.lang.Nullable; diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/ObjectMetadata.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/ObjectMetadata.java index 738fffc1e..7c4a20b04 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/ObjectMetadata.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/ObjectMetadata.java @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import java.time.Instant; import java.util.HashMap; import java.util.Map; - +import org.springframework.lang.Nullable; import software.amazon.awssdk.services.s3.model.ChecksumAlgorithm; import software.amazon.awssdk.services.s3.model.ObjectCannedACL; import software.amazon.awssdk.services.s3.model.ObjectLockLegalHoldStatus; @@ -29,11 +28,8 @@ import software.amazon.awssdk.services.s3.model.ServerSideEncryption; import software.amazon.awssdk.services.s3.model.StorageClass; -import org.springframework.lang.Nullable; - /** - * Container for S3 Object Metadata. For information about each field look at - * {@link PutObjectRequest} Javadocs. + * Container for S3 Object Metadata. For information about each field look at {@link PutObjectRequest} Javadocs. * * @author Maciej Walkowiak * @since 3.0 diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3OutputStream.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3OutputStream.java index 0ee4201fe..bb104b7b1 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3OutputStream.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3OutputStream.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import java.io.OutputStream; diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3OutputStreamProvider.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3OutputStreamProvider.java index d6196c008..8e6a5f37e 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3OutputStreamProvider.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3OutputStreamProvider.java @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import java.io.IOException; import java.io.OutputStream; - import org.springframework.lang.Nullable; /** diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3ProtocolResolver.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3ProtocolResolver.java index bf19e839a..574711144 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3ProtocolResolver.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3ProtocolResolver.java @@ -13,13 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import software.amazon.awssdk.services.s3.S3Client; - import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; @@ -30,10 +27,11 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import org.springframework.lang.Nullable; +import software.amazon.awssdk.services.s3.S3Client; /** - * Resolves {@link S3Resource} for resources paths starting from s3://. Registers resolver - * for S3 protocol in {@link ResourceLoader}. + * Resolves {@link S3Resource} for resources paths starting from s3://. Registers resolver for S3 protocol in + * {@link ResourceLoader}. * * @author Agim Emruli * @author Alain Sahli diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3Resource.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3Resource.java index 788e71233..037ca6964 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3Resource.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/S3Resource.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import java.io.File; @@ -24,14 +23,12 @@ import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.time.Instant; - -import software.amazon.awssdk.services.s3.S3Client; -import software.amazon.awssdk.services.s3.model.HeadObjectResponse; -import software.amazon.awssdk.services.s3.model.NoSuchKeyException; - import org.springframework.core.io.AbstractResource; import org.springframework.core.io.WritableResource; import org.springframework.lang.Nullable; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.model.HeadObjectResponse; +import software.amazon.awssdk.services.s3.model.NoSuchKeyException; /** * {@link org.springframework.core.io.Resource} implementation for S3 objects. diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/UploadFailedException.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/UploadFailedException.java index a04bc122d..bfa78c344 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/UploadFailedException.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/main/java/io/awspring/cloud/s3/UploadFailedException.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; import org.springframework.lang.Nullable; diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/DiskBufferingS3OutputStreamTests.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/DiskBufferingS3OutputStreamTests.java index 420bf34a7..fb41060aa 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/DiskBufferingS3OutputStreamTests.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/DiskBufferingS3OutputStreamTests.java @@ -13,12 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import java.io.IOException; import java.nio.charset.StandardCharsets; - import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import software.amazon.awssdk.core.sync.RequestBody; @@ -26,13 +31,6 @@ import software.amazon.awssdk.services.s3.model.PutObjectRequest; import software.amazon.awssdk.services.s3.model.S3Exception; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - /** * Unit tests for {@link DiskBufferingS3OutputStream}. * diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/ObjectMetadataTests.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/ObjectMetadataTests.java index 70ed5c1b3..23e50e4f5 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/ObjectMetadataTests.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/ObjectMetadataTests.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; -import java.time.Instant; +import static org.assertj.core.api.Assertions.assertThat; +import java.time.Instant; import org.junit.jupiter.api.Test; import software.amazon.awssdk.services.s3.model.ChecksumAlgorithm; import software.amazon.awssdk.services.s3.model.ObjectCannedACL; @@ -27,8 +27,6 @@ import software.amazon.awssdk.services.s3.model.ServerSideEncryption; import software.amazon.awssdk.services.s3.model.StorageClass; -import static org.assertj.core.api.Assertions.assertThat; - /** * Unit tests for {@link ObjectMetadata}. * diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/S3ProtocolResolverTests.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/S3ProtocolResolverTests.java index ddcf12c46..5f9f73603 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/S3ProtocolResolverTests.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/S3ProtocolResolverTests.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import software.amazon.awssdk.services.s3.S3Client; - import org.springframework.aop.framework.Advised; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -33,9 +33,7 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; +import software.amazon.awssdk.services.s3.S3Client; /** * Tests for {@link S3ProtocolResolverTests}. @@ -44,7 +42,8 @@ */ @ExtendWith(SpringExtension.class) @ContextConfiguration -// context must be cleaned up before each method to make sure that for each use case +// context must be cleaned up before each method to make sure that for each use +// case // protocol resolver is registered before resource is requested @DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) class S3ProtocolResolverTests { diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/S3ResourceTests.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/S3ResourceTests.java index ee3ed366e..65ee1a1dc 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/S3ResourceTests.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3/src/test/java/io/awspring/cloud/s3/S3ResourceTests.java @@ -13,9 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import com.amazonaws.auth.AWSCredentials; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -24,8 +27,6 @@ import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; import java.util.stream.Collectors; - -import com.amazonaws.auth.AWSCredentials; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -44,9 +45,6 @@ import software.amazon.awssdk.services.s3.model.PutObjectRequest; import software.amazon.awssdk.services.s3.model.StorageClass; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - /** * Integration tests for {@link S3Resource}. * @@ -63,7 +61,8 @@ class S3ResourceTests { @BeforeAll static void beforeAll() { - // region and credentials are irrelevant for test, but must be added to make test + // region and credentials are irrelevant for test, but must be added to make + // test // work on // environments without AWS cli configured AWSCredentials localstackCredentials = localstack.getDefaultCredentialsProvider().getCredentials(); diff --git a/spring-cloud-aws-samples/spring-cloud-aws-parameter-store-sample/src/main/java/io/awspring/cloud/parameterstore/sample/SpringCloudAwsParameterStoreSample.java b/spring-cloud-aws-samples/spring-cloud-aws-parameter-store-sample/src/main/java/io/awspring/cloud/parameterstore/sample/SpringCloudAwsParameterStoreSample.java index 2f61bc784..12148506e 100644 --- a/spring-cloud-aws-samples/spring-cloud-aws-parameter-store-sample/src/main/java/io/awspring/cloud/parameterstore/sample/SpringCloudAwsParameterStoreSample.java +++ b/spring-cloud-aws-samples/spring-cloud-aws-parameter-store-sample/src/main/java/io/awspring/cloud/parameterstore/sample/SpringCloudAwsParameterStoreSample.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.parameterstore.sample; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; diff --git a/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/app/src/main/java/io/awspring/cloud/s3/sample/SpringCloudAwsS3Sample.java b/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/app/src/main/java/io/awspring/cloud/s3/sample/SpringCloudAwsS3Sample.java index 737e28792..d811c5cf4 100644 --- a/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/app/src/main/java/io/awspring/cloud/s3/sample/SpringCloudAwsS3Sample.java +++ b/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/app/src/main/java/io/awspring/cloud/s3/sample/SpringCloudAwsS3Sample.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,18 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3.sample; import java.io.IOException; import java.io.OutputStream; import java.nio.charset.StandardCharsets; import java.util.Scanner; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import software.amazon.awssdk.services.s3.S3Client; - import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; @@ -33,6 +29,7 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.WritableResource; +import software.amazon.awssdk.services.s3.S3Client; @SpringBootApplication public class SpringCloudAwsS3Sample { diff --git a/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/infrastructure/src/main/java/io/awspring/cloud/s3/sample/infrastructure/InfrastructureApp.java b/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/infrastructure/src/main/java/io/awspring/cloud/s3/sample/infrastructure/InfrastructureApp.java index da33eb005..bacdd005d 100644 --- a/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/infrastructure/src/main/java/io/awspring/cloud/s3/sample/infrastructure/InfrastructureApp.java +++ b/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/infrastructure/src/main/java/io/awspring/cloud/s3/sample/infrastructure/InfrastructureApp.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3.sample.infrastructure; import software.amazon.awscdk.App; diff --git a/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/infrastructure/src/main/java/io/awspring/cloud/s3/sample/infrastructure/InfrastructureStack.java b/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/infrastructure/src/main/java/io/awspring/cloud/s3/sample/infrastructure/InfrastructureStack.java index dd1838a4c..97e8f7b16 100644 --- a/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/infrastructure/src/main/java/io/awspring/cloud/s3/sample/infrastructure/InfrastructureStack.java +++ b/spring-cloud-aws-samples/spring-cloud-aws-s3-sample/infrastructure/src/main/java/io/awspring/cloud/s3/sample/infrastructure/InfrastructureStack.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,11 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.s3.sample.infrastructure; import java.util.Arrays; - import software.amazon.awscdk.Stack; import software.amazon.awscdk.StackProps; import software.amazon.awscdk.services.s3.Bucket; diff --git a/spring-cloud-aws-samples/spring-cloud-aws-secrets-manager-sample/src/main/java/io/awspring/cloud/samples/secretsmanager/App.java b/spring-cloud-aws-samples/spring-cloud-aws-secrets-manager-sample/src/main/java/io/awspring/cloud/samples/secretsmanager/App.java index 650ddf1c8..ed9e6f4f3 100644 --- a/spring-cloud-aws-samples/spring-cloud-aws-secrets-manager-sample/src/main/java/io/awspring/cloud/samples/secretsmanager/App.java +++ b/spring-cloud-aws-samples/spring-cloud-aws-secrets-manager-sample/src/main/java/io/awspring/cloud/samples/secretsmanager/App.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.samples.secretsmanager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; @@ -28,9 +26,8 @@ import org.springframework.core.env.Environment; /** - * Secrets from the Secret Manager are added to the {@link Environment} and can be - * retrieved using: - {@link Value} annotation - {@link Environment#getProperty(String)} - - * or bound to {@link ConfigurationProperties} annotated classes. + * Secrets from the Secret Manager are added to the {@link Environment} and can be retrieved using: - {@link Value} + * annotation - {@link Environment#getProperty(String)} - or bound to {@link ConfigurationProperties} annotated classes. * * @author Maciej Walkowiak */ diff --git a/spring-cloud-aws-secrets-manager/src/main/java/io/awspring/cloud/secretsmanager/SecretsManagerPropertySource.java b/spring-cloud-aws-secrets-manager/src/main/java/io/awspring/cloud/secretsmanager/SecretsManagerPropertySource.java index 40165c7f6..3df58734d 100644 --- a/spring-cloud-aws-secrets-manager/src/main/java/io/awspring/cloud/secretsmanager/SecretsManagerPropertySource.java +++ b/spring-cloud-aws-secrets-manager/src/main/java/io/awspring/cloud/secretsmanager/SecretsManagerPropertySource.java @@ -13,29 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.secretsmanager; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.core.env.EnumerablePropertySource; +import org.springframework.lang.Nullable; import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest; import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse; import software.amazon.awssdk.services.secretsmanager.model.ResourceNotFoundException; -import org.springframework.core.env.EnumerablePropertySource; -import org.springframework.lang.Nullable; - /** - * Retrieves secret value under the given context / path from the AWS Secrets Manager - * using the provided Secrets Manager client. + * Retrieves secret value under the given context / path from the AWS Secrets Manager using the provided Secrets Manager + * client. * * @author Fabio Maia * @author Maciej Walkowiak @@ -59,8 +56,7 @@ public SecretsManagerPropertySource(String context, SecretsManagerClient smClien /** * Loads properties from the Secrets Manager secret. - * @throws ResourceNotFoundException if specified secret does not exist in the AWS - * Secret Manager service. + * @throws ResourceNotFoundException if specified secret does not exist in the AWS Secret Manager service. */ public void init() { readSecretValue(GetSecretValueRequest.builder().secretId(context).build()); diff --git a/spring-cloud-aws-secrets-manager/src/test/java/io/awspring/cloud/secretsmanager/SecretsManagerPropertySourceTest.java b/spring-cloud-aws-secrets-manager/src/test/java/io/awspring/cloud/secretsmanager/SecretsManagerPropertySourceTest.java index 8402a2511..bbd2b0f34 100644 --- a/spring-cloud-aws-secrets-manager/src/test/java/io/awspring/cloud/secretsmanager/SecretsManagerPropertySourceTest.java +++ b/spring-cloud-aws-secrets-manager/src/test/java/io/awspring/cloud/secretsmanager/SecretsManagerPropertySourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 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. @@ -13,21 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.secretsmanager; -import org.junit.jupiter.api.Test; -import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; -import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest; -import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse; -import software.amazon.awssdk.services.secretsmanager.model.ResourceNotFoundException; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import org.junit.jupiter.api.Test; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; +import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest; +import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueResponse; +import software.amazon.awssdk.services.secretsmanager.model.ResourceNotFoundException; + /** * Tests for {@link SecretsManagerPropertySource}. * diff --git a/spring-cloud-aws-ses/src/main/java/io/awspring/cloud/ses/SimpleEmailServiceJavaMailSender.java b/spring-cloud-aws-ses/src/main/java/io/awspring/cloud/ses/SimpleEmailServiceJavaMailSender.java index 892da238c..fbc799a9a 100644 --- a/spring-cloud-aws-ses/src/main/java/io/awspring/cloud/ses/SimpleEmailServiceJavaMailSender.java +++ b/spring-cloud-aws-ses/src/main/java/io/awspring/cloud/ses/SimpleEmailServiceJavaMailSender.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.ses; import java.io.ByteArrayOutputStream; @@ -24,20 +23,12 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; - import javax.activation.FileTypeMap; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.internet.MimeMessage; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import software.amazon.awssdk.core.SdkBytes; -import software.amazon.awssdk.services.ses.SesClient; -import software.amazon.awssdk.services.ses.model.RawMessage; -import software.amazon.awssdk.services.ses.model.SendRawEmailRequest; -import software.amazon.awssdk.services.ses.model.SendRawEmailResponse; - import org.springframework.beans.BeanUtils; import org.springframework.lang.Nullable; import org.springframework.mail.MailException; @@ -50,11 +41,16 @@ import org.springframework.mail.javamail.MimeMessagePreparator; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; +import software.amazon.awssdk.core.SdkBytes; +import software.amazon.awssdk.services.ses.SesClient; +import software.amazon.awssdk.services.ses.model.RawMessage; +import software.amazon.awssdk.services.ses.model.SendRawEmailRequest; +import software.amazon.awssdk.services.ses.model.SendRawEmailResponse; /** - * {@link JavaMailSender} implementation that allows to send {@link MimeMessage} using the - * Simple E-Mail Service. In contrast to {@link SimpleEmailServiceMailSender} this class - * also allows the use of attachment and other mime parts inside mail messages. + * {@link JavaMailSender} implementation that allows to send {@link MimeMessage} using the Simple E-Mail Service. In + * contrast to {@link SimpleEmailServiceMailSender} this class also allows the use of attachment and other mime parts + * inside mail messages. * * @author Agim Emruli * @author Eddú Meléndez @@ -83,11 +79,9 @@ public SimpleEmailServiceJavaMailSender(SesClient sesClient) { } /** - * Allow Map access to the JavaMail properties of this sender, with the option to add - * or override specific entries. + * Allow Map access to the JavaMail properties of this sender, with the option to add or override specific entries. *

- * Useful for specifying entries directly, for example via - * "javaMailProperties[mail.from]". + * Useful for specifying entries directly, for example via "javaMailProperties[mail.from]". * @return java mail properties */ protected Properties getJavaMailProperties() { @@ -108,8 +102,7 @@ public void setJavaMailProperties(Properties javaMailProperties) { } /** - * Return the JavaMail {@code Session}, lazily initializing it if hasn't been - * specified explicitly. + * Return the JavaMail {@code Session}, lazily initializing it if hasn't been specified explicitly. * @return cached session or a new one from java mail properties */ @Nullable @@ -123,11 +116,10 @@ protected Session getSession() { /** * Set the JavaMail {@code Session}, possibly pulled from JNDI. *

- * Default is a new {@code Session} without defaults, that is completely configured - * via this instance's properties. + * Default is a new {@code Session} without defaults, that is completely configured via this instance's properties. *

- * If using a pre-configured {@code Session}, non-default properties in this instance - * will override the settings in the {@code Session}. + * If using a pre-configured {@code Session}, non-default properties in this instance will override the settings in + * the {@code Session}. * @param session JavaMail session * @see #setJavaMailProperties */ @@ -137,8 +129,7 @@ public void setSession(Session session) { } /** - * Set the default encoding to use for {@link MimeMessage MimeMessages} created by - * this instance. + * Set the default encoding to use for {@link MimeMessage MimeMessages} created by this instance. *

* Such an encoding will be auto-detected by {@link MimeMessageHelper}. * @param defaultEncoding default encoding for mime messages @@ -148,18 +139,15 @@ public void setDefaultEncoding(String defaultEncoding) { } /** - * Set the default Java Activation {@link FileTypeMap} to use for {@link MimeMessage - * MimeMessages} created by this instance. + * Set the default Java Activation {@link FileTypeMap} to use for {@link MimeMessage MimeMessages} created by this + * instance. *

- * A {@code FileTypeMap} specified here will be autodetected by - * {@link MimeMessageHelper}, avoiding the need to specify the {@code FileTypeMap} for - * each {@code MimeMessageHelper} instance. + * A {@code FileTypeMap} specified here will be autodetected by {@link MimeMessageHelper}, avoiding the need to + * specify the {@code FileTypeMap} for each {@code MimeMessageHelper} instance. *

- * For example, you can specify a custom instance of Spring's - * {@link ConfigurableMimeFileTypeMap} here. If not explicitly specified, a default - * {@code ConfigurableMimeFileTypeMap} will be used, containing an extended set of - * MIME type mappings (as defined by the {@code mime.types} file contained in the - * Spring jar). + * For example, you can specify a custom instance of Spring's {@link ConfigurableMimeFileTypeMap} here. If not + * explicitly specified, a default {@code ConfigurableMimeFileTypeMap} will be used, containing an extended set of + * MIME type mappings (as defined by the {@code mime.types} file contained in the Spring jar). * @param defaultFileTypeMap Java Activation file type map * @see MimeMessageHelper#setFileTypeMap */ diff --git a/spring-cloud-aws-ses/src/main/java/io/awspring/cloud/ses/SimpleEmailServiceMailSender.java b/spring-cloud-aws-ses/src/main/java/io/awspring/cloud/ses/SimpleEmailServiceMailSender.java index 1f04f40a8..94af9d85b 100644 --- a/spring-cloud-aws-ses/src/main/java/io/awspring/cloud/ses/SimpleEmailServiceMailSender.java +++ b/spring-cloud-aws-ses/src/main/java/io/awspring/cloud/ses/SimpleEmailServiceMailSender.java @@ -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. @@ -13,14 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.ses; import java.util.HashMap; import java.util.Map; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.mail.MailException; +import org.springframework.mail.MailSendException; +import org.springframework.mail.MailSender; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.util.StringUtils; import software.amazon.awssdk.services.ses.SesClient; import software.amazon.awssdk.services.ses.model.Body; import software.amazon.awssdk.services.ses.model.Content; @@ -30,18 +34,10 @@ import software.amazon.awssdk.services.ses.model.SendEmailResponse; import software.amazon.awssdk.services.ses.model.SesException; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.mail.MailException; -import org.springframework.mail.MailSendException; -import org.springframework.mail.MailSender; -import org.springframework.mail.SimpleMailMessage; -import org.springframework.util.StringUtils; - /** - * Simple MailSender implementation to send E-Mails with the Amazon Simple Email Service. - * This implementation has no dependencies to the Java Mail API. It can be used to send - * simple mail messages that doesn't have any attachment and therefore only consist of a - * text body and a subject line. + * Simple MailSender implementation to send E-Mails with the Amazon Simple Email Service. This implementation has no + * dependencies to the Java Mail API. It can be used to send simple mail messages that doesn't have any attachment and + * therefore only consist of a text body and a subject line. * * @author Agim Emruli * @author Eddú Meléndez diff --git a/spring-cloud-aws-ses/src/test/java/io/awspring/cloud/ses/SimpleEmailServiceJavaMailSenderTest.java b/spring-cloud-aws-ses/src/test/java/io/awspring/cloud/ses/SimpleEmailServiceJavaMailSenderTest.java index 182eeefae..9efce76ef 100644 --- a/spring-cloud-aws-ses/src/test/java/io/awspring/cloud/ses/SimpleEmailServiceJavaMailSenderTest.java +++ b/spring-cloud-aws-ses/src/test/java/io/awspring/cloud/ses/SimpleEmailServiceJavaMailSenderTest.java @@ -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. @@ -13,9 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.ses; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -23,34 +29,24 @@ import java.io.OutputStream; import java.util.Objects; import java.util.Properties; - import javax.activation.FileTypeMap; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.internet.MimeMessage; - import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; -import software.amazon.awssdk.services.ses.SesClient; -import software.amazon.awssdk.services.ses.model.SendRawEmailRequest; -import software.amazon.awssdk.services.ses.model.SendRawEmailResponse; -import software.amazon.awssdk.services.ses.model.SesException; - import org.springframework.mail.MailParseException; import org.springframework.mail.MailPreparationException; import org.springframework.mail.MailSendException; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessagePreparator; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import software.amazon.awssdk.services.ses.SesClient; +import software.amazon.awssdk.services.ses.model.SendRawEmailRequest; +import software.amazon.awssdk.services.ses.model.SendRawEmailResponse; +import software.amazon.awssdk.services.ses.model.SesException; /** * Tests for class {@link SimpleEmailServiceJavaMailSender}. diff --git a/spring-cloud-aws-ses/src/test/java/io/awspring/cloud/ses/SimpleEmailServiceMailSenderTest.java b/spring-cloud-aws-ses/src/test/java/io/awspring/cloud/ses/SimpleEmailServiceMailSenderTest.java index 82991a123..b529e2264 100644 --- a/spring-cloud-aws-ses/src/test/java/io/awspring/cloud/ses/SimpleEmailServiceMailSenderTest.java +++ b/spring-cloud-aws-ses/src/test/java/io/awspring/cloud/ses/SimpleEmailServiceMailSenderTest.java @@ -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. @@ -13,29 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package io.awspring.cloud.ses; -import java.util.Objects; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import java.util.Objects; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; +import org.springframework.mail.MailSendException; +import org.springframework.mail.SimpleMailMessage; import software.amazon.awssdk.services.ses.SesClient; import software.amazon.awssdk.services.ses.model.SendEmailRequest; import software.amazon.awssdk.services.ses.model.SendEmailResponse; import software.amazon.awssdk.services.ses.model.SesException; -import org.springframework.mail.MailSendException; -import org.springframework.mail.SimpleMailMessage; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - /** * Tests for {@link SimpleEmailServiceMailSender}. *