1
0
Fork 0

Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Max Neunhoeffer 2014-10-20 10:47:49 +02:00
commit f15cb48a10
9 changed files with 1905 additions and 1184 deletions

View File

@ -1684,13 +1684,15 @@ namespace triagens {
ScatterBlock (ExecutionEngine* engine, ScatterBlock (ExecutionEngine* engine,
ScatterNode const* ep, ScatterNode const* ep,
std::vector<std::string> const& shardIds) std::vector<std::string> const& shardIds)
: BlockWithClients(engine, ep, shardIds) {} : BlockWithClients(engine, ep, shardIds) {
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief destructor /// @brief destructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
~ScatterBlock () {} ~ScatterBlock () {
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief initializeCursor /// @brief initializeCursor
@ -1755,7 +1757,8 @@ namespace triagens {
/// @brief destructor /// @brief destructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
~DistributeBlock () {} ~DistributeBlock () {
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief initializeCursor /// @brief initializeCursor

View File

@ -889,7 +889,9 @@ int ArangoServer::startupServer () {
// for a cluster coordinator, the users are loaded at a later stage; // for a cluster coordinator, the users are loaded at a later stage;
// the kickstarter will trigger a bootstrap process // the kickstarter will trigger a bootstrap process
if (ServerState::instance()->getRole() != ServerState::ROLE_COORDINATOR) { const auto role = ServerState::instance()->getRole();
if (role != ServerState::ROLE_COORDINATOR && role != ServerState::ROLE_PRIMARY && role != ServerState::ROLE_SECONDARY) {
// if the authentication info could not be loaded, but authentication is turned on, // if the authentication info could not be loaded, but authentication is turned on,
// then we refuse to start // then we refuse to start

View File

@ -280,7 +280,7 @@ static int SetupExampleObject (v8::Handle<v8::Object> const example,
static TRI_index_operator_t* SetupConditionsSkiplist (TRI_index_t* idx, static TRI_index_operator_t* SetupConditionsSkiplist (TRI_index_t* idx,
TRI_shaper_t* shaper, TRI_shaper_t* shaper,
v8::Handle<v8::Object> conditions) { v8::Handle<v8::Object> conditions) {
TRI_index_operator_t* lastOperator = 0; TRI_index_operator_t* lastOperator = nullptr;
size_t numEq = 0; size_t numEq = 0;
size_t lastNonEq = 0; size_t lastNonEq = 0;
@ -449,7 +449,7 @@ static TRI_index_operator_t* SetupConditionsSkiplist (TRI_index_t* idx,
MEM_ERROR: MEM_ERROR:
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, parameters); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, parameters);
if (lastOperator == nullptr) { if (lastOperator != nullptr) {
TRI_FreeIndexOperator(lastOperator); TRI_FreeIndexOperator(lastOperator);
} }

View File

@ -411,8 +411,8 @@
this.collection.each(function(model) { this.collection.each(function(model) {
self.customQueries.push({ self.customQueries.push({
name: model.attributes.name, name: model.get("name"),
value: model.attributes.value value: model.get("value")
}); });
}); });
}, },

View File

@ -4589,7 +4589,6 @@ function TRAVERSAL_VISITOR (config, result, vertex, path) {
function TRAVERSAL_NEIGHBOR_VISITOR (config, result, vertex, path) { function TRAVERSAL_NEIGHBOR_VISITOR (config, result, vertex, path) {
"use strict"; "use strict";
result.push(CLONE({ vertex: vertex, path: path, startVertex : config.startVertex })); result.push(CLONE({ vertex: vertex, path: path, startVertex : config.startVertex }));
} }
@ -4653,10 +4652,23 @@ function TRAVERSAL_EDGE_EXAMPLE_FILTER (config, vertex, edge, path) {
function TRAVERSAL_VERTEX_FILTER (config, vertex, path) { function TRAVERSAL_VERTEX_FILTER (config, vertex, path) {
"use strict"; "use strict";
if (config.filterVertexExamples && !MATCHES(vertex, config.filterVertexExamples)) {
if (! MATCHES(vertex, config.filterVertexExamples)) { if (config.filterVertexCollections
&& config.vertexFilterMethod.indexOf("exclude") === -1
&& config.filterVertexCollections.indexOf(vertex._id.split("/")[0]) === -1
) {
if (config.vertexFilterMethod.indexOf("prune") === -1) {
return ["exclude"];
}
return ["prune", "exclude"];
}
return config.vertexFilterMethod; return config.vertexFilterMethod;
} }
if (config.filterVertexCollections
&& config.filterVertexCollections.indexOf(vertex._id.split("/")[0]) === -1
){
return ["exclude"];
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -4789,6 +4801,11 @@ function TRAVERSAL_FUNC (func,
config.vertexFilterMethod = params.vertexFilterMethod || ["prune", "exclude"]; config.vertexFilterMethod = params.vertexFilterMethod || ["prune", "exclude"];
} }
} }
if (params.filterVertexCollections) {
config.filter = config.filter || TRAVERSAL_VERTEX_FILTER;
config.vertexFilterMethod = config.vertexFilterMethod || ["prune", "exclude"];
config.filterVertexCollections = params.filterVertexCollections;
}
if (params._sort) { if (params._sort) {
config.sort = function (l, r) { return l._key < r._key ? -1 : 1; }; config.sort = function (l, r) { return l._key < r._key ? -1 : 1; };
@ -6020,8 +6037,8 @@ function GRAPH_NEIGHBORS (vertexCollection,
/// * *edgeCollectionRestriction* : One or multiple edge /// * *edgeCollectionRestriction* : One or multiple edge
/// collection names. Only edges from these collections will be considered for the path. /// collection names. Only edges from these collections will be considered for the path.
/// * *vertexCollectionRestriction* : One or multiple vertex /// * *vertexCollectionRestriction* : One or multiple vertex
/// collection names. Only vertices from these collections will be considered as /// collection names. Only vertices from these collections will be contained in the
/// neighbor. /// result. This does not effect vertices on the path.
/// * *minDepth* : Defines the minimal /// * *minDepth* : Defines the minimal
/// depth a path to a neighbor must have to be returned (default is 1). /// depth a path to a neighbor must have to be returned (default is 1).
/// * *maxDepth* : Defines the maximal /// * *maxDepth* : Defines the maximal
@ -6064,22 +6081,13 @@ function GENERAL_GRAPH_NEIGHBORS (graphName,
} }
options.fromVertexExample = vertexExample; options.fromVertexExample = vertexExample;
if (! options.direction) { if (! options.hasOwnProperty("direction")) {
options.direction = 'any'; options.direction = 'any';
} }
if (options.vertexCollectionRestriction) { if (options.hasOwnProperty("neighborExamples") && typeof options.neighborExamples === "string") {
if (options.direction === "inbound") {
options.endVertexCollectionRestriction = options.vertexCollectionRestriction;
} else {
options.startVertexCollectionRestriction = options.vertexCollectionRestriction;
}
}
if (options.neighborExamples) {
if (typeof options.neighborExamples === "string") {
options.neighborExamples = {_id : options.neighborExamples}; options.neighborExamples = {_id : options.neighborExamples};
} }
}
var neighbors = [], var neighbors = [],
params = TRAVERSAL_PARAMS(), params = TRAVERSAL_PARAMS(),
factory = TRAVERSAL.generalGraphDatasourceFactory(graphName); factory = TRAVERSAL.generalGraphDatasourceFactory(graphName);
@ -6094,6 +6102,9 @@ function GENERAL_GRAPH_NEIGHBORS (graphName,
if (options.edgeCollectionRestriction) { if (options.edgeCollectionRestriction) {
params.edgeCollectionRestriction = options.edgeCollectionRestriction; params.edgeCollectionRestriction = options.edgeCollectionRestriction;
} }
if (options.vertexCollectionRestriction) {
params.filterVertexCollections = options.vertexCollectionRestriction;
}
fromVertices.forEach(function (v) { fromVertices.forEach(function (v) {
var e = TRAVERSAL_FUNC("GRAPH_NEIGHBORS", var e = TRAVERSAL_FUNC("GRAPH_NEIGHBORS",
factory, factory,

View File

@ -33,6 +33,7 @@ var TRAVERSAL = require("org/arangodb/graph/traversal");
var ArangoError = require("org/arangodb").ArangoError; var ArangoError = require("org/arangodb").ArangoError;
var ShapedJson = INTERNAL.ShapedJson; var ShapedJson = INTERNAL.ShapedJson;
var isCoordinator = require("org/arangodb/cluster").isCoordinator(); var isCoordinator = require("org/arangodb/cluster").isCoordinator();
var console = require("console");
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private variables // --SECTION-- private variables
@ -491,10 +492,15 @@ function FCALL_USER (name, parameters) {
} }
if (UserFunctions[prefix].hasOwnProperty(name)) { if (UserFunctions[prefix].hasOwnProperty(name)) {
try {
var result = UserFunctions[prefix][name].func.apply(null, parameters); var result = UserFunctions[prefix][name].func.apply(null, parameters);
return FIX_VALUE(result); return FIX_VALUE(result);
} }
catch (err) {
console.warn("AQL user function '%s' returned an exception. result is converted to null", name);
return null;
}
}
THROW(INTERNAL.errors.ERROR_QUERY_FUNCTION_NOT_FOUND, NORMALIZE_FNAME(name)); THROW(INTERNAL.errors.ERROR_QUERY_FUNCTION_NOT_FOUND, NORMALIZE_FNAME(name));
} }

View File

@ -41,6 +41,7 @@ var assertQueryError = helper.assertQueryError;
function ahuacatlQueryGeneralEdgesTestSuite() { function ahuacatlQueryGeneralEdgesTestSuite() {
var gN = "bla3";
var v1 = "UnitTestsAhuacatlVertex1"; var v1 = "UnitTestsAhuacatlVertex1";
var v2 = "UnitTestsAhuacatlVertex2"; var v2 = "UnitTestsAhuacatlVertex2";
var v3 = "UnitTestsAhuacatlVertex3"; var v3 = "UnitTestsAhuacatlVertex3";
@ -49,6 +50,13 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
var e2 = "UnitTestsAhuacatlEdge2"; var e2 = "UnitTestsAhuacatlEdge2";
var or = "UnitTestsAhuacatlOrphan"; var or = "UnitTestsAhuacatlOrphan";
var AQL_VERTICES = "FOR e IN GRAPH_VERTICES(@name, @example, @options) SORT e._id RETURN e";
var AQL_EDGES = "FOR e IN GRAPH_EDGES(@name, @example, @options) SORT e.what RETURN e.what";
var AQL_NEIGHBORS = "FOR e IN GRAPH_NEIGHBORS(@name, @example, @options) SORT e.vertex._id, e.path.edges[0].what RETURN e";
var startExample = [{hugo : true}, {heinz : 1}];
var vertexExample = {_key: "v1"};
return { return {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -128,96 +136,801 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
}, },
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief checks GRAPH_EDGES() and GRAPH_NEIGHBOURS() and GRAPH_VERTICES() /// @brief checks GRAPH_VERTICES()
////////////////////////////////////////////////////////////////////////////////
testVertices: function () {
var bindVars = {
name: gN,
example: v1 + "/v1",
options: {direction : 'any'}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual[0]._id, v1 + '/v1');
},
testVerticesRestricted: function() {
var bindVars = {
name: gN,
example: {},
options: {
direction : 'any',
vertexCollectionRestriction: or
}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0]._id, 'UnitTestsAhuacatlOrphan/orphan');
},
testVerticesExample: function () {
var bindVars = {
name: gN,
example: startExample,
options: {direction : 'any'}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 4);
assertEqual(actual[0]._id, 'UnitTestsAhuacatlVertex1/v1');
assertEqual(actual[1]._id, 'UnitTestsAhuacatlVertex1/v2');
assertEqual(actual[2]._id, 'UnitTestsAhuacatlVertex2/v3');
assertEqual(actual[3]._id, 'UnitTestsAhuacatlVertex4/v8');
},
testVerticesWithInboundEdges: function () {
var bindVars = {
name: gN,
example: v3 + "/v5",
options: {direction : 'inbound'}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0]._id, 'UnitTestsAhuacatlVertex3/v5');
},
testVerticesWithInboundEdgesHasNoInboundEdges: function () {
var bindVars = {
name: gN,
example: v2 + "/v3",
options: {direction : 'inbound'}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 0);
},
testVerticesWithInboundEdgesAndExample: function () {
var bindVars = {
name: gN,
example: startExample,
options: {direction : 'inbound'}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 3);
assertEqual(actual[0]._id, 'UnitTestsAhuacatlVertex1/v1');
assertEqual(actual[1]._id, 'UnitTestsAhuacatlVertex1/v2');
assertEqual(actual[2]._id, 'UnitTestsAhuacatlVertex4/v8');
},
testVerticesWithInboundEdgesRestrictedHasNoInbound: function() {
var bindVars = {
name: gN,
example: {},
options: {
direction : 'inbound',
vertexCollectionRestriction: v2
}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 0);
},
testVerticesWithInboundEdgesRestrictedHasInbound: function() {
var bindVars = {
name: gN,
example: {},
options: {
direction : 'inbound',
vertexCollectionRestriction: v3
}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 2);
assertEqual(actual[0]._id, v3 + '/v5');
assertEqual(actual[1]._id, v3 + '/v6');
},
testVerticesWithOutboundEdgesRestrictedHasOutbound: function() {
var bindVars = {
name: gN,
example: {},
options: {
direction : 'outbound',
vertexCollectionRestriction: v2
}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 2);
assertEqual(actual[0]._id, v2 + '/v3');
assertEqual(actual[1]._id, v2 + '/v4');
},
testVerticesWithOutboundEdgesRestrictedHasNoOutbound: function() {
var bindVars = {
name: gN,
example: {},
options: {
direction : 'outbound',
vertexCollectionRestriction: v3
}
};
var actual = getRawQueryResults(AQL_VERTICES, bindVars);
assertEqual(actual.length, 0);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief checks GRAPH_EDGES()
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// Section any direction
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
testEdgesAny: function () { testEdgesAny: function () {
var bindVars = {
var actual; name: gN,
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', '" + v1 + "/v1', {direction : 'any'}) RETURN e"); example: v1 + "/v1",
assertEqual(actual[0]._id, v1 + '/v1'); options: {direction : 'any'}
};
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', {}, {direction : 'any', vertexCollectionRestriction : 'UnitTestsAhuacatlOrphan'}) RETURN e"); var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual[0]._id, 'UnitTestsAhuacatlOrphan/orphan');
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'any'}) SORT e.what RETURN e.what");
assertEqual(actual, [ "v1->v2", "v1->v5", "v2->v1" ]); assertEqual(actual, [ "v1->v2", "v1->v5", "v2->v1" ]);
},
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'any' , edgeCollectionRestriction: ['UnitTestsAhuacatlEdge1']}) " + testEdgesAnyRestricted: function () {
"SORT e.what RETURN e.what"); var bindVars = {
name: gN,
example: v1 + "/v1",
options: {
direction : 'any',
edgeCollectionRestriction: [e1]
}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual, [ "v1->v2", "v2->v1" ]); assertEqual(actual, [ "v1->v2", "v2->v1" ]);
},
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', [{hugo : true}, {heinz : 1}], {direction : 'any'}) " + testEdgesAnyStartExample: function () {
"SORT e.what RETURN e.what"); var bindVars = {
assertEqual(actual, [ "v1->v2", name: gN,
example: startExample,
options: {direction : 'any'}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual, [
"v1->v2",
"v1->v5", "v1->v5",
"v2->v1", "v2->v1",
"v2->v5", "v2->v5",
"v3->v5", "v3->v5",
"v3->v6", "v3->v6",
"v3->v8" ]); "v3->v8"
]);
},
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', [{hugo : true}, {heinz : 1}], {direction : 'any'}) SORT e._id RETURN e"); testEdgesAnyStartExampleEdgeExample: function () {
assertEqual(actual[0]._id, 'UnitTestsAhuacatlVertex1/v1'); var bindVars = {
assertEqual(actual[1]._id, 'UnitTestsAhuacatlVertex1/v2'); name: gN,
assertEqual(actual[2]._id, 'UnitTestsAhuacatlVertex2/v3'); example: v1 + "/v1",
assertEqual(actual[3]._id, 'UnitTestsAhuacatlVertex4/v8'); options: {
direction : 'any',
edgeExamples: [{what: 'v2->v1'}]
}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0], "v2->v1");
},
testEdgesInbound: function() {
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'any' , edgeExamples : [{'what' : 'v2->v1'}]}) SORT e.what RETURN e.what"); var bindVars = {
name: gN,
example: v1 + "/v1",
options: {direction : 'inbound'}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual, [ "v2->v1"]); assertEqual(actual, [ "v2->v1"]);
},
actual = getQueryResults("FOR e IN GRAPH_NEIGHBORS('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'any' , edgeExamples : [{'what' : 'v2->v1'}]}) SORT e.what RETURN e"); testEdgesInboundStartExample: function() {
var bindVars = {
name: gN,
example: startExample,
options: {direction : 'inbound'}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual.length, 3);
assertEqual(actual[0], "v1->v2");
assertEqual(actual[1], "v2->v1");
assertEqual(actual[2], "v3->v8");
},
testEdgesInboundStartExampleRestricted: function() {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'inbound',
edgeCollectionRestriction: [e2]
}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0], "v3->v8");
},
testEdgesInboundStartExampleEdgeExample: function() {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'inbound',
edgeExamples: [{'what' : 'v3->v8'}]
}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0], "v3->v8");
},
testEdgesOutbound: function() {
var bindVars = {
name: gN,
example: v1 + "/v1",
options: {direction : 'outbound'}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual[0], "v1->v2");
assertEqual(actual[1], "v1->v5");
},
testEdgesOutboundStartExample: function() {
var bindVars = {
name: gN,
example: startExample,
options: {direction : 'outbound'}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual.length, 7);
assertEqual(actual[0], "v1->v2");
assertEqual(actual[1], "v1->v5");
assertEqual(actual[2], "v2->v1");
assertEqual(actual[3], "v2->v5");
assertEqual(actual[4], "v3->v5");
assertEqual(actual[5], "v3->v6");
assertEqual(actual[6], "v3->v8");
},
testEdgesOutboundStartExampleRestricted: function() {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'outbound',
edgeCollectionRestriction: [e2]
}
};
var actual = getRawQueryResults(AQL_EDGES, bindVars);
assertEqual(actual.length, 5);
assertEqual(actual[0], "v1->v5");
assertEqual(actual[1], "v2->v5");
assertEqual(actual[2], "v3->v5");
assertEqual(actual[3], "v3->v6");
assertEqual(actual[4], "v3->v8");
},
////////////////////////////////////////////////////////////////////////////////
/// Test Neighbors
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// Any direction
////////////////////////////////////////////////////////////////////////////////
testNeighborsAny: function () {
var bindVars = {
name: gN,
example: v1 + "/v1",
options: {
direction : 'any'
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 3);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v2");
assertEqual(actual[1].path.edges[0].what, "v2->v1");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v2");
assertEqual(actual[2].path.edges[0].what, "v1->v5");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v5");
},
testNeighborsAnyEdgeExample: function () {
var bindVars = {
name: gN,
example: v1 + "/v1",
options: {
direction : 'any',
edgeExamples : [{'what' : 'v2->v1'}]
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0].path.edges[0].what, "v2->v1"); assertEqual(actual[0].path.edges[0].what, "v2->v1");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v2"); assertEqual(actual[0].vertex._key, "v2");
}, },
////////////////////////////////////////////////////////////////////////////////
/// @brief checks EDGES()
////////////////////////////////////////////////////////////////////////////////
testEdgesIn: function () { testNeighborsAnyStartExample: function () {
var actual; var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'any'
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 10);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].path.edges[0].what, "v2->v1");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v1");
assertEqual(actual[2].path.edges[0].what, "v1->v2");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v2");
assertEqual(actual[3].path.edges[0].what, "v2->v1");
assertEqual(actual[3].path.edges.length, 1);
assertEqual(actual[3].vertex._key, "v2");
assertEqual(actual[4].path.edges[0].what, "v3->v8");
assertEqual(actual[4].path.edges.length, 1);
assertEqual(actual[4].vertex._key, "v3");
assertEqual(actual[5].path.edges[0].what, "v1->v5");
assertEqual(actual[5].path.edges.length, 1);
assertEqual(actual[5].vertex._key, "v5");
assertEqual(actual[6].path.edges[0].what, "v2->v5");
assertEqual(actual[6].path.edges.length, 1);
assertEqual(actual[6].vertex._key, "v5");
assertEqual(actual[7].path.edges[0].what, "v3->v5");
assertEqual(actual[7].path.edges.length, 1);
assertEqual(actual[7].vertex._key, "v5");
assertEqual(actual[8].path.edges[0].what, "v3->v6");
assertEqual(actual[8].path.edges.length, 1);
assertEqual(actual[8].vertex._key, "v6");
assertEqual(actual[9].path.edges[0].what, "v3->v8");
assertEqual(actual[9].path.edges.length, 1);
assertEqual(actual[9].vertex._key, "v8");
},
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex3/v5', {direction : 'inbound'}) SORT e.what RETURN e.what"); testNeighborsAnyVertexExample: function () {
assertEqual(actual, [ "v1->v5", "v2->v5", "v3->v5"]); var bindVars = {
name: gN,
example: {},
options: {
direction : 'any',
neighborExamples: vertexExample
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 3);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].path.edges[0].what, "v1->v5");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v1");
assertEqual(actual[2].path.edges[0].what, "v2->v1");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v1");
},
testNeighborsAnyStartExampleRestrictEdges: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'any',
edgeCollectionRestriction: e2
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 6);
assertEqual(actual[0].path.edges[0].what, "v3->v8");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v3");
assertEqual(actual[1].path.edges[0].what, "v1->v5");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v5");
assertEqual(actual[2].path.edges[0].what, "v2->v5");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v5");
assertEqual(actual[3].path.edges[0].what, "v3->v5");
assertEqual(actual[3].path.edges.length, 1);
assertEqual(actual[3].vertex._key, "v5");
assertEqual(actual[4].path.edges[0].what, "v3->v6");
assertEqual(actual[4].path.edges.length, 1);
assertEqual(actual[4].vertex._key, "v6");
assertEqual(actual[5].path.edges[0].what, "v3->v8");
assertEqual(actual[5].path.edges.length, 1);
assertEqual(actual[5].vertex._key, "v8");
},
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', 'UnitTestsAhuacatlVertex3/v5', {direction : 'inbound'}) SORT e._id RETURN e"); testNeighborsAnyStartExampleRestrictVertices: function () {
assertEqual(actual[0]._id, 'UnitTestsAhuacatlVertex3/v5'); var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'any',
vertexCollectionRestriction: [v1, v3]
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 8);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].path.edges[0].what, "v2->v1");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v1");
assertEqual(actual[2].path.edges[0].what, "v1->v2");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v2");
assertEqual(actual[3].path.edges[0].what, "v2->v1");
assertEqual(actual[3].path.edges.length, 1);
assertEqual(actual[3].vertex._key, "v2");
assertEqual(actual[4].path.edges[0].what, "v1->v5");
assertEqual(actual[4].path.edges.length, 1);
assertEqual(actual[4].vertex._key, "v5");
assertEqual(actual[5].path.edges[0].what, "v2->v5");
assertEqual(actual[5].path.edges.length, 1);
assertEqual(actual[5].vertex._key, "v5");
assertEqual(actual[6].path.edges[0].what, "v3->v5");
assertEqual(actual[6].path.edges.length, 1);
assertEqual(actual[6].vertex._key, "v5");
assertEqual(actual[7].path.edges[0].what, "v3->v6");
assertEqual(actual[7].path.edges.length, 1);
assertEqual(actual[7].vertex._key, "v6");
},
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', [{hugo : true}, {heinz : 1}], {direction : 'inbound'}) SORT e._id RETURN e"); testNeighborsAnyStartExampleRestrictEdgesAndVertices: function () {
assertEqual(actual[0]._id, 'UnitTestsAhuacatlVertex1/v1'); var bindVars = {
assertEqual(actual[1]._id, 'UnitTestsAhuacatlVertex1/v2'); name: gN,
assertEqual(actual[2]._id, 'UnitTestsAhuacatlVertex4/v8'); example: startExample,
assertTrue(actual.length === 3); options: {
direction : 'any',
vertexCollectionRestriction: [v1, v3],
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex3/v5', {direction : 'inbound' ,edgeCollectionRestriction: 'UnitTestsAhuacatlEdge2'}) SORT e.what RETURN e.what"); edgeCollectionRestriction: e2
assertEqual(actual, [ "v1->v5", "v2->v5", "v3->v5"]); }
};
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex3/v5', {direction : 'inbound' , edgeExamples : [{'what' : 'v2->v5'}]}) SORT e.what RETURN e.what"); var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual, [ "v2->v5" ]); assertEqual(actual.length, 4);
assertEqual(actual[0].path.edges[0].what, "v1->v5");
actual = getQueryResults("FOR e IN GRAPH_NEIGHBORS('bla3', 'UnitTestsAhuacatlVertex3/v5', {direction : 'inbound' , edgeExamples : [{'what' : 'v2->v5'}]}) SORT e.what RETURN e"); assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].path.edges[0].what, "v2->v5"); assertEqual(actual[0].vertex._key, "v5");
assertEqual(actual[0].vertex._key, "v2"); assertEqual(actual[1].path.edges[0].what, "v2->v5");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v5");
assertEqual(actual[2].path.edges[0].what, "v3->v5");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v5");
assertEqual(actual[3].path.edges[0].what, "v3->v6");
assertEqual(actual[3].path.edges.length, 1);
assertEqual(actual[3].vertex._key, "v6");
}, },
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief checks EDGES() /// direction outbound
////////////////////////////////////////////////////////////////////////////////
testNeighborsOutbound: function () {
var bindVars = {
name: gN,
example: v1 + "/v1",
options: {
direction : 'outbound'
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 2);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v2");
assertEqual(actual[1].path.edges[0].what, "v1->v5");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v5");
},
testNeighborsOutboundEdgeExample: function () {
var bindVars = {
name: gN,
example: v1 + "/v1",
options: {
direction : 'outbound',
edgeExamples : [{'what' : 'v1->v2'}, {'what' : 'v2->v1'}]
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v2");
},
testNeighborsOutboundStartExample: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'outbound'
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 7);
assertEqual(actual[0].path.edges[0].what, "v2->v1");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].path.edges[0].what, "v1->v2");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v2");
assertEqual(actual[2].path.edges[0].what, "v1->v5");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v5");
assertEqual(actual[3].path.edges[0].what, "v2->v5");
assertEqual(actual[3].path.edges.length, 1);
assertEqual(actual[3].vertex._key, "v5");
assertEqual(actual[4].path.edges[0].what, "v3->v5");
assertEqual(actual[4].path.edges.length, 1);
assertEqual(actual[4].vertex._key, "v5");
assertEqual(actual[5].path.edges[0].what, "v3->v6");
assertEqual(actual[5].path.edges.length, 1);
assertEqual(actual[5].vertex._key, "v6");
assertEqual(actual[6].path.edges[0].what, "v3->v8");
assertEqual(actual[6].path.edges.length, 1);
assertEqual(actual[6].vertex._key, "v8");
},
testNeighborsOutboundVertexExample: function () {
var bindVars = {
name: gN,
example: {},
options: {
direction : 'outbound',
neighborExamples: vertexExample
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0].path.edges[0].what, "v2->v1");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
},
testNeighborsOutboundStartExampleRestrictEdges: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'outbound',
edgeCollectionRestriction: e2
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 5);
assertEqual(actual[0].path.edges[0].what, "v1->v5");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v5");
assertEqual(actual[1].path.edges[0].what, "v2->v5");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v5");
assertEqual(actual[2].path.edges[0].what, "v3->v5");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v5");
assertEqual(actual[3].path.edges[0].what, "v3->v6");
assertEqual(actual[3].path.edges.length, 1);
assertEqual(actual[3].vertex._key, "v6");
assertEqual(actual[4].path.edges[0].what, "v3->v8");
assertEqual(actual[4].path.edges.length, 1);
assertEqual(actual[4].vertex._key, "v8");
},
testNeighborsOutboundStartExampleRestrictVertices: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'outbound',
vertexCollectionRestriction: [v1, v3]
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 6);
assertEqual(actual[0].path.edges[0].what, "v2->v1");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].path.edges[0].what, "v1->v2");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v2");
assertEqual(actual[2].path.edges[0].what, "v1->v5");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v5");
assertEqual(actual[3].path.edges[0].what, "v2->v5");
assertEqual(actual[3].path.edges.length, 1);
assertEqual(actual[3].vertex._key, "v5");
assertEqual(actual[4].path.edges[0].what, "v3->v5");
assertEqual(actual[4].path.edges.length, 1);
assertEqual(actual[4].vertex._key, "v5");
assertEqual(actual[5].path.edges[0].what, "v3->v6");
assertEqual(actual[5].path.edges.length, 1);
assertEqual(actual[5].vertex._key, "v6");
},
testNeighborsOutboundStartExampleRestrictEdgesAndVertices: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'outbound',
vertexCollectionRestriction: [v1, v3],
edgeCollectionRestriction: e2
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 4);
assertEqual(actual[0].path.edges[0].what, "v1->v5");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v5");
assertEqual(actual[1].path.edges[0].what, "v2->v5");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v5");
assertEqual(actual[2].path.edges[0].what, "v3->v5");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v5");
assertEqual(actual[3].path.edges[0].what, "v3->v6");
assertEqual(actual[3].path.edges.length, 1);
assertEqual(actual[3].vertex._key, "v6");
},
////////////////////////////////////////////////////////////////////////////////
/// inbound direction
////////////////////////////////////////////////////////////////////////////////
testNeighborsInbound: function () {
var bindVars = {
name: gN,
example: v1 + "/v1",
options: {
direction : 'inbound'
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0].path.edges[0].what, "v2->v1");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v2");
},
testNeighborsInboundEdgeExample: function () {
var bindVars = {
name: gN,
example: v1 + "/v1",
options: {
direction : 'inbound',
edgeExamples : [{'what' : 'v2->v1'}]
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0].path.edges[0].what, "v2->v1");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v2");
},
testNeighborsInboundStartExample: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'inbound'
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 3);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].path.edges[0].what, "v2->v1");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v2");
assertEqual(actual[2].path.edges[0].what, "v3->v8");
assertEqual(actual[2].path.edges.length, 1);
assertEqual(actual[2].vertex._key, "v3");
},
testNeighborsInboundNeighborExample: function () {
var bindVars = {
name: gN,
example: {},
options: {
direction : 'inbound',
neighborExamples: vertexExample
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 2);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].path.edges[0].what, "v1->v5");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v1");
},
testNeighborsInboundStartExampleRestrictEdges: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'inbound',
edgeCollectionRestriction: e2
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 1);
assertEqual(actual[0].path.edges[0].what, "v3->v8");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v3");
},
testNeighborsInboundStartExampleRestrictVertices: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'inbound',
vertexCollectionRestriction: [v1, v3]
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 2);
assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].path.edges.length, 1);
assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].path.edges[0].what, "v2->v1");
assertEqual(actual[1].path.edges.length, 1);
assertEqual(actual[1].vertex._key, "v2");
},
testNeighborsInboundStartExampleRestrictEdgesAndVertices: function () {
var bindVars = {
name: gN,
example: startExample,
options: {
direction : 'inbound',
vertexCollectionRestriction: [v1, v3],
edgeCollectionRestriction: e2
}
};
var actual = getRawQueryResults(AQL_NEIGHBORS, bindVars);
assertEqual(actual.length, 0);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief checks EDGES() OLD
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
testEdgesOut: function () { testEdgesOut: function () {
var actual; var actual;
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'outbound'}) SORT e.what RETURN e.what");
assertEqual(actual, [ "v1->v2", "v1->v5"]);
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'outbound' ,edgeCollectionRestriction: 'UnitTestsAhuacatlEdge2'}) SORT e.what RETURN e.what");
assertEqual(actual, [ "v1->v5"]);
actual = getQueryResults("FOR e IN GRAPH_EDGES('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'outbound' ,edgeExamples : [{'what' : 'v2->v5'}]}) SORT e.what RETURN e.what");
assertEqual(actual, []);
actual = getQueryResults("FOR e IN GRAPH_NEIGHBORS('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'outbound' ,minDepth : 1, maxDepth : 3}) SORT e.vertex._key RETURN e"); actual = getQueryResults("FOR e IN GRAPH_NEIGHBORS('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'outbound' ,minDepth : 1, maxDepth : 3}) SORT e.vertex._key RETURN e");
assertEqual(actual[0].vertex._key, "v1"); assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].vertex._key, "v2"); assertEqual(actual[1].vertex._key, "v2");
@ -228,13 +941,6 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
assertEqual(actual[0].vertex._key, "v1"); assertEqual(actual[0].vertex._key, "v1");
assertEqual(actual[1].vertex._key, "v2"); assertEqual(actual[1].vertex._key, "v2");
actual = getRawQueryResults("FOR e IN GRAPH_VERTICES('bla3', [{hugo : true}, {heinz : 1}], {direction : 'outbound'}) SORT e._id RETURN e");
assertEqual(actual[0]._id, 'UnitTestsAhuacatlVertex1/v1');
assertEqual(actual[1]._id, 'UnitTestsAhuacatlVertex1/v2');
assertEqual(actual[2]._id, 'UnitTestsAhuacatlVertex2/v3');
assertTrue(actual.length === 3);
actual = getQueryResults("FOR e IN GRAPH_NEIGHBORS('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'outbound'}) SORT e.what RETURN e"); actual = getQueryResults("FOR e IN GRAPH_NEIGHBORS('bla3', 'UnitTestsAhuacatlVertex1/v1', {direction : 'outbound'}) SORT e.what RETURN e");
assertEqual(actual[0].path.edges[0].what, "v1->v2"); assertEqual(actual[0].path.edges[0].what, "v1->v2");
assertEqual(actual[0].vertex._key, "v2"); assertEqual(actual[0].vertex._key, "v2");
@ -344,7 +1050,7 @@ function ahuacatlQueryGeneralCommonTestSuite() {
/// @brief checks GRAPH_COMMON_NEIGHBORS() and GRAPH_COMMON_PROPERTIES() /// @brief checks GRAPH_COMMON_NEIGHBORS() and GRAPH_COMMON_PROPERTIES()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
testEdgesAny: function () { testCommonNeighbors: function () {
var actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', 'UnitTestsAhuacatlVertex1/v3' , 'UnitTestsAhuacatlVertex2/v6', {direction : 'any'}) SORT ATTRIBUTES(e)[0] RETURN e"); var actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', 'UnitTestsAhuacatlVertex1/v3' , 'UnitTestsAhuacatlVertex2/v6', {direction : 'any'}) SORT ATTRIBUTES(e)[0] RETURN e");
assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v3"]["UnitTestsAhuacatlVertex2/v6"][0]._id, "UnitTestsAhuacatlVertex1/v2"); assertEqual(actual[0]["UnitTestsAhuacatlVertex1/v3"]["UnitTestsAhuacatlVertex2/v6"][0]._id, "UnitTestsAhuacatlVertex1/v2");
@ -396,23 +1102,27 @@ function ahuacatlQueryGeneralCommonTestSuite() {
/// @brief checks GRAPH_COMMON_NEIGHBORS() /// @brief checks GRAPH_COMMON_NEIGHBORS()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
testCommonNeighborsMixedOptions: function () { testCommonNeighborsMixedOptionsDistinctFilters: function () {
var actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', {} , {}, " + var actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', {} , {}, " +
"{direction : 'outbound', vertexCollectionRestriction : 'UnitTestsAhuacatlVertex1'}, " + "{direction : 'outbound', vertexCollectionRestriction : 'UnitTestsAhuacatlVertex1'}, " +
"{direction : 'inbound', minDepth : 1, maxDepth : 2, vertexCollectionRestriction : 'UnitTestsAhuacatlVertex2'}) SORT TO_STRING(e) RETURN e"); "{direction : 'inbound', minDepth : 1, maxDepth : 2, vertexCollectionRestriction : 'UnitTestsAhuacatlVertex2'}) SORT TO_STRING(e) RETURN e");
assertEqual(Object.keys(actual[0])[0], "UnitTestsAhuacatlVertex1/v2"); assertEqual(actual.length, 0);
assertEqual(Object.keys(actual[0][Object.keys(actual[0])[0]]).sort(), ["UnitTestsAhuacatlVertex2/v5", "UnitTestsAhuacatlVertex2/v7", "UnitTestsAhuacatlVertex2/v8"]); },
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex2/v5"].length, 1); testCommonNeighborsMixedOptionsFilterBasedOnOneCollectionOnly: function () {
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex2/v8"].length, 1); var actual = getQueryResults("FOR e IN GRAPH_COMMON_NEIGHBORS('bla3', {} , {}, " +
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex2/v7"].length, 2); "{direction : 'outbound', vertexCollectionRestriction : 'UnitTestsAhuacatlVertex2'}, " +
"{direction : 'inbound', minDepth : 1, maxDepth : 2, vertexCollectionRestriction : 'UnitTestsAhuacatlVertex2'}) SORT TO_STRING(e) RETURN e");
assertEqual(Object.keys(actual[1])[0], "UnitTestsAhuacatlVertex1/v1"); assertEqual(Object.keys(actual[0])[0], "UnitTestsAhuacatlVertex1/v3");
assertEqual(Object.keys(actual[1][Object.keys(actual[1])[0]]).sort(), ["UnitTestsAhuacatlVertex2/v5", "UnitTestsAhuacatlVertex2/v6", "UnitTestsAhuacatlVertex2/v7", "UnitTestsAhuacatlVertex2/v8"]); assertEqual(Object.keys(actual[0][Object.keys(actual[0])[0]]).sort(), ["UnitTestsAhuacatlVertex1/v1", "UnitTestsAhuacatlVertex1/v2"]);
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex1/v1"].length, 1);
assertEqual(actual[0][Object.keys(actual[0])[0]]["UnitTestsAhuacatlVertex1/v2"].length, 1);
assertEqual(Object.keys(actual[1])[0], "UnitTestsAhuacatlVertex1/v2");
assertEqual(Object.keys(actual[1][Object.keys(actual[1])[0]]).sort(), ["UnitTestsAhuacatlVertex2/v7"]);
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v6"].length, 1);
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v5"].length, 1);
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v8"].length, 1);
assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v7"].length, 1); assertEqual(actual[1][Object.keys(actual[1])[0]]["UnitTestsAhuacatlVertex2/v7"].length, 1);
}, },

View File

@ -495,9 +495,6 @@ function TaskSuite () {
internal.wait(1); internal.wait(1);
var t = getTasks();
assertEqual(0, t.length);
internal.wait(5); internal.wait(5);
assertEqual(1, db[cn].count()); assertEqual(1, db[cn].count());
@ -529,17 +526,9 @@ function TaskSuite () {
assertEqual(5, task.offset); assertEqual(5, task.offset);
assertEqual("_system", task.database); assertEqual("_system", task.database);
var t = getTasks();
assertEqual(1, t.length);
internal.wait(15); internal.wait(15);
assertEqual(1, db[cn].count()); assertEqual(1, db[cn].count());
// assertEqual(1, db[cn].byExample({ value: 23 }).toArray().length);
// task should have gone by now
// t = getTasks();
// assertEqual(0, t.length);
}, },
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////