1
0
Fork 0

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

This commit is contained in:
Max Neunhoeffer 2014-02-12 15:20:48 +01:00
commit a060bccbc4
7 changed files with 1023 additions and 912 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,10 @@
window.PlannerRouter = Backbone.Router.extend({
routes: {
"planTest" : "planTest",
"planScenarioSelector" : "planScenarioSelector"
"planTest" : "planTest",
"planSymmetric" : "planSymmetric",
"planAsymmetric" : "planAsymmetric",
"planScenarioSelector" : "planScenarioSelector"
},
planTest: function() {
@ -18,6 +20,20 @@
this.planTestView.render();
},
planSymmetric: function() {
if (!this.planSymmetricView) {
this.planSymmetricView = new window.PlanSymmetricView();
}
this.planTestView.render();
},
planAsymmetric: function() {
if (!this.planAsymmetricView) {
this.planAsymmetricView = new window.PlanAsymmetricView();
}
this.planAsymmetricView.render();
},
planScenarioSelector: function() {
if (!this.PlanScenarioSelector) {
this.PlanScenarioSelector = new window.PlanScenarioSelectorView();
@ -25,18 +41,16 @@
this.PlanScenarioSelector.render();
},
initialize: function () {
/*
this.footerView = new window.FooterView();
this.footerView.render();
*/
},
},
handleResize: function() {
handleResize: function() {
// Not needed here
}
}
});
}());

View File

@ -1,5 +1,5 @@
/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, newcap: true */
/*global window, $, Backbone, document, arangoCollection,arangoHelper,dashboardView,arangoDatabase*/
/*global window, $, Backbone, plannerTemplateEngine */
(function() {
"use strict";

View File

@ -13,8 +13,9 @@
simpleNavigationCheck;
beforeEach(function() {
r = new window.plannerRouter();
simpleNavigationCheck = function(url, viewName, initObject, funcList, shouldNotRender) {
r = new window.PlannerRouter();
simpleNavigationCheck = function(url, viewName,
initObject, funcList, shouldNotRender) {
var route,
view = {},
checkFuncExec = function() {

View File

@ -1,7 +1,7 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
/*global describe, beforeEach, afterEach, it, spyOn, expect*/
/*global runs, waitsFor, jasmine*/
/*global $, arangoCollection*/
/*global $*/
(function() {
"use strict";

View File

@ -0,0 +1,74 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
/*global describe, beforeEach, afterEach, it, spyOn, expect*/
/*global runs, waitsFor, jasmine*/
/*global $, arangoCollection*/
(function() {
"use strict";
describe("Plan Test View", function() {
var myView, ip, port, coords, dbs;
beforeEach(function() {
$('body').append('<div id="content" class="removeMe"></div>');
ip = "192.168.0.1";
port = 8529;
coords = 4;
dbs = 5;
myView = new window.PlanTestView();
myView.render();
$("#host").val(ip);
$("#port").val(port);
$("#coordinators").val(coords);
$("#dbs").val(dbs);
spyOn($, "ajax");
});
afterEach(function() {
$('.removeMe').remove();
});
it("should start a cluster", function() {
$("#startPlan").click();
expect($.ajax).toHaveBeenCalledWith("cluster/plan", {
type: "POST",
data: {
dispatcher: ip + ":" + port,
numberCoordinators: coords,
numberDBServers: dbs,
type: "testSetup"
}
});
});
it("should not start a cluster if dispatcher port is missing", function() {
$("#host").val("");
$("#startPlan").click();
expect($.ajax).not.toHaveBeenCalled();
});
it("should not start a cluster if dispatcher host is missing", function() {
$("#port").val("");
$("#startPlan").click();
expect($.ajax).not.toHaveBeenCalled();
});
it("should not start a cluster if coordinator number is missing", function() {
$("#coordinators").val("");
$("#startPlan").click();
expect($.ajax).not.toHaveBeenCalled();
});
it("should not start a cluster if db number is missing", function() {
$("#dbs").val("");
$("#startPlan").click();
expect($.ajax).not.toHaveBeenCalled();
});
});
}());

View File

@ -380,16 +380,6 @@ function handleDatabaseChanges (plan, current) {
cleanupCurrentDatabases();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief create an index in a shard
////////////////////////////////////////////////////////////////////////////////
function createIndex (shard, index) {
var collection = arangodb.db._collection(shard);
return collection.ensureIndex(index);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief create collections if they exist in the plan but not locally
////////////////////////////////////////////////////////////////////////////////
@ -544,7 +534,7 @@ function createLocalCollections (plannedCollections) {
shard,
JSON.stringify(index));
createIndex(shard, index);
arangodb.db._collection(shard).ensureIndex(index);
}
}
}