mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
Conflicts: js/common/modules/org/arangodb/general-graph.js
This commit is contained in:
commit
55c494c81d
|
@ -79,22 +79,36 @@
|
||||||
expect(col.loglevel).toEqual(1);
|
expect(col.loglevel).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should check if last page is active", function() {
|
||||||
|
col.page = 1;
|
||||||
|
col.pagesize = 10;
|
||||||
|
col.totalAmount = 14;
|
||||||
|
col.totalPages = 2;
|
||||||
|
expect(col.url()).toEqual('/_admin/log?upto=1&size=4&offset=0');
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should check if totalAmount is set", function() {
|
||||||
|
col.totalAmount = 0;
|
||||||
|
col.url();
|
||||||
|
});
|
||||||
|
|
||||||
it("url with upto", function() {
|
it("url with upto", function() {
|
||||||
col.initialize({upto : true, loglevel : 1});
|
col.initialize({upto : true, loglevel : 1});
|
||||||
col.page = 1;
|
col.page = 2;
|
||||||
col.pagesize = 1;
|
col.pagesize = 2;
|
||||||
|
col.totalAmount = 10;
|
||||||
|
|
||||||
expect(col.url()).toEqual('/_admin/log?upto=1&size=1&offset=0');
|
expect(col.url()).toEqual('/_admin/log?upto=1&size=2&offset=4');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("url with no upto", function() {
|
it("url with no upto", function() {
|
||||||
col.initialize({upto : false, loglevel : 1});
|
col.initialize({upto : false, loglevel : 1});
|
||||||
col.upto = false;
|
col.upto = false;
|
||||||
col.page = 1;
|
col.page = 2;
|
||||||
col.pagesize = 1;
|
col.pagesize = 2;
|
||||||
|
col.totalAmount = 10;
|
||||||
|
|
||||||
expect(col.url()).toEqual('/_admin/log?level=1&size=1&offset=0');
|
expect(col.url()).toEqual('/_admin/log?level=1&size=2&offset=4');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ var arangodb = require("org/arangodb"),
|
||||||
_ = require("underscore");
|
_ = require("underscore");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- module "org/arangodb/general-graph"
|
// --SECTION-- module "org/arangodb/general-graph"
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -230,7 +229,6 @@ var _create = function (graphName, edgeDefinitions) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return new Graph(graphName, edgeDefinitions, vertexCollections, edgeCollections);
|
return new Graph(graphName, edgeDefinitions, vertexCollections, edgeCollections);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
///
|
///
|
||||||
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// @author Florian Bartels
|
/// @author Florian Bartels, Michael Hackstein
|
||||||
/// @author Copyright 2014, triAGENS GmbH, Cologne, Germany
|
/// @author Copyright 2014, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ var jsunity = require("jsunity");
|
||||||
var arangodb = require("org/arangodb");
|
var arangodb = require("org/arangodb");
|
||||||
|
|
||||||
var console = require("console");
|
var console = require("console");
|
||||||
var graph = require("org/arangodb/general-graph")
|
var graph = require("org/arangodb/general-graph");
|
||||||
|
|
||||||
var print = arangodb.print;
|
var print = arangodb.print;
|
||||||
|
|
||||||
|
@ -223,7 +223,6 @@ function GeneralGraphCreationSuite() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*test_create : function () {
|
/*test_create : function () {
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,11 +241,115 @@ function GeneralGraphCreationSuite() {
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- Simple Queries
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function GeneralGraphSimpleQueriesSuite() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief test: restrict construct on edges
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
test_restrictOnEdges: function() {
|
||||||
|
// Creation of a graph content
|
||||||
|
var inc = graph._directedRelationDefinition("included", ["v1"], ["v1", "v2"]);
|
||||||
|
var exc = graph._directedRelationDefinition("excluded", ["v1"], ["v3"]);
|
||||||
|
/*
|
||||||
|
var g = graph._create("graph", [inc, exc]);
|
||||||
|
var incEdge1 = g.included.save({
|
||||||
|
_from: "v1/1",
|
||||||
|
_to:"v2/1",
|
||||||
|
included: true
|
||||||
|
});
|
||||||
|
var incEdge2 = g.included.save({
|
||||||
|
_from: "v1/2",
|
||||||
|
_to:"v1/1",
|
||||||
|
included: true
|
||||||
|
});
|
||||||
|
var excEdge = g.excluded.save({
|
||||||
|
_from: "v1/1",
|
||||||
|
_to:"v3/1",
|
||||||
|
included: false
|
||||||
|
});
|
||||||
|
var result = g.edges().restrict("v1");
|
||||||
|
assertEqual(result.length, 2);
|
||||||
|
assertNotEqual(result.indexOf(incEdge1), -1);
|
||||||
|
assertNotEqual(result.indexOf(incEdge2), -1);
|
||||||
|
assertEqual(result.indexOf(excEdge), -1);
|
||||||
|
*/
|
||||||
|
},
|
||||||
|
|
||||||
|
test_restrictOnInEdges: function() {
|
||||||
|
// Creation of a graph content
|
||||||
|
var inc = graph._directedRelationDefinition("included", ["v1"], ["v1", "v2"]);
|
||||||
|
var exc = graph._directedRelationDefinition("excluded", ["v1"], ["v3"]);
|
||||||
|
/*
|
||||||
|
var g = graph._create("graph", [inc, exc]);
|
||||||
|
var excEdge1 = g.included.save({
|
||||||
|
_from: "v1/1",
|
||||||
|
_to:"v2/1",
|
||||||
|
included: true
|
||||||
|
});
|
||||||
|
var incEdge = g.included.save({
|
||||||
|
_from: "v1/2",
|
||||||
|
_to:"v1/1",
|
||||||
|
included: true
|
||||||
|
});
|
||||||
|
var excEdge2 = g.excluded.save({
|
||||||
|
_from: "v1/1",
|
||||||
|
_to:"v3/1",
|
||||||
|
included: false
|
||||||
|
});
|
||||||
|
var result = g.edges().restrict("v1");
|
||||||
|
assertEqual(result.length, 1);
|
||||||
|
assertEqual(result.indexOf(excEdge1), -1);
|
||||||
|
assertNotEqual(result.indexOf(incEdge), -1);
|
||||||
|
assertEqual(result.indexOf(excEdge2), -1);
|
||||||
|
*/
|
||||||
|
},
|
||||||
|
|
||||||
|
test_restrictOnOutEdges: function() {
|
||||||
|
// Creation of a graph content
|
||||||
|
var inc = graph._directedRelationDefinition("included", ["v1"], ["v1", "v2"]);
|
||||||
|
var exc = graph._directedRelationDefinition("excluded", ["v1"], ["v3"]);
|
||||||
|
/*
|
||||||
|
var g = graph._create("graph", [inc, exc]);
|
||||||
|
var incEdge = g.included.save({
|
||||||
|
_from: "v1/1",
|
||||||
|
_to:"v2/1",
|
||||||
|
included: true
|
||||||
|
});
|
||||||
|
var excEdge1 = g.included.save({
|
||||||
|
_from: "v1/2",
|
||||||
|
_to:"v1/1",
|
||||||
|
included: true
|
||||||
|
});
|
||||||
|
var excEdge2 = g.excluded.save({
|
||||||
|
_from: "v1/1",
|
||||||
|
_to:"v3/1",
|
||||||
|
included: false
|
||||||
|
});
|
||||||
|
var result = g.edges().restrict("v1");
|
||||||
|
assertEqual(result.length, 1);
|
||||||
|
assertNotEqual(result.indexOf(incEdge), -1);
|
||||||
|
assertEqual(result.indexOf(excEdge1), -1);
|
||||||
|
assertEqual(result.indexOf(excEdge2), -1);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- main
|
// --SECTION-- main
|
||||||
|
@ -257,6 +360,7 @@ function GeneralGraphCreationSuite() {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
jsunity.run(GeneralGraphCreationSuite);
|
jsunity.run(GeneralGraphCreationSuite);
|
||||||
|
jsunity.run(GeneralGraphSimpleQueriesSuite);
|
||||||
|
|
||||||
return jsunity.done();
|
return jsunity.done();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue