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/12 07:29:05 UTC

[camel-quarkus] branch master updated (86224bb -> 81b7c64)

This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git.


    from 86224bb  Updated CHANGELOG.md
     new 67e2636  Autogenerate the dependencies in the aws2-grouped test
     new 22124f1  Test AWS 2 DynamoDB properly
     new 81b7c64  Upgrade to cq-maven-plugin 0.30.0; now removes duplicate virtual deps comments

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 extensions-jvm/redis/integration-test/pom.xml      |   2 -
 extensions-jvm/spark/integration-test/pom.xml      |   2 -
 .../aws2-ddb}/pom.xml                              |  31 ++---
 .../component/aws2/ddb/it/Aws2DdbResource.java     | 151 +++++++++++++++++++++
 .../src/main/resources/application.properties      |   9 +-
 .../quarkus/component/aws2/ddb/it/Aws2DdbIT.java}  |   4 +-
 .../quarkus/component/aws2/ddb/it/Aws2DdbTest.java | 109 +++++++++++++++
 .../aws2/ddb/it/Aws2DdbTestEnvCustomizer.java      |  80 +++++++++++
 ...quarkus.test.support.aws2.Aws2TestEnvCustomizer |   1 +
 integration-tests-aws2/aws2-sqs-sns/pom.xml        |   6 +-
 integration-tests-aws2/pom.xml                     |   1 +
 .../test/support/aws2/Aws2TestEnvContext.java      |  16 ++-
 integration-tests/aws2-grouped/README.adoc         |   7 +-
 integration-tests/aws2-grouped/pom.xml             |  61 ++++-----
 integration-tests/cassandraql/pom.xml              |  15 --
 integration-tests/debezium/pom.xml                 |   2 -
 integration-tests/hazelcast/pom.xml                |   2 -
 integration-tests/jsonata/pom.xml                  |   2 -
 integration-tests/leveldb/pom.xml                  |   2 -
 integration-tests/msv/pom.xml                      |   2 -
 integration-tests/nsq/pom.xml                      |   2 -
 integration-tests/pgevent/pom.xml                  |   2 -
 integration-tests/rest/pom.xml                     |   2 -
 integration-tests/saga/pom.xml                     |   2 -
 integration-tests/shiro/pom.xml                    |   2 -
 integration-tests/univocity-parsers/pom.xml        |   2 -
 integration-tests/weather/pom.xml                  |   4 -
 pom.xml                                            |  13 +-
 tooling/scripts/group-tests.groovy                 |  16 +++
 29 files changed, 435 insertions(+), 115 deletions(-)
 copy {integration-tests/spring-rabbitmq => integration-tests-aws2/aws2-ddb}/pom.xml (86%)
 create mode 100644 integration-tests-aws2/aws2-ddb/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbResource.java
 copy {integration-tests/bean => integration-tests-aws2/aws2-ddb}/src/main/resources/application.properties (85%)
 copy integration-tests-aws2/{aws2-sqs-sns/src/test/java/org/apache/camel/quarkus/component/aws2/sqs/it/Aws2SqsSnsIT.java => aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbIT.java} (91%)
 create mode 100644 integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java
 create mode 100644 integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTestEnvCustomizer.java
 create mode 100644 integration-tests-aws2/aws2-ddb/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer


[camel-quarkus] 02/03: Test AWS 2 DynamoDB properly

Posted by pp...@apache.org.
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 22124f14a59c88cc351dbc278d9cce177e0b41b7
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Feb 11 16:28:41 2021 +0100

    Test AWS 2 DynamoDB properly
---
 .../aws2-ddb}/pom.xml                              | 123 +++--------------
 .../component/aws2/ddb/it/Aws2DdbResource.java     | 151 +++++++++++++++++++++
 .../src/main/resources/application.properties      |  20 +++
 .../quarkus/component/aws2/ddb/it/Aws2DdbIT.java   |  26 ++++
 .../quarkus/component/aws2/ddb/it/Aws2DdbTest.java | 109 +++++++++++++++
 .../aws2/ddb/it/Aws2DdbTestEnvCustomizer.java      |  80 +++++++++++
 ...quarkus.test.support.aws2.Aws2TestEnvCustomizer |   1 +
 integration-tests-aws2/pom.xml                     |   1 +
 .../test/support/aws2/Aws2TestEnvContext.java      |  16 ++-
 integration-tests/aws2-grouped/pom.xml             |  17 +++
 10 files changed, 434 insertions(+), 110 deletions(-)

diff --git a/integration-tests/aws2-grouped/pom.xml b/integration-tests-aws2/aws2-ddb/pom.xml
similarity index 51%
copy from integration-tests/aws2-grouped/pom.xml
copy to integration-tests-aws2/aws2-ddb/pom.xml
index 74fe8a6..f10cfb3 100644
--- a/integration-tests/aws2-grouped/pom.xml
+++ b/integration-tests-aws2/aws2-ddb/pom.xml
@@ -17,17 +17,20 @@
     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">
