You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/09/02 11:56:18 UTC
[camel-quarkus] 03/13: Add ArangoDB component extension #1533
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 09cc88287ddb6300d34faa226f625debe63a127d
Author: Zineb Bendhiba <be...@gmail.com>
AuthorDate: Tue Aug 18 09:41:58 2020 +0200
Add ArangoDB component extension #1533
---
catalog/pom.xml | 1 +
docs/modules/ROOT/nav.adoc | 1 +
docs/modules/ROOT/pages/reference/components.adoc | 3 +
.../ROOT/pages/reference/extensions/arangodb.adoc | 29 ++++
docs/modules/ROOT/pages/reference/index.adoc | 3 +
extensions/arangodb/deployment/pom.xml | 63 +++++++++
.../arangodb/deployment/ArangodbProcessor.java | 30 ++++
extensions/arangodb/pom.xml | 39 ++++++
extensions/arangodb/runtime/pom.xml | 94 +++++++++++++
.../main/resources/META-INF/quarkus-extension.yaml | 31 +++++
extensions/pom.xml | 1 +
integration-tests/arangodb/pom.xml | 131 ++++++++++++++++++
.../component/arangodb/it/ArangodbResource.java | 143 +++++++++++++++++++
.../quarkus/component/arangodb/it/ArangodbIT.java | 24 ++++
.../component/arangodb/it/ArangodbTest.java | 152 +++++++++++++++++++++
.../arangodb/it/ArangodbTestResource.java | 71 ++++++++++
integration-tests/pom.xml | 1 +
poms/bom/pom.xml | 15 ++
tooling/scripts/test-categories.yaml | 1 +
19 files changed, 833 insertions(+)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index d286eda..c64a753 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -43,6 +43,7 @@
camel-quarkus-ahc-ws
camel-quarkus-amqp
camel-quarkus-apns
+ camel-quarkus-arangodb
camel-quarkus-asterisk
camel-quarkus-atmos
camel-quarkus-atom
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 68830af..e5e414b 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -18,6 +18,7 @@
*** xref:reference/extensions/activemq.adoc[ActiveMQ]
*** xref:reference/extensions/amqp.adoc[AMQP]
*** xref:reference/extensions/apns.adoc[APNS]
+*** xref:reference/extensions/arangodb.adoc[ArangoDb]
*** xref:reference/extensions/asterisk.adoc[Asterisk]
*** xref:reference/extensions/ahc.adoc[Async HTTP Client (AHC)]
*** xref:reference/extensions/ahc-ws.adoc[Async HTTP Client (AHC) Websocket]
diff --git a/docs/modules/ROOT/pages/reference/components.adoc b/docs/modules/ROOT/pages/reference/components.adoc
index c6d3f04..5ea5ced 100644
--- a/docs/modules/ROOT/pages/reference/components.adoc
+++ b/docs/modules/ROOT/pages/reference/components.adoc
@@ -19,6 +19,9 @@ Stable | 1.0.0 | Messaging with AMQP protocol using Apache QPid Client.
| xref:reference/extensions/apns.adoc[APNS] | [.camel-element-artifact]##camel-quarkus-apns## | [.camel-element-JVM]##JVM## +
Preview | 1.1.0 | Send notifications to Apple iOS devices.
+| xref:reference/extensions/arangodb.adoc[ArangoDb] | [.camel-element-artifact]##camel-quarkus-arangodb## | [.camel-element-Native]##Native## +
+Stable | 1.1.0 | Perform operations on ArangoDb when used as a Document Database, or as a Graph Database
+
| xref:reference/extensions/asterisk.adoc[Asterisk] | [.camel-element-artifact]##camel-quarkus-asterisk## | [.camel-element-JVM]##JVM## +
Preview | 1.1.0 | Interact with Asterisk PBX Server.
diff --git a/docs/modules/ROOT/pages/reference/extensions/arangodb.adoc b/docs/modules/ROOT/pages/reference/extensions/arangodb.adoc
new file mode 100644
index 0000000..16b937c
--- /dev/null
+++ b/docs/modules/ROOT/pages/reference/extensions/arangodb.adoc
@@ -0,0 +1,29 @@
+// Do not edit directly!
+// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
+
+[[arangodb]]
+= ArangoDb
+:page-aliases: extensions/arangodb.adoc
+
+[.badges]
+[.badge-key]##Since Camel Quarkus##[.badge-version]##1.1.0## [.badge-key]##JVM##[.badge-supported]##supported## [.badge-key]##Native##[.badge-supported]##supported##
+
+Perform operations on ArangoDb documents, collections and graphs.
+
+== What's inside
+
+* https://camel.apache.org/components/latest/arangodb-component.html[ArangoDb component], URI syntax: `arangodb:database`
+
+Please refer to the above link for usage and configuration details.
+
+== Maven coordinates
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-arangodb</artifactId>
+</dependency>
+----
+
+Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
diff --git a/docs/modules/ROOT/pages/reference/index.adoc b/docs/modules/ROOT/pages/reference/index.adoc
index 76670d0..76e9a03 100644
--- a/docs/modules/ROOT/pages/reference/index.adoc
+++ b/docs/modules/ROOT/pages/reference/index.adoc
@@ -32,6 +32,9 @@ Stable | 1.0.0 | Messaging with AMQP protocol using Apache QPid Client.
| xref:reference/extensions/apns.adoc[APNS] | camel-quarkus-apns | [.camel-element-JVM]##JVM## +
Preview | 1.1.0 | Send notifications to Apple iOS devices.
+| xref:reference/extensions/arangodb.adoc[ArangoDb] | camel-quarkus-arangodb | [.camel-element-Native]##Native## +
+Stable | 1.1.0 | Perform operations on ArangoDb when used as a Document Database, or as a Graph Database
+
| xref:reference/extensions/asterisk.adoc[Asterisk] | camel-quarkus-asterisk | [.camel-element-JVM]##JVM## +
Preview | 1.1.0 | Interact with Asterisk PBX Server.
diff --git a/extensions/arangodb/deployment/pom.xml b/extensions/arangodb/deployment/pom.xml
new file mode 100644
index 0000000..4bdd196
--- /dev/null
+++ b/extensions/arangodb/deployment/pom.xml
@@ -0,0 +1,63 @@
+<?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-arangodb-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-arangodb-deployment</artifactId>
+ <name>Camel Quarkus :: ArangoDb :: Deployment</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-arangodb</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/arangodb/deployment/src/main/java/org/apache/camel/quarkus/component/arangodb/deployment/ArangodbProcessor.java b/extensions/arangodb/deployment/src/main/java/org/apache/camel/quarkus/component/arangodb/deployment/ArangodbProcessor.java
new file mode 100644
index 0000000..c98ae1a
--- /dev/null
+++ b/extensions/arangodb/deployment/src/main/java/org/apache/camel/quarkus/component/arangodb/deployment/ArangodbProcessor.java
@@ -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.
+ */
+package org.apache.camel.quarkus.component.arangodb.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class ArangodbProcessor {
+
+ private static final String FEATURE = "camel-arangodb";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+}
diff --git a/extensions/arangodb/pom.xml b/extensions/arangodb/pom.xml
new file mode 100644
index 0000000..9c247e7
--- /dev/null
+++ b/extensions/arangodb/pom.xml
@@ -0,0 +1,39 @@
+<?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-arangodb-parent</artifactId>
+ <name>Camel Quarkus :: ArangoDb</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/arangodb/runtime/pom.xml b/extensions/arangodb/runtime/pom.xml
new file mode 100644
index 0000000..a21eb09
--- /dev/null
+++ b/extensions/arangodb/runtime/pom.xml
@@ -0,0 +1,94 @@
+<?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-arangodb-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-arangodb</artifactId>
+ <name>Camel Quarkus :: ArangoDb :: Runtime</name>
+ <description>Perform operations on ArangoDb documents, collections and graphs.</description>
+
+ <properties>
+ <firstVersion>1.1.0</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>org.apache.camel</groupId>
+ <artifactId>camel-arangodb</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>update-extension-doc-page</id>
+ <goals><goal>update-extension-doc-page</goal></goals>
+ <phase>process-classes</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <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/arangodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/arangodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..c7b1a0d
--- /dev/null
+++ b/extensions/arangodb/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -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.
+#
+
+# This is a generated file. Do not edit directly!
+# To re-generate, run the following command from the top level directory:
+#
+# mvn -N cq:update-quarkus-metadata
+#
+---
+name: "Camel ArangoDb"
+description: "Perform operations on ArangoDb documents, collections and graphs"
+metadata:
+ guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/arangodb.html"
+ categories:
+ - "integration"
+ status:
+ - "stable"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index cbb129b..dc708c9 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -37,6 +37,7 @@
<module>ahc</module>
<module>ahc-ws</module>
<module>amqp</module>
+ <module>arangodb</module>
<module>attachments</module>
<module>avro</module>
<module>aws-ec2</module>
diff --git a/integration-tests/arangodb/pom.xml b/integration-tests/arangodb/pom.xml
new file mode 100644
index 0000000..43c78bd
--- /dev/null
+++ b/integration-tests/arangodb/pom.xml
@@ -0,0 +1,131 @@
+<?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-integration-tests</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-arangodb</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: ArangoDb</name>
+ <description>Integration tests for Camel Quarkus ArangoDb 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-arangodb-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-test</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-arangodb</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>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-testcontainers-support</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>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/arangodb/src/main/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbResource.java b/integration-tests/arangodb/src/main/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbResource.java
new file mode 100644
index 0000000..0f89335
--- /dev/null
+++ b/integration-tests/arangodb/src/main/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbResource.java
@@ -0,0 +1,143 @@
+/*
+ * 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.arangodb.it;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+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 com.arangodb.entity.DocumentCreateEntity;
+import com.arangodb.entity.DocumentDeleteEntity;
+import com.arangodb.util.MapBuilder;
+import org.apache.camel.ProducerTemplate;
+import org.jboss.logging.Logger;
+
+import static org.apache.camel.component.arangodb.ArangoDbConstants.AQL_QUERY;
+import static org.apache.camel.component.arangodb.ArangoDbConstants.AQL_QUERY_BIND_PARAMETERS;
+import static org.apache.camel.component.arangodb.ArangoDbConstants.AQL_QUERY_OPTIONS;
+import static org.apache.camel.component.arangodb.ArangoDbConstants.ARANGO_KEY;
+import static org.apache.camel.component.arangodb.ArangoDbConstants.RESULT_CLASS_TYPE;
+
+@Path("/arangodb/camel")
+@ApplicationScoped
+public class ArangodbResource {
+
+ private static final Logger LOG = Logger.getLogger(ArangodbResource.class);
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @PUT
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response put(String message) throws Exception {
+ LOG.infof("Saving to arangodb: %s", message);
+ final DocumentCreateEntity response = producerTemplate.requestBody(
+ "arangodb:test?host={{camel.arangodb.host}}&port={{camel.arangodb.port}}&documentCollection=camel&operation=SAVE_DOCUMENT",
+ message, DocumentCreateEntity.class);
+ LOG.infof("Got response from arangodb: %s", response);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(response.getKey())
+ .build();
+ }
+
+ @Path("{key}")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response get(@PathParam("key") String key) throws Exception {
+ LOG.infof("Retrieve document from arangodb with key: %s", key);
+ final String response = producerTemplate.requestBodyAndHeader(
+ "arangodb:test?host={{camel.arangodb.host}}&port={{camel.arangodb.port}}&documentCollection=camel&operation=FIND_DOCUMENT_BY_KEY",
+ key, RESULT_CLASS_TYPE, String.class, String.class);
+ LOG.infof("Got response from arangodb: %s", response);
+ return Response
+ .ok()
+ .entity(response)
+ .build();
+ }
+
+ @Path("{key}")
+ @DELETE
+ public Response delete(@PathParam("key") String key) throws Exception {
+ LOG.infof("Delete document from arangodb with key : %s", key);
+ producerTemplate.requestBody(
+ "arangodb:test?host={{camel.arangodb.host}}&port={{camel.arangodb.port}}&documentCollection=camel&operation=DELETE_DOCUMENT",
+ key, DocumentDeleteEntity.class);
+
+ return Response
+ .ok()
+ .build();
+ }
+
+ @Path("{key}")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ public Response post(@PathParam("key") String key, String msg) throws Exception {
+ LOG.infof("Update document from arangodb with key : %s", key);
+ Map<String, Object> headers = new HashMap<>();
+ headers.put(RESULT_CLASS_TYPE, String.class);
+ headers.put(ARANGO_KEY, key);
+
+ producerTemplate.requestBodyAndHeaders(
+ "arangodb:test?host={{camel.arangodb.host}}&port={{camel.arangodb.port}}&documentCollection=camel&operation=UPDATE_DOCUMENT",
+ msg, headers, String.class);
+ return Response
+ .ok()
+ .build();
+ }
+
+ @Path("/foo/{fooName}")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response getByFooName(@PathParam("fooName") String fooName) throws Exception {
+ LOG.infof("Retrieve document from arangodb with foo: %s", fooName);
+
+ String query = "FOR t IN camel FILTER t.foo == @foo RETURN t";
+ Map<String, Object> bindVars = new MapBuilder().put("foo", fooName)
+ .get();
+
+ Map<String, Object> headers = new HashMap<>();
+ headers.put(AQL_QUERY, query);
+ headers.put(AQL_QUERY_BIND_PARAMETERS, bindVars);
+ headers.put(AQL_QUERY_OPTIONS, null);
+ headers.put(RESULT_CLASS_TYPE, String.class);
+
+ final Collection<String> responseList = producerTemplate.requestBodyAndHeaders(
+ "arangodb:test?host={{camel.arangodb.host}}&port={{camel.arangodb.port}}&operation=AQL_QUERY",
+ fooName, headers, Collection.class);
+
+ return Response
+ .ok()
+ .entity(responseList.toString())
+ .build();
+ }
+}
diff --git a/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbIT.java b/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbIT.java
new file mode 100644
index 0000000..8e86006
--- /dev/null
+++ b/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbIT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.arangodb.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class ArangodbIT extends ArangodbTest {
+
+}
diff --git a/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbTest.java b/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbTest.java
new file mode 100644
index 0000000..96a86ec
--- /dev/null
+++ b/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbTest.java
@@ -0,0 +1,152 @@
+/*
+ * 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.arangodb.it;
+
+import com.arangodb.ArangoCollection;
+import com.arangodb.ArangoDB;
+import com.arangodb.ArangoDatabase;
+import com.arangodb.entity.BaseDocument;
+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.Response;
+import io.restassured.specification.RequestSpecification;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+@QuarkusTestResource(ArangodbTestResource.class)
+class ArangodbTest {
+ protected static final String DATABASE_NAME = "test";
+ protected static final String COLLECTION_NAME = "camel";
+ protected static ArangoDB arangoDb;
+ protected static ArangoCollection collection;
+
+ @Test
+ public void testCreateGetDeleteDocument() {
+ // create a new document
+ RequestSpecification request = RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body("{\"foo\":\"bar\"}");
+ Response response = request.put("/arangodb/camel");
+
+ int statusCode = response.getStatusCode();
+ assertEquals(201, statusCode);
+ // getting key of the document inserted
+ String key = response.body().asString().trim();
+
+ // get the document by key
+ request = RestAssured.given()
+ .contentType(ContentType.TEXT);
+ response = request.get("/arangodb/camel/" + key);
+ statusCode = response.getStatusCode();
+ assertEquals(200, statusCode);
+ String document = response.body().asString().trim();
+ assertTrue(document.contains("\"foo\":\"bar\""));
+
+ // delete document
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .delete("/arangodb/camel/" + key)
+ .then()
+ .statusCode(200);
+
+ // search for the document deleted
+ BaseDocument documentDeleted = collection.getDocument(key, BaseDocument.class);
+ assertNull(documentDeleted);
+ }
+
+ @Test
+ public void testUpdateDocument() {
+ // insert one Document
+ BaseDocument myObject = new BaseDocument();
+ myObject.setKey("myKey");
+ myObject.addAttribute("foo", "bar");
+ collection.insertDocument(myObject);
+
+ // udpate document
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body("{\"key\":\"myKey\",\"foo\":\"hello\", \"gg\":\"42\"}")
+ .post("/arangodb/camel/myKey")
+ .then()
+ .statusCode(200);
+
+ // get document by key
+ RequestSpecification request = RestAssured.given()
+ .contentType(ContentType.TEXT);
+ Response response = request.get("/arangodb/camel/myKey");
+ assertEquals(200, response.getStatusCode());
+ String document = response.body().asString().trim();
+ assertTrue(document.contains("\"foo\":\"hello\""));
+ assertTrue(document.contains("\"gg\":\"42\""));
+ }
+
+ @Test
+ public void testAQLQuery() {
+ // insert first Document
+ BaseDocument myObject1 = new BaseDocument();
+ myObject1.setKey("keyBar1");
+ myObject1.addAttribute("foo", "bar1");
+ collection.insertDocument(myObject1);
+
+ // insert second Document
+ BaseDocument myObject2 = new BaseDocument();
+ myObject2.setKey("keyBar2");
+ myObject2.addAttribute("foo", "bar2");
+ collection.insertDocument(myObject2);
+
+ // get document with foo = bar1
+ RequestSpecification request = RestAssured.given()
+ .contentType(ContentType.TEXT);
+ Response response = request.get("/arangodb/camel/foo/bar1");
+ assertEquals(200, response.getStatusCode());
+ String result = response.body().asString();
+ assertTrue(result.contains("\"_key\":\"keyBar1\""));
+
+ //get document with foo = bar2
+ request = RestAssured.given()
+ .contentType(ContentType.TEXT);
+ response = request.get("/arangodb/camel/foo/bar2");
+ assertEquals(200, response.getStatusCode());
+ result = response.body().asString().trim();
+ assertTrue(result.contains("\"_key\":\"keyBar2\""));
+ }
+
+ @BeforeAll
+ public static void setup() {
+ String host = System.getProperty("camel.arangodb.host");
+ Integer port = Integer.valueOf(System.getProperty("camel.arangodb.port"));
+ arangoDb = new ArangoDB.Builder().host(host, port).build();
+ arangoDb.createDatabase(DATABASE_NAME);
+ ArangoDatabase arangoDatabase = arangoDb.db(DATABASE_NAME);
+ arangoDatabase.createCollection(COLLECTION_NAME);
+ collection = arangoDatabase.collection(COLLECTION_NAME);
+ }
+
+ @AfterAll
+ public static void teardown() {
+ arangoDb.shutdown();
+ }
+
+}
diff --git a/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbTestResource.java b/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbTestResource.java
new file mode 100644
index 0000000..beb6a64
--- /dev/null
+++ b/integration-tests/arangodb/src/test/java/org/apache/camel/quarkus/component/arangodb/it/ArangodbTestResource.java
@@ -0,0 +1,71 @@
+/*
+ * 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.arangodb.it;
+
+import java.util.Map;
+
+import org.apache.camel.quarkus.testcontainers.ContainerResourceLifecycleManager;
+import org.apache.camel.util.CollectionHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.TestcontainersConfiguration;
+
+public class ArangodbTestResource implements ContainerResourceLifecycleManager {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ArangodbTestResource.class);
+ private GenericContainer container;
+ private static final String CONTAINER_NAME = "arango";
+ private static final String ARANGO_IMAGE = "arangodb:latest";
+ private static final String ARANGO_NO_AUTH = "ARANGO_NO_AUTH";
+ private static final Integer PORT_DEFAULT = 8529;
+
+ @Override
+ public Map<String, String> start() {
+ LOGGER.info(TestcontainersConfiguration.getInstance().toString());
+
+ try {
+ container = new GenericContainer(ARANGO_IMAGE)
+ .withExposedPorts(PORT_DEFAULT)
+ .withEnv(ARANGO_NO_AUTH, "1")
+ .withNetworkAliases(CONTAINER_NAME)
+ .waitingFor(Wait.forListeningPort());
+
+ container.start();
+
+ return CollectionHelper.mapOf(
+ "camel.arangodb.port",
+ container.getMappedPort(PORT_DEFAULT).toString(),
+ "camel.arangodb.host",
+ container.getContainerIpAddress());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void stop() {
+ try {
+ if (container != null) {
+ container.stop();
+ }
+ } catch (Exception e) {
+ // ignored
+ }
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index e114178..588d462 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -66,6 +66,7 @@
<!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat -->
<module>activemq</module>
<module>amqp</module>
+ <module>arangodb</module>
<module>avro</module>
<module>aws</module>
<module>aws2</module>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 293293c..2e8333b 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -136,6 +136,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-arangodb</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-asterisk</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -1680,6 +1685,16 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-arangodb</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-arangodb-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-asterisk</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 830feb5..5c800ad 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -44,6 +44,7 @@ database:
- kudu
- mongodb
- sql
+ - arangodb
dataformats:
- avro
- base64