diff --git a/arangod/RestHandler/RestDocumentHandler.cpp b/arangod/RestHandler/RestDocumentHandler.cpp index d2bdd43a61..ed3b012692 100644 --- a/arangod/RestHandler/RestDocumentHandler.cpp +++ b/arangod/RestHandler/RestDocumentHandler.cpp @@ -447,16 +447,18 @@ bool RestDocumentHandler::readDocument () { /// @RESTRETURNCODE{200} /// is returned if the document was found /// -/// @RESTRETURNCODE{404} -/// is returned if the document or collection was not found -/// /// @RESTRETURNCODE{304} /// is returned if the "If-None-Match" header is given and the document has /// the same version /// +/// @RESTRETURNCODE{404} +/// is returned if the document or collection was not found +/// /// @RESTRETURNCODE{412} /// is returned if a "If-Match" header or `rev` is given and the found -/// document has a different version +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. /// /// @EXAMPLES /// @@ -773,7 +775,9 @@ bool RestDocumentHandler::readAllDocuments () { /// /// @RESTRETURNCODE{412} /// is returned if a "If-Match" header or `rev` is given and the found -/// document has a different version +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. /// /// @EXAMPLES /// @@ -922,7 +926,9 @@ bool RestDocumentHandler::checkDocument () { /// /// @RESTRETURNCODE{412} /// is returned if a "If-Match" header or `rev` is given and the found -/// document has a different version +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. /// /// @EXAMPLES /// @@ -1114,7 +1120,9 @@ bool RestDocumentHandler::replaceDocument () { /// /// @RESTRETURNCODE{412} /// is returned if a "If-Match" header or `rev` is given and the found -/// document has a different version +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. /// /// @EXAMPLES /// @@ -1378,8 +1386,10 @@ bool RestDocumentHandler::modifyDocument (bool isPatch) { /// The response body contains an error document in this case. /// /// @RESTRETURNCODE{412} -/// is returned if a "If-Match" header or `rev` is given and the current -/// document has a different version +/// is returned if a "If-Match" header or `rev` is given and the found +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. /// /// @EXAMPLES /// diff --git a/arangod/RestHandler/RestEdgeHandler.cpp b/arangod/RestHandler/RestEdgeHandler.cpp index 6822bb443a..e98963bf69 100644 --- a/arangod/RestHandler/RestEdgeHandler.cpp +++ b/arangod/RestHandler/RestEdgeHandler.cpp @@ -357,16 +357,18 @@ bool RestEdgeHandler::createDocument () { /// @RESTRETURNCODE{200} /// is returned if the edge was found /// -/// @RESTRETURNCODE{404} -/// is returned if the edge or collection was not found -/// /// @RESTRETURNCODE{304} /// is returned if the "If-None-Match" header is given and the edge has /// the same version /// +/// @RESTRETURNCODE{404} +/// is returned if the edge or collection was not found +/// /// @RESTRETURNCODE{412} /// is returned if a "If-Match" header or `rev` is given and the found -/// edge has a different version +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -424,16 +426,18 @@ bool RestEdgeHandler::createDocument () { /// @RESTRETURNCODE{200} /// is returned if the edge document was found /// -/// @RESTRETURNCODE{404} -/// is returned if the edge document or collection was not found -/// /// @RESTRETURNCODE{304} /// is returned if the "If-None-Match" header is given and the edge document has /// same version /// +/// @RESTRETURNCODE{404} +/// is returned if the edge document or collection was not found +/// /// @RESTRETURNCODE{412} -/// is returned if a "If-Match" header or `rev` is given and the found edge -/// document has a different version +/// is returned if a "If-Match" header or `rev` is given and the found +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -555,8 +559,10 @@ bool RestEdgeHandler::createDocument () { /// is returned if the collection or the edge document was not found /// /// @RESTRETURNCODE{412} -/// is returned if a "If-Match" header or `rev` is given and the found edge -/// document has a different version +/// is returned if a "If-Match" header or `rev` is given and the found +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. /////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -655,8 +661,10 @@ bool RestEdgeHandler::createDocument () { /// is returned if the collection or the edge document was not found /// /// @RESTRETURNCODE{412} -/// is returned if a "If-Match" header or `rev` is given and the found edge -/// document has a different version +/// is returned if a "If-Match" header or `rev` is given and the found +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -716,8 +724,10 @@ bool RestEdgeHandler::createDocument () { /// The response body contains an error document in this case. /// /// @RESTRETURNCODE{412} -/// is returned if a "If-Match" header or `rev` is given and the current edge -/// document has a different version +/// is returned if a "If-Match" header or `rev` is given and the found +/// document has a different version. The response will also contain the found +/// document's current revision in the `_rev` attribute. Additionally, the +/// attributes `_id` and `_key` will be returned. //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// diff --git a/js/Makefile.files b/js/Makefile.files index d7d0c97ccb..75c0da5b6a 100644 --- a/js/Makefile.files +++ b/js/Makefile.files @@ -50,10 +50,13 @@ JAVASCRIPT_JSLINT = \ `find @srcdir@/js/common/modules/org -name "*.js"` \ `find @srcdir@/js/client/modules -name "*.js"` \ `find @srcdir@/js/server/modules -name "*.js"` \ + `find @srcdir@/js/client/tests -name "*.js"` \ `find @srcdir@/js/apps/system/aardvark/frontend/js/models -name "*.js"` \ `find @srcdir@/js/apps/system/aardvark/frontend/js/views -name "*.js"` \ `find @srcdir@/js/apps/system/aardvark/frontend/js/collections -name "*.js"` \ `find @srcdir@/js/apps/system/aardvark/frontend/js/routers -name "*.js"` \ + `find @srcdir@/js/apps/system/aardvark/frontend/js/arango -name "*.js"` \ + `find @srcdir@/js/apps/system/aardvark/frontend/js/shell -name "*.js"` \ \ @srcdir@/js/client/client.js \ @srcdir@/js/server/server.js \ diff --git a/js/apps/system/aardvark/frontend/js/arango/arango.js b/js/apps/system/aardvark/frontend/js/arango/arango.js index 9a8d40da4c..e85bad77c1 100644 --- a/js/apps/system/aardvark/frontend/js/arango/arango.js +++ b/js/apps/system/aardvark/frontend/js/arango/arango.js @@ -3,6 +3,40 @@ (function() { "use strict"; + window.versionHelper = { + fromString: function (s) { + var parts = s.replace(/-[a-zA-Z0-9_\-]*$/g, '').split('.'); + return { + major: parseInt(parts[0], 10) || 0, + minor: parseInt(parts[1], 10) || 0, + patch: parseInt(parts[2], 10) || 0 + }; + }, + toString: function (v) { + return v.major + '.' + v.minor + '.' + v.patch; + }, + toStringMainLine: function (v) { + return v.major + '.' + v.minor; + }, + compareVersions: function (l, r) { + if (l.major === r.major) { + if (l.minor === r.minor) { + if (l.patch === r.patch) { + return 0; + } + return l.patch - r.patch; + } + return l.minor - r.minor; + } + return l.major - r.major; + }, + compareVersionStrings: function (l, r) { + l = window.versionHelper.fromString(l); + r = window.versionHelper.fromString(r); + return window.versionHelper.compareVersions(l, r); + } + }; + window.arangoHelper = { lastNotificationMessage: null, @@ -71,12 +105,12 @@ $.gritter.removeAll(); this.lastNotificationMessage = null; }, - arangoNotification: function (message) { + arangoNotification: function (message, time) { var returnVal = false; $.gritter.add({ title: "Notice:", text: message, - time: 3000, + time: time || 3000, before_open: function(){ returnVal = true; } diff --git a/js/apps/system/aardvark/frontend/js/routers/router.js b/js/apps/system/aardvark/frontend/js/routers/router.js index 95dd10dc87..8a59e8c387 100644 --- a/js/apps/system/aardvark/frontend/js/routers/router.js +++ b/js/apps/system/aardvark/frontend/js/routers/router.js @@ -76,6 +76,8 @@ collection: window.arangoCollectionsStore }); + // this.initVersionCheck(); + var self = this; $(window).resize(function() { self.handleResize(); @@ -83,6 +85,97 @@ this.handleResize(); }, +/* + initVersionCheck: function () { + // this checks for version updates + + var self = this; + var versionCheck = function () { + $.ajax({ + async: true, + crossDomain: true, + dataType: "jsonp", + url: "https://www.arangodb.org/repositories/versions.php?callback=parseVersions", + success: function (json) { + if (typeof json !== 'object') { + return; + } + + // turn our own version string into a version object + var currentVersion = window.versionHelper.fromString(self.footerView.system.version); + + // get our mainline version + var mainLine = window.versionHelper.toStringMainLine(currentVersion); + + var mainLines = Object.keys(json).sort(window.versionHelper.compareVersionStrings); + var latestMainLine; + mainLines.forEach(function (l) { + if (json[l].stable) { + if (window.versionHelper.compareVersionStrings(l, mainLine) > 0) { + latestMainLine = json[l]; + } + } + }); + + var update; + + if (latestMainLine !== undefined && + Object.keys(latestMainLine.versions.length > 0) { + var mainLineVersions = Object.keys(latestMainLine.versions); + mainLineVersions = mainLineVersions.sort(window.versionHelper.compareVersionStrings); + var latest = mainLineVersions[mainLineVersions.length - 1]; + + update = { + type: "major", + version: latest, + changes: latestMainLine.versions[latest].changes + }; + } + + // check which stable mainline versions are available remotely + if (update === undefined && + json.hasOwnProperty(mainLine) && + json[mainLine].stable && + json[mainLine].hasOwnProperty("versions") && + Object.keys(json[mainLine].versions).length > 0) { + // sort by version numbers + var mainLineVersions = Object.keys(json[mainLine].versions); + mainLineVersions = mainLineVersions.sort(window.versionHelper.compareVersionStrings); + var latest = mainLineVersions[mainLineVersions.length - 1]; + + var result = window.versionHelper.compareVersions( + currentVersion, + window.versionHelper.fromString(latest) + ); + if (result < 0) { + update = { + type: "minor", + version: latest, + changes: json[mainLine].versions[latest].changes + }; + } + } + + if (update !== undefined) { + var msg = "A newer version of ArangoDB (" + update.version + + ") has become available. You may want to check the " + + "changelog at " + + update.changes + ""; + arangoHelper.arangoNotification(msg, 15000); + + } + }, + error: function () { + // re-schedule the version check + window.setTimeout(versionCheck, 60000); + } + }); + }; + + window.setTimeout(versionCheck, 5000); + }, +*/ + logsAllowed: function () { return (window.databaseName === '_system'); }, diff --git a/js/client/tests/client.js b/js/client/tests/client.js index 637938b062..92498c2efe 100644 --- a/js/client/tests/client.js +++ b/js/client/tests/client.js @@ -1,3 +1,8 @@ +/*jslint indent: 2, maxlen: 120, vars: true, white: true, plusplus: true, nonpropdel: true, nomen: true, sloppy: true */ +/*global require, assertEqual, assertNotEqual, + print, print_plain, COMPARE_STRING, NORMALIZE_STRING, + help, start_pager, stop_pager, start_pretty_print, stop_pretty_print, start_color_print, stop_color_print */ + //////////////////////////////////////////////////////////////////////////////// /// @brief tests for client-specific functionality /// @@ -25,6 +30,8 @@ /// @author Copyright 2012, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// +(function () { + var jsunity = require("jsunity"); var db = require("org/arangodb").db; @@ -153,8 +160,8 @@ function clientTestSuite () { //////////////////////////////////////////////////////////////////////////////// testICU_Compare : function () { - nfc = "Gr\u00FC\u00DF Gott."; - nfd = "Gru\u0308\u00DF Gott."; + var nfc = "Gr\u00FC\u00DF Gott."; + var nfd = "Gru\u0308\u00DF Gott."; assertNotEqual(nfc, nfd); assertNotEqual(COMPARE_STRING(nfc, nfd), true); @@ -165,8 +172,8 @@ function clientTestSuite () { //////////////////////////////////////////////////////////////////////////////// testICU_Normalize : function () { - nfc = "Gr\u00FC\u00DF Gott."; - nfd = "Gru\u0308\u00DF Gott."; + var nfc = "Gr\u00FC\u00DF Gott."; + var nfd = "Gru\u0308\u00DF Gott."; assertNotEqual(nfc, nfd); assertEqual(NORMALIZE_STRING(nfd), nfc); @@ -179,15 +186,15 @@ function clientTestSuite () { testICU_Compare_Skiplist_Sorting : function () { db._create("ICU_SORTED"); - db["ICU_SORTED"].ensureSkiplist("test"); - db["ICU_SORTED"].save({ test : "äää" }); - db["ICU_SORTED"].save({ test : "aaa" }); - db["ICU_SORTED"].save({ test : "aab" }); - db["ICU_SORTED"].save({ test : "äaa" }); - db["ICU_SORTED"].save({ test : "äää" }); - db["ICU_SORTED"].save({ test : "Aaa" }); + db.ICU_SORTED.ensureSkiplist("test"); + db.ICU_SORTED.save({ test : "äää" }); + db.ICU_SORTED.save({ test : "aaa" }); + db.ICU_SORTED.save({ test : "aab" }); + db.ICU_SORTED.save({ test : "äaa" }); + db.ICU_SORTED.save({ test : "äää" }); + db.ICU_SORTED.save({ test : "Aaa" }); - var y = db["ICU_SORTED"].range("test", "A", "z") ; + var y = db.ICU_SORTED.range("test", "A", "z") ; assertEqual(y.next().test, "Aaa"); assertEqual(y.next().test, "aaa"); @@ -208,6 +215,8 @@ jsunity.run(clientTestSuite); return jsunity.done(); +}()); + // Local Variables: // mode: outline-minor // outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" diff --git a/js/client/tests/shell-auth.js b/js/client/tests/shell-auth.js index bd2cf70e8a..3a358f0916 100644 --- a/js/client/tests/shell-auth.js +++ b/js/client/tests/shell-auth.js @@ -1,5 +1,8 @@ +/*jslint indent: 2, maxlen: 120, vars: true, white: true, plusplus: true, nonpropdel: true, nomen: true, sloppy: true */ +/*global require, fail, assertTrue */ + //////////////////////////////////////////////////////////////////////////////// -/// @brief test the foxx manager +/// @brief test the authentication /// /// @file /// @@ -25,6 +28,7 @@ /// @author Copyright 2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// +(function () { var jsunity = require("jsunity"); var arango = require("org/arangodb").arango; var db = require("internal").db; @@ -241,9 +245,9 @@ function AuthSuite () { jsunity.run(AuthSuite); return jsunity.done(); +}()); // Local Variables: // mode: outline-minor // outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" // End: - diff --git a/js/client/tests/shell-endpoints.js b/js/client/tests/shell-endpoints.js index 5662ff22e9..d4d0ad3b30 100644 --- a/js/client/tests/shell-endpoints.js +++ b/js/client/tests/shell-endpoints.js @@ -1,3 +1,6 @@ +/*jslint indent: 2, maxlen: 120, vars: true, white: true, plusplus: true, nonpropdel: true, nomen: true, sloppy: true */ +/*global require, fail, assertTrue, assertEqual */ + //////////////////////////////////////////////////////////////////////////////// /// @brief test the endpoints /// @@ -25,6 +28,8 @@ /// @author Copyright 2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// +(function () { + var jsunity = require("jsunity"); var arangodb = require("org/arangodb"); var arango = arangodb.arango; @@ -166,7 +171,7 @@ function EndpointsSuite () { fail(); } catch (err1) { - assertEqual(ERRORS.ERROR_BAD_PARAMETER.code, err1.errorNum) + assertEqual(ERRORS.ERROR_BAD_PARAMETER.code, err1.errorNum); } try { @@ -175,7 +180,7 @@ function EndpointsSuite () { fail(); } catch (err2) { - assertEqual(ERRORS.ERROR_BAD_PARAMETER.code, err2.errorNum) + assertEqual(ERRORS.ERROR_BAD_PARAMETER.code, err2.errorNum); } try { @@ -184,7 +189,7 @@ function EndpointsSuite () { fail(); } catch (err3) { - assertEqual(ERRORS.ERROR_BAD_PARAMETER.code, err3.errorNum) + assertEqual(ERRORS.ERROR_BAD_PARAMETER.code, err3.errorNum); } }, @@ -257,7 +262,7 @@ function EndpointsSuite () { var base = 30000 + parseInt(Math.random() * 10000, 10); // create a few endpoints - db._configureEndpoint("tcp://127.0.0.1:" + (base + 0), [ ]); + db._configureEndpoint("tcp://127.0.0.1:" + (base), [ ]); db._configureEndpoint("tcp://127.0.0.1:" + (base + 1), [ "UnitTestsDatabase0" ]); db._configureEndpoint("tcp://127.0.0.1:" + (base + 2), [ "UnitTestsDatabase1" ]); db._configureEndpoint("tcp://127.0.0.1:" + (base + 3), [ "UnitTestsDatabase0", "UnitTestsDatabase1" ]); @@ -290,7 +295,7 @@ function EndpointsSuite () { [ "UnitTestsDatabase1", "UnitTestsDatabase1" ] ]; - test("tcp://127.0.0.1:" + (base + 0), endpoints); + test("tcp://127.0.0.1:" + (base), endpoints); endpoints = [ [ "", "UnitTestsDatabase0" ], @@ -354,7 +359,7 @@ function EndpointsSuite () { fail(); } catch (err2) { - assertEqual(ERRORS.ERROR_ARANGO_USE_SYSTEM_DATABASE.code, err2.errorNum) + assertEqual(ERRORS.ERROR_ARANGO_USE_SYSTEM_DATABASE.code, err2.errorNum); } // _configureEndpoint is forbidden @@ -364,7 +369,7 @@ function EndpointsSuite () { fail(); } catch (err3) { - assertEqual(ERRORS.ERROR_ARANGO_USE_SYSTEM_DATABASE.code, err3.errorNum) + assertEqual(ERRORS.ERROR_ARANGO_USE_SYSTEM_DATABASE.code, err3.errorNum); } } @@ -382,6 +387,7 @@ function EndpointsSuite () { jsunity.run(EndpointsSuite); return jsunity.done(); +}()); // Local Variables: // mode: outline-minor diff --git a/js/client/tests/shell-fm.js b/js/client/tests/shell-fm.js index 936796ce4b..4439525284 100644 --- a/js/client/tests/shell-fm.js +++ b/js/client/tests/shell-fm.js @@ -1,3 +1,6 @@ +/*jslint indent: 2, maxlen: 120, vars: true, white: true, plusplus: true, nonpropdel: true, nomen: true, sloppy: true */ +/*global require, fail, assertTrue, assertFalse, assertEqual, assertMatch, assertNotNull */ + //////////////////////////////////////////////////////////////////////////////// /// @brief test the foxx manager /// @@ -25,6 +28,7 @@ /// @author Copyright 2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// +(function () { var jsunity = require("jsunity"); var fm = require("org/arangodb/foxx/manager"); var arango = require("org/arangodb").arango; @@ -119,8 +123,8 @@ function FoxxManagerSuite () { assertTrue(entry.hasOwnProperty("description")); assertTrue(entry.hasOwnProperty("version")); assertTrue(entry.hasOwnProperty("path")); + return; } - return; } fail(); @@ -185,7 +189,7 @@ function FoxxManagerSuite () { assertTrue(entry.hasOwnProperty("author")); assertTrue(entry.hasOwnProperty("versions")); - versions = entry.versions; + var version; for (version in entry.versions) { if (entry.versions.hasOwnProperty(version)) { @@ -302,7 +306,7 @@ function FoxxManagerSuite () { try { fm.uninstall("/itz"); } - catch (err) { + catch (err1) { } try { @@ -310,7 +314,7 @@ function FoxxManagerSuite () { fm.uninstall("/itz"); fail(); } - catch (err) { + catch (err2) { } }, @@ -361,7 +365,7 @@ function FoxxManagerSuite () { try { fm.uninstall("/itz"); } - catch (err) { + catch (err1) { } try { @@ -369,7 +373,7 @@ function FoxxManagerSuite () { fm.unmount("/itz"); fail(); } - catch (err) { + catch (err2) { } }, @@ -408,6 +412,8 @@ jsunity.run(FoxxManagerSuite); return jsunity.done(); +}()); + // Local Variables: // mode: outline-minor // outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" diff --git a/js/common/tests/shell-collection-volatile.js b/js/common/tests/shell-collection-volatile.js index 6671f7986c..adbae63625 100644 --- a/js/common/tests/shell-collection-volatile.js +++ b/js/common/tests/shell-collection-volatile.js @@ -89,7 +89,7 @@ function CollectionVolatileSuite () { testCreationError : function () { try { // cannot set isVolatile and waitForSync at the same time - var c = internal.db._create(cn, { isVolatile : true, waitForSync : true }); + internal.db._create(cn, { isVolatile : true, waitForSync : true }); fail(); } catch (err) { diff --git a/js/common/tests/shell-collection.js b/js/common/tests/shell-collection.js index cf96a8ac0a..07b5f6ad60 100644 --- a/js/common/tests/shell-collection.js +++ b/js/common/tests/shell-collection.js @@ -870,7 +870,7 @@ function CollectionSuite () { db._drop(cn1); db._drop(cn2); var c1 = db._create(cn1); - var c2 = db._create(cn2); + db._create(cn2); try { c1.rename(cn2); @@ -1506,8 +1506,8 @@ function CollectionDbSuite () { db._drop(cn1); db._drop(cn2); - var c1 = db._createDocumentCollection(cn1); - var c2 = db._createEdgeCollection(cn2); + db._createDocumentCollection(cn1); + db._createEdgeCollection(cn2); var collections = db._collections(); for (var i in collections) { diff --git a/js/common/tests/shell-download.js b/js/common/tests/shell-download.js index f4f68bcc39..1c27818b72 100644 --- a/js/common/tests/shell-download.js +++ b/js/common/tests/shell-download.js @@ -133,7 +133,7 @@ function DownloadSuite () { //////////////////////////////////////////////////////////////////////////////// testGetErrorNoReturn : function () { - var result, response = internal.download(buildUrl("?foo=1&bar=baz&code=404"), undefined, { }, tempName ); + var response = internal.download(buildUrl("?foo=1&bar=baz&code=404"), undefined, { }, tempName ); assertEqual(404, response.code); @@ -287,7 +287,7 @@ function DownloadSuite () { //////////////////////////////////////////////////////////////////////////////// testHead : function () { - var result, response = internal.download(buildUrl(""), undefined, { method: "head" }); + var response = internal.download(buildUrl(""), undefined, { method: "head" }); assertEqual(200, response.code); diff --git a/js/common/tests/shell-fs.js b/js/common/tests/shell-fs.js index b65b6fcdd1..4d0d17e589 100644 --- a/js/common/tests/shell-fs.js +++ b/js/common/tests/shell-fs.js @@ -28,7 +28,6 @@ var jsunity = require("jsunity"); var fs = require("fs"); -var internal = require("internal"); // ----------------------------------------------------------------------------- // --SECTION-- filesystem diff --git a/js/common/tests/shell-graph-algorithms.js b/js/common/tests/shell-graph-algorithms.js index 086c75ae5a..07e9235a6d 100644 --- a/js/common/tests/shell-graph-algorithms.js +++ b/js/common/tests/shell-graph-algorithms.js @@ -32,8 +32,6 @@ var jsunity = require("jsunity"); var console = require("console"); -var Helper = require("org/arangodb/test-helper").Helper; - // ----------------------------------------------------------------------------- // --SECTION-- collection methods // ----------------------------------------------------------------------------- diff --git a/js/common/tests/shell-graph-measurement.js b/js/common/tests/shell-graph-measurement.js index 3430ee765f..588e715be0 100644 --- a/js/common/tests/shell-graph-measurement.js +++ b/js/common/tests/shell-graph-measurement.js @@ -37,7 +37,6 @@ //////////////////////////////////////////////////////////////////////////////// var jsunity = require("jsunity"), - Helper = require("org/arangodb/test-helper").Helper, console = require("console"); // ----------------------------------------------------------------------------- diff --git a/js/common/tests/shell-graph-traversal.js b/js/common/tests/shell-graph-traversal.js index 53ebc7df88..bf51659e56 100644 --- a/js/common/tests/shell-graph-traversal.js +++ b/js/common/tests/shell-graph-traversal.js @@ -75,10 +75,10 @@ function GraphTraversalSuite () { var v2 = g.addVertex("v2"); var v3 = g.addVertex("v3"); var v4 = g.addVertex("v4"); - var e1 = g.addEdge(v1, v2, "v1v2"); - var e3 = g.addEdge(v2, v3, "v2v3"); - var e4 = g.addEdge(v1, v4, "v1v4"); - var e5 = g.addEdge(v4, v3, "v4v3"); + g.addEdge(v1, v2, "v1v2"); + g.addEdge(v2, v3, "v2v3"); + g.addEdge(v1, v4, "v1v4"); + g.addEdge(v4, v3, "v4v3"); }, //////////////////////////////////////////////////////////////////////////////// diff --git a/js/common/tests/shell-hash-index.js b/js/common/tests/shell-hash-index.js index 987e69fb6e..e1dda1383b 100644 --- a/js/common/tests/shell-hash-index.js +++ b/js/common/tests/shell-hash-index.js @@ -30,7 +30,6 @@ var jsunity = require("jsunity"); var internal = require("internal"); -var console = require("console"); var errors = internal.errors; // ----------------------------------------------------------------------------- @@ -158,15 +157,15 @@ function HashIndexSuite() { var d1 = collection.save({ a : 1, b : 1 })._id; var d2 = collection.save({ a : 2, b : 1 })._id; - var d3 = collection.save({ a : 3, b : 1 })._id; - var d4 = collection.save({ a : 4, b : 1 })._id; - var d5 = collection.save({ a : 4, b : 2 })._id; + collection.save({ a : 3, b : 1 })._id; + collection.save({ a : 4, b : 1 })._id; + collection.save({ a : 4, b : 2 })._id; var d6 = collection.save({ a : 1, b : 1 })._id; var d7 = collection.save({ a : 1 })._id; var d8 = collection.save({ a : 1 })._id; - var d9 = collection.save({ a : null, b : 1 })._id; - var d10 = collection.save({ a : null, b : 1 })._id; + collection.save({ a : null, b : 1 })._id; + collection.save({ a : null, b : 1 })._id; var d11 = collection.save({ c : 1 })._id; var d12 = collection.save({ c : 1 })._id; @@ -214,9 +213,9 @@ function HashIndexSuite() { testReadDocumentsUnloaded : function () { var idx = collection.ensureHashIndex("a"); - var d1 = collection.save({ a : 1, b : 1 })._id; + collection.save({ a : 1, b : 1 })._id; var d2 = collection.save({ a : 2, b : 1 })._id; - var d3 = collection.save({ a : 3, b : 1 })._id; + collection.save({ a : 3, b : 1 })._id; collection.unload(); internal.wait(4); diff --git a/js/common/tests/shell-index-geo.js b/js/common/tests/shell-index-geo.js index d61fdb9153..5a91449693 100644 --- a/js/common/tests/shell-index-geo.js +++ b/js/common/tests/shell-index-geo.js @@ -549,7 +549,7 @@ function GeoIndexErrorHandlingSuite() { var d2 = collection.save({ loc : null }); var d3 = collection.save({ loc : [0] }); var d4 = collection.save({ loc : [ -100, -200 ] }); - var d5 = collection.save({ loc : [ -10, -20 ]}); + collection.save({ loc : [ -10, -20 ]}); assertEqual(1, collection.near(0,0).toArray().length); diff --git a/js/common/tests/shell-index.js b/js/common/tests/shell-index.js index 83f321a903..2e3d91ff29 100644 --- a/js/common/tests/shell-index.js +++ b/js/common/tests/shell-index.js @@ -175,7 +175,7 @@ function indexSuite() { testGetNonExistingIndexes : function () { [ "2444334000000", "9999999999999" ].forEach(function (id) { try { - var idx = collection.index(id); + collection.index(id); fail(); } catch (err) { diff --git a/js/common/tests/shell-statement.js b/js/common/tests/shell-statement.js index f12119630e..e06854b62e 100644 --- a/js/common/tests/shell-statement.js +++ b/js/common/tests/shell-statement.js @@ -73,7 +73,7 @@ function StatementSuite () { testConstructNoQuery : function () { try { - var st = new ArangoStatement(db); + new ArangoStatement(db); fail(); } catch (e) { @@ -396,8 +396,8 @@ function StatementSuite () { var st = new ArangoStatement(db, { query : "for u in [ 1 ] return @value" }); st.bind("list", [ 1, 2, 3 ]); try { - var result = st.execute(); - assertFalse(true); + st.execute(); + fail(); } catch (e) { assertEqual(1551, e.errorNum); @@ -413,7 +413,7 @@ function StatementSuite () { st.bind("value", 1); try { st.bind("value", 1); - assertFalse(true); + fail(); } catch (e) { } diff --git a/js/common/tests/shell-unique-constraint.js b/js/common/tests/shell-unique-constraint.js index 6067348552..0637fbefaf 100644 --- a/js/common/tests/shell-unique-constraint.js +++ b/js/common/tests/shell-unique-constraint.js @@ -162,10 +162,10 @@ function UniqueConstraintSuite() { assertEqual(true, idx.isNewlyCreated); var d1 = collection.save({ a : 1, b : 1 })._id; - var d2 = collection.save({ a : 2, b : 1 })._id; - var d3 = collection.save({ a : 3, b : 1 })._id; - var d4 = collection.save({ a : 4, b : 1 })._id; - var d5 = collection.save({ a : 4, b : 2 })._id; + collection.save({ a : 2, b : 1 })._id; + collection.save({ a : 3, b : 1 })._id; + collection.save({ a : 4, b : 1 })._id; + collection.save({ a : 4, b : 2 })._id; collection.save({ a : 1 }); collection.save({ a : 1 }); diff --git a/js/common/tests/shell-unload.js b/js/common/tests/shell-unload.js index 3a35176118..d70f99ed59 100644 --- a/js/common/tests/shell-unload.js +++ b/js/common/tests/shell-unload.js @@ -29,7 +29,6 @@ //////////////////////////////////////////////////////////////////////////////// var jsunity = require("jsunity"); -var arangodb = require("org/arangodb"); var internal = require("internal"); // ----------------------------------------------------------------------------- diff --git a/js/server/tests/ahuacatl-cross.js b/js/server/tests/ahuacatl-cross.js index 4f6b6ca6f2..9e5dccb6c7 100644 --- a/js/server/tests/ahuacatl-cross.js +++ b/js/server/tests/ahuacatl-cross.js @@ -134,8 +134,8 @@ function ahuacatlCrossCollection () { var d1 = vertex1.save({ _key: "test1", a: 1 }); var d2 = vertex1.save({ _key: "test2", a: 2 }); var d3 = vertex2.save({ _key: "test3", a: 3 }); - var e1 = edge.save(d1._id, d2._id, { }); - var e2 = edge.save(d2._id, d3._id, { }); + edge.save(d1._id, d2._id, { }); + edge.save(d2._id, d3._id, { }); var actual = getQueryResults("FOR t IN TRAVERSAL(" + vn1 + ", " + en + ", " + JSON.stringify(d1._id) + ", 'outbound', { }) RETURN t"); assertEqual(3, actual.length); @@ -153,8 +153,8 @@ function ahuacatlCrossCollection () { var d1 = vertex1.save({ _key: "test1", a: 1 }); var d2 = vertex2.save({ _key: "test2", a: 2 }); var d3 = vertex2.save({ _key: "test3", a: 3 }); - var e1 = edge.save(d1._id, d2._id, { }); - var e2 = edge.save(d2._id, d3._id, { }); + edge.save(d1._id, d2._id, { }); + edge.save(d2._id, d3._id, { }); var actual = getQueryResults("FOR t IN TRAVERSAL(" + vn1 + ", " + en + ", " + JSON.stringify(d2._id) + ", 'outbound', { }) RETURN t"); assertEqual(2, actual.length); diff --git a/js/server/tests/ahuacatl-functions.js b/js/server/tests/ahuacatl-functions.js index 78928f3467..500443b056 100644 --- a/js/server/tests/ahuacatl-functions.js +++ b/js/server/tests/ahuacatl-functions.js @@ -1179,7 +1179,7 @@ function ahuacatlFunctionsTestSuite () { //////////////////////////////////////////////////////////////////////////////// testKeep : function () { - var actual, expected; + var actual; actual = getQueryResults("FOR i IN [ { }, { foo: 1, bar: 2, moo: 3, goof: 4, bang: 5, meow: 6 }, { foo: 0, goof: 1, meow: 2 }, { foo: null }, { foo: true }, { goof: null } ] RETURN KEEP(i, 'foo', 'bar', 'baz', [ 'meow' ], [ ])"); assertEqual([ { }, { bar: 2, foo: 1, meow: 6 }, { foo: 0, meow: 2 }, { foo: null }, { foo: true }, { } ], actual); @@ -1993,7 +1993,7 @@ function ahuacatlFunctionsTestSuite () { actual = getQueryResults("RETURN DOCUMENT(CONCAT(\"" + cn + "\", \"bart\"))"); assertEqual([ null ], actual); - var d3 = cx.save({ _key: "foo", value: "bar" }); + cx.save({ _key: "foo", value: "bar" }); expected = [ { value: "bar" } ]; actual = getQueryResults("RETURN DOCUMENT(CONCAT(\"" + cn + "\", \"foo\"))"); assertEqual([ null ], actual); @@ -2112,7 +2112,7 @@ function ahuacatlFunctionsTestSuite () { var cn = "UnitTestsAhuacatlFunctions"; internal.db._drop(cn); - var cx = internal.db._create(cn); + internal.db._create(cn); var expected, actual; diff --git a/js/server/tests/ahuacatl-hash.js b/js/server/tests/ahuacatl-hash.js index b54143976f..babc8b13e8 100644 --- a/js/server/tests/ahuacatl-hash.js +++ b/js/server/tests/ahuacatl-hash.js @@ -30,7 +30,6 @@ var jsunity = require("jsunity"); var helper = require("org/arangodb/aql-helper"); var getQueryResults = helper.getQueryResults; var getQueryExplanation = helper.getQueryExplanation; -var errors = internal.errors; //////////////////////////////////////////////////////////////////////////////// /// @brief test suite diff --git a/js/server/tests/ahuacatl-skiplist.js b/js/server/tests/ahuacatl-skiplist.js index 018682226c..6a10e87168 100644 --- a/js/server/tests/ahuacatl-skiplist.js +++ b/js/server/tests/ahuacatl-skiplist.js @@ -36,7 +36,6 @@ var getQueryExplanation = helper.getQueryExplanation; //////////////////////////////////////////////////////////////////////////////// function ahuacatlSkiplistTestSuite () { - var errors = internal.errors; var skiplist; return { diff --git a/js/server/tests/compaction.js b/js/server/tests/compaction.js index 71c0024c51..eeab87c9aa 100644 --- a/js/server/tests/compaction.js +++ b/js/server/tests/compaction.js @@ -37,8 +37,6 @@ var internal = require("internal"); //////////////////////////////////////////////////////////////////////////////// function CompactionSuite () { - var ERRORS = require("internal").errors; - return { //////////////////////////////////////////////////////////////////////////////// diff --git a/js/server/tests/replication-data.js b/js/server/tests/replication-data.js index 4e06bdef15..2a671970cf 100644 --- a/js/server/tests/replication-data.js +++ b/js/server/tests/replication-data.js @@ -81,7 +81,6 @@ function ReplicationSuite () { var masterState = replication.logger.state(); assertTrue(masterState.state.running); - var lastTick = masterState.state.lastLogTick; replication.logger.stop(); masterState = replication.logger.state(); @@ -183,7 +182,7 @@ function ReplicationSuite () { }; try { - replication.applier.properties(); + replication.applier.properties(configuration); } catch (err) { require("internal").print(err); @@ -203,7 +202,7 @@ function ReplicationSuite () { }; try { - replication.applier.properties(); + replication.applier.properties(configuration); } catch (err) { assertEqual(errors.ERROR_HTTP_UNAUTHORIZED.code, err.errorNum); @@ -222,7 +221,7 @@ function ReplicationSuite () { }; try { - replication.applier.properties(); + replication.applier.properties(configuration); } catch (err) { assertEqual(errors.ERROR_HTTP_UNAUTHORIZED.code, err.errorNum); @@ -512,7 +511,7 @@ function ReplicationSuite () { testTransaction3 : function () { compare( function (state) { - var c = db._create(cn), i; + db._create(cn); db._executeTransaction({ collections: { @@ -546,7 +545,7 @@ function ReplicationSuite () { testTransaction4 : function () { compare( function (state) { - var c = db._create(cn), i; + db._create(cn); db._executeTransaction({ collections: { @@ -592,7 +591,7 @@ function ReplicationSuite () { testTransactionBig : function () { compare( function (state) { - var c = db._create(cn), i; + db._create(cn); db._executeTransaction({ collections: { diff --git a/js/server/tests/routing.js b/js/server/tests/routing.js index 52c607f27f..77c79e83f9 100644 --- a/js/server/tests/routing.js +++ b/js/server/tests/routing.js @@ -38,7 +38,6 @@ var jsunity = require("jsunity"); //////////////////////////////////////////////////////////////////////////////// function routingSuiteSingle () { - var errors = internal.errors; var cn = "_routing"; return { diff --git a/js/server/tests/shell-any.js b/js/server/tests/shell-any.js index ed54fdfd8c..44c976fd48 100644 --- a/js/server/tests/shell-any.js +++ b/js/server/tests/shell-any.js @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////////////// -/// @brief test the collection interface +/// @brief test the random document selector /// /// @file /// @@ -28,7 +28,6 @@ var jsunity = require("jsunity"); var arangodb = require("org/arangodb"); -var internal = require("internal"); var db = arangodb.db; // ----------------------------------------------------------------------------- diff --git a/js/server/tests/shell-bitarray-index.js b/js/server/tests/shell-bitarray-index.js index 9ddcd22e07..628bcbee0f 100644 --- a/js/server/tests/shell-bitarray-index.js +++ b/js/server/tests/shell-bitarray-index.js @@ -35,7 +35,6 @@ var jsunity = require("jsunity"); var internal = require("internal"); -var console = require("console"); // ----------------------------------------------------------------------------- // --SECTION-- basic methods @@ -46,7 +45,6 @@ var console = require("console"); //////////////////////////////////////////////////////////////////////////////// function BitarrayIndexSuite() { - var ERRORS = internal.errors; var cn = "UnitTestsCollectionBitarray"; var collection = null; diff --git a/js/server/tests/shell-database.js b/js/server/tests/shell-database.js index a0a0dcbddb..ad9dbe4fde 100644 --- a/js/server/tests/shell-database.js +++ b/js/server/tests/shell-database.js @@ -27,8 +27,6 @@ var jsunity = require("jsunity"); var internal = require("internal"); -var arangodb = require("org/arangodb"); -var ERRORS = arangodb.errors; // ----------------------------------------------------------------------------- // --SECTION-- database methods diff --git a/js/server/tests/shell-foxx-base-middleware.js b/js/server/tests/shell-foxx-base-middleware.js index a28ae71a3d..019c4888a6 100644 --- a/js/server/tests/shell-foxx-base-middleware.js +++ b/js/server/tests/shell-foxx-base-middleware.js @@ -1,11 +1,9 @@ require("internal").flushModuleCache(); -var jsunity = require("jsunity"), - arangodb = require("org/arangodb"), - db = arangodb.db; +var jsunity = require("jsunity"); function BaseMiddlewareSpec () { - var BaseMiddleware, request, response, options, next; + var request, response, options, next; return { setUp: function () { diff --git a/js/server/tests/shell-foxx-preprocessor.js b/js/server/tests/shell-foxx-preprocessor.js index 812c001fa2..c3a0d7dfbd 100644 --- a/js/server/tests/shell-foxx-preprocessor.js +++ b/js/server/tests/shell-foxx-preprocessor.js @@ -51,7 +51,7 @@ function PreprocessSpec () { // Low level Spec Suite for the Transform prototype function PreprocessorSpec () { - var i, result, testFileWithSingleJSDoc, testFileWithJSDocAndMultiline, processedLineOne; + var i, testFileWithSingleJSDoc, testFileWithJSDocAndMultiline, processedLineOne; return { setUp: function () { diff --git a/js/server/tests/shell-foxx.js b/js/server/tests/shell-foxx.js index f41bcd2e2b..af9972371c 100644 --- a/js/server/tests/shell-foxx.js +++ b/js/server/tests/shell-foxx.js @@ -7,7 +7,6 @@ var jsunity = require("jsunity"), stub_and_mock = require("org/arangodb/stub_and_mock"), stub = stub_and_mock.stub, allow = stub_and_mock.allow, - expect = stub_and_mock.expect, mockConstructor = stub_and_mock.mockConstructor; fakeContext = { @@ -343,9 +342,7 @@ function DocumentationAndConstraintsSpec () { }, testAddBodyParam: function () { - var determinedName, - determinedType, - paramName = stub(), + var paramName = stub(), description = stub(), ModelPrototype = stub(), jsonSchema = { id: 'a', required: [], properties: {} }; @@ -366,9 +363,7 @@ function DocumentationAndConstraintsSpec () { }, testDefineBodyParamAddsJSONSchemaToModels: function () { - var determinedName, - determinedType, - paramName = stub(), + var paramName = stub(), description = stub(), ModelPrototype = stub(), jsonSchema = { id: 'a', required: [], properties: {} }; diff --git a/js/server/tests/shell-production.js b/js/server/tests/shell-production.js index 301318fa0c..fabb9d0166 100644 --- a/js/server/tests/shell-production.js +++ b/js/server/tests/shell-production.js @@ -25,7 +25,6 @@ /// @author Copyright 2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -var console = require("console"); var internal = require("internal"); var jsunity = require("jsunity"); diff --git a/js/server/tests/shell-skiplist-correctness.js b/js/server/tests/shell-skiplist-correctness.js index 4c098155f7..1c5809523b 100644 --- a/js/server/tests/shell-skiplist-correctness.js +++ b/js/server/tests/shell-skiplist-correctness.js @@ -30,8 +30,6 @@ var jsunity = require("jsunity"); var internal = require("internal"); -var console = require("console"); -var errors = internal.errors; // ----------------------------------------------------------------------------- // --SECTION-- basic methods @@ -42,7 +40,6 @@ var errors = internal.errors; //////////////////////////////////////////////////////////////////////////////// function SkipListCorrSuite() { - var ERRORS = internal.errors; var cn = "UnitTestsCollectionSkiplistCorr"; var coll = null; var helper = require("org/arangodb/aql-helper"); diff --git a/js/server/tests/shell-skiplist-index.js b/js/server/tests/shell-skiplist-index.js index f7faf228cf..88f13741fb 100644 --- a/js/server/tests/shell-skiplist-index.js +++ b/js/server/tests/shell-skiplist-index.js @@ -30,8 +30,6 @@ var jsunity = require("jsunity"); var internal = require("internal"); -var console = require("console"); -var errors = internal.errors; // ----------------------------------------------------------------------------- // --SECTION-- basic methods @@ -42,7 +40,6 @@ var errors = internal.errors; //////////////////////////////////////////////////////////////////////////////// function SkipListSuite() { - var ERRORS = internal.errors; var cn = "UnitTestsCollectionSkiplist"; var collection = null; diff --git a/js/server/tests/shell-skiplist-rm-performance.js b/js/server/tests/shell-skiplist-rm-performance.js index bdbc83e5e6..3f55a16d64 100644 --- a/js/server/tests/shell-skiplist-rm-performance.js +++ b/js/server/tests/shell-skiplist-rm-performance.js @@ -30,8 +30,6 @@ var jsunity = require("jsunity"); var internal = require("internal"); -var console = require("console"); -var errors = internal.errors; // ----------------------------------------------------------------------------- // --SECTION-- basic methods @@ -42,7 +40,6 @@ var errors = internal.errors; //////////////////////////////////////////////////////////////////////////////// function SkipListPerfSuite() { - var ERRORS = internal.errors; var cn = "UnitTestsCollectionSkiplistPerf"; var collection = null; diff --git a/js/server/tests/transactions.js b/js/server/tests/transactions.js index cfa1ab5427..e7681919ba 100644 --- a/js/server/tests/transactions.js +++ b/js/server/tests/transactions.js @@ -151,8 +151,6 @@ function transactionInvocationSuite () { //////////////////////////////////////////////////////////////////////////////// testReturnValues : function () { - var result; - var tests = [ { expected: 1, trx: { collections: { }, action: function () { return 1; } } }, { expected: undefined, trx: { collections: { }, action: function () { } } }, @@ -2850,8 +2848,6 @@ function transactionCountSuite () { write: [ cn1 ] }, action : function () { - var d1; - c1.save({ _key: "baz" }); assertEqual(3, c1.count()); @@ -2883,8 +2879,6 @@ function transactionCountSuite () { write: [ cn1 ] }, action : function () { - var d1; - c1.save({ _key: "baz" }); assertEqual(3, c1.count());