This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 6f74f57 CAMEL-15409: ArangoDb - add operations on graphs in the
producer (#4110)
6f74f57 is described below
commit 6f74f578f5460bd5d0b4c945c262f03ea301272d
Author: Zineb BENDHIBA <[email protected]>
AuthorDate: Fri Aug 21 10:48:58 2020 +0200
CAMEL-15409: ArangoDb - add operations on graphs in the producer (#4110)
---
.../arangodb/ArangoDbComponentConfigurer.java | 21 ++-
.../arangodb/ArangoDbEndpointConfigurer.java | 21 ++-
.../apache/camel/component/arangodb/arangodb.json | 34 ++--
.../src/main/docs/arangodb-component.adoc | 38 +++--
.../component/arangodb/ArangoDbConfiguration.java | 76 +++++++--
.../camel/component/arangodb/ArangoDbEndpoint.java | 4 +-
.../component/arangodb/ArangoDbOperation.java | 10 +-
.../camel/component/arangodb/ArangoDbProducer.java | 174 +++++++++++++++++++--
.../arangodb/ArangoCollectionDeleteTest.java | 24 +--
.../arangodb/ArangoCollectionFindByKeyTest.java | 15 +-
.../arangodb/ArangoCollectionQueryTest.java | 54 +++----
.../arangodb/ArangoCollectionSaveTest.java | 24 +--
.../arangodb/ArangoCollectionUpdateTest.java | 19 +--
.../component/arangodb/ArangoDbComponentTest.java | 12 +-
.../component/arangodb/ArangoGraphEdgeTest.java | 140 +++++++++++++++++
.../component/arangodb/ArangoGraphQueriesTest.java | 104 ++++++++++++
.../component/arangodb/ArangoGraphVertexTest.java | 124 +++++++++++++++
...ractArangoDbTest.java => BaseArangoDbTest.java} | 5 +-
.../component/arangodb/BaseCollectionTest.java} | 24 ++-
.../camel/component/arangodb/BaseGraphTest.java | 129 +++++++++++++++
.../src/test/resources/arango.test.properties | 5 +-
.../component/ComponentsBuilderFactory.java | 5 +-
.../dsl/ArangodbComponentBuilderFactory.java | 92 ++++++++---
.../src/generated/resources/metadata.json | 4 +-
.../builder/endpoint/StaticEndpointBuilders.java | 10 +-
.../dsl/ArangoDbEndpointBuilderFactory.java | 94 +++++++++--
26 files changed, 1040 insertions(+), 222 deletions(-)
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 41876bb..72f80d1 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,8 +28,12 @@ public class ArangoDbComponentConfigurer extends
PropertyConfigurerSupport imple
switch (ignoreCase ? name.toLowerCase() : name) {
case "basicpropertybinding":
case "basicPropertyBinding":
target.setBasicPropertyBinding(property(camelContext, boolean.class, value));
return true;
- case "collection":
getOrCreateConfiguration(target).setCollection(property(camelContext,
java.lang.String.class, value)); return true;
case "configuration": target.setConfiguration(property(camelContext,
org.apache.camel.component.arangodb.ArangoDbConfiguration.class, value));
return true;
+ case "documentcollection":
+ case "documentCollection":
getOrCreateConfiguration(target).setDocumentCollection(property(camelContext,
java.lang.String.class, value)); return true;
+ case "edgecollection":
+ case "edgeCollection":
getOrCreateConfiguration(target).setEdgeCollection(property(camelContext,
java.lang.String.class, value)); return true;
+ case "graph":
getOrCreateConfiguration(target).setGraph(property(camelContext,
java.lang.String.class, value)); return true;
case "host":
getOrCreateConfiguration(target).setHost(property(camelContext,
java.lang.String.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
@@ -37,6 +41,8 @@ public class ArangoDbComponentConfigurer extends
PropertyConfigurerSupport imple
case "password":
getOrCreateConfiguration(target).setPassword(property(camelContext,
java.lang.String.class, value)); return true;
case "port":
getOrCreateConfiguration(target).setPort(property(camelContext, int.class,
value)); return true;
case "user":
getOrCreateConfiguration(target).setUser(property(camelContext,
java.lang.String.class, value)); return true;
+ case "vertexcollection":
+ case "vertexCollection":
getOrCreateConfiguration(target).setVertexCollection(property(camelContext,
java.lang.String.class, value)); return true;
default: return false;
}
}
@@ -45,14 +51,17 @@ public class ArangoDbComponentConfigurer extends
PropertyConfigurerSupport imple
public Map<String, Object> getAllOptions(Object target) {
Map<String, Object> answer = new CaseInsensitiveMap();
answer.put("basicPropertyBinding", boolean.class);
- answer.put("collection", java.lang.String.class);
answer.put("configuration",
org.apache.camel.component.arangodb.ArangoDbConfiguration.class);
+ answer.put("documentCollection", java.lang.String.class);
+ answer.put("edgeCollection", java.lang.String.class);
+ answer.put("graph", java.lang.String.class);
answer.put("host", java.lang.String.class);
answer.put("lazyStartProducer", boolean.class);
answer.put("operation",
org.apache.camel.component.arangodb.ArangoDbOperation.class);
answer.put("password", java.lang.String.class);
answer.put("port", int.class);
answer.put("user", java.lang.String.class);
+ answer.put("vertexCollection", java.lang.String.class);
return answer;
}
@@ -62,8 +71,12 @@ public class ArangoDbComponentConfigurer extends
PropertyConfigurerSupport imple
switch (ignoreCase ? name.toLowerCase() : name) {
case "basicpropertybinding":
case "basicPropertyBinding": return target.isBasicPropertyBinding();
- case "collection": return
getOrCreateConfiguration(target).getCollection();
case "configuration": return target.getConfiguration();
+ case "documentcollection":
+ case "documentCollection": return
getOrCreateConfiguration(target).getDocumentCollection();
+ case "edgecollection":
+ case "edgeCollection": return
getOrCreateConfiguration(target).getEdgeCollection();
+ case "graph": return getOrCreateConfiguration(target).getGraph();
case "host": return getOrCreateConfiguration(target).getHost();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
@@ -71,6 +84,8 @@ public class ArangoDbComponentConfigurer extends
PropertyConfigurerSupport imple
case "password": return getOrCreateConfiguration(target).getPassword();
case "port": return getOrCreateConfiguration(target).getPort();
case "user": return getOrCreateConfiguration(target).getUser();
+ case "vertexcollection":
+ case "vertexCollection": return
getOrCreateConfiguration(target).getVertexCollection();
default: return null;
}
}
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 a6bf854..eea0990 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,7 +21,11 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
switch (ignoreCase ? name.toLowerCase() : name) {
case "basicpropertybinding":
case "basicPropertyBinding":
target.setBasicPropertyBinding(property(camelContext, boolean.class, value));
return true;
- case "collection":
target.getConfiguration().setCollection(property(camelContext,
java.lang.String.class, value)); return true;
+ case "documentcollection":
+ case "documentCollection":
target.getConfiguration().setDocumentCollection(property(camelContext,
java.lang.String.class, value)); return true;
+ case "edgecollection":
+ case "edgeCollection":
target.getConfiguration().setEdgeCollection(property(camelContext,
java.lang.String.class, value)); return true;
+ case "graph":
target.getConfiguration().setGraph(property(camelContext,
java.lang.String.class, value)); return true;
case "host": target.getConfiguration().setHost(property(camelContext,
java.lang.String.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
@@ -30,6 +34,8 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
case "port": target.getConfiguration().setPort(property(camelContext,
int.class, value)); return true;
case "synchronous": target.setSynchronous(property(camelContext,
boolean.class, value)); return true;
case "user": target.getConfiguration().setUser(property(camelContext,
java.lang.String.class, value)); return true;
+ case "vertexcollection":
+ case "vertexCollection":
target.getConfiguration().setVertexCollection(property(camelContext,
java.lang.String.class, value)); return true;
default: return false;
}
}
@@ -38,7 +44,9 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
public Map<String, Object> getAllOptions(Object target) {
Map<String, Object> answer = new CaseInsensitiveMap();
answer.put("basicPropertyBinding", boolean.class);
- answer.put("collection", java.lang.String.class);
+ answer.put("documentCollection", java.lang.String.class);
+ answer.put("edgeCollection", java.lang.String.class);
+ answer.put("graph", java.lang.String.class);
answer.put("host", java.lang.String.class);
answer.put("lazyStartProducer", boolean.class);
answer.put("operation",
org.apache.camel.component.arangodb.ArangoDbOperation.class);
@@ -46,6 +54,7 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
answer.put("port", int.class);
answer.put("synchronous", boolean.class);
answer.put("user", java.lang.String.class);
+ answer.put("vertexCollection", java.lang.String.class);
return answer;
}
@@ -55,7 +64,11 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
switch (ignoreCase ? name.toLowerCase() : name) {
case "basicpropertybinding":
case "basicPropertyBinding": return target.isBasicPropertyBinding();
- case "collection": return target.getConfiguration().getCollection();
+ case "documentcollection":
+ case "documentCollection": return
target.getConfiguration().getDocumentCollection();
+ case "edgecollection":
+ case "edgeCollection": return
target.getConfiguration().getEdgeCollection();
+ case "graph": return target.getConfiguration().getGraph();
case "host": return target.getConfiguration().getHost();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
@@ -64,6 +77,8 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
case "port": return target.getConfiguration().getPort();
case "synchronous": return target.isSynchronous();
case "user": return target.getConfiguration().getUser();
+ case "vertexcollection":
+ case "vertexCollection": return
target.getConfiguration().getVertexCollection();
default: return null;
}
}
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 de469e3..d760499 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
@@ -3,9 +3,9 @@
"kind": "component",
"name": "arangodb",
"title": "ArangoDb",
- "description": "Perform operations on ArangoDb documents, collections and
graphs.",
+ "description": "Perform operations on ArangoDb when used as a Document
Database, or as a Graph Database",
"deprecated": false,
- "firstVersion": "3.5.0-SNAPSHOT",
+ "firstVersion": "3.5.0",
"label": "database,nosql",
"javaType": "org.apache.camel.component.arangodb.ArangoDbComponent",
"supportLevel": "Preview",
@@ -21,26 +21,32 @@
"lenientProperties": false
},
"componentProperties": {
- "collection": { "kind": "property", "displayName": "Collection", "group":
"producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "secret": false,
"configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "collection in the
database" },
"configuration": { "kind": "property", "displayName": "Configuration",
"group": "producer", "label": "", "required": false, "type": "object",
"javaType": "org.apache.camel.component.arangodb.ArangoDbConfiguration",
"deprecated": false, "secret": false, "description": "Component configuration"
},
- "host": { "kind": "property", "displayName": "Host", "group": "producer",
"label": "producer", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "host if host and\/or
port different from default" },
+ "documentCollection": { "kind": "property", "displayName": "Document
Collection", "group": "producer", "label": "producer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "Collection name, when
using ArangoDb as a Document Database. Set the documentCollection name when
using the CRUD operat [...]
+ "edgeCollection": { "kind": "property", "displayName": "Edge Collection",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": 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 edgeCollection name
to perform CRUD operation on [...]
+ "graph": { "kind": "property", "displayName": "Graph", "group":
"producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "secret": false,
"configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "Graph name, when using
ArangoDb as a Graph Database. Combine this attribute with one of the two
attributes vertexCollection and edgeCollection." },
+ "host": { "kind": "property", "displayName": "Host", "group": "producer",
"label": "producer", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB host. If host
and port are default, this field is Optional." },
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": 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 producer may otherwise
fail during starting and cause the r [...]
- "operation": { "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" ], "deprecated": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description" [...]
- "port": { "kind": "property", "displayName": "Port", "group": "producer",
"label": "producer", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "port if host and\/or
port different from default" },
+ "operation": { "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, "secret": false, " [...]
+ "port": { "kind": "property", "displayName": "Port", "group": "producer",
"label": "producer", "required": false, "type": "integer", "javaType": "int",
"deprecated": 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": { "kind": "property", "displayName": "Vertex
Collection", "group": "producer", "label": "producer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": 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 vertexCollection
name to perform CRUD operati [...]
"basicPropertyBinding": { "kind": "property", "displayName": "Basic
Property Binding", "group": "advanced", "label": "advanced", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "Whether the component should use basic
property binding (Camel 2.x) or the newer property binding with additional
capabilities" },
- "password": { "kind": "property", "displayName": "Password", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "secret": true,
"configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "password if user and\/or
password different from default" },
- "user": { "kind": "property", "displayName": "User", "group": "security",
"label": "security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "user if user and\/or
password different from default" }
+ "password": { "kind": "property", "displayName": "Password", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": 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": { "kind": "property", "displayName": "User", "group": "security",
"label": "security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": 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." }
},
"properties": {
"database": { "kind": "path", "displayName": "Database", "group":
"producer", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "secret":
false, "description": "database name" },
- "collection": { "kind": "parameter", "displayName": "Collection", "group":
"producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "secret": false,
"configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "collection in the
database" },
- "host": { "kind": "parameter", "displayName": "Host", "group": "producer",
"label": "producer", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "host if host and\/or
port different from default" },
+ "documentCollection": { "kind": "parameter", "displayName": "Document
Collection", "group": "producer", "label": "producer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "Collection name, when
using ArangoDb as a Document Database. Set the documentCollection name when
using the CRUD opera [...]
+ "edgeCollection": { "kind": "parameter", "displayName": "Edge Collection",
"group": "producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": 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 edgeCollection name
to perform CRUD operation on [...]
+ "graph": { "kind": "parameter", "displayName": "Graph", "group":
"producer", "label": "producer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "secret": false,
"configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "Graph name, when using
ArangoDb as a Graph Database. Combine this attribute with one of the two
attributes vertexCollection and edgeCollection." },
+ "host": { "kind": "parameter", "displayName": "Host", "group": "producer",
"label": "producer", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB host. If host
and port are default, this field is Optional." },
"lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": 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 producer may otherwise
fail during starting and cause the [...]
- "operation": { "kind": "parameter", "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" ], "deprecated": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description [...]
- "port": { "kind": "parameter", "displayName": "Port", "group": "producer",
"label": "producer", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "port if host and\/or
port different from default" },
+ "operation": { "kind": "parameter", "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, "secret": false, [...]
+ "port": { "kind": "parameter", "displayName": "Port", "group": "producer",
"label": "producer", "required": false, "type": "integer", "javaType": "int",
"deprecated": 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": { "kind": "parameter", "displayName": "Vertex
Collection", "group": "producer", "label": "producer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": 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 vertexCollection
name to perform CRUD operat [...]
"basicPropertyBinding": { "kind": "parameter", "displayName": "Basic
Property Binding", "group": "advanced", "label": "advanced", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "Whether the endpoint should use basic
property binding (Camel 2.x) or the newer property binding with additional
capabilities" },
"synchronous": { "kind": "parameter", "displayName": "Synchronous",
"group": "advanced", "label": "advanced", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
"false", "description": "Sets whether synchronous processing should be strictly
used, or Camel is allowed to use asynchronous processing (if supported)." },
- "password": { "kind": "parameter", "displayName": "Password", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "secret": true,
"configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "password if user and\/or
password different from default" },
- "user": { "kind": "parameter", "displayName": "User", "group": "security",
"label": "security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "user if user and\/or
password different from default" }
+ "password": { "kind": "parameter", "displayName": "Password", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": 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": { "kind": "parameter", "displayName": "User", "group": "security",
"label": "security", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": 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/docs/arangodb-component.adoc
b/components/camel-arangodb/src/main/docs/arangodb-component.adoc
index d883a0d..ff74b12 100644
--- a/components/camel-arangodb/src/main/docs/arangodb-component.adoc
+++ b/components/camel-arangodb/src/main/docs/arangodb-component.adoc
@@ -2,8 +2,8 @@
= ArangoDb Component
:docTitle: ArangoDb
:artifactId: camel-arangodb
-:description: Perform operations on ArangoDb documents, collections and graphs.
-:since: 3.5.0-SNAPSHOT
+:description: Perform operations on ArangoDb when used as a Document Database,
or as a Graph Database
+:since: 3.5
:supportLevel: Preview
:component-header: Only producer is supported
@@ -38,22 +38,25 @@ arangodb:database[?options]
// component options: START
-The ArangoDb component supports 9 options, which are listed below.
+The ArangoDb component supports 12 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *collection* (producer) | collection in the database | | String
| *configuration* (producer) | Component configuration | |
ArangoDbConfiguration
-| *host* (producer) | host if host and/or port different from default | |
String
+| *documentCollection* (producer) | Collection name, when using ArangoDb as a
Document Database. Set the documentCollection name when using the CRUD
operation on the document database collections (SAVE_DOCUMENT ,
FIND_DOCUMENT_BY_KEY, UPDATE_DOCUMENT, DELETE_DOCUMENT). | | String
+| *edgeCollection* (producer) | Collection name of vertices, when using
ArangoDb as a Graph Database. Set the edgeCollection name to perform CRUD
operation on edges using these operations : SAVE_VERTEX, FIND_VERTEX_BY_KEY,
UPDATE_VERTEX, DELETE_VERTEX. The graph attribute is mandatory. | | String
+| *graph* (producer) | Graph name, when using ArangoDb as a Graph Database.
Combine this attribute with one of the two attributes vertexCollection and
edgeCollection. | | String
+| *host* (producer) | ArangoDB host. If host and port are default, this field
is Optional. | | String
| *lazyStartProducer* (producer) | 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 producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
-| *operation* (producer) | operation to perform. The value can be one of:
SAVE_DOCUMENT, FIND_DOCUMENT_BY_KEY, UPDATE_DOCUMENT, DELETE_DOCUMENT,
AQL_QUERY | | ArangoDbOperation
-| *port* (producer) | port if host and/or port different from default | | int
+| *operation* (producer) | Operations to perform on ArangoDb. For the
operation AQL_QUERY, no need to specify a collection or graph. The value can be
one of: 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 | | ArangoDbOperation
+| *port* (producer) | ArangoDB exposed port. If host and port are default,
this field is Optional. | | int
+| *vertexCollection* (producer) | Collection name of vertices, when using
ArangoDb as a Graph Database. Set the vertexCollection name to perform CRUD
operation on vertices using these operations : SAVE_EDGE, FIND_EDGE_BY_KEY,
UPDATE_EDGE, DELETE_EDGE. The graph attribute is mandatory. | | String
| *basicPropertyBinding* (advanced) | Whether the component should use basic
property binding (Camel 2.x) or the newer property binding with additional
capabilities | false | boolean
-| *password* (security) | password if user and/or password different from
default | | String
-| *user* (security) | user if user and/or password different from default | |
String
+| *password* (security) | ArangoDB password. If user and password are default,
this field is Optional. | | String
+| *user* (security) | ArangoDB user. If user and password are default, this
field is Optional. | | String
|===
// component options: END
@@ -76,21 +79,24 @@ with the following path and query parameters:
|===
-=== Query Parameters (9 parameters):
+=== Query Parameters (12 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *collection* (producer) | collection in the database | | String
-| *host* (producer) | host if host and/or port different from default | |
String
+| *documentCollection* (producer) | Collection name, when using ArangoDb as a
Document Database. Set the documentCollection name when using the CRUD
operation on the document database collections (SAVE_DOCUMENT ,
FIND_DOCUMENT_BY_KEY, UPDATE_DOCUMENT, DELETE_DOCUMENT). | | String
+| *edgeCollection* (producer) | Collection name of vertices, when using
ArangoDb as a Graph Database. Set the edgeCollection name to perform CRUD
operation on edges using these operations : SAVE_VERTEX, FIND_VERTEX_BY_KEY,
UPDATE_VERTEX, DELETE_VERTEX. The graph attribute is mandatory. | | String
+| *graph* (producer) | Graph name, when using ArangoDb as a Graph Database.
Combine this attribute with one of the two attributes vertexCollection and
edgeCollection. | | String
+| *host* (producer) | ArangoDB host. If host and port are default, this field
is Optional. | | String
| *lazyStartProducer* (producer) | 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 producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
-| *operation* (producer) | operation to perform. The value can be one of:
SAVE_DOCUMENT, FIND_DOCUMENT_BY_KEY, UPDATE_DOCUMENT, DELETE_DOCUMENT,
AQL_QUERY | | ArangoDbOperation
-| *port* (producer) | port if host and/or port different from default | | int
+| *operation* (producer) | Operations to perform on ArangoDb. For the
operation AQL_QUERY, no need to specify a collection or graph. The value can be
one of: 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 | | ArangoDbOperation
+| *port* (producer) | ArangoDB exposed port. If host and port are default,
this field is Optional. | | int
+| *vertexCollection* (producer) | Collection name of vertices, when using
ArangoDb as a Graph Database. Set the vertexCollection name to perform CRUD
operation on vertices using these operations : SAVE_EDGE, FIND_EDGE_BY_KEY,
UPDATE_EDGE, DELETE_EDGE. The graph attribute is mandatory. | | String
| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic
property binding (Camel 2.x) or the newer property binding with additional
capabilities | false | boolean
| *synchronous* (advanced) | Sets whether synchronous processing should be
strictly used, or Camel is allowed to use asynchronous processing (if
supported). | false | boolean
-| *password* (security) | password if user and/or password different from
default | | String
-| *user* (security) | user if user and/or password different from default | |
String
+| *password* (security) | ArangoDB password. If user and password are default,
this field is Optional. | | String
+| *user* (security) | ArangoDB user. If user and password are default, this
field is Optional. | | String
|===
// endpoint options: END
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 6a3602b..f5520ab 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
@@ -32,9 +32,15 @@ public class ArangoDbConfiguration implements Cloneable {
@UriParam(label = "security", secret = true)
private String password;
@UriParam(label = "producer")
- private String collection;
+ private String documentCollection;
@UriParam(label = "producer")
private ArangoDbOperation operation;
+ @UriParam(label = "producer")
+ private String graph;
+ @UriParam(label = "producer")
+ private String vertexCollection;
+ @UriParam(label = "producer")
+ private String edgeCollection;
public ArangoDbConfiguration() {
}
@@ -57,7 +63,7 @@ public class ArangoDbConfiguration implements Cloneable {
}
/**
- * host if host and/or port different from default
+ * ArangoDB host. If host and port are default, this field is Optional.
*
* @param host
*/
@@ -70,7 +76,7 @@ public class ArangoDbConfiguration implements Cloneable {
}
/**
- * port if host and/or port different from default
+ * ArangoDB exposed port. If host and port are default, this field is
Optional.
*
* @param port
*/
@@ -83,7 +89,7 @@ public class ArangoDbConfiguration implements Cloneable {
}
/**
- * user if user and/or password different from default
+ * ArangoDB user. If user and password are default, this field is Optional.
*
* @param user
*/
@@ -96,7 +102,7 @@ public class ArangoDbConfiguration implements Cloneable {
}
/**
- * password if user and/or password different from default
+ * ArangoDB password. If user and password are default, this field is
Optional.
*
* @param password
*/
@@ -104,17 +110,19 @@ public class ArangoDbConfiguration implements Cloneable {
this.password = password;
}
- public String getCollection() {
- return collection;
+ public String getDocumentCollection() {
+ return documentCollection;
}
/**
- * collection in the database
+ * Collection name, when using ArangoDb as a Document Database. Set the
documentCollection name when using the CRUD
+ * operation on the document database collections (SAVE_DOCUMENT ,
FIND_DOCUMENT_BY_KEY, UPDATE_DOCUMENT,
+ * DELETE_DOCUMENT).
*
- * @param collection
+ * @param documentCollection
*/
- public void setCollection(String collection) {
- this.collection = collection;
+ public void setDocumentCollection(String documentCollection) {
+ this.documentCollection = documentCollection;
}
public ArangoDbOperation getOperation() {
@@ -122,7 +130,7 @@ public class ArangoDbConfiguration implements Cloneable {
}
/**
- * operation to perform
+ * Operations to perform on ArangoDb. For the operation AQL_QUERY, no need
to specify a collection or graph.
*
* @param operation
*/
@@ -130,6 +138,50 @@ public class ArangoDbConfiguration implements Cloneable {
this.operation = operation;
}
+ public String getGraph() {
+ return graph;
+ }
+
+ /**
+ * Graph name, when using ArangoDb as a Graph Database. Combine this
attribute with one of the two attributes
+ * vertexCollection and edgeCollection.
+ *
+ * @param graph
+ */
+ public void setGraph(String graph) {
+ this.graph = graph;
+ }
+
+ public String getVertexCollection() {
+ return vertexCollection;
+ }
+
+ /**
+ * Collection name of vertices, when using ArangoDb as a Graph Database.
Set the vertexCollection name to perform
+ * CRUD operation on vertices using these operations : SAVE_EDGE,
FIND_EDGE_BY_KEY, UPDATE_EDGE, DELETE_EDGE. The
+ * graph attribute is mandatory.
+ *
+ * @param vertexCollection
+ */
+ public void setVertexCollection(String vertexCollection) {
+ this.vertexCollection = vertexCollection;
+ }
+
+ public String getEdgeCollection() {
+ return edgeCollection;
+ }
+
+ /**
+ * Collection name of vertices, when using ArangoDb as a Graph Database.
Set the edgeCollection name to perform CRUD
+ * operation on edges using these operations : SAVE_VERTEX,
FIND_VERTEX_BY_KEY, UPDATE_VERTEX, DELETE_VERTEX. The
+ * graph attribute is mandatory.
+ *
+ * @param edgeCollection
+ */
+ public void setEdgeCollection(String edgeCollection) {
+ this.edgeCollection = edgeCollection;
+ }
+
public ArangoDbConfiguration copy() {
try {
return (ArangoDbConfiguration) super.clone();
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 c3ee0bd..c0b48c8 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
@@ -29,9 +29,9 @@ import org.apache.camel.support.DefaultEndpoint;
import org.apache.camel.util.ObjectHelper;
/**
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or as a
Graph Database
*/
-@UriEndpoint(firstVersion = "3.5.0-SNAPSHOT", scheme = "arangodb", title =
"ArangoDb", syntax = "arangodb:database",
+@UriEndpoint(firstVersion = "3.5.0", scheme = "arangodb", title = "ArangoDb",
syntax = "arangodb:database",
category = { Category.DATABASE, Category.NOSQL }, producerOnly =
true)
public class ArangoDbEndpoint extends DefaultEndpoint {
private ArangoDB arango;
diff --git
a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbOperation.java
b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbOperation.java
index 562cb33..ebfad82 100644
---
a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbOperation.java
+++
b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbOperation.java
@@ -21,5 +21,13 @@ public enum ArangoDbOperation {
FIND_DOCUMENT_BY_KEY,
UPDATE_DOCUMENT,
DELETE_DOCUMENT,
- AQL_QUERY
+ AQL_QUERY,
+ SAVE_VERTEX,
+ FIND_VERTEX_BY_KEY,
+ UPDATE_VERTEX,
+ DELETE_VERTEX,
+ SAVE_EDGE,
+ FIND_EDGE_BY_KEY,
+ UPDATE_EDGE,
+ DELETE_EDGE
}
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 07b1841..bef0c88 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
@@ -22,8 +22,13 @@ import java.util.Map;
import java.util.function.Function;
import com.arangodb.ArangoCollection;
+import com.arangodb.ArangoCursor;
import com.arangodb.ArangoDatabase;
+import com.arangodb.ArangoEdgeCollection;
+import com.arangodb.ArangoGraph;
+import com.arangodb.ArangoVertexCollection;
import com.arangodb.entity.BaseDocument;
+import com.arangodb.entity.BaseEdgeDocument;
import com.arangodb.model.AqlQueryOptions;
import org.apache.camel.Exchange;
import org.apache.camel.InvalidPayloadException;
@@ -53,6 +58,14 @@ public class ArangoDbProducer extends DefaultProducer {
bind(ArangoDbOperation.UPDATE_DOCUMENT, updateDocument());
bind(ArangoDbOperation.DELETE_DOCUMENT, deleteDocument());
bind(ArangoDbOperation.AQL_QUERY, aqlQuery());
+ bind(ArangoDbOperation.SAVE_VERTEX, saveVertex());
+ bind(ArangoDbOperation.UPDATE_VERTEX, updateVertex());
+ bind(ArangoDbOperation.DELETE_VERTEX, deleteVertex());
+ bind(ArangoDbOperation.FIND_VERTEX_BY_KEY, findVertexByKey());
+ bind(ArangoDbOperation.SAVE_EDGE, saveEdge());
+ bind(ArangoDbOperation.UPDATE_EDGE, updateEdge());
+ bind(ArangoDbOperation.FIND_EDGE_BY_KEY, findEdgeByKey());
+ bind(ArangoDbOperation.DELETE_EDGE, deleteEdge());
}
public ArangoDbProducer(ArangoDbEndpoint endpoint) {
@@ -100,7 +113,7 @@ public class ArangoDbProducer extends DefaultProducer {
private Function<Exchange, Object> saveDocument() {
return exchange -> {
try {
- ArangoCollection collection = calculateCollection();
+ ArangoCollection collection = calculateDocumentCollection();
Boolean isMultiInsert = (Boolean)
exchange.getMessage().getHeader(MULTI_INSERT, false);
// save multiple document
@@ -121,7 +134,7 @@ public class ArangoDbProducer extends DefaultProducer {
private Function<Exchange, Object> findDocumentByKey() {
return exchange -> {
try {
- ArangoCollection collection = calculateCollection();
+ ArangoCollection collection = calculateDocumentCollection();
// key
String key = exchange.getIn().getMandatoryBody(String.class);
// return type
@@ -138,7 +151,7 @@ public class ArangoDbProducer extends DefaultProducer {
private Function<Exchange, Object> updateDocument() {
return exchange -> {
try {
- ArangoCollection collection = calculateCollection();
+ ArangoCollection collection = calculateDocumentCollection();
Boolean isMultiUpdate = (Boolean)
exchange.getMessage().getHeader(MULTI_UPDATE, false);
@@ -161,7 +174,7 @@ public class ArangoDbProducer extends DefaultProducer {
private Function<Exchange, Object> deleteDocument() {
return exchange -> {
try {
- ArangoCollection collection = calculateCollection();
+ ArangoCollection collection = calculateDocumentCollection();
Boolean isMultiUpdate = (Boolean)
exchange.getMessage().getHeader(MULTI_DELETE, false);
// if multiple documents to delete
@@ -179,6 +192,114 @@ public class ArangoDbProducer extends DefaultProducer {
};
}
+ private Function<Exchange, Object> saveVertex() {
+ return exchange -> {
+ try {
+ ArangoVertexCollection vertexCollection =
calculateVertexCollection();
+ Object vertexDocument =
exchange.getMessage().getMandatoryBody();
+ return vertexCollection.insertVertex(vertexDocument);
+ } catch (InvalidPayloadException e) {
+ throw new RuntimeException("Invalid payload for command", e);
+ }
+ };
+ }
+
+ private Function<Exchange, Object> updateVertex() {
+ return exchange -> {
+ try {
+ ArangoVertexCollection vertexCollection =
calculateVertexCollection();
+ String key = (String)
exchange.getMessage().getHeader(ARANGO_KEY);
+ Object vertexDocument =
exchange.getMessage().getMandatoryBody();
+ return vertexCollection.updateVertex(key, vertexDocument);
+ } catch (InvalidPayloadException e) {
+ throw new RuntimeException("Invalid payload for command", e);
+ }
+ };
+ }
+
+ private Function<Exchange, Object> deleteVertex() {
+ return exchange -> {
+ try {
+ ArangoVertexCollection vertexCollection =
calculateVertexCollection();
+ String singleKey =
exchange.getMessage().getMandatoryBody(String.class);
+ vertexCollection.deleteVertex(singleKey);
+ return true;
+ } catch (InvalidPayloadException e) {
+ throw new RuntimeException("Invalid payload for command", e);
+ }
+ };
+ }
+
+ private Function<Exchange, Object> findVertexByKey() {
+ return exchange -> {
+ try {
+ ArangoVertexCollection vertexCollection =
calculateVertexCollection();
+ // key
+ String key = exchange.getIn().getMandatoryBody(String.class);
+ // return type
+ Class<?> resultClassType = (Class<?>)
exchange.getIn().getHeader(RESULT_CLASS_TYPE);
+ resultClassType = resultClassType != null ? resultClassType :
BaseDocument.class;
+ return vertexCollection.getVertex(key, resultClassType);
+ } catch (InvalidPayloadException e) {
+ throw new RuntimeException("Invalid payload for command", e);
+ }
+ };
+ }
+
+ private Function<Exchange, Object> saveEdge() {
+ return exchange -> {
+ try {
+ ArangoEdgeCollection edgeCollection =
calculateEdgeCollection();
+ Object edgeDocument = exchange.getMessage().getMandatoryBody();
+ return edgeCollection.insertEdge(edgeDocument);
+ } catch (InvalidPayloadException e) {
+ throw new RuntimeException("Invalid payload for command", e);
+ }
+ };
+ }
+
+ private Function<Exchange, Object> updateEdge() {
+ return exchange -> {
+ try {
+ ArangoEdgeCollection edgeCollection =
calculateEdgeCollection();
+ String key = (String)
exchange.getMessage().getHeader(ARANGO_KEY);
+ Object edgeDocument = exchange.getMessage().getMandatoryBody();
+ return edgeCollection.updateEdge(key, edgeDocument);
+ } catch (InvalidPayloadException e) {
+ throw new RuntimeException("Invalid payload for command", e);
+ }
+ };
+ }
+
+ private Function<Exchange, Object> deleteEdge() {
+ return exchange -> {
+ try {
+ ArangoEdgeCollection edgeCollection =
calculateEdgeCollection();
+ String singleKey =
exchange.getMessage().getMandatoryBody(String.class);
+ edgeCollection.deleteEdge(singleKey);
+ return true;
+ } catch (InvalidPayloadException e) {
+ throw new RuntimeException("Invalid payload for command", e);
+ }
+ };
+ }
+
+ private Function<Exchange, Object> findEdgeByKey() {
+ return exchange -> {
+ try {
+ ArangoEdgeCollection edgeCollection =
calculateEdgeCollection();
+ // key
+ String key = exchange.getIn().getMandatoryBody(String.class);
+ // return type
+ Class<?> resultClassType = (Class<?>)
exchange.getIn().getHeader(RESULT_CLASS_TYPE);
+ resultClassType = resultClassType != null ? resultClassType :
BaseEdgeDocument.class;
+ return edgeCollection.getEdge(key, resultClassType);
+ } catch (InvalidPayloadException e) {
+ throw new RuntimeException("Invalid payload for command", e);
+ }
+ };
+ }
+
private Function<Exchange, Object> aqlQuery() {
return exchange -> {
try {
@@ -192,17 +313,18 @@ public class ArangoDbProducer extends DefaultProducer {
// parameters to bind :: can be null if nothing to bind
Map<String, Object> bindParameters
- = (Map<String, Object>)
exchange.getMessage().getHeader(AQL_QUERY_BIND_PARAMETERS);
+ =
exchange.getMessage().getHeader(AQL_QUERY_BIND_PARAMETERS, Map.class);
- // options :: can be null
+ // options (advanced) :: can be null
AqlQueryOptions queryOptions = (AqlQueryOptions)
exchange.getMessage().getHeader(AQL_QUERY_OPTIONS);
// Class Type for cursor in return :: by default BaseDocument
Class<?> resultClassType = (Class<?>)
exchange.getIn().getHeader(RESULT_CLASS_TYPE);
resultClassType = resultClassType != null ? resultClassType :
BaseDocument.class;
- // perform query and return ArangoCursor of class Type
- return database.query(query, bindParameters, queryOptions,
resultClassType);
+ // perform query and return Collection
+ ArangoCursor<?> cursor = database.query(query, bindParameters,
queryOptions, resultClassType);
+ return cursor == null ? null : cursor.asListRemaining();
} catch (InvalidPayloadException e) {
throw new RuntimeException("Invalid payload for command", e);
}
@@ -210,14 +332,44 @@ public class ArangoDbProducer extends DefaultProducer {
}
/**
- * retrieve collection from endpoints params
+ * retrieve document collection from endpoint params
*/
- private ArangoCollection calculateCollection() {
+ private ArangoCollection calculateDocumentCollection() {
String database = endpoint.getConfiguration().getDatabase();
- String collection = endpoint.getConfiguration().getCollection();
+ String collection =
endpoint.getConfiguration().getDocumentCollection();
// return collection
return endpoint.getArango().db(database).collection(collection);
}
+ /**
+ * retrieve graph from endpoint params
+ */
+ private ArangoGraph calculateGraph() {
+ String database = endpoint.getConfiguration().getDatabase();
+ String graph = endpoint.getConfiguration().getGraph();
+ // return vertex collection collection
+ return endpoint.getArango().db(database).graph(graph);
+ }
+
+ /**
+ * retrieve vertex collection from endpoints params
+ */
+ private ArangoVertexCollection calculateVertexCollection() {
+ String vertexCollection =
endpoint.getConfiguration().getVertexCollection();
+
+ // return vertex collection collection
+ return calculateGraph().vertexCollection(vertexCollection);
+ }
+
+ /**
+ * retrieve edge collection from endpoints params
+ */
+ private ArangoEdgeCollection calculateEdgeCollection() {
+ String edgeCollection =
endpoint.getConfiguration().getEdgeCollection();
+
+ // return edge collection collection
+ return calculateGraph().edgeCollection(edgeCollection);
+ }
+
}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionDeleteTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionDeleteTest.java
index 1105211..3e2c5f2 100644
---
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionDeleteTest.java
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionDeleteTest.java
@@ -18,11 +18,8 @@ package org.apache.camel.component.arangodb;
import java.util.Arrays;
-import com.arangodb.ArangoCollection;
import com.arangodb.entity.BaseDocument;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static
org.apache.camel.component.arangodb.ArangoDbConstants.MULTI_DELETE;
@@ -30,27 +27,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
-public class ArangoCollectionDeleteTest extends AbstractArangoDbTest {
-
- private ArangoCollection collection;
-
- @BeforeEach
- public void beforeEach() {
- arangoDatabase.createCollection(COLLECTION_NAME);
- collection = arangoDatabase.collection(COLLECTION_NAME);
- }
-
- @AfterEach
- public void afterEach() {
- collection.drop();
- }
+public class ArangoCollectionDeleteTest extends BaseCollectionTest {
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:delete")
-
.to("arangodb:{{arangodb.testDb}}?collection={{arangodb.testCollection}}&operation=DELETE_DOCUMENT");
+
.to("arangodb:{{arangodb.testDb}}?documentCollection={{arangodb.testCollection}}&operation=DELETE_DOCUMENT");
}
};
}
@@ -62,9 +46,7 @@ public class ArangoCollectionDeleteTest extends
AbstractArangoDbTest {
myObject.addAttribute("foo", "bar");
collection.insertDocument(myObject);
- template.request("direct:delete", exchange -> {
- exchange.getMessage().setBody("myKey");
- });
+ template.request("direct:delete", exchange ->
exchange.getMessage().setBody("myKey"));
BaseDocument documentDeleted =
collection.getDocument(myObject.getKey(), BaseDocument.class);
assertNull(documentDeleted);
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionFindByKeyTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionFindByKeyTest.java
index 4caca09..3e05a88 100644
---
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionFindByKeyTest.java
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionFindByKeyTest.java
@@ -18,12 +18,10 @@ package org.apache.camel.component.arangodb;
import java.util.Map;
-import com.arangodb.ArangoCollection;
import com.arangodb.entity.BaseDocument;
import com.arangodb.velocypack.VPackSlice;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -32,12 +30,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ArangoCollectionFindByKeyTest extends AbstractArangoDbTest {
- private ArangoCollection collection;
+public class ArangoCollectionFindByKeyTest extends BaseCollectionTest {
private BaseDocument myObject;
@BeforeEach
+ @Override
public void beforeEach() {
arangoDatabase.createCollection(COLLECTION_NAME);
collection = arangoDatabase.collection(COLLECTION_NAME);
@@ -49,17 +47,12 @@ public class ArangoCollectionFindByKeyTest extends
AbstractArangoDbTest {
collection.insertDocument(myObject);
}
- @AfterEach
- public void afterEach() {
- collection.drop();
- }
-
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:findDocByKey")
-
.to("arangodb://dbTest?collection={{arangodb.testCollection}}&operation=FIND_DOCUMENT_BY_KEY");
+
.to("arangodb://dbTest?documentCollection={{arangodb.testCollection}}&operation=FIND_DOCUMENT_BY_KEY");
}
};
}
@@ -76,7 +69,7 @@ public class ArangoCollectionFindByKeyTest extends
AbstractArangoDbTest {
@Test
public void findDocumentByKey() {
- // test without header setting type of Message expected
+ // test with header setting type of Message expected
Exchange result = template.request("direct:findDocByKey", exchange -> {
exchange.getMessage().setBody(myObject.getKey());
exchange.getMessage().setHeader(RESULT_CLASS_TYPE,
BaseDocument.class);
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionQueryTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionQueryTest.java
index 6806125..4d831ad 100644
---
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionQueryTest.java
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionQueryTest.java
@@ -16,34 +16,23 @@
*/
package org.apache.camel.component.arangodb;
+import java.util.Collection;
import java.util.Map;
+import java.util.Optional;
-import com.arangodb.ArangoCollection;
-import com.arangodb.ArangoCursor;
import com.arangodb.util.MapBuilder;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import static org.apache.camel.component.arangodb.ArangoDbConstants.*;
-import static org.junit.jupiter.api.Assertions.*;
+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.RESULT_CLASS_TYPE;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ArangoCollectionQueryTest extends AbstractArangoDbTest {
-
- private ArangoCollection collection;
-
- @BeforeEach
- public void beforeEach() {
- arangoDatabase.createCollection(COLLECTION_NAME);
- collection = arangoDatabase.collection(COLLECTION_NAME);
- }
-
- @AfterEach
- public void afterEach() {
- collection.drop();
- }
+public class ArangoCollectionQueryTest extends BaseCollectionTest {
@Override
protected RouteBuilder createRouteBuilder() {
@@ -57,7 +46,6 @@ public class ArangoCollectionQueryTest extends
AbstractArangoDbTest {
@Test
public void findByParameters() {
-
TestDocumentEntity test = new TestDocumentEntity("bar", 10);
collection.insertDocument(test);
@@ -76,21 +64,21 @@ public class ArangoCollectionQueryTest extends
AbstractArangoDbTest {
Exchange result = template.request("direct:query", exchange -> {
exchange.getMessage().setHeader(AQL_QUERY, query);
exchange.getMessage().setHeader(AQL_QUERY_BIND_PARAMETERS,
bindVars);
- exchange.getMessage().setHeader(AQL_QUERY_OPTIONS, null);
exchange.getMessage().setHeader(RESULT_CLASS_TYPE,
TestDocumentEntity.class);
});
- assertTrue(result.getMessage().getBody() instanceof ArangoCursor);
- ArangoCursor<TestDocumentEntity> cursor =
(ArangoCursor<TestDocumentEntity>) result.getMessage().getBody();
-
- assertTrue(cursor.hasNext());
- cursor.forEachRemaining(doc -> {
- assertNotNull(doc);
- assertNotNull(doc.getKey());
- assertNotNull(doc.getRev());
- assertEquals(test.getFoo(), doc.getFoo());
- assertEquals(test.getNumber(), doc.getNumber());
- });
+ assertTrue(result.getMessage().getBody() instanceof Collection);
+ Collection<TestDocumentEntity> list = (Collection<TestDocumentEntity>)
result.getMessage().getBody();
+
+ assertNotNull(list);
+ Optional<TestDocumentEntity> optional = list.stream().findFirst();
+ assertTrue(optional.isPresent());
+ TestDocumentEntity doc = optional.get();
+ assertNotNull(doc);
+ assertNotNull(doc.getKey());
+ assertNotNull(doc.getRev());
+ assertEquals(test.getFoo(), doc.getFoo());
+ assertEquals(test.getNumber(), doc.getNumber());
}
}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionSaveTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionSaveTest.java
index 3c98a21..ffdf579 100644
---
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionSaveTest.java
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionSaveTest.java
@@ -20,7 +20,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import com.arangodb.ArangoCollection;
import com.arangodb.ArangoCursor;
import com.arangodb.entity.BaseDocument;
import com.arangodb.entity.DocumentCreateEntity;
@@ -31,8 +30,6 @@ 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.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static
org.apache.camel.component.arangodb.ArangoDbConstants.MULTI_INSERT;
@@ -40,26 +37,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ArangoCollectionSaveTest extends AbstractArangoDbTest {
- private ArangoCollection collection;
-
- @BeforeEach
- public void beforeEach() {
- arangoDatabase.createCollection(COLLECTION_NAME);
- collection = arangoDatabase.collection(COLLECTION_NAME);
- }
-
- @AfterEach
- public void afterEach() {
- collection.drop();
- }
+public class ArangoCollectionSaveTest extends BaseCollectionTest {
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:insert")
-
.to("arangodb:{{arangodb.testDb}}?collection={{arangodb.testCollection}}&operation=SAVE_DOCUMENT");
+
.to("arangodb:{{arangodb.testDb}}?documentCollection={{arangodb.testCollection}}&operation=SAVE_DOCUMENT");
}
};
}
@@ -70,10 +55,7 @@ public class ArangoCollectionSaveTest extends
AbstractArangoDbTest {
myObject.addAttribute("a", "Foo");
myObject.addAttribute("b", 42);
- Exchange result = template.request("direct:insert", exchange -> {
- exchange.getMessage().setBody(myObject);
- exchange.getMessage().setHeader("abc", "def");
- });
+ Exchange result = template.request("direct:insert", exchange ->
exchange.getMessage().setBody(myObject));
assertTrue(result.getMessage().getBody() instanceof
DocumentCreateEntity);
DocumentCreateEntity<BaseDocument> docCreated =
(DocumentCreateEntity<BaseDocument>) result.getMessage().getBody();
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionUpdateTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionUpdateTest.java
index 7abbc3a..11de780 100644
---
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionUpdateTest.java
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoCollectionUpdateTest.java
@@ -19,40 +19,25 @@ package org.apache.camel.component.arangodb;
import java.util.ArrayList;
import java.util.List;
-import com.arangodb.ArangoCollection;
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.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
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.*;
-public class ArangoCollectionUpdateTest extends AbstractArangoDbTest {
- private ArangoCollection collection;
-
- @BeforeEach
- public void beforeEach() {
- arangoDatabase.createCollection(COLLECTION_NAME);
- collection = arangoDatabase.collection(COLLECTION_NAME);
- }
-
- @AfterEach
- public void afterEach() {
- collection.drop();
- }
+public class ArangoCollectionUpdateTest extends BaseCollectionTest {
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:update")
-
.to("arangodb:{{arangodb.testDb}}?collection={{arangodb.testCollection}}&operation=UPDATE_DOCUMENT");
+
.to("arangodb:{{arangodb.testDb}}?documentCollection={{arangodb.testCollection}}&operation=UPDATE_DOCUMENT");
}
};
}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoDbComponentTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoDbComponentTest.java
index bee03a8..56abb2c 100644
---
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoDbComponentTest.java
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoDbComponentTest.java
@@ -28,17 +28,15 @@ public class ArangoDbComponentTest extends CamelTestSupport
{
public void createEndpointWithMinimalConfiguration() throws Exception {
ArangoDbComponent component = context.getComponent("arangodb",
ArangoDbComponent.class);
ArangoDbEndpoint endpoint = (ArangoDbEndpoint) component
- .createEndpoint("arangodb:testDb?collection=myCollection");
+
.createEndpoint("arangodb:testDb?documentCollection=myCollection");
assertEquals("testDb", endpoint.getConfiguration().getDatabase());
- assertEquals("myCollection",
endpoint.getConfiguration().getCollection());
+ assertEquals("myCollection",
endpoint.getConfiguration().getDocumentCollection());
}
@Test
- public void testRouteWithNoDatabaseName() throws Exception {
+ public void testRouteWithNoDatabaseName() {
ArangoDbComponent component = context.getComponent("arangodb",
ArangoDbComponent.class);
- assertThrows(IllegalArgumentException.class, () -> {
- component
- .createEndpoint("arangodb?collection=myCollection");
- });
+ assertThrows(IllegalArgumentException.class, () -> component
+ .createEndpoint("arangodb?documentCollection=myCollection"));
}
}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphEdgeTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphEdgeTest.java
new file mode 100644
index 0000000..a12d0fa
--- /dev/null
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphEdgeTest.java
@@ -0,0 +1,140 @@
+/*
+ * 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.component.arangodb;
+
+import com.arangodb.entity.BaseDocument;
+import com.arangodb.entity.BaseEdgeDocument;
+import com.arangodb.entity.EdgeEntity;
+import com.arangodb.entity.EdgeUpdateEntity;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.component.arangodb.ArangoDbConstants.ARANGO_KEY;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ArangoGraphEdgeTest extends BaseGraphTest {
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:insert")
+
.to("arangodb:{{arangodb.testDb}}?graph={{arangodb.testGraph}}&edgeCollection={{arangodb.testEdgeCollection}}&operation=SAVE_EDGE");
+ from("direct:update")
+
.to("arangodb:{{arangodb.testDb}}?graph={{arangodb.testGraph}}&edgeCollection={{arangodb.testEdgeCollection}}&operation=UPDATE_EDGE");
+ from("direct:delete")
+
.to("arangodb:{{arangodb.testDb}}?graph={{arangodb.testGraph}}&edgeCollection={{arangodb.testEdgeCollection}}&operation=DELETE_EDGE");
+ from("direct:findDocByKey")
+
.to("arangodb:{{arangodb.testDb}}?graph={{arangodb.testGraph}}&edgeCollection={{arangodb.testEdgeCollection}}&operation=FIND_EDGE_BY_KEY");
+ }
+ };
+ }
+
+ public void initVertices() {
+ vertexA = vertexCollection.insertVertex(new BaseDocument("A"));
+ vertexB = vertexCollection.insertVertex(new BaseDocument("B"));
+ vertexC = vertexCollection.insertVertex(new BaseDocument("C"));
+ }
+
+ @Test
+ public void saveEdge() {
+ // creating an edge A->B
+ BaseEdgeDocument edge = new BaseEdgeDocument();
+ edge.setFrom(vertexA.getId());
+ edge.setTo(vertexB.getId());
+
+ Exchange result = template.request("direct:insert", exchange ->
exchange.getMessage().setBody(edge));
+
+ assertTrue(result.getMessage().getBody() instanceof EdgeEntity);
+ EdgeEntity edgeEntity = (EdgeEntity) result.getMessage().getBody();
+ assertNotNull(edgeEntity.getKey());
+
+ BaseEdgeDocument actualResult =
edgeCollection.getEdge(edgeEntity.getKey(),
+ BaseEdgeDocument.class);
+ assertEquals(edgeEntity.getKey(), actualResult.getKey());
+ assertEquals(vertexA.getId(), actualResult.getFrom());
+ assertEquals(vertexB.getId(), actualResult.getTo());
+ }
+
+ @Test
+ public void updateEdge() {
+ // creating an edge A->B
+ BaseEdgeDocument edge = new BaseEdgeDocument();
+ edge.setFrom(vertexA.getId());
+ edge.setTo(vertexB.getId());
+ edge.addAttribute("foo", "bar");
+ EdgeEntity entity = edgeCollection.insertEdge(edge);
+
+ BaseEdgeDocument objectToUpdate =
edgeCollection.getEdge(entity.getKey(), BaseEdgeDocument.class);
+
+ // update
+ objectToUpdate.updateAttribute("foo", "hello");
+ // set direction of the edge A->C
+ objectToUpdate.setTo(vertexC.getId());
+
+ Exchange result = template.request("direct:update", exchange -> {
+ exchange.getMessage().setBody(objectToUpdate);
+ exchange.getMessage().setHeader(ARANGO_KEY,
objectToUpdate.getKey());
+ });
+
+ assertTrue(result.getMessage().getBody() instanceof EdgeUpdateEntity);
+ EdgeUpdateEntity docUpdated = (EdgeUpdateEntity)
result.getMessage().getBody();
+ assertEquals(entity.getKey(), docUpdated.getKey());
+
+ BaseEdgeDocument actualResult = edgeCollection.getEdge(entity.getKey(),
+ BaseEdgeDocument.class);
+ assertEquals(vertexC.getId(), actualResult.getTo());
+ assertEquals("hello", actualResult.getAttribute("foo"));
+ }
+
+ @Test
+ public void deleteVertex() {
+ // creating an edge A->B
+ BaseEdgeDocument edge = new BaseEdgeDocument();
+ edge.setFrom(vertexA.getId());
+ edge.setTo(vertexB.getId());
+ EdgeEntity entity = edgeCollection.insertEdge(edge);
+
+ template.request("direct:delete", exchange ->
exchange.getMessage().setBody(entity.getKey()));
+
+ BaseEdgeDocument documentDeleted =
edgesCollection.getDocument(entity.getKey(), BaseEdgeDocument.class);
+ assertNull(documentDeleted);
+ }
+
+ @Test
+ public void findVertexByKey() {
+ // creating an edge A->B
+ BaseEdgeDocument edge = new BaseEdgeDocument();
+ edge.setFrom(vertexA.getId());
+ edge.setTo(vertexB.getId());
+ edge.addAttribute("foo", "bar");
+ EdgeEntity entity = edgeCollection.insertEdge(edge);
+
+ Exchange result = template.request("direct:findDocByKey", exchange ->
exchange.getMessage().setBody(entity.getKey()));
+
+ assertTrue(result.getMessage().getBody() instanceof BaseEdgeDocument);
+ BaseEdgeDocument docResult = (BaseEdgeDocument)
result.getMessage().getBody();
+ assertEquals("bar", docResult.getAttribute("foo"));
+ assertEquals(vertexA.getId(), docResult.getFrom());
+ assertEquals(vertexB.getId(), docResult.getTo());
+ }
+
+}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphQueriesTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphQueriesTest.java
new file mode 100644
index 0000000..4a4d8a9
--- /dev/null
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphQueriesTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.component.arangodb;
+
+import java.util.Collection;
+
+import com.arangodb.ArangoDBException;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.component.arangodb.ArangoDbConstants.AQL_QUERY;
+import static
org.apache.camel.component.arangodb.ArangoDbConstants.RESULT_CLASS_TYPE;
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ArangoGraphQueriesTest extends BaseGraphTest {
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:query")
+
.to("arangodb:{{arangodb.testDb}}?operation=AQL_QUERY");
+ }
+ };
+ }
+
+ @Test
+ public void testTravesalOutbound() {
+ // depth = 3
+ Exchange result = getResultOutboundQuery(3, vertexA.getId(), "
OUTBOUND ");
+ assertTrue(result.getMessage().getBody() instanceof Collection);
+
+ Collection<String> list = (Collection<String>)
result.getMessage().getBody();
+ assertThat(list, hasItems("B", "C", "D", "E", "F", "G", "H", "I",
"J"));
+
+ // depth = 2
+ result = getResultOutboundQuery(2, vertexA.getId(), " OUTBOUND ");
+ assertTrue(result.getMessage().getBody() instanceof Collection);
+
+ list = (Collection<String>) result.getMessage().getBody();
+ assertThat(list, hasItems("B", "C", "D", "E", "F", "G"));
+ }
+
+ private Exchange getResultOutboundQuery(int depth, String vertexId, String
outInBound) {
+ String query = "FOR v IN 1.." + depth + outInBound + " '" + vertexId +
"' GRAPH '" + GRAPH_NAME + "' RETURN v._key";
+ return getResult(query);
+ }
+
+ private Exchange getResult(String query) {
+ Exchange result = template.request("direct:query", exchange -> {
+ exchange.getMessage().setHeader(AQL_QUERY, query);
+ exchange.getMessage().setHeader(RESULT_CLASS_TYPE, String.class);
+ });
+ return result;
+ }
+
+ @Test
+ public void testTravesalInbound() {
+ // depth = 3
+ Exchange result = getResultOutboundQuery(3, vertexH.getId(), " INBOUND
");
+ assertTrue(result.getMessage().getBody() instanceof Collection);
+
+ Collection<String> list = (Collection<String>)
result.getMessage().getBody();
+ list = (Collection<String>) result.getMessage().getBody();
+ assertEquals(3, list.size());
+ assertThat(list, hasItems("A", "B", "D"));
+
+ // depth = 2
+ result = getResultOutboundQuery(2, vertexH.getId(), " INBOUND ");
+ assertTrue(result.getMessage().getBody() instanceof Collection);
+
+ list = (Collection<String>) result.getMessage().getBody();
+ assertEquals(2, list.size());
+ assertThat(list, hasItems("B", "D"));
+ }
+
+ @Test
+ public void queryShortestPathFromAToH() throws ArangoDBException {
+ String query = "FOR v, e IN OUTBOUND SHORTEST_PATH '" +
vertexA.getId() + "' TO '" + vertexH.getId() + "' GRAPH '"
+ + GRAPH_NAME + "' RETURN v._key";
+ Exchange result = getResult(query);
+ Collection<String> list = (Collection<String>)
result.getMessage().getBody();
+ assertEquals(4, list.size());
+ assertThat(list, hasItems("A", "B", "D", "H"));
+ }
+
+}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphVertexTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphVertexTest.java
new file mode 100644
index 0000000..fb0d4bf
--- /dev/null
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/ArangoGraphVertexTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.component.arangodb;
+
+import com.arangodb.entity.BaseDocument;
+import com.arangodb.entity.VertexEntity;
+import com.arangodb.entity.VertexUpdateEntity;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.component.arangodb.ArangoDbConstants.ARANGO_KEY;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ArangoGraphVertexTest extends BaseGraphTest {
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:insert")
+
.to("arangodb:{{arangodb.testDb}}?graph={{arangodb.testGraph}}&vertexCollection={{arangodb.testVertexCollection}}&operation=SAVE_VERTEX");
+ from("direct:update")
+
.to("arangodb:{{arangodb.testDb}}?graph={{arangodb.testGraph}}&vertexCollection={{arangodb.testVertexCollection}}&operation=UPDATE_VERTEX");
+ from("direct:delete")
+
.to("arangodb:{{arangodb.testDb}}?graph={{arangodb.testGraph}}&vertexCollection={{arangodb.testVertexCollection}}&operation=DELETE_VERTEX");
+ from("direct:findDocByKey")
+
.to("arangodb:{{arangodb.testDb}}?graph={{arangodb.testGraph}}&vertexCollection={{arangodb.testVertexCollection}}&operation=FIND_VERTEX_BY_KEY");
+ }
+ };
+ }
+
+ @Test
+ public void saveVertex() {
+ BaseDocument myObject = new BaseDocument();
+ myObject.addAttribute("a", "Foo");
+ myObject.addAttribute("b", 42);
+
+ Exchange result = template.request("direct:insert", exchange ->
exchange.getMessage().setBody(myObject));
+
+ assertTrue(result.getMessage().getBody() instanceof VertexEntity);
+ VertexEntity vertexCreated = (VertexEntity)
result.getMessage().getBody();
+ assertNotNull(vertexCreated.getKey());
+
+ BaseDocument actualResult =
vertexCollection.getVertex(vertexCreated.getKey(),
+ BaseDocument.class);
+ assertEquals(vertexCreated.getKey(), actualResult.getKey());
+ assertEquals("Foo", actualResult.getAttribute("a"));
+ assertEquals(Long.valueOf(42), actualResult.getAttribute("b"));
+ }
+
+ @Test
+ public void updateVertex() {
+ BaseDocument myObject = new BaseDocument();
+ myObject.setKey("myKey");
+ myObject.addAttribute("foo", "bar");
+ VertexEntity entity = vertexCollection.insertVertex(myObject);
+
+ BaseDocument objectToUpdate =
vertexCollection.getVertex(entity.getKey(), BaseDocument.class);
+
+ // update
+ objectToUpdate.updateAttribute("foo", "hello");
+ objectToUpdate.addAttribute("gg", 42);
+
+ Exchange result = template.request("direct:update", exchange -> {
+ exchange.getMessage().setBody(objectToUpdate);
+ exchange.getMessage().setHeader(ARANGO_KEY,
objectToUpdate.getKey());
+ });
+
+ assertTrue(result.getMessage().getBody() instanceof
VertexUpdateEntity);
+ VertexUpdateEntity docUpdated = (VertexUpdateEntity)
result.getMessage().getBody();
+ assertEquals(myObject.getKey(), docUpdated.getKey());
+
+ BaseDocument actualResult =
vertexCollection.getVertex(docUpdated.getKey(),
+ BaseDocument.class);
+ assertEquals(objectToUpdate.getKey(), actualResult.getKey());
+ assertEquals("hello", actualResult.getAttribute("foo"));
+ assertEquals(Long.valueOf(42), actualResult.getAttribute("gg"));
+ }
+
+ @Test
+ public void deleteVertex() {
+ BaseDocument myObject = new BaseDocument();
+ myObject.setKey("myKey");
+ myObject.addAttribute("foo", "bar");
+ verticesCollection.insertDocument(myObject);
+
+ template.request("direct:delete", exchange ->
exchange.getMessage().setBody("myKey"));
+
+ BaseDocument documentDeleted =
verticesCollection.getDocument(myObject.getKey(), BaseDocument.class);
+ assertNull(documentDeleted);
+ }
+
+ @Test
+ public void findVertexByKey() {
+ BaseDocument myObject = new BaseDocument();
+ myObject.setKey("myKey");
+ myObject.addAttribute("foo", "bar");
+ VertexEntity entity = vertexCollection.insertVertex(myObject);
+
+ Exchange result = template.request("direct:findDocByKey", exchange ->
exchange.getMessage().setBody(entity.getKey()));
+
+ assertTrue(result.getMessage().getBody() instanceof BaseDocument);
+ BaseDocument docResult = (BaseDocument) result.getMessage().getBody();
+ assertEquals("bar", docResult.getAttribute("foo"));
+ }
+}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/AbstractArangoDbTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseArangoDbTest.java
similarity index 88%
rename from
components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/AbstractArangoDbTest.java
rename to
components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseArangoDbTest.java
index 19ecc3b..ee02c7d 100644
---
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/AbstractArangoDbTest.java
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseArangoDbTest.java
@@ -24,10 +24,13 @@ import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
-public class AbstractArangoDbTest extends CamelTestSupport {
+public class BaseArangoDbTest extends CamelTestSupport {
protected static final String DATABASE_NAME = "dbTest";
protected static final String COLLECTION_NAME = "camelTest";
+ 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 ArangoDbContainer container;
protected static ArangoDB arangoDb;
protected static ArangoDatabase arangoDatabase;
diff --git
a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbOperation.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseCollectionTest.java
similarity index 63%
copy from
components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbOperation.java
copy to
components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseCollectionTest.java
index 562cb33..6f15f4d 100644
---
a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbOperation.java
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseCollectionTest.java
@@ -16,10 +16,22 @@
*/
package org.apache.camel.component.arangodb;
-public enum ArangoDbOperation {
- SAVE_DOCUMENT,
- FIND_DOCUMENT_BY_KEY,
- UPDATE_DOCUMENT,
- DELETE_DOCUMENT,
- AQL_QUERY
+import com.arangodb.ArangoCollection;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+
+public class BaseCollectionTest extends BaseArangoDbTest {
+
+ protected ArangoCollection collection;
+
+ @BeforeEach
+ public void beforeEach() {
+ arangoDatabase.createCollection(COLLECTION_NAME);
+ collection = arangoDatabase.collection(COLLECTION_NAME);
+ }
+
+ @AfterEach
+ public void afterEach() {
+ collection.drop();
+ }
}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseGraphTest.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseGraphTest.java
new file mode 100644
index 0000000..60a092a
--- /dev/null
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/BaseGraphTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.component.arangodb;
+
+import java.util.Collections;
+
+import com.arangodb.ArangoCollection;
+import com.arangodb.ArangoEdgeCollection;
+import com.arangodb.ArangoGraph;
+import com.arangodb.ArangoVertexCollection;
+import com.arangodb.entity.BaseDocument;
+import com.arangodb.entity.BaseEdgeDocument;
+import com.arangodb.entity.CollectionType;
+import com.arangodb.entity.EdgeDefinition;
+import com.arangodb.entity.EdgeEntity;
+import com.arangodb.entity.VertexEntity;
+import com.arangodb.model.CollectionCreateOptions;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+
+public class BaseGraphTest extends BaseArangoDbTest {
+
+ protected static ArangoCollection edgesCollection;
+ protected static ArangoCollection verticesCollection;
+ protected static ArangoEdgeCollection edgeCollection;
+ protected static ArangoVertexCollection vertexCollection;
+
+ protected static ArangoGraph graph;
+
+ protected static VertexEntity vertexA;
+ protected static VertexEntity vertexB;
+ protected static VertexEntity vertexC;
+ protected static VertexEntity vertexD;
+ protected static VertexEntity vertexE;
+ protected static VertexEntity vertexF;
+ protected static VertexEntity vertexG;
+ protected static VertexEntity vertexH;
+ protected static VertexEntity vertexI;
+ protected static VertexEntity vertexJ;
+ protected static EdgeEntity edgeAtoB;
+ protected static EdgeEntity edgeAtoC;
+ protected static EdgeEntity edgeBtoD;
+ protected static EdgeEntity edgeBtoE;
+ protected static EdgeEntity edgeCtoF;
+ protected static EdgeEntity edgeCtoG;
+ protected static EdgeEntity edgeDtoH;
+ protected static EdgeEntity edgeDtoI;
+ protected static EdgeEntity edgeFtoJ;
+
+ protected void initData() {
+ // create vertex collection
+ arangoDatabase.createCollection(VERTEX_COLLECTION_NAME);
+ verticesCollection = arangoDatabase.collection(VERTEX_COLLECTION_NAME);
+
+ // create Edge collection
+ arangoDatabase.createCollection(EDGE_COLLECTION_NAME, new
CollectionCreateOptions().type(CollectionType.EDGES));
+ edgesCollection = arangoDatabase.collection(EDGE_COLLECTION_NAME);
+
+ // create graph
+ arangoDatabase.createGraph(GRAPH_NAME,
+ Collections.singletonList(new EdgeDefinition()
+ .collection(EDGE_COLLECTION_NAME)
+ .from(VERTEX_COLLECTION_NAME)
+ .to(VERTEX_COLLECTION_NAME)),
+ null);
+
+ graph = arangoDatabase.graph(GRAPH_NAME);
+ edgeCollection = graph.edgeCollection(EDGE_COLLECTION_NAME);
+ vertexCollection = graph.vertexCollection(VERTEX_COLLECTION_NAME);
+
+ // creating some vertices
+ initTraversalGraph();
+ }
+
+ public void initTraversalGraph() {
+ // creating vertices
+ vertexA = vertexCollection.insertVertex(new BaseDocument("A"));
+ vertexB = vertexCollection.insertVertex(new BaseDocument("B"));
+ vertexC = vertexCollection.insertVertex(new BaseDocument("C"));
+ vertexD = vertexCollection.insertVertex(new BaseDocument("D"));
+ vertexE = vertexCollection.insertVertex(new BaseDocument("E"));
+ vertexF = vertexCollection.insertVertex(new BaseDocument("F"));
+ vertexG = vertexCollection.insertVertex(new BaseDocument("G"));
+ vertexH = vertexCollection.insertVertex(new BaseDocument("H"));
+ vertexI = vertexCollection.insertVertex(new BaseDocument("I"));
+ vertexJ = vertexCollection.insertVertex(new BaseDocument("J"));
+
+ // creating edges
+ edgeAtoB = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexA.getId(), vertexB.getId()));
+ edgeAtoC = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexA.getId(), vertexC.getId()));
+ edgeBtoD = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexB.getId(), vertexD.getId()));
+ edgeBtoE = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexB.getId(), vertexE.getId()));
+ edgeCtoF = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexC.getId(), vertexF.getId()));
+ edgeCtoG = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexC.getId(), vertexG.getId()));
+ edgeDtoH = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexD.getId(), vertexH.getId()));
+ edgeDtoI = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexD.getId(), vertexI.getId()));
+ edgeFtoJ = edgeCollection.insertEdge(new
BaseEdgeDocument(vertexF.getId(), vertexJ.getId()));
+ }
+
+ protected void dropData() {
+ edgesCollection.drop();
+ verticesCollection.drop();
+ graph.drop();
+ }
+
+ @BeforeEach
+ public void init() {
+ initData();
+ }
+
+ @AfterEach
+ public void tearDown() {
+ dropData();
+ }
+}
diff --git
a/components/camel-arangodb/src/test/resources/arango.test.properties
b/components/camel-arangodb/src/test/resources/arango.test.properties
index e89d93e..4462d3d 100644
--- a/components/camel-arangodb/src/test/resources/arango.test.properties
+++ b/components/camel-arangodb/src/test/resources/arango.test.properties
@@ -16,4 +16,7 @@
## ---------------------------------------------------------------------------
arangodb.testDb=dbTest
-arangodb.testCollection=camelTest
\ No newline at end of file
+arangodb.testCollection=camelTest
+arangodb.testGraph=graphTest
+arangodb.testVertexCollection=vertexTest
+arangodb.testEdgeCollection=edgeTest
\ No newline at end of file
diff --git
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
index fc6b26e..52a5793 100644
---
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
+++
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java
@@ -96,10 +96,11 @@ public interface ComponentsBuilderFactory {
}
/**
* ArangoDb (camel-arangodb)
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or as a
+ * Graph Database
*
* Category: database,nosql
- * Since: 3.5.0-SNAPSHOT
+ * Since: 3.5
* Maven coordinates: org.apache.camel:camel-arangodb
*/
static
org.apache.camel.builder.component.dsl.ArangodbComponentBuilderFactory.ArangodbComponentBuilder
arangodb() {
diff --git
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ArangodbComponentBuilderFactory.java
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ArangodbComponentBuilderFactory.java
index af396a6..dbb4688 100644
---
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ArangodbComponentBuilderFactory.java
+++
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ArangodbComponentBuilderFactory.java
@@ -23,7 +23,8 @@ import org.apache.camel.builder.component.ComponentBuilder;
import org.apache.camel.component.arangodb.ArangoDbComponent;
/**
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or as a
+ * Graph Database
*
* Generated by camel-package-maven-plugin - do not edit this file!
*/
@@ -32,10 +33,11 @@ public interface ArangodbComponentBuilderFactory {
/**
* ArangoDb (camel-arangodb)
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or as a
+ * Graph Database
*
* Category: database,nosql
- * Since: 3.5.0-SNAPSHOT
+ * Since: 3.5
* Maven coordinates: org.apache.camel:camel-arangodb
*/
static ArangodbComponentBuilder arangodb() {
@@ -49,31 +51,63 @@ public interface ArangodbComponentBuilderFactory {
extends
ComponentBuilder<ArangoDbComponent> {
/**
- * collection in the database.
+ * Component configuration.
+ *
+ * The option is a:
+ *
<code>org.apache.camel.component.arangodb.ArangoDbConfiguration</code> type.
+ *
+ * Group: producer
+ */
+ default ArangodbComponentBuilder configuration(
+ org.apache.camel.component.arangodb.ArangoDbConfiguration
configuration) {
+ doSetProperty("configuration", configuration);
+ return this;
+ }
+ /**
+ * Collection name, when using ArangoDb as a Document Database. Set the
+ * documentCollection name when using the CRUD operation on the
document
+ * database collections (SAVE_DOCUMENT , FIND_DOCUMENT_BY_KEY,
+ * UPDATE_DOCUMENT, DELETE_DOCUMENT).
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: producer
*/
- default ArangodbComponentBuilder collection(java.lang.String
collection) {
- doSetProperty("collection", collection);
+ default ArangodbComponentBuilder documentCollection(
+ java.lang.String documentCollection) {
+ doSetProperty("documentCollection", documentCollection);
return this;
}
/**
- * Component configuration.
+ * Collection name of vertices, when using ArangoDb as a Graph
Database.
+ * Set the edgeCollection name to perform CRUD operation on edges using
+ * these operations : SAVE_VERTEX, FIND_VERTEX_BY_KEY, UPDATE_VERTEX,
+ * DELETE_VERTEX. The graph attribute is mandatory.
*
- * The option is a:
- *
<code>org.apache.camel.component.arangodb.ArangoDbConfiguration</code> type.
+ * The option is a: <code>java.lang.String</code> type.
*
* Group: producer
*/
- default ArangodbComponentBuilder configuration(
- org.apache.camel.component.arangodb.ArangoDbConfiguration
configuration) {
- doSetProperty("configuration", configuration);
+ default ArangodbComponentBuilder edgeCollection(
+ java.lang.String edgeCollection) {
+ doSetProperty("edgeCollection", edgeCollection);
+ return this;
+ }
+ /**
+ * Graph name, when using ArangoDb as a Graph Database. Combine this
+ * attribute with one of the two attributes vertexCollection and
+ * edgeCollection.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: producer
+ */
+ default ArangodbComponentBuilder graph(java.lang.String graph) {
+ doSetProperty("graph", graph);
return this;
}
/**
- * host if host and/or port different from default.
+ * ArangoDB host. If host and port are default, this field is Optional.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -105,7 +139,8 @@ public interface ArangodbComponentBuilderFactory {
return this;
}
/**
- * operation to perform.
+ * Operations to perform on ArangoDb. For the operation AQL_QUERY, no
+ * need to specify a collection or graph.
*
* The option is a:
* <code>org.apache.camel.component.arangodb.ArangoDbOperation</code>
@@ -119,7 +154,8 @@ public interface ArangodbComponentBuilderFactory {
return this;
}
/**
- * port if host and/or port different from default.
+ * ArangoDB exposed port. If host and port are default, this field is
+ * Optional.
*
* The option is a: <code>int</code> type.
*
@@ -130,6 +166,21 @@ public interface ArangodbComponentBuilderFactory {
return this;
}
/**
+ * Collection name of vertices, when using ArangoDb as a Graph
Database.
+ * Set the vertexCollection name to perform CRUD operation on vertices
+ * using these operations : SAVE_EDGE, FIND_EDGE_BY_KEY, UPDATE_EDGE,
+ * DELETE_EDGE. The graph attribute is mandatory.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: producer
+ */
+ default ArangodbComponentBuilder vertexCollection(
+ java.lang.String vertexCollection) {
+ doSetProperty("vertexCollection", vertexCollection);
+ return this;
+ }
+ /**
* Whether the component should use basic property binding (Camel 2.x)
* or the newer property binding with additional capabilities.
*
@@ -144,7 +195,8 @@ public interface ArangodbComponentBuilderFactory {
return this;
}
/**
- * password if user and/or password different from default.
+ * ArangoDB password. If user and password are default, this field is
+ * Optional.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -155,7 +207,8 @@ public interface ArangodbComponentBuilderFactory {
return this;
}
/**
- * user if user and/or password different from default.
+ * ArangoDB user. If user and password are default, this field is
+ * Optional.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -189,12 +242,15 @@ public interface ArangodbComponentBuilderFactory {
String name,
Object value) {
switch (name) {
- case "collection": getOrCreateConfiguration((ArangoDbComponent)
component).setCollection((java.lang.String) value); return true;
case "configuration": ((ArangoDbComponent)
component).setConfiguration((org.apache.camel.component.arangodb.ArangoDbConfiguration)
value); return true;
+ case "documentCollection":
getOrCreateConfiguration((ArangoDbComponent)
component).setDocumentCollection((java.lang.String) value); return true;
+ case "edgeCollection":
getOrCreateConfiguration((ArangoDbComponent)
component).setEdgeCollection((java.lang.String) value); return true;
+ case "graph": getOrCreateConfiguration((ArangoDbComponent)
component).setGraph((java.lang.String) value); return true;
case "host": getOrCreateConfiguration((ArangoDbComponent)
component).setHost((java.lang.String) value); return true;
case "lazyStartProducer": ((ArangoDbComponent)
component).setLazyStartProducer((boolean) value); return true;
case "operation": getOrCreateConfiguration((ArangoDbComponent)
component).setOperation((org.apache.camel.component.arangodb.ArangoDbOperation)
value); return true;
case "port": getOrCreateConfiguration((ArangoDbComponent)
component).setPort((int) value); return true;
+ case "vertexCollection":
getOrCreateConfiguration((ArangoDbComponent)
component).setVertexCollection((java.lang.String) value); return true;
case "basicPropertyBinding": ((ArangoDbComponent)
component).setBasicPropertyBinding((boolean) value); return true;
case "password": getOrCreateConfiguration((ArangoDbComponent)
component).setPassword((java.lang.String) value); return true;
case "user": getOrCreateConfiguration((ArangoDbComponent)
component).setUser((java.lang.String) value); return true;
diff --git a/core/camel-componentdsl/src/generated/resources/metadata.json
b/core/camel-componentdsl/src/generated/resources/metadata.json
index c13db98..4dcaf80 100644
--- a/core/camel-componentdsl/src/generated/resources/metadata.json
+++ b/core/camel-componentdsl/src/generated/resources/metadata.json
@@ -131,9 +131,9 @@
"kind": "component",
"name": "arangodb",
"title": "ArangoDb",
- "description": "Perform operations on ArangoDb documents, collections and
graphs.",
+ "description": "Perform operations on ArangoDb when used as a Document
Database, or as a Graph Database",
"deprecated": false,
- "firstVersion": "3.5.0-SNAPSHOT",
+ "firstVersion": "3.5.0",
"label": "database,nosql",
"javaType": "org.apache.camel.component.arangodb.ArangoDbComponent",
"supportLevel": "Preview",
diff --git
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index 7877ae3..1eed630 100644
---
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -254,10 +254,11 @@ public class StaticEndpointBuilders {
}
/**
* ArangoDb (camel-arangodb)
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or as a
+ * Graph Database
*
* Category: database,nosql
- * Since: 3.5.0-SNAPSHOT
+ * Since: 3.5
* Maven coordinates: org.apache.camel:camel-arangodb
*
* Syntax: <code>arangodb:database</code>
@@ -273,10 +274,11 @@ public class StaticEndpointBuilders {
}
/**
* ArangoDb (camel-arangodb)
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or as a
+ * Graph Database
*
* Category: database,nosql
- * Since: 3.5.0-SNAPSHOT
+ * Since: 3.5
* Maven coordinates: org.apache.camel:camel-arangodb
*
* Syntax: <code>arangodb:database</code>
diff --git
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java
index e0c80cc..1b2eb58 100644
---
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java
+++
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java
@@ -22,7 +22,8 @@ import org.apache.camel.builder.EndpointProducerBuilder;
import org.apache.camel.builder.endpoint.AbstractEndpointBuilder;
/**
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or as a
+ * Graph Database
*
* Generated by camel build tools - do NOT edit this file!
*/
@@ -38,18 +39,49 @@ public interface ArangoDbEndpointBuilderFactory {
return (AdvancedArangoDbEndpointBuilder) this;
}
/**
- * collection in the database.
+ * Collection name, when using ArangoDb as a Document Database. Set the
+ * documentCollection name when using the CRUD operation on the
document
+ * database collections (SAVE_DOCUMENT , FIND_DOCUMENT_BY_KEY,
+ * UPDATE_DOCUMENT, DELETE_DOCUMENT).
*
* The option is a: <code>java.lang.String</code> type.
*
* Group: producer
*/
- default ArangoDbEndpointBuilder collection(String collection) {
- doSetProperty("collection", collection);
+ default ArangoDbEndpointBuilder documentCollection(
+ String documentCollection) {
+ doSetProperty("documentCollection", documentCollection);
return this;
}
/**
- * host if host and/or port different from default.
+ * Collection name of vertices, when using ArangoDb as a Graph
Database.
+ * Set the edgeCollection name to perform CRUD operation on edges using
+ * these operations : SAVE_VERTEX, FIND_VERTEX_BY_KEY, UPDATE_VERTEX,
+ * DELETE_VERTEX. The graph attribute is mandatory.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: producer
+ */
+ default ArangoDbEndpointBuilder edgeCollection(String edgeCollection) {
+ doSetProperty("edgeCollection", edgeCollection);
+ return this;
+ }
+ /**
+ * Graph name, when using ArangoDb as a Graph Database. Combine this
+ * attribute with one of the two attributes vertexCollection and
+ * edgeCollection.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: producer
+ */
+ default ArangoDbEndpointBuilder graph(String graph) {
+ doSetProperty("graph", graph);
+ return this;
+ }
+ /**
+ * ArangoDB host. If host and port are default, this field is Optional.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -102,7 +134,8 @@ public interface ArangoDbEndpointBuilderFactory {
return this;
}
/**
- * operation to perform.
+ * Operations to perform on ArangoDb. For the operation AQL_QUERY, no
+ * need to specify a collection or graph.
*
* The option is a:
* <code>org.apache.camel.component.arangodb.ArangoDbOperation</code>
@@ -115,7 +148,8 @@ public interface ArangoDbEndpointBuilderFactory {
return this;
}
/**
- * operation to perform.
+ * Operations to perform on ArangoDb. For the operation AQL_QUERY, no
+ * need to specify a collection or graph.
*
* The option will be converted to a
* <code>org.apache.camel.component.arangodb.ArangoDbOperation</code>
@@ -128,7 +162,8 @@ public interface ArangoDbEndpointBuilderFactory {
return this;
}
/**
- * port if host and/or port different from default.
+ * ArangoDB exposed port. If host and port are default, this field is
+ * Optional.
*
* The option is a: <code>int</code> type.
*
@@ -139,7 +174,8 @@ public interface ArangoDbEndpointBuilderFactory {
return this;
}
/**
- * port if host and/or port different from default.
+ * ArangoDB exposed port. If host and port are default, this field is
+ * Optional.
*
* The option will be converted to a <code>int</code> type.
*
@@ -150,7 +186,22 @@ public interface ArangoDbEndpointBuilderFactory {
return this;
}
/**
- * password if user and/or password different from default.
+ * Collection name of vertices, when using ArangoDb as a Graph
Database.
+ * Set the vertexCollection name to perform CRUD operation on vertices
+ * using these operations : SAVE_EDGE, FIND_EDGE_BY_KEY, UPDATE_EDGE,
+ * DELETE_EDGE. The graph attribute is mandatory.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: producer
+ */
+ default ArangoDbEndpointBuilder vertexCollection(String
vertexCollection) {
+ doSetProperty("vertexCollection", vertexCollection);
+ return this;
+ }
+ /**
+ * ArangoDB password. If user and password are default, this field is
+ * Optional.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -161,7 +212,8 @@ public interface ArangoDbEndpointBuilderFactory {
return this;
}
/**
- * user if user and/or password different from default.
+ * ArangoDB user. If user and password are default, this field is
+ * Optional.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -247,16 +299,25 @@ public interface ArangoDbEndpointBuilderFactory {
FIND_DOCUMENT_BY_KEY,
UPDATE_DOCUMENT,
DELETE_DOCUMENT,
- AQL_QUERY;
+ AQL_QUERY,
+ SAVE_VERTEX,
+ FIND_VERTEX_BY_KEY,
+ UPDATE_VERTEX,
+ DELETE_VERTEX,
+ SAVE_EDGE,
+ FIND_EDGE_BY_KEY,
+ UPDATE_EDGE,
+ DELETE_EDGE;
}
public interface ArangoDbBuilders {
/**
* ArangoDb (camel-arangodb)
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or
+ * as a Graph Database
*
* Category: database,nosql
- * Since: 3.5.0-SNAPSHOT
+ * Since: 3.5
* Maven coordinates: org.apache.camel:camel-arangodb
*
* Syntax: <code>arangodb:database</code>
@@ -271,10 +332,11 @@ public interface ArangoDbEndpointBuilderFactory {
}
/**
* ArangoDb (camel-arangodb)
- * Perform operations on ArangoDb documents, collections and graphs.
+ * Perform operations on ArangoDb when used as a Document Database, or
+ * as a Graph Database
*
* Category: database,nosql
- * Since: 3.5.0-SNAPSHOT
+ * Since: 3.5
* Maven coordinates: org.apache.camel:camel-arangodb
*
* Syntax: <code>arangodb:database</code>