diff options
author | Jose <jose@zeroc.com> | 2018-04-30 21:10:23 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2018-04-30 21:10:23 +0200 |
commit | 530608e4ce63dd36d1659b58d1a3fb7fdcf56bea (patch) | |
tree | b5195405b16dd31ac1c486daf7f3ff2572ce6499 | |
parent | Allow FileParser.Endpoints to be set via Ice::Properties (#58) (diff) | |
download | ice-530608e4ce63dd36d1659b58d1a3fb7fdcf56bea.tar.bz2 ice-530608e4ce63dd36d1659b58d1a3fb7fdcf56bea.tar.xz ice-530608e4ce63dd36d1659b58d1a3fb7fdcf56bea.zip |
Fix JavaScript errors and warnings report by ESLINT
Close #28
121 files changed, 2345 insertions, 2407 deletions
diff --git a/config/makeprops.py b/config/makeprops.py index aa8cb6c0da7..c0d0cc07ae4 100755 --- a/config/makeprops.py +++ b/config/makeprops.py @@ -123,6 +123,10 @@ namespace IceInternal """ jsPreamble = commonPreamble + """ +/* eslint comma-dangle: "off" */ +/* eslint array-bracket-newline: "off" */ +/* eslint no-useless-escape: "off" */ + const Ice = require("../Ice/Property").Ice; const %(classname)s = {}; const Property = Ice.Property; @@ -560,10 +564,8 @@ class JSPropertyHandler(PropertyHandler): def startFiles(self): self.srcFile = open(self.className + ".js", "w") self.srcFile.write(jsPreamble % {'inputfile' : self.inputfile, 'classname' : self.className}) - self.srcFile.write("/* jshint -W044*/\n\n"); def closeFiles(self): - self.srcFile.write("/* jshint +W044*/\n\n"); self.srcFile.write("%s.validProps =\n" % (self.className)) self.srcFile.write("[\n") for s in self.sections: diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index caff8e1ba34..a34984e5cb4 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Sat Apr 28 20:49:27 2018 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Apr 30 21:00:34 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 78dbd5f3796..096672d4875 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Sat Apr 28 20:49:27 2018 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Apr 30 21:00:34 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/csharp/src/Ice/PropertyNames.cs b/csharp/src/Ice/PropertyNames.cs index 40f05204fd3..c84dbb6c8a9 100644 --- a/csharp/src/Ice/PropertyNames.cs +++ b/csharp/src/Ice/PropertyNames.cs @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Sat Apr 28 20:49:27 2018 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Apr 30 21:00:34 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java b/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java index 66c3e6599a1..c8c9cc818f5 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Sat Apr 28 20:49:27 2018 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Apr 30 21:00:34 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java index da3f27012ed..76796b68124 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Sat Apr 28 20:49:27 2018 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Apr 30 21:00:34 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/js/.eslintignore b/js/.eslintignore new file mode 100644 index 00000000000..99b87916045 --- /dev/null +++ b/js/.eslintignore @@ -0,0 +1,7 @@ +es5 +lib +assets +gulpfile.js +gulp/bundle.js +bin/HttpServer.js +test/Ice/import/bundle.js
\ No newline at end of file diff --git a/js/.eslintrc.js b/js/.eslintrc.js index 7d24b13d281..c4a88fcdcfd 100644 --- a/js/.eslintrc.js +++ b/js/.eslintrc.js @@ -2,7 +2,8 @@ module.exports = { "env": { "browser": true, "es6": true, - "node": true + "node": true, + "worker": true }, "extends": "eslint:recommended", "parserOptions": { @@ -10,7 +11,7 @@ module.exports = { }, "rules": { "accessor-pairs": "error", - "array-bracket-newline": "error", + "array-bracket-newline": "off", "array-bracket-spacing": [ "error", "never" @@ -31,10 +32,7 @@ module.exports = { ], "block-scoped-var": "error", "block-spacing": "error", - "brace-style": [ - "error", - "allman" - ], + "brace-style": "off", "callback-return": "off", "camelcase": "off", "capitalized-comments": "off", @@ -57,7 +55,7 @@ module.exports = { "consistent-this": "error", "curly": "error", "default-case": "error", - "dot-location": "error", + "dot-location": ["error", "property"], "dot-notation": [ "error", { @@ -75,7 +73,7 @@ module.exports = { "generator-star-spacing": "error", "getter-return": "error", "global-require": "error", - "guard-for-in": "error", + "guard-for-in": "off", "handle-callback-err": "error", "id-blacklist": "error", "id-length": "off", @@ -104,11 +102,8 @@ module.exports = { "max-params": "off", "max-statements": "off", "max-statements-per-line": "error", - "multiline-comment-style": [ - "error", - "separate-lines" - ], - "new-cap": "error", + "multiline-comment-style": "off", + "new-cap": "off", "new-parens": "error", "newline-after-var": "off", "newline-before-return": "off", @@ -119,7 +114,7 @@ module.exports = { "no-bitwise": "off", "no-buffer-constructor": "error", "no-caller": "error", - "no-catch-shadow": "error", + "no-catch-shadow": "off", "no-confusing-arrow": "error", "no-console": "off", "no-continue": "off", @@ -157,7 +152,7 @@ module.exports = { "no-lonely-if": "error", "no-loop-func": "error", "no-magic-numbers": "off", - "no-mixed-operators": "error", + "no-mixed-operators": "off", "no-mixed-requires": "error", "no-multi-assign": "error", "no-multi-spaces": "error", @@ -173,13 +168,13 @@ module.exports = { "no-new-require": "error", "no-new-wrappers": "error", "no-octal-escape": "error", - "no-param-reassign": "error", + "no-param-reassign": "off", "no-path-concat": "error", "no-plusplus": "off", "no-process-env": "error", "no-process-exit": "error", "no-proto": "error", - "no-prototype-builtins": "error", + "no-prototype-builtins": "off", "no-restricted-globals": "error", "no-restricted-imports": "error", "no-restricted-modules": "error", @@ -190,7 +185,7 @@ module.exports = { "no-script-url": "error", "no-self-compare": "error", "no-sequences": "error", - "no-shadow": "error", + "no-shadow": "off", "no-shadow-restricted-names": "error", "no-spaced-func": "error", "no-sync": "error", @@ -205,9 +200,12 @@ module.exports = { "no-unmodified-loop-condition": "error", "no-unneeded-ternary": "error", "no-unused-expressions": "error", - "no-use-before-define": [ + "no-use-before-define": "off", + "no-unused-vars":[ "error", - "nofunc" + { + "args" : "none" + } ], "no-useless-call": "error", "no-useless-computed-key": "error", @@ -215,16 +213,17 @@ module.exports = { "no-useless-constructor": "error", "no-useless-rename": "error", "no-useless-return": "error", + "no-useless-escape": "error", "no-var": "error", "no-void": "error", "no-warning-comments": "off", "no-whitespace-before-property": "error", "no-with": "error", "nonblock-statement-body-position": "error", - "object-curly-newline": "error", + "object-curly-newline": "off", "object-curly-spacing": "error", "object-property-newline": "off", - "object-shorthand": "error", + "object-shorthand": ["error", "consistent"], "one-var": "off", "one-var-declaration-per-line": "error", "operator-assignment": "error", @@ -239,7 +238,7 @@ module.exports = { "prefer-destructuring": "off", "prefer-numeric-literals": "error", "prefer-promise-reject-errors": "error", - "prefer-reflect": "error", + "prefer-reflect": "off", "prefer-rest-params": "error", "prefer-spread": "error", "prefer-template": "off", @@ -251,7 +250,7 @@ module.exports = { "off", "double" ], - "radix": "error", + "radix": "off", "require-await": "error", "require-jsdoc": "off", "rest-spread-spacing": "error", diff --git a/js/.jshintrc b/js/.jshintrc deleted file mode 100644 index f1969068d41..00000000000 --- a/js/.jshintrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "esversion": 6, - "node": true, - "undef": true, - "evil": true, - "elision": true, - "globals": - { - "WebSocket" : false, - "window": false, - "navigator": false, - "escape" : false, - "unescape": false - } -} diff --git a/js/.jshintrc_browser b/js/.jshintrc_browser deleted file mode 100644 index ff091005f5d..00000000000 --- a/js/.jshintrc_browser +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends" : ".jshintrc", - "browser" : true, - "jquery" : true, - "globals": - { - "Ice" : false, - "IceGrid" : false, - "IceMX" : false, - "IceSSL" : false, - "IceStorm" : false, - "Glacier2" : false - } -} diff --git a/js/gulpfile.js b/js/gulpfile.js index d5d6b8db422..5231831b436 100644 --- a/js/gulpfile.js +++ b/js/gulpfile.js @@ -134,7 +134,8 @@ gulp.task("common:slice-babel", ["common:slice"], "test/Common/ControllerWorker.js", "test/Common/TestRunner.js", "test/Common/TestSuite.js", - "test/Common/Worker.js"]), + "test/Common/Worker.js", + "test/Common/run.js"]), babel({compact: false}), gulp.dest("test/es5/Common")], cb); }); diff --git a/js/src/Glacier2/Glacier2.js b/js/src/Glacier2/Glacier2.js index 5ae2d25c1de..2ba6a085f4b 100644 --- a/js/src/Glacier2/Glacier2.js +++ b/js/src/Glacier2/Glacier2.js @@ -7,12 +7,12 @@ // // ********************************************************************** -var _ModuleRegistry = require("../Ice/ModuleRegistry").Ice._ModuleRegistry; +const _ModuleRegistry = require("../Ice/ModuleRegistry").Ice._ModuleRegistry; module.exports.Glacier2 = _ModuleRegistry.require(module, [ "../Glacier2/PermissionsVerifier", "../Glacier2/Router", "../Glacier2/Session", - "../Glacier2/SSLInfo", + "../Glacier2/SSLInfo" ]).Glacier2; diff --git a/js/src/Ice/ArrayUtil.js b/js/src/Ice/ArrayUtil.js index 162a2d74913..2fbe9295bd3 100644 --- a/js/src/Ice/ArrayUtil.js +++ b/js/src/Ice/ArrayUtil.js @@ -92,11 +92,13 @@ Slice.defineSequence = function(module, name, valueHelper, fixed, elementType) let helper = null; Object.defineProperty(module, name, { - get: function() + get: () => { if(helper === null) { - helper = Ice.StreamHelpers.generateSeqHelper(_ModuleRegistry.type(valueHelper), fixed, _ModuleRegistry.type(elementType)); + helper = Ice.StreamHelpers.generateSeqHelper(_ModuleRegistry.type(valueHelper), + fixed, + _ModuleRegistry.type(elementType)); } return helper; } diff --git a/js/src/Ice/AsyncStatus.js b/js/src/Ice/AsyncStatus.js index 22767bdfc60..cdc3fb3c757 100644 --- a/js/src/Ice/AsyncStatus.js +++ b/js/src/Ice/AsyncStatus.js @@ -8,5 +8,5 @@ // ********************************************************************** const Ice = require("../Ice/ModuleRegistry").Ice; -Ice.AsyncStatus = { Queued: 0, Sent: 1 }; +Ice.AsyncStatus = {Queued: 0, Sent: 1}; module.exports.Ice = Ice; diff --git a/js/src/Ice/Base64.js b/js/src/Ice/Base64.js index bd549baf767..944ffd89713 100644 --- a/js/src/Ice/Base64.js +++ b/js/src/Ice/Base64.js @@ -9,8 +9,6 @@ const Ice = require("../Ice/Buffer").Ice; -const Buffer = Ice.Buffer; - const _codeA = "A".charCodeAt(0); const _codea = "a".charCodeAt(0); const _code0 = "0".charCodeAt(0); @@ -170,7 +168,7 @@ class Base64 // Figure out how long the final sequence is going to be. const totalBytes = (newStr.length * 3 / 4) + 1; - const retval = new Buffer(); + const retval = new Ice.Buffer(); retval.resize(totalBytes); let by1; diff --git a/js/src/Ice/Buffer.js b/js/src/Ice/Buffer.js index 7af36f0e6ef..3bb6a08a1dd 100644 --- a/js/src/Ice/Buffer.js +++ b/js/src/Ice/Buffer.js @@ -147,7 +147,7 @@ class Buffer putArray(v) { - //Expects an Uint8Array + // Expects an Uint8Array if(!(v instanceof Uint8Array)) { throw new TypeError('argument is not a Uint8Array'); @@ -286,8 +286,9 @@ class Buffer { throw new Error(bufferUnderflowExceptionMsg); } - length = length === undefined ? (this.b.byteLength - position) : length; - return new Uint8Array(this.b.slice(position, position + length)); + return new Uint8Array( + this.b.slice(position, position + length === undefined ? + (this.b.byteLength - position) : length)); } getShort() diff --git a/js/src/Ice/ConnectRequestHandler.js b/js/src/Ice/ConnectRequestHandler.js index 9c708af752f..04c43ca8535 100644 --- a/js/src/Ice/ConnectRequestHandler.js +++ b/js/src/Ice/ConnectRequestHandler.js @@ -15,7 +15,7 @@ Ice._ModuleRegistry.require(module, "../Ice/Debug", "../Ice/RetryException", "../Ice/ReferenceMode", - "../Ice/Exception", + "../Ice/Exception" ]); const AsyncStatus = Ice.AsyncStatus; @@ -125,12 +125,14 @@ class ConnectRequestHandler const ri = this._reference.getRouterInfo(); if(ri !== null) { - // - ri.addProxy(this._proxy).then(() => this.flushRequests(), // The proxy was added to the router - // info, we're now ready to send the - // queued requests. - // - ex => this.setException(ex)); + ri.addProxy(this._proxy).then( + // + // The proxy was added to the router + // info, we're now ready to send the + // queued requests. + // + () => this.flushRequests(), + ex => this.setException(ex)); return; // The request handler will be initialized once addProxy completes. } @@ -180,26 +182,23 @@ class ConnectRequestHandler Debug.assert(this._connection !== null); return true; } - else + else if(this._exception !== null) { - if(this._exception !== null) - { - if(this._connection !== null) - { - // - // Only throw if the connection didn't get established. If - // it died after being established, we allow the caller to - // retry the connection establishment by not throwing here - // (the connection will throw RetryException). - // - return true; - } - throw this._exception; - } - else + if(this._connection !== null) { - return this._initialized; + // + // Only throw if the connection didn't get established. If + // it died after being established, we allow the caller to + // retry the connection establishment by not throwing here + // (the connection will throw RetryException). + // + return true; } + throw this._exception; + } + else + { + return this._initialized; } } @@ -222,7 +221,6 @@ class ConnectRequestHandler // Remove the request handler before retrying. this._reference.getInstance().requestHandlerFactory().removeRequestHandler(this._reference, this); - request.retryException(ex.inner); } else diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js index 94699a15d1d..d5a9ae8cfed 100644 --- a/js/src/Ice/ConnectionI.js +++ b/js/src/Ice/ConnectionI.js @@ -26,7 +26,7 @@ Ice._ModuleRegistry.require(module, "../Ice/Version", "../Ice/Exception", "../Ice/LocalException", - "../Ice/BatchRequestQueue", + "../Ice/BatchRequestQueue" ]); const AsyncStatus = Ice.AsyncStatus; @@ -96,7 +96,7 @@ class ConnectionI this._readTimeoutId = 0; this._readTimeoutScheduled = false; - this._hasMoreData = { value: false }; + this._hasMoreData = {value: false}; this._warn = initData.properties.getPropertyAsInt("Ice.Warn.Connections") > 0; this._warnUdp = instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0; @@ -159,9 +159,9 @@ class ConnectionI this._startPromise = new Ice.Promise(); this._transceiver.setCallbacks( - () => { this.message(SocketOperation.Write); }, // connected callback - () => { this.message(SocketOperation.Read); }, // read callback - () => { this.message(SocketOperation.Write); } // write callback + () => this.message(SocketOperation.Write), // connected callback + () => this.message(SocketOperation.Read), // read callback + () => this.message(SocketOperation.Write) // write callback ); this.initialize(); } @@ -213,6 +213,12 @@ class ConnectionI this.setState(StateClosing, new Ice.CommunicatorDestroyedException()); break; } + + default: + { + Debug.assert(false); + break; + } } } @@ -322,7 +328,7 @@ class ConnectionI // if(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatAlways || (acm.heartbeat != Ice.ACMHeartbeat.HeartbeatOff && this._writeStream.isEmpty() && - now >= (this._acmLastActivity + acm.timeout / 4))) + now >= (this._acmLastActivity + (acm.timeout / 4)))) { if(acm.heartbeat != Ice.ACMHeartbeat.HeartbeatOnDispatch || this._dispatchCount > 0) { @@ -903,7 +909,7 @@ class ConnectionI if(this._hasMoreData.value) { - Timer.setImmediate(() => { this.message(SocketOperation.Read); }); // Don't tie up the thread. + Timer.setImmediate(() => this.message(SocketOperation.Read)); // Don't tie up the thread. } } @@ -1010,31 +1016,28 @@ class ConnectionI this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); } } - else + else if(traceLevels.network >= 1) { - if(traceLevels.network >= 1) - { - const s = []; - s.push("closed "); - s.push(this._endpoint.protocol()); - s.push(" connection\n"); - s.push(this.toString()); - - // - // Trace the cause of unexpected connection closures - // - if(!(this._exception instanceof Ice.CloseConnectionException || - this._exception instanceof Ice.ConnectionManuallyClosedException || - this._exception instanceof Ice.ConnectionTimeoutException || - this._exception instanceof Ice.CommunicatorDestroyedException || - this._exception instanceof Ice.ObjectAdapterDeactivatedException)) - { - s.push("\n"); - s.push(this._exception.toString()); - } + const s = []; + s.push("closed "); + s.push(this._endpoint.protocol()); + s.push(" connection\n"); + s.push(this.toString()); - this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); + // + // Trace the cause of unexpected connection closures + // + if(!(this._exception instanceof Ice.CloseConnectionException || + this._exception instanceof Ice.ConnectionManuallyClosedException || + this._exception instanceof Ice.ConnectionTimeoutException || + this._exception instanceof Ice.CommunicatorDestroyedException || + this._exception instanceof Ice.ObjectAdapterDeactivatedException)) + { + s.push("\n"); + s.push(this._exception.toString()); } + + this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); } if(this._startPromise !== null) @@ -1272,100 +1275,106 @@ class ConnectionI { switch(state) { - case StateNotInitialized: - { - Debug.assert(false); - break; - } + case StateNotInitialized: + { + Debug.assert(false); + break; + } - case StateNotValidated: - { - if(this._state !== StateNotInitialized) + case StateNotValidated: { - Debug.assert(this._state === StateClosed); - return; + if(this._state !== StateNotInitialized) + { + Debug.assert(this._state === StateClosed); + return; + } + // + // Register to receive validation message. + // + if(!this._endpoint.datagram() && !this._incoming) + { + // + // Once validation is complete, a new connection starts out in the + // Holding state. We only want to register the transceiver now if we + // need to receive data in order to validate the connection. + // + this._transceiver.register(); + } + break; } - // - // Register to receive validation message. - // - if(!this._endpoint.datagram() && !this._incoming) + + case StateActive: { // - // Once validation is complete, a new connection starts out in the - // Holding state. We only want to register the transceiver now if we - // need to receive data in order to validate the connection. + // Can only switch from holding or not validated to + // active. // + if(this._state !== StateHolding && this._state !== StateNotValidated) + { + return; + } this._transceiver.register(); + break; } - break; - } - case StateActive: - { - // - // Can only switch from holding or not validated to - // active. - // - if(this._state !== StateHolding && this._state !== StateNotValidated) + case StateHolding: { - return; + // + // Can only switch from active or not validated to + // holding. + // + if(this._state !== StateActive && this._state !== StateNotValidated) + { + return; + } + if(this._state === StateActive) + { + this._transceiver.unregister(); + } + break; } - this._transceiver.register(); - break; - } - case StateHolding: - { - // - // Can only switch from active or not validated to - // holding. - // - if(this._state !== StateActive && this._state !== StateNotValidated) + case StateClosing: { - return; + // + // Can't change back from closed. + // + if(this._state >= StateClosed) + { + return; + } + if(this._state === StateHolding) + { + // We need to continue to read in closing state. + this._transceiver.register(); + } + break; } - if(this._state === StateActive) + + case StateClosed: { + if(this._state === StateFinished) + { + return; + } + this._batchRequestQueue.destroy(this._exception); this._transceiver.unregister(); + break; } - break; - } - case StateClosing: - { - // - // Can't change back from closed. - // - if(this._state >= StateClosed) - { - return; - } - if(this._state === StateHolding) + case StateFinished: { - // We need to continue to read in closing state. - this._transceiver.register(); + Debug.assert(this._state === StateClosed); + this._transceiver.close(); + this._communicator = null; + break; } - break; - } - case StateClosed: - { - if(this._state === StateFinished) + default: { - return; + Debug.assert(false); + break; } - this._batchRequestQueue.destroy(this._exception); - this._transceiver.unregister(); - break; - } - - case StateFinished: - { - Debug.assert(this._state === StateClosed); - this._transceiver.close(); - this._communicator = null; - break; - } } } catch(ex) @@ -1567,7 +1576,7 @@ class ConnectionI throw new Ice.ConnectionNotValidatedException(); } this._readStream.readByte(); // Ignore compression status for validate connection. - if( this._readStream.readInt() !== Protocol.headerSize) + if(this._readStream.readInt() !== Protocol.headerSize) { throw new Ice.IllegalMessageSizeException(); } @@ -1692,7 +1701,7 @@ class ConnectionI // If all the messages were sent and we are in the closing state, we schedule // the close timeout to wait for the peer to close the connection. // - if(this._state === StateClosing && _shutdownInitiated) + if(this._state === StateClosing && this._shutdownInitiated) { this.scheduleTimeout(SocketOperation.Read); } diff --git a/js/src/Ice/Debug.js b/js/src/Ice/Debug.js index bc7876b6b82..d7f1665c74a 100644 --- a/js/src/Ice/Debug.js +++ b/js/src/Ice/Debug.js @@ -7,6 +7,9 @@ // // ********************************************************************** +/* eslint no-sync: "off" */ +/* eslint no-process-exit: "off" */ + const Ice = require("../Ice/ModuleRegistry").Ice; const fs = require("fs"); diff --git a/js/src/Ice/EndpointFactoryManager.js b/js/src/Ice/EndpointFactoryManager.js index 2a2ddfc9219..0ea675d36aa 100644 --- a/js/src/Ice/EndpointFactoryManager.js +++ b/js/src/Ice/EndpointFactoryManager.js @@ -96,7 +96,7 @@ class EndpointFactoryManager throw new EndpointParseException("unrecognized argument `" + arr[0] + "' in endpoint `" + str + "'"); } - for(let i = 0, length = this._factories.length; i < length; ++i) + for(let i = 0, length = this._factories.length; i < length; ++i) { if(this._factories[i].type() == ue.type()) { diff --git a/js/src/Ice/EnumBase.js b/js/src/Ice/EnumBase.js index bf8fdf53368..9e9c03a585a 100644 --- a/js/src/Ice/EnumBase.js +++ b/js/src/Ice/EnumBase.js @@ -91,10 +91,6 @@ Slice.defineEnum = function(enumerators) { const type = class extends EnumBase { - constructor(n, v) - { - super(n, v); - } }; const enums = []; @@ -121,9 +117,7 @@ Slice.defineEnum = function(enumerators) } } - Object.defineProperty(type, "minWireSize", { - get: function(){ return 1; } - }); + Object.defineProperty(type, "minWireSize", {get: () => 1}); type._write = function(os, v) { @@ -136,10 +130,12 @@ Slice.defineEnum = function(enumerators) os.writeEnum(firstEnum); } }; + type._read = function(is) { return is.readEnum(type); }; + type._writeOpt = function(os, tag, v) { if(v !== undefined) @@ -150,6 +146,7 @@ Slice.defineEnum = function(enumerators) } } }; + type._readOpt = function(is, tag) { return is.readOptionalEnum(tag, type); diff --git a/js/src/Ice/Exception.js b/js/src/Ice/Exception.js index fa5ed01ce2d..162b28a7622 100644 --- a/js/src/Ice/Exception.js +++ b/js/src/Ice/Exception.js @@ -281,7 +281,7 @@ const readPreserved = function(is) const ice_getSlicedData = function() { return this._slicedData; -} +}; Ice.Slice.PreservedUserException = function(ex) { diff --git a/js/src/Ice/FormatType.js b/js/src/Ice/FormatType.js index d7e88b6fd71..a904c1caeef 100644 --- a/js/src/Ice/FormatType.js +++ b/js/src/Ice/FormatType.js @@ -8,5 +8,10 @@ // ********************************************************************** const Ice = require("../Ice/EnumBase").Ice; -Ice.FormatType = Ice.Slice.defineEnum([['DefaultFormat', 0], ['CompactFormat',1], ['SlicedFormat',2]]); +Ice.FormatType = Ice.Slice.defineEnum( + [ + ['DefaultFormat', 0], + ['CompactFormat', 1], + ['SlicedFormat', 2] + ]); module.exports.Ice = Ice; diff --git a/js/src/Ice/HashMap.js b/js/src/Ice/HashMap.js index feff178e07c..71dda4b2574 100644 --- a/js/src/Ice/HashMap.js +++ b/js/src/Ice/HashMap.js @@ -234,10 +234,15 @@ class HashMap return false; } - const eq = valuesEqual || ((v1, v2) => - { - return this._valueComparator.call(this._valueComparator, v1, v2); - }); + let eq; + if(valuesEqual) + { + eq = valuesEqual; + } + else + { + eq = (v1, v2) => this._valueComparator.call(this._valueComparator, v1, v2); + } for(let e = this._head; e !== null; e = e._next) { @@ -264,44 +269,53 @@ class HashMap // Create a new table entry. // const e = Object.create(null, { - "key": { + key: + { enumerable: true, get: function() { return this._key; } }, - "value": { + value: + { enumerable: true, get: function() { return this._value; } }, - "next": { + next: + { enumerable: true, get: function() { return this._next; } }, - "_key": { + _key: + { enumerable: false, writable: true, value: key }, - "_value": { + _value: + { enumerable: false, writable: true, value: value }, - "_prev": { + _prev: + { enumerable: false, writable: true, value: null }, - "_next": { + _next: + { enumerable: false, writable: true, value: null }, - "_nextInBucket": { + _nextInBucket: + { enumerable: false, writable: true, value: null }, - "_hash": { + _hash: + { enumerable: false, writable: true, value: hash @@ -366,9 +380,9 @@ class HashMap computeHash(v) { - if(v === 0 || v === -0) + if(v === 0) { - return {key:0, hash:0}; + return {key: 0, hash: 0}; } if(v === null) @@ -376,7 +390,7 @@ class HashMap if(HashMap._null === null) { const uuid = Ice.generateUUID(); - HashMap._null = {key:uuid, hash:StringUtil.hashCode(uuid)}; + HashMap._null = {key: uuid, hash: StringUtil.hashCode(uuid)}; } return HashMap._null; } @@ -386,15 +400,15 @@ class HashMap throw new Error("cannot compute hash for undefined value"); } - if(typeof(v.hashCode) === "function") + if(typeof v.hashCode === "function") { - return {key:v, hash:v.hashCode()}; + return {key: v, hash: v.hashCode()}; } - const type = typeof(v); + const type = typeof v; if(type === "string" || v instanceof String) { - return {key:v, hash:StringUtil.hashCode(v)}; + return {key: v, hash: StringUtil.hashCode(v)}; } else if(type === "number" || v instanceof Number) { @@ -403,15 +417,15 @@ class HashMap if(HashMap._nan === null) { const uuid = Ice.generateUUID(); - HashMap._nan = {key:uuid, hash:StringUtil.hashCode(uuid)}; + HashMap._nan = {key: uuid, hash: StringUtil.hashCode(uuid)}; } return HashMap._nan; } - return {key:v, hash:v.toFixed(0)}; + return {key: v, hash: v.toFixed(0)}; } else if(type === "boolean" || v instanceof Boolean) { - return {key:v, hash:v ? 1 : 0}; + return {key: v, hash: v ? 1 : 0}; } throw new Error("cannot compute hash for value of type " + type); diff --git a/js/src/Ice/IdentityUtil.js b/js/src/Ice/IdentityUtil.js index c8d1b9ec993..1768ccdd79b 100644 --- a/js/src/Ice/IdentityUtil.js +++ b/js/src/Ice/IdentityUtil.js @@ -8,7 +8,12 @@ // ********************************************************************** const Ice = require("../Ice/ModuleRegistry").Ice; -Ice._ModuleRegistry.require(module, [ "../Ice/StringUtil", "../Ice/Identity", "../Ice/LocalException"]); +Ice._ModuleRegistry.require(module, + [ + "../Ice/StringUtil", + "../Ice/Identity", + "../Ice/LocalException" + ]); const StringUtil = Ice.StringUtil; const Identity = Ice.Identity; diff --git a/js/src/Ice/IncomingAsync.js b/js/src/Ice/IncomingAsync.js index d5503b8d897..20cdd006f6d 100644 --- a/js/src/Ice/IncomingAsync.js +++ b/js/src/Ice/IncomingAsync.js @@ -47,7 +47,7 @@ class IncomingAsync this._servant = null; this._locator = null; - this._cookie = { value: null }; + this._cookie = {value: null}; this._os = null; this._is = null; @@ -208,7 +208,7 @@ class IncomingAsync } else { - Ice.StringSeqHelper.write(this._os, [ ex.facet ]); + Ice.StringSeqHelper.write(this._os, [ex.facet]); } this._os.writeString(ex.operation); @@ -342,7 +342,6 @@ class IncomingAsync this._os.writeBlob(Protocol.replyHdr); this._os.writeInt(this._current.requestId); this._os.writeByte(Protocol.replyUnknownException); - //this._os.writeString(ex.toString()); this._os.writeString(ex.toString() + (ex.stack ? "\n" + ex.stack : "")); this._connection.sendResponse(this._os); } @@ -457,7 +456,8 @@ class IncomingAsync const promise = this._servant._iceDispatch(this, this._current); if(promise !== null) { - promise.then(() => this.completed(null, true), (ex) => this.completed(ex, true)); + promise.then(() => this.completed(null, true), + ex => this.completed(ex, true)); return; } diff --git a/js/src/Ice/LocatorInfo.js b/js/src/Ice/LocatorInfo.js index e4085e307f0..b7e71384d57 100644 --- a/js/src/Ice/LocatorInfo.js +++ b/js/src/Ice/LocatorInfo.js @@ -95,7 +95,7 @@ class LocatorInfo Debug.assert(ref.isIndirect()); let endpoints = null; - const cached = { value: false }; + const cached = {value: false}; if(!ref.isWellKnown()) { endpoints = this._table.getAdapterEndpoints(ref.getAdapterId(), ttl, cached); @@ -168,7 +168,7 @@ class LocatorInfo } else { - const r = this._table.removeObjectReference(ref.getIdentity()); + const r = this._table.removeObjectReference(ref.getIdentity()); if(r !== null) { if(!r.isIndirect()) @@ -323,18 +323,15 @@ class LocatorInfo this.trace("found endpoints for adapter in locator cache", ref, endpoints); } } + else if(ref.isWellKnown()) + { + this.trace("retrieved endpoints for well-known proxy from locator, adding to locator cache", + ref, endpoints); + } else { - if(ref.isWellKnown()) - { - this.trace("retrieved endpoints for well-known proxy from locator, adding to locator cache", - ref, endpoints); - } - else - { - this.trace("retrieved endpoints for adapter from locator, adding to locator cache", - ref, endpoints); - } + this.trace("retrieved endpoints for adapter from locator, adding to locator cache", + ref, endpoints); } } else diff --git a/js/src/Ice/ModuleRegistry.js b/js/src/Ice/ModuleRegistry.js index 42607067a5c..b5a62b105ec 100644 --- a/js/src/Ice/ModuleRegistry.js +++ b/js/src/Ice/ModuleRegistry.js @@ -13,11 +13,11 @@ class _ModuleRegistry { static module(name) { - let m = modules[name]; + let m = modules[name]; if(m === undefined) { m = {}; - modules[name] = m; + modules[name] = m; } return m; } diff --git a/js/src/Ice/Object.js b/js/src/Ice/Object.js index 45dd64b54bc..e01468241e5 100644 --- a/js/src/Ice/Object.js +++ b/js/src/Ice/Object.js @@ -21,8 +21,6 @@ Ice._ModuleRegistry.require(module, "../Ice/OptionalFormat" ]); -const ids = ["::Ice::Object"]; - Ice.Object = class { ice_isA(s, current) diff --git a/js/src/Ice/ObjectAdapterI.js b/js/src/Ice/ObjectAdapterI.js index a6c65d266e6..2fd184a958d 100644 --- a/js/src/Ice/ObjectAdapterI.js +++ b/js/src/Ice/ObjectAdapterI.js @@ -73,11 +73,11 @@ const _suffixes = const StateUninitialized = 0; // Just constructed. const StateHeld = 1; -//const StateWaitActivate = 2; +// const StateWaitActivate = 2; const StateActive = 3; -//const StateDeactivating = 4; +// const StateDeactivating = 4; const StateDeactivated = 5; -const StateDestroyed = 6; +const StateDestroyed = 6; // // Only for use by IceInternal.ObjectAdapterFactory @@ -459,7 +459,11 @@ class ObjectAdapterI refreshPublishedEndpoints() { this.checkForDeactivation(); - return this.computePublishedEndpoints().then(endpoints => this._publishedEndpoints = endpoints); + return this.computePublishedEndpoints().then( + endpoints => + { + this._publishedEndpoints = endpoints; + }); } getPublishedEndpoints() @@ -488,7 +492,7 @@ class ObjectAdapterI setAdapterOnConnection(connection) { this.checkForDeactivation(); - connection.setAdapterAndServantManager(this, _servantManager); + connection.setAdapterAndServantManager(this, this._servantManager); } messageSizeMax() @@ -546,21 +550,22 @@ class ObjectAdapterI let p; if(this._routerInfo !== null) { - p = this._routerInfo.getServerEndpoints().then((endpts) => - { - // - // Remove duplicate endpoints, so we have a list of unique endpoints. - // - const endpoints = []; - endpts.forEach(endpoint => - { - if(endpoints.findIndex(value => endpoint.equals(value)) === -1) + p = this._routerInfo.getServerEndpoints().then( + endpts => { - endpoints.push(endpoint); - } - }); - return endpoints; - }); + // + // Remove duplicate endpoints, so we have a list of unique endpoints. + // + const endpoints = []; + endpts.forEach(endpoint => + { + if(endpoints.findIndex(value => endpoint.equals(value)) === -1) + { + endpoints.push(endpoint); + } + }); + return endpoints; + }); } else { @@ -609,7 +614,7 @@ class ObjectAdapterI } else { - quote = s.indexOf('\"', ++quote); + quote = s.indexOf("\"", ++quote); if(quote == -1) { break; @@ -632,7 +637,7 @@ class ObjectAdapterI const es = s.substring(beg, end); const endp = this._instance.endpointFactoryManager().create(es, false); - if(endp == null) + if(endp === null) { throw new Ice.EndpointParseException("invalid object adapter endpoint `" + s + "'"); } @@ -642,28 +647,30 @@ class ObjectAdapterI p = Ice.Promise.resolve(endpoints); } - return p.then((endpoints) => - { - if(this._instance.traceLevels().network >= 1 && endpoints.length > 0) - { - const s = []; - s.push("published endpoints for object adapter `"); - s.push(this._name); - s.push("':\n"); - let first = true; - endpoints.forEach(endpoint => + return p.then( + endpoints => { - if(!first) + if(this._instance.traceLevels().network >= 1 && endpoints.length > 0) { - s.push(":"); + const s = []; + s.push("published endpoints for object adapter `"); + s.push(this._name); + s.push("':\n"); + let first = true; + endpoints.forEach(endpoint => + { + if(!first) + { + s.push(":"); + } + s.push(endpoint.toString()); + first = false; + }); + this._instance.initializationData().logger.trace(this._instance.traceLevels().networkCat, + s.toString()); } - s.push(endpoint.toString()); - first = false; + return endpoints; }); - this._instance.initializationData().logger.trace(this._instance.traceLevels().networkCat, s.toString()); - } - return endpoints; - }); } filterProperties(unknownProps) @@ -684,7 +691,7 @@ class ObjectAdapterI let noProps = true; const props = this._instance.initializationData().properties.getPropertiesForPrefix(prefix); - for(const [key, value] of props) + for(const key of props.keys()) { let valid = false; for(let i = 0; i < _suffixes.length; ++i) diff --git a/js/src/Ice/ObjectPrx.js b/js/src/Ice/ObjectPrx.js index cb1b03b25e3..3e83bcba57f 100644 --- a/js/src/Ice/ObjectPrx.js +++ b/js/src/Ice/ObjectPrx.js @@ -25,9 +25,7 @@ Ice._ModuleRegistry.require(module, const ArrayUtil = Ice.ArrayUtil; const AsyncResultBase = Ice.AsyncResultBase; -const AsyncResult = Ice.AsyncResult; const Debug = Ice.Debug; -const FormatType = Ice.FormatType; const OutgoingAsync = Ice.OutgoingAsync; const ProxyFlushBatch = Ice.ProxyFlushBatch; const ProxyGetConnection = Ice.ProxyGetConnection; @@ -701,7 +699,7 @@ class ObjectPrx else { const ostr = r.startWriteParams(fmt); - marshalFn.call(null, ostr, args); + marshalFn(ostr, args); r.endWriteParams(); } r.invoke(); @@ -738,7 +736,6 @@ class ObjectPrx catch(ex) { this.dispatchLocalException(r, ex); - return; } } diff --git a/js/src/Ice/Operation.js b/js/src/Ice/Operation.js index 211dc2c2a2f..5fd85b1404a 100644 --- a/js/src/Ice/Operation.js +++ b/js/src/Ice/Operation.js @@ -37,7 +37,7 @@ const builtinHelpers = function parseParam(p) { let type = p[0]; - const t = typeof(type); + const t = typeof type; if(t === 'number') { type = builtinHelpers[p[0]]; @@ -48,9 +48,9 @@ function parseParam(p) } return { - "type": type, - "isObject": (p[1] === true), - "tag": p[2] // Optional tag, which may not be present - an undefined tag means "not optional". + type: type, + isObject: (p[1] === true), + tag: p[2] // Optional tag, which may not be present - an undefined tag means "not optional". }; } @@ -181,23 +181,29 @@ function unmarshalParams(is, retvalInfo, allParamInfo, optParamInfo, usesClasses { if(p.isObject) { - is.readOptionalValue(p.tag, obj => params[p.pos + offset] = obj, p.type); + is.readOptionalValue(p.tag, + obj => + { + params[p.pos + offset] = obj; + }, + p.type); } else { params[p.pos + offset] = p.type.readOptional(is, p.tag); } } + else if(p.isObject) + { + is.readValue(obj => + { + params[p.pos + offset] = obj; + }, + p.type); + } else { - if(p.isObject) - { - is.readValue(obj => params[p.pos + offset] = obj, p.type); - } - else - { - params[p.pos + offset] = p.type.read(is); - } + params[p.pos + offset] = p.type.read(is); } }; @@ -277,7 +283,7 @@ function dispatchImpl(servant, op, incomingAsync, current) // Check to make sure the servant implements the operation. // const method = servant[op.servantMethod]; - if(method === undefined || typeof(method) !== "function") + if(method === undefined || typeof method !== "function") { throw new Ice.UnknownException("servant for identity " + current.adapter.getCommunicator().identityToString(current.id) + " does not define operation `" + op.servantMethod + "'"); @@ -492,10 +498,8 @@ function addProxyOperation(proxyType, name, data) let op = null; - proxyType.prototype[method] = function() + proxyType.prototype[method] = function(...args) { - const args = arguments; - // // Parse the operation data on the first invocation of a proxy method. // @@ -524,7 +528,7 @@ function addProxyOperation(proxyType, name, data) { if(!p.type.validate(v)) { - throw new Ice.MarshalException("invalid value for argument " + (i + 1) + + throw new Ice.MarshalException("invalid value for argument " + (i + 1) + " in operation `" + op.servantMethod + "'"); } } @@ -558,8 +562,8 @@ function addProxyOperation(proxyType, name, data) return results.length == 1 ? results[0] : results; }; } - return Ice.ObjectPrx._invoke(this, op.name, op.sendMode, op.format, ctx, marshalFn, unmarshalFn, - op.exceptions, Array.prototype.slice.call(args)); + return Ice.ObjectPrx._invoke(this, op.name, op.sendMode, op.format, ctx, marshalFn, unmarshalFn, + op.exceptions, Array.prototype.slice.call(args)); }; } @@ -578,7 +582,7 @@ Slice.defineOperations = function(classType, proxyType, ids, pos, ops) // const method = getServantMethod(classType, current.operation); - if(method === undefined || typeof(method) !== 'function') + if(method === undefined || typeof method !== 'function') { throw new Ice.OperationNotExistException(current.id, current.facet, current.operation); } @@ -633,7 +637,7 @@ Slice.defineOperations = function(classType, proxyType, ids, pos, ops) } Object.defineProperty(proxyType, "_id", { - get: function(){ return ids[pos]; } + get: () => ids[pos] }); } }; @@ -643,10 +647,10 @@ Slice.defineOperations = function(classType, proxyType, ids, pos, ops) // Slice.defineOperations(Ice.Object, Ice.ObjectPrx, ["::Ice::Object"], 0, { - "ice_ping": [, 1, 1, , , , , ], - "ice_isA": [, 1, 1, , [1], [[7]], , ], - "ice_id": [, 1, 1, , [7], , , ], - "ice_ids": [, 1, 1, , ["Ice.StringSeqHelper"], , , ] + ice_ping: [undefined, 1, 1, undefined, undefined, undefined, undefined, undefined], + ice_isA: [undefined, 1, 1, undefined, [1], [[7]], undefined, undefined], + ice_id: [undefined, 1, 1, undefined, [7], undefined, undefined, undefined], + ice_ids: [undefined, 1, 1, undefined, ["Ice.StringSeqHelper"], undefined, undefined, undefined] }); module.exports.Ice = Ice; diff --git a/js/src/Ice/OutgoingAsync.js b/js/src/Ice/OutgoingAsync.js index 0fdfe1cb794..c8fe3a4d6e3 100644 --- a/js/src/Ice/OutgoingAsync.js +++ b/js/src/Ice/OutgoingAsync.js @@ -124,7 +124,7 @@ class ProxyOutgoingAsyncBase extends OutgoingAsyncBase { try { - this._sent = false; + this._sent = false; this._handler = this._proxy._getRequestHandler(); if((this._handler.sendAsyncRequest(this) & AsyncStatus.Sent) > 0) { @@ -184,7 +184,7 @@ class ProxyOutgoingAsyncBase extends OutgoingAsyncBase handleException(ex) { - const interval = { value: 0 }; + const interval = {value: 0}; this._cnt = this._proxy._handleException(ex, this._handler, this._mode, this._sent, interval, this._cnt); return interval.value; } @@ -232,7 +232,7 @@ class OutgoingAsync extends ProxyOutgoingAsyncBase } else { - Ice.StringSeqHelper.write(this._os, [ facet ]); + Ice.StringSeqHelper.write(this._os, [facet]); } this._os.writeString(this._operation); @@ -525,11 +525,6 @@ class ProxyFlushBatch extends ProxyOutgoingAsyncBase class ProxyGetConnection extends ProxyOutgoingAsyncBase { - constructor(prx, operation) - { - super(prx, operation); - } - invokeRemote(connection, response) { this.markFinished(true, r => r.resolve(connection)); diff --git a/js/src/Ice/OutgoingConnectionFactory.js b/js/src/Ice/OutgoingConnectionFactory.js index 79ad1327686..a2ef3c054b2 100644 --- a/js/src/Ice/OutgoingConnectionFactory.js +++ b/js/src/Ice/OutgoingConnectionFactory.js @@ -202,14 +202,18 @@ class OutgoingConnectionFactory applyOverrides(endpts) { const defaultsAndOverrides = this._instance.defaultsAndOverrides(); - return endpts.map(endpoint => - { - // - // Modify endpoints with overrides. - // - return defaultsAndOverrides.overrideTimeout ? - endpoint.changeTimeout(defaultsAndOverrides.overrideTimeoutValue) : endpoint; - }); + return endpts.map( + endpoint => + { + if(defaultsAndOverrides.overrideTimeout) + { + return endpoint.changeTimeout(defaultsAndOverrides.overrideTimeoutValue); + } + else + { + return endpoint; + } + }); } findConnectionByEndpoint(endpoints) @@ -410,12 +414,9 @@ class OutgoingConnectionFactory connectionCallbacks.push(cc); } } - else + else if(callbacks.indexOf(cc) === -1) { - if(callbacks.indexOf(cc) === -1) - { - callbacks.push(cc); - } + callbacks.push(cc); } }); } @@ -465,12 +466,9 @@ class OutgoingConnectionFactory failedCallbacks.push(cc); } } - else + else if(callbacks.indexOf(cc) === -1) { - if(callbacks.indexOf(cc) === -1) - { - callbacks.push(cc); - } + callbacks.push(cc); } }); } @@ -559,16 +557,13 @@ class OutgoingConnectionFactory { s.push("\n"); } + else if(hasMore) + { + s.push(", trying next endpoint\n"); + } else { - if(hasMore) - { - s.push(", trying next endpoint\n"); - } - else - { - s.push(" and no more endpoints to try\n"); - } + s.push(" and no more endpoints to try\n"); } s.push(ex.toString()); this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); @@ -586,16 +581,13 @@ class OutgoingConnectionFactory { s.push("\n"); } + else if(hasMore) + { + s.push(", trying next endpoint\n"); + } else { - if(hasMore) - { - s.push(", trying next endpoint\n"); - } - else - { - s.push(" and no more endpoints to try\n"); - } + s.push(" and no more endpoints to try\n"); } s.push(ex.toString()); this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); @@ -831,7 +823,7 @@ class ConnectCallback nextEndpoint() { - const start = (connection) => + const start = connection => { connection.start().then( () => diff --git a/js/src/Ice/Promise.js b/js/src/Ice/Promise.js index 07469f02e55..0c4b5a1abfc 100644 --- a/js/src/Ice/Promise.js +++ b/js/src/Ice/Promise.js @@ -14,7 +14,8 @@ class P extends Promise { constructor(cb) { - let res, rej; + let res; + let rej; super((resolve, reject) => { res = resolve; @@ -33,8 +34,8 @@ class P extends Promise finally(cb) { return this.then( - (value) => P.resolve(cb()).then(() => value), - (reason) => P.resolve(cb()).then(() => { throw reason; })); + value => P.resolve(cb()).then(() => value), + reason => P.resolve(cb()).then(() => { throw reason; })); } delay(ms) diff --git a/js/src/Ice/Properties.js b/js/src/Ice/Properties.js index 6574e7ed064..098d144beca 100644 --- a/js/src/Ice/Properties.js +++ b/js/src/Ice/Properties.js @@ -43,7 +43,7 @@ class Properties // for(const [key, property] of defaults._properties) { - this._properties.set(key, { 'value': property.value, 'used': false }); + this._properties.set(key, {value: property.value, used: false}); } } @@ -212,7 +212,7 @@ class Properties { mismatchCase = true; otherKey = pattern.substr(2); - otherKey = otherKey.substr(0, otherKey.length -1); + otherKey = otherKey.substr(0, otherKey.length - 1); otherKey = otherKey.replace(/\\/g, ""); break; } @@ -242,7 +242,7 @@ class Properties } else { - this._properties.set(key, { 'value': value, 'used': false }); + this._properties.set(key, {value: value, used: false}); } } else @@ -452,6 +452,12 @@ class Properties } break; } + + default: + { + Debug.assert(false); + break; + } } if(finished) { diff --git a/js/src/Ice/PropertyNames.js b/js/src/Ice/PropertyNames.js index 5dc694c7c78..542d3b2889e 100644 --- a/js/src/Ice/PropertyNames.js +++ b/js/src/Ice/PropertyNames.js @@ -6,15 +6,17 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ../config/PropertyNames.xml, Sat Apr 28 20:49:27 2018 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Apr 30 21:00:34 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! +/* eslint comma-dangle: "off" */ +/* eslint array-bracket-newline: "off" */ +/* eslint no-useless-escape: "off" */ + const Ice = require("../Ice/Property").Ice; const PropertyNames = {}; const Property = Ice.Property; -/* jshint -W044*/ - PropertyNames.IceProps = [ new Property("/^Ice\.ACM\.Client/", true, null), @@ -196,8 +198,6 @@ PropertyNames.IceProps = new Property("/^Ice\.Voip/", false, null), ]; -/* jshint +W044*/ - PropertyNames.validProps = [ PropertyNames.IceProps, diff --git a/js/src/Ice/Protocol.js b/js/src/Ice/Protocol.js index 5d71e4ecf0a..75a0506214f 100644 --- a/js/src/Ice/Protocol.js +++ b/js/src/Ice/Protocol.js @@ -40,10 +40,9 @@ Ice.Protocol_1_0 = new Ice.ProtocolVersion(1, 0); Protocol.headerSize = 14; // -// The magic number at the front of each message +// The magic number at the front of each message ['I', 'c', 'e', 'P'] // -//Protocol.magic = [ 0x49, 0x63, 0x65, 0x50 ]; // 'I', 'c', 'e', 'P' -Protocol.magic = new Uint8Array([ 0x49, 0x63, 0x65, 0x50 ]); // 'I', 'c', 'e', 'P' +Protocol.magic = new Uint8Array([0x49, 0x63, 0x65, 0x50]); // // The current Ice protocol and encoding version @@ -89,7 +88,7 @@ Protocol.requestHdr = new Uint8Array([ Protocol.requestMsg, 0, // Compression status. 0, 0, 0, 0, // Message size (placeholder). - 0, 0, 0, 0 // Request ID (placeholder). + 0, 0, 0, 0 // Request ID (placeholder). ]); Protocol.requestBatchHdr = new Uint8Array([ @@ -104,7 +103,7 @@ Protocol.requestBatchHdr = new Uint8Array([ Protocol.requestBatchMsg, 0, // Compression status. 0, 0, 0, 0, // Message size (placeholder). - 0, 0, 0, 0 // Number of requests in batch (placeholder). + 0, 0, 0, 0 // Number of requests in batch (placeholder). ]); Protocol.replyHdr = new Uint8Array([ @@ -242,25 +241,25 @@ Ice.protocolVersionToString = function(v) }; /** -* Converts an encoding version to a string. -* -* @param v The encoding version to convert. -* -* @return The converted string. -**/ + * Converts an encoding version to a string. + * + * @param v The encoding version to convert. + * + * @return The converted string. + **/ Ice.encodingVersionToString = function(v) { return majorMinorToString(v.major, v.minor); }; -Protocol.OPTIONAL_END_MARKER = 0xFF; -Protocol.FLAG_HAS_TYPE_ID_STRING = (1<<0); -Protocol.FLAG_HAS_TYPE_ID_INDEX = (1<<1); -Protocol.FLAG_HAS_TYPE_ID_COMPACT = (1<<1 | 1<<0); -Protocol.FLAG_HAS_OPTIONAL_MEMBERS = (1<<2); -Protocol.FLAG_HAS_INDIRECTION_TABLE = (1<<3); -Protocol.FLAG_HAS_SLICE_SIZE = (1<<4); -Protocol.FLAG_IS_LAST_SLICE = (1<<5); +Protocol.OPTIONAL_END_MARKER = 0xFF; +Protocol.FLAG_HAS_TYPE_ID_STRING = (1 << 0); +Protocol.FLAG_HAS_TYPE_ID_INDEX = (1 << 1); +Protocol.FLAG_HAS_TYPE_ID_COMPACT = (1 << 1 | 1 << 0); +Protocol.FLAG_HAS_OPTIONAL_MEMBERS = (1 << 2); +Protocol.FLAG_HAS_INDIRECTION_TABLE = (1 << 3); +Protocol.FLAG_HAS_SLICE_SIZE = (1 << 4); +Protocol.FLAG_IS_LAST_SLICE = (1 << 5); Ice.Protocol = Protocol; module.exports.Ice = Ice; diff --git a/js/src/Ice/ProxyFactory.js b/js/src/Ice/ProxyFactory.js index fbd81e026af..ebd5f0e23b9 100644 --- a/js/src/Ice/ProxyFactory.js +++ b/js/src/Ice/ProxyFactory.js @@ -64,7 +64,7 @@ class ProxyFactory } else { - this._retryIntervals = [ 0 ]; + this._retryIntervals = [0]; } } diff --git a/js/src/Ice/Reference.js b/js/src/Ice/Reference.js index c7e8e4ededa..6e3771eae87 100644 --- a/js/src/Ice/Reference.js +++ b/js/src/Ice/Reference.js @@ -454,7 +454,7 @@ class ReferenceFactory } else { - quote = s.indexOf('\"', ++quote); + quote = s.indexOf("\"", ++quote); if(quote == -1) { break; @@ -1329,6 +1329,12 @@ class Reference s.push(" -D"); break; } + + default: + { + Debug.assert(false); + break; + } } if(this._secure) @@ -1634,6 +1640,12 @@ class FixedReference extends Reference } break; } + + default: + { + Debug.assert(false); + break; + } } // @@ -1992,8 +2004,8 @@ class RoutableReference extends Reference properties.set(prefix + ".EndpointSelection", this._endpointSelection === EndpointSelectionType.Random ? "Random" : "Ordered"); - properties.set(prefix + ".LocatorCacheTimeout", "" + this._locatorCacheTimeout); - properties.set(prefix + ".InvocationTimeout", "" + this.getInvocationTimeout()); + properties.set(prefix + ".LocatorCacheTimeout", String(this._locatorCacheTimeout)); + properties.set(prefix + ".InvocationTimeout", String(this.getInvocationTimeout())); if(this._routerInfo !== null) { @@ -2265,6 +2277,12 @@ class RoutableReference extends Reference endpoints = endpoints.filter(e => e.datagram()); break; } + + default: + { + Debug.assert(false); + break; + } } // @@ -2361,7 +2379,7 @@ class RoutableReference extends Reference // connection for one of the endpoints. // const cb = new CreateConnectionCallback(this, endpoints, promise); - factory.create([ endpoints[0] ], true, this.getEndpointSelection()).then( + factory.create([endpoints[0]], true, this.getEndpointSelection()).then( connection => cb.setConnection(connection)).catch(ex => cb.setException(ex)); } return promise; @@ -2410,9 +2428,9 @@ class CreateConnectionCallback } this.ref.getInstance().outgoingConnectionFactory().create( - [ this.endpoints[this.i] ], + [this.endpoints[this.i]], this.i != this.endpoints.length - 1, - this.ref.getEndpointSelection()).then(connection => this.setConnection(connection)) - .catch(ex => this.setException(ex)); + this.ref.getEndpointSelection()).then( + connection => this.setConnection(connection)).catch(ex => this.setException(ex)); } } diff --git a/js/src/Ice/RouterInfo.js b/js/src/Ice/RouterInfo.js index dd34a02669e..e14d42a52ab 100644 --- a/js/src/Ice/RouterInfo.js +++ b/js/src/Ice/RouterInfo.js @@ -79,7 +79,7 @@ class RouterInfo } else { - this._router.getClientProxy().then((result) => + this._router.getClientProxy().then(result => this.setClientEndpoints(result[0], result[1] !== undefined ? result[1] : true, promise)).catch(promise.reject); @@ -115,7 +115,7 @@ class RouterInfo } else { - return this._router.addProxies([ proxy ]).then( + return this._router.addProxies([proxy]).then( evictedProxies => { this.addAndEvictProxies(proxy, evictedProxies); diff --git a/js/src/Ice/ServantManager.js b/js/src/Ice/ServantManager.js index b858a0ecf80..b33a32b556b 100644 --- a/js/src/Ice/ServantManager.js +++ b/js/src/Ice/ServantManager.js @@ -30,9 +30,12 @@ class ServantManager { this._instance = instance; this._adapterName = adapterName; - this._servantMapMap = new HashMap(HashMap.compareEquals); // Map<Ice.Identity, Map<String, Ice.Object> > - this._defaultServantMap = new Map(); // Map<String, Ice.Object> - this._locatorMap = new Map(); // Map<String, Ice.ServantLocator> + // Map<Ice.Identity, Map<String, Ice.Object> > + this._servantMapMap = new HashMap(HashMap.compareEquals); + // Map<String, Ice.Object> + this._defaultServantMap = new Map(); + // Map<String, Ice.ServantLocator> + this._locatorMap = new Map(); } addServant(servant, ident, facet) @@ -50,19 +53,16 @@ class ServantManager m = new Map(); this._servantMapMap.set(ident, m); } - else + else if(m.has(facet)) { - if(m.has(facet)) + const ex = new Ice.AlreadyRegisteredException(); + ex.id = Ice.identityToString(ident, this._instance.toStringMode()); + ex.kindOfObject = "servant"; + if(facet.length > 0) { - const ex = new Ice.AlreadyRegisteredException(); - ex.id = Ice.identityToString(ident, this._instance.toStringMode()); - ex.kindOfObject = "servant"; - if(facet.length > 0) - { - ex.id += " -f " + StringUtil.escapeString(facet, "", this._instance.toStringMode()); - } - throw ex; + ex.id += " -f " + StringUtil.escapeString(facet, "", this._instance.toStringMode()); } + throw ex; } m.set(facet, servant); @@ -153,14 +153,6 @@ class ServantManager findServant(ident, facet) { - // - // This assert is not valid if the adapter dispatch incoming - // requests from bidir connections. This method might be called if - // requests are received over the bidir connection after the - // adapter was deactivated. - // - //Debug.assert(this._instance !== null); // Must not be called after destruction. - if(facet === null) { facet = ""; @@ -207,14 +199,6 @@ class ServantManager hasServant(ident) { - // - // This assert is not valid if the adapter dispatch incoming - // requests from bidir connections. This method might be called if - // requests are received over the bidir connection after the - // adapter was deactivated. - // - //Debug.assert(this._instance !== null); // Must not be called after destruction. - const m = this._servantMapMap.get(ident); if(m === undefined) { @@ -260,14 +244,6 @@ class ServantManager findServantLocator(category) { - // - // This assert is not valid if the adapter dispatch incoming - // requests from bidir connections. This method might be called if - // requests are received over the bidir connection after the - // adapter was deactivated. - // - //Debug.assert(this._instance !== null); // Must not be called after destruction. - const l = this._locatorMap.get(category); return l === undefined ? null : l; } diff --git a/js/src/Ice/Stream.js b/js/src/Ice/Stream.js index eb8fdd1dd45..573ad9bea12 100644 --- a/js/src/Ice/Stream.js +++ b/js/src/Ice/Stream.js @@ -163,7 +163,7 @@ class EncapsDecoder const obj = this._unmarshaledMap.get(index); if(obj !== undefined && obj !== null) { - cb.call(null, obj); + cb(obj); return; } @@ -303,7 +303,7 @@ class EncapsDecoder10 extends EncapsDecoder if(index === 0) { - cb.call(null, null); + cb(null); } else { @@ -384,7 +384,7 @@ class EncapsDecoder10 extends EncapsDecoder this._skipFirstSlice = true; } - endInstance(/*preserve*/) + endInstance(preserve) { // // Read the Ice::Object slice. @@ -558,7 +558,7 @@ class EncapsDecoder11 extends EncapsDecoder { if(cb !== null) { - cb.call(null, null); + cb(null); } } else if(this._current !== null && (this._current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) !== 0) @@ -793,25 +793,19 @@ class EncapsDecoder11 extends EncapsDecoder Debug.assert(this._current.sliceSize >= 4); this._stream.skip(this._current.sliceSize - 4); } + else if(this._current.sliceType === SliceType.ValueSlice) + { + throw new Ice.NoValueFactoryException("no value factory found and compact format prevents slicing " + + "(the sender should use the sliced format instead)", + this._current.typeId); + } + else if(this._current.typeId.indexOf("::") === 0) + { + throw new Ice.UnknownUserException(this._current.typeId.substring(2)); + } else { - if(this._current.sliceType === SliceType.ValueSlice) - { - throw new Ice.NoValueFactoryException("no value factory found and compact format prevents slicing " + - "(the sender should use the sliced format instead)", - this._current.typeId); - } - else - { - if(this._current.typeId.indexOf("::") === 0) - { - throw new Ice.UnknownUserException(this._current.typeId.substring(2)); - } - else - { - throw new Ice.UnknownUserException(this._current.typeId); - } - } + throw new Ice.UnknownUserException(this._current.typeId); } // @@ -998,7 +992,7 @@ class EncapsDecoder11 extends EncapsDecoder if(cb !== null) { - cb.call(null, v); + cb(v); } return index; @@ -1067,7 +1061,7 @@ EncapsDecoder11.InstanceData = class // Instance attributes this.sliceType = null; this.skipFirstSlice = false; - this.slices = null; // Preserved slices. Ice.SliceInfo[] + this.slices = null; // Preserved slices. Ice.SliceInfo[] this.indirectionTables = null; // int[][] // Slice attributes @@ -1832,14 +1826,7 @@ class InputStream readValue(cb, T) { this.initEncaps(); - // - // BUGFIX: - // With Chrome on Linux the invocation of readValue on the decoder sometimes - // calls InputStream.readValue with the decoder object as this param. - // Use call instead of directly invoking the method to workaround this bug. - // - this._encapsStack.decoder.readValue.call( - this._encapsStack.decoder, + this._encapsStack.decoder.readValue( cb === null ? null : obj => { if(obj !== null && !(obj instanceof T)) @@ -1923,29 +1910,50 @@ class InputStream switch(format) { case OptionalFormat.F1: + { this.skip(1); break; + } case OptionalFormat.F2: + { this.skip(2); break; + } case OptionalFormat.F4: + { this.skip(4); break; + } case OptionalFormat.F8: + { this.skip(8); break; + } case OptionalFormat.Size: + { this.skipSize(); break; + } case OptionalFormat.VSize: + { this.skip(this.readSize()); break; + } case OptionalFormat.FSize: + { this.skip(this.readInt()); break; + } case OptionalFormat.Class: + { this.readValue(null, Ice.Value); break; + } + default: + { + Debug.assert(false); + break; + } } } @@ -2027,8 +2035,7 @@ class InputStream createUserException(id) { - let userEx = null, Class; - + let userEx = null; try { const typeId = id.length > 2 ? id.substr(2).replace(/::/g, ".") : ""; @@ -2261,7 +2268,7 @@ class EncapsEncoder10 extends EncapsEncoder { super(stream, encaps); this._sliceType = SliceType.NoSlice; - this._writeSlice = 0; // Position of the slice data members + this._writeSlice = 0; // Position of the slice data members this._valueIdIndex = 0; this._toBeMarshaledMap = new Map(); // Map<Ice.Value, Integer>(); } @@ -2746,7 +2753,7 @@ EncapsEncoder11.InstanceData = class // Slice attributes this.sliceFlags = 0; - this.writeSlice = 0; // Position of the slice data members + this.writeSlice = 0; // Position of the slice data members this.sliceFlagsPos = 0; // Position of the slice flags this.indirectionTable = null; // Ice.Value[] this.indirectionMap = null; // Map<Ice.Value, int> @@ -3487,7 +3494,10 @@ Ice.ObjectHelper = class static read(is) { let o; - is.readValue(v => o = v, Ice.Value); + is.readValue(v => + { + o = v; + }, Ice.Value); return o; } @@ -3499,7 +3509,10 @@ Ice.ObjectHelper = class static readOptional(is, tag) { let o; - is.readOptionalValue(tag, v => o = v, Ice.Value); + is.readOptionalValue(tag, v => + { + o = v; + }, Ice.Value); return o; } diff --git a/js/src/Ice/StreamHelpers.js b/js/src/Ice/StreamHelpers.js index 3fc8c132b83..58077da5e47 100644 --- a/js/src/Ice/StreamHelpers.js +++ b/js/src/Ice/StreamHelpers.js @@ -154,11 +154,10 @@ class SequenceHelper // Speacialization optimized for ByteSeq const byteSeqHelper = new SequenceHelper(); -byteSeqHelper.write = function(os, v) { return os.writeByteSeq(v); }; -byteSeqHelper.read = function(is) { return is.readByteSeq(); }; -defineProperty(byteSeqHelper, "elementHelper", { - get: function(){ return Ice.ByteHelper; } -}); +byteSeqHelper.write = (os, v) => os.writeByteSeq(v); +byteSeqHelper.read = is => is.readByteSeq(); + +defineProperty(byteSeqHelper, "elementHelper", {get: () => Ice.ByteHelper}); StreamHelpers.VSizeContainer1OptHelper.call(byteSeqHelper); // Read method for value sequences @@ -170,7 +169,10 @@ const valueSequenceHelperRead = function(is) const elementType = this.elementType; const readValueAtIndex = function(idx) { - is.readValue(obj => v[idx] = obj, elementType); + is.readValue(obj => + { + v[idx] = obj; + }, elementType); }; for(let i = 0; i < sz; ++i) @@ -204,15 +206,11 @@ StreamHelpers.generateSeqHelper = function(elementHelper, fixed, elementType) StreamHelpers.FSizeOptHelper.call(helper); } - defineProperty(helper, "elementHelper", { - get: function(){ return elementHelper; } - }); + defineProperty(helper, "elementHelper", {get: () => elementHelper}); if(elementHelper == Ice.ObjectHelper) { - defineProperty(helper, "elementType", { - get: function(){ return elementType; } - }); + defineProperty(helper, "elementType", {get: () => elementType}); helper.read = valueSequenceHelperRead; } @@ -301,23 +299,28 @@ StreamHelpers.generateDictHelper = function(keyHelper, valueHelper, fixed, value StreamHelpers.FSizeOptHelper.call(helper); } - defineProperty(helper, "mapType", { - get: function(){ return mapType; } - }); + defineProperty(helper, + "mapType", + { + get: () => mapType + }); - defineProperty(helper, "keyHelper", { - get: function(){ return keyHelper; } - }); + defineProperty(helper, "keyHelper", + { + get: () => keyHelper + }); - defineProperty(helper, "valueHelper", { - get: function(){ return valueHelper; } - }); + defineProperty(helper, "valueHelper", + { + get: () => valueHelper + }); if(valueHelper == Ice.ObjectHelper) { - defineProperty(helper, "valueType", { - get: function(){ return valueType; } - }); + defineProperty(helper, "valueType", + { + get: () => valueType + }); helper.read = valueDictionaryHelperRead; } diff --git a/js/src/Ice/StringUtil.js b/js/src/Ice/StringUtil.js index b9edaacd970..3bef1d37639 100644 --- a/js/src/Ice/StringUtil.js +++ b/js/src/Ice/StringUtil.js @@ -30,6 +30,7 @@ Ice.StringUtil = class } return -1; } + // // Return the index of the first character in str which does // not appear in match, starting from start. Returns -1 if none is @@ -48,6 +49,7 @@ Ice.StringUtil = class } return -1; } + // // Add escape sequences (such as "\n", or "\123") to s // @@ -113,6 +115,7 @@ Ice.StringUtil = class } return result.join(""); } + // // Remove escape sequences added by escapeString. Throws Error // for an invalid input string. @@ -157,6 +160,7 @@ Ice.StringUtil = class return arr.join(""); } } + // // Split string helper; returns null for unmatched quotes // @@ -220,6 +224,7 @@ Ice.StringUtil = class return v; } + // // If a single or double quotation mark is found at the start position, // then the position of the matching closing quote is returned. If no @@ -247,6 +252,7 @@ Ice.StringUtil = class } return 0; // Not quoted } + static hashCode(s) { let hash = 0; @@ -256,6 +262,7 @@ Ice.StringUtil = class } return hash; } + static toInt(s) { const n = parseInt(s, 10); @@ -347,55 +354,52 @@ function encodeChar(c, sb, special, toStringMode) sb.push('\\'); sb.push(s); } - else + else if(c < 32 || c > 126) { - if(c < 32 || c > 126) + if(toStringMode === Ice.ToStringMode.Compat) { - if(toStringMode === Ice.ToStringMode.Compat) + // + // When ToStringMode=Compat, c is a UTF-8 byte + // + Debug.assert(c < 256); + sb.push('\\'); + const octal = c.toString(8); + // + // Add leading zeroes so that we avoid problems during + // decoding. For example, consider the encoded string + // \0013 (i.e., a character with value 1 followed by + // the character '3'). If the leading zeroes were omitted, + // the result would be incorrectly interpreted by the + // decoder as a single character with value 11. + // + for(let j = octal.length; j < 3; j++) { - // - // When ToStringMode=Compat, c is a UTF-8 byte - // - Debug.assert(c < 256); - sb.push('\\'); - const octal = c.toString(8); - // - // Add leading zeroes so that we avoid problems during - // decoding. For example, consider the encoded string - // \0013 (i.e., a character with value 1 followed by - // the character '3'). If the leading zeroes were omitted, - // the result would be incorrectly interpreted by the - // decoder as a single character with value 11. - // - for(let j = octal.length; j < 3; j++) - { - sb.push('0'); - } - sb.push(octal); + sb.push('0'); } - else if(c < 32 || c == 127 || toStringMode === Ice.ToStringMode.ASCII) - { - // append \\unnnn - sb.push("\\u"); - const hex = c.toString(16); - for(let j = hex.length; j < 4; j++) - { - sb.push('0'); - } - sb.push(hex); - } - else + sb.push(octal); + } + else if(c < 32 || c == 127 || toStringMode === Ice.ToStringMode.ASCII) + { + // append \\unnnn + sb.push("\\u"); + const hex = c.toString(16); + for(let j = hex.length; j < 4; j++) { - // keep as is - sb.push(s); + sb.push('0'); } + sb.push(hex); } else { - // printable ASCII character + // keep as is sb.push(s); } } + else + { + // printable ASCII character + sb.push(s); + } break; } } diff --git a/js/src/Ice/Struct.js b/js/src/Ice/Struct.js index 96a4a2a3bb2..fa9e6b60a7b 100644 --- a/js/src/Ice/Struct.js +++ b/js/src/Ice/Struct.js @@ -97,7 +97,7 @@ function memberHashCode(h, e) } else { - const t = typeof(e); + const t = typeof e; if(e instanceof String || t == "string") { return Ice.HashUtil.addString(h, e); diff --git a/js/src/Ice/TcpEndpointI.js b/js/src/Ice/TcpEndpointI.js index 8ce8f6259e1..9d905aa1955 100644 --- a/js/src/Ice/TcpEndpointI.js +++ b/js/src/Ice/TcpEndpointI.js @@ -24,7 +24,7 @@ const IceSSL = Ice._ModuleRegistry.require(module, ["../Ice/EndpointInfo"]).IceS const Debug = Ice.Debug; const HashUtil = Ice.HashUtil; const StringUtil = Ice.StringUtil; -const TcpTransceiver = typeof(Ice.TcpTransceiver) !== "undefined" ? Ice.TcpTransceiver : null; +const TcpTransceiver = typeof Ice.TcpTransceiver !== "undefined" ? Ice.TcpTransceiver : null; class TcpEndpointI extends Ice.IPEndpointI { diff --git a/js/src/Ice/TcpTransceiver.js b/js/src/Ice/TcpTransceiver.js index ffad377425a..9ce88207d89 100644 --- a/js/src/Ice/TcpTransceiver.js +++ b/js/src/Ice/TcpTransceiver.js @@ -45,6 +45,7 @@ class TcpTransceiver this._bytesAvailableCallback = bytesAvailableCallback; this._bytesWrittenCallback = bytesWrittenCallback; } + // // Returns SocketOperation.None when initialization is complete. // @@ -60,9 +61,12 @@ class TcpTransceiver if(this._state === StateNeedConnect) { this._state = StateConnectPending; - this._fd = net.createConnection({port: this._addr.port, - host: this._addr.host, - localAddress: this._sourceAddr}); + this._fd = net.createConnection( + { + port: this._addr.port, + host: this._addr.host, + localAddress: this._sourceAddr + }); this._fd.on("connect", () => this.socketConnected()); this._fd.on("data", buf => this.socketBytesAvailable(buf)); @@ -160,6 +164,7 @@ class TcpTransceiver this._fd = null; } } + // // Returns true if all of the data was flushed to the kernel buffer. // @@ -183,7 +188,12 @@ class TcpTransceiver const slice = byteBuffer.b.slice(byteBuffer.position, byteBuffer.position + packetSize); let sync = true; - /*jshint -W083 */ + // + // XXX: diasble for compatibility with Node 4.x replace by + // Buffer.from when we drop support to Node 4.x + // + + /* eslint-disable no-buffer-constructor */ sync = this._fd.write(new Buffer(slice), null, () => { if(!sync) @@ -191,9 +201,9 @@ class TcpTransceiver this._bytesWrittenCallback(); } }); - /*jshint +W083 */ + /* eslint-enable no-buffer-constructor */ - byteBuffer.position = byteBuffer.position + packetSize; + byteBuffer.position += packetSize; if(!sync) { return false; // Wait for callback to be called before sending more data. @@ -235,8 +245,15 @@ class TcpTransceiver avail = byteBuffer.remaining; } + // + // XXX: diasble for compatibility with Node 4.x replace by + // Buffer.from when we drop support to Node 4.x + // + + /* eslint-disable no-buffer-constructor */ this._readBuffers[0].copy(new Buffer(byteBuffer.b), byteBuffer.position, this._readPosition, this._readPosition + avail); + /* eslint-enable no-buffer-constructor */ byteBuffer.position += avail; this._readPosition += avail; diff --git a/js/src/Ice/Timer.js b/js/src/Ice/Timer.js index 0cff34b1c46..1842edfe572 100644 --- a/js/src/Ice/Timer.js +++ b/js/src/Ice/Timer.js @@ -37,7 +37,7 @@ class Timer } const token = this._tokenId++; const id = Timer.setTimeout(() => this.handleTimeout(token), delay); - this._tokens.set(token, { callback: callback, id: id, isInterval: false }); + this._tokens.set(token, {callback: callback, id: id, isInterval: false}); return token; } @@ -49,7 +49,7 @@ class Timer } const token = this._tokenId++; const id = Timer.setInterval(() => this.handleInterval(token), period); - this._tokens.set(token, { callback: callback, id: id, isInterval: true }); + this._tokens.set(token, {callback: callback, id: id, isInterval: true}); return token; } diff --git a/js/src/Ice/ToStringMode.js b/js/src/Ice/ToStringMode.js index cf40f644434..80ef16066fa 100644 --- a/js/src/Ice/ToStringMode.js +++ b/js/src/Ice/ToStringMode.js @@ -8,5 +8,10 @@ // ********************************************************************** const Ice = require("../Ice/EnumBase").Ice; -Ice.ToStringMode = Ice.Slice.defineEnum([['Unicode', 0], ['ASCII',1], ['Compat',2]]); +Ice.ToStringMode = Ice.Slice.defineEnum( + [ + ['Unicode', 0], + ['ASCII', 1], + ['Compat', 2] + ]); module.exports.Ice = Ice; diff --git a/js/src/Ice/TraceUtil.js b/js/src/Ice/TraceUtil.js index ab5aa925661..9d4bcca754d 100644 --- a/js/src/Ice/TraceUtil.js +++ b/js/src/Ice/TraceUtil.js @@ -224,7 +224,7 @@ function printRequestHeader(s, stream) { const key = stream.readString(); const value = stream.readString(); - s.push(key + '/'+ value); + s.push(key + '/' + value); if(sz > 0) { s.push(", "); @@ -241,7 +241,7 @@ function printRequestHeader(s, stream) function printHeader(s, stream) { - stream.readByte(); // Don't bother printing the magic number + stream.readByte(); // Don't bother printing the magic number stream.readByte(); stream.readByte(); stream.readByte(); @@ -348,7 +348,7 @@ function getMessageTypeAsString(type) case Protocol.closeConnectionMsg: return "close connection"; case Protocol.validateConnectionMsg: - return "validate connection"; + return "validate connection"; default: return "unknown"; } @@ -469,7 +469,7 @@ class TraceUtil } else { - s = "" + n; + s = String(n); } buf.push(s + " "); } diff --git a/js/src/Ice/UnknownSlicedValue.js b/js/src/Ice/UnknownSlicedValue.js index 6bf779cffee..9ee01b89724 100644 --- a/js/src/Ice/UnknownSlicedValue.js +++ b/js/src/Ice/UnknownSlicedValue.js @@ -13,34 +13,34 @@ class SliceInfo { constructor() { - /** - * The Slice type ID for this slice. - **/ + // + // The Slice type ID for this slice. + // this.typeId = ""; - /** - * The Slice compact type ID for this slice. - **/ + // + // The Slice compact type ID for this slice. + // this.compactId = -1; - /** - * The encoded bytes for this slice, including the leading size integer. - **/ + // + // The encoded bytes for this slice, including the leading size integer. + // this.bytes = []; - /** - * The class instances referenced by this slice. - **/ + // + // The class instances referenced by this slice. + // this.instances = []; - /** - * Whether or not the slice contains optional members. - **/ + // + // Whether or not the slice contains optional members. + // this.hasOptionalMembers = false; - /** - * Whether or not this is the last slice. - **/ + // + // Whether or not this is the last slice. + // this.isLastSlice = false; } } diff --git a/js/src/Ice/Value.js b/js/src/Ice/Value.js index 9d40e2fea7c..f5700829193 100644 --- a/js/src/Ice/Value.js +++ b/js/src/Ice/Value.js @@ -63,15 +63,21 @@ Ice.Value = class static read(is) { - const v = { value: null }; - is.readValue(o => v.value = o, this); + const v = {value: null}; + is.readValue(o => + { + v.value = o; + }, this); return v; } static readOptional(is, tag) { - const v = { value: undefined }; - is.readOptionalValue(tag, o => v.value = o, this); + const v = {value: undefined}; + is.readOptionalValue(tag, o => + { + v.value = o; + }, this); return v; } }; @@ -123,7 +129,7 @@ const writeImpl = function(obj, os, type) } os.startSlice(type.ice_staticId(), - Object.prototype.hasOwnProperty.call(type, '_iceCompactId') ? type._iceCompactId : -1 , + Object.prototype.hasOwnProperty.call(type, '_iceCompactId') ? type._iceCompactId : -1, Object.getPrototypeOf(type) === Ice.Value); if(type.prototype.hasOwnProperty('_iceWriteMemberImpl')) { diff --git a/js/src/Ice/WSEndpoint.js b/js/src/Ice/WSEndpoint.js index cf588c89050..becfd0c90bd 100644 --- a/js/src/Ice/WSEndpoint.js +++ b/js/src/Ice/WSEndpoint.js @@ -213,21 +213,11 @@ class WSEndpoint extends EndpointI } return true; } -} -if(typeof(Ice.WSTransceiver) !== "undefined") -{ - WSEndpoint.prototype.connectable = function() + connectable() { - return true; - }; -} -else -{ - WSEndpoint.prototype.connectable = function() - { - return false; - }; + return typeof Ice.WSTransceiver !== "undefined"; + } } Ice.WSEndpoint = WSEndpoint; diff --git a/js/src/Ice/browser/ModuleRegistry.js b/js/src/Ice/browser/ModuleRegistry.js index 514e6115d57..4571803fce3 100644 --- a/js/src/Ice/browser/ModuleRegistry.js +++ b/js/src/Ice/browser/ModuleRegistry.js @@ -10,9 +10,9 @@ /* global self : false */ -const root = typeof(window) !== "undefined" ? window : - typeof(global) !== "undefined" ? global : - typeof(self) !== "undefined" ? self : {}; +const root = typeof window !== "undefined" ? window : + typeof global !== "undefined" ? global : + typeof self !== "undefined" ? self : {}; /* global self : true */ @@ -25,7 +25,7 @@ class _ModuleRegistry if(m === undefined) { m = {}; - root[name] = m; + root[name] = m; } return m; } diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js index 54388e04c66..abe9ddfde97 100644 --- a/js/src/Ice/browser/TimerUtil.js +++ b/js/src/Ice/browser/TimerUtil.js @@ -27,44 +27,40 @@ function createTimerObject() { static setTimeout(cb, ms) { - return setTimeout.apply(null, arguments); + return setTimeout(cb, ms); } static clearTimeout(id) { - return clearTimeout.apply(null, arguments); + return clearTimeout(id); } - static setInterval() + static setInterval(cb, ms) { - return setInterval.apply(null, arguments); + return setInterval(cb, ms); } - static clearInterval() + static clearInterval(id) { - return clearInterval.apply(null, arguments); + return clearInterval(id); } - }; - if(typeof(setImmediate) == "function") - { - Timer.setImmediate = function() - { - return setImmediate.apply(null, arguments); - }; - } - else - { - Timer.setImmediate = function() + static setImmediate(cb) { - return setTimeout.apply(null, arguments); - }; - } - + if(typeof setImmediate == "function") + { + return setImmediate(cb); + } + else + { + return setTimeout(cb); + } + } + }; return Timer; } -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; const _timers = new Map(); @@ -204,7 +200,7 @@ else if(typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobal } else if(worker === undefined) { - const url = URL.createObjectURL(new Blob([workerCode()], {type : 'text/javascript'})); + const url = URL.createObjectURL(new Blob([workerCode()], {type: 'text/javascript'})); worker = new Worker(url); worker.onmessage = Timer.onmessage; Ice.Timer = Timer; diff --git a/js/src/Ice/browser/WSTransceiver.js b/js/src/Ice/browser/WSTransceiver.js index 5ecee521186..b86f7c65c26 100644 --- a/js/src/Ice/browser/WSTransceiver.js +++ b/js/src/Ice/browser/WSTransceiver.js @@ -52,7 +52,7 @@ class WSTransceiver writeReadyTimeout() { const t = Math.round(this._writeReadyTimeout); - this._writeReadyTimeout += (this._writeReadyTimeout >= 5 ? 5 : 0.2); + this._writeReadyTimeout += (this._writeReadyTimeout >= 5 ? 5 : 0.2); return Math.min(t, 25); } @@ -62,6 +62,7 @@ class WSTransceiver this._bytesAvailableCallback = bytesAvailableCallback; this._bytesWrittenCallback = bytesWrittenCallback; } + // // Returns SocketOperation.None when initialization is complete. // diff --git a/js/src/IceGrid/IceGrid.js b/js/src/IceGrid/IceGrid.js index d57ed61575d..b3869d2e065 100644 --- a/js/src/IceGrid/IceGrid.js +++ b/js/src/IceGrid/IceGrid.js @@ -7,7 +7,7 @@ // // ********************************************************************** -var _ModuleRegistry = require("../Ice/ModuleRegistry").Ice._ModuleRegistry; +const _ModuleRegistry = require("../Ice/ModuleRegistry").Ice._ModuleRegistry; module.exports.IceGrid = _ModuleRegistry.require(module, [ diff --git a/js/src/es5/index.js b/js/src/es5/index.js index b9f004f3292..d8ed521ab93 100644 --- a/js/src/es5/index.js +++ b/js/src/es5/index.js @@ -8,9 +8,9 @@ // ********************************************************************** require("babel-polyfill"); -module.exports.Ice = require("./Ice/Ice").Ice; -module.exports.IceMX = require("./Ice/Ice").IceMX; -module.exports.IceSSL = require("./Ice/Ice").IceSSL; +module.exports.Ice = require("./Ice/Ice").Ice; +module.exports.IceMX = require("./Ice/Ice").IceMX; +module.exports.IceSSL = require("./Ice/Ice").IceSSL; module.exports.Glacier2 = require("./Glacier2/Glacier2").Glacier2; -module.exports.IceGrid = require("./IceGrid/IceGrid").IceGrid; +module.exports.IceGrid = require("./IceGrid/IceGrid").IceGrid; module.exports.IceStorm = require("./IceStorm/IceStorm").IceStorm; diff --git a/js/src/index.js b/js/src/index.js index 59e8553e934..f883df3aa83 100644 --- a/js/src/index.js +++ b/js/src/index.js @@ -7,9 +7,9 @@ // // ********************************************************************** -module.exports.Ice = require("./Ice/Ice").Ice; -module.exports.IceMX = require("./Ice/Ice").IceMX; -module.exports.IceSSL = require("./Ice/Ice").IceSSL; +module.exports.Ice = require("./Ice/Ice").Ice; +module.exports.IceMX = require("./Ice/Ice").IceMX; +module.exports.IceSSL = require("./Ice/Ice").IceSSL; module.exports.Glacier2 = require("./Glacier2/Glacier2").Glacier2; -module.exports.IceGrid = require("./IceGrid/IceGrid").IceGrid; +module.exports.IceGrid = require("./IceGrid/IceGrid").IceGrid; module.exports.IceStorm = require("./IceStorm/IceStorm").IceStorm; diff --git a/js/test/Common/.jshintrc b/js/test/Common/.jshintrc deleted file mode 100644 index 289afb198d2..00000000000 --- a/js/test/Common/.jshintrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends" : "../../.jshintrc_browser", - "globals" : - { - "runController" : false - } -} diff --git a/js/test/Common/ControllerI.js b/js/test/Common/ControllerI.js index d4b59425d30..85e9bb69228 100644 --- a/js/test/Common/ControllerI.js +++ b/js/test/Common/ControllerI.js @@ -7,19 +7,12 @@ // // ********************************************************************** - /* global - _test : false, - _runServer : false, - Test : false, - WorkerGlobalScope : false, - _server: false, - _serveramd: false, - URI: false -*/ +/* globals Ice, Test, _server, _serveramd, _test, URI, WorkerGlobalScope */ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "isSafari|isChrome|isWorker|isWindows|runController" }] */ function isSafari() { - return /^((?!chrome).)*safari/i.test(navigator.userAgent); + return (/^((?!chrome).)*safari/i).test(navigator.userAgent); } function isChrome() @@ -33,7 +26,7 @@ function isChrome() function isWorker() { - return typeof(WorkerGlobalScope) !== 'undefined' && this instanceof WorkerGlobalScope; + return typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobalScope; } function isWindows() @@ -69,7 +62,7 @@ class ProcessI extends Test.Common.Process this._ready = ready; } - async waitReady(timeout, current) + async waitReady() { if(this._ready) { @@ -77,7 +70,7 @@ class ProcessI extends Test.Common.Process } } - async waitSuccess(timeout, current) + async waitSuccess() { try { @@ -111,7 +104,7 @@ class ProcessControllerI extends Test.Common.BrowserProcessController start(testSuite, exe, args, current) { - let es5 = document.location.pathname.indexOf("/es5/") !== -1; + const es5 = document.location.pathname.indexOf("/es5/") !== -1; let promise; let ready = null; let out; @@ -128,11 +121,11 @@ class ProcessControllerI extends Test.Common.BrowserProcessController if(this._useWorker) { - let scripts = this._scripts; + const scripts = this._scripts; promise = new Promise( (resolve, reject) => { - let worker = new Worker(es5 ? + const worker = new Worker(es5 ? "/test/es5/Common/ControllerWorker.js" : "/test/Common/ControllerWorker.js"); this._worker = worker; @@ -171,17 +164,17 @@ class ProcessControllerI extends Test.Common.BrowserProcessController worker.terminate(); } }; - worker.postMessage({ scripts:scripts, exe:exe, args:args }); + worker.postMessage({scripts: scripts, exe: exe, args: args}); }); } else { - let initData = new Ice.InitializationData(); + const initData = new Ice.InitializationData(); initData.properties = Ice.createProperties(args); if(exe === "Server" || exe === "ServerAMD") { initData.logger = new Logger(this._serverOutput); - let test = exe === "Server" ? _server : _serveramd; + const test = exe === "Server" ? _server : _serveramd; promise = test(this._serverOutput, initData, ready, args); } else @@ -193,7 +186,7 @@ class ProcessControllerI extends Test.Common.BrowserProcessController return Test.Common.ProcessPrx.uncheckedCast(current.adapter.addWithUUID(new ProcessI(promise, out, ready))); } - getHost(protocol, ipv6, current) + getHost() { return "127.0.0.1"; } @@ -237,16 +230,16 @@ async function runController(clientOutput, serverOutput, scripts) } } - let out = new Output(clientOutput); - let serverOut = new Output(serverOutput); + const out = new Output(clientOutput); + const serverOut = new Output(serverOutput); - let uri = new URI(document.location.href); - let protocol = uri.protocol() === "http" ? "ws" : "wss"; - let query = uri.search(true); - let port = query.port || 15002; - let worker = query.worker === "True"; + const uri = new URI(document.location.href); + const protocol = uri.protocol() === "http" ? "ws" : "wss"; + const query = uri.search(true); + const port = query.port || 15002; + const worker = query.worker === "True"; - let initData = new Ice.InitializationData(); + const initData = new Ice.InitializationData(); initData.logger = new Logger(out); initData.properties = Ice.createProperties(); initData.properties.setProperty("Ice.Override.ConnectTimeout", "1000"); @@ -256,11 +249,11 @@ async function runController(clientOutput, serverOutput, scripts) try { await registry.ice_ping(); - let connection = registry.ice_getCachedConnection(); + const connection = registry.ice_getCachedConnection(); connection.setAdapter(adapter); connection.setACM(5, Ice.ACMClose.CloseOff, Ice.ACMHeartbeat.HeartbeatAlways); connection.setCloseCallback( - connection => out.writeLine("connection with process controller registry closed")); + () => out.writeLine("connection with process controller registry closed")); await registry.setProcessController(Test.Common.ProcessControllerPrx.uncheckedCast(processController)); } catch(ex) @@ -280,11 +273,11 @@ async function runController(clientOutput, serverOutput, scripts) try { comm = Ice.initialize(initData); - let str = `Util/ProcessControllerRegistry:${protocol} -h ${document.location.hostname} -p ${port}`; - let registry = Test.Common.ProcessControllerRegistryPrx.uncheckedCast(comm.stringToProxy(str)); - let adapter = await comm.createObjectAdapter(""); - let ident = new Ice.Identity("ProcessController", "Browser"); - let processController = adapter.add(new ProcessControllerI(out, serverOut, worker, scripts), ident); + const str = `Util/ProcessControllerRegistry:${protocol} -h ${document.location.hostname} -p ${port}`; + const registry = Test.Common.ProcessControllerRegistryPrx.uncheckedCast(comm.stringToProxy(str)); + const adapter = await comm.createObjectAdapter(""); + const ident = new Ice.Identity("ProcessController", "Browser"); + const processController = adapter.add(new ProcessControllerI(out, serverOut, worker, scripts), ident); adapter.activate(); registerProcessController(adapter, registry, processController); } diff --git a/js/test/Common/ControllerWorker.js b/js/test/Common/ControllerWorker.js index 9d3ce074b06..178b6000007 100644 --- a/js/test/Common/ControllerWorker.js +++ b/js/test/Common/ControllerWorker.js @@ -7,32 +7,26 @@ // // ********************************************************************** -/* global - self : false, - runTest : false, - _server : false, - _serveramd : false, - _test : false -*/ +/* global self, _server, _serveramd, _test, Ice */ class Output { static write(message) { - self.postMessage({type:"write", message:message}); + self.postMessage({type: "write", message: message}); } static writeLine(message) { - self.postMessage({type:"writeLine", message:message}); + self.postMessage({type: "writeLine", message: message}); } } -self.onmessage = async (e) => +self.onmessage = async e => { try { - for(let script of e.data.scripts) + for(const script of e.data.scripts) { self.importScripts(script); } @@ -50,16 +44,16 @@ self.onmessage = async (e) => } let promise; - let initData = new Ice.InitializationData(); + const initData = new Ice.InitializationData(); initData.properties = Ice.createProperties(e.data.args); initData.logger = new Logger(); if(e.data.exe === "Server" || e.data.exe === "ServerAMD") { - let ready = new Ice.Promise(); - let test = e.data.exe === "Server" ? _server : _serveramd; + const ready = new Ice.Promise(); + const test = e.data.exe === "Server" ? _server : _serveramd; promise = test(Output, initData, ready, e.data.args); await ready; - self.postMessage({type:"ready"}); + self.postMessage({type: "ready"}); } else { @@ -67,10 +61,10 @@ self.onmessage = async (e) => } await promise; - self.postMessage({ type: "finished" }); + self.postMessage({type: "finished"}); } catch(ex) { - self.postMessage({ type: "finished", exception:ex.toString() }); + self.postMessage({type: "finished", exception: ex.toString()}); } }; diff --git a/js/test/Common/TestRunner.js b/js/test/Common/TestRunner.js index ddbad8eed9a..cec1f1d3bb8 100644 --- a/js/test/Common/TestRunner.js +++ b/js/test/Common/TestRunner.js @@ -7,17 +7,12 @@ // // ********************************************************************** - /* global - _test : false, - _runServer : false, - _server: false, - Test : false, - WorkerGlobalScope: false -*/ +/* global _test, _runServer, _server, Test, WorkerGlobalScope, Ice */ +/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "isSafari|isChrome|isWorker|isWindows|runTest" }] */ function isSafari() { - return /^((?!chrome).)*safari/i.test(navigator.userAgent); + return (/^((?!chrome).)*safari/i).test(navigator.userAgent); } function isChrome() @@ -31,7 +26,7 @@ function isChrome() function isWorker() { - return typeof(WorkerGlobalScope) !== 'undefined' && this instanceof WorkerGlobalScope; + return typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobalScope; } function isWindows() @@ -56,7 +51,6 @@ async function runTest(testsuite, language, host, protocol, testcases, out) trace(category, message) { const s = []; - const d = new Date(); s.push("-- "); s.push(this.timestamp()); s.push(' '); @@ -70,7 +64,6 @@ async function runTest(testsuite, language, host, protocol, testcases, out) warning(message) { const s = []; - const d = new Date(); s.push("-! "); s.push(this.timestamp()); s.push(' '); @@ -83,7 +76,6 @@ async function runTest(testsuite, language, host, protocol, testcases, out) error(message) { const s = []; - const d = new Date(); s.push("!! "); s.push(this.timestamp()); s.push(' '); @@ -98,7 +90,7 @@ async function runTest(testsuite, language, host, protocol, testcases, out) return ""; } - cloneWithPrefix(prefix) + cloneWithPrefix() { return Logger; } @@ -113,95 +105,95 @@ async function runTest(testsuite, language, host, protocol, testcases, out) let communicator; try { - let initData = new Ice.InitializationData(); - let port = protocol == "ws" ? 15002 : 15003; + const initData = new Ice.InitializationData(); + const port = protocol == "ws" ? 15002 : 15003; initData.logger = new Logger(); initData.properties = Ice.createProperties(); initData.properties.setProperty("Ice.Default.Host", host); initData.properties.setProperty("Ice.Default.Protocol", protocol); - //initData.properties.setProperty("Ice.Trace.Protocol", "1"); - //initData.properties.setProperty("Ice.Trace.Network", "3"); + // initData.properties.setProperty("Ice.Trace.Protocol", "1"); + // initData.properties.setProperty("Ice.Trace.Network", "3"); - if(typeof(_runServer) === "undefined") + if(typeof _runServer === "undefined") { await _test(out, initData); } else { communicator = Ice.initialize(); - let controller = Test.Common.ControllerPrx.uncheckedCast( + const controller = Test.Common.ControllerPrx.uncheckedCast( communicator.stringToProxy(`controller:${protocol} -h ${host} -p ${port}`)); - testcases = testcases || [ { name: "client/server" } ]; - - async function run(testcase, client) - { - let serverTestCase; - try - { - if(testcase.langs && testcase.langs.indexOf(language) == -1) - { - return; - } - - out.writeLine(`[ running ${testcase.name} test]`); - out.write("starting server side... "); - serverTestCase = (language === "js") ? - await controller.runTestCase("cpp", "Ice/echo", "server", "") : - await controller.runTestCase("js", testsuite, testcase.name, language); - - serverTestCase = Test.Common.TestCasePrx.uncheckedCast( - controller.ice_getCachedConnection().createProxy(serverTestCase.ice_getIdentity())); - - let config = new Test.Common.Config(); - config.protocol = protocol; - await serverTestCase.startServerSide(config); - out.writeLine("ok"); - - let server; - if(language === "js") - { - let id = initData.clone(); - if(testcase.args !== undefined) - { - id.properties = Ice.createProperties(testcase.args, initData.properties); - } - let ready = new Ice.Promise(); - server = _server(out, id, ready, testcase.args); - await ready; - } - - { - let id = initData.clone(); - if(testcase.args !== undefined) - { - initData.properties = Ice.createProperties(testcase.args, id.properties); - } - await client(out, id, testcase.args); - } - - if(server) - { - await server; // Wait for server to terminate - } - - await serverTestCase.stopServerSide(true); - } - catch(ex) - { - out.writeLine("failed! (" + ex + ")"); - throw ex; - } - finally - { - if(serverTestCase) - { - await serverTestCase.destroy(); - } - } - } - - for(let testcase of testcases) + testcases = testcases || [{name: "client/server"}]; + + const run = async (testcase, client) => + { + let serverTestCase; + try + { + if(testcase.langs && testcase.langs.indexOf(language) == -1) + { + return; + } + + out.writeLine(`[ running ${testcase.name} test]`); + out.write("starting server side... "); + serverTestCase = (language === "js") ? + await controller.runTestCase("cpp", "Ice/echo", "server", "") : + await controller.runTestCase("js", testsuite, testcase.name, language); + + serverTestCase = Test.Common.TestCasePrx.uncheckedCast( + controller.ice_getCachedConnection().createProxy(serverTestCase.ice_getIdentity())); + + const config = new Test.Common.Config(); + config.protocol = protocol; + await serverTestCase.startServerSide(config); + out.writeLine("ok"); + + let server; + if(language === "js") + { + const id = initData.clone(); + if(testcase.args !== undefined) + { + id.properties = Ice.createProperties(testcase.args, initData.properties); + } + const ready = new Ice.Promise(); + server = _server(out, id, ready, testcase.args); + await ready; + } + + { + const id = initData.clone(); + if(testcase.args !== undefined) + { + initData.properties = Ice.createProperties(testcase.args, id.properties); + } + await client(out, id, testcase.args); + } + + if(server) + { + await server; // Wait for server to terminate + } + + await serverTestCase.stopServerSide(true); + } + catch(ex) + { + out.writeLine("failed! (" + ex + ")"); + throw ex; + } + finally + { + if(serverTestCase) + { + await serverTestCase.destroy(); + } + } + }; + + for(const testcase of testcases) { await run(testcase, _test); } @@ -223,7 +215,7 @@ async function runTest(testsuite, language, host, protocol, testcases, out) out.writeLine(ex.stack); } } - return false + return false; } finally { diff --git a/js/test/Common/TestSuite.js b/js/test/Common/TestSuite.js index 6c2a24fbf04..85eda4cb445 100644 --- a/js/test/Common/TestSuite.js +++ b/js/test/Common/TestSuite.js @@ -7,19 +7,11 @@ // // ********************************************************************** -/* global - _runEchoServerOptions : false, - _test : false, - Test : false, - URI : false, - current : false, - TestSuites : false, - runTest: false -*/ +/* eslint-env jquery, browser */ +/* global URI, current, TestSuites, runTest */ $(document).foundation(); -$(document).ready( - function() +$(document).ready(() => { const es5 = document.location.pathname.indexOf("/es5/") !== -1; let worker; @@ -41,7 +33,7 @@ $(document).ready( } } - let query = new URI(document.location.href).search(true); + const query = new URI(document.location.href).search(true); $("#language").val(query.language !== undefined ? query.language : "cpp"); $("#protocol").val(document.location.protocol == "http:" ? "ws" : "wss"); @@ -57,16 +49,17 @@ $(document).ready( path = path.replace("/test/", "/test/es5/"); } - document.location.assign(new URI() - .host(document.location.host) - .pathname(path) - .search( - { - language: $("#language").val(), - worker: $("#worker").is(":checked"), - loop: $("#loop").is(":checked"), - next:"true" - }).toString()); + document.location.assign( + new URI() + .host(document.location.host) + .pathname(path) + .search( + { + language: $("#language").val(), + worker: $("#worker").is(":checked"), + loop: $("#loop").is(":checked"), + next: "true" + }).toString()); } function next(success) @@ -113,18 +106,18 @@ $(document).ready( path = path.replace("/test/", "/test/es5/"); } - document.location.assign(new URI() - .host(document.location.host) - .pathname(path) - .search( - { - language: $("#language").val(), - worker: $("#worker").is(":checked"), - loop: $("#loop").is(":checked") - }).toString()); + document.location.assign( + new URI() + .host(document.location.host) + .pathname(path).search( + { + language: $("#language").val(), + worker: $("#worker").is(":checked"), + loop: $("#loop").is(":checked") + }).toString()); } - $("#run").click((e) => + $("#run").click(e => { if(!$(e.currentTarget).hasClass("disabled")) { @@ -215,7 +208,7 @@ $(document).ready( $("#protocol").on("change", e => { - let protocol = $(e.currentTarget).val(); + const protocol = $(e.currentTarget).val(); console.log(`protocol change: ${protocol}`); if((document.location.protocol == "http:" && protocol == "wss") || (document.location.protocol == "https:" && protocol == "ws")) diff --git a/js/test/Common/Worker.js b/js/test/Common/Worker.js index 062bd4892a7..1e604311a37 100644 --- a/js/test/Common/Worker.js +++ b/js/test/Common/Worker.js @@ -16,20 +16,20 @@ class Output { static write(msg) { - self.postMessage({type:"Write", message:msg}); + self.postMessage({type: "Write", message: msg}); } static writeLine(msg) { - self.postMessage({type:"WriteLine", message:msg}); + self.postMessage({type: "WriteLine", message: msg}); } } -self.onmessage = (e) => +self.onmessage = e => { try { - let test = e.data.test; + const test = e.data.test; if(test.es5) { self.importScripts("/lib/es5/Ice.js"); @@ -44,7 +44,7 @@ self.onmessage = (e) => self.importScripts("/test/Common/TestRunner.js"); } - for(let file of test.files) + for(const file of test.files) { if(file.indexOf("/") === -1) { @@ -59,17 +59,17 @@ self.onmessage = (e) => runTest(test.name, test.language, test.defaultHost, test.protocol, test.testcases, Output).then( result => { - self.postMessage({type:"TestFinished", success:result}); + self.postMessage({type: "TestFinished", success: result}); }, ex => { Output.writeLine(ex.toString()); - self.postMessage({type:"TestFinished", success:false}); + self.postMessage({type: "TestFinished", success: false}); }); } catch(ex) { Output.writeLine(ex.toString()); - self.postMessage({type:"TestFinished", success:false}); + self.postMessage({type: "TestFinished", success: false}); } }; diff --git a/js/test/Common/run.js b/js/test/Common/run.js index 76a76a430f9..e517a21f21d 100755 --- a/js/test/Common/run.js +++ b/js/test/Common/run.js @@ -7,42 +7,45 @@ // // ********************************************************************** -var es5 = process.argv[2] === "--es5"; +const es5 = process.argv[2] === "--es5"; if(es5) { process.argv.splice(2, 1); } -var Ice = require(es5 ? "ice/src/es5" : "ice").Ice; +const Ice = require(es5 ? "ice/src/es5" : "ice").Ice; -var write = function(msg) +const write = function(msg) { process.stdout.write(msg); }; -var writeLine = function(msg) +const writeLine = function(msg) { this.write(msg + "\n"); }; -var exception = function(ex) +const exception = function(ex) { console.log(ex.toString()); if(ex.stack) { console.log(ex.stack); } + /* eslint-disable no-process-exit */ process.exit(1); + /* eslint-enable no-process-exit */ }; -var id = new Ice.InitializationData(); +const id = new Ice.InitializationData(); id.properties = Ice.createProperties(process.argv); -var exe = process.argv[2]; -var test = module.require(exe); +const exe = process.argv[2]; +let test = module.require(exe); +console.log(test); if(exe === "Server" || exe === "ServerAMD") { - var ready = new Ice.Promise(); - test = exe === "Server" ? test._server : test._serveramd; + const ready = new Ice.Promise(); + test = (exe === "Server") ? test._server : test._serveramd; test({write: write, writeLine: writeLine}, id, ready, process.argv).catch(exception); ready.then(() => console.log("server ready")); } diff --git a/js/test/Glacier2/router/Client.js b/js/test/Glacier2/router/Client.js index 03be9d4de60..626d06c920c 100644 --- a/js/test/Glacier2/router/Client.js +++ b/js/test/Glacier2/router/Client.js @@ -63,12 +63,12 @@ async function allTests(out, communicator, shutdown) { out.write("testing stringToProxy for router... "); - let routerBase = communicator.stringToProxy("Glacier2/router:default -p 12060"); + const routerBase = communicator.stringToProxy("Glacier2/router:default -p 12060"); test(routerBase !== null); out.writeLine("ok"); out.write("testing checked cast for router... "); - let router = await Glacier2.RouterPrx.checkedCast(routerBase); + const router = await Glacier2.RouterPrx.checkedCast(routerBase); test(router !== null); out.writeLine("ok"); @@ -77,12 +77,12 @@ out.writeLine("ok"); out.write("getting the session timeout... "); - let timeout = await router.getSessionTimeout(); + const timeout = await router.getSessionTimeout(); test(timeout.toNumber() === 30); out.writeLine("ok"); out.write("testing stringToProxy for server object... "); - base = communicator.stringToProxy("c1/callback:default -p 12010"); + const base = communicator.stringToProxy("c1/callback:default -p 12010"); out.writeLine("ok"); out.write("trying to ping server before session creation... "); @@ -122,7 +122,7 @@ out.writeLine("ok"); out.write("creating session with correct password... "); - let session = await router.createSession("userid", "abc123"); + await router.createSession("userid", "abc123"); out.writeLine("ok"); out.write("trying to create a second session... "); @@ -155,38 +155,38 @@ } out.write("testing checked cast for server object... "); - let twoway = await Test.CallbackPrx.checkedCast(base); + const twoway = await Test.CallbackPrx.checkedCast(base); test(twoway !== null); out.writeLine("ok"); out.write("creating and activating callback receiver adapter... "); communicator.getProperties().setProperty("Ice.PrintAdapterReady", "0"); - let adapter = await communicator.createObjectAdapterWithRouter("CallbackReceiverAdapter", router); + const adapter = await communicator.createObjectAdapterWithRouter("CallbackReceiverAdapter", router); await adapter.activate(); out.writeLine("ok"); out.write("getting category from router... "); - let category = await router.getCategoryForClient(); + const category = await router.getCategoryForClient(); out.writeLine("ok"); out.write("creating and adding callback receiver object... "); - callbackReceiverImpl = new CallbackReceiverI(); - callbackReceiver = callbackReceiverImpl; + const callbackReceiverImpl = new CallbackReceiverI(); + const callbackReceiver = callbackReceiverImpl; - let callbackReceiverIdent = new Ice.Identity(); + const callbackReceiverIdent = new Ice.Identity(); callbackReceiverIdent.name = "callbackReceiver"; callbackReceiverIdent.category = category; - twowayR = CallbackReceiverPrx.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent)); + const twowayR = CallbackReceiverPrx.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent)); - let fakeCallbackReceiverIdent = new Ice.Identity(); + const fakeCallbackReceiverIdent = new Ice.Identity(); fakeCallbackReceiverIdent.name = "callbackReceiver"; fakeCallbackReceiverIdent.category = "dummy"; - fakeTwowayR = CallbackReceiverPrx.uncheckedCast(adapter.add(callbackReceiver, fakeCallbackReceiverIdent)); + const fakeTwowayR = CallbackReceiverPrx.uncheckedCast(adapter.add(callbackReceiver, fakeCallbackReceiverIdent)); out.writeLine("ok"); out.write("testing oneway callback... "); - oneway = CallbackPrx.uncheckedCast(twoway.ice_oneway()); - onewayR = CallbackReceiverPrx.uncheckedCast(twowayR.ice_oneway()); + const oneway = CallbackPrx.uncheckedCast(twoway.ice_oneway()); + const onewayR = CallbackReceiverPrx.uncheckedCast(twowayR.ice_oneway()); let context = new Ice.Context(); context.set("_fwd", "o"); await oneway.initiateCallback(onewayR, context); @@ -295,11 +295,11 @@ out.writeLine("ok"); out.write("testing stringToProxy for process object... "); - processBase = communicator.stringToProxy("Glacier2/admin -f Process:default -p 12061"); + const processBase = communicator.stringToProxy("Glacier2/admin -f Process:default -p 12061"); out.writeLine("ok"); out.write("testing checked cast for admin object... "); - processPrx = await Ice.ProcessPrx.checkedCast(processBase); + const processPrx = await Ice.ProcessPrx.checkedCast(processBase); test(processPrx !== null); out.writeLine("ok"); @@ -325,7 +325,7 @@ { initData.properties.setProperty("Ice.Warn.Dispatch", "1"); initData.properties.setProperty("Ice.Warn.Connections", "0"); - communicator= Ice.initialize(initData); + communicator = Ice.initialize(initData); await allTests(out, communicator, args.indexOf("--shutdown") > -1); } finally @@ -339,7 +339,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/acm/Client.js b/js/test/Ice/acm/Client.js index 8da91a6c2d9..31f3cce941d 100644 --- a/js/test/Ice/acm/Client.js +++ b/js/test/Ice/acm/Client.js @@ -89,18 +89,16 @@ initData.properties.setProperty("Ice.ACM.Timeout", "2"); if(this._clientACMTimeout >= 0) { - initData.properties.setProperty("Ice.ACM.Client.Timeout", "" + this._clientACMTimeout); + initData.properties.setProperty("Ice.ACM.Client.Timeout", String(this._clientACMTimeout)); } if(this._clientACMClose >= 0) { - initData.properties.setProperty("Ice.ACM.Client.Close", "" + this._clientACMClose); + initData.properties.setProperty("Ice.ACM.Client.Close", String(this._clientACMClose)); } if(this._clientACMHeartbeat >= 0) { - initData.properties.setProperty("Ice.ACM.Client.Heartbeat", "" + this._clientACMHeartbeat); + initData.properties.setProperty("Ice.ACM.Client.Heartbeat", String(this._clientACMHeartbeat)); } - //initData.properties.setProperty("Ice.Trace.Protocol", "2"); - //initData.properties.setProperty("Ice.Trace.Network", "2"); this._communicator = Ice.initialize(initData); this._adapter = await this._com.createObjectAdapter(this._serverACMTimeout, @@ -135,10 +133,12 @@ { let prx = await this._adapter.getTestIntf(); prx = Test.TestIntfPrx.uncheckedCast(this._communicator.stringToProxy(prx.toString())); - let con = await prx.ice_getConnection(); - con.setCloseCallback(connection => this._closed = true); + const con = await prx.ice_getConnection(); + con.setCloseCallback(connection => + { + this._closed = true; + }); con.setHeartbeatCallback(connection => ++this._heartbeat); - await this.runTestCase(this._adapter, prx); } catch(ex) @@ -354,7 +354,7 @@ async runTestCase(adapter, proxy) { await Ice.Promise.delay(3000); - await this._heartbeat >= 3; + return this._heartbeat >= 3; } } @@ -413,7 +413,7 @@ async runTestCase(adapter, proxy) { - let con = proxy.ice_getCachedConnection(); + const con = proxy.ice_getCachedConnection(); try { @@ -470,7 +470,7 @@ // Skip some tests with IE it opens too many connections and // IE doesn't allow more than 6 connections. // - if(typeof(navigator) !== "undefined" && + if(typeof navigator !== "undefined" && ["MSIE", "Trident/7.0", "Edge/12", "Edge/13"].some(value => navigator.userAgent.indexOf(value) !== -1)) { tests.push(new HeartbeatOnIdleTest(com, out)); @@ -496,7 +496,7 @@ await Promise.all(tests.map(test => test.init())); await Promise.all(tests.map(test => test.start())); - for(let test of tests) + for(const test of tests) { test.join(out); } @@ -527,7 +527,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/adapterDeactivation/Client.js b/js/test/Ice/adapterDeactivation/Client.js index 7236f9ecd81..cd98ca29898 100644 --- a/js/test/Ice/adapterDeactivation/Client.js +++ b/js/test/Ice/adapterDeactivation/Client.js @@ -10,17 +10,12 @@ (function(module, require, exports) { const Ice = require("ice").Ice; - const IceSSL = require("ice").IceSSL; const Test = require("Test").Test; async function allTests(communicator, out) { class TestError extends Error { - constructor(message) - { - super(message); - } } function test(value, ex) @@ -36,12 +31,10 @@ } } - let defaultProtocol = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - out.write("testing stringToProxy... "); const ref = "test:default -p 12010"; const base = communicator.stringToProxy(ref); - test(base != null); + test(base !== null); out.writeLine("ok"); out.write("testing checked cast... "); @@ -77,31 +70,29 @@ await obj.transient(); out.writeLine("ok"); + out.write("testing connection closure... "); + for(let i = 0; i < 10; ++i) { - out.write("testing connection closure... "); - for(i = 0; i < 10; ++i) - { - let initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties().clone(); - let comm = Ice.initialize(initData); - comm.stringToProxy("test:default -p 12010").ice_ping().catch(ex => {}); - await comm.destroy(); - } - out.writeLine("ok"); + const initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties().clone(); + const comm = Ice.initialize(initData); + comm.stringToProxy("test:default -p 12010").ice_ping().catch(ex => {}); + await comm.destroy(); } + out.writeLine("ok"); out.write("testing object adapter published endpoints... "); { communicator.getProperties().setProperty("PAdapter.PublishedEndpoints", "tcp -h localhost -p 12345 -t 30000"); - let adapter = await communicator.createObjectAdapter("PAdapter"); + const adapter = await communicator.createObjectAdapter("PAdapter"); test(adapter.getPublishedEndpoints().length === 1); - let endpt = adapter.getPublishedEndpoints()[0]; + const endpt = adapter.getPublishedEndpoints()[0]; test(endpt.toString() == "tcp -h localhost -p 12345 -t 30000"); - let prx = + const prx = communicator.stringToProxy("dummy:tcp -h localhost -p 12346 -t 20000:tcp -h localhost -p 12347 -t 10000"); adapter.setPublishedEndpoints(prx.ice_getEndpoints()); test(adapter.getPublishedEndpoints().length === 2); - let id = new Ice.Identity(); + const id = new Ice.Identity(); id.name = "dummy"; test(Ice.ArrayUtil.equals(adapter.createProxy(id).ice_getEndpoints(), prx.ice_getEndpoints())); test(Ice.ArrayUtil.equals(adapter.getPublishedEndpoints(), prx.ice_getEndpoints())); @@ -117,7 +108,7 @@ } out.writeLine("ok"); - test(obj.ice_getConnection() != null) + test(obj.ice_getConnection() !== null); { out.write("testing object adapter with bi-dir connection... "); const adapter = await communicator.createObjectAdapter(""); @@ -197,7 +188,10 @@ test(!adpt.isDeactivated()); let isHolding = false; - adpt.waitForHold().then(() => { isHolding = true; }); + adpt.waitForHold().then(() => + { + isHolding = true; + }); test(!isHolding); adpt.hold(); await adpt.waitForHold(); @@ -205,10 +199,16 @@ test(isHolding); isHolding = false; - adpt.waitForHold().then(() => isHolding = true); + adpt.waitForHold().then(() => + { + isHolding = true; + }); let isDeactivated = false; - adpt.waitForDeactivate().then(() => isDeactivated = true); + adpt.waitForDeactivate().then(() => + { + isDeactivated = true; + }); test(!isDeactivated); await adpt.deactivate(); await adpt.waitForDeactivate(); @@ -223,7 +223,7 @@ try { await obj.ice_timeout(100).ice_ping(); // Use timeout to speed up testing on Windows - throw new RuntimeException(); + throw new Error(); } catch(ex) { @@ -251,7 +251,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/ami/Client.js b/js/test/Ice/ami/Client.js index d3fc06be74c..5c2b3018bb0 100644 --- a/js/test/Ice/ami/Client.js +++ b/js/test/Ice/ami/Client.js @@ -25,19 +25,19 @@ let sref = "test:default -p 12010"; let obj = communicator.stringToProxy(sref); test(obj !== null); - let p = Test.TestIntfPrx.uncheckedCast(obj); + const p = Test.TestIntfPrx.uncheckedCast(obj); sref = "testController:default -p 12011"; obj = communicator.stringToProxy(sref); - test(obj != null); - let testController = Test.TestIntfControllerPrx.uncheckedCast(obj); + test(obj !== null); + const testController = Test.TestIntfControllerPrx.uncheckedCast(obj); out.write("testing batch requests with proxy... "); { - let count = await p.opBatchCount(); + const count = await p.opBatchCount(); test(count === 0); - let b1 = p.ice_batchOneway(); - let bf = b1.opBatch(); + const b1 = p.ice_batchOneway(); + const bf = b1.opBatch(); test(bf.isCompleted()); test(!bf.isSent()); test(b1.opBatch()); @@ -50,9 +50,9 @@ out.write("testing batch requests with connection... "); { test(await p.opBatchCount() === 0); - let b1 = p.ice_batchOneway(); + const b1 = p.ice_batchOneway(); await b1.opBatch(); - let bf = b1.opBatch(); + const bf = b1.opBatch(); test(bf.isCompleted()); await b1.ice_flushBatchRequests(); test(await p.waitForBatch(2)); @@ -61,7 +61,7 @@ if(await p.ice_getConnection() !== null) { test(await p.opBatchCount() == 0); - let b1 = p.ice_batchOneway(); + const b1 = p.ice_batchOneway(); await b1.opBatch(); await b1.ice_getConnection().then(conn => conn.close(Ice.ConnectionClose.GracefullyWithWait)); await b1.ice_flushBatchRequests(); @@ -71,98 +71,96 @@ out.write("testing batch requests with communicator... "); { - { - // - // Async task - 1 connection. - // - test(await p.opBatchCount() === 0); - let b1 = Test.TestIntfPrx.uncheckedCast( - await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); - await b1.opBatch(); - await b1.opBatch(); - - await communicator.flushBatchRequests(); - test(await p.waitForBatch(2)); - } + // + // Async task - 1 connection. + // + test(await p.opBatchCount() === 0); + const b1 = Test.TestIntfPrx.uncheckedCast( + await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); + await b1.opBatch(); + await b1.opBatch(); - { - // - // Async task exception - 1 connection. - // - test(await p.opBatchCount() === 0); - let b1 = Test.TestIntfPrx.uncheckedCast( - await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); - await b1.opBatch(); - await b1.ice_getConnection().then(c => c.close(Ice.ConnectionClose.GracefullyWithWait)); - - await communicator.flushBatchRequests(); - test(await p.opBatchCount() == 0); - } + await communicator.flushBatchRequests(); + test(await p.waitForBatch(2)); + } - { - // - // Async task - 2 connections. - // - test(await p.opBatchCount() === 0); - let b1 = Test.TestIntfPrx.uncheckedCast( - await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); - let b2 = Test.TestIntfPrx.uncheckedCast( - await p.ice_connectionId("2").ice_getConnection().then( - c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); - - await b2.ice_getConnection(); // Ensure connection is established. - await b1.opBatch(); - await b1.opBatch(); - await b2.opBatch(); - await b2.opBatch(); - - await communicator.flushBatchRequests(); - test(await p.waitForBatch(4)); - } + { + // + // Async task exception - 1 connection. + // + test(await p.opBatchCount() === 0); + const b1 = Test.TestIntfPrx.uncheckedCast( + await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); + await b1.opBatch(); + await b1.ice_getConnection().then(c => c.close(Ice.ConnectionClose.GracefullyWithWait)); - { - // - // AsyncResult exception - 2 connections - 1 failure. - // - // All connections should be flushed even if there are failures on some connections. - // Exceptions should not be reported. - // - test(await p.opBatchCount() === 0); - let b1 = Test.TestIntfPrx.uncheckedCast( - await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); - let b2 = Test.TestIntfPrx.uncheckedCast( - await p.ice_connectionId("2").ice_getConnection().then( - c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); - await b2.ice_getConnection(); // Ensure connection is established. - await b1.opBatch(); - await b2.opBatch(); - await b1.ice_getConnection().then(c => c.close(Ice.ConnectionClose.GracefullyWithWait)); - - await communicator.flushBatchRequests(); - test(await p.waitForBatch(1)); - } + await communicator.flushBatchRequests(); + test(await p.opBatchCount() == 0); + } - { - // - // Async task exception - 2 connections - 2 failures. - // - // The sent callback should be invoked even if all connections fail. - // - test(await p.opBatchCount() == 0); - let b1 = Test.TestIntfPrx.uncheckedCast( - await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); - let b2 = Test.TestIntfPrx.uncheckedCast( - await p.ice_connectionId("2").ice_getConnection().then( - c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); - await b2.ice_getConnection(); // Ensure connection is established. - await b1.opBatch(); - await b2.opBatch(); - await b1.ice_getConnection().then(c => c.close(Ice.ConnectionClose.GracefullyWithWait)); - await b2.ice_getConnection().then(c => c.close(Ice.ConnectionClose.GracefullyWithWait)); - - await communicator.flushBatchRequests(); - test(await p.opBatchCount() === 0); - } + { + // + // Async task - 2 connections. + // + test(await p.opBatchCount() === 0); + const b1 = Test.TestIntfPrx.uncheckedCast( + await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); + const b2 = Test.TestIntfPrx.uncheckedCast( + await p.ice_connectionId("2").ice_getConnection().then( + c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); + + await b2.ice_getConnection(); // Ensure connection is established. + await b1.opBatch(); + await b1.opBatch(); + await b2.opBatch(); + await b2.opBatch(); + + await communicator.flushBatchRequests(); + test(await p.waitForBatch(4)); + } + + { + // + // AsyncResult exception - 2 connections - 1 failure. + // + // All connections should be flushed even if there are failures on some connections. + // Exceptions should not be reported. + // + test(await p.opBatchCount() === 0); + const b1 = Test.TestIntfPrx.uncheckedCast( + await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); + const b2 = Test.TestIntfPrx.uncheckedCast( + await p.ice_connectionId("2").ice_getConnection().then( + c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); + await b2.ice_getConnection(); // Ensure connection is established. + await b1.opBatch(); + await b2.opBatch(); + await b1.ice_getConnection().then(c => c.close(Ice.ConnectionClose.GracefullyWithWait)); + + await communicator.flushBatchRequests(); + test(await p.waitForBatch(1)); + } + + { + // + // Async task exception - 2 connections - 2 failures. + // + // The sent callback should be invoked even if all connections fail. + // + test(await p.opBatchCount() == 0); + const b1 = Test.TestIntfPrx.uncheckedCast( + await p.ice_getConnection().then(c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); + const b2 = Test.TestIntfPrx.uncheckedCast( + await p.ice_connectionId("2").ice_getConnection().then( + c => c.createProxy(p.ice_getIdentity()).ice_batchOneway())); + await b2.ice_getConnection(); // Ensure connection is established. + await b1.opBatch(); + await b2.opBatch(); + await b1.ice_getConnection().then(c => c.close(Ice.ConnectionClose.GracefullyWithWait)); + await b2.ice_getConnection().then(c => c.close(Ice.ConnectionClose.GracefullyWithWait)); + + await communicator.flushBatchRequests(); + test(await p.opBatchCount() === 0); } out.writeLine("ok"); @@ -174,8 +172,7 @@ try { r1 = p.op(); - let seq = new Uint8Array(100000); - + const seq = new Uint8Array(100000); while(true) { r2 = p.opWithPayload(seq); @@ -216,7 +213,7 @@ test(r1.operation == "op"); test(r2.operation == "opWithPayload"); - r = p.ice_ping(); + let r = p.ice_ping(); test(r.operation === "ice_ping"); test(r.connection === null); // Expected test(r.communicator == communicator); @@ -243,7 +240,7 @@ test(r.communicator == communicator); test(r.proxy == p2); - let con = p.ice_getCachedConnection(); + const con = p.ice_getCachedConnection(); p2 = p.ice_batchOneway(); p2.ice_ping(); r = con.flushBatchRequests(); @@ -263,7 +260,7 @@ { await testController.holdAdapter(); - let seq = new Uint8Array(new Array(100000)); + const seq = new Uint8Array(new Array(100000)); let r; while(true) { @@ -283,12 +280,12 @@ const r1 = p.ice_ping(); r1.then( () => test(false), - (ex) => test(ex instanceof Ice.InvocationCanceledException)); + ex => test(ex instanceof Ice.InvocationCanceledException)); const r2 = p.ice_id(); r2.then( () => test(false), - (ex) => test(ex instanceof Ice.InvocationCanceledException)); + ex => test(ex instanceof Ice.InvocationCanceledException)); r1.cancel(); r2.cancel(); @@ -303,20 +300,20 @@ { await testController.holdAdapter(); - let r1 = p.op(); - let r2 = p.ice_id(); + const r1 = p.op(); + const r2 = p.ice_id(); await p.ice_oneway().ice_ping(); r1.cancel(); r1.then( () => test(false), - (ex) => test(ex instanceof Ice.InvocationCanceledException)); + ex => test(ex instanceof Ice.InvocationCanceledException)); r2.cancel(); r2.then( () => test(false), - (ex) => test(ex instanceof Ice.InvocationCanceledException)); + ex => test(ex instanceof Ice.InvocationCanceledException)); await testController.resumeAdapter(); } @@ -344,7 +341,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/binding/Client.js b/js/test/Ice/binding/Client.js index ff7beb87993..6b5551d0e9e 100644 --- a/js/test/Ice/binding/Client.js +++ b/js/test/Ice/binding/Client.js @@ -43,7 +43,7 @@ { let endpoints = []; let obj = null; - for(let adapter of adapters) + for(const adapter of adapters) { obj = await adapter.getTestIntf(); endpoints = endpoints.concat(obj.ice_getEndpoints()); @@ -53,7 +53,7 @@ async function deactivate(communicator, adapters) { - for(let adapter of adapters) + for(const adapter of adapters) { await communicator.deactivateObjectAdapter(adapter); } @@ -65,17 +65,17 @@ communicator = Ice.initialize(initData); out.write("testing stringToProxy... "); - ref = "communicator:default -p 12010"; - com = Test.RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref)); + const ref = "communicator:default -p 12010"; + let com = Test.RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref)); test(com !== null); out.writeLine("ok"); out.write("testing binding with single endpoint... "); { - let adapter = await com.createObjectAdapter("Adapter", "default"); + const adapter = await com.createObjectAdapter("Adapter", "default"); - let test1 = await adapter.getTestIntf(); - let test2 = await adapter.getTestIntf(); + const test1 = await adapter.getTestIntf(); + const test2 = await adapter.getTestIntf(); test(await test1.ice_getConnection() === await test2.ice_getConnection()); await test1.ice_ping(); @@ -83,7 +83,7 @@ await com.deactivateObjectAdapter(adapter); - let test3 = Test.TestIntfPrx.uncheckedCast(test1); + const test3 = Test.TestIntfPrx.uncheckedCast(test1); test(await test3.ice_getConnection() === await test1.ice_getConnection()); test(await test3.ice_getConnection() === await test2.ice_getConnection()); @@ -98,7 +98,7 @@ } } - out.writeLine("ok") + out.writeLine("ok"); await communicator.destroy(); communicator = Ice.initialize(initData); @@ -106,9 +106,12 @@ out.write("testing binding with multiple endpoints... "); { - let adapters = await Promise.all([com.createObjectAdapter("Adapter11", "default"), - com.createObjectAdapter("Adapter12", "default"), - com.createObjectAdapter("Adapter13", "default")]); + const adapters = await Promise.all( + [ + com.createObjectAdapter("Adapter11", "default"), + com.createObjectAdapter("Adapter12", "default"), + com.createObjectAdapter("Adapter13", "default") + ]); // // Ensure that when a connection is opened it's reused for new @@ -117,24 +120,24 @@ let names = ["Adapter11", "Adapter12", "Adapter13"]; while(names.length > 0) { - let adpts = ArrayUtil.clone(adapters); - let test1 = await createTestIntfPrx(adpts); - ArrayUtil.shuffle(adpts) - let test2 = await createTestIntfPrx(adpts); - ArrayUtil.shuffle(adpts) - let test3 = await createTestIntfPrx(adpts); + const adpts = ArrayUtil.clone(adapters); + const test1 = await createTestIntfPrx(adpts); + ArrayUtil.shuffle(adpts); + const test2 = await createTestIntfPrx(adpts); + ArrayUtil.shuffle(adpts); + const test3 = await createTestIntfPrx(adpts); await test1.ice_ping(); test(await test1.ice_getConnection() == await test2.ice_getConnection()); test(await test2.ice_getConnection() == await test3.ice_getConnection()); - let name = await test1.getAdapterName(); - let index = names.indexOf(name); + const name = await test1.getAdapterName(); + const index = names.indexOf(name); if(index !== -1) { names.splice(index, 1); } - let conn = await test1.ice_getConnection(); + const conn = await test1.ice_getConnection(); await conn.close(Ice.ConnectionClose.GracefullyWithWait); } // @@ -142,23 +145,26 @@ // always send the request over the same connection.) // { - for(let adpt of adapters) + for(const adpt of adapters) { - let prx = await adpt.getTestIntf(); + const prx = await adpt.getTestIntf(); await prx.ice_ping(); } - let t = await createTestIntfPrx(adapters); - let name = await t.getAdapterName(); - let nRetry = 10; + const t = await createTestIntfPrx(adapters); + const name = await t.getAdapterName(); + const nRetry = 10; + let i; + /* eslint-disable curly */ for(i = 0; i < nRetry && await t.getAdapterName() == name; i++); + /* eslint-enable curly */ test(i == nRetry); - for(let adpt of adapters) + for(const adpt of adapters) { - let prx = await adpt.getTestIntf(); - let conn = await prx.ice_getConnection(); + const prx = await adpt.getTestIntf(); + const conn = await prx.ice_getConnection(); await conn.close(Ice.ConnectionClose.GracefullyWithWait); } } @@ -170,24 +176,24 @@ names = ["Adapter12", "Adapter13"]; while(names.length > 0) { - let adpts = ArrayUtil.clone(adapters); + const adpts = ArrayUtil.clone(adapters); - let test1 = await createTestIntfPrx(adpts); + const test1 = await createTestIntfPrx(adpts); ArrayUtil.shuffle(adpts); - let test2 = await createTestIntfPrx(adpts); + const test2 = await createTestIntfPrx(adpts); ArrayUtil.shuffle(adpts); - let test3 = await createTestIntfPrx(adpts); + const test3 = await createTestIntfPrx(adpts); test(await test1.ice_getConnection() == await test2.ice_getConnection()); test(await test2.ice_getConnection() == await test3.ice_getConnection()); - let name = await test1.getAdapterName(); - let index = names.indexOf(name); + const name = await test1.getAdapterName(); + const index = names.indexOf(name); if(index !== -1) { names.splice(index, 1); } - let conn = await test1.ice_getConnection(); + const conn = await test1.ice_getConnection(); await conn.close(Ice.ConnectionClose.GracefullyWithWait); } // @@ -195,7 +201,7 @@ // establish the connection to the remaining adapter. // await com.deactivateObjectAdapter(adapters[2]); - let obj = await createTestIntfPrx(adapters); + const obj = await createTestIntfPrx(adapters); test(await obj.getAdapterName() == "Adapter12"); await deactivate(com, adapters); @@ -212,17 +218,19 @@ // to be delayed on retry (network.websocket.delay-failed-reconnects=true by // default), so we prefer to also disable this test with Firefox. // - if(typeof(navigator) === "undefined" || + if(typeof navigator === "undefined" || ["MSIE", "Trident/7.0", "Firefox"].every(value => navigator.userAgent.indexOf(value) === -1)) { out.write("testing binding with multiple random endpoints... "); - let adapters = await Promise.all([ - com.createObjectAdapter("AdapterRandom11", "default"), - com.createObjectAdapter("AdapterRandom12", "default"), - com.createObjectAdapter("AdapterRandom13", "default"), - com.createObjectAdapter("AdapterRandom14", "default"), - com.createObjectAdapter("AdapterRandom15", "default")]); + const adapters = await Promise.all( + [ + com.createObjectAdapter("AdapterRandom11", "default"), + com.createObjectAdapter("AdapterRandom12", "default"), + com.createObjectAdapter("AdapterRandom13", "default"), + com.createObjectAdapter("AdapterRandom14", "default"), + com.createObjectAdapter("AdapterRandom15", "default") + ]); let count = 20; let adapterCount = adapters.length; @@ -251,7 +259,11 @@ } for(let i = 0; i < proxies.length; i++) { - proxies[i].getAdapterName().catch(ex => { /*ignore exception*/ }); + proxies[i].getAdapterName().catch( + ex => + { + // ignore exception + }); } for(let i = 0; i < proxies.Length; i++) { @@ -264,7 +276,7 @@ test(ex instanceof Ice.LocalException, ex); } } - let connections = []; + const connections = []; for(let i = 0; i < proxies.length; i++) { if(proxies[i].ice_getCachedConnection() !== null) @@ -277,12 +289,12 @@ } test(connections.length <= adapterCount); - for(let a of adapters) + for(const a of adapters) { try { - let prx = await a.getTestIntf(); - let conn = await prx.ice_getConnection(); + const prx = await a.getTestIntf(); + const conn = await prx.ice_getConnection(); await conn.close(Ice.ConnectionClose.GracefullyWithWait); } catch(ex) @@ -301,10 +313,12 @@ out.write("testing random endpoint selection... "); { - let adapters = await Promise.all([ - com.createObjectAdapter("Adapter21", "default"), - com.createObjectAdapter("Adapter22", "default"), - com.createObjectAdapter("Adapter23", "default")]); + const adapters = await Promise.all( + [ + com.createObjectAdapter("Adapter21", "default"), + com.createObjectAdapter("Adapter22", "default"), + com.createObjectAdapter("Adapter23", "default") + ]); let obj = await createTestIntfPrx(adapters); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); @@ -312,27 +326,27 @@ let names = ["Adapter21", "Adapter22", "Adapter23"]; while(names.length > 0) { - let index = names.indexOf(await obj.getAdapterName()); + const index = names.indexOf(await obj.getAdapterName()); if(index !== -1) { names.splice(index, 1); } - let conn = await obj.ice_getConnection(); + const conn = await obj.ice_getConnection(); await conn.close(Ice.ConnectionClose.GracefullyWithWait); } obj = Test.TestIntfPrx.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Random)); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); - names = ["Adapter21", "Adapter22", "Adapter23"] + names = ["Adapter21", "Adapter22", "Adapter23"]; while(names.length > 0) { - let index = names.indexOf(await obj.getAdapterName()); + const index = names.indexOf(await obj.getAdapterName()); if(index !== -1) { names.splice(index, 1); } - let conn = await obj.ice_getConnection(); + const conn = await obj.ice_getConnection(); await conn.close(Ice.ConnectionClose.GracefullyWithWait); } @@ -346,21 +360,24 @@ out.write("testing ordered endpoint selection... "); { - let adapters = await Promise.all([ - com.createObjectAdapter("Adapter31", "default"), - com.createObjectAdapter("Adapter32", "default"), - com.createObjectAdapter("Adapter33", "default")]); + let adapters = await Promise.all( + [ + com.createObjectAdapter("Adapter31", "default"), + com.createObjectAdapter("Adapter32", "default"), + com.createObjectAdapter("Adapter33", "default") + ]); let obj = await createTestIntfPrx(adapters); obj = Test.TestIntfPrx.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); - let nRetry = 3; - let i; + const nRetry = 3; // // Ensure that endpoints are tried in order by deactiving the adapters // one after the other. // + /* eslint-disable curly */ + let i; for(i = 0; i < nRetry && await obj.getAdapterName() == "Adapter31"; i++); test(i == nRetry); await com.deactivateObjectAdapter(adapters[0]); @@ -370,6 +387,7 @@ for(i = 0; i < nRetry && await obj.getAdapterName() == "Adapter33"; i++); test(i == nRetry); await com.deactivateObjectAdapter(adapters[2]); + /* eslint-enable curly */ try { @@ -380,7 +398,7 @@ test(isConnectionFailed(ex), ex); } - let endpoints = obj.ice_getEndpoints(); + const endpoints = obj.ice_getEndpoints(); adapters = []; @@ -388,6 +406,8 @@ // Now, re-activate the adapters with the same endpoints in the opposite // order. // + + /* eslint-disable curly */ adapters.push(await com.createObjectAdapter("Adapter36", endpoints[2].toString())); for(i = 0; i < nRetry && await obj.getAdapterName() == "Adapter36"; i++); test(i == nRetry); @@ -401,6 +421,7 @@ adapters.push(await com.createObjectAdapter("Adapter34", endpoints[0].toString())); for(i = 0; i < nRetry && await obj.getAdapterName() == "Adapter34"; i++); test(i == nRetry); + /* eslint-enable curly */ await deactivate(com, adapters); } @@ -412,10 +433,10 @@ out.write("testing per request binding with single endpoint... "); { - let adapter = await com.createObjectAdapter("Adapter41", "default"); + const adapter = await com.createObjectAdapter("Adapter41", "default"); - let test1 = Test.TestIntfPrx.uncheckedCast((await adapter.getTestIntf()).ice_connectionCached(false)); - let test2 = Test.TestIntfPrx.uncheckedCast((await adapter.getTestIntf()).ice_connectionCached(false)); + const test1 = Test.TestIntfPrx.uncheckedCast((await adapter.getTestIntf()).ice_connectionCached(false)); + const test2 = Test.TestIntfPrx.uncheckedCast((await adapter.getTestIntf()).ice_connectionCached(false)); test(!test1.ice_isConnectionCached()); test(!test2.ice_isConnectionCached()); test(await test1.ice_getConnection() !== null && await test2.ice_getConnection() !== null); @@ -425,7 +446,7 @@ await com.deactivateObjectAdapter(adapter); - let test3 = Test.TestIntfPrx.uncheckedCast(test1); + const test3 = Test.TestIntfPrx.uncheckedCast(test1); try { test(await test3.ice_getConnection() == await test1.ice_getConnection()); @@ -444,12 +465,15 @@ out.write("testing per request binding with multiple endpoints... "); { - let adapters = await Promise.all([ - com.createObjectAdapter("Adapter51", "default"), - com.createObjectAdapter("Adapter52", "default"), - com.createObjectAdapter("Adapter53", "default")]); - - let obj = Test.TestIntfPrx.uncheckedCast((await createTestIntfPrx(adapters)).ice_connectionCached(false)); + const adapters = await Promise.all( + [ + com.createObjectAdapter("Adapter51", "default"), + com.createObjectAdapter("Adapter52", "default"), + com.createObjectAdapter("Adapter53", "default") + ]); + + const obj = Test.TestIntfPrx.uncheckedCast( + (await createTestIntfPrx(adapters)).ice_connectionCached(false)); test(!obj.ice_isConnectionCached()); let names = ["Adapter51", "Adapter52", "Adapter53"]; @@ -484,7 +508,7 @@ } out.writeLine("ok"); - if(typeof(navigator) === "undefined" || + if(typeof navigator === "undefined" || ["Firefox", "MSIE", "Trident/7.0"].every(value => navigator.userAgent.indexOf(value) === -1)) { // @@ -500,23 +524,27 @@ com = Test.RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref)); out.write("testing per request binding and ordered endpoint selection... "); - let adapters = await Promise.all([ - com.createObjectAdapter("Adapter61", "default"), - com.createObjectAdapter("Adapter62", "default"), - com.createObjectAdapter("Adapter63", "default")]); + let adapters = await Promise.all( + [ + com.createObjectAdapter("Adapter61", "default"), + com.createObjectAdapter("Adapter62", "default"), + com.createObjectAdapter("Adapter63", "default") + ]); let obj = await createTestIntfPrx(adapters); obj = Test.TestIntfPrx.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); obj = Test.TestIntfPrx.uncheckedCast(obj.ice_connectionCached(false)); test(!obj.ice_isConnectionCached()); - let nRetry = 3; + const nRetry = 3; let i; // // Ensure that endpoints are tried in order by deactiving the adapters // one after the other. // + + /* eslint-disable curly */ for(i = 0; i < nRetry && await obj.getAdapterName() == "Adapter61"; i++); test(i == nRetry); await com.deactivateObjectAdapter(adapters[0]); @@ -526,6 +554,7 @@ for(i = 0; i < nRetry && await obj.getAdapterName() == "Adapter63"; i++); test(i == nRetry); com.deactivateObjectAdapter(adapters[2]); + /* eslint-enable curly */ try { @@ -536,7 +565,7 @@ test(isConnectionFailed(ex), ex); } - let endpoints = obj.ice_getEndpoints(); + const endpoints = obj.ice_getEndpoints(); adapters = []; @@ -544,6 +573,7 @@ // Now, re-activate the adapters with the same endpoints in the opposite // order. // + /* eslint-disable curly */ adapters.push(await com.createObjectAdapter("Adapter66", endpoints[2].toString())); for(i = 0; i < nRetry && await obj.getAdapterName() == "Adapter66"; i++); test(i == nRetry); @@ -553,7 +583,7 @@ adapters.push(await com.createObjectAdapter("Adapter64", endpoints[0].toString())); for(i = 0; i < nRetry && await obj.getAdapterName() == "Adapter64"; i++); test(i == nRetry); - + /* eslint-enable curly */ await deactivate(com, adapters); out.writeLine("ok"); } @@ -571,7 +601,7 @@ async function run(out, initData) { - if(typeof(navigator) !== 'undefined' && isSafari() && isWorker()) + if(typeof navigator !== 'undefined' && isSafari() && isWorker()) { let communicator; try @@ -584,8 +614,8 @@ // web socket send() method never returns for the sending of close connection message. // out.writeLine("Test not supported with Safari web workers."); - let obj = communicator.stringToProxy("communicator:default -p 12010"); - let prx = await Test.RemoteCommunicatorPrx.uncheckedCast(obj); + const obj = communicator.stringToProxy("communicator:default -p 12010"); + const prx = await Test.RemoteCommunicatorPrx.uncheckedCast(obj); await prx.shutdown(); } finally @@ -604,7 +634,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/defaultValue/Client.js b/js/test/Ice/defaultValue/Client.js index e15f5080f2c..6182af97b43 100644 --- a/js/test/Ice/defaultValue/Client.js +++ b/js/test/Ice/defaultValue/Client.js @@ -12,7 +12,7 @@ const Ice = require("ice").Ice; const Test = require("Test").Test; - async function run(out, initData) + function run(out, initData) { function test(value) { @@ -22,183 +22,190 @@ } } - out.write("testing default values... "); + try { - const v = new Test.Struct1(); - test(!v.boolFalse); - test(v.boolTrue); - test(v.b === 254); - test(v.s === 16000); - test(v.i === 3); - test(v.l.equals(new Ice.Long(0, 4))); - test(v.f === 5.1); - test(v.d === 6.2); - test(v.str === "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); - test(v.c1 === Test.Color.red); - test(v.c2 === Test.Color.green); - test(v.c3 === Test.Color.blue); - test(v.nc1 === Test.Nested.Color.red); - test(v.nc2 === Test.Nested.Color.green); - test(v.nc3 === Test.Nested.Color.blue); - test(v.noDefault === ""); - test(v.zeroI === 0); - test(v.zeroL.equals(new Ice.Long(0, 0))); - test(v.zeroF === 0); - test(v.zeroDotF === 0); - test(v.zeroD === 0); - test(v.zeroDotD === 0); - } + out.write("testing default values... "); + { + const v = new Test.Struct1(); + test(!v.boolFalse); + test(v.boolTrue); + test(v.b === 254); + test(v.s === 16000); + test(v.i === 3); + test(v.l.equals(new Ice.Long(0, 4))); + test(v.f === 5.1); + test(v.d === 6.2); + test(v.str === "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); + test(v.c1 === Test.Color.red); + test(v.c2 === Test.Color.green); + test(v.c3 === Test.Color.blue); + test(v.nc1 === Test.Nested.Color.red); + test(v.nc2 === Test.Nested.Color.green); + test(v.nc3 === Test.Nested.Color.blue); + test(v.noDefault === ""); + test(v.zeroI === 0); + test(v.zeroL.equals(new Ice.Long(0, 0))); + test(v.zeroF === 0); + test(v.zeroDotF === 0); + test(v.zeroD === 0); + test(v.zeroDotD === 0); + } - { - const v = new Test.Struct2(); - test(v.boolTrue === Test.ConstBool); - test(v.b === Test.ConstByte); - test(v.s === Test.ConstShort); - test(v.i === Test.ConstInt); - test(v.l.equals(Test.ConstLong)); - test(v.f === Test.ConstFloat); - test(v.d === Test.ConstDouble); - test(v.str == Test.ConstString); - test(v.c1 === Test.ConstColor1); - test(v.c2 === Test.ConstColor2); - test(v.c3 === Test.ConstColor3); - test(v.nc1 === Test.ConstNestedColor1); - test(v.nc2 === Test.ConstNestedColor2); - test(v.nc3 === Test.ConstNestedColor3); - } + { + const v = new Test.Struct2(); + test(v.boolTrue === Test.ConstBool); + test(v.b === Test.ConstByte); + test(v.s === Test.ConstShort); + test(v.i === Test.ConstInt); + test(v.l.equals(Test.ConstLong)); + test(v.f === Test.ConstFloat); + test(v.d === Test.ConstDouble); + test(v.str === Test.ConstString); + test(v.c1 === Test.ConstColor1); + test(v.c2 === Test.ConstColor2); + test(v.c3 === Test.ConstColor3); + test(v.nc1 === Test.ConstNestedColor1); + test(v.nc2 === Test.ConstNestedColor2); + test(v.nc3 === Test.ConstNestedColor3); + } - { - const v = new Test.Base(); - test(!v.boolFalse); - test(v.boolTrue); - test(v.b === 1); - test(v.s === 2); - test(v.i === 3); - test(v.l.equals(new Ice.Long(0, 4))); - test(v.f === 5.1); - test(v.d === 6.2); - test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); - test(v.noDefault === ""); - test(v.zeroI === 0); - test(v.zeroL.equals(new Ice.Long(0, 0))); - test(v.zeroF === 0); - test(v.zeroDotF === 0); - test(v.zeroD === 0); - test(v.zeroDotD === 0); - } + { + const v = new Test.Base(); + test(!v.boolFalse); + test(v.boolTrue); + test(v.b === 1); + test(v.s === 2); + test(v.i === 3); + test(v.l.equals(new Ice.Long(0, 4))); + test(v.f === 5.1); + test(v.d === 6.2); + test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); + test(v.noDefault === ""); + test(v.zeroI === 0); + test(v.zeroL.equals(new Ice.Long(0, 0))); + test(v.zeroF === 0); + test(v.zeroDotF === 0); + test(v.zeroD === 0); + test(v.zeroDotD === 0); + } - { - const v = new Test.Derived(); - test(!v.boolFalse); - test(v.boolTrue); - test(v.b === 1); - test(v.s === 2); - test(v.i === 3); - test(v.l.equals(new Ice.Long(0, 4))); - test(v.f === 5.1); - test(v.d === 6.2); - test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); - test(v.c1 === Test.Color.red); - test(v.c2 === Test.Color.green); - test(v.c3 === Test.Color.blue); - test(v.nc1 === Test.Nested.Color.red); - test(v.nc2 === Test.Nested.Color.green); - test(v.nc3 === Test.Nested.Color.blue); - test(v.noDefault === ""); - test(v.zeroI === 0); - test(v.zeroL.equals(new Ice.Long(0, 0))); - test(v.zeroF === 0); - test(v.zeroDotF === 0); - test(v.zeroD === 0); - test(v.zeroDotD === 0); - } + { + const v = new Test.Derived(); + test(!v.boolFalse); + test(v.boolTrue); + test(v.b === 1); + test(v.s === 2); + test(v.i === 3); + test(v.l.equals(new Ice.Long(0, 4))); + test(v.f === 5.1); + test(v.d === 6.2); + test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); + test(v.c1 === Test.Color.red); + test(v.c2 === Test.Color.green); + test(v.c3 === Test.Color.blue); + test(v.nc1 === Test.Nested.Color.red); + test(v.nc2 === Test.Nested.Color.green); + test(v.nc3 === Test.Nested.Color.blue); + test(v.noDefault === ""); + test(v.zeroI === 0); + test(v.zeroL.equals(new Ice.Long(0, 0))); + test(v.zeroF === 0); + test(v.zeroDotF === 0); + test(v.zeroD === 0); + test(v.zeroDotD === 0); + } - { - const v = new Test.BaseEx(); - test(!v.boolFalse); - test(v.boolTrue); - test(v.b === 1); - test(v.s === 2); - test(v.i === 3); - test(v.l.equals(new Ice.Long(0, 4))); - test(v.f === 5.1); - test(v.d === 6.2); - test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); - test(v.noDefault === ""); - test(v.zeroI === 0); - test(v.zeroL.equals(new Ice.Long(0, 0))); - test(v.zeroF === 0); - test(v.zeroDotF === 0); - test(v.zeroD === 0); - test(v.zeroDotD === 0); - } + { + const v = new Test.BaseEx(); + test(!v.boolFalse); + test(v.boolTrue); + test(v.b === 1); + test(v.s === 2); + test(v.i === 3); + test(v.l.equals(new Ice.Long(0, 4))); + test(v.f === 5.1); + test(v.d === 6.2); + test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); + test(v.noDefault === ""); + test(v.zeroI === 0); + test(v.zeroL.equals(new Ice.Long(0, 0))); + test(v.zeroF === 0); + test(v.zeroDotF === 0); + test(v.zeroD === 0); + test(v.zeroDotD === 0); + } - { - const v = new Test.DerivedEx(); - test(!v.boolFalse); - test(v.boolTrue); - test(v.b === 1); - test(v.s === 2); - test(v.i === 3); - test(v.l.equals(new Ice.Long(0, 4))); - test(v.f === 5.1); - test(v.d === 6.2); - test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); - test(v.noDefault === ""); - test(v.c1 === Test.Color.red); - test(v.c2 === Test.Color.green); - test(v.c3 === Test.Color.blue); - test(v.nc1 === Test.Nested.Color.red); - test(v.nc2 === Test.Nested.Color.green); - test(v.nc3 === Test.Nested.Color.blue); - test(v.zeroI === 0); - test(v.zeroL.equals(new Ice.Long(0, 0))); - test(v.zeroF === 0); - test(v.zeroDotF === 0); - test(v.zeroD === 0); - test(v.zeroDotD === 0); - } - out.writeLine("ok"); + { + const v = new Test.DerivedEx(); + test(!v.boolFalse); + test(v.boolTrue); + test(v.b === 1); + test(v.s === 2); + test(v.i === 3); + test(v.l.equals(new Ice.Long(0, 4))); + test(v.f === 5.1); + test(v.d === 6.2); + test(v.str == "foo \\ \"bar\n \r\n\t\u000b\f\u0007\b?"); + test(v.noDefault === ""); + test(v.c1 === Test.Color.red); + test(v.c2 === Test.Color.green); + test(v.c3 === Test.Color.blue); + test(v.nc1 === Test.Nested.Color.red); + test(v.nc2 === Test.Nested.Color.green); + test(v.nc3 === Test.Nested.Color.blue); + test(v.zeroI === 0); + test(v.zeroL.equals(new Ice.Long(0, 0))); + test(v.zeroF === 0); + test(v.zeroDotF === 0); + test(v.zeroD === 0); + test(v.zeroDotD === 0); + } + out.writeLine("ok"); - out.write("testing default constructor... "); - { - const v2 = new Test.StructNoDefaults(); - test(v2.bo === false); - test(v2.b === 0); - test(v2.s === 0); - test(v2.i === 0); - test(v2.l.equals(new Ice.Long(0, 0))); - test(v2.f === 0.0); - test(v2.d === 0.0); - test(v2.str === ""); - test(v2.c1 == Test.Color.red); - test(v2.bs === null); - test(v2.is === null); - test(v2.st !== null && v2.st instanceof Test.InnerStruct); - test(v2.dict === null); - } + out.write("testing default constructor... "); + { + const v2 = new Test.StructNoDefaults(); + test(v2.bo === false); + test(v2.b === 0); + test(v2.s === 0); + test(v2.i === 0); + test(v2.l.equals(new Ice.Long(0, 0))); + test(v2.f === 0.0); + test(v2.d === 0.0); + test(v2.str === ""); + test(v2.c1 == Test.Color.red); + test(v2.bs === null); + test(v2.is === null); + test(v2.st !== null && v2.st instanceof Test.InnerStruct); + test(v2.dict === null); + } - { - const e = new Test.ExceptionNoDefaults(); - test(e.str === ""); - test(e.c1 == Test.Color.red); - test(e.bs === null); - test(e.st !== null && e.st instanceof Test.InnerStruct); - test(e.dict === null); - } + { + const e = new Test.ExceptionNoDefaults(); + test(e.str === ""); + test(e.c1 == Test.Color.red); + test(e.bs === null); + test(e.st !== null && e.st instanceof Test.InnerStruct); + test(e.dict === null); + } + { + const cl = new Test.ClassNoDefaults(); + test(cl.str === ""); + test(cl.c1 == Test.Color.red); + test(cl.bs === null); + test(cl.st !== null && cl.st instanceof Test.InnerStruct); + test(cl.dict === null); + } + out.writeLine("ok"); + return Promise.resolve(); + } + catch(ex) { - const cl = new Test.ClassNoDefaults(); - test(cl.str === ""); - test(cl.c1 == Test.Color.red); - test(cl.bs === null); - test(cl.st !== null && cl.st instanceof Test.InnerStruct); - test(cl.dict === null); + return Promise.reject(ex); } - out.writeLine("ok"); } exports._test = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/enums/Client.js b/js/test/Ice/enums/Client.js index 746a6f0b4a9..75bf9d1dd3b 100644 --- a/js/test/Ice/enums/Client.js +++ b/js/test/Ice/enums/Client.js @@ -24,12 +24,12 @@ out.write("testing stringToProxy... "); const ref = "test:default -p 12010"; - let base = communicator.stringToProxy(ref); + const base = communicator.stringToProxy(ref); test(base !== null); out.writeLine("ok"); out.write("testing checked cast... "); - let proxy = await Test.TestIntfPrx.checkedCast(base); + const proxy = await Test.TestIntfPrx.checkedCast(base); test(proxy !== null); test(proxy.equals(base)); out.writeLine("ok"); @@ -50,7 +50,7 @@ test(Test.ByteEnum.valueOf(0) === Test.ByteEnum.benum1); test(Test.ByteEnum.valueOf(1) === Test.ByteEnum.benum2); test(Test.ByteEnum.valueOf(Test.ByteConst1) === Test.ByteEnum.benum3); - test(Test.ByteEnum.valueOf(Test.ByteConst1+ 1) === Test.ByteEnum.benum4); + test(Test.ByteEnum.valueOf(Test.ByteConst1 + 1) === Test.ByteEnum.benum4); test(Test.ByteEnum.valueOf(Test.ShortConst1) === Test.ByteEnum.benum5); test(Test.ByteEnum.valueOf(Test.ShortConst1 + 1) === Test.ByteEnum.benum6); test(Test.ByteEnum.valueOf(Test.IntConst1) === Test.ByteEnum.benum7); @@ -189,7 +189,6 @@ } exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptions/AMDThrowerI.js b/js/test/Ice/exceptions/AMDThrowerI.js index cc1b3e08998..d1db94619a8 100644 --- a/js/test/Ice/exceptions/AMDThrowerI.js +++ b/js/test/Ice/exceptions/AMDThrowerI.js @@ -22,27 +22,27 @@ class AMDThrowerI extends Test.Thrower { - async shutdown(current) + shutdown(current) { current.adapter.getCommunicator().shutdown(); } - async supportsUndeclaredExceptions(current) + supportsUndeclaredExceptions(current) { return true; } - async supportsAssertException(current) + supportsAssertException(current) { return false; } - async throwAasA(a, current) + throwAasA(a, current) { throw new Test.A(a); } - async throwAorDasAorD(a, current) + throwAorDasAorD(a, current) { if(a > 0) { @@ -59,7 +59,7 @@ return this.throwBasB(a, b, current); } - async throwBasB(a, b, current) + throwBasB(a, b, current) { throw new Test.B(a, b); } @@ -74,64 +74,61 @@ return this.throwCasC(a, b, c, current); } - async throwCasC(a, b, c, current) + throwCasC(a, b, c, current) { throw new Test.C(a, b, c); } - async throwUndeclaredA(a, current) + throwUndeclaredA(a, current) { throw new Test.A(a); } - async throwUndeclaredB(a, b, current) + throwUndeclaredB(a, b, current) { throw new Test.B(a, b); } - async throwUndeclaredC(a, b, c, current) + throwUndeclaredC(a, b, c, current) { throw new Test.C(a, b, c); } - async throwLocalException(current) + throwLocalException(current) { throw new Ice.TimeoutException(); } - async throwLocalExceptionIdempotent(current) + throwLocalExceptionIdempotent(current) { throw new Ice.TimeoutException(); } - async throwNonIceException(current) + throwNonIceException(current) { throw new Error(); } - async throwAssertException(current) + throwAssertException(current) { test(false); } - async throwMemoryLimitException(seq, current) + throwMemoryLimitException(seq, current) { return new Uint8Array(1024 * 20); // 20KB is over the configured 10KB message size max. } - async throwAfterResponse(current) + throwAfterResponse(current) { - //throw new Error(); } - async throwAfterException(current) + throwAfterException(current) { throw new Test.A(); - //throw new Error(); } } exports.AMDThrowerI = AMDThrowerI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptions/Client.js b/js/test/Ice/exceptions/Client.js index de737376aef..fd897c2be06 100644 --- a/js/test/Ice/exceptions/Client.js +++ b/js/test/Ice/exceptions/Client.js @@ -51,7 +51,7 @@ try { await communicator.createObjectAdapter("TestAdapter0"); - test(false) + test(false); } catch(ex) { @@ -71,7 +71,7 @@ out.write("testing servant registration exceptions... "); { - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.add(new EmptyI(), Ice.stringToIdentity("x")); try { @@ -120,7 +120,7 @@ out.write("testing servant locator registration exceptions... "); { - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.addServantLocator(new ServantLocatorI(), "x"); try { @@ -149,13 +149,13 @@ out.writeLine("ok"); out.write("testing stringToProxy... "); - let ref = "thrower:default -p 12010"; - let base = communicator.stringToProxy(ref); + const ref = "thrower:default -p 12010"; + const base = communicator.stringToProxy(ref); test(base !== null); out.writeLine("ok"); out.write("testing checked cast... "); - let thrower = await Test.ThrowerPrx.checkedCast(base); + const thrower = await Test.ThrowerPrx.checkedCast(base); test(thrower !== null); test(thrower.equals(base)); out.writeLine("ok"); @@ -386,7 +386,7 @@ out.write("catching object not exist exception... "); try { - let thrower2 = Test.ThrowerPrx.uncheckedCast( + const thrower2 = Test.ThrowerPrx.uncheckedCast( thrower.ice_identity(Ice.stringToIdentity("does not exist"))); await thrower2.ice_ping(); test(false); @@ -401,7 +401,7 @@ out.write("catching facet not exist exception... "); try { - let thrower2 = Test.ThrowerPrx.uncheckedCast(thrower, "no such facet"); + const thrower2 = Test.ThrowerPrx.uncheckedCast(thrower, "no such facet"); await thrower2.ice_ping(); test(false); } @@ -415,7 +415,7 @@ out.write("catching operation not exist exception... "); try { - let thrower2 = Test.WrongOperationPrx.uncheckedCast(thrower); + const thrower2 = Test.WrongOperationPrx.uncheckedCast(thrower); await thrower2.noSuchOperation(); test(false); } @@ -479,7 +479,7 @@ async function run(out, initData) { - let communicator + let communicator; try { initData.properties.setProperty("Ice.MessageSizeMax", "10"); @@ -499,7 +499,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptions/Server.js b/js/test/Ice/exceptions/Server.js index f4238648f70..8660cde9565 100644 --- a/js/test/Ice/exceptions/Server.js +++ b/js/test/Ice/exceptions/Server.js @@ -26,10 +26,10 @@ { communicator = Ice.initialize(initData); echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010")); - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.add(new ThrowerI(), Ice.stringToIdentity("thrower")); await echo.setConnection(); - let connection = echo.ice_getCachedConnection(); + const connection = echo.ice_getCachedConnection(); connection.setCloseCallback(con => { // Re-establish connection if it fails (necessary for MemoryLimitException test) echo.setConnection().then(() => echo.ice_getCachedConnection().setAdapter(adapter)); @@ -59,7 +59,6 @@ } } exports._server = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptions/ServerAMD.js b/js/test/Ice/exceptions/ServerAMD.js index 72a0973bf94..83c35ba0ad3 100644 --- a/js/test/Ice/exceptions/ServerAMD.js +++ b/js/test/Ice/exceptions/ServerAMD.js @@ -26,10 +26,10 @@ { communicator = Ice.initialize(initData); echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010")); - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.add(new AMDThrowerI(), Ice.stringToIdentity("thrower")); await echo.setConnection(); - let connection = echo.ice_getCachedConnection(); + const connection = echo.ice_getCachedConnection(); connection.setCloseCallback(con => { // Re-establish connection if it fails (necessary for MemoryLimitException test) echo.setConnection().then(() => echo.ice_getCachedConnection().setAdapter(adapter)); @@ -60,7 +60,6 @@ } } exports._serveramd = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptions/ThrowerI.js b/js/test/Ice/exceptions/ThrowerI.js index 60dc10ad723..8055aa2fd23 100644 --- a/js/test/Ice/exceptions/ThrowerI.js +++ b/js/test/Ice/exceptions/ThrowerI.js @@ -135,7 +135,6 @@ } } exports.ThrowerI = ThrowerI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/facets/Client.js b/js/test/Ice/facets/Client.js index 9c3a937303f..f29eec247d2 100644 --- a/js/test/Ice/facets/Client.js +++ b/js/test/Ice/facets/Client.js @@ -23,8 +23,8 @@ } out.write("testing stringToProxy... "); - let ref = "d:default -p 12010"; - let db = communicator.stringToProxy(ref); + const ref = "d:default -p 12010"; + const db = communicator.stringToProxy(ref); test(db !== null); out.writeLine("ok"); @@ -62,7 +62,7 @@ test(df.ice_getFacet() == "facetABCD"); df2 = await Test.DPrx.checkedCast(df); test(df2.ice_getFacet() == "facetABCD"); - def3 = await Test.DPrx.checkedCast(df, ""); + df3 = await Test.DPrx.checkedCast(df, ""); test(df3.ice_getFacet().length === 0); out.writeLine("ok"); @@ -86,19 +86,19 @@ out.writeLine("ok"); out.write("testing facets E and F... "); - let ff = await Test.FPrx.checkedCast(d, "facetEF"); + const ff = await Test.FPrx.checkedCast(d, "facetEF"); test(await ff.callE() == "E"); test(await ff.callF() == "F"); out.writeLine("ok"); out.write("testing facet G... "); - let gf = await Test.GPrx.checkedCast(ff, "facetGH"); + const gf = await Test.GPrx.checkedCast(ff, "facetGH"); test(gf !== null); test(await gf.callG() == "G"); out.writeLine("ok"); out.write("testing whether casting preserves the facet... "); - let hf = await Test.HPrx.checkedCast(gf); + const hf = await Test.HPrx.checkedCast(gf); test(hf !== null); test(await hf.callG() == "G"); test(await hf.callH() == "H"); @@ -126,7 +126,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/facets/Server.js b/js/test/Ice/facets/Server.js index 2de1296083c..e0ad7a92e89 100644 --- a/js/test/Ice/facets/Server.js +++ b/js/test/Ice/facets/Server.js @@ -40,7 +40,7 @@ out.write("testing facet registration exceptions... "); let adapter = await communicator.createObjectAdapter(""); - let obj = new EmptyI(); + const obj = new EmptyI(); adapter.add(obj, Ice.stringToIdentity("d")); adapter.addFacet(obj, Ice.stringToIdentity("d"), "facetABCD"); try @@ -66,11 +66,11 @@ out.writeLine("ok"); out.write("testing removeAllFacets... "); - let obj1 = new EmptyI(); - let obj2 = new EmptyI(); + const obj1 = new EmptyI(); + const obj2 = new EmptyI(); adapter.addFacet(obj1, Ice.stringToIdentity("id1"), "f1"); adapter.addFacet(obj2, Ice.stringToIdentity("id1"), "f2"); - let obj3 = new EmptyI(); + const obj3 = new EmptyI(); adapter.addFacet(obj1, Ice.stringToIdentity("id2"), "f1"); adapter.addFacet(obj2, Ice.stringToIdentity("id2"), "f2"); adapter.addFacet(obj3, Ice.stringToIdentity("id2"), ""); @@ -97,12 +97,12 @@ await adapter.deactivate(); adapter = await communicator.createObjectAdapter(""); - let di = new DI(); + const di = new DI(); adapter.add(di, Ice.stringToIdentity("d")); adapter.addFacet(di, Ice.stringToIdentity("d"), "facetABCD"); - let fi = new FI(); + const fi = new FI(); adapter.addFacet(fi, Ice.stringToIdentity("d"), "facetEF"); - let hi = new HI(); + const hi = new HI(); adapter.addFacet(hi, Ice.stringToIdentity("d"), "facetGH"); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); @@ -131,7 +131,6 @@ } exports._server = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/facets/TestI.js b/js/test/Ice/facets/TestI.js index 4efa0c7f6b2..7c7490d6580 100644 --- a/js/test/Ice/facets/TestI.js +++ b/js/test/Ice/facets/TestI.js @@ -9,7 +9,6 @@ (function(module, require, exports) { - const Ice = require("ice").Ice; const Test = require("Test").Test; class DI extends Test.D @@ -74,7 +73,6 @@ exports.EmptyI = EmptyI; exports.FI = FI; exports.HI = HI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/hold/Client.js b/js/test/Ice/hold/Client.js index ad4ee61ce17..005e660afc2 100644 --- a/js/test/Ice/hold/Client.js +++ b/js/test/Ice/hold/Client.js @@ -284,7 +284,6 @@ } exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/import/.eslintrc.js b/js/test/Ice/import/.eslintrc.js new file mode 100644 index 00000000000..0f21210ee9d --- /dev/null +++ b/js/test/Ice/import/.eslintrc.js @@ -0,0 +1,16 @@ +module.exports = { + "env": { + "browser": true, + "es6": true, + "node": true, + "worker": true + }, + "extends": "../../../.eslintrc.js", + "parserOptions": { + "ecmaVersion": 8, + "sourceType": "module" + }, + "rules": { + "sort-imports": "off" + } +}; diff --git a/js/test/Ice/import/main.js b/js/test/Ice/import/main.js index 583788fe12e..e45711e2518 100644 --- a/js/test/Ice/import/main.js +++ b/js/test/Ice/import/main.js @@ -8,12 +8,13 @@ // ********************************************************************** import ice from "ice"; + const Ice = ice.Ice; -import { Demo } from "./Demo/Point"; +import {Demo} from "./Demo/Point"; +import "./Demo/Canvas"; import "./Demo/Circle"; import "./Demo/Square"; -import "./Demo/Canvas"; function test(value) { @@ -24,16 +25,16 @@ function test(value) } console.log("testing import/export modules"); -let point = new Demo.gx.Point(10, 10); +const point = new Demo.gx.Point(10, 10); test(point.x === 10); test(point.y === 10); -let circle = new Demo.gx.Circle(new Demo.gx.Point(10, 10), 100); +const circle = new Demo.gx.Circle(new Demo.gx.Point(10, 10), 100); test(circle.center.x == 10); test(circle.center.y == 10); test(circle.radius == 100); -let square = new Demo.gx.Square( +const square = new Demo.gx.Square( new Demo.gx.Point(0, 0), new Demo.gx.Point(10, 0), new Demo.gx.Point(10, 10), @@ -51,11 +52,11 @@ test(square.p3.y === 10); test(square.p4.x === 0); test(square.p4.y === 10); -let communicator = Ice.initialize(); -let session = Demo.gx.SessionPrx.uncheckedCast(communicator.stringToProxy("demo:default -h 127.0.0.1")); +const communicator = Ice.initialize(); +const session = Demo.gx.SessionPrx.uncheckedCast(communicator.stringToProxy("demo:default -h 127.0.0.1")); test(session !== undefined); -let canvas = Demo.gx.CanvasPrx.uncheckedCast(communicator.stringToProxy("demo:default -h 127.0.0.1")); +const canvas = Demo.gx.CanvasPrx.uncheckedCast(communicator.stringToProxy("demo:default -h 127.0.0.1")); test(canvas !== undefined); communicator.destroy().then(() => console.log("ok")); diff --git a/js/test/Ice/info/Client.js b/js/test/Ice/info/Client.js index b3b9bd38d6c..79602cabe8b 100644 --- a/js/test/Ice/info/Client.js +++ b/js/test/Ice/info/Client.js @@ -10,7 +10,6 @@ (function(module, require, exports) { const Ice = require("ice").Ice; - const IceSSL = require("ice").IceSSL; const Test = require("Test").Test; function getTCPEndpointInfo(info) @@ -54,9 +53,9 @@ "test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:opaque -e 1.8 -t 100 -v ABCD"; const p1 = communicator.stringToProxy(ref); - let endps = p1.ice_getEndpoints(); - let endpoint = endps[0].getInfo(); - let ipEndpoint = getTCPEndpointInfo(endpoint); + const endps = p1.ice_getEndpoints(); + const endpoint = endps[0].getInfo(); + const ipEndpoint = getTCPEndpointInfo(endpoint); test(ipEndpoint.host == "tcphost"); test(ipEndpoint.port == 10000); test(ipEndpoint.timeout == 1200); @@ -71,13 +70,13 @@ ipEndpoint.type() == Ice.WSEndpointType && endpoint instanceof Ice.WSEndpointInfo || ipEndpoint.type() == Ice.WSSEndpointType && endpoint instanceof Ice.WSEndpointInfo); - let opaqueEndpoint = endps[1].getInfo(); + const opaqueEndpoint = endps[1].getInfo(); test(opaqueEndpoint.rawEncoding.equals(new Ice.EncodingVersion(1, 8))); out.writeLine("ok"); out.write("testing connection endpoint information... "); - let base = communicator.stringToProxy("test:default -p 12010"); - let testIntf = Test.TestIntfPrx.uncheckedCast(base); + const base = communicator.stringToProxy("test:default -p 12010"); + const testIntf = Test.TestIntfPrx.uncheckedCast(base); let conn = await base.ice_getConnection(); let ipinfo = getTCPEndpointInfo(conn.getEndpoint().getInfo()); @@ -96,7 +95,7 @@ conn = await base.ice_getConnection(); conn.setBufferSize(1024, 2048); - info = conn.getInfo(); + const info = conn.getInfo(); ipinfo = getTCPConnectionInfo(info); test(!info.incoming); test(info.adapterName.length === 0); @@ -113,7 +112,6 @@ test(ipinfo.localAddress == defaultHost); } } - //test(info.rcvSize >= 1024); test(info.sndSize >= 2048); ctx = await testIntf.getConnectionInfoAsContext(); @@ -123,17 +121,12 @@ { test(ctx.get("remoteAddress") == info.localAddress); test(ctx.get("localAddress") == info.remoteAddress); - test(parseInt(ctx.get("remotePort")) == info.localPort); - test(parseInt(ctx.get("localPort")) == info.remotePort); + test(parseInt(ctx.get("remotePort")) === info.localPort); + test(parseInt(ctx.get("localPort")) === info.remotePort); } if(conn.type() == "ws" || conn.type() == "wss") { - //test(info.headers["Upgrade"] == "websocket"); - //test(info.headers.get("Connection") == "Upgrade"); - //test(info.headers.get("Sec-WebSocket-Protocol") == "ice.zeroc.com"); - //test(info.headers.get("Sec-WebSocket-Accept") != null); - test(ctx.get("ws.Upgrade").toLowerCase() == "websocket"); test(ctx.get("ws.Connection").indexOf("Upgrade") >= 0); test(ctx.get("ws.Sec-WebSocket-Protocol") == "ice.zeroc.com"); @@ -164,7 +157,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/inheritance/Client.js b/js/test/Ice/inheritance/Client.js index 8b988ca007b..42b7f6d943d 100644 --- a/js/test/Ice/inheritance/Client.js +++ b/js/test/Ice/inheritance/Client.js @@ -23,22 +23,22 @@ } out.write("testing stringToProxy... "); - let ref = "initial:default -p 12010"; - let base = communicator.stringToProxy(ref); + const ref = "initial:default -p 12010"; + const base = communicator.stringToProxy(ref); test(base !== null); out.writeLine("ok"); out.write("testing checked cast... "); - let initial = await Test.InitialPrx.checkedCast(base); + const initial = await Test.InitialPrx.checkedCast(base); test(initial !== null); test(initial.equals(base)); out.writeLine("ok"); out.write("getting proxies for class hierarchy... "); - let ca = await initial.caop(); - let cb = await initial.cbop(); - let cc = await initial.ccop(); - let cd = await initial.cdop(); + const ca = await initial.caop(); + const cb = await initial.cbop(); + const cc = await initial.ccop(); + const cd = await initial.cdop(); test(ca != cb); test(ca != cc); test(ca != cd); @@ -48,10 +48,10 @@ out.writeLine("ok"); out.write("getting proxies for interface hierarchy... "); - let ia = await initial.iaop(); - let ib1 = await initial.ib1op(); - let ib2 = await initial.ib2op(); - let ic = await initial.icop(); + const ia = await initial.iaop(); + const ib1 = await initial.ib1op(); + const ib2 = await initial.ib2op(); + const ic = await initial.icop(); test(ia != ib1); test(ia != ib2); test(ia != ic); @@ -60,11 +60,8 @@ out.writeLine("ok"); out.write("invoking proxy operations on class hierarchy... "); - let cao; - let cbo; - let cco; - cao = await ca.caop(ca); + let cao = await ca.caop(ca); test(cao.equals(ca)); cao = await ca.caop(cb); test(cao.equals(cb)); @@ -85,7 +82,7 @@ cao = await cb.cbop(cb); test(cao.equals(cb)); - cbo = await cb.cbop(cb); + let cbo = await cb.cbop(cb); test(cbo.equals(cb)); cao = await cb.cbop(cc); test(cao.equals(cc)); @@ -104,7 +101,7 @@ test(cao.equals(cc)); cbo = await cc.ccop(cc); test(cbo.equals(cc)); - cco = await cc.ccop(cc); + let cco = await cc.ccop(cc); test(cco.equals(cc)); out.writeLine("ok"); @@ -112,7 +109,6 @@ let iao; let ib1o; let ib2o; - let ico; iao = await ia.iaop(ia); test(iao.equals(ia)); @@ -187,7 +183,7 @@ test(ib1o.equals(ic)); ib2o = await ic.icop(ic); test(ib2o.equals(ic)); - ico = await ic.icop(ic); + const ico = await ic.icop(ic); test(ico.equals(ic)); out.writeLine("ok"); @@ -222,7 +218,7 @@ out.writeLine("ok"); await initial.shutdown(); - }; + } async function run(out, initData) { @@ -243,7 +239,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/inheritance/InitialI.js b/js/test/Ice/inheritance/InitialI.js index e3cd0d3ee0d..1ea9030c1eb 100644 --- a/js/test/Ice/inheritance/InitialI.js +++ b/js/test/Ice/inheritance/InitialI.js @@ -9,7 +9,6 @@ (function(module, require, exports) { - const Ice = require("ice").Ice; const Test = require("Test").Test; class CAI extends Test.MA.CADisp @@ -209,7 +208,6 @@ } exports.InitialI = InitialI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/inheritance/Server.js b/js/test/Ice/inheritance/Server.js index a413678b510..746b3723c27 100644 --- a/js/test/Ice/inheritance/Server.js +++ b/js/test/Ice/inheritance/Server.js @@ -52,7 +52,6 @@ } } exports._server = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/location/Client.js b/js/test/Ice/location/Client.js index b1eb15649b4..942f50b4498 100644 --- a/js/test/Ice/location/Client.js +++ b/js/test/Ice/location/Client.js @@ -27,27 +27,27 @@ } } - let manager = Test.ServerManagerPrx.uncheckedCast(communicator.stringToProxy("ServerManager:default -p 12010")); + const manager = Test.ServerManagerPrx.uncheckedCast(communicator.stringToProxy("ServerManager:default -p 12010")); test(manager !== null); - let locator = Test.TestLocatorPrx.uncheckedCast(communicator.getDefaultLocator()); + const locator = Test.TestLocatorPrx.uncheckedCast(communicator.getDefaultLocator()); test(locator !== null); - let registry = Test.TestLocatorRegistryPrx.uncheckedCast(await locator.getRegistry()); + const registry = Test.TestLocatorRegistryPrx.uncheckedCast(await locator.getRegistry()); test(registry !== null); out.write("testing stringToProxy... "); let base = communicator.stringToProxy("test @ TestAdapter"); - let base2 = communicator.stringToProxy("test @ TestAdapter"); - let base3 = communicator.stringToProxy("test"); - let base4 = communicator.stringToProxy("ServerManager"); - let base5 = communicator.stringToProxy("test2"); - let base6 = communicator.stringToProxy("test @ ReplicatedAdapter"); + const base2 = communicator.stringToProxy("test @ TestAdapter"); + const base3 = communicator.stringToProxy("test"); + const base4 = communicator.stringToProxy("ServerManager"); + const base5 = communicator.stringToProxy("test2"); + const base6 = communicator.stringToProxy("test @ ReplicatedAdapter"); out.writeLine("ok"); out.write("testing ice_locator and ice_getLocator... "); test(Ice.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) === 0); - let anotherLocator = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("anotherLocator")); + const anotherLocator = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("anotherLocator")); base = base.ice_locator(anotherLocator); test(Ice.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) === 0); communicator.setDefaultLocator(null); @@ -64,10 +64,10 @@ // test/Ice/router test?) // test(base.ice_getRouter() === null); - anotherRouter = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("anotherRouter")); + const anotherRouter = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("anotherRouter")); base = base.ice_router(anotherRouter); test(Ice.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) === 0); - router = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("dummyrouter")); + const router = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("dummyrouter")); communicator.setDefaultRouter(router); base = communicator.stringToProxy("test @ TestAdapter"); test(Ice.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) === 0); @@ -84,19 +84,19 @@ let obj = await Test.TestIntfPrx.checkedCast(base); test(obj !== null); - let obj2 = await Test.TestIntfPrx.checkedCast(base2); + const obj2 = await Test.TestIntfPrx.checkedCast(base2); test(obj2 !== null); - let obj3 = await Test.TestIntfPrx.checkedCast(base3); + const obj3 = await Test.TestIntfPrx.checkedCast(base3); test(obj3 !== null); - let obj4 = await Test.ServerManagerPrx.checkedCast(base4); + const obj4 = await Test.ServerManagerPrx.checkedCast(base4); test(obj4 !== null); - let obj5 = await Test.TestIntfPrx.checkedCast(base5); + const obj5 = await Test.TestIntfPrx.checkedCast(base5); test(obj5 !== null); - let obj6 = await Test.TestIntfPrx.checkedCast(base6); + const obj6 = await Test.TestIntfPrx.checkedCast(base6); test(obj6 !== null); out.writeLine("ok"); @@ -219,7 +219,7 @@ for(let i = 0; i < 1000; i++) { results.push(hello.sayHello().catch( - (ex) => + ex => { test(false); })); @@ -243,7 +243,7 @@ { test(false); }, - (ex) => + ex => { test(ex instanceof Ice.NotRegisteredException, ex); })); @@ -412,10 +412,10 @@ out.write("testing locator cache background updates... "); { - let initData = new Ice.InitializationData(); + const initData = new Ice.InitializationData(); initData.properties = communicator.getProperties().clone(); initData.properties.setProperty("Ice.BackgroundLocatorCacheUpdates", "1"); - let ic = Ice.initialize(initData); + const ic = Ice.initialize(initData); await registry.setAdapterDirectProxy("TestAdapter5", await locator.findAdapterById("TestAdapter")); await registry.addObject(communicator.stringToProxy("test3@TestAdapter")); @@ -478,7 +478,7 @@ out.write("testing object migration... "); hello = await Test.HelloPrx.checkedCast(communicator.stringToProxy("hello")); await obj.migrateHello(); - let conn = await hello.ice_getConnection(); + const conn = await hello.ice_getConnection(); await conn.close(Ice.ConnectionClose.GracefullyWithWait); await hello.sayHello(); await obj.migrateHello(); @@ -523,7 +523,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/number/Client.js b/js/test/Ice/number/Client.js index 413d04976c1..98cf2b2dcb7 100644 --- a/js/test/Ice/number/Client.js +++ b/js/test/Ice/number/Client.js @@ -19,82 +19,88 @@ } } - async function run(out) + function run(out) { - out.write("Testing Ice.Long... "); - // - // Test positive numbers - // - test(new Ice.Long(0x00000000, 0x00000000).toNumber() === 0); // 0 - test(new Ice.Long(0x00000000, 0x00000001).toNumber() === 1); // 1 - test(new Ice.Long(0x00000000, 0x00000400).toNumber() === 1024); // 1024 - test(new Ice.Long(0x00000000, 0xFFFFFFFF).toNumber() === Math.pow(2, 32) - 1); // 2^32 - 1 - test(new Ice.Long(0x00000001, 0x00000000).toNumber() === Math.pow(2, 32)); // 2^32 - test(new Ice.Long(0x00000001, 0xFFFFFFFF).toNumber() === Math.pow(2, 33) - 1); // 2^33 - 1 - test(new Ice.Long(0x001FFFFF, 0xFFFFFFFF).toNumber() === Math.pow(2, 53) - 1); // 2^53 - 1 - test(new Ice.Long(0x00200000, 0x00000000).toNumber() === Number.POSITIVE_INFINITY); // 2^53 - - // - // Test negative numbers - // - test(new Ice.Long(0xFFFFFFFF, 0xFFFFFFFF).toNumber() === -1); - test(new Ice.Long(0xFFFFFFFF, 0xFFFFFFFE).toNumber() === -2); - test(new Ice.Long(0xFFFFFFFF, 0xFFFFFF9C).toNumber() === -100); + try + { + out.write("Testing Ice.Long... "); + // + // Test positive numbers + // + test(new Ice.Long(0x00000000, 0x00000000).toNumber() === 0); // 0 + test(new Ice.Long(0x00000000, 0x00000001).toNumber() === 1); // 1 + test(new Ice.Long(0x00000000, 0x00000400).toNumber() === 1024); // 1024 + test(new Ice.Long(0x00000000, 0xFFFFFFFF).toNumber() === Math.pow(2, 32) - 1); // 2^32 - 1 + test(new Ice.Long(0x00000001, 0x00000000).toNumber() === Math.pow(2, 32)); // 2^32 + test(new Ice.Long(0x00000001, 0xFFFFFFFF).toNumber() === Math.pow(2, 33) - 1); // 2^33 - 1 + test(new Ice.Long(0x001FFFFF, 0xFFFFFFFF).toNumber() === Math.pow(2, 53) - 1); // 2^53 - 1 + test(new Ice.Long(0x00200000, 0x00000000).toNumber() === Number.POSITIVE_INFINITY); // 2^53 - test(new Ice.Long(0xFFFFFFFF, 0x00000000).toNumber() === -Math.pow(2, 32)); // -(2^32) - test(new Ice.Long(0xFFFFFFFE, 0x00000000).toNumber() === -Math.pow(2, 33)); // -(2^33) - test(new Ice.Long(0xFFFFFFFE, 0x00000001).toNumber() === -(Math.pow(2, 33) - 1)); // -(2^33 - 1) - test(new Ice.Long(0xFFF00000, 0x00000000).toNumber() === -Math.pow(2, 52)); // -(2^52) - test(new Ice.Long(0xFFF00000, 0x00000001).toNumber() === -(Math.pow(2, 52) - 1)); // -(2^52 - 1) - test(new Ice.Long(0xFFE00000, 0x00000001).toNumber() === -(Math.pow(2, 53) - 1)); // -(2^53 - 1) - test(new Ice.Long(0xFFE00000, 0x00000000).toNumber() === Number.NEGATIVE_INFINITY); // -(2^53) + // + // Test negative numbers + // + test(new Ice.Long(0xFFFFFFFF, 0xFFFFFFFF).toNumber() === -1); + test(new Ice.Long(0xFFFFFFFF, 0xFFFFFFFE).toNumber() === -2); + test(new Ice.Long(0xFFFFFFFF, 0xFFFFFF9C).toNumber() === -100); - // - // Test conversion from positive number - // + test(new Ice.Long(0xFFFFFFFF, 0x00000000).toNumber() === -Math.pow(2, 32)); // -(2^32) + test(new Ice.Long(0xFFFFFFFE, 0x00000000).toNumber() === -Math.pow(2, 33)); // -(2^33) + test(new Ice.Long(0xFFFFFFFE, 0x00000001).toNumber() === -(Math.pow(2, 33) - 1)); // -(2^33 - 1) + test(new Ice.Long(0xFFF00000, 0x00000000).toNumber() === -Math.pow(2, 52)); // -(2^52) + test(new Ice.Long(0xFFF00000, 0x00000001).toNumber() === -(Math.pow(2, 52) - 1)); // -(2^52 - 1) + test(new Ice.Long(0xFFE00000, 0x00000001).toNumber() === -(Math.pow(2, 53) - 1)); // -(2^53 - 1) + test(new Ice.Long(0xFFE00000, 0x00000000).toNumber() === Number.NEGATIVE_INFINITY); // -(2^53) - test(new Ice.Long(0).toNumber() === 0); // 0 - test(new Ice.Long(1).toNumber() === 1); // 1 - test(new Ice.Long(1024).toNumber() === 1024); // 1024 - test(new Ice.Long(Math.pow(2, 32) - 1).toNumber() === Math.pow(2, 32) - 1); // 2^32 - 1 - test(new Ice.Long(Math.pow(2, 32)).toNumber() === Math.pow(2, 32)); // 2^32 - test(new Ice.Long(Math.pow(2, 33) - 1).toNumber() === Math.pow(2, 33) - 1); // 2^33 - 1 - test(new Ice.Long(Math.pow(2, 53) - 1).toNumber() === Math.pow(2, 53) - 1); // 2^53 - 1 + // + // Test conversion from positive number + // + test(new Ice.Long(0).toNumber() === 0); // 0 + test(new Ice.Long(1).toNumber() === 1); // 1 + test(new Ice.Long(1024).toNumber() === 1024); // 1024 + test(new Ice.Long(Math.pow(2, 32) - 1).toNumber() === Math.pow(2, 32) - 1); // 2^32 - 1 + test(new Ice.Long(Math.pow(2, 32)).toNumber() === Math.pow(2, 32)); // 2^32 + test(new Ice.Long(Math.pow(2, 33) - 1).toNumber() === Math.pow(2, 33) - 1); // 2^33 - 1 + test(new Ice.Long(Math.pow(2, 53) - 1).toNumber() === Math.pow(2, 53) - 1); // 2^53 - 1 - test(Ice.LongHelper.validate(new Ice.Long(0))); // 0 - test(Ice.LongHelper.validate(new Ice.Long(1))); // 1 - test(Ice.LongHelper.validate(new Ice.Long(1024))); // 1024 - test(Ice.LongHelper.validate(new Ice.Long(Math.pow(2, 32) - 1))); // 2^32 - 1 - test(Ice.LongHelper.validate(new Ice.Long(Math.pow(2, 32)))); // 2^32 - test(Ice.LongHelper.validate(new Ice.Long(Math.pow(2, 33) - 1))); // 2^33 - 1 - test(Ice.LongHelper.validate(new Ice.Long(Math.pow(2, 53) - 1))); // 2^53 - 1 + test(Ice.LongHelper.validate(new Ice.Long(0))); // 0 + test(Ice.LongHelper.validate(new Ice.Long(1))); // 1 + test(Ice.LongHelper.validate(new Ice.Long(1024))); // 1024 + test(Ice.LongHelper.validate(new Ice.Long(Math.pow(2, 32) - 1))); // 2^32 - 1 + test(Ice.LongHelper.validate(new Ice.Long(Math.pow(2, 32)))); // 2^32 + test(Ice.LongHelper.validate(new Ice.Long(Math.pow(2, 33) - 1))); // 2^33 - 1 + test(Ice.LongHelper.validate(new Ice.Long(Math.pow(2, 53) - 1))); // 2^53 - 1 - // - // Test conversion from negative number - // - test(new Ice.Long(-1).toNumber() === -1); - test(new Ice.Long(-2).toNumber() === -2); - test(new Ice.Long(-100).toNumber() === -100); + // + // Test conversion from negative number + // + test(new Ice.Long(-1).toNumber() === -1); + test(new Ice.Long(-2).toNumber() === -2); + test(new Ice.Long(-100).toNumber() === -100); - test(new Ice.Long(-Math.pow(2, 32)).toNumber() === -Math.pow(2, 32)); // -(2^32) - test(new Ice.Long(-Math.pow(2, 33)).toNumber() === -Math.pow(2, 33)); // -(2^33) - test(new Ice.Long(-Math.pow(2, 33) - 1).toNumber() === -Math.pow(2, 33) - 1); // -(2^33 - 1) - test(new Ice.Long(-Math.pow(2, 52)).toNumber() === -Math.pow(2, 52)); // -(2^52) - test(new Ice.Long(-Math.pow(2, 52) - 1).toNumber() === -Math.pow(2, 52) - 1); // -(2^52 - 1) + test(new Ice.Long(-Math.pow(2, 32)).toNumber() === -Math.pow(2, 32)); // -(2^32) + test(new Ice.Long(-Math.pow(2, 33)).toNumber() === -Math.pow(2, 33)); // -(2^33) + test(new Ice.Long(-Math.pow(2, 33) - 1).toNumber() === -Math.pow(2, 33) - 1); // -(2^33 - 1) + test(new Ice.Long(-Math.pow(2, 52)).toNumber() === -Math.pow(2, 52)); // -(2^52) + test(new Ice.Long(-Math.pow(2, 52) - 1).toNumber() === -Math.pow(2, 52) - 1); // -(2^52 - 1) - test(Ice.LongHelper.validate(new Ice.Long(-1))); - test(Ice.LongHelper.validate(new Ice.Long(-2))); - test(Ice.LongHelper.validate(new Ice.Long(-100))); - test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 32)))); // -(2^32) - test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 33)))); // -(2^33) - test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 33) - 1))); // -(2^33 - 1) - test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 52)))); // -(2^52) - test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 52) - 1))); // -(2^52 - 1) + test(Ice.LongHelper.validate(new Ice.Long(-1))); + test(Ice.LongHelper.validate(new Ice.Long(-2))); + test(Ice.LongHelper.validate(new Ice.Long(-100))); + test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 32)))); // -(2^32) + test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 33)))); // -(2^33) + test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 33) - 1))); // -(2^33 - 1) + test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 52)))); // -(2^52) + test(Ice.LongHelper.validate(new Ice.Long(-Math.pow(2, 52) - 1))); // -(2^52 - 1) - out.writeLine("ok"); + out.writeLine("ok"); + return Promise.resolve(); + } + catch(ex) + { + return Promise.reject(ex); + } } exports._test = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/objects/Client.js b/js/test/Ice/objects/Client.js index c24b186c57a..1ee5f2cbf8c 100644 --- a/js/test/Ice/objects/Client.js +++ b/js/test/Ice/objects/Client.js @@ -175,7 +175,7 @@ out.writeLine("ok"); out.write("testing checked cast... "); - let initial = await Test.InitialPrx.checkedCast(base); + const initial = await Test.InitialPrx.checkedCast(base); test(initial !== null); test(initial.equals(base)); out.writeLine("ok"); @@ -202,11 +202,6 @@ out.write("checking consistency... "); test(b1 !== b2); - //test(b1 != c); - //test(b1 != d); - //test(b2 != c); - //test(b2 != d); - //test(c != d); test(b1.theB === b1); test(b1.theC === null); @@ -240,11 +235,6 @@ out.write("checking consistency... "); test(b1 !== b2); - //test(b1 != c); - //test(b1 != d); - //test(b2 != c); - //test(b2 != d); - //test(c != d); test(b1.theA === b2); test(b1.theB === b1); test(b1.theC === null); @@ -266,28 +256,28 @@ out.writeLine("ok"); out.write("testing protected members... "); - let e = await initial.getE(); + const e = await initial.getE(); test(e.checkValues()); - let f = await initial.getF(); + const f = await initial.getF(); test(f.checkValues()); test(f.e2.checkValues()); out.writeLine("ok"); out.write("getting I, J and H... "); - let i = await initial.getI(); + const i = await initial.getI(); test(i); - let j = await initial.getJ(); + const j = await initial.getJ(); test(j); - let h = await initial.getH(); + const h = await initial.getH(); test(h); out.writeLine("ok"); out.write("getting D1... "); - let d1 = await initial.getD1(new Test.D1(new Test.A1("a1"), - new Test.A1("a2"), - new Test.A1("a3"), - new Test.A1("a4"))); + const d1 = await initial.getD1(new Test.D1(new Test.A1("a1"), + new Test.A1("a2"), + new Test.A1("a3"), + new Test.A1("a4"))); test(d1.a1.name == "a1"); test(d1.a2.name == "a2"); @@ -336,7 +326,7 @@ out.write("testing recursive types... "); - let top = new Test.Recursive(); + const top = new Test.Recursive(); let p = top; let depth = 0; @@ -358,9 +348,14 @@ } catch(ex) { - test((ex instanceof Ice.UnknownLocalException) || // Expected marshal exception from the server (max class graph depth reached) - (ex instanceof Ice.UnknownException) || // Expected stack overflow from the server (Java only) - (ex instanceof Error), ex); // Expected, JavaScript stack overflow + // + // Ice.UnknownLocalException: Expected marshal exception from the server (max class graph depth reached) + // Ice.UnknownException: Expected stack overflow from the server (Java only) + // Error: Expected, JavaScript stack overflow + // + test((ex instanceof Ice.UnknownLocalException) || + (ex instanceof Ice.UnknownException) || + (ex instanceof Error), ex); } await initial.setRecursive(new Test.Recursive()); out.writeLine("ok"); @@ -381,7 +376,7 @@ base = communicator.stringToProxy(ref); test(base !== null); - let uoet = Test.UnexpectedObjectExceptionTestPrx.uncheckedCast(base); + const uoet = Test.UnexpectedObjectExceptionTestPrx.uncheckedCast(base); test(uoet !== null); try { @@ -458,7 +453,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/objects/InitialI.js b/js/test/Ice/objects/InitialI.js index 27ed739e0ed..f209b35e634 100644 --- a/js/test/Ice/objects/InitialI.js +++ b/js/test/Ice/objects/InitialI.js @@ -309,7 +309,6 @@ } exports.InitialI = InitialI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/objects/Server.js b/js/test/Ice/objects/Server.js index 5d69f6f2a71..f9d5bc6f270 100644 --- a/js/test/Ice/objects/Server.js +++ b/js/test/Ice/objects/Server.js @@ -33,7 +33,7 @@ { communicator = Ice.initialize(initData); echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010")); - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.add(new InitialI(communicator), Ice.stringToIdentity("initial")); adapter.add(new UnexpectedObjectExceptionTestI(), Ice.stringToIdentity("uoet")); await echo.setConnection(); @@ -63,7 +63,6 @@ } exports._server = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/AMDMyDerivedClassI.js b/js/test/Ice/operations/AMDMyDerivedClassI.js index 45f46f98be8..d4739ff5ea1 100644 --- a/js/test/Ice/operations/AMDMyDerivedClassI.js +++ b/js/test/Ice/operations/AMDMyDerivedClassI.js @@ -56,51 +56,51 @@ return Ice.Object.prototype.ice_id.call(this, current); } - async shutdown(current) + shutdown(current) { current.adapter.getCommunicator().shutdown(); } - async supportsCompress(current) + supportsCompress(current) { return false; } - async opVoid(current) + opVoid(current) { test(current.mode === Ice.OperationMode.Normal); } - async opBool(p1, p2, current) + opBool(p1, p2, current) { return [p2, p1]; } - async opBoolS(p1, p2, current) + opBoolS(p1, p2, current) { const p3 = p1.concat(p2); return [p1.reverse(), p3]; } - async opBoolSS(p1, p2, current) + opBoolSS(p1, p2, current) { const p3 = p1.concat(p2); return [p1.reverse(), p3]; } - async opByte(p1, p2, current) + opByte(p1, p2, current) { return [p1, (p1 ^ p2) & 0xff]; } - async opByteBoolD(p1, p2, current) + opByteBoolD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); return [r, p1]; } - async opByteS(p1, p2, current) + opByteS(p1, p2, current) { const p3 = new Uint8Array(p1.length); for(let i = 0; i < p1.length; i++) @@ -120,39 +120,39 @@ return [r, p3]; } - async opByteSS(p1, p2, current) + opByteSS(p1, p2, current) { const r = p1.concat(p2); return [r, p1.reverse()]; } - async opFloatDouble(p1, p2, current) + opFloatDouble(p1, p2, current) { return [p2, p1, p2]; } - async opFloatDoubleS(p1, p2, current) + opFloatDoubleS(p1, p2, current) { const r = p2.concat(p1); const p4 = p2.reverse(); return [r, p1, p4]; } - async opFloatDoubleSS(p1, p2, current) + opFloatDoubleSS(p1, p2, current) { const r = p2.concat(p2); const p4 = p2.reverse(); return [r, p1, p4]; } - async opLongFloatD(p1, p2, current) + opLongFloatD(p1, p2, current) { const r = new Ice.HashMap(p1); p2.forEach((value, key) => r.set(key, value)); return [r, p1]; } - async opMyClass(p1, current) + opMyClass(p1, current) { const p2 = p1; const p3 = Test.MyClassPrx.uncheckedCast( @@ -161,109 +161,109 @@ return [r.ice_endpoints(this._endpoints), p2, p3.ice_endpoints(this._endpoints)]; } - async opMyEnum(p1, current) + opMyEnum(p1, current) { return [Test.MyEnum.enum3, p1]; } - async opShortIntD(p1, p2, current) + opShortIntD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); return [r, p1]; } - async opShortIntLong(p1, p2, p3, current) + opShortIntLong(p1, p2, p3, current) { return [p3, p1, p2, p3]; } - async opShortIntLongS(p1, p2, p3, current) + opShortIntLongS(p1, p2, p3, current) { return [p3, p1, p2.reverse(), p3.concat(p3)]; } - async opShortIntLongSS(p1, p2, p3, current) + opShortIntLongSS(p1, p2, p3, current) { return [p3, p1, p2.reverse(), p3.concat(p3)]; } - async opString(p1, p2, current) + opString(p1, p2, current) { return [p1 + " " + p2, p2 + " " + p1]; } - async opStringMyEnumD(p1, p2, current) + opStringMyEnumD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); return [r, p1]; } - async opMyEnumStringD(p1, p2, current) + opMyEnumStringD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); return [r, p1]; } - async opMyStructMyEnumD(p1, p2, current) + opMyStructMyEnumD(p1, p2, current) { const r = new Ice.HashMap(p1); p2.forEach((value, key) => r.set(key, value)); return [r, p1]; } - async opByteBoolDS(p1, p2, current) + opByteBoolDS(p1, p2, current) { const p3 = p2.concat(p1); const r = p1.reverse(); return [r, p3]; } - async opShortIntDS(p1, p2, current) + opShortIntDS(p1, p2, current) { const p3 = p2.concat(p1); const r = p1.reverse(); return [r, p3]; } - async opLongFloatDS(p1, p2, current) + opLongFloatDS(p1, p2, current) { const p3 = p2.concat(p1); const r = p1.reverse(); return [r, p3]; } - async opStringStringDS(p1, p2, current) + opStringStringDS(p1, p2, current) { const p3 = p2.concat(p1); const r = p1.reverse(); return [r, p3]; } - async opStringMyEnumDS(p1, p2, current) + opStringMyEnumDS(p1, p2, current) { const p3 = p2.concat(p1); const r = p1.reverse(); return [r, p3]; } - async opMyEnumStringDS(p1, p2, current) + opMyEnumStringDS(p1, p2, current) { const p3 = p2.concat(p1); const r = p1.reverse(); return [r, p3]; } - async opMyStructMyEnumDS(p1, p2, current) + opMyStructMyEnumDS(p1, p2, current) { const p3 = p2.concat(p1); const r = p1.reverse(); return [r, p3]; } - async opByteByteSD(p1, p2, current) + opByteByteSD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); @@ -271,7 +271,7 @@ return [r, p3]; } - async opBoolBoolSD(p1, p2, current) + opBoolBoolSD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); @@ -279,7 +279,7 @@ return [r, p3]; } - async opShortShortSD(p1, p2, current) + opShortShortSD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); @@ -287,7 +287,7 @@ return [r, p3]; } - async opIntIntSD(p1, p2, current) + opIntIntSD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); @@ -295,7 +295,7 @@ return [r, p3]; } - async opLongLongSD(p1, p2, current) + opLongLongSD(p1, p2, current) { const r = new Ice.HashMap(p1); p2.forEach((value, key) => r.set(key, value)); @@ -303,7 +303,7 @@ return [r, p3]; } - async opStringFloatSD(p1, p2, current) + opStringFloatSD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); @@ -311,7 +311,7 @@ return [r, p3]; } - async opStringDoubleSD(p1, p2, current) + opStringDoubleSD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); @@ -319,7 +319,7 @@ return [r, p3]; } - async opStringStringSD(p1, p2, current) + opStringStringSD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); @@ -327,7 +327,7 @@ return [r, p3]; } - async opMyEnumMyEnumSD(p1, p2, current) + opMyEnumMyEnumSD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); @@ -335,29 +335,29 @@ return [r, p3]; } - async opIntS(s, current) + opIntS(s, current) { return s.map(v => -v); } - async opByteSOneway(s, current) + opByteSOneway(s, current) { this._opByteSOnewayCount += 1; } - async opByteSOnewayCallCount(current) + opByteSOnewayCallCount(current) { const count = this._opByteSOnewayCount; this._opByteSOnewayCount = 0; return count; } - async opContext(current) + opContext(current) { return current.ctx; } - async opDoubleMarshaling(p1, p2, current) + opDoubleMarshaling(p1, p2, current) { const d = 1278312346.0 / 13.0; test(p1 === d); @@ -367,126 +367,128 @@ } } - async opStringS(p1, p2, current) + opStringS(p1, p2, current) { const p3 = p1.concat(p2); const r = p1.reverse(); return [r, p3]; } - async opStringSS(p1, p2, current) + opStringSS(p1, p2, current) { const p3 = p1.concat(p2); const r = p2.reverse(); return [r, p3]; } - async opStringSSS(p1, p2, current) + opStringSSS(p1, p2, current) { const p3 = p1.concat(p2); const r = p2.reverse(); return [r, p3]; } - async opStringStringD(p1, p2, current) + opStringStringD(p1, p2, current) { const r = new Map(p1); p2.forEach((value, key) => r.set(key, value)); return [r, p1]; } - async opStruct(p1, p2, current) + opStruct(p1, p2, current) { p1.s.s = "a new string"; return [p2, p1]; } - async opIdempotent(current) + opIdempotent(current) { test(current.mode === Ice.OperationMode.Idempotent); } - async opNonmutating(current) + opNonmutating(current) { test(current.mode === Ice.OperationMode.Nonmutating); } - async opDerived(current) + opDerived(current) { } - async opByte1(value, current) + opByte1(value, current) { return value; } - async opShort1(value, current) + opShort1(value, current) { return value; } - async opInt1(value, current) + opInt1(value, current) { return value; } - async opLong1(value, current) + opLong1(value, current) { return value; } - async opFloat1(value, current) + opFloat1(value, current) { return value; } - async opDouble1(value, current) + opDouble1(value, current) { return value; } - async opString1(value, current) + opString1(value, current) { return value; } - async opStringS1(value, current) + opStringS1(value, current) { return value; } - async opByteBoolD1(value, current) + opByteBoolD1(value, current) { return value; } - async opStringS2(value, current) + opStringS2(value, current) { return value; } - async opByteBoolD2(value, current) + opByteBoolD2(value, current) { return value; } - async opMyClass1(value, current) + opMyClass1(value, current) { return value; } - async opMyStruct1(value, current) + opMyStruct1(value, current) { return value; } - async opStringLiterals(current) + opStringLiterals(current) { return [ - Test.s0, Test.s1, Test.s2, Test.s3, Test.s4, Test.s5, Test.s6, Test.s7, Test.s8, Test.s9, Test.s10, + Test.s0, + Test.s1, Test.s2, Test.s3, Test.s4, Test.s5, Test.s6, Test.s7, Test.s8, Test.s9, Test.s10, Test.sw0, Test.sw1, Test.sw2, Test.sw3, Test.sw4, Test.sw5, Test.sw6, Test.sw7, Test.sw8, Test.sw9, Test.sw10, Test.ss0, Test.ss1, Test.ss2, Test.ss3, Test.ss4, Test.ss5, - Test.su0, Test.su1, Test.su2]; + Test.su0, Test.su1, Test.su2 + ]; } opWStringLiterals(current) @@ -494,39 +496,38 @@ return this.opStringLiterals(current); } - async opMStruct1(current) + opMStruct1(current) { return new Test.Structure(); } - async opMStruct2(p1, current) + opMStruct2(p1, current) { return [p1, p1]; } - async opMSeq1(current) + opMSeq1(current) { return []; } - async opMSeq2(p1, current) + opMSeq2(p1, current) { return [p1, p1]; } - async opMDict1(current) + opMDict1(current) { return new Map(); } - async opMDict2(p1, current) + opMDict2(p1, current) { return [p1, p1]; } } exports.AMDMyDerivedClassI = AMDMyDerivedClassI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/BatchOneways.js b/js/test/Ice/operations/BatchOneways.js index 1f4e3505121..4041eb2c446 100644 --- a/js/test/Ice/operations/BatchOneways.js +++ b/js/test/Ice/operations/BatchOneways.js @@ -10,7 +10,6 @@ (function(module, require, exports) { const Ice = require("ice").Ice; - const Test = require("Test").Test; async function run(communicator, prx, Test, bidir) { @@ -22,13 +21,13 @@ } } - let bs1 = new Uint8Array(10 * 1024); + const bs1 = new Uint8Array(10 * 1024); for(let i = 0; i < bs1.length; ++i) { bs1[i] = 0; } - let batch = Test.MyClassPrx.uncheckedCast(prx.ice_batchOneway()); + const batch = Test.MyClassPrx.uncheckedCast(prx.ice_batchOneway()); await batch.ice_flushBatchRequests(); test(batch.ice_flushBatchRequests().isCompleted()); // Empty flush @@ -47,10 +46,10 @@ await Ice.Promise.delay(10); } - if(batch.ice_getConnection() != null) + if(batch.ice_getConnection() !== null) { - let batch1 = Test.MyClassPrx.uncheckedCast(prx.ice_batchOneway()); - let batch2 = Test.MyClassPrx.uncheckedCast(prx.ice_batchOneway()); + const batch1 = Test.MyClassPrx.uncheckedCast(prx.ice_batchOneway()); + const batch2 = Test.MyClassPrx.uncheckedCast(prx.ice_batchOneway()); batch1.ice_ping(); batch2.ice_ping(); @@ -69,9 +68,9 @@ batch2.ice_ping(); } - let identity = new Ice.Identity(); + const identity = new Ice.Identity(); identity.name = "invalid"; - let batch3 = batch.ice_identity(identity); + const batch3 = batch.ice_identity(identity); batch3.ice_ping(); await batch3.ice_flushBatchRequests(); @@ -80,10 +79,8 @@ batch.ice_ping(); await batch.ice_flushBatchRequests(); await batch.ice_ping(); - }; - - exports.BatchOneways = { run: run }; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); + } + exports.BatchOneways = {run: run}; +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/Client.js b/js/test/Ice/operations/Client.js index 9ab738a5d6e..c35aedd63e5 100644 --- a/js/test/Ice/operations/Client.js +++ b/js/test/Ice/operations/Client.js @@ -19,13 +19,13 @@ async function allTests(out, communicator, Test, bidir) { out.write("testing twoway operations... "); - let ref = "test:default -p 12010"; - let base = communicator.stringToProxy(ref); - let cl = await Test.MyClassPrx.checkedCast(base); - let derived = await Test.MyDerivedClassPrx.checkedCast(cl); + const ref = "test:default -p 12010"; + const base = communicator.stringToProxy(ref); + const cl = await Test.MyClassPrx.checkedCast(base); + const derived = await Test.MyDerivedClassPrx.checkedCast(cl); await Twoways.run(communicator, cl, Test, bidir); - await Twoways.run(communicator, derived, Test, bidir) + await Twoways.run(communicator, derived, Test, bidir); out.writeLine("ok"); out.write("testing oneway operations... "); @@ -76,7 +76,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/MyDerivedClassI.js b/js/test/Ice/operations/MyDerivedClassI.js index ba80e040b8b..ea94c00f950 100644 --- a/js/test/Ice/operations/MyDerivedClassI.js +++ b/js/test/Ice/operations/MyDerivedClassI.js @@ -486,7 +486,8 @@ Test.s0, Test.s1, Test.s2, Test.s3, Test.s4, Test.s5, Test.s6, Test.s7, Test.s8, Test.s9, Test.s10, Test.sw0, Test.sw1, Test.sw2, Test.sw3, Test.sw4, Test.sw5, Test.sw6, Test.sw7, Test.sw8, Test.sw9, Test.sw10, Test.ss0, Test.ss1, Test.ss2, Test.ss3, Test.ss4, Test.ss5, - Test.su0, Test.su1, Test.su2]; + Test.su0, Test.su1, Test.su2 + ]; } opWStringLiterals(current) @@ -526,7 +527,6 @@ } exports.MyDerivedClassI = MyDerivedClassI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/Oneways.js b/js/test/Ice/operations/Oneways.js index 4903a43cb1b..d840b8c6f10 100644 --- a/js/test/Ice/operations/Oneways.js +++ b/js/test/Ice/operations/Oneways.js @@ -10,7 +10,6 @@ (function(module, require, exports) { const Ice = require("ice").Ice; - const Test = require("Test").Test; async function run(communicator, prx, Test, bidir) { @@ -21,7 +20,7 @@ let message = "test failed"; if(ex) { - message + "\n" + ex.toString(); + message += "\n" + ex.toString(); } throw new Error(message); } @@ -64,10 +63,8 @@ } await prx.opVoid(); - await prx.opIdempotent(); - - await prx.opNonmutating() + await prx.opNonmutating(); try { @@ -81,8 +78,7 @@ } } - exports.Oneways = { run: run }; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); + exports.Oneways = {run: run}; +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/Server.js b/js/test/Ice/operations/Server.js index b83a3089808..49c5207bf26 100644 --- a/js/test/Ice/operations/Server.js +++ b/js/test/Ice/operations/Server.js @@ -24,7 +24,7 @@ { communicator = Ice.initialize(initData); echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010")); - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.add(new MyDerivedClassI(echo.ice_getEndpoints()), Ice.stringToIdentity("test")); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); @@ -53,7 +53,6 @@ } exports._server = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/ServerAMD.js b/js/test/Ice/operations/ServerAMD.js index f9b9fa0ecc8..4b4f9dbcb50 100644 --- a/js/test/Ice/operations/ServerAMD.js +++ b/js/test/Ice/operations/ServerAMD.js @@ -24,7 +24,7 @@ { communicator = Ice.initialize(initData); echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010")); - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.add(new AMDMyDerivedClassI(echo.ice_getEndpoints()), Ice.stringToIdentity("test")); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); @@ -53,7 +53,6 @@ } exports._serveramd = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/Twoways.js b/js/test/Ice/operations/Twoways.js index 0b410f447cd..1888c5316cc 100644 --- a/js/test/Ice/operations/Twoways.js +++ b/js/test/Ice/operations/Twoways.js @@ -10,7 +10,6 @@ (function(module, require, exports) { const Ice = require("ice").Ice; - const Test = require("Test").Test; async function run(communicator, prx, Test, bidir) { @@ -27,7 +26,7 @@ } } - let literals = await prx.opStringLiterals(); + const literals = await prx.opStringLiterals(); test(Test.s0 == "\\" && Test.s0 == Test.sw0 && @@ -84,7 +83,7 @@ Test.s10 == literals[10] && Test.s10 == literals[21]); - test(Test.ss0 == "\'\"\?\\\u0007\b\f\n\r\t\v\u0006" && + test(Test.ss0 == "'\"?\\\u0007\b\f\n\r\t\v\u0006" && Test.ss0 == Test.ss1 && Test.ss0 == Test.ss2 && Test.ss0 == literals[22] && @@ -117,20 +116,20 @@ await prx.opVoid(); { - let [retval, p3] = await prx.opByte(0xff, 0x0f); + const [retval, p3] = await prx.opByte(0xff, 0x0f); test(p3 === 0xf0); test(retval === 0xff); } { - let [retval, p3] = await prx.opBool(true, false); + const [retval, p3] = await prx.opBool(true, false); test(p3); test(!retval); } { - let lo = new Ice.Long(0, 12); - let [retval, s, i, l] = await prx.opShortIntLong(10, 11, lo); + const lo = new Ice.Long(0, 12); + const [retval, s, i, l] = await prx.opShortIntLong(10, 11, lo); test(s === 10); test(i === 11); @@ -139,7 +138,7 @@ } { - let [retval, f, d] = await prx.opFloatDouble(3.14, 1.1E10); + const [retval, f, d] = await prx.opFloatDouble(3.14, 1.1E10); test((f - 3.14) <= 0.01); test(d == 1.1E10); test(retval == 1.1E10); @@ -261,45 +260,45 @@ await prx.opFloatDouble(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY); { - let [retval, p3] = await prx.opString("hello", "world"); + const [retval, p3] = await prx.opString("hello", "world"); test(p3 === "world hello"); test(retval === "hello world"); } { - let [retval, p2] = await prx.opMyEnum(Test.MyEnum.enum2); + const [retval, p2] = await prx.opMyEnum(Test.MyEnum.enum2); test(p2 === Test.MyEnum.enum2); test(retval === Test.MyEnum.enum3); } { // Test null enum - let [retval, p2] = await prx.opMyEnum(null); + const [retval, p2] = await prx.opMyEnum(null); test(p2 === Test.MyEnum.enum1); test(retval === Test.MyEnum.enum3); } { - let [retval, p2, p3] = await prx.opMyClass(prx); + const [retval, p2, p3] = await prx.opMyClass(prx); test(p2.ice_getIdentity().equals(Ice.stringToIdentity("test"))); test(p3.ice_getIdentity().equals(Ice.stringToIdentity("noSuchIdentity"))); test(retval.ice_getIdentity().equals(Ice.stringToIdentity("test"))); + } - si1 = new Test.Structure(); + { + const si1 = new Test.Structure(); si1.p = prx; si1.e = Test.MyEnum.enum3; si1.s = new Test.AnotherStruct(); si1.s.s = "abc"; - si2 = new Test.Structure(); + const si2 = new Test.Structure(); si2.p = null; si2.e = Test.MyEnum.enum2; si2.s = new Test.AnotherStruct(); si2.s.s = "def"; - } - { - let [retval, p3] = await prx.opStruct(si1, si2);; + const [retval, p3] = await prx.opStruct(si1, si2); test(retval.p === null); test(retval.e === Test.MyEnum.enum2); test(retval.s.s === "def"); @@ -309,9 +308,9 @@ } { - let si1 = new Test.Structure(); + const si1 = new Test.Structure(); // Test null struct - let [retval, p3] = await prx.opStruct(si1, null); + const [retval, p3] = await prx.opStruct(si1, null); test(retval.p === null); test(retval.e === Test.MyEnum.enum1); @@ -322,10 +321,10 @@ } { - let bsi1 = new Uint8Array([ 0x01, 0x11, 0x12, 0x22 ]); - let bsi2 = new Uint8Array([ 0xf1, 0xf2, 0xf3, 0xf4 ]); + const bsi1 = new Uint8Array([0x01, 0x11, 0x12, 0x22]); + const bsi2 = new Uint8Array([0xf1, 0xf2, 0xf3, 0xf4]); - let [retval, p3] = await prx.opByteS(bsi1, bsi2); + const [retval, p3] = await prx.opByteS(bsi1, bsi2); test(p3.length === 4); test(p3[0] === 0x22); @@ -344,9 +343,9 @@ } { - let bsi1 = [ true, true, false ]; - let bsi2 = [ false ]; - let [retval, p3] = await prx.opBoolS(bsi1, bsi2); + const bsi1 = [true, true, false]; + const bsi2 = [false]; + const [retval, p3] = await prx.opBoolS(bsi1, bsi2); test(p3.length == 4); test(p3[0]); @@ -360,13 +359,13 @@ } { - let ssi = [ 1, 2, 3 ]; - let isi = [ 5, 6, 7, 8 ]; - let l1 = new Ice.Long(0, 10); - let l2 = new Ice.Long(0, 30); - let l3 = new Ice.Long(0, 20); - let lsi = [ l1, l2, l3 ]; - let [retval, sso, iso, lso] = await prx.opShortIntLongS(ssi, isi, lsi); + const ssi = [1, 2, 3]; + const isi = [5, 6, 7, 8]; + const l1 = new Ice.Long(0, 10); + const l2 = new Ice.Long(0, 30); + const l3 = new Ice.Long(0, 20); + const lsi = [l1, l2, l3]; + const [retval, sso, iso, lso] = await prx.opShortIntLongS(ssi, isi, lsi); test(sso.length === 3); test(sso[0] === 1); @@ -391,9 +390,9 @@ } { - let fsi = [ 3.14, 1.11 ]; - let dsi = [ 1.1E10, 1.2E10, 1.3E10 ]; - let [retval, fso, dso] = await prx.opFloatDoubleS(fsi, dsi); + const fsi = [3.14, 1.11]; + const dsi = [1.1E10, 1.2E10, 1.3E10]; + const [retval, fso, dso] = await prx.opFloatDoubleS(fsi, dsi); test(fso.length === 2); test((fso[0] - 3.14) <= 0.01); @@ -411,9 +410,9 @@ } { - let ssi1 = [ "abc", "de", "fghi" ]; - let ssi2 = [ "xyz" ]; - let [retval, sso] = await prx.opStringS(ssi1, ssi2); + const ssi1 = ["abc", "de", "fghi"]; + const ssi2 = ["xyz"]; + const [retval, sso] = await prx.opStringS(ssi1, ssi2); test(sso.length === 4); test(sso[0] === "abc"); @@ -427,17 +426,19 @@ } { - let bsi1 = + const bsi1 = [ - new Uint8Array([ 0x01, 0x11, 0x12 ]), - new Uint8Array([ 0xff ]) + new Uint8Array([0x01, 0x11, 0x12]), + new Uint8Array([0xff]) ]; - let bsi2 = + + const bsi2 = [ - new Uint8Array([ 0x0e ]), - new Uint8Array([ 0xf2, 0xf1 ]) + new Uint8Array([0x0e]), + new Uint8Array([0xf2, 0xf1]) ]; - let [retval, bso] = await prx.opByteSS(bsi1, bsi2); + + const [retval, bso] = await prx.opByteSS(bsi1, bsi2); test(bso.length === 2); test(bso[0].length === 1); @@ -461,18 +462,19 @@ } { - let bsi1 = + const bsi1 = [ - [ true ], - [ false ], - [ true, true ] + [true], + [false], + [true, true] ]; - let bsi2 = + + const bsi2 = [ - [ false, false, true ] + [false, false, true] ]; - let [retval, bso] = await prx.opBoolSS(bsi1, bsi2); + const [retval, bso] = await prx.opBoolSS(bsi1, bsi2); test(bso.length === 4); test(bso[0].length === 1); @@ -497,25 +499,28 @@ } { - let ssi = + const ssi = [ - [ 1, 2, 5 ], - [ 13 ], - [ ] + [1, 2, 5], + [13], + [] ]; - let isi = + + const isi = [ - [ 24, 98 ], - [ 42 ] + [24, 98], + [42] ]; - let l1 = new Ice.Long(0, 496); - let l2 = new Ice.Long(0, 1729); - let lsi = + + const l1 = new Ice.Long(0, 496); + const l2 = new Ice.Long(0, 1729); + + const lsi = [ - [ l1, l2 ] + [l1, l2] ]; - let [retval, sso, iso, lso] = await prx.opShortIntLongSS(ssi, isi, lsi); + const [retval, sso, iso, lso] = await prx.opShortIntLongSS(ssi, isi, lsi); test(retval.length === 1); test(retval[0].length === 2); @@ -545,18 +550,19 @@ } { - let fsi = + const fsi = [ - [ 3.14 ], - [ 1.11 ], - [ ], + [3.14], + [1.11], + [] ]; - let dsi = + + const dsi = [ - [ 1.1E10, 1.2E10, 1.3E10 ] + [1.1E10, 1.2E10, 1.3E10] ]; - let [retval, fso, dso] = await prx.opFloatDoubleSS(fsi, dsi); + const [retval, fso, dso] = await prx.opFloatDoubleSS(fsi, dsi); test(fso.length === 3); test(fso[0].length === 1); @@ -581,20 +587,20 @@ } { - let ssi1 = + const ssi1 = [ - [ "abc" ], - [ "de", "fghi" ] + ["abc"], + ["de", "fghi"] ]; - let ssi2 = + const ssi2 = [ - [ ], - [ ], - [ "xyz" ] + [], + [], + ["xyz"] ]; - let [retval, sso] = await prx.opStringSS(ssi1, ssi2); + const [retval, sso] = await prx.opStringSS(ssi1, ssi2); test(sso.length === 5); test(sso[0].length === 1); test(sso[0][0] === "abc"); @@ -613,7 +619,7 @@ } { - let sssi1 = + const sssi1 = [ [ ["abc", "de"], @@ -624,7 +630,7 @@ ] ]; - let sssi2 = + const sssi2 = [ [ ["", ""], @@ -636,7 +642,7 @@ [] ]; - let [retval, ssso] = await prx.opStringSSS(sssi1, sssi2); + const [retval, ssso] = await prx.opStringSSS(sssi1, sssi2); test(ssso.length === 5); test(ssso[0].length === 2); @@ -673,17 +679,16 @@ } { - let di1 = new Test.ByteBoolD(); + const di1 = new Test.ByteBoolD(); di1.set(10, true); di1.set(100, false); - let di2 = new Test.ByteBoolD(); + const di2 = new Test.ByteBoolD(); di2.set(10, true); di2.set(11, false); di2.set(101, true); - let [retval, p3] = await prx.opByteBoolD(di1, di2); - + const [retval, p3] = await prx.opByteBoolD(di1, di2); test(Ice.MapUtil.equals(p3, di1)); test(retval.size === 4); test(retval.get(10) === true); @@ -693,17 +698,16 @@ } { - let di1 = new Test.ShortIntD(); + const di1 = new Test.ShortIntD(); di1.set(110, -1); di1.set(1100, 123123); - let di2 = new Test.ShortIntD(); + const di2 = new Test.ShortIntD(); di2.set(110, -1); di2.set(111, -100); di2.set(1101, 0); - let [retval, p3] = await prx.opShortIntD(di1, di2); - + const [retval, p3] = await prx.opShortIntD(di1, di2); test(Ice.MapUtil.equals(p3, di1)); test(retval.size === 4); test(retval.get(110) === -1); @@ -713,16 +717,16 @@ } { - let di1 = new Test.LongFloatD(); + const di1 = new Test.LongFloatD(); di1.set(new Ice.Long(0, 999999110), -1.1); di1.set(new Ice.Long(0, 999999111), 123123.2); - let di2 = new Test.LongFloatD(); + const di2 = new Test.LongFloatD(); di2.set(new Ice.Long(0, 999999110), -1.1); di2.set(new Ice.Long(0, 999999120), -100.4); di2.set(new Ice.Long(0, 999999130), 0.5); - let [retval, p3] = await prx.opLongFloatD(di1, di2); + const [retval, p3] = await prx.opLongFloatD(di1, di2); test(p3.equals(di1, (v1, v2) => (Math.abs(v1) - Math.abs(v2)) <= 0.01)); test(retval.size === 4); @@ -733,17 +737,16 @@ } { - let di1 = new Test.StringStringD(); + const di1 = new Test.StringStringD(); di1.set("foo", "abc -1.1"); di1.set("bar", "abc 123123.2"); - let di2 = new Test.StringStringD(); + const di2 = new Test.StringStringD(); di2.set("foo", "abc -1.1"); di2.set("FOO", "abc -100.4"); di2.set("BAR", "abc 0.5"); - let [retval, p3] = await prx.opStringStringD(di1, di2); - + const [retval, p3] = await prx.opStringStringD(di1, di2); test(Ice.MapUtil.equals(p3, di1)); test(retval.size == 4); test(retval.get("foo") === "abc -1.1"); @@ -753,16 +756,16 @@ } { - let di1 = new Test.StringMyEnumD(); + const di1 = new Test.StringMyEnumD(); di1.set("abc", Test.MyEnum.enum1); di1.set("", Test.MyEnum.enum2); - let di2 = new Test.StringMyEnumD(); + const di2 = new Test.StringMyEnumD(); di2.set("abc", Test.MyEnum.enum1); di2.set("qwerty", Test.MyEnum.enum3); di2.set("Hello!!", Test.MyEnum.enum2); - let [retval, p3] = await prx.opStringMyEnumD(di1, di2); + const [retval, p3] = await prx.opStringMyEnumD(di1, di2); test(Ice.MapUtil.equals(p3, di1)); test(retval.size === 4); @@ -773,14 +776,14 @@ } { - let di1 = new Test.MyEnumStringD(); + const di1 = new Test.MyEnumStringD(); di1.set(Test.MyEnum.enum1, "abc"); - let di2 = new Test.MyEnumStringD(); + const di2 = new Test.MyEnumStringD(); di2.set(Test.MyEnum.enum2, "Hello!!"); di2.set(Test.MyEnum.enum3, "qwerty"); - let [retval, p3] = await prx.opMyEnumStringD(di1, di2); + const [retval, p3] = await prx.opMyEnumStringD(di1, di2); test(Ice.MapUtil.equals(p3, di1)); test(retval.size === 3); @@ -790,19 +793,19 @@ } { - let s11 = new Test.MyStruct(1, 1); - let s12 = new Test.MyStruct(1, 2); - let di1 = new Test.MyStructMyEnumD(); + const s11 = new Test.MyStruct(1, 1); + const s12 = new Test.MyStruct(1, 2); + const di1 = new Test.MyStructMyEnumD(); di1.set(s11, Test.MyEnum.enum1); di1.set(s12, Test.MyEnum.enum2); - let s22 = new Test.MyStruct(2, 2); - let s23 = new Test.MyStruct(2, 3); - let di2 = new Test.MyStructMyEnumD(); + const s22 = new Test.MyStruct(2, 2); + const s23 = new Test.MyStruct(2, 3); + const di2 = new Test.MyStructMyEnumD(); di2.set(s11, Test.MyEnum.enum1); di2.set(s22, Test.MyEnum.enum3); di2.set(s23, Test.MyEnum.enum2); - let [retval, p3] = await prx.opMyStructMyEnumD(di1, di2); + const [retval, p3] = await prx.opMyStructMyEnumD(di1, di2); test(p3.equals(di1)); test(retval.size === 4); @@ -813,19 +816,18 @@ } { - let ds1 = new Test.ByteBoolD(); + const ds1 = new Test.ByteBoolD(); ds1.set(10, true); ds1.set(100, false); - let ds2 = new Test.ByteBoolD(); + const ds2 = new Test.ByteBoolD(); ds2.set(10, true); ds2.set(11, false); ds2.set(101, true); - let ds3 = new Test.ByteBoolD(); + const ds3 = new Test.ByteBoolD(); ds3.set(100, false); ds3.set(101, false); - let [retval, p3] = await prx.opByteBoolDS([ds1, ds2], [ds3]); - + const [retval, p3] = await prx.opByteBoolDS([ds1, ds2], [ds3]); test(retval.length == 2); test(retval[0].size == 3); test(retval[0].get(10) === true); @@ -848,18 +850,17 @@ } { - let di1 = new Test.ShortIntD(); + const di1 = new Test.ShortIntD(); di1.set(110, -1); di1.set(1100, 123123); - let di2 = new Test.ShortIntD(); + const di2 = new Test.ShortIntD(); di2.set(110, -1); di2.set(111, -100); di2.set(1101, 0); - let di3 = new Test.ShortIntD(); + const di3 = new Test.ShortIntD(); di3.set(100, -1001); - let [retval, p3] = await prx.opShortIntDS([di1, di2], [di3]); - + const [retval, p3] = await prx.opShortIntDS([di1, di2], [di3]); test(retval.length == 2); test(retval[0].size == 3); test(retval[0].get(110) === -1); @@ -882,17 +883,17 @@ } { - let di1 = new Test.LongFloatD(); + const di1 = new Test.LongFloatD(); di1.set(new Ice.Long(0, 999999110), -1.1); di1.set(new Ice.Long(0, 999999111), 123123.2); - let di2 = new Test.LongFloatD(); + const di2 = new Test.LongFloatD(); di2.set(new Ice.Long(0, 999999110), -1.1); di2.set(new Ice.Long(0, 999999120), -100.4); di2.set(new Ice.Long(0, 999999130), 0.5); - let di3 = new Test.LongFloatD(); + const di3 = new Test.LongFloatD(); di3.set(new Ice.Long(0, 999999140), 3.14); - let[retval, p3] = await prx.opLongFloatDS([di1, di2], [di3]); + const [retval, p3] = await prx.opLongFloatDS([di1, di2], [di3]); test(retval.length == 2); test(retval[0].size == 3); test(retval[0].get(new Ice.Long(0, 999999110)) - Math.abs(-1.1) <= 0.1); @@ -915,18 +916,17 @@ } { - let di1 = new Test.StringStringD(); + const di1 = new Test.StringStringD(); di1.set("foo", "abc -1.1"); di1.set("bar", "abc 123123.2"); - let di2 = new Test.StringStringD(); + const di2 = new Test.StringStringD(); di2.set("foo", "abc -1.1"); di2.set("FOO", "abc -100.4"); di2.set("BAR", "abc 0.5"); - let di3 = new Test.StringStringD(); + const di3 = new Test.StringStringD(); di3.set("f00", "ABC -3.14"); - let [retval, p3] = await prx.opStringStringDS([di1, di2], [di3]); - + const [retval, p3] = await prx.opStringStringDS([di1, di2], [di3]); test(retval.length === 2); test(retval[0].size === 3); test(retval[0].get("foo") === "abc -1.1"); @@ -949,17 +949,17 @@ } { - let di1 = new Test.StringMyEnumD(); + const di1 = new Test.StringMyEnumD(); di1.set("abc", Test.MyEnum.enum1); di1.set("", Test.MyEnum.enum2); - let di2 = new Test.StringMyEnumD(); + const di2 = new Test.StringMyEnumD(); di2.set("abc", Test.MyEnum.enum1); di2.set("qwerty", Test.MyEnum.enum3); di2.set("Hello!!", Test.MyEnum.enum2); - let di3 = new Test.StringMyEnumD(); + const di3 = new Test.StringMyEnumD(); di3.set("Goodbye", Test.MyEnum.enum1); - let [retval, p3] = await prx.opStringMyEnumDS([di1, di2], [di3]); + const [retval, p3] = await prx.opStringMyEnumDS([di1, di2], [di3]); test(retval.length == 2); test(retval[0].size == 3); @@ -983,16 +983,15 @@ } { - let di1 = new Test.MyEnumStringD(); + const di1 = new Test.MyEnumStringD(); di1.set(Test.MyEnum.enum1, "abc"); - let di2 = new Test.MyEnumStringD(); + const di2 = new Test.MyEnumStringD(); di2.set(Test.MyEnum.enum2, "Hello!!"); di2.set(Test.MyEnum.enum3, "qwerty"); - let di3 = new Test.MyEnumStringD(); + const di3 = new Test.MyEnumStringD(); di3.set(Test.MyEnum.enum1, "Goodbye"); - let [retval, p3] = await prx.opMyEnumStringDS([di1, di2], [di3]); - + const [retval, p3] = await prx.opMyEnumStringDS([di1, di2], [di3]); test(retval.length == 2); test(retval[0].size == 2); test(retval[0].get(Test.MyEnum.enum2) === "Hello!!"); @@ -1011,24 +1010,23 @@ } { - let s11 = new Test.MyStruct(1, 1); - let s12 = new Test.MyStruct(1, 2); - let di1 = new Test.MyStructMyEnumD(); + const s11 = new Test.MyStruct(1, 1); + const s12 = new Test.MyStruct(1, 2); + const di1 = new Test.MyStructMyEnumD(); di1.set(s11, Test.MyEnum.enum1); di1.set(s12, Test.MyEnum.enum2); - let s22 = new Test.MyStruct(2, 2); - let s23 = new Test.MyStruct(2, 3); - let di2 = new Test.MyStructMyEnumD(); + const s22 = new Test.MyStruct(2, 2); + const s23 = new Test.MyStruct(2, 3); + const di2 = new Test.MyStructMyEnumD(); di2.set(s11, Test.MyEnum.enum1); di2.set(s22, Test.MyEnum.enum3); di2.set(s23, Test.MyEnum.enum2); - let di3 = new Test.MyStructMyEnumD(); + const di3 = new Test.MyStructMyEnumD(); di3.set(s23, Test.MyEnum.enum3); - let [retval, p3] = await prx.opMyStructMyEnumDS([di1, di2], [di3]); - + const [retval, p3] = await prx.opMyStructMyEnumDS([di1, di2], [di3]); test(retval.length == 2); test(retval[0].size == 3); test(retval[0].get(s11) === Test.MyEnum.enum1); @@ -1051,14 +1049,13 @@ } { - let sdi1 = new Test.ByteByteSD(); + const sdi1 = new Test.ByteByteSD(); sdi1.set(0x01, new Uint8Array([0x01, 0x11])); sdi1.set(0x22, new Uint8Array([0x12])); - let sdi2 = new Test.ByteByteSD(); + const sdi2 = new Test.ByteByteSD(); sdi2.set(0xf1, new Uint8Array([0xf2, 0xf3])); - let [retval, p3] = await prx.opByteByteSD(sdi1, sdi2); - + const [retval, p3] = await prx.opByteByteSD(sdi1, sdi2); test(p3.size == 1); test(p3.get(0xf1).length === 2); test(p3.get(0xf1)[0] === 0xf2); @@ -1075,17 +1072,15 @@ } { - let si1 = [true, false]; - let si2 = [false, true, true]; - - let sdi1 = new Test.BoolBoolSD(); + const si1 = [true, false]; + const si2 = [false, true, true]; + const sdi1 = new Test.BoolBoolSD(); sdi1.set(false, si1); sdi1.set(true, si2); - let sdi2 = new Test.BoolBoolSD(); + const sdi2 = new Test.BoolBoolSD(); sdi2.set(false, si1); - let [retval, p3] = await prx.opBoolBoolSD(sdi1, sdi2); - + const [retval, p3] = await prx.opBoolBoolSD(sdi1, sdi2); test(p3.size === 1); test(p3.get(false).length === 2); test(p3.get(false)[0] === true); @@ -1101,19 +1096,18 @@ } { - let sdi1 = new Test.ShortShortSD(); - let sdi2 = new Test.ShortShortSD(); + const sdi1 = new Test.ShortShortSD(); + const sdi2 = new Test.ShortShortSD(); - let si1 = [1, 2, 3]; - let si2 = [4, 5]; - let si3 = [6, 7]; + const si1 = [1, 2, 3]; + const si2 = [4, 5]; + const si3 = [6, 7]; sdi1.set(1, si1); sdi1.set(2, si2); sdi2.set(4, si3); - let [retval, p3] = await prx.opShortShortSD(sdi1, sdi2); - + const [retval, p3] = await prx.opShortShortSD(sdi1, sdi2); test(p3.size === 1); test(p3.get(4).length === 2); test(p3.get(4)[0] === 6); @@ -1132,19 +1126,18 @@ } { - let sdi1 = new Test.IntIntSD(); - let sdi2 = new Test.IntIntSD(); + const sdi1 = new Test.IntIntSD(); + const sdi2 = new Test.IntIntSD(); - let si1 = [100, 200, 300]; - let si2 = [400, 500]; - let si3 = [600, 700]; + const si1 = [100, 200, 300]; + const si2 = [400, 500]; + const si3 = [600, 700]; sdi1.set(100, si1); sdi1.set(200, si2); sdi2.set(400, si3); - let [retval, p3] = await prx.opIntIntSD(sdi1, sdi2); - + const [retval, p3] = await prx.opIntIntSD(sdi1, sdi2); test(p3.size === 1); test(p3.get(400).length === 2); test(p3.get(400)[0] === 600); @@ -1163,19 +1156,18 @@ } { - let sdi1 = new Test.LongLongSD(); - let sdi2 = new Test.LongLongSD(); + const sdi1 = new Test.LongLongSD(); + const sdi2 = new Test.LongLongSD(); - let si1 = [new Ice.Long(0, 999999110), new Ice.Long(0, 999999111), new Ice.Long(0, 999999110)]; - let si2 = [new Ice.Long(0, 999999120), new Ice.Long(0, 999999130)]; - let si3 = [new Ice.Long(0, 999999110), new Ice.Long(0, 999999120)]; + const si1 = [new Ice.Long(0, 999999110), new Ice.Long(0, 999999111), new Ice.Long(0, 999999110)]; + const si2 = [new Ice.Long(0, 999999120), new Ice.Long(0, 999999130)]; + const si3 = [new Ice.Long(0, 999999110), new Ice.Long(0, 999999120)]; sdi1.set(new Ice.Long(0, 999999990), si1); sdi1.set(new Ice.Long(0, 999999991), si2); sdi2.set(new Ice.Long(0, 999999992), si3); - let [retval, p3] = await prx.opLongLongSD(sdi1, sdi2); - + const [retval, p3] = await prx.opLongLongSD(sdi1, sdi2); test(p3.size == 1); test(p3.get(new Ice.Long(0, 999999992)).length === 2); test(p3.get(new Ice.Long(0, 999999992))[0].equals(new Ice.Long(0, 999999110))); @@ -1194,18 +1186,18 @@ } { - let sdi1 = new Test.StringFloatSD(); - let sdi2 = new Test.StringFloatSD(); + const sdi1 = new Test.StringFloatSD(); + const sdi2 = new Test.StringFloatSD(); - let si1 = [-1.1, 123123.2, 100.0]; - let si2 = [42.24, -1.61]; - let si3 = [-3.14, 3.14]; + const si1 = [-1.1, 123123.2, 100.0]; + const si2 = [42.24, -1.61]; + const si3 = [-3.14, 3.14]; sdi1.set("abc", si1); sdi1.set("ABC", si2); sdi2.set("aBc", si3); - let [retval, p3] = await prx.opStringFloatSD(sdi1, sdi2); + const [retval, p3] = await prx.opStringFloatSD(sdi1, sdi2); test(p3.size === 1); test(p3.get("aBc").length === 2); @@ -1225,24 +1217,24 @@ } { - let sdi1 = new Test.StringDoubleSD(); - let sdi2 = new Test.StringDoubleSD(); + const sdi1 = new Test.StringDoubleSD(); + const sdi2 = new Test.StringDoubleSD(); - let si1 = [1.1E10, 1.2E10, 1.3E10]; - let si2 = [1.4E10, 1.5E10]; - let si3 = [1.6E10, 1.7E10]; + const si1 = [1.1E10, 1.2E10, 1.3E10]; + const si2 = [1.4E10, 1.5E10]; + const si3 = [1.6E10, 1.7E10]; sdi1.set("Hello!!", si1); - sdi1.set("Goodbye", si2); + sdi1.set("Goodbye", si2); sdi2.set("", si3); - let [retval, p3] = await prx.opStringDoubleSD(sdi1, sdi2); + const [retval, p3] = await prx.opStringDoubleSD(sdi1, sdi2); test(p3.size === 1); test(p3.get("").length === 2); test(p3.get("")[0] === 1.6E10); test(p3.get("")[1] === 1.7E10); - test(retval.size=== 3); + test(retval.size === 3); test(retval.get("Hello!!").length === 3); test(retval.get("Hello!!")[0] === 1.1E10); test(retval.get("Hello!!")[1] === 1.2E10); @@ -1250,27 +1242,27 @@ test(retval.get("Goodbye").length === 2); test(retval.get("Goodbye")[0] === 1.4E10); test(retval.get("Goodbye")[1] === 1.5E10); - test(retval.get("").length=== 2); + test(retval.get("").length === 2); test(retval.get("")[0] === 1.6E10); test(retval.get("")[1] === 1.7E10); } { - let sdi1 = new Test.StringStringSD(); - let sdi2 = new Test.StringStringSD(); + const sdi1 = new Test.StringStringSD(); + const sdi2 = new Test.StringStringSD(); - let si1 = ["abc", "de", "fghi"]; - let si2 = ["xyz", "or"]; - let si3 = ["and", "xor"]; + const si1 = ["abc", "de", "fghi"]; + const si2 = ["xyz", "or"]; + const si3 = ["and", "xor"]; sdi1.set("abc", si1); sdi1.set("def", si2); sdi2.set("ghi", si3); - let [retval, p3] = await prx.opStringStringSD(sdi1, sdi2); + const [retval, p3] = await prx.opStringStringSD(sdi1, sdi2); test(p3.size === 1); - test(p3.get("ghi").length ===2); + test(p3.get("ghi").length === 2); test(p3.get("ghi")[0] === "and"); test(p3.get("ghi")[1] === "xor"); test(retval.size === 3); @@ -1287,24 +1279,23 @@ } { - let sdi1 = new Test.MyEnumMyEnumSD(); - let sdi2 = new Test.MyEnumMyEnumSD(); + const sdi1 = new Test.MyEnumMyEnumSD(); + const sdi2 = new Test.MyEnumMyEnumSD(); - let si1 = [Test.MyEnum.enum1, Test.MyEnum.enum1, Test.MyEnum.enum2]; - let si2 = [Test.MyEnum.enum1, Test.MyEnum.enum2]; - let si3 = [Test.MyEnum.enum3, Test.MyEnum.enum3]; + const si1 = [Test.MyEnum.enum1, Test.MyEnum.enum1, Test.MyEnum.enum2]; + const si2 = [Test.MyEnum.enum1, Test.MyEnum.enum2]; + const si3 = [Test.MyEnum.enum3, Test.MyEnum.enum3]; sdi1.set(Test.MyEnum.enum3, si1); sdi1.set(Test.MyEnum.enum2, si2); sdi2.set(Test.MyEnum.enum1, si3); - let [retval, p3] = await prx.opMyEnumMyEnumSD(sdi1, sdi2); - + const [retval, p3] = await prx.opMyEnumMyEnumSD(sdi1, sdi2); test(p3.size == 1); test(p3.get(Test.MyEnum.enum1).length == 2); test(p3.get(Test.MyEnum.enum1)[0] == Test.MyEnum.enum3); test(p3.get(Test.MyEnum.enum1)[1] == Test.MyEnum.enum3); - test(retval.size== 3); + test(retval.size === 3); test(retval.get(Test.MyEnum.enum3).length == 3); test(retval.get(Test.MyEnum.enum3)[0] == Test.MyEnum.enum1); test(retval.get(Test.MyEnum.enum3)[1] == Test.MyEnum.enum1); @@ -1318,17 +1309,17 @@ } { - let lengths = [0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000]; + const lengths = [0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000]; - for(let l of lengths) + for(const l of lengths) { - let s = new Array(l); + const s = new Array(l); for(let i = 0; i < l; ++i) { s[i] = i; } - let r = await prx.opIntS(s); + const r = await prx.opIntS(s); test(r.length == l); for(let j = 0; j < r.length; ++j) { @@ -1338,24 +1329,24 @@ } { - let ctx = new Ice.Context(); + const ctx = new Ice.Context(); ctx.set("one", "ONE"); ctx.set("two", "TWO"); ctx.set("three", "THREE"); { test(prx.ice_getContext().size === 0); - let r = await prx.opContext(); + const r = await prx.opContext(); test(!Ice.MapUtil.equals(r, ctx)); } { - let r = await prx.opContext(ctx); + const r = await prx.opContext(ctx); test(prx.ice_getContext().size === 0); test(Ice.MapUtil.equals(r, ctx)); } { - let p2 = await Test.MyClassPrx.checkedCast(prx.ice_context(ctx)); + const p2 = await Test.MyClassPrx.checkedCast(prx.ice_context(ctx)); test(Ice.MapUtil.equals(p2.ice_getContext(), ctx)); let r = await p2.opContext(); test(Ice.MapUtil.equals(r, ctx)); @@ -1369,12 +1360,11 @@ // // Test implicit context propagation // - - let initData = new Ice.InitializationData(); + const initData = new Ice.InitializationData(); initData.properties = communicator.getProperties().clone(); initData.properties.setProperty("Ice.ImplicitContext", "Shared"); - let ic = Ice.initialize(initData); + const ic = Ice.initialize(initData); let ctx = new Ice.Context(); ctx.set("one", "ONE"); @@ -1388,19 +1378,19 @@ test(Ice.MapUtil.equals(await p3.opContext(), ctx)); test(ic.getImplicitContext().containsKey("zero") == false); - let r = ic.getImplicitContext().put("zero", "ZERO"); + const r = ic.getImplicitContext().put("zero", "ZERO"); test(r === undefined); test(ic.getImplicitContext().get("zero") == "ZERO"); ctx = ic.getImplicitContext().getContext(); test(Ice.MapUtil.equals(await p3.opContext(), ctx)); - let prxContext = new Ice.Context(); + const prxContext = new Ice.Context(); prxContext.set("one", "UN"); prxContext.set("four", "QUATRE"); - let combined = new Ice.Context(prxContext); - for(let [key, value] of ctx) + const combined = new Ice.Context(prxContext); + for(const [key, value] of ctx) { if(!combined.has(key)) { @@ -1424,21 +1414,15 @@ } { - let d = 1278312346.0 / 13.0; - let ds = []; + const d = 1278312346.0 / 13.0; + const ds = []; for(let i = 0; i < 5; i++) { ds[i] = d; } await prx.opDoubleMarshaling(d, ds); - } - - { await prx.opIdempotent(); - } - - { await prx.opNonmutating(); } @@ -1456,14 +1440,14 @@ test((await prx.opStringS2(null)).length === 0); test((await prx.opByteBoolD2(null)).size === 0); - let d = Test.MyDerivedClassPrx.uncheckedCast(prx); + const d = Test.MyDerivedClassPrx.uncheckedCast(prx); let s = new Test.MyStruct1(); s.tesT = "Test.MyStruct1.s"; s.myClass = null; s.myStruct1 = "Test.MyStruct1.myStruct1"; s = await d.opMyStruct1(s); test(s.tesT == "Test.MyStruct1.s"); - test(s.myClass == null); + test(s.myClass === null); test(s.myStruct1 == "Test.MyStruct1.myStruct1"); let c = new Test.MyClass1(); c.tesT = "Test.MyClass1.testT"; @@ -1471,36 +1455,34 @@ c.myClass1 = "Test.MyClass1.myClass1"; c = await d.opMyClass1(c); test(c.tesT == "Test.MyClass1.testT"); - test(c.myClass == null); + test(c.myClass === null); test(c.myClass1 == "Test.MyClass1.myClass1"); } { - let p1 = await prx.opMStruct1(); + const p1 = await prx.opMStruct1(); p1.e = Test.MyEnum.enum3; - let [p2, p3] = await prx.opMStruct2(p1); + const [p2, p3] = await prx.opMStruct2(p1); test(p2.equals(p1) && p3.equals(p1)); } { await prx.opMSeq1(); - - let p1 = ["test"]; - let [p2, p3] = await prx.opMSeq2(p1); + const p1 = ["test"]; + const [p2, p3] = await prx.opMSeq2(p1); test(Ice.ArrayUtil.equals(p2, p1) && Ice.ArrayUtil.equals(p3, p1)); } { await prx.opMDict1(); - - let p1 = new Map(); + const p1 = new Map(); p1.set("test", "test"); - let [p2, p3] = await prx.opMDict2(p1); + const [p2, p3] = await prx.opMDict2(p1); test(Ice.MapUtil.equals(p2, p1) && Ice.MapUtil.equals(p3, p1)); } { - let ds = []; + const ds = []; for(let i = 0; i < 5; i++) { ds[i] = 1278312346.0 / 13.0; @@ -1509,8 +1491,7 @@ } } - exports.Twoways = { run: run }; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); + exports.Twoways = {run: run}; +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optional/AMDInitialI.js b/js/test/Ice/optional/AMDInitialI.js index 37523181603..293e0862f5d 100644 --- a/js/test/Ice/optional/AMDInitialI.js +++ b/js/test/Ice/optional/AMDInitialI.js @@ -9,24 +9,23 @@ (function(module, require, exports) { - const Ice = require("ice").Ice; const Test = require("Test").Test; class AMDInitialI extends Test.Initial { - async shutdown(current) + shutdown(current) { current.adapter.getCommunicator().shutdown(); } - async pingPong(obj, current) + pingPong(obj, current) { return obj; } - async opOptionalException(a, b, o, current) + opOptionalException(a, b, o, current) { - let ex = new Test.OptionalException(); + const ex = new Test.OptionalException(); if(a !== undefined) { ex.a = a; @@ -46,9 +45,9 @@ throw ex; } - async opDerivedException(a, b, o, current) + opDerivedException(a, b, o, current) { - let ex = new Test.DerivedException(); + const ex = new Test.DerivedException(); if(a !== undefined) { ex.a = a; @@ -74,9 +73,9 @@ throw ex; } - async opRequiredException(a, b, o, current) + opRequiredException(a, b, o, current) { - let ex = new Test.RequiredException(); + const ex = new Test.RequiredException(); if(a !== undefined) { ex.a = a; @@ -98,251 +97,250 @@ throw ex; } - async opByte(p1, current) + opByte(p1, current) { return [p1, p1]; } - async opBool(p1, current) + opBool(p1, current) { return [p1, p1]; } - async opShort(p1, current) + opShort(p1, current) { return [p1, p1]; } - async opInt(p1, current) + opInt(p1, current) { return [p1, p1]; } - async opLong(p1, current) + opLong(p1, current) { return [p1, p1]; } - async opFloat(p1, current) + opFloat(p1, current) { return [p1, p1]; } - async opDouble(p1, current) + opDouble(p1, current) { return [p1, p1]; } - async opString(p1, current) + opString(p1, current) { return [p1, p1]; } - async opMyEnum(p1, current) + opMyEnum(p1, current) { return [p1, p1]; } - async opSmallStruct(p1, current) + opSmallStruct(p1, current) { return [p1, p1]; } - async opFixedStruct(p1, current) + opFixedStruct(p1, current) { return [p1, p1]; } - async opVarStruct(p1, current) + opVarStruct(p1, current) { return [p1, p1]; } - async opOneOptional(p1, current) + opOneOptional(p1, current) { return [p1, p1]; } - async opOneOptionalProxy(p1, current) + opOneOptionalProxy(p1, current) { return [p1, p1]; } - async opByteSeq(p1, current) + opByteSeq(p1, current) { return [p1, p1]; } - async opBoolSeq(p1, current) + opBoolSeq(p1, current) { return [p1, p1]; } - async opShortSeq(p1, current) + opShortSeq(p1, current) { return [p1, p1]; } - async opIntSeq(p1, current) + opIntSeq(p1, current) { return [p1, p1]; } - async opLongSeq(p1, current) + opLongSeq(p1, current) { return [p1, p1]; } - async opFloatSeq(p1, current) + opFloatSeq(p1, current) { return [p1, p1]; } - async opDoubleSeq(p1, current) + opDoubleSeq(p1, current) { return [p1, p1]; } - async opStringSeq(p1, current) + opStringSeq(p1, current) { return [p1, p1]; } - async opSmallStructSeq(p1, current) + opSmallStructSeq(p1, current) { return [p1, p1]; } - async opSmallStructList(p1, current) + opSmallStructList(p1, current) { return [p1, p1]; } - async opFixedStructSeq(p1, current) + opFixedStructSeq(p1, current) { return [p1, p1]; } - async opFixedStructList(p1, current) + opFixedStructList(p1, current) { return [p1, p1]; } - async opVarStructSeq(p1, current) + opVarStructSeq(p1, current) { return [p1, p1]; } - async opSerializable(p1, current) + opSerializable(p1, current) { return [p1, p1]; } - async opIntIntDict(p1, current) + opIntIntDict(p1, current) { return [p1, p1]; } - async opStringIntDict(p1, current) + opStringIntDict(p1, current) { return [p1, p1]; } - async opIntOneOptionalDict(p1, current) + opIntOneOptionalDict(p1, current) { return [p1, p1]; } - async opClassAndUnknownOptional(p, current) + opClassAndUnknownOptional(p, current) { } - async sendOptionalClass(req, current) + sendOptionalClass(req, current) { } - async returnOptionalClass(req, current) + returnOptionalClass(req, current) { return new Test.OneOptional(53); } - async opG(g, current) + opG(g, current) { return g; } - async opVoid(current) + opVoid(current) { } - async opMStruct1(current) + opMStruct1(current) { return new Test.SmallStruct(); } - async opMStruct2(p1, current) + opMStruct2(p1, current) { return [p1, p1]; } - async opMSeq1(current) + opMSeq1(current) { return []; } - async opMSeq2(p1, current) + opMSeq2(p1, current) { return [p1, p1]; } - async opMDict1(current) + opMDict1(current) { return new Map(); } - async opMDict2(p1, current) + opMDict2(p1, current) { return [p1, p1]; } - async opMG1(current) + opMG1(current) { return new Test.G(); } - async opMG2(p1, current) + opMG2(p1, current) { return [p1, p1]; } - async supportsRequiredParams(current) + supportsRequiredParams(current) { return false; } - async supportsJavaSerializable(current) + supportsJavaSerializable(current) { return false; } - async supportsCsharpSerializable(current) + supportsCsharpSerializable(current) { return false; } - async supportsCppStringView(current) + supportsCppStringView(current) { return false; } - async supportsNullOptional(current) + supportsNullOptional(current) { return true; } } exports.AMDInitialI = AMDInitialI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optional/Client.js b/js/test/Ice/optional/Client.js index aa93447462b..92decb51083 100644 --- a/js/test/Ice/optional/Client.js +++ b/js/test/Ice/optional/Client.js @@ -31,8 +31,8 @@ } out.write("testing stringToProxy... "); - let ref = "initial:default -p 12010"; - let base = communicator.stringToProxy(ref); + const ref = "initial:default -p 12010"; + const base = communicator.stringToProxy(ref); test(base !== null); out.writeLine("ok"); @@ -40,20 +40,20 @@ oo1.a = 15; out.write("testing checked cast... "); - let initial = await Test.InitialPrx.checkedCast(base); + const initial = await Test.InitialPrx.checkedCast(base); test(initial !== null); test(initial.equals(base)); out.writeLine("ok"); out.write("testing marshaling... "); - let oo4 = await initial.pingPong(new Test.OneOptional()); + const oo4 = await initial.pingPong(new Test.OneOptional()); test(oo4.a === undefined); - let oo5 = await initial.pingPong(oo1); + const oo5 = await initial.pingPong(oo1); test(oo5.a === oo1.a); - let mo4 = await initial.pingPong(new Test.MultiOptional()); + const mo4 = await initial.pingPong(new Test.MultiOptional()); test(mo4.a === undefined); test(mo4.b === undefined); test(mo4.c === undefined); @@ -89,7 +89,7 @@ test(mo4.ser === undefined); - mo1 = new Test.MultiOptional(); + const mo1 = new Test.MultiOptional(); mo1.a = 15; mo1.b = true; mo1.c = 19; @@ -132,7 +132,7 @@ mo1.bos = [false, true, false]; - let mo5 = await initial.pingPong(mo1); + const mo5 = await initial.pingPong(mo1); test(mo1.a == mo5.a); test(mo1.b == mo5.b); @@ -167,7 +167,7 @@ test(ArrayUtil.equals(mo5.bos, [false, true, false])); // Clear the first half of the optional parameters - mo6 = new Test.MultiOptional(); + const mo6 = new Test.MultiOptional(); mo6.b = mo5.b; mo6.d = mo5.d; mo6.f = mo5.f; @@ -183,11 +183,10 @@ mo6.iood = mo5.iood; mo6.bos = mo5.bos; - let mo7 = await initial.pingPong(mo6); - + const mo7 = await initial.pingPong(mo6); test(mo7.a === undefined); test(mo7.b == mo1.b); - test(mo7.c === undefined ); + test(mo7.c === undefined); test(mo7.d == mo1.d); test(mo7.e === undefined); test(mo7.f == mo1.f); @@ -218,7 +217,7 @@ test(ArrayUtil.equals(mo7.bos, [false, true, false])); // Clear the second half of the optional parameters - mo8 = new Test.MultiOptional(); + const mo8 = new Test.MultiOptional(); mo8.a = mo1.a; mo8.c = mo1.c; mo8.e = mo1.e; @@ -237,7 +236,7 @@ mo8.ivsd = mo1.ivsd; mo8.ioopd = mo1.ioopd; - let mo9 = await initial.pingPong(mo8); + const mo9 = await initial.pingPong(mo8); test(mo9.a == mo1.a); test(mo9.b === undefined); @@ -275,20 +274,20 @@ // // Use the 1.0 encoding with operations whose only class parameters are optional. // - let initial2 = initial.ice_encodingVersion(Ice.Encoding_1_0); - let oo = new Test.OneOptional(53); + const initial2 = initial.ice_encodingVersion(Ice.Encoding_1_0); + const oo = new Test.OneOptional(53); await initial.sendOptionalClass(true, oo); await initial2.sendOptionalClass(true, oo); - oo1 = await initial.returnOptionalClass(true) + oo1 = await initial.returnOptionalClass(true); test(oo1 !== undefined && oo1.a == 53); oo1 = await initial2.returnOptionalClass(true); test(oo1 === undefined); - let recursive1 = [new Test.Recursive()]; - let recursive2 = [new Test.Recursive()]; + const recursive1 = [new Test.Recursive()]; + const recursive2 = [new Test.Recursive()]; recursive1[0].value = recursive2; - let outer = new Test.Recursive(); + const outer = new Test.Recursive(); outer.value = recursive1; await initial.pingPong(outer); @@ -305,7 +304,7 @@ test(g.gg2Opt.a.equals(new Ice.Long(0, 20))); test(g.gg1.a == "gg1"); - let init2 = ClientPrivate.Initial2Prx.uncheckedCast(initial); + const init2 = ClientPrivate.Initial2Prx.uncheckedCast(initial); await init2.opVoid(5, "test"); out.writeLine("ok"); @@ -326,7 +325,7 @@ { mc.ifsd.set(i, new Test.FixedStruct()); } - mc = await initial.pingPong(mc); + mc = await initial.pingPong(mc); test(mc.bs.length == 1000); test(mc.shs.length == 300); @@ -336,7 +335,7 @@ out.writeLine("ok"); out.write("testing tag marshaling... "); - b = await initial.pingPong(new Test.B()); + let b = await initial.pingPong(new Test.B()); test(b.ma === undefined); test(b.mb === undefined); @@ -756,41 +755,37 @@ test(await initial.opMG1() !== undefined); { - let p1, p2, p3; - [p3, p2] = await initial.opMStruct2(); + let [p3, p2] = await initial.opMStruct2(); test(p3 === undefined && p2 == undefined); - p1 = new Test.SmallStruct(); + const p1 = new Test.SmallStruct(); [p3, p2] = await initial.opMStruct2(p1); test(p2.equals(p1) && p3.equals(p1)); } { - let p1, p2, p3; - [p3, p2] = await initial.opMSeq2(); + let [p3, p2] = await initial.opMSeq2(); test(p2 === undefined && p3 === undefined); - p1 = ["hello"]; + const p1 = ["hello"]; [p3, p2] = await initial.opMSeq2(p1); test(ArrayUtil.equals(p2, p1) && ArrayUtil.equals(p3, p1)); } { - let p1, p2, p3; - [p3, p2] = await initial.opMDict2(); + let [p3, p2] = await initial.opMDict2(); test(p2 === undefined && p3 === undefined); - p1 = new Map(); + const p1 = new Map(); p1.set("test", 54); [p3, p2] = await initial.opMDict2(p1); test(Ice.MapUtil.equals(p2, p1) && Ice.MapUtil.equals(p3, p1)); } { - let p1, p2, p3; - [p3, p2] = await initial.opMG2(); + let [p3, p2] = await initial.opMG2(); test(p2 === undefined && p3 === undefined); - p1 = new Test.G(); + const p1 = new Test.G(); [p3, p2] = await initial.opMG2(p1); test(p3 !== undefined && p2 !== undefined && p3 === p2); } @@ -819,7 +814,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optional/InitialI.js b/js/test/Ice/optional/InitialI.js index 39f8e19e110..6fbc23a4baa 100644 --- a/js/test/Ice/optional/InitialI.js +++ b/js/test/Ice/optional/InitialI.js @@ -9,7 +9,6 @@ (function(module, require, exports) { - const Ice = require("ice").Ice; const Test = require("Test").Test; class InitialI extends Test.Initial @@ -341,7 +340,6 @@ } } exports.InitialI = InitialI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optional/Server.js b/js/test/Ice/optional/Server.js index d7ba9f07f5b..8356fcbe8a8 100644 --- a/js/test/Ice/optional/Server.js +++ b/js/test/Ice/optional/Server.js @@ -23,7 +23,7 @@ { communicator = Ice.initialize(initData); echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010")); - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.add(new InitialI(), Ice.stringToIdentity("initial")); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); @@ -52,7 +52,6 @@ } exports._server = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optional/ServerAMD.js b/js/test/Ice/optional/ServerAMD.js index 8cd285c3a99..75bc59858e6 100644 --- a/js/test/Ice/optional/ServerAMD.js +++ b/js/test/Ice/optional/ServerAMD.js @@ -23,7 +23,7 @@ { communicator = Ice.initialize(initData); echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010")); - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.add(new AMDInitialI(), Ice.stringToIdentity("initial")); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); @@ -52,7 +52,6 @@ } exports._serveramd = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/properties/Client.js b/js/test/Ice/properties/Client.js index 614ae254dc6..7230fbd1858 100644 --- a/js/test/Ice/properties/Client.js +++ b/js/test/Ice/properties/Client.js @@ -7,6 +7,8 @@ // // ********************************************************************** +/* eslint-env jquery */ + (function(module, require, exports) { const Ice = require("ice").Ice; @@ -45,22 +47,24 @@ props.set("AServer", "\\\\server\\dir"); props.set("BServer", "\\server\\dir"); - let properties = Ice.createProperties(); - if(typeof(require("fs").readFileSync) == "function") + const properties = Ice.createProperties(); + /* eslint-disable no-sync */ + if(typeof require("fs").readFileSync == "function") { // // We are runing with NodeJS we load the properties file from the file system. // properties.parse(require("fs").readFileSync(args[3] + "/config/escapes.cfg", {encoding: "utf8"})); - for(let [key, value] of props) + for(const [key, value] of props) { test(properties.getProperty(key) == value); } } + /* eslint-enable no-sync */ else if(typeof window !== 'undefined') { // - //Skiped when running in a worker, we don't load JQuery in the workers + // Skiped when running in a worker, we don't load JQuery in the workers // // @@ -69,8 +73,6 @@ await new Promise( (resolve, reject) => { - /*jshint jquery: true */ - // // Use text data type to avoid problems interpreting the data. // @@ -78,7 +80,7 @@ data => { properties.parse(data); - for(let [key, value] of props) + for(const [key, value] of props) { test(properties.getProperty(key) == value); } @@ -90,7 +92,6 @@ } exports._test = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/proxy/Client.js b/js/test/Ice/proxy/Client.js index a0ab98886d8..0b2e3c60db2 100644 --- a/js/test/Ice/proxy/Client.js +++ b/js/test/Ice/proxy/Client.js @@ -10,17 +10,12 @@ (function(module, require, exports) { const Ice = require("ice").Ice; - const IceSSL = require("ice").IceSSL; const Test = require("Test").Test; async function allTests(communicator, out) { class TestError extends Error { - constructor(message) - { - super(message); - } } function test(value, ex) @@ -36,14 +31,14 @@ } } - let defaultProtocol = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + const defaultProtocol = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp"); out.write("testing stringToProxy... "); - ref = "test:default -p 12010"; - base = communicator.stringToProxy(ref); + const ref = "test:default -p 12010"; + const base = communicator.stringToProxy(ref); test(base !== null); - b1 = communicator.stringToProxy("test"); + let b1 = communicator.stringToProxy("test"); test(b1.ice_getIdentity().name === "test" && b1.ice_getIdentity().category.length === 0 && b1.ice_getAdapterId().length === 0 && b1.ice_getFacet().length === 0); b1 = communicator.stringToProxy("test "); @@ -116,7 +111,7 @@ test(b1.ice_getIdentity().name === "test\x494test"); b1 = communicator.stringToProxy("test\\b\\f\\n\\r\\t\\'\\\"\\\\test"); - test(b1.ice_getIdentity().name === "test\b\f\n\r\t\'\"\\test" && + test(b1.ice_getIdentity().name === "test\b\f\n\r\t'\"\\test" && b1.ice_getIdentity().category.length === 0); b1 = communicator.stringToProxy("category/test"); @@ -204,7 +199,7 @@ try { - b1 = communicator.stringToProxy("id -f \'facet x"); + b1 = communicator.stringToProxy("id -f 'facet x"); test(false); } catch(ex) @@ -278,16 +273,6 @@ test(ex instanceof Ice.EndpointParseException, ex); } - // This is an unknown endpoint warning, not a parse exception. - // - //try - //{ - // b1 = communicator.stringToProxy("test -f the:facet:tcp"); - // test(false); - //} - //catch(ex:Ice.EndpointParseException) - //{ - //} try { b1 = communicator.stringToProxy("test::" + defaultProtocol); @@ -386,8 +371,8 @@ out.writeLine("ok"); out.write("testing propertyToProxy... "); - let prop = communicator.getProperties(); - let propertyPrefix = "Foo.Proxy"; + const prop = communicator.getProperties(); + const propertyPrefix = "Foo.Proxy"; prop.setProperty(propertyPrefix, "test:default -p 12010"); b1 = communicator.propertyToProxy(propertyPrefix); test(b1.ice_getIdentity().name === "test" && b1.ice_getIdentity().category.length === 0 && @@ -422,14 +407,6 @@ test(b1.ice_getLocatorCacheTimeout() === 1); prop.setProperty(property, ""); - // This cannot be tested so easily because the property is cached - // on communicator initialization. - // - //prop.setProperty("Ice.Default.LocatorCacheTimeout", "60"); - //b1 = communicator.propertyToProxy(propertyPrefix); - //test(b1.ice_getLocatorCacheTimeout() === 60); - //prop.setProperty("Ice.Default.LocatorCacheTimeout", ""); - prop.setProperty(propertyPrefix, "test:default -p 12010"); property = propertyPrefix + ".Router"; @@ -499,7 +476,7 @@ locator = locator.ice_router(Ice.RouterPrx.uncheckedCast(router)); b1 = b1.ice_locator(Ice.LocatorPrx.uncheckedCast(locator)); - let proxyProps = communicator.proxyToProperty(b1, "Test"); + const proxyProps = communicator.proxyToProperty(b1, "Test"); test(proxyProps.size === 21); test(proxyProps.get("Test") === "test -t -e 1.0"); test(proxyProps.get("Test.CollocationOptimized") === "0"); @@ -575,7 +552,7 @@ try { base.ice_timeout(-2); - test(false, ex); + test(false); } catch(ex) { @@ -646,7 +623,7 @@ test(communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo"))); test(!communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo2"))); - let compObj = communicator.stringToProxy("foo"); + const compObj = communicator.stringToProxy("foo"); test(compObj.ice_facet("facet").equals(compObj.ice_facet("facet"))); test(!compObj.ice_facet("facet").equals(compObj.ice_facet("facet1"))); @@ -671,10 +648,6 @@ test(compObj.ice_connectionId("id1").ice_getConnectionId() === "id1"); test(compObj.ice_connectionId("id2").ice_getConnectionId() === "id2"); - // Proxy doesn't support ice_compress - //test(compObj.ice_compress(true).equals(compObj.ice_compress(true))); - //test(!compObj.ice_compress(false).equals(compObj.ice_compress(true))); - test(compObj.ice_timeout(20).equals(compObj.ice_timeout(20))); test(!compObj.ice_timeout(10).equals(compObj.ice_timeout(20))); @@ -682,25 +655,25 @@ test(compObj.ice_timeout(10).ice_getTimeout() == 10); test(compObj.ice_timeout(20).ice_getTimeout() == 20); - let loc1 = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("loc1:default -p 10000")); - let loc2 = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("loc2:default -p 10000")); + const loc1 = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("loc1:default -p 10000")); + const loc2 = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("loc2:default -p 10000")); test(compObj.ice_locator(null).equals(compObj.ice_locator(null))); test(compObj.ice_locator(loc1).equals(compObj.ice_locator(loc1))); test(!compObj.ice_locator(loc1).equals(compObj.ice_locator(null))); test(!compObj.ice_locator(null).equals(compObj.ice_locator(loc2))); test(!compObj.ice_locator(loc1).equals(compObj.ice_locator(loc2))); - let rtr1 = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("rtr1:default -p 10000")); - let rtr2 = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("rtr2:default -p 10000")); + const rtr1 = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("rtr1:default -p 10000")); + const rtr2 = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("rtr2:default -p 10000")); test(compObj.ice_router(null).equals(compObj.ice_router(null))); test(compObj.ice_router(rtr1).equals(compObj.ice_router(rtr1))); test(!compObj.ice_router(rtr1).equals(compObj.ice_router(null))); test(!compObj.ice_router(null).equals(compObj.ice_router(rtr2))); test(!compObj.ice_router(rtr1).equals(compObj.ice_router(rtr2))); - let ctx1 = new Map(); + const ctx1 = new Map(); ctx1.set("ctx1", "v1"); - let ctx2 = new Map(); + const ctx2 = new Map(); ctx2.set("ctx2", "v2"); test(compObj.ice_context(null).equals(compObj.ice_context(null))); test(compObj.ice_context(ctx1).equals(compObj.ice_context(ctx1))); @@ -729,18 +702,18 @@ compObj2 = communicator.stringToProxy("foo@MyAdapter1"); test(!compObj1.equals(compObj2)); - let endpts1 = communicator.stringToProxy("foo:" + defaultProtocol + " -h 127.0.0.1 -p 10000").ice_getEndpoints(); - let endpts2 = communicator.stringToProxy("foo:" + defaultProtocol + " -h 127.0.0.1 -p 10001").ice_getEndpoints(); + const endpts1 = communicator.stringToProxy(`foo:${defaultProtocol} -h 127.0.0.1 -p 10000`).ice_getEndpoints(); + const endpts2 = communicator.stringToProxy(`foo:${defaultProtocol} -h 127.0.0.1 -p 10001`).ice_getEndpoints(); test(!endpts1[0].equals(endpts2[0])); - test(endpts1[0].equals(communicator.stringToProxy("foo:" + defaultProtocol + " -h 127.0.0.1 -p 10000").ice_getEndpoints()[0])); + test(endpts1[0].equals(communicator.stringToProxy(`foo:${defaultProtocol} -h 127.0.0.1 -p 10000`).ice_getEndpoints()[0])); test(compObj1.ice_encodingVersion(Ice.Encoding_1_0).equals(compObj1.ice_encodingVersion(Ice.Encoding_1_0))); test(!compObj1.ice_encodingVersion(Ice.Encoding_1_0).equals(compObj1.ice_encodingVersion(Ice.Encoding_1_1))); - let baseConnection = await base.ice_getConnection(); + const baseConnection = await base.ice_getConnection(); if(baseConnection !== null) { - let baseConnection2 = await base.ice_connectionId("base2").ice_getConnection(); + const baseConnection2 = await base.ice_connectionId("base2").ice_getConnection(); compObj1 = compObj1.ice_fixed(baseConnection); compObj2 = compObj2.ice_fixed(baseConnection2); test(!compObj1.equals(compObj2)); @@ -748,7 +721,7 @@ out.writeLine("ok"); out.write("testing checked cast... "); - let cl = await Test.MyClassPrx.checkedCast(base); + const cl = await Test.MyClassPrx.checkedCast(base); test(cl !== null); let derived = await Test.MyDerivedClassPrx.checkedCast(cl); test(derived !== null); @@ -759,19 +732,19 @@ out.write("testing checked cast with context... "); let c = await cl.getContext(); - test(c == null || c.size == 0); + test(c === null || c.size == 0); c = new Map(); c.set("one", "hello"); c.set("two", "world"); - clc = await Test.MyClassPrx.checkedCast(base, undefined, c); - let c2 = await clc.getContext(); - test(Ice.MapUtil.equals(c, c2)) + const clc = await Test.MyClassPrx.checkedCast(base, undefined, c); + const c2 = await clc.getContext(); + test(Ice.MapUtil.equals(c, c2)); out.writeLine("ok"); out.write("testing ice_fixed... "); { const connection = await cl.ice_getConnection(); - if(connection != null) + if(connection !== null) { await cl.ice_fixed(connection).getContext(); test(cl.ice_secure(true).ice_fixed(connection).ice_isSecure()); @@ -1020,16 +993,14 @@ if(communicator.getProperties().getPropertyAsInt("Ice.IPv6") === 0) { - let ref = "test:default -p 12010"; - let base = communicator.stringToProxy(ref); + const ref = "test:default -p 12010"; - let ssl = communicator.getProperties().getProperty("Ice.Default.Protocol") === "ssl"; - /* TODO: p1 contains 127.0.0.1 - OK to invoke? - if(!ssl) - { - p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); - } - */ + const ssl = communicator.getProperties().getProperty("Ice.Default.Protocol") === "ssl"; + // TODO: p1 contains 127.0.0.1 - OK to invoke? + // if(!ssl) + // { + // p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); + // } // Two legal TCP endpoints expressed as opaque endpoints p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); @@ -1119,14 +1090,14 @@ out.write("testing proxyToString... "); b1 = communicator.stringToProxy(ref); - b2 = communicator.stringToProxy(communicator.proxyToString(b1)); + let b2 = communicator.stringToProxy(communicator.proxyToString(b1)); test(b1.equals(b2)); con = await b1.ice_getConnection(); b2 = con.createProxy(Ice.stringToIdentity("fixed")); - str = communicator.proxyToString(b2); + const str = communicator.proxyToString(b2); test(b2.toString() === str); - str2 = b1.ice_identity(b2.ice_getIdentity()).ice_secure(b2.ice_isSecure()).toString(); + const str2 = b1.ice_identity(b2.ice_getIdentity()).ice_secure(b2.ice_isSecure()).toString(); // Verify that the stringified fixed proxy is the same as a regular stringified proxy // but without endpoints @@ -1198,7 +1169,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/retry/Client.js b/js/test/Ice/retry/Client.js index 34c66c532f3..86d810347c1 100644 --- a/js/test/Ice/retry/Client.js +++ b/js/test/Ice/retry/Client.js @@ -28,15 +28,15 @@ } out.write("testing stringToProxy... "); - let ref = "retry:default -p 12010"; - let base1 = communicator.stringToProxy(ref); + const ref = "retry:default -p 12010"; + const base1 = communicator.stringToProxy(ref); test(base1 !== null); - let base2 = communicator.stringToProxy(ref); + const base2 = communicator.stringToProxy(ref); test(base2 !== null); out.writeLine("ok"); out.write("testing checked cast... "); - let retry1 = await Test.RetryPrx.checkedCast(base1); + const retry1 = await Test.RetryPrx.checkedCast(base1); test(retry1 !== null); test(retry1.equals(base1)); let retry2 = await Test.RetryPrx.checkedCast(base2); @@ -56,7 +56,7 @@ } catch(ex) { - if(typeof(window) === 'undefined' && typeof(WorkerGlobalScope) === 'undefined') // Nodejs + if(typeof window === 'undefined' && typeof WorkerGlobalScope === 'undefined') // Nodejs { test(ex instanceof Ice.ConnectionLostException, ex); } @@ -72,7 +72,7 @@ out.writeLine("ok"); out.write("testing idempotent operation... "); - let count = await retry1.opIdempotent(4); + const count = await retry1.opIdempotent(4); test(count === 4); out.writeLine("ok"); @@ -128,7 +128,7 @@ // + retry test, we need to configure a large retry interval // to avoid time-sensitive failures. // - let initData2 = new Ice.InitializationData(); + const initData2 = new Ice.InitializationData(); initData2.properties = communicator.getProperties().clone(); initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000"); communicator2 = Ice.initialize(initData2); @@ -151,7 +151,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/servantLocator/Client.js b/js/test/Ice/servantLocator/Client.js index 08c7da169d1..dca5314a5f7 100644 --- a/js/test/Ice/servantLocator/Client.js +++ b/js/test/Ice/servantLocator/Client.js @@ -32,7 +32,7 @@ try { await obj.requestFailedException(); - test(false) + test(false); } catch(ex) { @@ -163,32 +163,32 @@ } out.write("testing stringToProxy... "); - let ref = "asm:default -p 12010"; + const ref = "asm:default -p 12010"; let base = communicator.stringToProxy(ref); test(base !== null); out.writeLine("ok"); out.write("testing checked cast... "); let obj = await Test.TestIntfPrx.checkedCast(base); - test(obj != null); + test(obj !== null); test(obj.equals(base)); out.writeLine("ok"); out.write("testing ice_ids... "); try { - let o = communicator.stringToProxy("category/locate:default -p 12010"); + const o = communicator.stringToProxy("category/locate:default -p 12010"); await o.ice_ids(); test(false); } catch(ex) { - test(ex instanceof Ice.UnknownUserException && ex.unknown == "::Test::TestIntfUserException", ex) + test(ex instanceof Ice.UnknownUserException && ex.unknown == "::Test::TestIntfUserException", ex); } try { - let o = communicator.stringToProxy("category/finished:default -p 12010"); + const o = communicator.stringToProxy("category/finished:default -p 12010"); await o.ice_ids(); test(false); } @@ -276,7 +276,7 @@ out.write("testing servant locator removal... "); base = communicator.stringToProxy("test/activation:default -p 12010"); - activation = await Test.TestActivationPrx.checkedCast(base); + const activation = await Test.TestActivationPrx.checkedCast(base); await activation.activateServantLocator(false); try { @@ -316,7 +316,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/servantLocator/ServantLocatorI.js b/js/test/Ice/servantLocator/ServantLocatorI.js index e4f27a0fa95..fea334685b1 100644 --- a/js/test/Ice/servantLocator/ServantLocatorI.js +++ b/js/test/Ice/servantLocator/ServantLocatorI.js @@ -78,7 +78,7 @@ test(this._requestId == current.requestId); this._requestId = -1; - test(current.id.category == this._category || this._category.length == 0); + test(current.id.category == this._category || this._category.length == 0); test(current.id.name == "locate" || current.id.name == "finished"); if(current.id.name == "finished") @@ -153,7 +153,6 @@ } exports.ServantLocatorI = ServantLocatorI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/servantLocator/Server.js b/js/test/Ice/servantLocator/Server.js index e8bac3a0755..55017855161 100644 --- a/js/test/Ice/servantLocator/Server.js +++ b/js/test/Ice/servantLocator/Server.js @@ -28,7 +28,7 @@ { communicator = Ice.initialize(initData); echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010")); - let adapter = await communicator.createObjectAdapter(""); + const adapter = await communicator.createObjectAdapter(""); adapter.addServantLocator(new ServantLocatorI("category"), "category"); adapter.addServantLocator(new ServantLocatorI(""), ""); adapter.add(new TestI(), Ice.stringToIdentity("asm")); @@ -60,7 +60,6 @@ } exports._server = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/servantLocator/TestActivationI.js b/js/test/Ice/servantLocator/TestActivationI.js index 451c6791b0f..e1d411a7cf3 100644 --- a/js/test/Ice/servantLocator/TestActivationI.js +++ b/js/test/Ice/servantLocator/TestActivationI.js @@ -9,7 +9,6 @@ (function(module, require, exports) { - const Ice = require("ice").Ice; const Test = require("Test").Test; const ServantLocatorI = require("ServantLocatorI").ServantLocatorI; @@ -33,7 +32,6 @@ } exports.TestActivationI = TestActivationI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/servantLocator/TestI.js b/js/test/Ice/servantLocator/TestI.js index 52f88027971..9e9f78d019b 100644 --- a/js/test/Ice/servantLocator/TestI.js +++ b/js/test/Ice/servantLocator/TestI.js @@ -51,7 +51,7 @@ { if(throwEx) { - throw new TestImpossibleException(); + throw new Test.TestImpossibleException(); } // @@ -65,7 +65,7 @@ { if(throwEx) { - throw new TestIntfUserException(); + throw new Test.TestIntfUserException(); } // @@ -92,7 +92,6 @@ } exports.TestI = TestI; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/slicing/exceptions/Client.js b/js/test/Ice/slicing/exceptions/Client.js index ceda1ee3c8e..8a18ad3ade1 100644 --- a/js/test/Ice/slicing/exceptions/Client.js +++ b/js/test/Ice/slicing/exceptions/Client.js @@ -11,7 +11,6 @@ { const Ice = require("ice").Ice; const Test = require("Test").Test; - const ArrayUtil = Ice.ArrayUtil; async function allTests(out, communicator) { @@ -29,13 +28,13 @@ } out.write("testing stringToProxy... "); - let ref = "Test:default -p 12010 -t 10000"; - let base = communicator.stringToProxy(ref); + const ref = "Test:default -p 12010 -t 10000"; + const base = communicator.stringToProxy(ref); test(base !== null); out.writeLine("ok"); out.write("testing checked cast... "); - let prx = await Test.TestIntfPrx.checkedCast(base); + const prx = await Test.TestIntfPrx.checkedCast(base); test(prx !== null); test(prx.equals(base)); out.writeLine("ok"); @@ -130,7 +129,7 @@ out.write("slicing of known most derived as base... "); try { - await prx.knownMostDerivedAsBase(); + await prx.knownMostDerivedAsBase(); test(false); } catch(ex) @@ -146,7 +145,7 @@ out.write("non-slicing of known intermediate as intermediate... "); try { - await prx.knownIntermediateAsKnownIntermediate(); + await prx.knownIntermediateAsKnownIntermediate(); test(false); } catch(ex) @@ -259,6 +258,7 @@ } else if(ex instanceof Ice.OperationNotExistException) { + // Ignore } else { @@ -267,7 +267,7 @@ } out.writeLine("ok"); - out.write("preserved exceptions...") + out.write("preserved exceptions..."); try { await prx.unknownPreservedAsBase(); @@ -282,7 +282,7 @@ } else { - let slicedData = ex.ice_getSlicedData(); + const slicedData = ex.ice_getSlicedData(); test(slicedData !== null); test(slicedData.slices.length == 2); test(slicedData.slices[1].typeId == "::Test::SPreserved1"); @@ -293,7 +293,7 @@ try { await prx.unknownPreservedAsKnownPreserved(); - test(false) + test(false); } catch(ex) { @@ -305,7 +305,7 @@ } else { - let slicedData = ex.ice_getSlicedData(); + const slicedData = ex.ice_getSlicedData(); test(slicedData !== null); test(slicedData.slices.length == 2); test(slicedData.slices[1].typeId == "::Test::SPreserved1"); @@ -335,7 +335,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/slicing/objects/Client.js b/js/test/Ice/slicing/objects/Client.js index 291fc522432..953c336bfe4 100644 --- a/js/test/Ice/slicing/objects/Client.js +++ b/js/test/Ice/slicing/objects/Client.js @@ -11,7 +11,6 @@ { const Ice = require("ice").Ice; const Test = require("Test").Test; - const ArrayUtil = Ice.ArrayUtil; async function allTests(out, communicator) { @@ -26,7 +25,7 @@ function PreservedFactoryI(id) { - return id === Test.Preserved.ice_staticId() ? new PreservedI() : null; + return id === Test.Preserved.ice_staticId() ? new PreservedI() : null; } function test(value, ex) @@ -43,20 +42,20 @@ } out.write("testing stringToProxy... "); - let ref = "Test:default -p 12010 -t 10000"; - let base = communicator.stringToProxy(ref); + const ref = "Test:default -p 12010 -t 10000"; + const base = communicator.stringToProxy(ref); test(base !== null); out.writeLine("ok"); out.write("testing checked cast... "); - let prx = await Test.TestIntfPrx.checkedCast(base); + const prx = await Test.TestIntfPrx.checkedCast(base); test(prx !== null); test(prx.equals(base)); out.writeLine("ok"); out.write("base as Object... "); { - let sb = await prx.SBaseAsObject(); + const sb = await prx.SBaseAsObject(); test(sb !== null); test(sb.ice_id() == "::Test::SBase"); test(sb.sb == "SBase.sb"); @@ -65,14 +64,14 @@ out.write("base as base... "); { - let sb = await prx.SBaseAsSBase(); + const sb = await prx.SBaseAsSBase(); test(sb.sb == "SBase.sb"); } out.writeLine("ok"); out.write("base with known derived as base... "); { - let sb = await prx.SBSKnownDerivedAsSBase(); + const sb = await prx.SBSKnownDerivedAsSBase(); test(sb !== null); test(sb.sb == "SBSKnownDerived.sb"); test(sb.sbskd == "SBSKnownDerived.sbskd"); @@ -81,14 +80,14 @@ out.write("base with known derived as known derived... "); { - let sb = await prx.SBSKnownDerivedAsSBSKnownDerived(); + const sb = await prx.SBSKnownDerivedAsSBSKnownDerived(); test(sb.sbskd == "SBSKnownDerived.sbskd"); } out.writeLine("ok"); out.write("base with unknown derived as base... "); { - let sb = await prx.SBSUnknownDerivedAsSBase(); + const sb = await prx.SBSUnknownDerivedAsSBase(); test(sb.sb == "SBSUnknownDerived.sb"); } @@ -96,7 +95,7 @@ { try { - let sb = await prx.SBSUnknownDerivedAsSBaseCompact(); + const sb = await prx.SBSUnknownDerivedAsSBaseCompact(); test(sb.sb == "SBSUnknownDerived.sb"); } catch(ex) @@ -122,7 +121,7 @@ out.write("unknown with Object as Object... "); try { - let obj = await prx.SUnknownAsObject(); + const obj = await prx.SUnknownAsObject(); test(!prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)); test(obj instanceof Ice.UnknownSlicedValue); test(obj.ice_id() == "::Test::SUnknown"); @@ -138,7 +137,7 @@ out.write("one-element cycle... "); { - let b = await prx.oneElementCycle(); + const b = await prx.oneElementCycle(); test(b !== null); test(b.ice_id() == "::Test::B"); test(b.sb == "B1.sb"); @@ -148,12 +147,12 @@ out.write("two-element cycle... "); { - let b1 = await prx.twoElementCycle(); + const b1 = await prx.twoElementCycle(); test(b1 !== null); test(b1.ice_id() == "::Test::B"); test(b1.sb == "B1.sb"); - let b2 = b1.pb; + const b2 = b1.pb; test(b2 !== null); test(b2.ice_id() == "::Test::B"); test(b2.sb == "B2.sb"); @@ -163,7 +162,7 @@ out.write("known derived pointer slicing as derived... "); { - let d1 = await prx.D1AsD1(); + const d1 = await prx.D1AsD1(); test(d1 !== null); test(d1.ice_id() == "::Test::D1"); @@ -171,7 +170,7 @@ test(d1.pb !== null); test(d1.pb !== d1); - let b2 = d1.pb; + const b2 = d1.pb; test(b2 !== null); test(b2.ice_id() == "::Test::B"); test(b2.sb == "D2.sb"); @@ -181,7 +180,7 @@ out.write("unknown derived pointer slicing as base... "); { - let b2 = await prx.D2AsB(); + const b2 = await prx.D2AsB(); test(b2 !== null); test(b2.ice_id() == "::Test::B"); @@ -189,7 +188,7 @@ test(b2.pb !== null); test(b2.pb !== b2); - let b1 = b2.pb; + const b1 = b2.pb; test(b1 !== null); test(b1.ice_id() == "::Test::D1"); test(b1.sb == "D1.sb"); @@ -201,7 +200,7 @@ out.write("param ptr slicing with known first... "); { - let [b1, b2] = await prx.paramTest1(); + const [b1, b2] = await prx.paramTest1(); test(b1 !== null); test(b1.ice_id() == "::Test::D1"); test(b1.sb == "D1.sb"); @@ -211,7 +210,7 @@ test(b1.pd1 === b2); test(b2 !== null); - test(b2.ice_id() == "::Test::B"); // No factory, must be sliced + test(b2.ice_id() == "::Test::B"); // No factory, must be sliced test(b2.sb == "D2.sb"); test(b2.pb === b1); } @@ -219,7 +218,7 @@ out.write("param ptr slicing with unknown first... "); { - let [b2, b1] = await prx.paramTest2(); + const [b2, b1] = await prx.paramTest2(); test(b1 !== null); test(b1.ice_id() == "::Test::D1"); test(b1.sb == "D1.sb"); @@ -229,7 +228,7 @@ test(b1.pd1 == b2); test(b2 !== null); - test(b2.ice_id() == "::Test::B"); // No factory, must be sliced + test(b2.ice_id() == "::Test::B"); // No factory, must be sliced test(b2.sb == "D2.sb"); test(b2.pb == b1); } @@ -237,24 +236,24 @@ out.write("return value identity with known first... "); { - let [ret, p1, p2] = await prx.returnTest1(); + const [ret, p1] = await prx.returnTest1(); test(ret === p1); } out.writeLine("ok"); out.write("return value identity with unknown first... "); { - let[ret, p1, p2] = await prx.returnTest2(); + const [ret, p1] = await prx.returnTest2(); test(ret == p1); } out.writeLine("ok"); out.write("return value identity for input params known first... "); { - let d1 = new Test.D1(); + const d1 = new Test.D1(); d1.sb = "D1.sb"; d1.sd1 = "D1.sd1"; - let d3 = new Test.D3(); + const d3 = new Test.D3(); d3.pb = d1; d3.sb = "D3.sb"; d3.sd3 = "D3.sd3"; @@ -262,19 +261,19 @@ d1.pb = d3; d1.pd1 = d3; - let b1 = await prx.returnTest3(d1, d3); + const b1 = await prx.returnTest3(d1, d3); test(b1 !== null); test(b1.sb == "D1.sb"); test(b1.ice_id() == "::Test::D1"); - let p1 = b1; + const p1 = b1; test(p1 !== null); test(p1.sd1 == "D1.sd1"); test(p1.pd1 == b1.pb); - let b2 = b1.pb; + const b2 = b1.pb; test(b2 !== null); test(b2.sb == "D3.sb"); - test(b2.ice_id() == "::Test::B"); // Sliced by server + test(b2.ice_id() == "::Test::B"); // Sliced by server test(b2.pb == b1); test(!(b2 instanceof Test.D3)); @@ -287,10 +286,10 @@ out.write("return value identity for input params unknown first... "); { - let d1 = new Test.D1(); + const d1 = new Test.D1(); d1.sb = "D1.sb"; d1.sd1 = "D1.sd1"; - let d3 = new Test.D3(); + const d3 = new Test.D3(); d3.pb = d1; d3.sb = "D3.sb"; d3.sd3 = "D3.sd3"; @@ -298,20 +297,20 @@ d1.pb = d3; d1.pd1 = d3; - let b1 = await prx.returnTest3(d3, d1); + const b1 = await prx.returnTest3(d3, d1); test(b1 !== null); test(b1.sb == "D3.sb"); - test(b1.ice_id() == "::Test::B"); // Sliced by server + test(b1.ice_id() == "::Test::B"); // Sliced by server test(!(b1 instanceof Test.D3)); - let b2 = b1.pb; + const b2 = b1.pb; test(b2 !== null); test(b2.sb == "D1.sb"); test(b2.ice_id() == "::Test::D1"); test(b2.pb == b1); - let p3 = b2; + const p3 = b2; test(p3 !== null); test(p3.sd1 == "D1.sd1"); test(p3.pd1 === b1); @@ -325,7 +324,7 @@ out.write("remainder unmarshaling (3 instances)... "); { - let [ret, p1, p2] = await prx.paramTest3(); + const [ret, p1, p2] = await prx.paramTest3(); test(p1 !== null); test(p1.sb == "D2.sb (p1 1)"); test(p1.pb === null); @@ -345,7 +344,7 @@ out.write("remainder unmarshaling (4 instances)... "); { - let [ret, b] = await prx.paramTest4(); + const [ret, b] = await prx.paramTest4(); test(b !== null); test(b.sb == "D4.sb (1)"); test(b.pb === null); @@ -360,22 +359,21 @@ out.write("param ptr slicing, instance marshaled in unknown derived as base... "); { - let b1 = new Test.B(); + const b1 = new Test.B(); b1.sb = "B.sb(1)"; b1.pb = b1; - let d3 = new Test.D3(); + const d3 = new Test.D3(); d3.sb = "D3.sb"; d3.pb = d3; d3.sd3 = "D3.sd3"; d3.pd3 = b1; - let b2 = new Test.B(); + const b2 = new Test.B(); b2.sb = "B.sb(2)"; b2.pb = b1; - let ret = await prx.returnTest3(d3, b2); - + const ret = await prx.returnTest3(d3, b2); test(ret !== null); test(ret.ice_id() == "::Test::B"); test(ret.sb == "D3.sb"); @@ -385,25 +383,24 @@ out.write("param ptr slicing, instance marshaled in unknown derived as derived... "); { - let d11 = new Test.D1(); + const d11 = new Test.D1(); d11.sb = "D1.sb(1)"; d11.pb = d11; d11.sd1 = "D1.sd1(1)"; - let d3 = new Test.D3(); + const d3 = new Test.D3(); d3.sb = "D3.sb"; d3.pb = d3; d3.sd3 = "D3.sd3"; d3.pd3 = d11; - let d12 = new Test.D1(); + const d12 = new Test.D1(); d12.sb = "D1.sb(2)"; d12.pb = d12; d12.sd1 = "D1.sd1(2)"; d12.pd1 = d11; - let ret = await prx.returnTest3(d3, d12); - + const ret = await prx.returnTest3(d3, d12); test(ret !== null); test(ret.ice_id() == "::Test::B"); test(ret.sb == "D3.sb"); @@ -447,19 +444,19 @@ ss2d1.pd1 = ss1d3; ss2d3.pd3 = ss1d1; - let ss1 = new Test.SS1(); + const ss1 = new Test.SS1(); ss1.s = []; ss1.s[0] = ss1b; ss1.s[1] = ss1d1; ss1.s[2] = ss1d3; - let ss2 = new Test.SS2(); + const ss2 = new Test.SS2(); ss2.s = []; ss2.s[0] = ss2b; ss2.s[1] = ss2d1; ss2.s[2] = ss2d3; - let ss = await prx.sequenceTest(ss1, ss2); + const ss = await prx.sequenceTest(ss1, ss2); test(ss.c1 !== null); ss1b = ss.c1.s[0]; @@ -492,24 +489,24 @@ out.write("dictionary slicing... "); { - let bin = new Map(); + const bin = new Map(); for(let i = 0; i < 10; ++i) { - let s = `D1.${i}`; - let d1 = new Test.D1(); + const s = `D1.${i}`; + const d1 = new Test.D1(); d1.sb = s; d1.pb = d1; d1.sd1 = s; bin.set(i, d1); } - let [ret, boutH] = await prx.dictionaryTest(bin); + const [ret, boutH] = await prx.dictionaryTest(bin); test(boutH.size === 10); for(let i = 0; i < 10; ++i) { - let b = boutH.get(i * 10); + const b = boutH.get(i * 10); test(b !== null); - let s = `D1.${i}`; + const s = `D1.${i}`; test(b.sb == s); test(b.pb !== null); test(b.pb !== b); @@ -520,9 +517,9 @@ test(ret.size === 10); for(let i = 0; i < 10; ++i) { - let b = ret.get(i * 20); + const b = ret.get(i * 20); test(b !== null); - let s = "D1." + (i * 20); + const s = "D1." + (i * 20); test(b.sb == s); test(b.pb === (i === 0 ? null : ret.get((i - 1) * 20))); test(b.sd1 == s); @@ -613,168 +610,163 @@ out.write("forward-declared class... "); { - let f = await prx.useForward(); + const f = await prx.useForward(); test(f !== null); } out.writeLine("ok"); out.write("preserved classes... "); + // + // Register a factory in order to substitute our own subclass of Preserved. This provides + // an easy way to determine how many unmarshaled instances currently exist. + // + // TODO: We have to install this now (even though it's not necessary yet), because otherwise + // the Ice run time will install its own internal factory for Preserved upon receiving the + // first instance. + // + communicator.getValueFactoryManager().add(PreservedFactoryI, Test.Preserved.ice_staticId()); { // - // Register a factory in order to substitute our own subclass of Preserved. This provides - // an easy way to determine how many unmarshaled instances currently exist. + // Server knows the most-derived class PDerived. // - // TODO: We have to install this now (even though it's not necessary yet), because otherwise - // the Ice run time will install its own internal factory for Preserved upon receiving the - // first instance. - // - communicator.getValueFactoryManager().add(PreservedFactoryI, Test.Preserved.ice_staticId()); - { - // - // Server knows the most-derived class PDerived. - // - let pd = new Test.PDerived(); - pd.pi = 3; - pd.ps = "preserved"; - pd.pb = pd; + const pd = new Test.PDerived(); + pd.pi = 3; + pd.ps = "preserved"; + pd.pb = pd; - let p2 = await prx.exchangePBase(pd); + const p2 = await prx.exchangePBase(pd); - test(p2.pi === 3); - test(p2.ps == "preserved"); - test(p2.pb === p2); - } + test(p2.pi === 3); + test(p2.ps == "preserved"); + test(p2.pb === p2); + } - { - // - // Server only knows the base (non-preserved) type, so the object is sliced. - // - let pu = new Test.PCUnknown(); - pu.pi = 3; - pu.pu = "preserved"; + { + // + // Server only knows the base (non-preserved) type, so the object is sliced. + // + const pu = new Test.PCUnknown(); + pu.pi = 3; + pu.pu = "preserved"; - let r = await prx.exchangePBase(pu); + const r = await prx.exchangePBase(pu); - test(!(r instanceof Test.PCUnknown)); - test(r.pi == 3); - } + test(!(r instanceof Test.PCUnknown)); + test(r.pi == 3); + } + + { + // + // Server only knows the intermediate type Preserved. The object will be sliced to + // Preserved for the 1.0 encoding; otherwise it should be returned intact. + // + const pcd = new Test.PCDerived(); + pcd.pi = 3; + pcd.pbs = [pcd]; + const r = await prx.exchangePBase(pcd); + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(r instanceof Test.PCDerived)); + test(r.pi === 3); + } + else { - // - // Server only knows the intermediate type Preserved. The object will be sliced to - // Preserved for the 1.0 encoding; otherwise it should be returned intact. - // - let pcd = new Test.PCDerived(); - pcd.pi = 3; - pcd.pbs = [ pcd ]; + test(r.pi === 3); + test(r.pbs[0] === r); + } + } - let r = await prx.exchangePBase(pcd); + { + // + // Server only knows the intermediate type Preserved. The object will be sliced to + // Preserved for the 1.0 encoding; otherwise it should be returned intact. + // + const pcd = new Test.CompactPCDerived(); + pcd.pi = 3; + pcd.pbs = [pcd]; - if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) - { - test(!(r instanceof Test.PCDerived)); - test(r.pi === 3); - } - else - { - test(r.pi === 3); - test(r.pbs[0] === r); - } + const r = await prx.exchangePBase(pcd); + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(r instanceof Test.CompactPCDerived)); + test(r.pi === 3); } - + else { - // - // Server only knows the intermediate type Preserved. The object will be sliced to - // Preserved for the 1.0 encoding; otherwise it should be returned intact. - // - let pcd = new Test.CompactPCDerived(); - pcd.pi = 3; - pcd.pbs = [ pcd ]; + const p2 = r; + test(p2.pi === 3); + test(p2.pbs[0] === p2); + } + } - let r = await prx.exchangePBase(pcd); + { + // + // Send an object that will have multiple preserved slices in the server. + // The object will be sliced to Preserved for the 1.0 encoding. + // + const pcd = new Test.PCDerived3(); + pcd.pi = 3; - if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) - { - test(!(r instanceof Test.CompactPCDerived)); - test(r.pi === 3); - } - else - { - p2 = r; - test(p2.pi === 3); - test(p2.pbs[0] === p2); - } + // + // Sending more than 254 objects exercises the encoding for object ids. + // + pcd.pbs = new Array(300); + for(let i = 0; i < 300; ++i) + { + const p2 = new Test.PCDerived2(); + p2.pi = i; + p2.pbs = [null]; // Nil reference. This slice should not have an indirection table. + p2.pcd2 = i; + pcd.pbs[i] = p2; } + pcd.pcd2 = pcd.pi; + pcd.pcd3 = pcd.pbs[10]; + const r = await prx.exchangePBase(pcd); + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(r instanceof Test.PCDerived3)); + test(r instanceof Test.Preserved); + test(r.pi === 3); + } + else { - // - // Send an object that will have multiple preserved slices in the server. - // The object will be sliced to Preserved for the 1.0 encoding. - // - let pcd = new Test.PCDerived3(); - pcd.pi = 3; - - // - // Sending more than 254 objects exercises the encoding for object ids. - // - pcd.pbs = new Array(300); + const p3 = r; + test(p3.pi === 3); for(let i = 0; i < 300; ++i) { - let p2 = new Test.PCDerived2(); - p2.pi = i; - p2.pbs = [ null ]; // Nil reference. This slice should not have an indirection table. - p2.pcd2 = i; - pcd.pbs[i] = p2; + const p2 = p3.pbs[i]; + test(p2.pi === i); + test(p2.pbs.length === 1); + test(p2.pbs[0] === null); + test(p2.pcd2 === i); } - pcd.pcd2 = pcd.pi; - pcd.pcd3 = pcd.pbs[10]; + test(p3.pcd2 === p3.pi); + test(p3.pcd3 === p3.pbs[10]); + } + } - let r = await prx.exchangePBase(pcd); + { + // + // Obtain an object with preserved slices and send it back to the server. + // The preserved slices should be excluded for the 1.0 encoding, otherwise + // they should be included. + // + const p = await prx.PBSUnknownAsPreserved(); + await prx.checkPBSUnknown(p); - if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) - { - test(!(r instanceof Test.PCDerived3)); - test(r instanceof Test.Preserved); - test(r.pi === 3); - } - else - { - let p3 = r; - test(p3.pi === 3); - for(let i = 0; i < 300; ++i) - { - let p2 = p3.pbs[i]; - test(p2.pi === i); - test(p2.pbs.length === 1); - test(p2.pbs[0] === null); - test(p2.pcd2 === i); - } - test(p3.pcd2 === p3.pi); - test(p3.pcd3 === p3.pbs[10]); - } + if(!prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + const slicedData = p.ice_getSlicedData(); + test(slicedData !== null); + test(slicedData.slices.length === 1); + test(slicedData.slices[0].typeId == "::Test::PSUnknown"); + await prx.ice_encodingVersion(Ice.Encoding_1_0).checkPBSUnknown(p); } - + else { - // - // Obtain an object with preserved slices and send it back to the server. - // The preserved slices should be excluded for the 1.0 encoding, otherwise - // they should be included. - // - let p = await prx.PBSUnknownAsPreserved(); - await prx.checkPBSUnknown(p); - - if(!prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) - { - let slicedData = p.ice_getSlicedData(); - test(slicedData !== null); - test(slicedData.slices.length === 1); - test(slicedData.slices[0].typeId == "::Test::PSUnknown"); - await prx.ice_encodingVersion(Ice.Encoding_1_0).checkPBSUnknown(p); - } - else - { - test(p.ice_getSlicedData() === null); - } + test(p.ice_getSlicedData() === null); } } out.writeLine("ok"); @@ -800,7 +792,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Ice/timeout/Client.js b/js/test/Ice/timeout/Client.js index 25393cfb54b..8f8e92d520b 100644 --- a/js/test/Ice/timeout/Client.js +++ b/js/test/Ice/timeout/Client.js @@ -385,7 +385,6 @@ exports._test = run; exports._runServer = true; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Slice/escape/Client.js b/js/test/Slice/escape/Client.js index 64bd8724432..0ed9778c2d3 100644 --- a/js/test/Slice/escape/Client.js +++ b/js/test/Slice/escape/Client.js @@ -18,7 +18,7 @@ { throw new Error("test failed"); } - }; + } async function run(out, initData) { @@ -32,7 +32,7 @@ out.writeLine("ok"); out.write("testing structs... "); - let s = new _await._break(10); + const s = new _await._break(10); test(s._while == 10); out.writeLine("ok"); @@ -69,7 +69,7 @@ out.write("testing classes... "); - let d = new _await._delete(10, null, 10); + const d = new _await._delete(10, null, 10); test(d._if === 10); test(d._else === null); test(d._export === 10); @@ -100,7 +100,6 @@ } exports._test = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/js/test/Slice/macros/Client.js b/js/test/Slice/macros/Client.js index 5c6dbca9709..23ac3d78639 100644 --- a/js/test/Slice/macros/Client.js +++ b/js/test/Slice/macros/Client.js @@ -18,29 +18,36 @@ { throw new Error("test failed"); } - }; + } - async function run(out) + function run(out) { - out.write("testing Slice predefined macros... "); + try + { + out.write("testing Slice predefined macros... "); - let d = new Test._Default(); - test(d.x == 10); - test(d.y == 10); + const d = new Test._Default(); + test(d.x == 10); + test(d.y == 10); - let nd = new Test.NoDefault(); - test(nd.x != 10); - test(nd.y != 10); + const nd = new Test.NoDefault(); + test(nd.x != 10); + test(nd.y != 10); - let c = new Test.JsOnly(); - test(c.lang == "js"); - test(c.version == Ice.intVersion()); + const c = new Test.JsOnly(); + test(c.lang == "js"); + test(c.version == Ice.intVersion()); - out.writeLine("ok"); + out.writeLine("ok"); + return Promise.resolve(); + } + catch(ex) + { + return Promise.reject(ex); + } } exports._test = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : this.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : this)); diff --git a/scripts/Util.py b/scripts/Util.py index b1f8c08ff5b..07ec979787e 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -3653,7 +3653,7 @@ class JavaScriptMapping(Mapping): def getCommandLine(self, current, process, exe, args): if current.config.es5: - return "node {0}/test/Common/run.js --es5 {1} {2}".format(self.path, exe, args) + return "node {0}/test/es5/Common/run.js --es5 {1} {2}".format(self.path, exe, args) else: return "node {0}/test/Common/run.js {1} {2}".format(self.path, exe, args) |