+<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">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.camel.quarkus</groupId>
-        <artifactId>camel-quarkus-integration-tests</artifactId>
+        <artifactId>camel-quarkus-integration-tests-aws2</artifactId>
         <version>1.7.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>camel-quarkus-integration-test-aws2-grouped</artifactId>
-    <name>Camel Quarkus :: Integration Tests :: AWS2 Grouped</name>
-    <description>AWS 2 tests from ../integration-tests-aws2 merged together</description>
+    <artifactId>camel-quarkus-integration-test-aws2-ddb</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: AWS 2 DynamoDB</name>
+    <description>Integration tests for Camel Quarkus AWS 2 DynamoDB extension</description>
 
     <dependencyManagement>
         <dependencies>
@@ -41,32 +44,25 @@
         </dependencies>
     </dependencyManagement>
 
-    <!-- Regenerate the dependencies via `mvn process-resources -Pformat -N` from the source tree root directory -->
     <dependencies>
         <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-resteasy</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-resteasy-jackson</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-aws2-s3</artifactId>
+            <artifactId>camel-quarkus-main</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-aws2-sns</artifactId>
+            <artifactId>camel-quarkus-aws2-ddb</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-aws2-sqs</artifactId>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-main</artifactId>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jackson</artifactId>
         </dependency>
+
+        <!-- test dependencies -->
         <dependency>
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-junit5</artifactId>
@@ -91,33 +87,7 @@
         <!-- 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-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>
+            <artifactId>camel-quarkus-aws2-ddb-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>
             <scope>test</scope>
@@ -141,65 +111,8 @@
                 </exclusion>
             </exclusions>
         </dependency>
-
     </dependencies>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>add-sources</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>add-source</goal>
-                        </goals>
-                        <configuration>
-                            <sources>
-                                <source>${basedir}/target/src/main/java</source>
-                            </sources>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>add-test-sources</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>add-test-source</goal>
-                        </goals>
-                        <configuration>
-                            <sources>
-                                <source>${basedir}/target/src/test/java</source>
-                            </sources>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.gmaven</groupId>
-                <artifactId>groovy-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>group-sources</id>
-                        <goals>
-                            <goal>execute</goal>
-                        </goals>
-                        <phase>generate-sources</phase>
-                        <configuration>
-                            <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source>
-                            <properties>
-                                <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-tests-aws2</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>
-                            </properties>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
     <profiles>
         <profile>
             <id>native</id>
