You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/07/18 05:33:06 UTC
[camel] branch main updated: CAMEL-19612: camel-arangodb - Upgrade to 7.1.0
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 01b0c2addd0 CAMEL-19612: camel-arangodb - Upgrade to 7.1.0
01b0c2addd0 is described below
commit 01b0c2addd00ebd966116d53bb008c35850aeffa
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jul 18 07:32:51 2023 +0200
CAMEL-19612: camel-arangodb - Upgrade to 7.1.0
---
.../apache/camel/catalog/components/arangodb.json | 12 +++--
components/camel-arangodb/pom.xml | 1 -
.../arangodb/ArangoDbComponentConfigurer.java | 11 ++++
.../arangodb/ArangoDbEndpointConfigurer.java | 6 +++
.../arangodb/ArangoDbEndpointUriFactory.java | 3 +-
.../apache/camel/component/arangodb/arangodb.json | 12 +++--
.../component/arangodb/ArangoDbComponent.java | 19 +++++--
.../component/arangodb/ArangoDbConfiguration.java | 1 +
.../camel/component/arangodb/ArangoDbEndpoint.java | 23 +++++----
.../camel/component/arangodb/ArangoDbProducer.java | 10 ++--
.../integration/ArangoCollectionDeleteIT.java | 22 ++++----
.../integration/ArangoCollectionFindByKeyIT.java | 39 +++++----------
.../integration/ArangoCollectionQueryIT.java | 7 +--
.../integration/ArangoCollectionSaveIT.java | 58 +++-------------------
.../integration/ArangoCollectionUpdateIT.java | 50 +------------------
.../arangodb/integration/ArangoGraphVertexIT.java | 4 +-
.../arangodb/integration/BaseArangoDb.java | 37 +++++++-------
...BaseCollection.java => BaseDocumentEntity.java} | 39 ++++++++++-----
parent/pom.xml | 2 +-
.../infra/arangodb/services/ArangoDbContainer.java | 2 +-
20 files changed, 153 insertions(+), 205 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/arangodb.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/arangodb.json
index d8b4471b051..500e828c2f6 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/arangodb.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/arangodb.json
@@ -31,9 +31,10 @@
"operation": { "index": 6, "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.arangodb.ArangoDbOperation", "enum": [ "SAVE_DOCUMENT", "FIND_DOCUMENT_BY_KEY", "UPDATE_DOCUMENT", "DELETE_DOCUMENT", "AQL_QUERY", "SAVE_VERTEX", "FIND_VERTEX_BY_KEY", "UPDATE_VERTEX", "DELETE_VERTEX", "SAVE_EDGE", "FIND_EDGE_BY_KEY", "UPDATE_EDGE", "DELETE_EDGE" ], "deprecated": false, "autow [...]
"port": { "index": 7, "kind": "property", "displayName": "Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB exposed port. If host and port are default, this field is Optional." },
"vertexCollection": { "index": 8, "kind": "property", "displayName": "Vertex Collection", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "Collection name of vertices, when using ArangoDb as a Graph Database. Set the vertexCollect [...]
- "autowiredEnabled": { "index": 9, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...]
- "password": { "index": 10, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." },
- "user": { "index": 11, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." }
+ "arangoDB": { "index": 9, "kind": "property", "displayName": "Arango DB", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.arangodb.ArangoDB", "deprecated": false, "autowired": true, "secret": false, "description": "To use an existing ArangDB client." },
+ "autowiredEnabled": { "index": 10, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching [...]
+ "password": { "index": 11, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." },
+ "user": { "index": 12, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." }
},
"headers": {
"CamelArangoDbMultiUpdate": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.lang.Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "false", "description": "Indicates if there are multiple documents to update. If set to true, the body of the message must be a Collection of documents to update.", "constantName": "org.apache.camel.component.arangodb.ArangoDb [...]
@@ -55,7 +56,8 @@
"port": { "index": 6, "kind": "parameter", "displayName": "Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB exposed port. If host and port are default, this field is Optional." },
"vertexCollection": { "index": 7, "kind": "parameter", "displayName": "Vertex Collection", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "Collection name of vertices, when using ArangoDb as a Graph Database. Set the vertexCollec [...]
"lazyStartProducer": { "index": 8, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...]
- "password": { "index": 9, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." },
- "user": { "index": 10, "kind": "parameter", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." }
+ "arangoDB": { "index": 9, "kind": "parameter", "displayName": "Arango DB", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.arangodb.ArangoDB", "deprecated": false, "autowired": false, "secret": false, "description": "To use an existing ArangDB client." },
+ "password": { "index": 10, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." },
+ "user": { "index": 11, "kind": "parameter", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." }
}
}
diff --git a/components/camel-arangodb/pom.xml b/components/camel-arangodb/pom.xml
index eb27fe9a5b8..7ce79edcaac 100644
--- a/components/camel-arangodb/pom.xml
+++ b/components/camel-arangodb/pom.xml
@@ -27,7 +27,6 @@
<version>4.0.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-arangodb</artifactId>
<packaging>jar</packaging>
diff --git a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbComponentConfigurer.java b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbComponentConfigurer.java
index 2da24bcbf7d..8c578475cc0 100644
--- a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbComponentConfigurer.java
+++ b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbComponentConfigurer.java
@@ -28,6 +28,8 @@ public class ArangoDbComponentConfigurer extends PropertyConfigurerSupport imple
public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
ArangoDbComponent target = (ArangoDbComponent) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "arangodb":
+ case "arangoDB": target.setArangoDB(property(camelContext, com.arangodb.ArangoDB.class, value)); return true;
case "autowiredenabled":
case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true;
case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.arangodb.ArangoDbConfiguration.class, value)); return true;
@@ -49,9 +51,16 @@ public class ArangoDbComponentConfigurer extends PropertyConfigurerSupport imple
}
}
+ @Override
+ public String[] getAutowiredNames() {
+ return new String[]{"arangoDB"};
+ }
+
@Override
public Class<?> getOptionType(String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "arangodb":
+ case "arangoDB": return com.arangodb.ArangoDB.class;
case "autowiredenabled":
case "autowiredEnabled": return boolean.class;
case "configuration": return org.apache.camel.component.arangodb.ArangoDbConfiguration.class;
@@ -77,6 +86,8 @@ public class ArangoDbComponentConfigurer extends PropertyConfigurerSupport imple
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
ArangoDbComponent target = (ArangoDbComponent) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "arangodb":
+ case "arangoDB": return target.getArangoDB();
case "autowiredenabled":
case "autowiredEnabled": return target.isAutowiredEnabled();
case "configuration": return target.getConfiguration();
diff --git a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointConfigurer.java b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointConfigurer.java
index 9645eb2a11e..19d70375d93 100644
--- a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointConfigurer.java
+++ b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointConfigurer.java
@@ -21,6 +21,8 @@ public class ArangoDbEndpointConfigurer extends PropertyConfigurerSupport implem
public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
ArangoDbEndpoint target = (ArangoDbEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "arangodb":
+ case "arangoDB": target.setArangoDB(property(camelContext, com.arangodb.ArangoDB.class, value)); return true;
case "documentcollection":
case "documentCollection": target.getConfiguration().setDocumentCollection(property(camelContext, java.lang.String.class, value)); return true;
case "edgecollection":
@@ -42,6 +44,8 @@ public class ArangoDbEndpointConfigurer extends PropertyConfigurerSupport implem
@Override
public Class<?> getOptionType(String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "arangodb":
+ case "arangoDB": return com.arangodb.ArangoDB.class;
case "documentcollection":
case "documentCollection": return java.lang.String.class;
case "edgecollection":
@@ -64,6 +68,8 @@ public class ArangoDbEndpointConfigurer extends PropertyConfigurerSupport implem
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
ArangoDbEndpoint target = (ArangoDbEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "arangodb":
+ case "arangoDB": return target.getArangoDB();
case "documentcollection":
case "documentCollection": return target.getConfiguration().getDocumentCollection();
case "edgecollection":
diff --git a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointUriFactory.java b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointUriFactory.java
index abdc9ac6f1e..c1dca19d944 100644
--- a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointUriFactory.java
+++ b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointUriFactory.java
@@ -21,7 +21,8 @@ public class ArangoDbEndpointUriFactory extends org.apache.camel.support.compone
private static final Set<String> SECRET_PROPERTY_NAMES;
private static final Set<String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(11);
+ Set<String> props = new HashSet<>(12);
+ props.add("arangoDB");
props.add("database");
props.add("documentCollection");
props.add("edgeCollection");
diff --git a/components/camel-arangodb/src/generated/resources/org/apache/camel/component/arangodb/arangodb.json b/components/camel-arangodb/src/generated/resources/org/apache/camel/component/arangodb/arangodb.json
index d8b4471b051..500e828c2f6 100644
--- a/components/camel-arangodb/src/generated/resources/org/apache/camel/component/arangodb/arangodb.json
+++ b/components/camel-arangodb/src/generated/resources/org/apache/camel/component/arangodb/arangodb.json
@@ -31,9 +31,10 @@
"operation": { "index": 6, "kind": "property", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.arangodb.ArangoDbOperation", "enum": [ "SAVE_DOCUMENT", "FIND_DOCUMENT_BY_KEY", "UPDATE_DOCUMENT", "DELETE_DOCUMENT", "AQL_QUERY", "SAVE_VERTEX", "FIND_VERTEX_BY_KEY", "UPDATE_VERTEX", "DELETE_VERTEX", "SAVE_EDGE", "FIND_EDGE_BY_KEY", "UPDATE_EDGE", "DELETE_EDGE" ], "deprecated": false, "autow [...]
"port": { "index": 7, "kind": "property", "displayName": "Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB exposed port. If host and port are default, this field is Optional." },
"vertexCollection": { "index": 8, "kind": "property", "displayName": "Vertex Collection", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "Collection name of vertices, when using ArangoDb as a Graph Database. Set the vertexCollect [...]
- "autowiredEnabled": { "index": 9, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...]
- "password": { "index": 10, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." },
- "user": { "index": 11, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." }
+ "arangoDB": { "index": 9, "kind": "property", "displayName": "Arango DB", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.arangodb.ArangoDB", "deprecated": false, "autowired": true, "secret": false, "description": "To use an existing ArangDB client." },
+ "autowiredEnabled": { "index": 10, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching [...]
+ "password": { "index": 11, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." },
+ "user": { "index": 12, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." }
},
"headers": {
"CamelArangoDbMultiUpdate": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.lang.Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "false", "description": "Indicates if there are multiple documents to update. If set to true, the body of the message must be a Collection of documents to update.", "constantName": "org.apache.camel.component.arangodb.ArangoDb [...]
@@ -55,7 +56,8 @@
"port": { "index": 6, "kind": "parameter", "displayName": "Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB exposed port. If host and port are default, this field is Optional." },
"vertexCollection": { "index": 7, "kind": "parameter", "displayName": "Vertex Collection", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "Collection name of vertices, when using ArangoDb as a Graph Database. Set the vertexCollec [...]
"lazyStartProducer": { "index": 8, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a produc [...]
- "password": { "index": 9, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." },
- "user": { "index": 10, "kind": "parameter", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." }
+ "arangoDB": { "index": 9, "kind": "parameter", "displayName": "Arango DB", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.arangodb.ArangoDB", "deprecated": false, "autowired": false, "secret": false, "description": "To use an existing ArangDB client." },
+ "password": { "index": 10, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." },
+ "user": { "index": 11, "kind": "parameter", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." }
}
}
diff --git a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
index 2c8a010953c..bd83e9027c0 100644
--- a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
+++ b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.arangodb;
import java.util.Map;
+import com.arangodb.ArangoDB;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.spi.Metadata;
@@ -28,6 +29,8 @@ import org.apache.camel.util.ObjectHelper;
@Component("arangodb")
public class ArangoDbComponent extends DefaultComponent {
+ @Metadata(label = "advanced", autowired = true)
+ private ArangoDB arangoDB;
@Metadata
private ArangoDbConfiguration configuration = new ArangoDbConfiguration();
@@ -47,19 +50,29 @@ public class ArangoDbComponent extends DefaultComponent {
final ArangoDbConfiguration configurationClone
= this.configuration != null ? this.configuration.copy() : new ArangoDbConfiguration();
configurationClone.setDatabase(remaining);
- Endpoint endpoint = new ArangoDbEndpoint(uri, this, configurationClone);
+ ArangoDbEndpoint endpoint = new ArangoDbEndpoint(uri, this, configurationClone);
+ endpoint.setArangoDB(arangoDB);
setProperties(endpoint, parameters);
return endpoint;
}
+ public ArangoDB getArangoDB() {
+ return arangoDB;
+ }
+
+ /**
+ * To use an existing ArangDB client.
+ */
+ public void setArangoDB(ArangoDB arangoDB) {
+ this.arangoDB = arangoDB;
+ }
+
public ArangoDbConfiguration getConfiguration() {
return configuration;
}
/**
* Component configuration
- *
- * @param configuration
*/
public void setConfiguration(ArangoDbConfiguration configuration) {
this.configuration = configuration;
diff --git a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
index f5520ab44e0..63e5d8b3d27 100644
--- a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
+++ b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConfiguration.java
@@ -23,6 +23,7 @@ import org.apache.camel.spi.UriParams;
@UriParams
public class ArangoDbConfiguration implements Cloneable {
private String database;
+
@UriParam(label = "producer")
private String host;
@UriParam(label = "producer")
diff --git a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java
index addf810678a..dd4d64d1906 100644
--- a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java
+++ b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java
@@ -34,14 +34,14 @@ import org.apache.camel.util.ObjectHelper;
@UriEndpoint(firstVersion = "3.5.0", scheme = "arangodb", title = "ArangoDb", syntax = "arangodb:database",
category = { Category.DATABASE }, producerOnly = true, headersClass = ArangoDbConstants.class)
public class ArangoDbEndpoint extends DefaultEndpoint {
- private ArangoDB arango;
@UriPath(description = "database name")
@Metadata(required = true)
private String database;
-
@UriParam
private ArangoDbConfiguration configuration;
+ @UriParam(label = "advanced")
+ private ArangoDB arangoDB;
public ArangoDbEndpoint() {
}
@@ -59,12 +59,15 @@ public class ArangoDbEndpoint extends DefaultEndpoint {
throw new UnsupportedOperationException("You cannot receive messages at this endpoint: " + getEndpointUri());
}
- public ArangoDB getArango() {
- return arango;
+ public ArangoDB getArangoDB() {
+ return arangoDB;
}
- public void setArango(ArangoDB arango) {
- this.arango = arango;
+ /**
+ * To use an existing ArangDB client.
+ */
+ public void setArangoDB(ArangoDB arangoDB) {
+ this.arangoDB = arangoDB;
}
public ArangoDbConfiguration getConfiguration() {
@@ -79,7 +82,7 @@ public class ArangoDbEndpoint extends DefaultEndpoint {
protected void doStart() throws Exception {
super.doStart();
- if (arango == null) {
+ if (arangoDB == null) {
final ArangoDB.Builder builder = new ArangoDB.Builder();
@@ -91,7 +94,7 @@ public class ArangoDbEndpoint extends DefaultEndpoint {
builder.user(configuration.getUser()).password(configuration.getPassword());
}
- arango = builder.build();
+ arangoDB = builder.build();
}
}
@@ -99,8 +102,8 @@ public class ArangoDbEndpoint extends DefaultEndpoint {
@Override
protected void doShutdown() throws Exception {
super.doShutdown();
- if (arango != null) {
- arango.shutdown();
+ if (arangoDB != null) {
+ arangoDB.shutdown();
}
}
diff --git a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbProducer.java b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbProducer.java
index 9344a355f6e..d83dd8b1a5f 100644
--- a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbProducer.java
+++ b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbProducer.java
@@ -28,7 +28,6 @@ import com.arangodb.ArangoDatabase;
import com.arangodb.ArangoEdgeCollection;
import com.arangodb.ArangoGraph;
import com.arangodb.ArangoVertexCollection;
-import com.arangodb.DbName;
import com.arangodb.entity.BaseDocument;
import com.arangodb.entity.BaseEdgeDocument;
import com.arangodb.model.AqlQueryOptions;
@@ -56,7 +55,6 @@ public class ArangoDbProducer extends DefaultProducer {
private final ArangoDbEndpoint endpoint;
private final Map<ArangoDbOperation, Processor> operations = new EnumMap<>(ArangoDbOperation.class);
-
{
bind(ArangoDbOperation.SAVE_DOCUMENT, saveDocument());
bind(ArangoDbOperation.FIND_DOCUMENT_BY_KEY, findDocumentByKey());
@@ -308,7 +306,7 @@ public class ArangoDbProducer extends DefaultProducer {
private Function<Exchange, Object> aqlQuery() {
return exchange -> {
try {
- ArangoDatabase database = endpoint.getArango().db(DbName.of(endpoint.getConfiguration().getDatabase()));
+ ArangoDatabase database = endpoint.getArangoDB().db(endpoint.getConfiguration().getDatabase());
// AQL query
String query = (String) exchange.getMessage().getHeader(AQL_QUERY);
@@ -328,7 +326,7 @@ public class ArangoDbProducer extends DefaultProducer {
resultClassType = resultClassType != null ? resultClassType : BaseDocument.class;
// perform query and return Collection
- try (ArangoCursor<?> cursor = database.query(query, bindParameters, queryOptions, resultClassType)) {
+ try (ArangoCursor<?> cursor = database.query(query, resultClassType, bindParameters, queryOptions)) {
return cursor == null ? null : cursor.asListRemaining();
} catch (IOException e) {
LOG.warn("Failed to close instance of ArangoCursor", e);
@@ -348,7 +346,7 @@ public class ArangoDbProducer extends DefaultProducer {
String collection = endpoint.getConfiguration().getDocumentCollection();
// return collection
- return endpoint.getArango().db(DbName.of(database)).collection(collection);
+ return endpoint.getArangoDB().db(database).collection(collection);
}
/**
@@ -358,7 +356,7 @@ public class ArangoDbProducer extends DefaultProducer {
String database = endpoint.getConfiguration().getDatabase();
String graph = endpoint.getConfiguration().getGraph();
// return vertex collection collection
- return endpoint.getArango().db(DbName.of(database)).graph(graph);
+ return endpoint.getArangoDB().db(database).graph(graph);
}
/**
diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionDeleteIT.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionDeleteIT.java
index a6b7ce1287c..b33ccd82ab7 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionDeleteIT.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionDeleteIT.java
@@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
@DisabledIfSystemProperty(named = "ci.env.name", matches = "apache.org",
disabledReason = "Apache CI nodes are too resource constrained for this test")
-public class ArangoCollectionDeleteIT extends BaseCollection {
+public class ArangoCollectionDeleteIT extends BaseArangoDb {
@Override
protected RouteBuilder createRouteBuilder() {
@@ -58,28 +58,32 @@ public class ArangoCollectionDeleteIT extends BaseCollection {
@Test
public void deleteMultipleDocuments() {
TestDocumentEntity test1 = new TestDocumentEntity("bar1");
+ var o = collection.insertDocument(test1);
+ var k1 = o.getKey();
+
TestDocumentEntity test2 = new TestDocumentEntity("bar2", 10);
- TestDocumentEntity test3 = new TestDocumentEntity("bar3");
+ o = collection.insertDocument(test2);
+ var k2 = o.getKey();
- collection.insertDocument(test1);
- collection.insertDocument(test2);
- collection.insertDocument(test3);
+ TestDocumentEntity test3 = new TestDocumentEntity("bar3");
+ o = collection.insertDocument(test3);
+ var k3 = o.getKey();
template.request("direct:delete", exchange -> {
- exchange.getMessage().setBody(Arrays.asList(test1.getKey(), test2.getKey()));
+ exchange.getMessage().setBody(Arrays.asList(k1, k2));
exchange.getMessage().setHeader(MULTI_DELETE, true);
});
// document is deleted
- TestDocumentEntity document = collection.getDocument(test1.getKey(), TestDocumentEntity.class);
+ TestDocumentEntity document = collection.getDocument(k1, TestDocumentEntity.class);
assertNull(document);
// document is deleted
- document = collection.getDocument(test2.getKey(), TestDocumentEntity.class);
+ document = collection.getDocument(k2, TestDocumentEntity.class);
assertNull(document);
// document is not delete
- document = collection.getDocument(test3.getKey(), TestDocumentEntity.class);
+ document = collection.getDocument(k3, TestDocumentEntity.class);
assertNotNull(document);
assertEquals(test3.getFoo(), document.getFoo());
}
diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionFindByKeyIT.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionFindByKeyIT.java
index d21c2586299..5fa8a69102d 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionFindByKeyIT.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionFindByKeyIT.java
@@ -19,10 +19,10 @@ package org.apache.camel.component.arangodb.integration;
import java.util.Map;
import com.arangodb.entity.BaseDocument;
-import com.arangodb.velocypack.VPackSlice;
+import com.arangodb.util.RawJson;
+import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
@@ -33,21 +33,21 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@DisabledIfSystemProperty(named = "ci.env.name", matches = "apache.org",
disabledReason = "Apache CI nodes are too resource constrained for this test")
-public class ArangoCollectionFindByKeyIT extends BaseCollection {
+public class ArangoCollectionFindByKeyIT extends BaseArangoDb {
private BaseDocument myObject;
- @BeforeEach
@Override
- public void beforeEach() {
- arangoDatabase.createCollection(COLLECTION_NAME);
- collection = arangoDatabase.collection(COLLECTION_NAME);
+ protected CamelContext createCamelContext() {
+ CamelContext ctx = super.createCamelContext();
myObject = new BaseDocument();
myObject.setKey("myKey");
myObject.addAttribute("foo", "bar");
collection.insertDocument(myObject);
+
+ return ctx;
}
@Override
@@ -110,33 +110,18 @@ public class ArangoCollectionFindByKeyIT extends BaseCollection {
assertEquals("bar", String.valueOf(docResult.get("foo")));
}
- @Test
- public void getVpackSliceByKey() {
- Exchange result = template.request("direct:findDocByKey", exchange -> {
- exchange.getMessage().setBody(myObject.getKey());
- exchange.getMessage().setHeader(RESULT_CLASS_TYPE, VPackSlice.class);
- });
-
- assertTrue(result.getMessage().getBody() instanceof VPackSlice);
- VPackSlice docResult = (VPackSlice) result.getMessage().getBody();
- assertNotNull(docResult);
- assertNotNull(docResult.get("foo"));
- assertTrue(docResult.get("foo").isString());
- assertEquals("bar", docResult.get("foo").getAsString());
- }
-
@Test
public void getJsonByKey() {
Exchange result = template.request("direct:findDocByKey", exchange -> {
exchange.getMessage().setBody(myObject.getKey());
- exchange.getMessage().setHeader(RESULT_CLASS_TYPE, String.class);
+ exchange.getMessage().setHeader(RESULT_CLASS_TYPE, RawJson.class);
});
- assertTrue(result.getMessage().getBody() instanceof String);
- String docResult = (String) result.getMessage().getBody();
+ assertTrue(result.getMessage().getBody() instanceof RawJson);
+ RawJson docResult = (RawJson) result.getMessage().getBody();
assertNotNull(docResult);
- assertTrue(docResult.contains("foo"));
- assertTrue(docResult.contains("bar"));
+ assertTrue(docResult.get().contains("foo"));
+ assertTrue(docResult.get().contains("bar"));
}
}
diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionQueryIT.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionQueryIT.java
index ff8a88cad7f..e7405c352ef 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionQueryIT.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionQueryIT.java
@@ -20,7 +20,6 @@ import java.util.Collection;
import java.util.Map;
import java.util.Optional;
-import com.arangodb.util.MapBuilder;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.Test;
@@ -35,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@DisabledIfSystemProperty(named = "ci.env.name", matches = "apache.org",
disabledReason = "Apache CI nodes are too resource constrained for this test")
-public class ArangoCollectionQueryIT extends BaseCollection {
+public class ArangoCollectionQueryIT extends BaseArangoDb {
@Override
protected RouteBuilder createRouteBuilder() {
@@ -60,9 +59,7 @@ public class ArangoCollectionQueryIT extends BaseCollection {
collection.insertDocument(test3);
String query = "FOR t IN " + COLLECTION_NAME + " FILTER t.foo == @foo AND t.number == @number RETURN t";
- Map<String, Object> bindVars = new MapBuilder().put("foo", test.getFoo())
- .put("number", test.getNumber())
- .get();
+ Map<String, Object> bindVars = Map.of("foo", test.getFoo(), "number", test.getNumber());
Exchange result = template.request("direct:query", exchange -> {
exchange.getMessage().setHeader(AQL_QUERY, query);
diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionSaveIT.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionSaveIT.java
index e54c9a04df1..6ced14411fc 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionSaveIT.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionSaveIT.java
@@ -24,10 +24,6 @@ import com.arangodb.ArangoCursor;
import com.arangodb.entity.BaseDocument;
import com.arangodb.entity.DocumentCreateEntity;
import com.arangodb.entity.MultiDocumentEntity;
-import com.arangodb.util.MapBuilder;
-import com.arangodb.velocypack.VPackBuilder;
-import com.arangodb.velocypack.VPackSlice;
-import com.arangodb.velocypack.ValueType;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.Test;
@@ -40,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@DisabledIfSystemProperty(named = "ci.env.name", matches = "apache.org",
disabledReason = "Apache CI nodes are too resource constrained for this test")
-public class ArangoCollectionSaveIT extends BaseCollection {
+public class ArangoCollectionSaveIT extends BaseArangoDb {
@Override
protected RouteBuilder createRouteBuilder() {
@@ -68,7 +64,7 @@ public class ArangoCollectionSaveIT extends BaseCollection {
BaseDocument.class);
assertEquals(docCreated.getKey(), actualResult.getKey());
assertEquals("Foo", actualResult.getAttribute("a"));
- assertEquals(Long.valueOf(42), actualResult.getAttribute("b"));
+ assertEquals(42, actualResult.getAttribute("b"));
}
@Test
@@ -110,44 +106,6 @@ public class ArangoCollectionSaveIT extends BaseCollection {
assertEquals(docCreated.getKey(), actualResult.getKey());
}
- @Test
- public void insertOneVPack() {
- final VPackBuilder builder = new VPackBuilder();
- builder.add(ValueType.OBJECT).add("foo", "bar").close();
- Exchange result = template.request("direct:insert", exchange -> {
- exchange.getMessage().setBody(builder.slice());
- exchange.getMessage().setHeader("abc", "def");
- });
- assertTrue(result.getMessage().getBody() instanceof DocumentCreateEntity);
- DocumentCreateEntity<VPackSlice> docCreated = (DocumentCreateEntity<VPackSlice>) result.getMessage().getBody();
- assertNotNull(docCreated.getKey());
-
- TestDocumentEntity actualResult = collection.getDocument(docCreated.getKey(),
- TestDocumentEntity.class);
- assertEquals("bar", actualResult.getFoo());
- assertEquals(docCreated.getKey(), actualResult.getKey());
-
- }
-
- @Test
- public void insertOneJson() {
- String jsonDoc = "{\"foo\":\"bar\"}";
- final VPackBuilder builder = new VPackBuilder();
- builder.add(ValueType.OBJECT).add("foo", "bar").close();
- Exchange result = template.request("direct:insert", exchange -> {
- exchange.getMessage().setBody(jsonDoc);
- exchange.getMessage().setHeader("abc", "def");
- });
- assertTrue(result.getMessage().getBody() instanceof DocumentCreateEntity);
- DocumentCreateEntity<VPackSlice> docCreated = (DocumentCreateEntity<VPackSlice>) result.getMessage().getBody();
- assertNotNull(docCreated.getKey());
-
- TestDocumentEntity actualResult = collection.getDocument(docCreated.getKey(),
- TestDocumentEntity.class);
- assertEquals("bar", actualResult.getFoo());
- assertEquals(docCreated.getKey(), actualResult.getKey());
- }
-
@Test
public void insertMultipleBeanDocuments() {
TestDocumentEntity test1 = new TestDocumentEntity("bar1");
@@ -163,9 +121,8 @@ public class ArangoCollectionSaveIT extends BaseCollection {
assertTrue(result.getMessage().getBody() instanceof MultiDocumentEntity);
String query = "FOR t IN " + COLLECTION_NAME + " FILTER t.foo == @foo RETURN t";
- Map<String, Object> bindVars = new MapBuilder().put("foo", test1.getFoo()).get();
- ArangoCursor<TestDocumentEntity> cursor = arangoDatabase.query(query, bindVars, null,
- TestDocumentEntity.class);
+ Map<String, Object> bindVars = Map.of("foo", test1.getFoo());
+ ArangoCursor<TestDocumentEntity> cursor = arangoDatabase.query(query, TestDocumentEntity.class, bindVars, null);
cursor.forEachRemaining(test1Inserted -> {
assertNotNull(test1Inserted);
assertNotNull(test1Inserted.getKey());
@@ -175,18 +132,15 @@ public class ArangoCollectionSaveIT extends BaseCollection {
});
- bindVars = new MapBuilder().put("foo", test2.getFoo()).get();
- cursor = arangoDatabase.query(query, bindVars, null,
- TestDocumentEntity.class);
+ bindVars = Map.of("foo", test2.getFoo());
+ cursor = arangoDatabase.query(query, TestDocumentEntity.class, bindVars, null);
cursor.forEachRemaining(test2Inserted -> {
assertNotNull(test2Inserted);
assertNotNull(test2Inserted.getKey());
assertNotNull(test2Inserted.getRev());
assertEquals(test2.getFoo(), test2Inserted.getFoo());
assertEquals(test2.getNumber(), test2Inserted.getNumber());
-
});
-
}
}
diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionUpdateIT.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionUpdateIT.java
index 96906dbe1ce..5d08254a22c 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionUpdateIT.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCollectionUpdateIT.java
@@ -16,24 +16,19 @@
*/
package org.apache.camel.component.arangodb.integration;
-import java.util.ArrayList;
-import java.util.List;
-
import com.arangodb.entity.BaseDocument;
import com.arangodb.entity.DocumentUpdateEntity;
-import com.arangodb.entity.MultiDocumentEntity;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import static org.apache.camel.component.arangodb.ArangoDbConstants.ARANGO_KEY;
-import static org.apache.camel.component.arangodb.ArangoDbConstants.MULTI_UPDATE;
import static org.junit.jupiter.api.Assertions.*;
@DisabledIfSystemProperty(named = "ci.env.name", matches = "apache.org",
disabledReason = "Apache CI nodes are too resource constrained for this test")
-public class ArangoCollectionUpdateIT extends BaseCollection {
+public class ArangoCollectionUpdateIT extends BaseArangoDb {
@Override
protected RouteBuilder createRouteBuilder() {
@@ -69,48 +64,7 @@ public class ArangoCollectionUpdateIT extends BaseCollection {
BaseDocument.class);
assertEquals(myObject.getKey(), actualResult.getKey());
assertEquals("hello", actualResult.getAttribute("foo"));
- assertEquals(Long.valueOf(42), actualResult.getAttribute("gg"));
- }
-
- @Test
- public void testUpdateMultipleDocuments() {
- TestDocumentEntity test1 = new TestDocumentEntity();
- test1.setFoo("bar1");
-
- TestDocumentEntity test2 = new TestDocumentEntity();
- test2.setFoo("bar2");
- test2.setNumber(10);
-
- collection.insertDocument(test1);
- collection.insertDocument(test2);
-
- test1.setNumber(20);
- test2.setFoo("bar2.2");
-
- List<TestDocumentEntity> documents = new ArrayList<>();
- documents.add(test1);
- documents.add(test2);
-
- Exchange result = template.request("direct:update", exchange -> {
- exchange.getMessage().setBody(documents);
- exchange.getMessage().setHeader(MULTI_UPDATE, true);
- });
- assertTrue(result.getMessage().getBody() instanceof MultiDocumentEntity);
- MultiDocumentEntity<DocumentUpdateEntity<TestDocumentEntity>> updateDocs
- = (MultiDocumentEntity<DocumentUpdateEntity<TestDocumentEntity>>) result.getMessage().getBody();
- assertFalse(updateDocs.getDocuments().isEmpty());
-
- TestDocumentEntity test1Updated = collection.getDocument(test1.getKey(), TestDocumentEntity.class);
- assertNotNull(test1Updated);
- assertNotEquals(test1.getRev(), test1Updated.getRev());
- assertEquals(test1.getFoo(), test1Updated.getFoo());
- assertEquals(test1.getNumber(), test1Updated.getNumber());
-
- TestDocumentEntity test2Updated = collection.getDocument(test2.getKey(), TestDocumentEntity.class);
- assertNotNull(test2Updated);
- assertNotEquals(test2.getRev(), test2Updated.getRev());
- assertEquals(test2.getFoo(), test2Updated.getFoo());
- assertEquals(test2.getNumber(), test2Updated.getNumber());
+ assertEquals(42, actualResult.getAttribute("gg"));
}
}
diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoGraphVertexIT.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoGraphVertexIT.java
index 9dd244523f0..1863911c9cc 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoGraphVertexIT.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoGraphVertexIT.java
@@ -66,7 +66,7 @@ public class ArangoGraphVertexIT extends BaseGraph {
BaseDocument.class);
assertEquals(vertexCreated.getKey(), actualResult.getKey());
assertEquals("Foo", actualResult.getAttribute("a"));
- assertEquals(Long.valueOf(42), actualResult.getAttribute("b"));
+ assertEquals(42, actualResult.getAttribute("b"));
}
@Test
@@ -95,7 +95,7 @@ public class ArangoGraphVertexIT extends BaseGraph {
BaseDocument.class);
assertEquals(objectToUpdate.getKey(), actualResult.getKey());
assertEquals("hello", actualResult.getAttribute("foo"));
- assertEquals(Long.valueOf(42), actualResult.getAttribute("gg"));
+ assertEquals(42, actualResult.getAttribute("gg"));
}
@Test
diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java
index 01f295469d7..d781b957c42 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseArangoDb.java
@@ -16,19 +16,18 @@
*/
package org.apache.camel.component.arangodb.integration;
+import com.arangodb.ArangoCollection;
import com.arangodb.ArangoDB;
import com.arangodb.ArangoDatabase;
-import com.arangodb.DbName;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.infra.arangodb.services.ArangoDBService;
import org.apache.camel.test.infra.arangodb.services.ArangoDBServiceFactory;
import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.extension.RegisterExtension;
public class BaseArangoDb extends CamelTestSupport {
+
@RegisterExtension
public static ArangoDBService service = ArangoDBServiceFactory.createService();
@@ -37,24 +36,28 @@ public class BaseArangoDb extends CamelTestSupport {
protected static final String GRAPH_NAME = "graphTest";
protected static final String VERTEX_COLLECTION_NAME = "vertexTest";
protected static final String EDGE_COLLECTION_NAME = "edgeTest";
- protected static ArangoDB arangoDb;
- protected static ArangoDatabase arangoDatabase;
-
- @BeforeAll
- public static void doBeforeAll() {
- arangoDb = new ArangoDB.Builder().build();
- arangoDb.createDatabase(DbName.of(DATABASE_NAME));
- arangoDatabase = arangoDb.db(DbName.of(DATABASE_NAME));
- }
-
- @AfterAll
- public static void doAfterAll() {
- arangoDb.shutdown();
- }
+ protected ArangoDB arangoDb;
+ protected ArangoDatabase arangoDatabase;
+ protected ArangoCollection collection;
@Override
protected CamelContext createCamelContext() {
CamelContext ctx = new DefaultCamelContext();
+
+ arangoDb = new ArangoDB.Builder().host("localhost", 8529).build();
+
+ // drop any existing database to start clean
+ if (arangoDb.getDatabases().contains(DATABASE_NAME)) {
+ arangoDatabase = arangoDb.db(DATABASE_NAME);
+ arangoDatabase.drop();
+ }
+
+ arangoDb.createDatabase(DATABASE_NAME);
+ arangoDatabase = arangoDb.db(DATABASE_NAME);
+ arangoDatabase.createCollection(COLLECTION_NAME);
+ collection = arangoDatabase.collection(COLLECTION_NAME);
+
+ ctx.getRegistry().bind("arangoDB", arangoDb);
ctx.getPropertiesComponent().setLocation("classpath:arango.test.properties");
return ctx;
}
diff --git a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseCollection.java b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseDocumentEntity.java
similarity index 56%
rename from components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseCollection.java
rename to components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseDocumentEntity.java
index 4836fcc5d16..9e7ba1eb5e9 100644
--- a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseCollection.java
+++ b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/BaseDocumentEntity.java
@@ -16,22 +16,37 @@
*/
package org.apache.camel.component.arangodb.integration;
-import com.arangodb.ArangoCollection;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
-public class BaseCollection extends BaseArangoDb {
+public abstract class BaseDocumentEntity {
- protected ArangoCollection collection;
+ @JsonProperty("_key")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private String key;
- @BeforeEach
- public void beforeEach() {
- arangoDatabase.createCollection(COLLECTION_NAME);
- collection = arangoDatabase.collection(COLLECTION_NAME);
+ @JsonProperty("_id")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private String id;
+
+ @JsonProperty("_rev")
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ private String rev;
+
+ public BaseDocumentEntity(String key) {
+ this.key = key;
+ }
+
+ public String getKey() {
+ return key;
}
- @AfterEach
- public void afterEach() {
- collection.drop();
+ public String getId() {
+ return id;
}
+
+ public String getRev() {
+ return rev;
+ }
+
}
diff --git a/parent/pom.xml b/parent/pom.xml
index 8d63fc4745f..87dd50aacd3 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -57,7 +57,7 @@
<apacheds-version>2.0.0.AM26</apacheds-version>
<apache-drill-version>1.21.1</apache-drill-version>
<apicurio-version>1.1.27</apicurio-version>
- <arangodb-java-version>6.20.0</arangodb-java-version>
+ <arangodb-java-version>7.1.0</arangodb-java-version>
<as2-lib-version>4.11.0</as2-lib-version>
<ascii-table-version>1.8.0</ascii-table-version>
<asm-version>9.5</asm-version>
diff --git a/test-infra/camel-test-infra-arangodb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDbContainer.java b/test-infra/camel-test-infra-arangodb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDbContainer.java
index 777c3e68218..b6fdebb85c3 100644
--- a/test-infra/camel-test-infra-arangodb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDbContainer.java
+++ b/test-infra/camel-test-infra-arangodb/src/test/java/org/apache/camel/test/infra/arangodb/services/ArangoDbContainer.java
@@ -24,7 +24,7 @@ import org.testcontainers.containers.wait.strategy.Wait;
public class ArangoDbContainer extends GenericContainer {
public static final Integer PORT_DEFAULT = 8529;
- public static final String ARANGO_IMAGE = "arangodb:3.9.8";
+ public static final String ARANGO_IMAGE = "arangodb:3.10.9";
private static final Logger LOGGER = LoggerFactory.getLogger(ArangoDbContainer.class);
private static final String CONTAINER_NAME = "arango";