1
0
Fork 0

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

This commit is contained in:
Jan Steemann 2014-11-05 16:04:10 +01:00
commit a35cf09411
15 changed files with 384 additions and 215 deletions

View File

@ -2,7 +2,7 @@
The default installation directory is *c:\Program Files\ArangoDB-1.x.y*. During the The default installation directory is *c:\Program Files\ArangoDB-1.x.y*. During the
installation process you may change this. In the following description we will assume installation process you may change this. In the following description we will assume
that ArangoDB has been installed in the location *<ROOTDIR>*. that ArangoDB has been installed in the location *&lt;ROOTDIR&gt;*.
You have to be careful when choosing an installation directory. You need either You have to be careful when choosing an installation directory. You need either
write permission to this directory or you need to modify the config file for the write permission to this directory or you need to modify the config file for the
@ -10,17 +10,17 @@ server process. In the latter case the database directory and the Foxx directory
has to be writable by the user. has to be writable by the user.
Installing for a single user: Select a different directory during Installing for a single user: Select a different directory during
installation. For example *C:/Users/<username>/arangodb* or *C:/ArangoDB*. installation. For example *c:\Users\&lt;Username&gt;\ArangoDB* or *c:\ArangoDB*.
Installing for multiple users: Keep the default directory. After the Installing for multiple users: Keep the default directory. After the
installation edit the file *<ROOTDIR>/etc/arangodb/arangod.conf*. Adjust the installation edit the file *&lt;ROOTDIR&gt;\etc\Arangodb\arangod.conf*. Adjust the
*directory* and *app-path* so that these paths point into your home directory. *directory* and *app-path* so that these paths point into your home directory.
[database] [database]
directory = @HOMEDRIVE@/@HOMEPATH@/arangodb/databases directory = @HOMEDRIVE@\@HOMEPATH@\arangodb\databases
[javascript] [javascript]
app-path = @HOMEDRIVE@/@HOMEPATH@/arangodb/apps app-path = @HOMEDRIVE@\@HOMEPATH@\arangodb\apps
Create the directories for each user that wants to use ArangoDB. Create the directories for each user that wants to use ArangoDB.
@ -28,16 +28,16 @@ Installing as Service: Keep the default directory. After the installation open
a command line as administrator (search for *cmd* and right click *run as a command line as administrator (search for *cmd* and right click *run as
administrator*). administrator*).
cmd> arangod --install-service cmd&gt; arangod --install-service
INFO: adding service 'ArangoDB - the multi-purpose database' (internal 'ArangoDB') INFO: adding service 'ArangoDB - the multi-purpose database' (internal 'ArangoDB')
INFO: added service with command line '"C:\Program Files (x86)\ArangoDB 1.4.4\bin\arangod.exe" --start-service' INFO: added service with command line '"C:\Program Files (x86)\ArangoDB 1.4.4\bin\arangod.exe" --start-service'
Open the service manager and start ArangoDB. In order to enable logging Open the service manager and start ArangoDB. In order to enable logging
edit the file "<ROOTDIR>/etc/arangodb/arangod.conf" and uncomment the file edit the file "<ROOTDIR>\etc\arangodb\arangod.conf" and uncomment the file
option. option.
[log] [log]
file = @ROOTDIR@/var/log/arangodb/arangod.log file = @ROOTDIR@\var\log\arangodb\arangod.log
!SUBSECTION Client, Server and Lock-Files !SUBSECTION Client, Server and Lock-Files
@ -51,9 +51,9 @@ not proceed correctly or if the server terminated unexpectedly.
!SUBSECTION Starting !SUBSECTION Starting
To start an ArangoDB server instance with networking enabled, use the executable To start an ArangoDB server instance with networking enabled, use the executable
*arangod.exe* located in *<ROOTDIR>/bin*. This will use the configuration *arangod.exe* located in *&lt;ROOTDIR&gt;\bin*. This will use the configuration
file *arangod.conf* located in *<ROOTDIR>/etc/arangodb*, which you can adjust file *arangod.conf* located in *&lt;ROOTDIR&gt;\etc\arangodb*, which you can adjust
to your needs and use the data directory *<ROOTDIR>/var/lib/arangodb*. This to your needs and use the data directory *&lt;ROOTDIR&gt;\var\lib\arangodb*. This
is the place where all your data (databases and collections) will be stored is the place where all your data (databases and collections) will be stored
by default. by default.
@ -85,7 +85,7 @@ containing the configuration files.
!SUBSECTION Using the Client !SUBSECTION Using the Client
To connect to an already running ArangoDB server instance, there is a shell To connect to an already running ArangoDB server instance, there is a shell
*arangosh.exe* located in *<ROOTDIR>/bin*. This starts a shell which can be *arangosh.exe* located in *&lt;ROOTDIR&gt;\bin*. This starts a shell which can be
used amongst other things to administer and query a local or remote used amongst other things to administer and query a local or remote
ArangoDB server. ArangoDB server.
@ -94,7 +94,7 @@ shell. To use it you must have a server running somewhere, e.g. by using
the *arangod.exe* executable. the *arangod.exe* executable.
*arangosh.exe* uses configuration from the file *arangosh.conf* located in *arangosh.exe* uses configuration from the file *arangosh.conf* located in
*<ROOTDIR>/etc/arangodb/*. Please adjust this to your needs if you want to *&lt;ROOTDIR&gt;\etc\arangodb\*. Please adjust this to your needs if you want to
use different connection settings etc. use different connection settings etc.
!SUBSECTION 32bit !SUBSECTION 32bit
@ -121,9 +121,9 @@ completed successfully.
To uninstall the Arango server application you can use the windows control panel To uninstall the Arango server application you can use the windows control panel
(as you would normally uninstall an application). Note however, that any data (as you would normally uninstall an application). Note however, that any data
files created by the Arango server will remain as well as the *<ROOTDIR>* files created by the Arango server will remain as well as the *&lt;ROOTDIR&gt;*
directory. To complete the uninstallation process, remove the data files and directory. To complete the uninstallation process, remove the data files and
the *<ROOTDIR>* directory manually. the *&lt;ROOTDIR&gt;* directory manually.
!SUBSECTION Limitations for Cygwin !SUBSECTION Limitations for Cygwin

View File

@ -40,6 +40,9 @@ var FoxxController = require("org/arangodb/foxx").Controller,
foxxInstallKey = joi.string().required().description( foxxInstallKey = joi.string().required().description(
"The _key attribute, where the information of this Foxx-Install is stored." "The _key attribute, where the information of this Foxx-Install is stored."
), ),
foxxMountPoint = joi.string().required().description(
"The mount point, where this Foxx is installed."
),
appname = joi.string().required(); appname = joi.string().required();
var foxxes = new (require("lib/foxxes").Foxxes)(); var foxxes = new (require("lib/foxxes").Foxxes)();
@ -286,13 +289,17 @@ controller.get('/docus', function (req, res) {
* *
*/ */
controller.get("/docu/:key",function (req, res) { controller.get("/docu/:mount", function (req, res) {
require("console").log("Paul");
var subPath = req.path.substr(0, req.path.lastIndexOf("[") - 1), var subPath = req.path.substr(0, req.path.lastIndexOf("[") - 1),
key = req.params("key"), mount = req.params("mount"),
path = req.protocol + "://" + req.headers.host + path = req.protocol + "://" + req.headers.host + "/_db/" + encodeURIComponent(req.database) + subPath + "/" + encodeURIComponent(mount) + "/";
"/_db/" + encodeURIComponent(req.database) + subPath + "/" + encodeURIComponent(key) + "/"; require("console").log(docus.listOne(path, mount));
res.json(docus.listOne(path, key)); res.json(docus.listOne(path, mount));
}).summary("List documentation of one foxxes.") }).pathParam("mount", {
type: foxxMountPoint,
allowMultiple: false
}).summary("List documentation of all foxxes.")
.notes("This function simply returns one specific" .notes("This function simply returns one specific"
+ " foxx and supplies the paths for the swagger documentation"); + " foxx and supplies the paths for the swagger documentation");
@ -301,12 +308,18 @@ controller.get("/docu/:key",function (req, res) {
* Get the Elements of the API Documentation subroutes * Get the Elements of the API Documentation subroutes
* *
*/ */
controller.get('/docu/:key/*', function(req, res) { controller.get('/docu/:mount/:mountPoint', function(req, res) {
var mountPoint = ""; require("console").log("Blub");
underscore.each(req.suffix, function(part) { require("console").log(req.params("mount"));
mountPoint += "/" + part; var mountPoint = decodeURIComponent(req.params("mountPoint"));
}); require("console").log(mountPoint);
res.json(docus.show(mountPoint)); res.json(docus.show(mountPoint));
}).pathParam("mount", {
type: foxxMountPoint,
allowMultiple: false
}).pathParam("mountPoint", {
type: foxxMountPoint,
allowMultiple: false
}).summary("List the API for one foxx") }).summary("List the API for one foxx")
.notes("This function lists the API of the foxx" .notes("This function lists the API of the foxx"
+ " running under the given mount point"); + " running under the given mount point");

View File

@ -19,7 +19,7 @@
"api": "api", "api": "api",
"databases": "databases", "databases": "databases",
"applications": "applications", "applications": "applications",
"application/documentation/:key": "appDocumentation", "application/documentation/:mount": "appDocumentation",
"graph": "graphManagement", "graph": "graphManagement",
"userManagement": "userManagement", "userManagement": "userManagement",
"userProfile": "userProfile", "userProfile": "userProfile",
@ -242,8 +242,8 @@
this.naviView.selectMenuItem('applications-menu'); this.naviView.selectMenuItem('applications-menu');
}, },
appDocumentation: function (key) { appDocumentation: function (mount) {
var docuView = new window.AppDocumentationView({key: key}); var docuView = new window.AppDocumentationView({mount: mount});
docuView.render(); docuView.render();
this.naviView.selectMenuItem('applications-menu'); this.naviView.selectMenuItem('applications-menu');
}, },

