You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/02/04 15:39:27 UTC
[camel-quarkus] 01/02: Test AWS 2 S3 properly
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 17408075ebbf804a0822f1366e5c806e1173e0be
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Feb 3 20:33:48 2021 +0100
Test AWS 2 S3 properly
---
integration-tests/aws2-s3/README.adoc | 21 ++++
integration-tests/aws2-s3/pom.xml | 140 +++++++++++++++++++++
.../quarkus/component/aws2/Aws2S3Resource.java | 116 +++++++++++++++++
.../src/main/resources/application.properties | 23 ++++
.../camel/quarkus/component/aws2/Aws2S3IT.java | 24 ++++
.../camel/quarkus/component/aws2/Aws2S3Test.java | 127 +++++++++++++++++++
.../quarkus/component/aws2/AwsTestResource.java | 106 ++++++++++++++++
integration-tests/aws2/pom.xml | 17 ---
.../camel/quarkus/component/aws2/CamelRoute.java | 6 -
.../aws2/src/main/resources/application.properties | 4 -
integration-tests/pom.xml | 1 +
pom.xml | 3 +-
poms/bom-test/pom.xml | 10 ++
tooling/scripts/test-categories.yaml | 1 +
14 files changed, 571 insertions(+), 28 deletions(-)
diff --git a/integration-tests/aws2-s3/README.adoc b/integration-tests/aws2-s3/README.adoc
new file mode 100644
index 0000000..c583472
--- /dev/null
+++ b/integration-tests/aws2-s3/README.adoc
@@ -0,0 +1,21 @@
+== AWS 2 S3 integration tests
+
+By default, the tests are run against a https://github.com/localstack/localstack[Localstack] container.
+
+To run the tests against the real AWS API, you need to
+
+* Export Your
+ https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys[AWS credentials]
+ (access key ID and secret access key)
+* Export our preferred
+ https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions[AWS region].
+
+[source,shell]
+----
+export AWS_ACCESS_KEY=<your-access-key-id>
+export AWS_SECRET_KEY=<your-secret-access-key>
+export AWS_REGION=eu-central-1
+----
+
+You may want to `export CAMEL_QUARKUS_START_MOCK_BACKEND=false` to force testing against
+the real AWS API.
\ No newline at end of file
diff --git a/integration-tests/aws2-s3/pom.xml b/integration-tests/aws2-s3/pom.xml
new file mode 100644
index 0000000..f7afa20
--- /dev/null
+++ b/integration-tests/aws2-s3/pom.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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
+
+ http://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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-integration-test-aws2-s3</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: AWS2 S3</name>
+ <description>The camel integration tests</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-main</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-s3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jackson</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-testcontainers-support</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-test-support-mock-backend</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>localstack</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency><!-- Workaround for https://github.com/testcontainers/testcontainers-java/issues/1442 -->
+ <groupId>com.amazonaws</groupId>
+ <artifactId>aws-java-sdk-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-s3-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-main-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/Aws2S3Resource.java b/integration-tests/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/Aws2S3Resource.java
new file mode 100644
index 0000000..8d7903f
--- /dev/null
+++ b/integration-tests/aws2-s3/src/main/java/org/apache/camel/quarkus/component/aws2/Aws2S3Resource.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ * http://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.
+ */
+package org.apache.camel.quarkus.component.aws2;
+
+import java.net.URI;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.aws2.s3.AWS2S3Constants;
+import org.apache.camel.component.aws2.s3.AWS2S3Operations;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import software.amazon.awssdk.services.s3.model.S3Object;
+
+@Path("/aws2")
+@ApplicationScoped
+public class Aws2S3Resource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Inject
+ ConsumerTemplate consumerTemplate;
+
+ @ConfigProperty(name = "aws-s3.bucket-name")
+ String bucketName;
+
+ @Path("s3/object/{key}")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ public Response post(String message, @PathParam("key") String key) throws Exception {
+ producerTemplate.sendBodyAndHeader(componentUri(),
+ message,
+ AWS2S3Constants.KEY,
+ key);
+ return Response.created(new URI("https://camel.apache.org/")).build();
+ }
+
+ @Path("s3/object/{key}")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String get(@PathParam("key") String key) throws Exception {
+ return producerTemplate.requestBodyAndHeader(
+ componentUri(AWS2S3Operations.getObject),
+ null,
+ AWS2S3Constants.KEY,
+ key,
+ String.class);
+ }
+
+ @Path("s3/poll-object/{key}")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String pollObject(@PathParam("key") String key) throws Exception {
+ return consumerTemplate.receiveBody(componentUri() + "?fileName=" + key, 10000, String.class);
+ }
+
+ @Path("s3/object/{key}")
+ @DELETE
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response read(@PathParam("key") String key) throws Exception {
+ producerTemplate.sendBodyAndHeader(
+ componentUri(AWS2S3Operations.deleteObject),
+ null,
+ AWS2S3Constants.KEY,
+ key);
+ return Response.noContent().build();
+ }
+
+ @Path("s3/object-keys")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public List<String> objectKey() throws Exception {
+ final List<S3Object> objects = (List<S3Object>) producerTemplate.requestBody(
+ componentUri(AWS2S3Operations.listObjects),
+ null,
+ List.class);
+ return objects.stream().map(S3Object::key).collect(Collectors.toList());
+ }
+
+ private String componentUri(final AWS2S3Operations operation) {
+ return String.format("aws2-s3://%s?operation=%s", bucketName, operation);
+ }
+
+ private String componentUri() {
+ return String.format("aws2-s3://%s", bucketName);
+ }
+
+}
diff --git a/integration-tests/aws2-s3/src/main/resources/application.properties b/integration-tests/aws2-s3/src/main/resources/application.properties
new file mode 100644
index 0000000..967305c
--- /dev/null
+++ b/integration-tests/aws2-s3/src/main/resources/application.properties
@@ -0,0 +1,23 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You 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
+##
+## http://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.
+## ---------------------------------------------------------------------------
+
+#
+# Camel :: AWS2 options
+#
+camel.component.aws2-s3.access-key=${AWS_ACCESS_KEY}
+camel.component.aws2-s3.secret-key=${AWS_SECRET_KEY}
+camel.component.aws2-s3.region=${AWS_REGION:us-east-1}
diff --git a/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/Aws2S3IT.java b/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/Aws2S3IT.java
new file mode 100644
index 0000000..3e29975
--- /dev/null
+++ b/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/Aws2S3IT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ * http://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.
+ */
+package org.apache.camel.quarkus.component.aws2;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class Aws2S3IT extends Aws2S3Test {
+
+}
diff --git a/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/Aws2S3Test.java b/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/Aws2S3Test.java
new file mode 100644
index 0000000..98d1233
--- /dev/null
+++ b/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/Aws2S3Test.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ * http://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.
+ */
+package org.apache.camel.quarkus.component.aws2;
+
+import java.util.UUID;
+import java.util.stream.Stream;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.core.Is.is;
+
+@QuarkusTest
+@QuarkusTestResource(AwsTestResource.class)
+class Aws2S3Test {
+
+ @Test
+ public void crud() {
+
+ final String oid = UUID.randomUUID().toString();
+ final String blobContent = "Hello " + oid;
+
+ // Make sure the object does not exist yet
+ final String[] objects = RestAssured.given()
+ .get("/aws2/s3/object-keys")
+ .then()
+ .statusCode(200)
+ .extract()
+ .body().as(String[].class);
+ Assertions.assertTrue(Stream.of(objects).noneMatch(key -> key.equals(oid)));
+
+ // Create
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(blobContent)
+ .post("/aws2/s3/object/" + oid)
+ .then()
+ .statusCode(201);
+
+ // Read
+ RestAssured.get("/aws2/s3/object/" + oid)
+ .then()
+ .statusCode(200)
+ .body(is(blobContent));
+
+ // Update
+ final String updatedContent = blobContent + " updated";
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(updatedContent)
+ .post("/aws2/s3/object/" + oid)
+ .then()
+ .statusCode(201);
+
+ // Read updated
+ RestAssured.get("/aws2/s3/object/" + oid)
+ .then()
+ .statusCode(200)
+ .body(is(updatedContent));
+
+ // Delete
+ RestAssured.delete("/aws2/s3/object/" + oid)
+ .then()
+ .statusCode(204);
+ }
+
+ @Test
+ public void consumer() {
+ final String oid = UUID.randomUUID().toString();
+ final String blobContent = "Hello " + oid;
+
+ // Make sure the object does not exist yet
+ {
+ final String[] objects = RestAssured.given()
+ .get("/aws2/s3/object-keys")
+ .then()
+ .statusCode(200)
+ .extract()
+ .body().as(String[].class);
+ Assertions.assertTrue(Stream.of(objects).noneMatch(key -> key.equals(oid)));
+ }
+
+ // Create
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(blobContent)
+ .post("/aws2/s3/object/" + oid)
+ .then()
+ .statusCode(201);
+
+ // Consumer
+ RestAssured.get("/aws2/s3/poll-object/" + oid)
+ .then()
+ .statusCode(200)
+ .body(is(blobContent));
+
+ // Make sure the consumer has removed the file from the bucket
+ {
+ final String[] objects = RestAssured.given()
+ .get("/aws2/s3/object-keys")
+ .then()
+ .statusCode(200)
+ .extract()
+ .body().as(String[].class);
+ Assertions.assertTrue(Stream.of(objects).noneMatch(key -> key.equals(oid)));
+ }
+ }
+
+}
diff --git a/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/AwsTestResource.java b/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/AwsTestResource.java
new file mode 100644
index 0000000..ae20d3c
--- /dev/null
+++ b/integration-tests/aws2-s3/src/test/java/org/apache/camel/quarkus/component/aws2/AwsTestResource.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ * http://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.
+ */
+package org.apache.camel.quarkus.component.aws2;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.camel.quarkus.test.mock.backend.MockBackendUtils;
+import org.apache.camel.quarkus.testcontainers.ContainerResourceLifecycleManager;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.testcontainers.containers.localstack.LocalStackContainer;
+import org.testcontainers.containers.localstack.LocalStackContainer.Service;
+import org.testcontainers.utility.DockerImageName;
+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 software.amazon.awssdk.services.s3.model.CreateBucketRequest;
+import software.amazon.awssdk.services.s3.model.DeleteBucketRequest;
+
+public class AwsTestResource implements ContainerResourceLifecycleManager {
+
+ private LocalStackContainer localstack;
+ private S3Client s3Client;
+ private String bucketName;
+
+ @SuppressWarnings("resource")
+ @Override
+ public Map<String, String> start() {
+ final String realKey = System.getenv("AWS_ACCESS_KEY");
+ final String realSecret = System.getenv("AWS_SECRET_KEY");
+ final String realRegion = System.getenv("AWS_REGION");
+ final boolean realCredentialsProvided = realKey != null && realSecret != null && realRegion != null;
+ final boolean startMockBackend = MockBackendUtils.startMockBackend(false);
+ final Map<String, String> result = new LinkedHashMap<>();
+
+ bucketName = "camel-quarkus-" + RandomStringUtils.randomAlphanumeric(49).toLowerCase(Locale.ROOT);
+
+ if (startMockBackend && !realCredentialsProvided) {
+ MockBackendUtils.logMockBackendUsed();
+ localstack = new LocalStackContainer(DockerImageName.parse("localstack/localstack:0.11.3"))
+ .withServices(Service.S3);
+ localstack.start();
+
+ result.put("camel.component.aws2-s3.access-key", localstack.getAccessKey());
+ result.put("camel.component.aws2-s3.secret-key", localstack.getSecretKey());
+ result.put("camel.component.aws2-s3.override-endpoint", "true");
+ result.put("camel.component.aws2-s3.uri-endpoint-override", localstack.getEndpointOverride(Service.S3).toString());
+ result.put("camel.component.aws2-s3.region", localstack.getRegion());
+
+ s3Client = S3Client
+ .builder()
+ .endpointOverride(localstack.getEndpointOverride(LocalStackContainer.Service.S3))
+ .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(
+ localstack.getAccessKey(), localstack.getSecretKey())))
+ .region(Region.of(localstack.getRegion()))
+ .build();
+
+ } else {
+ if (!startMockBackend && !realCredentialsProvided) {
+ throw new IllegalStateException(
+ "Set AWS_ACCESS_KEY, AWS_SECRET_KEY and AWS_REGION env vars if you set CAMEL_QUARKUS_START_MOCK_BACKEND=false");
+ }
+ MockBackendUtils.logRealBackendUsed();
+ s3Client = S3Client
+ .builder()
+ .credentialsProvider(
+ StaticCredentialsProvider.create(AwsBasicCredentials.create(realKey, realSecret)))
+ .region(Region.of(realRegion))
+ .build();
+ }
+
+ s3Client.createBucket(CreateBucketRequest.builder().bucket(bucketName).build());
+
+ result.put("aws-s3.bucket-name", bucketName);
+
+ return Collections.unmodifiableMap(result);
+ }
+
+ @Override
+ public void stop() {
+ if (s3Client != null) {
+ s3Client.deleteBucket(DeleteBucketRequest.builder().bucket(bucketName).build());
+ s3Client.close();
+ }
+ if (localstack != null && localstack.isRunning()) {
+ localstack.stop();
+ }
+ }
+}
diff --git a/integration-tests/aws2/pom.xml b/integration-tests/aws2/pom.xml
index bb443e9..95e8a69 100644
--- a/integration-tests/aws2/pom.xml
+++ b/integration-tests/aws2/pom.xml
@@ -84,10 +84,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-aws2-s3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-sns</artifactId>
</dependency>
<dependency>
@@ -278,19 +274,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-aws2-s3-deployment</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-sns-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
diff --git a/integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws2/CamelRoute.java b/integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws2/CamelRoute.java
index a47939e..c30ec40 100644
--- a/integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws2/CamelRoute.java
+++ b/integration-tests/aws2/src/main/java/org/apache/camel/quarkus/component/aws2/CamelRoute.java
@@ -31,12 +31,6 @@ public class CamelRoute extends RouteBuilder {
.to("aws2-sqs://camel-1?delaySeconds=5")
.to("log:sf?showAll=true");
- from("timer:quarkus-s3?repeatCount=1")
- .setHeader("CamelAwsS3Key", constant("testquarkus"))
- .setBody(constant("Quarkus is great!"))
- .to("aws2-s3://camel-kafka-connector")
- .to("log:sf?showAll=true");
-
from("timer:quarkus-sns?repeatCount=1")
.setBody(constant("Quarkus is great!"))
.to("aws2-sns://topic1")
diff --git a/integration-tests/aws2/src/main/resources/application.properties b/integration-tests/aws2/src/main/resources/application.properties
index db11723..3df0357 100644
--- a/integration-tests/aws2/src/main/resources/application.properties
+++ b/integration-tests/aws2/src/main/resources/application.properties
@@ -18,10 +18,6 @@
#
# Camel :: AWS2 options
#
-camel.component.aws2-s3.access-key={{env:AWS_ACCESS_KEY}}
-camel.component.aws2-s3.secret-key={{env:AWS_SECRET_KEY}}
-camel.component.aws2-s3.region={{env:AWS_REGION}}
-
camel.component.aws2-sqs.access-key={{env:AWS_ACCESS_KEY}}
camel.component.aws2-sqs.secret-key={{env:AWS_SECRET_KEY}}
camel.component.aws2-sqs.region={{env:AWS_REGION}}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index fbae048..ccb619b 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -68,6 +68,7 @@
<module>avro-rpc</module>
<module>aws</module>
<module>aws2</module>
+ <module>aws2-s3</module>
<module>azure</module>
<module>azure-eventhubs</module>
<module>azure-storage-blob</module>
diff --git a/pom.xml b/pom.xml
index 869dbaa..04b09b5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,7 +42,8 @@
<animal-sniffer.version>1.18</animal-sniffer.version>
<antlr3.version>3.5.2</antlr3.version><!-- Spark, Stringtemplate and probably others -->
<avro.version>${avro-version}</avro.version>
- <awssdk1-swf-libs.version>1.11.22</awssdk1-swf-libs.version>
+ <aws-java-sdk.version>${aws-java-sdk-version}</aws-java-sdk.version>
+ <awssdk1-swf-libs.version>${aws-java-sdk-swf-libs}</awssdk1-swf-libs.version>
<!-- TODO: Use azure-sdk-bom once they start maintaining it properly https://github.com/Azure/azure-sdk-for-java/issues/18759 -->
<azure-core.version>1.8.1</azure-core.version><!-- keep compatible with the azure artifacts below -->
<azure-sdk-bom.version>1.0.1</azure-sdk-bom.version>
diff --git a/poms/bom-test/pom.xml b/poms/bom-test/pom.xml
index 5923b9d..1eecbb0 100644
--- a/poms/bom-test/pom.xml
+++ b/poms/bom-test/pom.xml
@@ -164,6 +164,11 @@
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
+ <artifactId>localstack</artifactId>
+ <version>${testcontainers.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
<artifactId>mongodb</artifactId>
<version>${testcontainers.version}</version>
</dependency>
@@ -216,6 +221,11 @@
<artifactId>zt-exec</artifactId>
<version>${zt-exec.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.amazonaws</groupId>
+ <artifactId>aws-java-sdk-core</artifactId>
+ <version>${aws-java-sdk.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 5f959ae..b17b719 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -164,6 +164,7 @@ platform:
- rest
- rest-openapi
- csimple
+ - aws2-s3
saas:
- box
- github