diff --git a/integration-tests-aws2/aws2-ddb/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbResource.java b/integration-tests-aws2/aws2-ddb/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbResource.java
new file mode 100644
index 0000000..f1aaddf
--- /dev/null
+++ b/integration-tests-aws2/aws2-ddb/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbResource.java
@@ -0,0 +1,151 @@
+/*
+ * 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.ddb.it;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+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.PUT;
+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.ProducerTemplate;
+import org.apache.camel.component.aws2.ddb.Ddb2Constants;
+import org.apache.camel.component.aws2.ddb.Ddb2Operations;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import software.amazon.awssdk.services.dynamodb.model.AttributeAction;
+import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
+import software.amazon.awssdk.services.dynamodb.model.AttributeValueUpdate;
+
+@Path("/aws2-ddb")
+@ApplicationScoped
+public class Aws2DdbResource {
+
+    @ConfigProperty(name = "aws-ddb.table-name")
+    String tableName;
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @SuppressWarnings("serial")
+    @Path("/item/{key}")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response post(String message, @PathParam("key") String key) throws Exception {
+        final Map<String, AttributeValue> item = new HashMap<String, AttributeValue>() {
+            {
+                put("key", AttributeValue.builder()
+                        .s(key).build());
+                put("value", AttributeValue.builder()
+                        .s(message).build());
+            }
+        };
+        producerTemplate.sendBodyAndHeaders(componentUri(Ddb2Operations.PutItem),
+                message,
+                new HashMap<String, Object>() {
+                    {
+                        put(Ddb2Constants.CONSISTENT_READ, true);
+                        put(Ddb2Constants.ITEM, item);
+                    }
+                });
+        return Response.created(new URI("https://camel.apache.org/")).build();
+    }
+
+    @SuppressWarnings("unchecked")
+    @Path("/item/{key}")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public String getItem(@PathParam("key") String key) throws Exception {
+        final Map<String, AttributeValue> item = (Map<String, AttributeValue>) producerTemplate
+                .send(componentUri(Ddb2Operations.GetItem),
+                        e -> {
+                            e.getMessage().setHeader(Ddb2Constants.CONSISTENT_READ, true);
+                            e.getMessage().setHeader(Ddb2Constants.ATTRIBUTE_NAMES,
+                                    new HashSet<String>(Arrays.asList("key", "value")));
+                            e.getMessage().setHeader(Ddb2Constants.KEY,
+                                    Collections.<String, AttributeValue> singletonMap("key",
+                                            AttributeValue.builder().s(key).build()));
+
+                        })
+                .getMessage()
+                .getHeader(Ddb2Constants.ATTRIBUTES, Map.class);
+        final AttributeValue val = item.get("value");
+        return val == null ? null : val.s();
+    }
+
+    @SuppressWarnings("serial")
+    @Path("/item/{key}")
+    @PUT
+    @Produces(MediaType.TEXT_PLAIN)
+    public void updateItem(String message, @PathParam("key") String key) throws Exception {
+        producerTemplate.sendBodyAndHeaders(
+                componentUri(Ddb2Operations.UpdateItem),
+                null,
+                new HashMap<String, Object>() {
+                    {
+                        put(
+                                Ddb2Constants.KEY,
+                                Collections.singletonMap("key", AttributeValue.builder().s(key).build()));
+                        put(
+                                Ddb2Constants.UPDATE_VALUES,
+                                Collections.singletonMap(
+                                        "value",
+                                        AttributeValueUpdate.builder()
+                                                .action(AttributeAction.PUT)
+                                                .value(AttributeValue.builder().s(message).build())
+                                                .build()));
+                    }
+                });
+    }
+
+    @SuppressWarnings("serial")
+    @Path("/item/{key}")
+    @DELETE
+    @Produces(MediaType.TEXT_PLAIN)
+    public void deleteItem(@PathParam("key") String key) throws Exception {
+        producerTemplate.sendBodyAndHeaders(
+                componentUri(Ddb2Operations.DeleteItem),
+                null,
+                new HashMap<String, Object>() {
+                    {
+                        put(Ddb2Constants.CONSISTENT_READ, true);
+                        put(Ddb2Constants.KEY,
+                                Collections.<String, AttributeValue> singletonMap("key",
+                                        AttributeValue.builder().s(key).build()));
+                    }
+                });
+    }
+
+    private String componentUri(Ddb2Operations op) {
+        return "aws2-ddb://" + tableName + "?operation=" + op;
+    }
+
+}
diff --git a/integration-tests-aws2/aws2-ddb/src/main/resources/application.properties b/integration-tests-aws2/aws2-ddb/src/main/resources/application.properties
new file mode 100644
index 0000000..2cfb3d1
--- /dev/null
+++ b/integration-tests-aws2/aws2-ddb/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.
+## ---------------------------------------------------------------------------
+
+camel.component.aws2-ddb.access-key=${AWS_ACCESS_KEY}
+camel.component.aws2-ddb.secret-key=${AWS_SECRET_KEY}
+camel.component.aws2-ddb.region=${AWS_REGION:us-east-1}
diff --git a/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbIT.java b/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbIT.java
new file mode 100644
index 0000000..31cdf1f
--- /dev/null
+++ b/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbIT.java
@@ -0,0 +1,26 @@
+/*
+ * 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.ddb.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
+@NativeImageTest
+@EnabledIfEnvironmentVariable(named = "AWS_ACCESS_KEY", matches = "[a-zA-Z0-9]+") // TODO https://github.com/apache/camel-quarkus/issues/2216
+class Aws2DdbIT extends Aws2DdbTest {
+
+}
diff --git a/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java b/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java
new file mode 100644
index 0000000..655b249
--- /dev/null
+++ b/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.ddb.it;
+
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Response;
+import org.apache.camel.quarkus.test.support.aws2.Aws2TestResource;
+import org.awaitility.Awaitility;
+import org.hamcrest.Matchers;
+import org.jboss.logging.Logger;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
+@QuarkusTest
+@QuarkusTestResource(Aws2TestResource.class)
+@EnabledIfEnvironmentVariable(named = "AWS_ACCESS_KEY", matches = "[a-zA-Z0-9]+") // TODO
+                                                                                  // https://github.com/apache/camel-quarkus/issues/2216
+class Aws2DdbTest {
+
+    private static final Logger LOG = Logger.getLogger(Aws2DdbTest.class);
+
+    @Test
+    public void crud() {
+
+        final String key = "key" + UUID.randomUUID().toString().replace("-", "");
+        final String msg = "val" + UUID.randomUUID().toString().replace("-", "");
+
+        /* Ensure initially empty */
+        RestAssured.get("/aws2-ddb/item/" + key)
+                .then()
+                .statusCode(204);
+
+        /* Put */
+        RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body(msg)
+                .post("/aws2-ddb/item/" + key)
+                .then()
+                .statusCode(201);
+
+        Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+                () -> {
+                    ExtractableResponse<Response> result = RestAssured.get("/aws2-ddb/item/" + key)
+                            .then()
+                            .statusCode(Matchers.anyOf(Matchers.is(200), Matchers.is(204)))
+                            .extract();
+                    LOG.info("Expecting " + msg + " got " + result.statusCode() + ": " + result.body().asString());
+                    return result.body().asString();
+                },
+                Matchers.is(msg));
+
+        /* Update */
+        final String newMsg = "newVal" + UUID.randomUUID().toString().replace("-", "");
+        RestAssured.given()
+                .body(newMsg)
+                .put("/aws2-ddb/item/" + key)
+                .then()
+                .statusCode(204);
+        Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+                () -> {
+                    ExtractableResponse<Response> result = RestAssured.get("/aws2-ddb/item/" + key)
+                            .then()
+                            .statusCode(Matchers.anyOf(Matchers.is(200), Matchers.is(204)))
+                            .extract();
+                    LOG.info("Expecting " + newMsg + " got " + result.statusCode() + ": " + result.body().asString());
+                    return result.body().asString();
+                },
+                Matchers.is(newMsg));
+
+        /* Delete */
+        RestAssured.given()
+                .delete("/aws2-ddb/item/" + key)
+                .then()
+                .statusCode(204);
+
+        Awaitility.await().pollInterval(1, TimeUnit.SECONDS).atMost(120, TimeUnit.SECONDS).until(
+                () -> {
+                    ExtractableResponse<Response> result = RestAssured.get("/aws2-ddb/item/" + key)
+                            .then()
+                            .extract();
+                    LOG.info("Expecting " + msg + " got " + result.statusCode() + ": " + result.body().asString());
+                    return result.statusCode();
+                },
+                Matchers.is(204));
+
+    }
+
+}
diff --git a/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTestEnvCustomizer.java b/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTestEnvCustomizer.java
new file mode 100644
index 0000000..1cc52e9
--- /dev/null
+++ b/integration-tests-aws2/aws2-ddb/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTestEnvCustomizer.java
@@ -0,0 +1,80 @@
+/*
+ * 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.ddb.it;
+
+import java.util.Locale;
+
+import org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvContext;
+import org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.testcontainers.containers.localstack.LocalStackContainer.Service;
+import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
+import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition;
+import software.amazon.awssdk.services.dynamodb.model.CreateTableRequest;
+import software.amazon.awssdk.services.dynamodb.model.CreateTableResponse;
+import software.amazon.awssdk.services.dynamodb.model.DeleteTableRequest;
+import software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest;
+import software.amazon.awssdk.services.dynamodb.model.KeySchemaElement;
+import software.amazon.awssdk.services.dynamodb.model.KeyType;
+import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput;
+import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType;
+import software.amazon.awssdk.services.dynamodb.waiters.DynamoDbWaiter;
+
+public class Aws2DdbTestEnvCustomizer implements Aws2TestEnvCustomizer {
+
+    @Override
+    public Service[] localstackServices() {
+        return new Service[] { Service.DYNAMODB };
+    }
+
+    @Override
+    public void customize(Aws2TestEnvContext envContext) {
+
+        final String tableName = "camel-quarkus-" + RandomStringUtils.randomAlphanumeric(16).toLowerCase(Locale.ROOT);
+        envContext.property("aws-ddb.table-name", tableName);
+
+        final DynamoDbClient client = envContext.client(Service.DYNAMODB, DynamoDbClient::builder);
+        {
+            final String keyColumn = "key";
+            CreateTableResponse tbl = client.createTable(
+                    CreateTableRequest.builder()
+                            .attributeDefinitions(AttributeDefinition.builder()
+                                    .attributeName(keyColumn)
+                                    .attributeType(ScalarAttributeType.S)
+                                    .build())
+                            .keySchema(KeySchemaElement.builder()
+                                    .attributeName(keyColumn)
+                                    .keyType(KeyType.HASH)
+                                    .build())
+                            .provisionedThroughput(ProvisionedThroughput.builder()
+                                    .readCapacityUnits(new Long(10))
+                                    .writeCapacityUnits(new Long(10))
+                                    .build())
+                            .tableName(tableName)
+                            .build());
+
+            try (DynamoDbWaiter dbWaiter = client.waiter()) {
+                dbWaiter.waitUntilTableExists(DescribeTableRequest.builder()
+                        .tableName(tableName)
+                        .build());
+            }
+
+            envContext.closeable(() -> client.deleteTable(DeleteTableRequest.builder().tableName(tableName).build()));
+        }
+
+    }
+}
diff --git a/integration-tests-aws2/aws2-ddb/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer b/integration-tests-aws2/aws2-ddb/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer
new file mode 100644
index 0000000..94d2241
--- /dev/null
+++ b/integration-tests-aws2/aws2-ddb/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer
@@ -0,0 +1 @@
+org.apache.camel.quarkus.component.aws2.ddb.it.Aws2DdbTestEnvCustomizer
\ No newline at end of file
diff --git a/integration-tests-aws2/pom.xml b/integration-tests-aws2/pom.xml
index 0448a1c..c919263 100644
--- a/integration-tests-aws2/pom.xml
+++ b/integration-tests-aws2/pom.xml
@@ -38,6 +38,7 @@
 
     <modules>
         <!-- extensions a..z; do not remove this comment, it is important when sorting via  mvn process-resources -Pformat -->
+        <module>aws2-ddb</module>
         <module>aws2-s3</module>
         <module>aws2-sqs-sns</module>
     </modules>
diff --git a/integration-tests-support/aws2/src/main/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java b/integration-tests-support/aws2/src/main/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java
index 52477c9..4f7454d 100644
--- a/integration-tests-support/aws2/src/main/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java
+++ b/integration-tests-support/aws2/src/main/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java
@@ -55,7 +55,7 @@ public class Aws2TestEnvContext {
 
         localstack.ifPresent(ls -> {
             for (Service service : services) {
-                String s = serviceKey(service);
+                String s = camelServiceAcronym(service);
                 properties.put("camel.component.aws2-" + s + ".access-key", accessKey);
                 properties.put("camel.component.aws2-" + s + ".secret-key", secretKey);
                 properties.put("camel.component.aws2-" + s + ".region", region);
@@ -63,6 +63,7 @@ public class Aws2TestEnvContext {
                 switch (service) {
                 case SQS:
                 case SNS:
+                case DYNAMODB:
                     // TODO https://github.com/apache/camel-quarkus/issues/2216
                     break;
                 default:
@@ -77,7 +78,7 @@ public class Aws2TestEnvContext {
 
     /**
      * Add a key-value pair to the system properties seen by AWS 2 tests
-     * 
+     *
      * @param  key
      * @param  value
      * @return       this {@link Aws2TestEnvContext}
@@ -89,7 +90,7 @@ public class Aws2TestEnvContext {
 
     /**
      * Add an {@link AutoCloseable} to be closed after running AWS 2 tests
-     * 
+     *
      * @param  closeable the {@link AutoCloseable} to add
      * @return           this {@link Aws2TestEnvContext}
      */
