mirror of https://gitee.com/bigwinds/arangodb
Add tests for job creation and removal. (#5894)
This commit is contained in:
parent
1ed2ac27ad
commit
c34c858901
|
@ -603,7 +603,7 @@ var checkROPermission = function(c) {
|
||||||
let user = users.currentUser();
|
let user = users.currentUser();
|
||||||
if (user) {
|
if (user) {
|
||||||
let p = users.permission(user, db._name(), c);
|
let p = users.permission(user, db._name(), c);
|
||||||
var err = new ArangoError();
|
var err = new ArangoError();
|
||||||
if (p === 'none') {
|
if (p === 'none') {
|
||||||
err.errorNum = arangodb.errors.ERROR_FORBIDDEN.code;
|
err.errorNum = arangodb.errors.ERROR_FORBIDDEN.code;
|
||||||
err.errorMessage = arangodb.errors.ERROR_FORBIDDEN.message;
|
err.errorMessage = arangodb.errors.ERROR_FORBIDDEN.message;
|
||||||
|
@ -891,9 +891,9 @@ class Graph {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var query = `
|
var query = `
|
||||||
${transformExampleToAQL(vertexExample, Object.keys(this.__vertexCollections), bindVars, 'start')}
|
${transformExampleToAQL(vertexExample, Object.keys(this.__vertexCollections), bindVars, 'start')}
|
||||||
FOR v, e IN ${options.minDepth || 1}..${options.maxDepth || 1} ${options.direction || 'ANY'} start
|
FOR v, e IN ${options.minDepth || 1}..${options.maxDepth || 1} ${options.direction || 'ANY'} start
|
||||||
${buildEdgeCollectionRestriction(options.edgeCollectionRestriction, bindVars, this)}
|
${buildEdgeCollectionRestriction(options.edgeCollectionRestriction, bindVars, this)}
|
||||||
${buildFilter(options.edgeExamples, bindVars, 'e')}
|
${buildFilter(options.edgeExamples, bindVars, 'e')}
|
||||||
RETURN DISTINCT ${options.includeData === true ? 'e' : 'e._id'}`;
|
RETURN DISTINCT ${options.includeData === true ? 'e' : 'e._id'}`;
|
||||||
return db._query(query, bindVars).toArray();
|
return db._query(query, bindVars).toArray();
|
||||||
}
|
}
|
||||||
|
@ -910,8 +910,8 @@ class Graph {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var bindVars = {};
|
var bindVars = {};
|
||||||
var query = `${transformExampleToAQL({}, Array.isArray(options.vertexCollectionRestriction) && options.vertexCollectionRestriction.length > 0 ? options.vertexCollectionRestriction : Object.keys(this.__vertexCollections), bindVars, 'start')}
|
var query = `${transformExampleToAQL({}, Array.isArray(options.vertexCollectionRestriction) && options.vertexCollectionRestriction.length > 0 ? options.vertexCollectionRestriction : Object.keys(this.__vertexCollections), bindVars, 'start')}
|
||||||
${buildFilter(vertexExample, bindVars, 'start')}
|
${buildFilter(vertexExample, bindVars, 'start')}
|
||||||
RETURN DISTINCT start`;
|
RETURN DISTINCT start`;
|
||||||
return db._query(query, bindVars).toArray();
|
return db._query(query, bindVars).toArray();
|
||||||
}
|
}
|
||||||
|
@ -1035,20 +1035,20 @@ class Graph {
|
||||||
${transformExampleToAQL(vertex1Example, Object.keys(this.__vertexCollections), bindVars, 'left')}
|
${transformExampleToAQL(vertex1Example, Object.keys(this.__vertexCollections), bindVars, 'left')}
|
||||||
LET leftNeighbors = (FOR v IN ${optionsVertex1.minDepth || 1}..${optionsVertex1.maxDepth || 1} ${optionsVertex1.direction || 'ANY'} left
|
LET leftNeighbors = (FOR v IN ${optionsVertex1.minDepth || 1}..${optionsVertex1.maxDepth || 1} ${optionsVertex1.direction || 'ANY'} left
|
||||||
${buildEdgeCollectionRestriction(optionsVertex1.edgeCollectionRestriction, bindVars, this)}
|
${buildEdgeCollectionRestriction(optionsVertex1.edgeCollectionRestriction, bindVars, this)}
|
||||||
OPTIONS {bfs: true, uniqueVertices: "global"}
|
OPTIONS {bfs: true, uniqueVertices: "global"}
|
||||||
${Array.isArray(optionsVertex1.vertexCollectionRestriction) && optionsVertex1.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(optionsVertex1.vertexCollectionRestriction, 'v') : ''}
|
${Array.isArray(optionsVertex1.vertexCollectionRestriction) && optionsVertex1.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(optionsVertex1.vertexCollectionRestriction, 'v') : ''}
|
||||||
RETURN v)
|
RETURN v)
|
||||||
${transformExampleToAQL(vertex2Example, Object.keys(this.__vertexCollections), bindVars, 'right')}
|
${transformExampleToAQL(vertex2Example, Object.keys(this.__vertexCollections), bindVars, 'right')}
|
||||||
FILTER right != left
|
FILTER right != left
|
||||||
LET rightNeighbors = (FOR v IN ${optionsVertex2.minDepth || 1}..${optionsVertex2.maxDepth || 1} ${optionsVertex2.direction || 'ANY'} right
|
LET rightNeighbors = (FOR v IN ${optionsVertex2.minDepth || 1}..${optionsVertex2.maxDepth || 1} ${optionsVertex2.direction || 'ANY'} right
|
||||||
${buildEdgeCollectionRestriction(optionsVertex2.edgeCollectionRestriction, bindVars, this)}
|
${buildEdgeCollectionRestriction(optionsVertex2.edgeCollectionRestriction, bindVars, this)}
|
||||||
OPTIONS {bfs: true, uniqueVertices: "global"}
|
OPTIONS {bfs: true, uniqueVertices: "global"}
|
||||||
${Array.isArray(optionsVertex2.vertexCollectionRestriction) && optionsVertex2.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(optionsVertex2.vertexCollectionRestriction, 'v') : ''}
|
${Array.isArray(optionsVertex2.vertexCollectionRestriction) && optionsVertex2.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(optionsVertex2.vertexCollectionRestriction, 'v') : ''}
|
||||||
RETURN v)
|
RETURN v)
|
||||||
LET neighbors = INTERSECTION(leftNeighbors, rightNeighbors)
|
LET neighbors = INTERSECTION(leftNeighbors, rightNeighbors)
|
||||||
FILTER LENGTH(neighbors) > 0 `;
|
FILTER LENGTH(neighbors) > 0 `;
|
||||||
if (optionsVertex1.includeData === true || optionsVertex2.includeData === true) {
|
if (optionsVertex1.includeData === true || optionsVertex2.includeData === true) {
|
||||||
query += `RETURN {left : left, right: right, neighbors: neighbors}`;
|
query += `RETURN {left : left._id, right: right._id, neighbors: neighbors}`;
|
||||||
} else {
|
} else {
|
||||||
query += `RETURN {left : left._id, right: right._id, neighbors: neighbors[*]._id}`;
|
query += `RETURN {left : left._id, right: right._id, neighbors: neighbors[*]._id}`;
|
||||||
}
|
}
|
||||||
|
@ -1839,15 +1839,15 @@ class Graph {
|
||||||
${transformExampleToAQL(vertex1Example, Object.keys(this.__vertexCollections), bindVars, 'left')}
|
${transformExampleToAQL(vertex1Example, Object.keys(this.__vertexCollections), bindVars, 'left')}
|
||||||
LET leftNeighbors = (FOR v IN ${optionsVertex1.minDepth || 1}..${optionsVertex1.maxDepth || 1} ${optionsVertex1.direction || 'ANY'} left
|
LET leftNeighbors = (FOR v IN ${optionsVertex1.minDepth || 1}..${optionsVertex1.maxDepth || 1} ${optionsVertex1.direction || 'ANY'} left
|
||||||
${buildEdgeCollectionRestriction(optionsVertex1.edgeCollectionRestriction, bindVars, this)}
|
${buildEdgeCollectionRestriction(optionsVertex1.edgeCollectionRestriction, bindVars, this)}
|
||||||
OPTIONS {bfs: true, uniqueVertices: "global"}
|
OPTIONS {bfs: true, uniqueVertices: "global"}
|
||||||
${Array.isArray(optionsVertex1.vertexCollectionRestriction) && optionsVertex1.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(optionsVertex1.vertexCollectionRestriction, 'v') : ''}
|
${Array.isArray(optionsVertex1.vertexCollectionRestriction) && optionsVertex1.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(optionsVertex1.vertexCollectionRestriction, 'v') : ''}
|
||||||
RETURN v)
|
RETURN v)
|
||||||
${transformExampleToAQL(vertex2Example, Object.keys(this.__vertexCollections), bindVars, 'right')}
|
${transformExampleToAQL(vertex2Example, Object.keys(this.__vertexCollections), bindVars, 'right')}
|
||||||
FILTER right != left
|
FILTER right != left
|
||||||
LET rightNeighbors = (FOR v IN ${optionsVertex2.minDepth || 1}..${optionsVertex2.maxDepth || 1} ${optionsVertex2.direction || 'ANY'} right
|
LET rightNeighbors = (FOR v IN ${optionsVertex2.minDepth || 1}..${optionsVertex2.maxDepth || 1} ${optionsVertex2.direction || 'ANY'} right
|
||||||
${buildEdgeCollectionRestriction(optionsVertex2.edgeCollectionRestriction, bindVars, this)}
|
${buildEdgeCollectionRestriction(optionsVertex2.edgeCollectionRestriction, bindVars, this)}
|
||||||
OPTIONS {bfs: true, uniqueVertices: "global"}
|
OPTIONS {bfs: true, uniqueVertices: "global"}
|
||||||
${Array.isArray(optionsVertex2.vertexCollectionRestriction) && optionsVertex2.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(optionsVertex2.vertexCollectionRestriction, 'v') : ''}
|
${Array.isArray(optionsVertex2.vertexCollectionRestriction) && optionsVertex2.vertexCollectionRestriction.length > 0 ? buildVertexCollectionRestriction(optionsVertex2.vertexCollectionRestriction, 'v') : ''}
|
||||||
RETURN v)
|
RETURN v)
|
||||||
LET neighbors = INTERSECTION(leftNeighbors, rightNeighbors)
|
LET neighbors = INTERSECTION(leftNeighbors, rightNeighbors)
|
||||||
FILTER LENGTH(neighbors) > 0 `;
|
FILTER LENGTH(neighbors) > 0 `;
|
||||||
|
|
Loading…
Reference in New Issue