View File

@ -13,7 +13,7 @@
initialize: function() { initialize: function() {
var internal = require("internal"); var internal = require("internal");
var url = internal.arango.databasePrefix("/_admin/aardvark/docu/" + this.options.key); var url = internal.arango.databasePrefix("/_admin/aardvark/docu/" + encodeURIComponent(this.options.mount));
this.swaggerUi = new SwaggerUi({ this.swaggerUi = new SwaggerUi({
discoveryUrl: url, discoveryUrl: url,
apiKey: false, apiKey: false,

View File

@ -665,12 +665,12 @@
this.isUpdating = false; this.isUpdating = false;
}, },
startUpdating: function () { startUpdating: function () {
var self = this; var self = this;
if (self.timer) { if (self.timer) {
return; return;
} }
self.timer = window.setInterval(function () { self.timer = window.setInterval(function () {
self.getStatistics(); self.getStatistics();
}, },
self.interval self.interval

View File

@ -208,7 +208,7 @@
showDocu: function(event) { showDocu: function(event) {
event.stopPropagation(); event.stopPropagation();
window.App.navigate( window.App.navigate(
"application/documentation/" + encodeURIComponent(this.model.get("_key")), "application/documentation/" + encodeURIComponent(this.model.get("mount").substr(1)),
{ {
trigger: true trigger: true
} }

View File

@ -119,24 +119,18 @@
//check for invalid query names, if present change the box-shadow to red //check for invalid query names, if present change the box-shadow to red
// and disable the save functionality // and disable the save functionality
var boolTemp = false; var found = this.customQueries.some(function(query){
this.customQueries.some(function(query){ return query.name === saveName;
if( query.name === saveName ){
$('#modalButton1').removeClass('button-success');
$('#modalButton1').addClass('button-warning');
$('#modalButton1').text('Update');
boolTemp = true;
}
else {
$('#modalButton1').removeClass('button-warning');
$('#modalButton1').addClass('button-success');
$('#modalButton1').text('Save');
}
if (boolTemp) {
return true;
}
}); });
if(found){
$('#modalButton1').removeClass('button-success');
$('#modalButton1').addClass('button-warning');
$('#modalButton1').text('Update');
} else {
$('#modalButton1').removeClass('button-warning');
$('#modalButton1').addClass('button-success');
$('#modalButton1').text('Save');
}
}, },
clearOutput: function () { clearOutput: function () {
@ -372,9 +366,9 @@
}); });
//old storage method //old storage method
if (localStorage.getItem("customQueries")) { var item = localStorage.getItem("customQueries");
if (item) {
var queries = JSON.parse(localStorage.getItem("customQueries")); var queries = JSON.parse(item);
//save queries in user collections extra attribute //save queries in user collections extra attribute
_.each(queries, function(oldQuery) { _.each(queries, function(oldQuery) {
self.collection.add({ self.collection.add({

View File

@ -2,92 +2,95 @@
/*jshint unused: false */ /*jshint unused: false */
/*global Backbone, templateEngine, $, window*/ /*global Backbone, templateEngine, $, window*/
(function () { (function () {
"use strict"; "use strict";
window.StatisticBarView = Backbone.View.extend({ window.StatisticBarView = Backbone.View.extend({
el: '#statisticBar', el: '#statisticBar',
events: { events: {
"change #arangoCollectionSelect": "navigateBySelect", "change #arangoCollectionSelect": "navigateBySelect",
"click .tab": "navigateByTab" "click .tab": "navigateByTab"
}, },
template: templateEngine.createTemplate("statisticBarView.ejs"), template: templateEngine.createTemplate("statisticBarView.ejs"),
initialize : function () { initialize : function () {
this.currentDB = this.options.currentDB; this.currentDB = this.options.currentDB;
}, },
render: function () { replaceSVG: function($img) {
$(this.el).html(this.template.render({ var imgID = $img.attr('id');
isSystem: this.currentDB.get("isSystem") var imgClass = $img.attr('class');
})); var imgURL = $img.attr('src');
$('img.svg').each(function(){ $.get(imgURL, function(data) {
var $img = $(this); // Get the SVG tag, ignore the rest
var imgID = $img.attr('id'); var $svg = $(data).find('svg');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
$.get(imgURL, function(data) { // Add replaced image's ID to the new SVG
// Get the SVG tag, ignore the rest if(imgID === undefined) {
var $svg = $(data).find('svg'); $svg = $svg.attr('id', imgID);
}
// Add replaced image's ID to the new SVG // Add replaced image's classes to the new SVG
if(imgID === undefined) { if(imgClass === undefined) {
$svg = $svg.attr('id', imgID); $svg = $svg.attr('class', imgClass+' replaced-svg');
}
// Add replaced image's classes to the new SVG
if(imgClass === undefined) {
$svg = $svg.attr('class', imgClass+' replaced-svg');
}
// Remove any invalid XML tags as per http://validator.w3.org
$svg = $svg.removeAttr('xmlns:a');
// Replace image with new SVG
$img.replaceWith($svg);
}, 'xml');
});
return this;
},
navigateBySelect: function () {
var navigateTo = $("#arangoCollectionSelect").find("option:selected").val();
window.App.navigate(navigateTo, {trigger: true});
},
navigateByTab: function (e) {
var tab = e.target || e.srcElement;
var navigateTo = tab.id;
if (navigateTo === "links") {
$("#link_dropdown").slideToggle(200);
e.preventDefault();
return;
}
if (navigateTo === "tools") {
$("#tools_dropdown").slideToggle(200);
e.preventDefault();
return;
}
window.App.navigate(navigateTo, {trigger: true});
e.preventDefault();
},
handleSelectNavigation: function () {
$("#arangoCollectionSelect").change(function () {
var navigateTo = $(this).find("option:selected").val();
window.App.navigate(navigateTo, {trigger: true});
});
},
selectMenuItem: function (menuItem) {
$('.navlist li').removeClass('active');
if (menuItem) {
$('.' + menuItem).addClass('active');
}
} }
}); // Remove any invalid XML tags as per http://validator.w3.org
$svg = $svg.removeAttr('xmlns:a');
// Replace image with new SVG
$img.replaceWith($svg);
}, 'xml');
},
render: function () {
var self = this;
$(this.el).html(this.template.render({
isSystem: this.currentDB.get("isSystem")
}));
$('img.svg').each(function() {
self.replaceSVG($(this));
});
return this;
},
navigateBySelect: function () {
var navigateTo = $("#arangoCollectionSelect").find("option:selected").val();
window.App.navigate(navigateTo, {trigger: true});
},
navigateByTab: function (e) {
var tab = e.target || e.srcElement;
var navigateTo = tab.id;
if (navigateTo === "links") {
$("#link_dropdown").slideToggle(200);
e.preventDefault();
return;
}
if (navigateTo === "tools") {
$("#tools_dropdown").slideToggle(200);
e.preventDefault();
return;
}
window.App.navigate(navigateTo, {trigger: true});
e.preventDefault();
},
handleSelectNavigation: function () {
$("#arangoCollectionSelect").change(function () {
var navigateTo = $(this).find("option:selected").val();
window.App.navigate(navigateTo, {trigger: true});
});
},
selectMenuItem: function (menuItem) {
$('.navlist li').removeClass('active');
if (menuItem) {
$('.' + menuItem).addClass('active');
}
}
});
}()); }());

View File

@ -47,42 +47,35 @@ exports.Swagger = function () {
result.swaggerVersion = "1.1"; result.swaggerVersion = "1.1";
result.basePath = basePath; result.basePath = basePath;
result.apis = apis; result.apis = apis;
var m;
while (res.hasNext()) { while (res.hasNext()) {
var m = res.next().mount; m = res.next().mount;
if (m === "/aardvark") { if (m !== "/aardvark") {
} else {
apis.push({ apis.push({
path: m path: m
}); });
} }
} }
return result; return result;
}, };
this.listOne = function(basePath, key) { this.listOne = function(basePath, mount) {
var result = {}, var result = {};
res;
if (key.substr(0, 4) === "dev:") {
res = "/dev/" + key.split(":")[2];
}
else {
res = _aal.document(key).mount;
}
result.swaggerVersion = "1.1"; result.swaggerVersion = "1.1";
result.basePath = basePath; result.basePath = basePath;
result.apis = [ result.apis = [
{path: res} {path: decodeURIComponent(mount)}
]; ];
require("console").log(result);
return result; return result;
}, };
// Get details of one specific installed foxx. // Get details of one specific installed foxx.
this.show = function(mount) { this.show = function(mount) {
require("console").log(mount);
var result = {}, var result = {},
apis = [], apis = [],
pathes, pathes,
@ -109,18 +102,20 @@ exports.Swagger = function () {
pathes = app.routes; pathes = app.routes;
for (i in pathes) { for (i in pathes) {
if (pathes[i].url.methods !== undefined) { if(pathes.hasOwnProperty(i)){
url = pathes[i].url.match; if (pathes[i].url.methods !== undefined) {
api = {}; url = pathes[i].url.match;
ops = []; api = {};
url = url.replace(regex, "{$2}"); ops = [];
api.path = url; url = url.replace(regex, "{$2}");
ops.push(pathes[i].docs); api.path = url;
api.operations = ops; ops.push(pathes[i].docs);
apis.push(api); api.operations = ops;
apis.push(api);
}
} }
} }
return result; return result;
} };
}; };

View File

@ -32,6 +32,7 @@
"frontend/js/lib/swagger-ui.js", "frontend/js/lib/swagger-ui.js",
"frontend/js/lib/highlight.7.3.pack.js", "frontend/js/lib/highlight.7.3.pack.js",
"frontend/js/lib/joi.browser.js", "frontend/js/lib/joi.browser.js",
"frontend/js/lib/md5.js",
"test/mocks/disableEJS.js", "test/mocks/disableEJS.js",
"frontend/js/arango/arango.js", "frontend/js/arango/arango.js",
"frontend/js/shell/browser.js", "frontend/js/shell/browser.js",
@ -186,6 +187,85 @@
"frontend/js/routers/router.js", "frontend/js/routers/router.js",
"clusterFrontend/js/routers/clusterRouter.js", "clusterFrontend/js/routers/clusterRouter.js",
"test/specs/graphViewer/specColourMapper/colourMapperSpec.js",
"test/specs/graphViewer/specWindowObjects/domObserverFactorySpec.js",
"test/specs/graphViewer/specCommunityNode/communityNodeSpec.js",
"test/specs/graphViewer/specAdapter/interfaceSpec.js",
"test/specs/graphViewer/specAdapter/abstractAdapterSpec.js",
"test/specs/graphViewer/specAdapter/jsonAdapterSpec.js",
"test/specs/graphViewer/specAdapter/arangoAdapterSpec.js",
"test/specs/graphViewer/specAdapter/gharialAdapterSpec.js",
"test/specs/graphViewer/specAdapter/foxxAdapterSpec.js",
"test/specs/graphViewer/specAdapter/previewAdapterSpec.js",
"test/specs/graphViewer/specAdapter/arangoAdapterUISpec.js",
"test/specs/graphViewer/specAdapter/gharialAdapterUISpec.js",
"test/specs/graphViewer/specNodeShaper/nodeShaperSpec.js",
"test/specs/graphViewer/specNodeShaper/nodeShaperUISpec.js",
"test/specs/graphViewer/specEdgeShaper/edgeShaperSpec.js",
"test/specs/graphViewer/specEdgeShaper/edgeShaperUISpec.js",
"test/specs/graphViewer/specForceLayouter/forceLayouterSpec.js",
"test/specs/graphViewer/specForceLayouter/forceLayouterUISpec.js",
"test/specs/graphViewer/specEvents/eventLibrarySpec.js",
"test/specs/graphViewer/specEvents/eventDispatcherSpec.js",
"test/specs/graphViewer/specEvents/eventDispatcherUISpec.js",
"test/specs/graphViewer/specZoomManager/zoomManagerSpec.js",
"test/specs/graphViewer/specGraphViewer/graphViewerSpec.js",
"test/specs/graphViewer/specGraphViewer/graphViewerUISpec.js",
"test/specs/graphViewer/specGraphViewer/graphViewerWidgetSpec.js",
"test/specs/graphViewer/specGraphViewer/graphViewerPreviewSpec.js",
"test/specs/graphViewer/specNodeReducer/nodeReducerSpec.js",
"test/specs/graphViewer/specNodeReducer/modularityJoinerSpec.js",
"test/specs/graphViewer/specContextMenu/contextMenuSpec.js",
"test/specs/arango/arangoSpec.js",
"test/specs/models/currentDatabaseSpec.js",
"test/specs/models/clusterPlanSpec.js",
"test/specs/models/graphSpec.js",
"test/specs/models/arangoCollectionModelSpec.js",
"test/specs/models/arangoDatabaseSpec.js",
"test/specs/models/arangoDocumentSpec.js",
"test/specs/models/arangoLogModelSpec.js",
"test/specs/models/arangoStatisticsDescriptionSpec.js",
"test/specs/models/arangoStatisticsSpec.js",
"test/specs/models/arangoUsersSpec.js",
"test/specs/models/foxxSpec.js",
"test/specs/models/clusterCoordinatorSpec.js",
"test/specs/config/dygraphConfigSpec.js",
"test/specs/collections/clusterServersSpec.js",
"test/specs/collections/clusterDatabasesSpec.js",
"test/specs/collections/clusterCollectionsSpec.js",
"test/specs/collections/clusterCoordinatorsSpec.js",
"test/specs/collections/clusterShardsSpec.js",
"test/specs/collections/arangoCollectionsSpec.js",
"test/specs/collections/arangoDatabaseSpec.js",
"test/specs/collections/arangoDocumentSpec.js",
"test/specs/collections/arangoDocumentsSpec.js",
"test/specs/collections/arangoLogsSpec.js",
"test/specs/collections/arangoReplicationSpec.js",
"test/specs/collections/arangoStatisticsCollectionSpec.js",
"test/specs/collections/arangoStatisticsDescriptionCollectionSpec.js",
"test/specs/collections/arangoUsersSpec.js",
"test/specs/collections/foxxCollectionSpec.js",
"test/specs/collections/graphCollectionSpec.js",
"test/specs/collections/notificationCollectionSpec.js",
"test/specs/collections/ClusterStatisticsCollectionSpec.js",
"test/specs/views/apiViewSpec.js",
"test/specs/views/applicationsViewSpec.js",
"test/specs/views/appDocumentationViewSpec.js",
"test/specs/views/modalViewSpec.js",
"test/specs/views/editListEntryViewSpec.js",
"test/specs/views/collectionsViewSpec.js",
"test/specs/views/collectionsItemViewSpec.js",
"test/specs/views/dbSelectionViewSpec.js",
"test/specs/views/navigationViewSpec.js",
"test/specs/views/loginViewSpec.js",
"test/specs/views/userBarViewSpec.js",
"test/specs/views/documentsViewSpec.js",
"test/specs/views/documentViewSpec.js",
"test/specs/views/dashboardViewSpec.js", "test/specs/views/dashboardViewSpec.js",
"test/specs/views/graphManagementViewSpec.js", "test/specs/views/graphManagementViewSpec.js",
"test/specs/views/newLogsViewSpec.js", "test/specs/views/newLogsViewSpec.js",

View File

@ -45,7 +45,7 @@ module.exports = function(karma) {
// enable / disable watching file and executing tests whenever any file changes // enable / disable watching file and executing tests whenever any file changes
autoWatch: false, autoWatch: true,
// Start these browsers, currently available: // Start these browsers, currently available:
@ -64,6 +64,6 @@ module.exports = function(karma) {
// Continuous Integration mode // Continuous Integration mode
// if true, it capture browsers, run tests and exit // if true, it capture browsers, run tests and exit
singleRun: true singleRun: false
}); });
}; };

View File

@ -694,11 +694,13 @@
target: "xyz" target: "xyz"
}; };
spyOn(view, "mergeHistory"); spyOn(view, "mergeHistory");
spyOn(view, "updateTendencies");
spyOn(view, "updateLineChart");
spyOn($, "ajax").andCallFake(function (url, opt) { spyOn($, "ajax").andCallFake(function (url, opt) {
expect(url).toEqual( expect(url).toEqual(
"abcde/_admin/aardvark/statistics/cluster?start=10000&type=short&DBserver=xyz" "abcde/_admin/aardvark/statistics/cluster?start=10000&type=short&DBserver=xyz"
); );
expect(opt.async).toEqual(false); expect(opt.async).toEqual(true);
return { return {
done: function (y) { done: function (y) {
y({ y({
@ -712,8 +714,11 @@
expect(view.mergeHistory).toHaveBeenCalledWith({ expect(view.mergeHistory).toHaveBeenCalledWith({
times: [1, 2, 3] times: [1, 2, 3]
}); });
expect(view.updateTendencies).toHaveBeenCalled();
expect(view.isUpdating).toEqual(true); expect(view.isUpdating).toEqual(true);
Object.keys(view.graphs).forEach(function (f) {
expect(view.updateLineChart).toHaveBeenCalledWith(f, false);
});
}); });
it("prepare D3Charts", function () { it("prepare D3Charts", function () {
@ -1166,7 +1171,6 @@
it("startUpdating with no timer and statistics updates", function () { it("startUpdating with no timer and statistics updates", function () {
spyOn(view, "getStatistics"); spyOn(view, "getStatistics");
spyOn(view, "updateCharts");
view.isUpdating = true; view.isUpdating = true;
spyOn(window, "setInterval").andCallFake( spyOn(window, "setInterval").andCallFake(
function (a) { function (a) {
@ -1176,7 +1180,6 @@
view.startUpdating(); view.startUpdating();
expect(window.setInterval).toHaveBeenCalled(); expect(window.setInterval).toHaveBeenCalled();
expect(view.getStatistics).toHaveBeenCalled(); expect(view.getStatistics).toHaveBeenCalled();
expect(view.updateCharts).toHaveBeenCalled();
}); });
@ -1282,7 +1285,9 @@
} }
}; };
spyOn(view, "startUpdating"); spyOn(view, "startUpdating");
spyOn(view, "getStatistics"); spyOn(view, "getStatistics").andCallFake(function(cb) {
cb();
});
spyOn(view, "prepareDygraphs"); spyOn(view, "prepareDygraphs");
spyOn(view, "prepareD3Charts"); spyOn(view, "prepareD3Charts");
@ -1317,7 +1322,9 @@
} }
}; };
spyOn(view, "startUpdating"); spyOn(view, "startUpdating");
spyOn(view, "getStatistics"); spyOn(view, "getStatistics").andCallFake(function(cb) {
cb();
});
spyOn(view, "prepareDygraphs"); spyOn(view, "prepareDygraphs");
spyOn(view, "prepareD3Charts"); spyOn(view, "prepareD3Charts");

View File

@ -60,9 +60,47 @@
div.id = "content"; div.id = "content";
document.body.appendChild(div); document.body.appendChild(div);
queryCollection = { queryCollection = {
fetch: function() {} __content: [],
}; fetch: function() {},
findWhere: function(ex) {
var i, k, found;
for (i = 0; i < this.__content.length; ++i) {
found = true;
for (k in ex) {
if (!ex.hasOwnProperty(k) || !this.__content[i].hasOwnProperty(k) || ex[k] !== this.__content[i][k]) {
found = false;
}
}
if (found) {
return this.__content[i];
}
}
},
each: function(func) {
return this.__content.forEach(func);
},
some: function(func) {
var res = false, i;
for (i = 0; i < this.__content.length; ++i) {
res = res || func(this.__content[i]);
}
return res;
},
remove: function(obj) {
var i;
for (i = 0; i < this.__content.length; ++i) {
if(this.__content[i] === obj) {
this.__content.splice(i, 1);
return;
}
}
},
add: function(item) {
this.__content.push(new DummyModel(item));
},
saveCollectionQueries: function() {}
};
view = new window.queryView({ view = new window.queryView({
collection: queryCollection, collection: queryCollection,
@ -334,12 +372,8 @@
spyOn(view, "renderSelectboxes"); spyOn(view, "renderSelectboxes");
spyOn(view, "updateTable"); spyOn(view, "updateTable");
spyOn(localStorage, "setItem");
view.deleteAQL(e); view.deleteAQL(e);
expect(localStorage.setItem).toHaveBeenCalledWith(
"customQueries", JSON.stringify(view.customQueries)
);
expect(view.renderSelectboxes).toHaveBeenCalled(); expect(view.renderSelectboxes).toHaveBeenCalled();
expect(view.updateTable).toHaveBeenCalled(); expect(view.updateTable).toHaveBeenCalled();
}); });
@ -362,13 +396,13 @@
spyOn(e, "stopPropagation"); spyOn(e, "stopPropagation");
spyOn(window.modalView, "hide"); spyOn(window.modalView, "hide");
spyOn(localStorage, "setItem");
spyOn(view, "renderSelectboxes"); spyOn(view, "renderSelectboxes");
spyOn(queryCollection, "add");
view.saveAQL(e); view.saveAQL(e);
expect(e.stopPropagation).toHaveBeenCalled(); expect(e.stopPropagation).toHaveBeenCalled();
expect(localStorage.setItem).toHaveBeenCalled(); expect(queryCollection.add).toHaveBeenCalled();
expect(view.renderSelectboxes).toHaveBeenCalled(); expect(view.renderSelectboxes).toHaveBeenCalled();
expect(window.modalView.hide).toHaveBeenCalled(); expect(window.modalView.hide).toHaveBeenCalled();
document.body.removeChild(div2); document.body.removeChild(div2);
@ -416,7 +450,7 @@
throw "Should be a spy"; throw "Should be a spy";
} }
}; };
localStorageFake = JSON.stringify(customQueries); localStorageFake.value = JSON.stringify(customQueries);
view.initialize(); view.initialize();
div2 = document.createElement("div"); div2 = document.createElement("div");
@ -448,7 +482,7 @@
throw "Should be a spy"; throw "Should be a spy";
} }
}; };
localStorageFake = JSON.stringify(customQueries); localStorageFake.value = JSON.stringify(customQueries);
view.initialize(); view.initialize();
div2 = document.createElement("div"); div2 = document.createElement("div");
@ -458,13 +492,13 @@
spyOn(e, "stopPropagation"); spyOn(e, "stopPropagation");
spyOn(window.modalView, "hide"); spyOn(window.modalView, "hide");
spyOn(localStorage, "setItem");
spyOn(view, "renderSelectboxes"); spyOn(view, "renderSelectboxes");
spyOn(queryCollection, "add");
view.saveAQL(e); view.saveAQL(e);
expect(e.stopPropagation).toHaveBeenCalled(); expect(e.stopPropagation).toHaveBeenCalled();
expect(localStorage.setItem).not.toHaveBeenCalled(); expect(queryCollection.add).not.toHaveBeenCalled();
expect(view.renderSelectboxes).not.toHaveBeenCalled(); expect(view.renderSelectboxes).not.toHaveBeenCalled();
expect(window.modalView.hide).toHaveBeenCalled(); expect(window.modalView.hide).toHaveBeenCalled();
document.body.removeChild(div2); document.body.removeChild(div2);
@ -476,7 +510,7 @@
value: "for var yx do something" value: "for var yx do something"
}], }],
returnValue; returnValue;
localStorageFake = JSON.stringify(customQueries); localStorageFake.value = JSON.stringify(customQueries);
view.initialize(); view.initialize();
returnValue = view.getCustomQueryValueByName("hallotest"); returnValue = view.getCustomQueryValueByName("hallotest");
@ -488,31 +522,26 @@
div2.id = "test123"; div2.id = "test123";
document.body.appendChild(div2); document.body.appendChild(div2);
localStorageFake = 5000; localStorageFake.value = 5000;
view.initialize(); view.initialize();
spyOn(localStorage, "getItem");
view.render(); view.render();
expect(localStorage.getItem).toHaveBeenCalledWith("querySize"); expect(localStorage.getItem).toHaveBeenCalledWith("customQueries");
document.body.removeChild(div2); document.body.removeChild(div2);
}); });
it("should change the query size", function() {
var e = {
currentTarget: {
id: "test123"
}
};
spyOn(localStorage, "setItem");
view.changeSize(e);
expect(localStorage.setItem).toHaveBeenCalled();
});
it("submit a query and fail without a msg from server", function() { it("submit a query and fail without a msg from server", function() {
// not finished yet // not finished yet
spyOn(view, "deselect"); spyOn(view, "deselect");
var old = window.progressView;
window.progressView = {
show: function() {}
};
spyOn(window.progressView, "show");
view.submitQuery(); view.submitQuery();
expect(view.deselect).toHaveBeenCalled(); expect(view.deselect).toHaveBeenCalled();
expect(window.progressView.show).toHaveBeenCalled();
window.progressView = old;
}); });
it("should just run basic functionality of ace editor", function() { it("should just run basic functionality of ace editor", function() {
@ -535,7 +564,7 @@
} }
}; };
$('#findme').val('findme'); $('#findme').val('findme');
localStorageFake = JSON.stringify(customQueries); localStorageFake.value = JSON.stringify(customQueries);
view.initialize(); view.initialize();
view.importSelected(e); view.importSelected(e);
@ -586,14 +615,14 @@
view.customQueries = customQueries; view.customQueries = customQueries;
spyOn(view, "sortQueries"); spyOn(view, "sortQueries");
spyOn(arangoHelper, "escapeHtml"); spyOn(_, "escape");
view.renderSelectboxes(); view.renderSelectboxes();
expect(view.sortQueries).toHaveBeenCalled(); expect(view.sortQueries).toHaveBeenCalled();
expect(jQueryDummy.empty).toHaveBeenCalled(); expect(jQueryDummy.empty).toHaveBeenCalled();
expect(jQueryDummy.append).toHaveBeenCalled(); expect(jQueryDummy.append).toHaveBeenCalled();
expect(arangoHelper.escapeHtml).toHaveBeenCalled(); expect(_.escape).toHaveBeenCalled();
}); });