@@ -144,7 +145,12 @@ public class Aws2TestEnvContext {
         return client;
     }
 
-    private static String serviceKey(Service service) {
-        return service.name().toLowerCase(Locale.ROOT);
+    private static String camelServiceAcronym(Service service) {
+        switch (service) {
+        case DYNAMODB:
+            return "ddb";
+        default:
+            return service.name().toLowerCase(Locale.ROOT);
+        }
     }
 }
diff --git a/integration-tests/aws2-grouped/pom.xml b/integration-tests/aws2-grouped/pom.xml
index 74fe8a6..0c96dd1 100644
--- a/integration-tests/aws2-grouped/pom.xml
+++ b/integration-tests/aws2-grouped/pom.xml
@@ -53,6 +53,10 @@
         </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-s3</artifactId>
         </dependency>
         <dependency>
@@ -91,6 +95,19 @@
         <!-- 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>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>*</groupId>
+                    <artifactId>*</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-aws2-s3-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>


[camel-quarkus] 03/03: Upgrade to cq-maven-plugin 0.30.0; now removes duplicate virtual deps comments

Posted by pp...@apache.org.
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 81b7c64c58b2968573121a93e0e58e2aac260e1f
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Feb 11 17:58:53 2021 +0100

    Upgrade to cq-maven-plugin 0.30.0; now removes duplicate virtual deps comments
