diff --git a/Documentation/Books/Users/Installing/Windows.mdpp b/Documentation/Books/Users/Installing/Windows.mdpp index fb835b06a1..d0d7280a6e 100644 --- a/Documentation/Books/Users/Installing/Windows.mdpp +++ b/Documentation/Books/Users/Installing/Windows.mdpp @@ -2,7 +2,7 @@ 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 -that ArangoDB has been installed in the location **. +that ArangoDB has been installed in the location *<ROOTDIR>*. 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 @@ -10,17 +10,17 @@ server process. In the latter case the database directory and the Foxx directory has to be writable by the user. Installing for a single user: Select a different directory during -installation. For example *C:/Users//arangodb* or *C:/ArangoDB*. +installation. For example *c:\Users\<Username>\ArangoDB* or *c:\ArangoDB*. Installing for multiple users: Keep the default directory. After the -installation edit the file */etc/arangodb/arangod.conf*. Adjust the +installation edit the file *<ROOTDIR>\etc\Arangodb\arangod.conf*. Adjust the *directory* and *app-path* so that these paths point into your home directory. [database] - directory = @HOMEDRIVE@/@HOMEPATH@/arangodb/databases + directory = @HOMEDRIVE@\@HOMEPATH@\arangodb\databases [javascript] - app-path = @HOMEDRIVE@/@HOMEPATH@/arangodb/apps + app-path = @HOMEDRIVE@\@HOMEPATH@\arangodb\apps 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 administrator*). - cmd> arangod --install-service + cmd> arangod --install-service 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' Open the service manager and start ArangoDB. In order to enable logging - edit the file "/etc/arangodb/arangod.conf" and uncomment the file + edit the file "\etc\arangodb\arangod.conf" and uncomment the file option. [log] - file = @ROOTDIR@/var/log/arangodb/arangod.log + file = @ROOTDIR@\var\log\arangodb\arangod.log !SUBSECTION Client, Server and Lock-Files @@ -51,9 +51,9 @@ not proceed correctly or if the server terminated unexpectedly. !SUBSECTION Starting To start an ArangoDB server instance with networking enabled, use the executable -*arangod.exe* located in */bin*. This will use the configuration -file *arangod.conf* located in */etc/arangodb*, which you can adjust -to your needs and use the data directory */var/lib/arangodb*. This +*arangod.exe* located in *<ROOTDIR>\bin*. This will use the configuration +file *arangod.conf* located in *<ROOTDIR>\etc\arangodb*, which you can adjust +to your needs and use the data directory *<ROOTDIR>\var\lib\arangodb*. This is the place where all your data (databases and collections) will be stored by default. @@ -85,7 +85,7 @@ containing the configuration files. !SUBSECTION Using the Client To connect to an already running ArangoDB server instance, there is a shell -*arangosh.exe* located in */bin*. This starts a shell which can be +*arangosh.exe* located in *<ROOTDIR>\bin*. This starts a shell which can be used – amongst other things – to administer and query a local or remote 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. *arangosh.exe* uses configuration from the file *arangosh.conf* located in -*/etc/arangodb/*. Please adjust this to your needs if you want to +*<ROOTDIR>\etc\arangodb\*. Please adjust this to your needs if you want to use different connection settings etc. !SUBSECTION 32bit @@ -121,9 +121,9 @@ completed successfully. 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 -files created by the Arango server will remain as well as the ** +files created by the Arango server will remain as well as the *<ROOTDIR>* directory. To complete the uninstallation process, remove the data files and -the ** directory manually. +the *<ROOTDIR>* directory manually. !SUBSECTION Limitations for Cygwin diff --git a/js/apps/system/aardvark/aardvark.js b/js/apps/system/aardvark/aardvark.js index 9535b8bf69..cee40cf5e6 100644 --- a/js/apps/system/aardvark/aardvark.js +++ b/js/apps/system/aardvark/aardvark.js @@ -40,6 +40,9 @@ var FoxxController = require("org/arangodb/foxx").Controller, foxxInstallKey = joi.string().required().description( "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(); 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), - key = req.params("key"), - path = req.protocol + "://" + req.headers.host + - "/_db/" + encodeURIComponent(req.database) + subPath + "/" + encodeURIComponent(key) + "/"; - res.json(docus.listOne(path, key)); -}).summary("List documentation of one foxxes.") + mount = req.params("mount"), + path = req.protocol + "://" + req.headers.host + "/_db/" + encodeURIComponent(req.database) + subPath + "/" + encodeURIComponent(mount) + "/"; + require("console").log(docus.listOne(path, mount)); + res.json(docus.listOne(path, mount)); +}).pathParam("mount", { + type: foxxMountPoint, + allowMultiple: false +}).summary("List documentation of all foxxes.") .notes("This function simply returns one specific" + " 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 * */ -controller.get('/docu/:key/*', function(req, res) { - var mountPoint = ""; - underscore.each(req.suffix, function(part) { - mountPoint += "/" + part; - }); +controller.get('/docu/:mount/:mountPoint', function(req, res) { + require("console").log("Blub"); + require("console").log(req.params("mount")); + var mountPoint = decodeURIComponent(req.params("mountPoint")); + require("console").log(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") .notes("This function lists the API of the foxx" + " running under the given mount point"); diff --git a/js/apps/system/aardvark/frontend/js/routers/router.js b/js/apps/system/aardvark/frontend/js/routers/router.js index 92fe915bd9..d9f30a820b 100644 --- a/js/apps/system/aardvark/frontend/js/routers/router.js +++ b/js/apps/system/aardvark/frontend/js/routers/router.js @@ -19,7 +19,7 @@ "api": "api", "databases": "databases", "applications": "applications", - "application/documentation/:key": "appDocumentation", + "application/documentation/:mount": "appDocumentation", "graph": "graphManagement", "userManagement": "userManagement", "userProfile": "userProfile", @@ -242,8 +242,8 @@ this.naviView.selectMenuItem('applications-menu'); }, - appDocumentation: function (key) { - var docuView = new window.AppDocumentationView({key: key}); + appDocumentation: function (mount) { + var docuView = new window.AppDocumentationView({mount: mount}); docuView.render(); this.naviView.selectMenuItem('applications-menu'); }, diff --git a/js/apps/system/aardvark/frontend/js/views/appDocumentationView.js b/js/apps/system/aardvark/frontend/js/views/appDocumentationView.js index 452cc69f84..50e0983f6e 100644 --- a/js/apps/system/aardvark/frontend/js/views/appDocumentationView.js +++ b/js/apps/system/aardvark/frontend/js/views/appDocumentationView.js @@ -13,7 +13,7 @@ initialize: function() { 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({ discoveryUrl: url, apiKey: false, diff --git a/js/apps/system/aardvark/frontend/js/views/dashboardView.js b/js/apps/system/aardvark/frontend/js/views/dashboardView.js index 77bc99c23c..39fadaae6d 100644 --- a/js/apps/system/aardvark/frontend/js/views/dashboardView.js +++ b/js/apps/system/aardvark/frontend/js/views/dashboardView.js @@ -665,12 +665,12 @@ this.isUpdating = false; }, - startUpdating: function () { - var self = this; - if (self.timer) { - return; - } - self.timer = window.setInterval(function () { + startUpdating: function () { + var self = this; + if (self.timer) { + return; + } + self.timer = window.setInterval(function () { self.getStatistics(); }, self.interval diff --git a/js/apps/system/aardvark/frontend/js/views/foxxActiveView.js b/js/apps/system/aardvark/frontend/js/views/foxxActiveView.js index ede5b41533..3ef097bcde 100644 --- a/js/apps/system/aardvark/frontend/js/views/foxxActiveView.js +++ b/js/apps/system/aardvark/frontend/js/views/foxxActiveView.js @@ -208,7 +208,7 @@ showDocu: function(event) { event.stopPropagation(); window.App.navigate( - "application/documentation/" + encodeURIComponent(this.model.get("_key")), + "application/documentation/" + encodeURIComponent(this.model.get("mount").substr(1)), { trigger: true } diff --git a/js/apps/system/aardvark/frontend/js/views/queryView.js b/js/apps/system/aardvark/frontend/js/views/queryView.js index 2edae8b6eb..a189940e0a 100644 --- a/js/apps/system/aardvark/frontend/js/views/queryView.js +++ b/js/apps/system/aardvark/frontend/js/views/queryView.js @@ -119,24 +119,18 @@ //check for invalid query names, if present change the box-shadow to red // and disable the save functionality - var boolTemp = false; - this.customQueries.some(function(query){ - 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; - } + var found = this.customQueries.some(function(query){ + return query.name === saveName; }); + 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 () { @@ -372,9 +366,9 @@ }); //old storage method - if (localStorage.getItem("customQueries")) { - - var queries = JSON.parse(localStorage.getItem("customQueries")); + var item = localStorage.getItem("customQueries"); + if (item) { + var queries = JSON.parse(item); //save queries in user collections extra attribute _.each(queries, function(oldQuery) { self.collection.add({ diff --git a/js/apps/system/aardvark/frontend/js/views/statisticBarView.js b/js/apps/system/aardvark/frontend/js/views/statisticBarView.js index 187177208a..5750ce42cf 100644 --- a/js/apps/system/aardvark/frontend/js/views/statisticBarView.js +++ b/js/apps/system/aardvark/frontend/js/views/statisticBarView.js @@ -2,92 +2,95 @@ /*jshint unused: false */ /*global Backbone, templateEngine, $, window*/ (function () { - "use strict"; - window.StatisticBarView = Backbone.View.extend({ - el: '#statisticBar', + "use strict"; + window.StatisticBarView = Backbone.View.extend({ + el: '#statisticBar', - events: { - "change #arangoCollectionSelect": "navigateBySelect", - "click .tab": "navigateByTab" - }, + events: { + "change #arangoCollectionSelect": "navigateBySelect", + "click .tab": "navigateByTab" + }, - template: templateEngine.createTemplate("statisticBarView.ejs"), + template: templateEngine.createTemplate("statisticBarView.ejs"), - initialize : function () { - this.currentDB = this.options.currentDB; - }, + initialize : function () { + this.currentDB = this.options.currentDB; + }, - render: function () { - $(this.el).html(this.template.render({ - isSystem: this.currentDB.get("isSystem") - })); + replaceSVG: function($img) { + var imgID = $img.attr('id'); + var imgClass = $img.attr('class'); + var imgURL = $img.attr('src'); - $('img.svg').each(function(){ - var $img = $(this); - var imgID = $img.attr('id'); - var imgClass = $img.attr('class'); - var imgURL = $img.attr('src'); + $.get(imgURL, function(data) { + // Get the SVG tag, ignore the rest + var $svg = $(data).find('svg'); - $.get(imgURL, function(data) { - // Get the SVG tag, ignore the rest - var $svg = $(data).find('svg'); - - // Add replaced image's ID to the new SVG - if(imgID === undefined) { - $svg = $svg.attr('id', imgID); - } - // 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'); - } + // Add replaced image's ID to the new SVG + if(imgID === undefined) { + $svg = $svg.attr('id', imgID); + } + // 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'); + }, + + 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'); + } + } + + }); }()); diff --git a/js/apps/system/aardvark/lib/swagger.js b/js/apps/system/aardvark/lib/swagger.js index f4a3ebeb13..121a9f5eaf 100644 --- a/js/apps/system/aardvark/lib/swagger.js +++ b/js/apps/system/aardvark/lib/swagger.js @@ -47,42 +47,35 @@ exports.Swagger = function () { result.swaggerVersion = "1.1"; result.basePath = basePath; result.apis = apis; + var m; while (res.hasNext()) { - var m = res.next().mount; - if (m === "/aardvark") { - - } else { + m = res.next().mount; + if (m !== "/aardvark") { apis.push({ path: m }); } } return result; - }, + }; - this.listOne = function(basePath, key) { - var result = {}, - res; - - if (key.substr(0, 4) === "dev:") { - res = "/dev/" + key.split(":")[2]; - } - else { - res = _aal.document(key).mount; - } + this.listOne = function(basePath, mount) { + var result = {}; result.swaggerVersion = "1.1"; result.basePath = basePath; result.apis = [ - {path: res} + {path: decodeURIComponent(mount)} ]; + require("console").log(result); return result; - }, + }; // Get details of one specific installed foxx. this.show = function(mount) { + require("console").log(mount); var result = {}, apis = [], pathes, @@ -109,18 +102,20 @@ exports.Swagger = function () { pathes = app.routes; for (i in pathes) { - if (pathes[i].url.methods !== undefined) { - url = pathes[i].url.match; - api = {}; - ops = []; - url = url.replace(regex, "{$2}"); - api.path = url; - ops.push(pathes[i].docs); - api.operations = ops; - apis.push(api); + if(pathes.hasOwnProperty(i)){ + if (pathes[i].url.methods !== undefined) { + url = pathes[i].url.match; + api = {}; + ops = []; + url = url.replace(regex, "{$2}"); + api.path = url; + ops.push(pathes[i].docs); + api.operations = ops; + apis.push(api); + } } } return result; - } + }; }; diff --git a/js/apps/system/aardvark/test/karma/files.json b/js/apps/system/aardvark/test/karma/files.json index 1b07aeea47..f570423ce4 100755 --- a/js/apps/system/aardvark/test/karma/files.json +++ b/js/apps/system/aardvark/test/karma/files.json @@ -32,6 +32,7 @@ "frontend/js/lib/swagger-ui.js", "frontend/js/lib/highlight.7.3.pack.js", "frontend/js/lib/joi.browser.js", + "frontend/js/lib/md5.js", "test/mocks/disableEJS.js", "frontend/js/arango/arango.js", "frontend/js/shell/browser.js", @@ -186,6 +187,85 @@ "frontend/js/routers/router.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/graphManagementViewSpec.js", "test/specs/views/newLogsViewSpec.js", diff --git a/js/apps/system/aardvark/test/karma/karma.conf.js b/js/apps/system/aardvark/test/karma/karma.conf.js index fe3af09da7..bc0f3b7d66 100644 --- a/js/apps/system/aardvark/test/karma/karma.conf.js +++ b/js/apps/system/aardvark/test/karma/karma.conf.js @@ -45,7 +45,7 @@ module.exports = function(karma) { // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, + autoWatch: true, // Start these browsers, currently available: @@ -64,6 +64,6 @@ module.exports = function(karma) { // Continuous Integration mode // if true, it capture browsers, run tests and exit - singleRun: true + singleRun: false }); }; diff --git a/js/apps/system/aardvark/test/specs/views/dashboardViewSpec.js b/js/apps/system/aardvark/test/specs/views/dashboardViewSpec.js index ea9b557359..959dea5713 100644 --- a/js/apps/system/aardvark/test/specs/views/dashboardViewSpec.js +++ b/js/apps/system/aardvark/test/specs/views/dashboardViewSpec.js @@ -694,11 +694,13 @@ target: "xyz" }; spyOn(view, "mergeHistory"); + spyOn(view, "updateTendencies"); + spyOn(view, "updateLineChart"); spyOn($, "ajax").andCallFake(function (url, opt) { expect(url).toEqual( "abcde/_admin/aardvark/statistics/cluster?start=10000&type=short&DBserver=xyz" ); - expect(opt.async).toEqual(false); + expect(opt.async).toEqual(true); return { done: function (y) { y({ @@ -712,8 +714,11 @@ expect(view.mergeHistory).toHaveBeenCalledWith({ times: [1, 2, 3] }); + expect(view.updateTendencies).toHaveBeenCalled(); expect(view.isUpdating).toEqual(true); - + Object.keys(view.graphs).forEach(function (f) { + expect(view.updateLineChart).toHaveBeenCalledWith(f, false); + }); }); it("prepare D3Charts", function () { @@ -1166,7 +1171,6 @@ it("startUpdating with no timer and statistics updates", function () { spyOn(view, "getStatistics"); - spyOn(view, "updateCharts"); view.isUpdating = true; spyOn(window, "setInterval").andCallFake( function (a) { @@ -1176,7 +1180,6 @@ view.startUpdating(); expect(window.setInterval).toHaveBeenCalled(); expect(view.getStatistics).toHaveBeenCalled(); - expect(view.updateCharts).toHaveBeenCalled(); }); @@ -1282,7 +1285,9 @@ } }; spyOn(view, "startUpdating"); - spyOn(view, "getStatistics"); + spyOn(view, "getStatistics").andCallFake(function(cb) { + cb(); + }); spyOn(view, "prepareDygraphs"); spyOn(view, "prepareD3Charts"); @@ -1317,7 +1322,9 @@ } }; spyOn(view, "startUpdating"); - spyOn(view, "getStatistics"); + spyOn(view, "getStatistics").andCallFake(function(cb) { + cb(); + }); spyOn(view, "prepareDygraphs"); spyOn(view, "prepareD3Charts"); diff --git a/js/apps/system/aardvark/test/specs/views/queryViewSpec.js b/js/apps/system/aardvark/test/specs/views/queryViewSpec.js index 64fc05a403..5d25503964 100644 --- a/js/apps/system/aardvark/test/specs/views/queryViewSpec.js +++ b/js/apps/system/aardvark/test/specs/views/queryViewSpec.js @@ -60,9 +60,47 @@ div.id = "content"; document.body.appendChild(div); - queryCollection = { - fetch: function() {} - }; + queryCollection = { + __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({ collection: queryCollection, @@ -334,12 +372,8 @@ spyOn(view, "renderSelectboxes"); spyOn(view, "updateTable"); - spyOn(localStorage, "setItem"); view.deleteAQL(e); - expect(localStorage.setItem).toHaveBeenCalledWith( - "customQueries", JSON.stringify(view.customQueries) - ); expect(view.renderSelectboxes).toHaveBeenCalled(); expect(view.updateTable).toHaveBeenCalled(); }); @@ -362,13 +396,13 @@ spyOn(e, "stopPropagation"); spyOn(window.modalView, "hide"); - spyOn(localStorage, "setItem"); spyOn(view, "renderSelectboxes"); + spyOn(queryCollection, "add"); view.saveAQL(e); expect(e.stopPropagation).toHaveBeenCalled(); - expect(localStorage.setItem).toHaveBeenCalled(); + expect(queryCollection.add).toHaveBeenCalled(); expect(view.renderSelectboxes).toHaveBeenCalled(); expect(window.modalView.hide).toHaveBeenCalled(); document.body.removeChild(div2); @@ -416,7 +450,7 @@ throw "Should be a spy"; } }; - localStorageFake = JSON.stringify(customQueries); + localStorageFake.value = JSON.stringify(customQueries); view.initialize(); div2 = document.createElement("div"); @@ -448,7 +482,7 @@ throw "Should be a spy"; } }; - localStorageFake = JSON.stringify(customQueries); + localStorageFake.value = JSON.stringify(customQueries); view.initialize(); div2 = document.createElement("div"); @@ -458,13 +492,13 @@ spyOn(e, "stopPropagation"); spyOn(window.modalView, "hide"); - spyOn(localStorage, "setItem"); spyOn(view, "renderSelectboxes"); + spyOn(queryCollection, "add"); view.saveAQL(e); expect(e.stopPropagation).toHaveBeenCalled(); - expect(localStorage.setItem).not.toHaveBeenCalled(); + expect(queryCollection.add).not.toHaveBeenCalled(); expect(view.renderSelectboxes).not.toHaveBeenCalled(); expect(window.modalView.hide).toHaveBeenCalled(); document.body.removeChild(div2); @@ -476,7 +510,7 @@ value: "for var yx do something" }], returnValue; - localStorageFake = JSON.stringify(customQueries); + localStorageFake.value = JSON.stringify(customQueries); view.initialize(); returnValue = view.getCustomQueryValueByName("hallotest"); @@ -488,31 +522,26 @@ div2.id = "test123"; document.body.appendChild(div2); - localStorageFake = 5000; + localStorageFake.value = 5000; view.initialize(); - spyOn(localStorage, "getItem"); view.render(); - expect(localStorage.getItem).toHaveBeenCalledWith("querySize"); + expect(localStorage.getItem).toHaveBeenCalledWith("customQueries"); 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() { // not finished yet spyOn(view, "deselect"); + var old = window.progressView; + window.progressView = { + show: function() {} + }; + spyOn(window.progressView, "show"); view.submitQuery(); expect(view.deselect).toHaveBeenCalled(); + expect(window.progressView.show).toHaveBeenCalled(); + window.progressView = old; }); it("should just run basic functionality of ace editor", function() { @@ -535,7 +564,7 @@ } }; $('#findme').val('findme'); - localStorageFake = JSON.stringify(customQueries); + localStorageFake.value = JSON.stringify(customQueries); view.initialize(); view.importSelected(e); @@ -586,14 +615,14 @@ view.customQueries = customQueries; spyOn(view, "sortQueries"); - spyOn(arangoHelper, "escapeHtml"); + spyOn(_, "escape"); view.renderSelectboxes(); expect(view.sortQueries).toHaveBeenCalled(); expect(jQueryDummy.empty).toHaveBeenCalled(); expect(jQueryDummy.append).toHaveBeenCalled(); - expect(arangoHelper.escapeHtml).toHaveBeenCalled(); + expect(_.escape).toHaveBeenCalled(); }); diff --git a/js/apps/system/aardvark/test/specs/views/statisticBarViewSpec.js b/js/apps/system/aardvark/test/specs/views/statisticBarViewSpec.js index c2ab706231..f4c0b393aa 100644 --- a/js/apps/system/aardvark/test/specs/views/statisticBarViewSpec.js +++ b/js/apps/system/aardvark/test/specs/views/statisticBarViewSpec.js @@ -44,26 +44,31 @@ spyOn(view.template, "render").andReturn(1); + spyOn(view, "replaceSVG"); spyOn($.fn, "html"); spyOn($.fn, "find").andCallThrough(); spyOn($.fn, "attr").andCallThrough(); spyOn($.fn, "each").andCallFake(function (a) { - a(); + a(); }); spyOn($, "get").andCallFake(function (a, b, c) { - b(); + b(); }); view.render(); 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('class'); expect($.fn.attr).toHaveBeenCalledWith('src'); + */ expect(view.template.render).toHaveBeenCalledWith({ isSystem: true }); + }); it("should navigateBySelect", function () { diff --git a/js/server/perftests/bigcollections.js b/js/server/perftests/bigcollections.js index 1b22ef8dac..839064b271 100644 --- a/js/server/perftests/bigcollections.js +++ b/js/server/perftests/bigcollections.js @@ -43,19 +43,17 @@ var colName = "perf_" + ruleName.replace(/-/g, "_"); var theCollection; var dbdApi = function (query, plan, bindVars) { - db._query(query, bindVars); + db._query(query, bindVars).toArray(); return {}; }; var setUp = function (options) { 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); theCollection = internal.db._create(colName); var i, j; @@ -75,6 +73,7 @@ var setUp = function (options) { var tearDown = function () { internal.db._drop(colName); + require("internal").wait(0); theCollection = null; }; @@ -103,6 +102,15 @@ var testNonIndexedPartialRead = function (testParams, testMethodStr, testMethod, 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. //////////////////////////////////////////////////////////////////////////////// @@ -119,6 +127,33 @@ var testIndexedFullSort = function (testParams, testMethodStr, testMethod) { 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 //////////////////////////////////////////////////////////////////////////////// @@ -126,12 +161,20 @@ var testIndexedFullSort = function (testParams, testMethodStr, testMethod) { var testSuite = [ { name: "setup", setUp: setUp, teardown: null, params: null, func: null}, - { name: "testFullRead", func: testFullRead}, + { name: "testNonIndexedPartialRead", func: testNonIndexedPartialRead}, + + { name: "testNonIndexedPartialReadCalcJS", func: testNonIndexedPartialReadCalcJS}, + { name: "testNonIndexedFullSort", func: testNonIndexedFullSort}, { 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} ]; @@ -141,8 +184,8 @@ var testSuite = [ //////////////////////////////////////////////////////////////////////////////// var k, l; -for (k = 4; k < 10; k++) { - for (l = 4; l < 10; l++) { +for (k = 1; k < 22; k+=5) { + for (l = 1; l < 22; l+=5) { var testOptions = { enableIndex: true, dbcols: 10000 * k,