This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new b0ec4e5 Migrates the camel-aws2-s3 tests to the shared test infra
(#4656)
b0ec4e5 is described below
commit b0ec4e5b5ca4925ff2f529fcd95f9d38e09b3b51
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Mon Nov 23 09:45:58 2020 +0100
Migrates the camel-aws2-s3 tests to the shared test infra (#4656)
---
components/camel-aws2-s3/pom.xml | 24 +++++++++-
.../aws2/s3/localstack/Aws2S3BaseTest.java | 54 ++++------------------
2 files changed, 31 insertions(+), 47 deletions(-)
diff --git a/components/camel-aws2-s3/pom.xml b/components/camel-aws2-s3/pom.xml
index 3f9f71a..c8b8feb 100644
--- a/components/camel-aws2-s3/pom.xml
+++ b/components/camel-aws2-s3/pom.xml
@@ -69,12 +69,32 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-testcontainers-junit5</artifactId>
+ <artifactId>camel-zip-deflater</artifactId>
<scope>test</scope>
</dependency>
+
+ <!-- test infra -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-zip-deflater</artifactId>
+ <artifactId>camel-test-infra-common</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-infra-aws-common</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-infra-aws-v2</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
diff --git
a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/Aws2S3BaseTest.java
b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/Aws2S3BaseTest.java
index f56e259..4258b58 100644
---
a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/Aws2S3BaseTest.java
+++
b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/Aws2S3BaseTest.java
@@ -16,61 +16,25 @@
*/
package org.apache.camel.component.aws2.s3.localstack;
-import java.net.URI;
-
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws2.s3.AWS2S3Component;
-import org.apache.camel.test.testcontainers.junit5.ContainerAwareTestSupport;
-import org.apache.camel.test.testcontainers.junit5.Wait;
+import org.apache.camel.test.infra.aws.common.services.AWSService;
+import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
+import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.TestInstance;
-import org.testcontainers.containers.GenericContainer;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.s3.S3Client;
+import org.junit.jupiter.api.extension.RegisterExtension;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class Aws2S3BaseTest extends ContainerAwareTestSupport {
-
- public static final String CONTAINER_IMAGE =
"localstack/localstack:0.12.2";
- public static final String CONTAINER_NAME = "s3";
-
- @Override
- protected GenericContainer<?> createContainer() {
- return localstackContainer();
- }
-
- public static GenericContainer localstackContainer() {
- return new GenericContainer(CONTAINER_IMAGE)
- .withNetworkAliases(CONTAINER_NAME)
- .withEnv("SERVICES", "s3")
- .withExposedPorts(4566)
- .waitingFor(Wait.forListeningPort())
- .waitingFor(Wait.forLogMessageContaining("Ready.", 1));
- }
-
- public String getS3Url() {
- return String.format(
- "%s:%d",
- getContainerHost(CONTAINER_NAME),
- getContainerPort(CONTAINER_NAME, 4566));
- }
-
- public S3Client getS3Client() {
- S3Client s3Client = S3Client
- .builder()
- .endpointOverride(URI.create("http://" + getS3Url()))
-
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("xxx",
"yyy")))
- .region(Region.EU_WEST_1)
- .build();
- return s3Client;
- }
+public class Aws2S3BaseTest extends CamelTestSupport {
+ @RegisterExtension
+ public static AWSService service = AWSServiceFactory.createS3Service();
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
AWS2S3Component s3 = context.getComponent("aws2-s3",
AWS2S3Component.class);
- s3.getConfiguration().setAmazonS3Client(getS3Client());
+
s3.getConfiguration().setAmazonS3Client(AWSSDKClientUtils.newS3Client());
return context;
}
}