---
 extensions-jvm/redis/integration-test/pom.xml | 2 --
 extensions-jvm/spark/integration-test/pom.xml | 2 --
 integration-tests-aws2/aws2-sqs-sns/pom.xml   | 6 ++----
 integration-tests/debezium/pom.xml            | 2 --
 integration-tests/hazelcast/pom.xml           | 2 --
 integration-tests/jsonata/pom.xml             | 2 --
 integration-tests/leveldb/pom.xml             | 2 --
 integration-tests/msv/pom.xml                 | 2 --
 integration-tests/nsq/pom.xml                 | 2 --
 integration-tests/pgevent/pom.xml             | 2 --
 integration-tests/rest/pom.xml                | 2 --
 integration-tests/saga/pom.xml                | 2 --
 integration-tests/shiro/pom.xml               | 2 --
 integration-tests/univocity-parsers/pom.xml   | 2 --
 integration-tests/weather/pom.xml             | 4 ----
 pom.xml                                       | 2 +-
 16 files changed, 3 insertions(+), 35 deletions(-)

diff --git a/extensions-jvm/redis/integration-test/pom.xml b/extensions-jvm/redis/integration-test/pom.xml
index 20ea75f..da3c82e 100644
--- a/extensions-jvm/redis/integration-test/pom.xml
+++ b/extensions-jvm/redis/integration-test/pom.xml
@@ -115,8 +115,6 @@
                 </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-redis-deployment</artifactId>
