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 9bba969a6a1b40ad7392dbc215643293f7549c14 Author: Peter Palaga <ppal...@redhat.com> AuthorDate: Mon Mar 23 11:11:33 2020 +0100 Fix #942 AWS 2 DynamoDB support (JVM only) --- .../pages/list-of-camel-quarkus-extensions.adoc | 8 ++ extensions-jvm/aws2-ddb/deployment/pom.xml | 79 ++++++++++++++++++++ .../aws2/ddb/deployment/Aws2DdbProcessor.java | 31 ++++++++ extensions-jvm/aws2-ddb/integration-test/pom.xml | 82 ++++++++++++++++++++ .../component/aws2/ddb/it/Aws2DdbResource.java | 64 ++++++++++++++++ .../quarkus/component/aws2/ddb/it/Aws2DdbTest.java | 42 +++++++++++ extensions-jvm/aws2-ddb/pom.xml | 40 ++++++++++ extensions-jvm/aws2-ddb/runtime/pom.xml | 87 ++++++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 30 ++++++++ extensions-jvm/pom.xml | 1 + poms/bom-deployment/pom.xml | 5 ++ poms/bom/pom.xml | 10 +++ 12 files changed, 479 insertions(+) diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc index ad2ac32..03cd068 100644 --- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc +++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc @@ -41,6 +41,14 @@ Level | Since | Description `aws2-cw:namespace` | JVM + Preview | 1.0.0-M6 | The aws2-cw component is used for sending metrics to an Amazon CloudWatch. +| link:https://camel.apache.org/components/latest/aws2-ddb-component.html[AWS 2 DynamoDB] (camel-quarkus-aws2-ddb) + +`aws2-ddb:tableName` | JVM + + Preview | 1.0.0-M6 | The aws2-ddb component is used for storing and retrieving data from Amazon's DynamoDB service. + +| link:https://camel.apache.org/components/latest/aws2-ddbstream-component.html[AWS 2 DynamoDB Streams] (camel-quarkus-aws2-ddb) + +`aws2-ddbstream:tableName` | JVM + + Preview | 1.0.0-M6 | The aws2-ddbstream component is used for working with Amazon DynamoDB Streams. + | link:https://camel.apache.org/components/latest/aws-ec2-component.html[AWS EC2] (camel-quarkus-aws-ec2) + `aws-ec2:label` | Native + Stable | 1.0.0-M3 | The aws-ec2 is used for managing Amazon EC2 instances. diff --git a/extensions-jvm/aws2-ddb/deployment/pom.xml b/extensions-jvm/aws2-ddb/deployment/pom.xml new file mode 100644 index 0000000..d759187 --- /dev/null +++ b/extensions-jvm/aws2-ddb/deployment/pom.xml @@ -0,0 +1,79 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ddb-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws2-ddb-deployment</artifactId> + <name>Camel Quarkus :: AWS 2 DynamoDB :: Deployment</name> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-amazon-dynamodb-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ddb</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/extensions-jvm/aws2-ddb/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/deployment/Aws2DdbProcessor.java b/extensions-jvm/aws2-ddb/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/deployment/Aws2DdbProcessor.java new file mode 100644 index 0000000..ae0cea0 --- /dev/null +++ b/extensions-jvm/aws2-ddb/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/deployment/Aws2DdbProcessor.java @@ -0,0 +1,31 @@ +/* + * 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.deployment; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.FeatureBuildItem; + +class Aws2DdbProcessor { + + private static final String FEATURE = "camel-aws2-ddb"; + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + +} diff --git a/extensions-jvm/aws2-ddb/integration-test/pom.xml b/extensions-jvm/aws2-ddb/integration-test/pom.xml new file mode 100644 index 0000000..f9a86af --- /dev/null +++ b/extensions-jvm/aws2-ddb/integration-test/pom.xml @@ -0,0 +1,82 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ddb-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-quarkus-aws2-ddb-integration-test</artifactId> + <name>Camel Quarkus :: AWS 2 DynamoDB :: Integration Test</name> + <description>Integration tests for Camel Quarkus AWS 2 DynamoDB extension</description> + + <properties> + <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd --> + <!-- The following rule tells mvnd to build the listed deployment modules before this module. --> + <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not --> + <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. --> + <!-- Please update rule whenever you change the dependencies of this module by running --> + <!-- mvn process-resources -Pformat from the root directory --> + <mvnd.builder.rule>camel-quarkus-aws2-ddb-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ddb</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</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> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>build</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/extensions-jvm/aws2-ddb/integration-test/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbResource.java b/extensions-jvm/aws2-ddb/integration-test/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbResource.java new file mode 100644 index 0000000..d6fc5ef --- /dev/null +++ b/extensions-jvm/aws2-ddb/integration-test/src/main/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbResource.java @@ -0,0 +1,64 @@ +/* + * 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 javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.apache.camel.CamelContext; +import org.jboss.logging.Logger; + +@Path("/aws2-ddb") +@ApplicationScoped +public class Aws2DdbResource { + + private static final Logger LOG = Logger.getLogger(Aws2DdbResource.class); + + private static final String COMPONENT_AWS2_DDB = "aws2-ddb"; + private static final String COMPONENT_AWS2_DDBSTREAM = "aws2-ddbstream"; + @Inject + CamelContext context; + + @Path("/load/component/aws2-ddb") + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response loadComponentAws2Ddb() throws Exception { + /* This is an autogenerated test */ + if (context.getComponent(COMPONENT_AWS2_DDB) != null) { + return Response.ok().build(); + } + LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_AWS2_DDB); + return Response.status(500, COMPONENT_AWS2_DDB + " could not be loaded from the Camel context").build(); + } + + @Path("/load/component/aws2-ddbstream") + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response loadComponentAws2Ddbstream() throws Exception { + /* This is an autogenerated test */ + if (context.getComponent(COMPONENT_AWS2_DDBSTREAM) != null) { + return Response.ok().build(); + } + LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_AWS2_DDBSTREAM); + return Response.status(500, COMPONENT_AWS2_DDBSTREAM + " could not be loaded from the Camel context").build(); + } +} diff --git a/extensions-jvm/aws2-ddb/integration-test/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java b/extensions-jvm/aws2-ddb/integration-test/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java new file mode 100644 index 0000000..3deb4f8 --- /dev/null +++ b/extensions-jvm/aws2-ddb/integration-test/src/test/java/org/apache/camel/quarkus/component/aws2/ddb/it/Aws2DdbTest.java @@ -0,0 +1,42 @@ +/* + * 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.QuarkusTest; +import io.restassured.RestAssured; +import org.junit.jupiter.api.Test; + +@QuarkusTest +class Aws2DdbTest { + + @Test + public void loadComponentAws2Ddb() { + /* A simple autogenerated test */ + RestAssured.get("/aws2-ddb/load/component/aws2-ddb") + .then() + .statusCode(200); + } + + @Test + public void loadComponentAws2Ddbstream() { + /* A simple autogenerated test */ + RestAssured.get("/aws2-ddb/load/component/aws2-ddbstream") + .then() + .statusCode(200); + } + +} diff --git a/extensions-jvm/aws2-ddb/pom.xml b/extensions-jvm/aws2-ddb/pom.xml new file mode 100644 index 0000000..7fa247e --- /dev/null +++ b/extensions-jvm/aws2-ddb/pom.xml @@ -0,0 +1,40 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-build-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws2-ddb-parent</artifactId> + <name>Camel Quarkus :: AWS 2 DynamoDB</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + <module>integration-test</module> + </modules> +</project> diff --git a/extensions-jvm/aws2-ddb/runtime/pom.xml b/extensions-jvm/aws2-ddb/runtime/pom.xml new file mode 100644 index 0000000..3b6dcec --- /dev/null +++ b/extensions-jvm/aws2-ddb/runtime/pom.xml @@ -0,0 +1,87 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ddb-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws2-ddb</artifactId> + <name>Camel Quarkus :: AWS 2 DynamoDB :: Runtime</name> + <description>The aws2-ddb component is used for storing and retrieving data from Amazon's DynamoDB service.</description> + + <properties> + <firstVersion>1.0.0-M6</firstVersion> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-amazon-dynamodb</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-aws2-ddb</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-bootstrap-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/extensions-jvm/aws2-ddb/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/aws2-ddb/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..6fbb757 --- /dev/null +++ b/extensions-jvm/aws2-ddb/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,30 @@ +# +# 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. +# + +--- +name: "AWS 2 DynamoDB" +description: "The aws2-ddb component is used for storing and retrieving data from Amazon's DynamoDB service." +metadata: + unlisted: true + keywords: + - "cloud" + - "database" + - "nosql" + guide: "https://camel.apache.org/components/latest/aws2-ddb-component.html" + categories: + - "integration" + status: "preview" diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml index 2168a0a..176d913 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/pom.xml @@ -35,6 +35,7 @@ <modules> <!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat --> <module>aws2-cw</module> + <module>aws2-ddb</module> <module>cassandraql</module> <module>couchbase</module> <module>couchdb</module> diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index cc40dee..5478f83 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -154,6 +154,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ddb-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index 116329f..35ce5ba 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -166,6 +166,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-aws2-ddb</artifactId> + <version>${camel.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-azure</artifactId> <version>${camel.version}</version> </dependency> @@ -960,6 +965,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws2-ddb</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure</artifactId> <version>${camel-quarkus.version}</version> </dependency>