This is an automated email from the ASF dual-hosted git repository. ppalaga pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 9d8f38a405f2c24b361a2030a1f455cdbf129bb6 Author: JiriOndrusek <[email protected]> AuthorDate: Mon Oct 25 09:30:00 2021 +0200 Check whether/how the clients for Quarkus AWS extension can be used in Camel routes #2592 --- .../aws2-quarkus-client/aws2-ses}/pom.xml | 70 +++++----------- .../aws2/ses/it/Aws2SesQuarkusClientInvoker.java | 29 +++++++ .../src/main/resources/application.properties | 20 +++++ .../it/Aws2SesQuarkusClientTestEnvCustomizer.java | 56 +++++++++++++ ...quarkus.test.support.aws2.Aws2TestEnvCustomizer | 1 + .../aws2-quarkus-client/aws2-sqs-sns}/pom.xml | 65 ++++++-------- .../aws2/sqs/it/Aws2SqsQuarkusClientInvoker.java | 33 ++++++++ .../src/main/resources/application.properties | 19 +++++ .../it/Aws2SqsQuarkusClientTestEnvCustomizer.java | 62 ++++++++++++++ ...quarkus.test.support.aws2.Aws2TestEnvCustomizer | 1 + .../aws2-quarkus-client-grouped/pom.xml | 98 ++++++++++++++++++++++ tooling/scripts/copy-tests.groovy | 50 +++++++++++ 12 files changed, 415 insertions(+), 89 deletions(-) diff --git a/integration-tests/aws2-quarkus-client-grouped/pom.xml b/integration-test-groups/aws2-quarkus-client/aws2-ses/pom.xml similarity index 70% copy from integration-tests/aws2-quarkus-client-grouped/pom.xml copy to integration-test-groups/aws2-quarkus-client/aws2-ses/pom.xml index 0beaca2..e0ebbb4 100644 --- a/integration-tests/aws2-quarkus-client-grouped/pom.xml +++ b/integration-test-groups/aws2-quarkus-client/aws2-ses/pom.xml @@ -22,23 +22,22 @@ <parent> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-build-parent-it</artifactId> - <version>2.5.0-SNAPSHOT</version> - <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + <version>2.4.0-SNAPSHOT</version> + <relativePath>../../../poms/build-parent-it/pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-integration-test-aws2-quarkus-client-grouped</artifactId> - <name>Camel Quarkus :: Integration Tests :: AWS2 Quarkus Client Grouped</name> - <description>AWS 2 tests from ../integration-test-groups/aws2-quarkus-client merged together</description> + <artifactId>camel-quarkus-integration-test-aws2-ses-quarkus-client</artifactId> + <name>Camel Quarkus :: Integration Tests :: Simple Email Service (SES) Quarkus Client</name> + <description>Integration tests for Camel Quarkus AWS Simple Email Service (SES) extension with the Quarkus AWS SES client</description> - <!-- Regenerate the dependencies via `mvn process-resources -Pformat -N` from the source tree root directory --> <dependencies> <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-amazon-dynamodb</artifactId> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ses</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> - <artifactId>quarkus-amazon-s3</artifactId> + <artifactId>quarkus-amazon-ses</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> @@ -48,18 +47,8 @@ <groupId>io.quarkus</groupId> <artifactId>quarkus-resteasy-jackson</artifactId> </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-aws2-ddb</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-aws2-kms</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-aws2-s3</artifactId> - </dependency> + + <!-- test dependencies --> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-junit5</artifactId> @@ -80,37 +69,16 @@ <artifactId>awaitility</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-ddb-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>htmlunit-driver</artifactId> <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-aws2-kms-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> </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> + <artifactId>camel-quarkus-aws2-ses-deployment</artifactId> <version>${project.version}</version> <type>pom</type> <scope>test</scope> @@ -166,11 +134,11 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> + <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> - <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2-quarkus-client</group-tests.source.dir> - <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> - <group-tests.concat.rel.paths>src/main/resources/application.properties,src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer</group-tests.concat.rel.paths> + <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-ses</copy-tests.source.dir> + <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> + <copy-tests.excludes>**/*TestEnvCustomizer,**/*application.properties</copy-tests.excludes> </properties> </configuration> </execution> diff --git a/integration-test-groups/aws2-quarkus-client/aws2-ses/src/main/java/org/apache/camel/quarkus/component/aws2/ses/it/Aws2SesQuarkusClientInvoker.java b/integration-test-groups/aws2-quarkus-client/aws2-ses/src/main/java/org/apache/camel/quarkus/component/aws2/ses/it/Aws2SesQuarkusClientInvoker.java new file mode 100644 index 0000000..960fd4b --- /dev/null +++ b/integration-test-groups/aws2-quarkus-client/aws2-ses/src/main/java/org/apache/camel/quarkus/component/aws2/ses/it/Aws2SesQuarkusClientInvoker.java @@ -0,0 +1,29 @@ +/* + * 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.ses.it; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; + +import software.amazon.awssdk.services.ses.SesClient; + +@ApplicationScoped +public class Aws2SesQuarkusClientInvoker { + + @Inject + SesClient ses; +} diff --git a/integration-test-groups/aws2-quarkus-client/aws2-ses/src/main/resources/application.properties b/integration-test-groups/aws2-quarkus-client/aws2-ses/src/main/resources/application.properties new file mode 100644 index 0000000..3cc8487 --- /dev/null +++ b/integration-test-groups/aws2-quarkus-client/aws2-ses/src/main/resources/application.properties @@ -0,0 +1,20 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +mailslurp.api.key=${MAILSLURP_API_KEY} + +quarkus.ses.sync-client.type=apache diff --git a/integration-test-groups/aws2-quarkus-client/aws2-ses/src/test/java/org/apache/camel/quarkus/component/aws2/ses/it/Aws2SesQuarkusClientTestEnvCustomizer.java b/integration-test-groups/aws2-quarkus-client/aws2-ses/src/test/java/org/apache/camel/quarkus/component/aws2/ses/it/Aws2SesQuarkusClientTestEnvCustomizer.java new file mode 100644 index 0000000..33cc9dc --- /dev/null +++ b/integration-test-groups/aws2-quarkus-client/aws2-ses/src/test/java/org/apache/camel/quarkus/component/aws2/ses/it/Aws2SesQuarkusClientTestEnvCustomizer.java @@ -0,0 +1,56 @@ +/* + * 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.ses.it; + +import java.util.Map; +import java.util.Optional; + +import org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvContext; +import org.testcontainers.containers.localstack.LocalStackContainer.Service; + +public class Aws2SesQuarkusClientTestEnvCustomizer extends Aws2SesTestEnvCustomizer { + + @Override + public Service[] localstackServices() { + return super.localstackServices(); + } + + @Override + public void customize(Aws2TestEnvContext envContext) { + + super.customize(envContext); + + Map<String, String> envContextProperties = envContext.getProperies(); + + envContext.property("quarkus.ses.aws.credentials.static-provider.access-key-id", envContext.getAccessKey()); + envContext.property("quarkus.ses.aws.credentials.static-provider.secret-access-key", envContext.getSecretKey()); + envContext.property("quarkus.ses.aws.region", envContext.getRegion()); + envContext.property("quarkus.ses.aws.credentials.type", "static"); + + // Propagate localstack environment config to Quarkus AWS if required + Optional<String> overrideEndpoint = envContextProperties + .keySet() + .stream() + .filter(key -> key.endsWith("uri-endpoint-override")) + .findFirst(); + + if (overrideEndpoint.isPresent()) { + String endpoint = envContextProperties.get(overrideEndpoint.get()); + envContext.property("quarkus.ses.endpoint-override", endpoint); + } + } +} diff --git a/integration-test-groups/aws2-quarkus-client/aws2-ses/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer b/integration-test-groups/aws2-quarkus-client/aws2-ses/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer new file mode 100644 index 0000000..5483ca8 --- /dev/null +++ b/integration-test-groups/aws2-quarkus-client/aws2-ses/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer @@ -0,0 +1 @@ +org.apache.camel.quarkus.component.aws2.ses.it.Aws2SesQuarkusClientTestEnvCustomizer \ No newline at end of file diff --git a/integration-tests/aws2-quarkus-client-grouped/pom.xml b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/pom.xml similarity index 77% copy from integration-tests/aws2-quarkus-client-grouped/pom.xml copy to integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/pom.xml index 0beaca2..48dd4ac 100644 --- a/integration-tests/aws2-quarkus-client-grouped/pom.xml +++ b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/pom.xml @@ -22,44 +22,41 @@ <parent> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-build-parent-it</artifactId> - <version>2.5.0-SNAPSHOT</version> - <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + <version>2.4.0-SNAPSHOT</version> + <relativePath>../../../poms/build-parent-it/pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-integration-test-aws2-quarkus-client-grouped</artifactId> - <name>Camel Quarkus :: Integration Tests :: AWS2 Quarkus Client Grouped</name> - <description>AWS 2 tests from ../integration-test-groups/aws2-quarkus-client merged together</description> + <artifactId>camel-quarkus-integration-test-aws2-ses-quarkus-client</artifactId> + <name>Camel Quarkus :: Integration Tests :: Simple Email Service (SES) Quarkus Client</name> + <description>Integration tests for Camel Quarkus AWS Simple Email Service (SES) extension with the Quarkus AWS SES client</description> - <!-- Regenerate the dependencies via `mvn process-resources -Pformat -N` from the source tree root directory --> <dependencies> <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-amazon-dynamodb</artifactId> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-sqs</artifactId> </dependency> <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-amazon-s3</artifactId> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-sns</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> - <artifactId>quarkus-resteasy</artifactId> + <artifactId>quarkus-amazon-sqs</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> - <artifactId>quarkus-resteasy-jackson</artifactId> + <artifactId>quarkus-amazon-sns</artifactId> </dependency> <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-aws2-ddb</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-aws2-kms</artifactId> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> </dependency> <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-aws2-s3</artifactId> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy-jackson</artifactId> </dependency> + + <!-- test dependencies --> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-junit5</artifactId> @@ -80,24 +77,16 @@ <artifactId>awaitility</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-ddb-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>htmlunit-driver</artifactId> <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> </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-kms-deployment</artifactId> + <artifactId>camel-quarkus-aws2-sqs-deployment</artifactId> <version>${project.version}</version> <type>pom</type> <scope>test</scope> @@ -110,7 +99,7 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-aws2-s3-deployment</artifactId> + <artifactId>camel-quarkus-aws2-sns-deployment</artifactId> <version>${project.version}</version> <type>pom</type> <scope>test</scope> @@ -166,11 +155,11 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> + <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> - <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2-quarkus-client</group-tests.source.dir> - <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> - <group-tests.concat.rel.paths>src/main/resources/application.properties,src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer</group-tests.concat.rel.paths> + <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-sqs-sns</copy-tests.source.dir> + <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> + <copy-tests.excludes>**/*TestEnvCustomizer,**/*application.properties</copy-tests.excludes> </properties> </configuration> </execution> diff --git a/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/main/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsQuarkusClientInvoker.java b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/main/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsQuarkusClientInvoker.java new file mode 100644 index 0000000..1f3085e --- /dev/null +++ b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/main/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsQuarkusClientInvoker.java @@ -0,0 +1,33 @@ +/* + * 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.sqs.it; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; + +import software.amazon.awssdk.services.sns.SnsClient; +import software.amazon.awssdk.services.sqs.SqsClient; + +@ApplicationScoped +public class Aws2SqsQuarkusClientInvoker { + + @Inject + SqsClient sqs; + + @Inject + SnsClient sns; +} diff --git a/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/main/resources/application.properties b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/main/resources/application.properties new file mode 100644 index 0000000..0dfe02f --- /dev/null +++ b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/main/resources/application.properties @@ -0,0 +1,19 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +quarkus.sns.sync-client.type=apache +quarkus.sqs.sync-client.type=apache diff --git a/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsQuarkusClientTestEnvCustomizer.java b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsQuarkusClientTestEnvCustomizer.java new file mode 100644 index 0000000..4a874fd --- /dev/null +++ b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsQuarkusClientTestEnvCustomizer.java @@ -0,0 +1,62 @@ +/* + * 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.sqs.it; + +import java.util.Map; +import java.util.Optional; + +import org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvContext; +import org.testcontainers.containers.localstack.LocalStackContainer.Service; + +public class Aws2SqsQuarkusClientTestEnvCustomizer extends Aws2SqsSnsTestEnvCustomizer { + + @Override + public Service[] localstackServices() { + return super.localstackServices(); + } + + @Override + public void customize(Aws2TestEnvContext envContext) { + + super.customize(envContext); + + Map<String, String> envContextProperties = envContext.getProperies(); + + envContext.property("quarkus.sns.aws.credentials.static-provider.access-key-id", envContext.getAccessKey()); + envContext.property("quarkus.sns.aws.credentials.static-provider.secret-access-key", envContext.getSecretKey()); + envContext.property("quarkus.sns.aws.region", envContext.getRegion()); + envContext.property("quarkus.sns.aws.credentials.type", "static"); + + envContext.property("quarkus.sqs.aws.credentials.static-provider.access-key-id", envContext.getAccessKey()); + envContext.property("quarkus.sqs.aws.credentials.static-provider.secret-access-key", envContext.getSecretKey()); + envContext.property("quarkus.sqs.aws.region", envContext.getRegion()); + envContext.property("quarkus.sqs.aws.credentials.type", "static"); + + // Propagate localstack environment config to Quarkus AWS if required + Optional<String> overrideEndpoint = envContextProperties + .keySet() + .stream() + .filter(key -> key.endsWith("uri-endpoint-override")) + .findFirst(); + + if (overrideEndpoint.isPresent()) { + String endpoint = envContextProperties.get(overrideEndpoint.get()); + envContext.property("quarkus.sns.endpoint-override", endpoint); + envContext.property("quarkus.sqs.endpoint-override", endpoint); + } + } +} diff --git a/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer new file mode 100644 index 0000000..ffc9a76 --- /dev/null +++ b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer @@ -0,0 +1 @@ +org.apache.camel.quarkus.component.aws2.sqs.it.Aws2SqsQuarkusClientTestEnvCustomizer \ No newline at end of file diff --git a/integration-tests/aws2-quarkus-client-grouped/pom.xml b/integration-tests/aws2-quarkus-client-grouped/pom.xml index 0beaca2..5e0fd55 100644 --- a/integration-tests/aws2-quarkus-client-grouped/pom.xml +++ b/integration-tests/aws2-quarkus-client-grouped/pom.xml @@ -42,6 +42,18 @@ </dependency> <dependency> <groupId>io.quarkus</groupId> + <artifactId>quarkus-amazon-ses</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-amazon-sns</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-amazon-sqs</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> <artifactId>quarkus-resteasy</artifactId> </dependency> <dependency> @@ -58,6 +70,18 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ses</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-sns</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-sqs</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-s3</artifactId> </dependency> <dependency> @@ -80,6 +104,11 @@ <artifactId>awaitility</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.seleniumhq.selenium</groupId> + <artifactId>htmlunit-driver</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> @@ -121,6 +150,45 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ses-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> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-sqs-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> </dependencies> <build> @@ -174,6 +242,36 @@ </properties> </configuration> </execution> + <execution> + <id>copy-client-test-sources-ses</id> + <goals> + <goal>execute</goal> + </goals> + <phase>generate-sources</phase> + <configuration> + <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <properties> + <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-ses</copy-tests.source.dir> + <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> + <copy-tests.excludes>**/*TestEnvCustomizer,**/*application.properties</copy-tests.excludes> + </properties> + </configuration> + </execution> + <execution> + <id>copy-client-test-sources-sqs</id> + <goals> + <goal>execute</goal> + </goals> + <phase>generate-sources</phase> + <configuration> + <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <properties> + <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-sqs-sns</copy-tests.source.dir> + <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> + <copy-tests.excludes>**/*TestEnvCustomizer,**/*application.properties</copy-tests.excludes> + </properties> + </configuration> + </execution> </executions> </plugin> </plugins> diff --git a/tooling/scripts/copy-tests.groovy b/tooling/scripts/copy-tests.groovy new file mode 100644 index 0000000..2120b73 --- /dev/null +++ b/tooling/scripts/copy-tests.groovy @@ -0,0 +1,50 @@ +/* + * 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. + */ + +/** + * Group tests in a directory to a single Maven module + */ +import java.nio.file.Path +import java.nio.file.Paths +import java.nio.file.Files +import java.util.stream.Stream +import java.util.stream.Collectors +import java.util.regex.Pattern +import java.util.regex.Matcher +import groovy.ant.AntBuilder + +/* Copies source files from one source test modulesinto one destination module (`copy-tests.dest.module.dir`) + * so that the tests can be executed. Use of ('copy-tests.exclude') allows to exclude files. + */ + +final Path sourceDir = Paths.get(properties['copy-tests.source.dir']) +final Path destinationModuleDir = Paths.get(properties['copy-tests.dest.module.dir']) +final String excl = properties['copy-tests.excludes'] + +copyResources(sourceDir.resolve('src/main/resources'), destinationModuleDir.resolve('target/classes'), excl) +copyResources(sourceDir.resolve('src/main/java'), destinationModuleDir.resolve('target/src/main/java'), excl) +copyResources(sourceDir.resolve('src/test/java'), destinationModuleDir.resolve('target/src/test/java'), excl) +copyResources(sourceDir.resolve('src/test/resources'), destinationModuleDir.resolve('target/test-classes'), excl) + +static void copyResources(Path source, Path dest, String excl) { + if (Files.exists(source)) { + new AntBuilder().copy(todir: dest) { + fileset(dir: source, includes: "**", excludes: excl) + } + } +} +