diff --git a/extensions-jvm/spark/integration-test/pom.xml b/extensions-jvm/spark/integration-test/pom.xml
index cff847a..1c75091 100644
--- a/extensions-jvm/spark/integration-test/pom.xml
+++ b/extensions-jvm/spark/integration-test/pom.xml
@@ -89,8 +89,6 @@
                 </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-spark-deployment</artifactId>
diff --git a/integration-tests-aws2/aws2-sqs-sns/pom.xml b/integration-tests-aws2/aws2-sqs-sns/pom.xml
index a83ec15..c88fcd7 100644
--- a/integration-tests-aws2/aws2-sqs-sns/pom.xml
+++ b/integration-tests-aws2/aws2-sqs-sns/pom.xml
@@ -102,11 +102,9 @@
                 </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-sqs-deployment</artifactId>
+            <artifactId>camel-quarkus-main-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>
             <scope>test</scope>
@@ -119,7 +117,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-main-deployment</artifactId>
+            <artifactId>camel-quarkus-aws2-sqs-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>
             <scope>test</scope>
diff --git a/integration-tests/debezium/pom.xml b/integration-tests/debezium/pom.xml
index 8f92f1a..79471b5 100644
--- a/integration-tests/debezium/pom.xml
+++ b/integration-tests/debezium/pom.xml
@@ -122,8 +122,6 @@
                 </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-debezium-postgres-deployment</artifactId>
diff --git a/integration-tests/hazelcast/pom.xml b/integration-tests/hazelcast/pom.xml
index 1a60a97..153e996 100644
--- a/integration-tests/hazelcast/pom.xml
+++ b/integration-tests/hazelcast/pom.xml
@@ -99,8 +99,6 @@
                 </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-hazelcast-deployment</artifactId>
diff --git a/integration-tests/jsonata/pom.xml b/integration-tests/jsonata/pom.xml
index 6e8aa8f..874ba49 100644
--- a/integration-tests/jsonata/pom.xml
+++ b/integration-tests/jsonata/pom.xml
@@ -82,8 +82,6 @@
                 </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-jsonata-deployment</artifactId>
diff --git a/integration-tests/leveldb/pom.xml b/integration-tests/leveldb/pom.xml
index 2476b22..e706607 100644
--- a/integration-tests/leveldb/pom.xml
+++ b/integration-tests/leveldb/pom.xml
@@ -90,8 +90,6 @@
                 </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-leveldb-deployment</artifactId>
diff --git a/integration-tests/msv/pom.xml b/integration-tests/msv/pom.xml
index 05b7f5b..d6d029a 100644
--- a/integration-tests/msv/pom.xml
+++ b/integration-tests/msv/pom.xml
@@ -81,8 +81,6 @@
                 </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-msv-deployment</artifactId>
diff --git a/integration-tests/nsq/pom.xml b/integration-tests/nsq/pom.xml
index 8cdd2e0..b113e05 100644
--- a/integration-tests/nsq/pom.xml
+++ b/integration-tests/nsq/pom.xml
@@ -91,8 +91,6 @@
                 </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-nsq-deployment</artifactId>
diff --git a/integration-tests/pgevent/pom.xml b/integration-tests/pgevent/pom.xml
index 7044058..56303fa 100644
--- a/integration-tests/pgevent/pom.xml
+++ b/integration-tests/pgevent/pom.xml
@@ -107,8 +107,6 @@
                 </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-direct-deployment</artifactId>
diff --git a/integration-tests/rest/pom.xml b/integration-tests/rest/pom.xml
index 814801f..9e67fe1 100644
--- a/integration-tests/rest/pom.xml
+++ b/integration-tests/rest/pom.xml
@@ -69,8 +69,6 @@
                 </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-rest-deployment</artifactId>
diff --git a/integration-tests/saga/pom.xml b/integration-tests/saga/pom.xml
index e5d8c66..d3f7b13 100644
--- a/integration-tests/saga/pom.xml
+++ b/integration-tests/saga/pom.xml
@@ -98,8 +98,6 @@
                 </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-saga-deployment</artifactId>
diff --git a/integration-tests/shiro/pom.xml b/integration-tests/shiro/pom.xml
index ace891b..841ec9b 100644
--- a/integration-tests/shiro/pom.xml
+++ b/integration-tests/shiro/pom.xml
@@ -103,8 +103,6 @@
                 </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-shiro-deployment</artifactId>
