mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: The adapters now initialise the Abstract adapter with the content of prioList
This commit is contained in:
parent
51358995ca
commit
3f12250c73
|
@ -48,7 +48,8 @@ function ArangoAdapter(nodes, edges, config) {
|
|||
}
|
||||
|
||||
var self = this,
|
||||
absAdapter = new AbstractAdapter(nodes, edges, this),
|
||||
absAdapter,
|
||||
absConfig = {},
|
||||
api = {},
|
||||
queries = {},
|
||||
nodeCollection,
|
||||
|
@ -199,7 +200,13 @@ function ArangoAdapter(nodes, edges, config) {
|
|||
_.each(res, self.deleteEdge);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (config.prioList) {
|
||||
absConfig.prioList = config.prioList;
|
||||
}
|
||||
absAdapter = new AbstractAdapter(nodes, edges, this, absConfig);
|
||||
|
||||
parseConfig(config);
|
||||
|
||||
api.base = arangodb.lastIndexOf("http://", 0) === 0
|
||||
|
|
|
@ -41,8 +41,11 @@ function FoxxAdapter(nodes, edges, route, config) {
|
|||
throw "The route has to be given.";
|
||||
}
|
||||
|
||||
config = config || {};
|
||||
|
||||
var self = this,
|
||||
absAdapter = new AbstractAdapter(nodes, edges, this),
|
||||
absConfig = {},
|
||||
absAdapter,
|
||||
routes = {},
|
||||
baseRoute = route,
|
||||
requestBase = {
|
||||
|
@ -195,8 +198,11 @@ function FoxxAdapter(nodes, edges, route, config) {
|
|||
callback(first);
|
||||
}
|
||||
};
|
||||
|
||||
config = config || {};
|
||||
|
||||
if (config.prioList) {
|
||||
absConfig.prioList = config.prioList;
|
||||
}
|
||||
absAdapter = new AbstractAdapter(nodes, edges, this, absConfig);
|
||||
|
||||
parseConfig(config);
|
||||
fillRoutes();
|
||||
|
|
|
@ -146,6 +146,17 @@
|
|||
expect(window.NodeReducer).wasCalledWith(nodes, edges);
|
||||
});
|
||||
|
||||
it('should send the nodeReducer the configuration if given', function() {
|
||||
spyOn(window, "NodeReducer");
|
||||
var nodes = [],
|
||||
edges = [],
|
||||
config = {
|
||||
prioList: ["foo", "bar", "baz"]
|
||||
},
|
||||
t = new AbstractAdapter(nodes, edges, descendant, config);
|
||||
expect(window.NodeReducer).wasCalledWith(nodes, edges, ["foo", "bar", "baz"]);
|
||||
});
|
||||
|
||||
it('should create a ModularityJoiner worker', function() {
|
||||
spyOn(window, "WebWorkerWrapper");
|
||||
var nodes = [],
|
||||
|
|
|
@ -94,7 +94,8 @@
|
|||
|
||||
return new ArangoAdapter([], [], {
|
||||
nodeCollection: "",
|
||||
edgeCollection: ""
|
||||
edgeCollection: "",
|
||||
prioList: ["foo", "bar", "baz"]
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
return new FoxxAdapter([], [], "foxx/route");
|
||||
return new FoxxAdapter([], [], "foxx/route", {prioList: ["foo", "bar", "baz"]});
|
||||
});
|
||||
|
||||
var adapter,
|
||||
|
|
|
@ -81,6 +81,7 @@ var describeInterface = function (testee) {
|
|||
|
||||
/**
|
||||
* Expectations on constructor:
|
||||
* Created with config: {prioList: ["foo", "bar", "baz"]}
|
||||
* loadNode -> Adds {_id: 1} -{_id:"1-2"}-> {_id: 2}
|
||||
* createEdge({source: {_id: 1}, target: {_id: 1}}) -> {_id: "1-2", _from:1, _to:2}
|
||||
* createNode({}) -> {_id: 1}
|
||||
|
@ -126,13 +127,23 @@ var describeIntegeration = function(constructor) {
|
|||
};
|
||||
|
||||
|
||||
spyOn(window, "AbstractAdapter").andCallFake(function(nodes, edges, descendant) {
|
||||
spyOn(window, "AbstractAdapter").andCallFake(function(nodes, edges, descendant, config) {
|
||||
mockedAbstract.nodes = nodes;
|
||||
mockedAbstract.edges = edges;
|
||||
return mockedAbstract;
|
||||
});
|
||||
});
|
||||
|
||||
it('should create the AbstractAdapter with correct values', function() {
|
||||
testee = constructor();
|
||||
expect(window.AbstractAdapter).wasCalledWith(
|
||||
[],
|
||||
[],
|
||||
testee,
|
||||
{prioList: ["foo", "bar", "baz"]}
|
||||
);
|
||||
});
|
||||
|
||||
it('should call setNodeLimit on the abstract', function() {
|
||||
spyOn(mockedAbstract, "setNodeLimit");
|
||||
testee = constructor();
|
||||
|
|
Loading…
Reference in New Issue