View File

@ -44,26 +44,31 @@
spyOn(view.template, "render").andReturn(1); spyOn(view.template, "render").andReturn(1);
spyOn(view, "replaceSVG");
spyOn($.fn, "html"); spyOn($.fn, "html");
spyOn($.fn, "find").andCallThrough(); spyOn($.fn, "find").andCallThrough();
spyOn($.fn, "attr").andCallThrough(); spyOn($.fn, "attr").andCallThrough();
spyOn($.fn, "each").andCallFake(function (a) { spyOn($.fn, "each").andCallFake(function (a) {
a(); a();
}); });
spyOn($, "get").andCallFake(function (a, b, c) { spyOn($, "get").andCallFake(function (a, b, c) {
b(); b();
}); });
view.render(); view.render();
expect($.fn.html).toHaveBeenCalledWith(1); expect($.fn.html).toHaveBeenCalledWith(1);
expect($.fn.find).toHaveBeenCalledWith('svg'); expect($.fn.find).toHaveBeenCalledWith('img.svg');
expect(view.replaceSVG).toHaveBeenCalled();
/*
expect($.fn.attr).toHaveBeenCalledWith('id'); expect($.fn.attr).toHaveBeenCalledWith('id');
expect($.fn.attr).toHaveBeenCalledWith('class'); expect($.fn.attr).toHaveBeenCalledWith('class');
expect($.fn.attr).toHaveBeenCalledWith('src'); expect($.fn.attr).toHaveBeenCalledWith('src');
*/
expect(view.template.render).toHaveBeenCalledWith({ expect(view.template.render).toHaveBeenCalledWith({
isSystem: true isSystem: true
}); });
}); });
it("should navigateBySelect", function () { it("should navigateBySelect", function () {

View File

@ -43,19 +43,17 @@ var colName = "perf_" + ruleName.replace(/-/g, "_");
var theCollection; var theCollection;
var dbdApi = function (query, plan, bindVars) { var dbdApi = function (query, plan, bindVars) {
db._query(query, bindVars); db._query(query, bindVars).toArray();
return {}; return {};
}; };
var setUp = function (options) { var setUp = function (options) {
var loopto = options.dbcols; var loopto = options.dbcols;
var contentmultipy = options.contentmultiply; var contentmultiply = options.contentmultiply;
var Content = Array(contentmultiply).join('abcdefghijklmnopqrstuvwxyz')
var Content = [];
for (j = 0; j < contentmultipy; j ++ ) {
Content = Content.concat(['abcdefghijklmnopqrstuvwxyz']);
}
internal.db._drop(colName); internal.db._drop(colName);
theCollection = internal.db._create(colName); theCollection = internal.db._create(colName);
var i, j; var i, j;
@ -75,6 +73,7 @@ var setUp = function (options) {
var tearDown = function () { var tearDown = function () {
internal.db._drop(colName); internal.db._drop(colName);
require("internal").wait(0);
theCollection = null; theCollection = null;
}; };
@ -103,6 +102,15 @@ var testNonIndexedPartialRead = function (testParams, testMethodStr, testMethod,
return testMethod.executeQuery(query, {}, {}); return testMethod.executeQuery(query, {}, {});
}; };
////////////////////////////////////////////////////////////////////////////////
/// @brief Testcase: dump 10% of a table without using an index
////////////////////////////////////////////////////////////////////////////////
var testNonIndexedPartialReadCalcJS = function (testParams, testMethodStr, testMethod, runOptions) {
var tenPercent = (runOptions.dbcols / 10) * 9;
var query = "FOR i IN " + colName + " FILTER i.Key + 1 > " + tenPercent + " RETURN i";
return testMethod.executeQuery(query, {}, {});
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief Testcase: dump a full table sorted by an unindexed key. /// @brief Testcase: dump a full table sorted by an unindexed key.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -119,6 +127,33 @@ var testIndexedFullSort = function (testParams, testMethodStr, testMethod) {
return testMethod.executeQuery(query, {}, {}); return testMethod.executeQuery(query, {}, {});
}; };
////////////////////////////////////////////////////////////////////////////////
/// @brief Testcase: dump a full table sorted by an indexed key.
////////////////////////////////////////////////////////////////////////////////
var testIndexedFullSortReverse = function (testParams, testMethodStr, testMethod) {
var query = "FOR i IN " + colName + " SORT i.indexedKey DESC RETURN i";
return testMethod.executeQuery(query, {}, {});
};
////////////////////////////////////////////////////////////////////////////////
/// @brief Testcase: dump a full table sorted by an indexed key - use filter
/// so the old also has
////////////////////////////////////////////////////////////////////////////////
var testIndexedFullSortFilter = function (testParams, testMethodStr, testMethod) {
var query = "FOR i IN " + colName + " FILTER i.indexedKey > 0 SORT i.indexedKey RETURN i";
return testMethod.executeQuery(query, {}, {});
};
////////////////////////////////////////////////////////////////////////////////
/// @brief Testcase: dump a full table sorted by an indexed key - use filter
/// so the old also has
////////////////////////////////////////////////////////////////////////////////
var testIndexedFullSortReverseFilter = function (testParams, testMethodStr, testMethod) {
var query = "FOR i IN " + colName + " FILTER i.indexedKey > 0 SORT i.indexedKey DESC RETURN i";
return testMethod.executeQuery(query, {}, {});
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief Simple join testsuite /// @brief Simple join testsuite
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -126,12 +161,20 @@ var testIndexedFullSort = function (testParams, testMethodStr, testMethod) {
var testSuite = [ var testSuite = [
{ name: "setup", setUp: setUp, teardown: null, params: null, func: null}, { name: "setup", setUp: setUp, teardown: null, params: null, func: null},
{ name: "testFullRead", func: testFullRead}, { name: "testFullRead", func: testFullRead},
{ name: "testNonIndexedPartialRead", func: testNonIndexedPartialRead}, { name: "testNonIndexedPartialRead", func: testNonIndexedPartialRead},
{ name: "testNonIndexedPartialReadCalcJS", func: testNonIndexedPartialReadCalcJS},
{ name: "testNonIndexedFullSort", func: testNonIndexedFullSort}, { name: "testNonIndexedFullSort", func: testNonIndexedFullSort},
{ name: "testIndexedFullSort", func: testIndexedFullSort}, { name: "testIndexedFullSort", func: testIndexedFullSort},
{ name: "testIndexedFullSortReverse", func: testIndexedFullSortReverse},
{ name: "testIndexedFullSortFilter", func: testIndexedFullSortFilter},
{ name: "testIndexedFullSortReverseFilter", func: testIndexedFullSortReverseFilter},
{ name: "teardown", setUp: null, teardown: tearDown, params: null, func: null} { name: "teardown", setUp: null, teardown: tearDown, params: null, func: null}
]; ];
@ -141,8 +184,8 @@ var testSuite = [
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
var k, l; var k, l;
for (k = 4; k < 10; k++) { for (k = 1; k < 22; k+=5) {
for (l = 4; l < 10; l++) { for (l = 1; l < 22; l+=5) {
var testOptions = { var testOptions = {
enableIndex: true, enableIndex: true,
dbcols: 10000 * k, dbcols: 10000 * k,