diff --git a/integration-tests/univocity-parsers/pom.xml b/integration-tests/univocity-parsers/pom.xml
index b143279..6ec5469 100644
--- a/integration-tests/univocity-parsers/pom.xml
+++ b/integration-tests/univocity-parsers/pom.xml
@@ -85,8 +85,6 @@
                 </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-univocity-parsers-deployment</artifactId>
diff --git a/integration-tests/weather/pom.xml b/integration-tests/weather/pom.xml
index 497e5cd..c5e7c61 100644
--- a/integration-tests/weather/pom.xml
+++ b/integration-tests/weather/pom.xml
@@ -64,10 +64,6 @@
         </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 -->
-
-        <!-- 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 -->
-
-        <!-- 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-weather-deployment</artifactId>
diff --git a/pom.xml b/pom.xml
index 708f601..2382079 100644
--- a/pom.xml
+++ b/pom.xml
@@ -145,7 +145,7 @@
         <zt-exec.version>1.11</zt-exec.version>
 
         <!-- Maven plugin versions (keep sorted alphabetically) -->
-        <cq-plugin.version>0.29.0</cq-plugin.version>
+        <cq-plugin.version>0.30.0</cq-plugin.version>
         <build-helper-maven-plugin.version>3.1.0</build-helper-maven-plugin.version>
         <exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
         <formatter-maven-plugin.version>2.11.0</formatter-maven-plugin.version>


[camel-quarkus] 01/03: Autogenerate the dependencies in the aws2-grouped test

Posted by pp...@apache.org.
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 67e26367c2f835df6849490304cfc552e5b3894e
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Feb 10 18:15:20 2021 +0100

    Autogenerate the dependencies in the aws2-grouped test
---
 integration-tests/aws2-grouped/README.adoc |  7 +++--
 integration-tests/aws2-grouped/pom.xml     | 44 ++++++++----------------------
 integration-tests/cassandraql/pom.xml      | 15 ----------
 pom.xml                                    | 13 ++++++++-
 tooling/scripts/group-tests.groovy         | 16 +++++++++++
 5 files changed, 43 insertions(+), 52 deletions(-)

diff --git a/integration-tests/aws2-grouped/README.adoc b/integration-tests/aws2-grouped/README.adoc
index 6c00519..0bb87fa 100644
--- a/integration-tests/aws2-grouped/README.adoc
+++ b/integration-tests/aws2-grouped/README.adoc
@@ -10,9 +10,10 @@ if, in the given situation, the speed matters more than isolation.
 
 === How the grouping works
 
-The grouped module dynamically pulls all sources from the individual AWS test modules to its
-`target/[test-]classes` directories.
-`application.properties` files and service descriptors are concatenated using a Groovy script.
+* The grouped module dynamically pulls all sources from the individual AWS test modules to its
+* `target/[test-]classes` directories.
+* `application.properties` files and service descriptors are concatenated using a Groovy script.
+* The dependencies in the grouped `pom.xml` can be updated via `mvn process-resources -Pformat -N`.
 
 === Mock backend vs. real service
 
diff --git a/integration-tests/aws2-grouped/pom.xml b/integration-tests/aws2-grouped/pom.xml
index c97c364..74fe8a6 100644
--- a/integration-tests/aws2-grouped/pom.xml
+++ b/integration-tests/aws2-grouped/pom.xml
@@ -41,8 +41,17 @@
         </dependencies>
     </dependencyManagement>
 
+    <!-- Regenerate the dependencies via `mvn process-resources -Pformat -N` from the source tree root directory -->
     <dependencies>
         <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-resteasy-jackson</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-aws2-s3</artifactId>
         </dependency>
@@ -54,21 +63,10 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-aws2-sqs</artifactId>
         </dependency>
-
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-resteasy</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-resteasy-jackson</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-main</artifactId>
         </dependency>
-
-        <!-- test dependencies -->
         <dependency>
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-junit5</artifactId>
@@ -157,21 +155,11 @@
                         <phase>generate-sources</phase>
                         <goals>
                             <goal>add-source</goal>
-                            <goal>add-resource</goal>
                         </goals>
                         <configuration>
                             <sources>
-                                <source>${maven.multiModuleProjectDirectory}/integration-tests-aws2/aws2-s3/src/main/java</source>
-                                <source>${maven.multiModuleProjectDirectory}/integration-tests-aws2/aws2-sqs-sns/src/main/java</source>
+                                <source>${basedir}/target/src/main/java</source>
                             </sources>
-                            <resources>
-                                <resource>
-                                    <directory>${maven.multiModuleProjectDirectory}/integration-tests-aws2/aws2-s3/src/main/resources</directory>
-                                </resource>
-                                <resource>
-                                    <directory>${maven.multiModuleProjectDirectory}/integration-tests-aws2/aws2-sqs-sns/src/main/resources</directory>
-                                </resource>
-                            </resources>
                         </configuration>
                     </execution>
                     <execution>
@@ -179,21 +167,11 @@
                         <phase>generate-sources</phase>
                         <goals>
                             <goal>add-test-source</goal>
-                            <goal>add-test-resource</goal>
                         </goals>
                         <configuration>
                             <sources>
-                                <source>${maven.multiModuleProjectDirectory}/integration-tests-aws2/aws2-s3/src/test/java</source>
-                                <source>${maven.multiModuleProjectDirectory}/integration-tests-aws2/aws2-sqs-sns/src/test/java</source>
+                                <source>${basedir}/target/src/test/java</source>
                             </sources>
-                            <resources>
-                                <resource>
-                                    <directory>${maven.multiModuleProjectDirectory}/integration-tests-aws2/aws2-s3/src/test/resources</directory>
-                                </resource>
-                                <resource>
-                                    <directory>${maven.multiModuleProjectDirectory}/integration-tests-aws2/aws2-sqs-sns/src/test/resources</directory>
-                                </resource>
-                            </resources>
                         </configuration>
                     </execution>
                 </executions>
diff --git a/integration-tests/cassandraql/pom.xml b/integration-tests/cassandraql/pom.xml
index 0f56448..824d537 100644
--- a/integration-tests/cassandraql/pom.xml
+++ b/integration-tests/cassandraql/pom.xml
@@ -89,21 +89,6 @@
             <artifactId>cassandra</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-cassandraql-deployment</artifactId>
-            <version>${project.version}</version>
-            <type>pom</type>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>*</groupId>
-                    <artifactId>*</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
     </dependencies>
 
     <profiles>
diff --git a/pom.xml b/pom.xml
index 9ef7d3db..708f601 100644
--- a/pom.xml
+++ b/pom.xml
@@ -145,7 +145,7 @@
         <zt-exec.version>1.11</zt-exec.version>
 
         <!-- Maven plugin versions (keep sorted alphabetically) -->
-        <cq-plugin.version>0.28.0</cq-plugin.version>
+        <cq-plugin.version>0.29.0</cq-plugin.version>
         <build-helper-maven-plugin.version>3.1.0</build-helper-maven-plugin.version>
         <exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
         <formatter-maven-plugin.version>2.11.0</formatter-maven-plugin.version>
@@ -836,6 +836,17 @@
                                             <include>integration-tests-aws2/*/src/main/resources/application.properties</include>
                                         </includes>
                                     </removeEmptyApplicationProperties>
+                                    <mergePoms>
+                                        <mergePom>
+                                            <sourcePoms>
+                                                <directory>${basedir}/integration-tests-aws2</directory>
+                                                <includes>
+                                                    <include>*/pom.xml</include>
+                                                </includes>
+                                            </sourcePoms>
+                                            <destinationPom>${basedir}/integration-tests/aws2-grouped/pom.xml</destinationPom>
+                                        </mergePom>
+                                    </mergePoms>
                                 </configuration>
                             </execution>
                         </executions>
diff --git a/tooling/scripts/group-tests.groovy b/tooling/scripts/group-tests.groovy
index 5b71408..6e1a654 100644
--- a/tooling/scripts/group-tests.groovy
+++ b/tooling/scripts/group-tests.groovy
@@ -25,7 +25,11 @@ 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 multiple source test modules (subdirs of `group-tests.source.dir`) into
+ * one destination module (`group-tests.dest.module.dir`) so that the tests can be executed all at once
+ */
 
 final Path sourceDir = Paths.get(properties['group-tests.source.dir'])
 final String[] concatRelPaths = properties['group-tests.concat.rel.paths'].split('[\\s,]+')
@@ -39,6 +43,18 @@ Files.list(sourceDir)
     .sorted()
     .forEach {p ->
         mergedFiles.each { relPath, sb -> sb.append(p.resolve(relPath).getText('UTF-8') + '\n') }
+        new AntBuilder().copy(todir: destinationModuleDir.resolve('target/src/main/java')) {
+            fileset(dir: p.resolve('src/main/java'), includes: "**")
+        }
+        new AntBuilder().copy(todir: destinationModuleDir.resolve('target/src/test/java')) {
+            fileset(dir: p.resolve('src/test/java'), includes: "**")
+        }
+        new AntBuilder().copy(todir: destinationModuleDir.resolve('target/classes')) {
+            fileset(dir: p.resolve('src/main/resources'), includes: "**")
+        }
+        new AntBuilder().copy(todir: destinationModuleDir.resolve('target/test-classes')) {
+            fileset(dir: p.resolve('src/test/resources'), includes: "**")
+        }
     }
 
 mergedFiles.each { relPath, sb ->