1
0
Fork 0

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:
gschwab 2014-05-16 16:12:40 +02:00
commit 55c494c81d
3 changed files with 229 additions and 113 deletions

View File

@ -79,22 +79,36 @@
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() {
col.initialize({upto : true, loglevel : 1});
col.page = 1;
col.pagesize = 1;
col.page = 2;
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() {
col.initialize({upto : false, loglevel : 1});
col.upto = false;
col.page = 1;
col.pagesize = 1;
col.page = 2;
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');
});
});

View File

@ -35,7 +35,6 @@ var arangodb = require("org/arangodb"),
_ = require("underscore");
// -----------------------------------------------------------------------------
// --SECTION-- module "org/arangodb/general-graph"
// -----------------------------------------------------------------------------
@ -230,7 +229,6 @@ var _create = function (graphName, edgeDefinitions) {
});
return new Graph(graphName, edgeDefinitions, vertexCollections, edgeCollections);
};

View File

@ -24,7 +24,7 @@
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Florian Bartels
/// @author Florian Bartels, Michael Hackstein
/// @author Copyright 2014, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
@ -33,7 +33,7 @@ var jsunity = require("jsunity");
var arangodb = require("org/arangodb");
var console = require("console");
var graph = require("org/arangodb/general-graph")
var graph = require("org/arangodb/general-graph");
var print = arangodb.print;
@ -223,7 +223,6 @@ function GeneralGraphCreationSuite() {
}
/*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
@ -257,6 +360,7 @@ function GeneralGraphCreationSuite() {
////////////////////////////////////////////////////////////////////////////////
jsunity.run(GeneralGraphCreationSuite);
jsunity.run(GeneralGraphSimpleQueriesSuite);
return jsunity.done();