From aab3ae3aaef1ca00f8e347d97230c6a54b3bf1d7 Mon Sep 17 00:00:00 2001 From: Jose Date: Mon, 21 Sep 2015 17:40:50 +0200 Subject: ICE-6634 - Using Ice in background worker. --- js/test/Common/Common.js | 66 +-- js/test/Common/TestCases.json | 231 ++++++++ js/test/Common/TestRunner.js | 154 +++++ js/test/Common/TestSuite.js | 667 +++++----------------- js/test/Common/Worker.js | 45 ++ js/test/Common/index.html | 24 +- js/test/Glacier2/router/Client.js | 4 +- js/test/Ice/acm/Client.js | 4 +- js/test/Ice/ami/Client.js | 4 +- js/test/Ice/binding/Client.js | 22 +- js/test/Ice/defaultValue/Client.js | 4 +- js/test/Ice/enums/Client.js | 4 +- js/test/Ice/exceptions/Client.js | 4 +- js/test/Ice/exceptionsBidir/AMDThrowerI.js | 4 +- js/test/Ice/exceptionsBidir/Client.js | 4 +- js/test/Ice/exceptionsBidir/ThrowerI.js | 4 +- js/test/Ice/facets/Client.js | 5 +- js/test/Ice/facetsBidir/Client.js | 4 +- js/test/Ice/facetsBidir/TestI.js | 4 +- js/test/Ice/hashmap/Client.js | 4 +- js/test/Ice/hold/Client.js | 4 +- js/test/Ice/info/Client.js | 4 +- js/test/Ice/inheritance/Client.js | 4 +- js/test/Ice/inheritanceBidir/Client.js | 4 +- js/test/Ice/inheritanceBidir/InitialI.js | 4 +- js/test/Ice/location/Client.js | 4 +- js/test/Ice/number/Client.js | 6 +- js/test/Ice/objects/Client.js | 4 +- js/test/Ice/operations/BatchOneways.js | 4 +- js/test/Ice/operations/Client.js | 4 +- js/test/Ice/operations/Oneways.js | 4 +- js/test/Ice/operations/Twoways.js | 11 +- js/test/Ice/operationsBidir/AMDMyDerivedClassI.js | 73 +-- js/test/Ice/operationsBidir/Client.js | 4 +- js/test/Ice/operationsBidir/MyDerivedClassI.js | 75 +-- js/test/Ice/optional/Client.js | 4 +- js/test/Ice/optionalBidir/AMDInitialI.js | 4 +- js/test/Ice/optionalBidir/Client.js | 4 +- js/test/Ice/optionalBidir/InitialI.js | 4 +- js/test/Ice/promise/Client.js | 4 +- js/test/Ice/properties/Client.js | 59 +- js/test/Ice/proxy/Client.js | 8 +- js/test/Ice/retry/Client.js | 14 +- js/test/Ice/slicing/exceptions/Client.js | 4 +- js/test/Ice/slicing/objects/Client.js | 4 +- js/test/Ice/timeout/Client.js | 4 +- 46 files changed, 755 insertions(+), 829 deletions(-) create mode 100644 js/test/Common/TestCases.json create mode 100644 js/test/Common/TestRunner.js create mode 100644 js/test/Common/Worker.js (limited to 'js/test') diff --git a/js/test/Common/Common.js b/js/test/Common/Common.js index d2bb087dd4f..c6887ab975a 100644 --- a/js/test/Common/Common.js +++ b/js/test/Common/Common.js @@ -7,44 +7,38 @@ // // ********************************************************************** -(function(module, require, exports){ - var Ice = require("ice").Ice; +/* globals -Ice*/ +var Ice = require("ice").Ice; - var write = function(msg) - { - process.stdout.write(msg); - }; +var write = function(msg) +{ + process.stdout.write(msg); +}; - var writeLine = function(msg) - { - this.write(msg + "\n"); - }; +var writeLine = function(msg) +{ + this.write(msg + "\n"); +}; - var run = function(m) - { - var id = new Ice.InitializationData(); - id.properties = Ice.createProperties(process.argv); - - var test = m.require("./Client").__test__; - - test({write: write, writeLine: writeLine}, id).exception( - function(ex, r) +var run = function(m) +{ + var id = new Ice.InitializationData(); + id.properties = Ice.createProperties(process.argv); + var test = m.require("./Client").__test__; + test({write: write, writeLine: writeLine}, id).exception( + function(ex, r) + { + console.log(ex.toString()); + if(r instanceof Ice.AsyncResult) + { + console.log("\nexception occurred in call to " + r.operation); + } + if(ex.stack) { - console.log(ex.toString()); - if(r instanceof Ice.AsyncResult) - { - console.log("\nexception occurred in call to " + r.operation); - } - if(ex.stack) - { - console.log(ex.stack); - } - process.exit(1); - }); - }; + console.log(ex.stack); + } + process.exit(1); + }); +}; - exports.run = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); +exports.run = run; diff --git a/js/test/Common/TestCases.json b/js/test/Common/TestCases.json new file mode 100644 index 00000000000..63aad046a21 --- /dev/null +++ b/js/test/Common/TestCases.json @@ -0,0 +1,231 @@ +{ + "Ice/acm": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/ami": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/binding": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/defaultValue": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/enums": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + }, + { + "name": "1.1 encoding" + } + ] + }, + "Ice/exceptions": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "compact (default) format" + }, + { + "name": "sliced format", + "args": ["--Ice.Default.SlicedFormat"] + }, + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + }, + { + "name": "compact (default) format and AMD server" + }, + { + "name": "sliced format and AMD server.", + "args": ["--Ice.Default.SlicedFormat"] + }, + { + "name": "1.0 encoding and AMD server", + "args": ["--Ice.Default.EncodingVersion=1.0"] + } + ] + }, + "Ice/exceptionsBidir": + { + "files": ["Test.js", "TestAMD.js", "ThrowerI.js", "AMDThrowerI.js", + "../exceptions/Client.js", "Client.js"] + }, + "Ice/facets": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/facetsBidir": + { + "files": ["Test.js", "TestI.js", "../facets/Client.js", "Client.js"] + }, + "Ice/hold": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/info": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/inheritance": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/inheritanceBidir": + { + "files": ["Test.js", "InitialI.js", "../inheritance/Client.js", "Client.js"] + }, + "Ice/operations": + { + "files": ["Test.js", "Twoways.js", "Oneways.js", "BatchOneways.js", "Client.js"], + "configurations": + [ + { + "name": "regular server" + }, + { + "name": "AMD server" + }, + { + "name": "TIE server", + "langs": ["java", "csharp"] + }, + { + "name": "AMD TIE server", + "langs": ["java", "csharp"] + } + ] + }, + "Ice/operationsBidir": + { + "files": ["Test.js", "TestAMD.js", "../operations/Twoways.js", "../operations/Oneways.js", + "../operations/BatchOneways.js", "MyDerivedClassI.js", "AMDMyDerivedClassI.js", + "../operations/Client.js", "Client.js"] + }, + "Ice/objects": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "compact (default) format" + }, + { + "name": "sliced format", + "args": ["--Ice.Default.SlicedFormat"] + }, + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + } + ] + }, + "Ice/optional": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "compact (default) format" + }, + { + "name": "sliced format", + "args": ["--Ice.Default.SlicedFormat"] + }, + { + "name": "AMD server" + } + ] + }, + "Ice/optionalBidir": + { + "files": ["Test.js", "TestAMD.js", "InitialI.js", "AMDInitialI.js", "../optional/Client.js", "Client.js"] + }, + "Ice/promise": + { + "files": ["Client.js"] + }, + "Ice/properties": + { + "files": ["Client.js"] + }, + "Ice/proxy": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "regular server" + }, + { + "name": "AMD server" + } + ] + }, + "Ice/retry": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/slicing/exceptions": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "sliced format" + }, + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + }, + { + "name": "sliced format and AMD server" + }, + { + "name": "1.0 encoding and AMD server", + "args": ["--Ice.Default.EncodingVersion=1.0"] + } + ] + }, + "Ice/slicing/objects": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "sliced format" + }, + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + }, + { + "name": "sliced format and AMD server" + }, + { + "name": "1.0 encoding and AMD server", + "args": ["--Ice.Default.EncodingVersion=1.0"] + } + ] + }, + "Ice/timeout": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/number": + { + "files": ["Client.js"] + } +} \ No newline at end of file diff --git a/js/test/Common/TestRunner.js b/js/test/Common/TestRunner.js new file mode 100644 index 00000000000..37d3684dc4a --- /dev/null +++ b/js/test/Common/TestRunner.js @@ -0,0 +1,154 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + + + /* global + __runEchoServerOptions__ : false, + __test__ : false, + Test : false, +*/ + +function runTest(name, language, defaultHost, protocol, configurations, out) +{ + var server, communicator; + var id = new Ice.InitializationData(); + id.properties = Ice.createProperties(); + id.properties.setProperty("Ice.Default.Host", defaultHost); + id.properties.setProperty("Ice.Default.Protocol", protocol); + + return Ice.Promise.try( + function() + { + if(typeof(__runServer__) !== "undefined" || typeof(__runEchoServer__) !== "undefined") + { + communicator = Ice.initialize(); + var str = protocol == "ws" ? "controller:ws -h " + defaultHost + " -p 15002" : + "controller:wss -h " + defaultHost + " -p 15003"; + + var controller = Test.Common.ControllerPrx.uncheckedCast(communicator.stringToProxy(str)); + + var options = []; + var srv = typeof(__runEchoServer__) !== "undefined" ? "Ice/echo" : name; + if(typeof(__runEchoServerOptions__) !== "undefined") + { + options = options.concat(__runEchoServerOptions__); + } + out.write("starting " + srv + " server... "); + return controller.runServer(language, srv, protocol, defaultHost, false, options).then( + function(proxy) + { + var ref = proxy.ice_getIdentity().name + ":" + protocol + " -h " + defaultHost + " -p " + + (protocol == "ws" ? "15002" : "15003"); + out.writeLine("ok"); + server = Test.Common.ServerPrx.uncheckedCast(communicator.stringToProxy(ref)); + + if(configurations === undefined) + { + return server.waitForServer().then( + function() + { + return __test__(out, id); + }); + } + else + { + var prev = new Ice.Promise().succeed(); + configurations.forEach( + function(configuration) + { + if(configuration.langs && configuration.langs.indexOf(language) == -1) + { + return prev; + } + prev = prev.then( + function() + { + out.writeLine("Running test with " + configuration.name + "."); + return server.waitForServer().then( + function() + { + var initData = id.clone(); + if(configuration.args !== undefined) + { + initData.properties = Ice.createProperties(configuration.args, id.properties); + } + return __test__(out, initData); + }); + }); + }); + return prev; + } + }, + function(ex) + { + out.writeLine("failed! (" + ex + ")"); + throw ex; + } + ).then( + function() + { + if(server) + { + return server.waitTestSuccess(); + } + } + ).exception( + function(ex) + { + if(server) + { + return server.terminate().then( + function() + { + throw ex; + }, + function() + { + throw ex; + }); + } + else + { + throw ex; + } + }); + } + else + { + return __test__(out, id); + } + } + ).finally( + function() + { + if(communicator) + { + return communicator.destroy(); + } + } + ).then( + function() + { + return true; + }, + function(ex, r) + { + out.writeLine(""); + if(r instanceof Ice.AsyncResult) + { + out.writeLine("exception occurred in call to " + r.operation); + } + out.writeLine(ex.toString()); + if(ex.stack) + { + out.writeLine(ex.stack); + } + return false; + }); +} diff --git a/js/test/Common/TestSuite.js b/js/test/Common/TestSuite.js index 7d1d38576c4..5add8b9cffd 100644 --- a/js/test/Common/TestSuite.js +++ b/js/test/Common/TestSuite.js @@ -11,286 +11,16 @@ __runEchoServerOptions__ : false, __test__ : false, Test : false, + URI : false, + current : false, + TestCases : false, + runTest: false */ -var communicator = Ice.initialize(); - - $(document).foundation(); $(document).ready( function(){ - - /* jshint browser:true, jquery:true */ - var TestCases = { - "Ice/acm": - { - files: ["Test.js", "Client.js"] - }, - "Ice/ami": - { - files: ["Test.js", "Client.js"] - }, - "Ice/binding": - { - files: ["Test.js", "Client.js"] - }, - "Ice/defaultValue": - { - files: ["Test.js", "Client.js"] - }, - "Ice/enums": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - }, - { - name: "1.1 encoding" - }, - ] - }, - "Ice/exceptions": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "compact (default) format" - }, - { - name: "sliced format", args: ["--Ice.Default.SlicedFormat"] - }, - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - }, - { - name: "compact (default) format and AMD server" - }, - { - name: "sliced format and AMD server.", args: ["--Ice.Default.SlicedFormat"] - }, - { - name: "1.0 encoding and AMD server", args: ["--Ice.Default.EncodingVersion=1.0"] - } - ] - }, - "Ice/exceptionsBidir": - { - files: ["Test.js", "TestAMD.js", "ThrowerI.js", "AMDThrowerI.js", - "../exceptions/Client.js", "Client.js"], - }, - "Ice/facets": - { - files: ["Test.js", "Client.js"] - }, - "Ice/facetsBidir": - { - files: ["Test.js", "TestI.js", "../facets/Client.js", "Client.js"] - }, - "Ice/hold": - { - files: ["Test.js", "Client.js"] - }, - "Ice/info": - { - files: ["Test.js", "Client.js"] - }, - "Ice/inheritance": - { - files: ["Test.js", "Client.js"] - }, - "Ice/inheritanceBidir": - { - files: ["Test.js", "InitialI.js", "../inheritance/Client.js", "Client.js"], - }, - "Ice/operations": - { - files: ["Test.js", "Twoways.js", "Oneways.js", "BatchOneways.js", "Client.js"], - configurations: - [ - { - name: "regular server" - }, - { - name: "AMD server" - }, - { - name: "TIE server", langs: ["java", "csharp"] - }, - { - name: "AMD TIE server", langs: ["java", "csharp"] - } - ] - }, - "Ice/operationsBidir": - { - files: ["Test.js", "TestAMD.js", "../operations/Twoways.js", "../operations/Oneways.js", - "../operations/BatchOneways.js", "MyDerivedClassI.js", "AMDMyDerivedClassI.js", - "../operations/Client.js", "Client.js"] - }, - "Ice/objects": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "compact (default) format" - }, - { - name: "sliced format", args: ["--Ice.Default.SlicedFormat"] - }, - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - } - ] - }, - "Ice/optional": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "compact (default) format" - }, - { - name: "sliced format", args: ["--Ice.Default.SlicedFormat"] - }, - { - name: "AMD server" - } - ] - }, - "Ice/optionalBidir": - { - files: ["Test.js", "TestAMD.js", "InitialI.js", "AMDInitialI.js", "../optional/Client.js", - "Client.js"] - }, - "Ice/promise": - { - files: ["Client.js"] - }, - "Ice/properties": - { - files: ["Client.js"] - }, - "Ice/proxy": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "regular server" - }, - { - name: "AMD server" - } - ] - }, - "Ice/retry": - { - files: ["Test.js", "Client.js"] - }, - "Ice/slicing/exceptions": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "sliced format" - }, - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - }, - { - name: "sliced format and AMD server" - }, - { - name: "1.0 encoding and AMD server", args: ["--Ice.Default.EncodingVersion=1.0"] - } - ] - }, - "Ice/slicing/objects": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "sliced format" - }, - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - }, - { - name: "sliced format and AMD server" - }, - { - name: "1.0 encoding and AMD server", args: ["--Ice.Default.EncodingVersion=1.0"] - } - ] - }, - "Ice/timeout": - { - files: ["Test.js", "Client.js"] - }, - "Ice/number": - { - files: ["Client.js"] - }, - }; - - var current, next; - for(var testName in TestCases) - { - if(current) - { - next = testName; - break; - } - - if(document.location.pathname.indexOf(testName + "/index.html") !== -1) - { - current = testName; - } - } - $("#console").height(120); - $("#protocol").val(document.location.protocol == "https:" ? "wss" : "ws"); - for(var name in TestCases) - { - $("#test").append(""); - } - $("#test").val("/test/" + current + "/index.html"); - - var nextLanguage; - $.ajax( - { - url: "/server-languages.json", - dataType: "json" - } - ).done( - function(data) - { - data.languages.forEach( - function(lang) - { - $("#language").append(""); - }); - - nextLanguage = function(language) - { - var i = 0; - for(; i < data.languages.length; ++i) - { - if(data.languages[i].value == language) - { - break; - } - } - return data.languages[i < data.languages.length - 1 ? i + 1 : 0].value; - }; - }); var out = { @@ -306,297 +36,178 @@ $(document).ready( } }; - var protocol; + var query = new URI(document.location.href).search(true); - $("#run").click(function(){ - if(!$(this).hasClass("disabled")) + $("#language").val(query.language !== undefined ? query.language : "cpp"); + $("#protocol").val(document.location.protocol == "http:" ? "ws" : "wss"); + $("#test").val("/test/" + current + "/index.html"); + $("#worker").prop("checked", query.worker == "true"); + $("#loop").prop("checked", query.loop == "true"); + + function nextTest() + { + document.location.assign(new URI() + .host(document.location.host) + .pathname($("#test").val()) + .search( + { + language: $("#language").val(), + worker: $("#worker").is(":checked"), + loop: $("#loop").is(":checked"), + next:"true" + }).toString()); + } + + function setRunning(running) + { + if(running) { $("#console").val(""); - $(this).addClass("disabled"); + $("#run").addClass("disabled"); $("#test").prop("disabled", "disabled"); $("#protocol").prop("disabled", "disabled"); $("#language").prop("disabled", "disabled"); - var defaultHost = document.location.hostname || "127.0.0.1"; - - protocol = $("#protocol").val(); - var id = new Ice.InitializationData(); - id.properties = Ice.createProperties(); - id.properties.setProperty("Ice.Default.Host", defaultHost); - id.properties.setProperty("Ice.Default.Protocol", protocol); - - var language = $("#language").val(); - - var str; - if(protocol == "ws") - { - str = "controller:ws -h " + defaultHost + " -p 15002"; - } - else - { - str = "controller:wss -h " + defaultHost + " -p 15003"; - } - var controller = Test.Common.ControllerPrx.uncheckedCast(communicator.stringToProxy(str)); + $("#worker").prop("disabled", "disabled"); + } + else + { + $("#test").prop("disabled", false); + $("#protocol").prop("disabled", false); + $("#language").prop("disabled", false); + $("#worker").prop("disabled", false); + $("#run").removeClass("disabled"); + } + } + + function updateLocation() + { + document.location.assign(new URI() + .host(document.location.host) + .pathname($("#test").val()) + .search( + { + language: $("#language").val(), + worker: $("#worker").is(":checked"), + loop: $("#loop").is(":checked") + }).toString()); + } - var p; - var server; - var options = []; - if(typeof(__runServer__) !== "undefined" || typeof(__runEchoServer__) !== "undefined") + $("#run").click(function(){ + if(!$(this).hasClass("disabled")) + { + setRunning(true); + if($("#worker").is(":checked")) { - var srv; - if(typeof(__runEchoServer__) !== "undefined") + var worker = new Worker("/test/Common/Worker.js"); + worker.onmessage = function(e) { - srv = "Ice/echo"; - if(typeof(__runEchoServerOptions__) !== "undefined") + if(e.data.type == "Write") { - options = options.concat(__runEchoServerOptions__); + out.write(e.data.message); } - - } - else - { - srv = current; - } - out.write("starting " + srv + " server... "); - p = controller.runServer(language, srv, protocol, defaultHost, false, options).then( - function(proxy) + else if(e.data.type == "WriteLine") { - var ref = proxy.ice_getIdentity().name + ":" + protocol + " -h " + defaultHost + " -p " + - (protocol == "ws" ? "15002" : "15003"); - out.writeLine("ok"); - server = Test.Common.ServerPrx.uncheckedCast(communicator.stringToProxy(ref)); - - var testCase = TestCases[current]; - if(testCase.configurations === undefined) + out.writeLine(e.data.message); + } + else if(e.data.type == "TestFinished") + { + setRunning(false); + if(e.data.success && $("#loop").is(":checked")) { - return server.waitForServer().then( - function() - { - return __test__(out, id); - }); + nextTest(); } - else + else if(query.loop == "true") { - var prev = new Ice.Promise().succeed(); - testCase.configurations.forEach( - function(configuration) - { - if(configuration.langs && configuration.langs.indexOf(language) == -1) - { - return prev; - } - prev = prev.then( - function() - { - out.writeLine("Running test with " + configuration.name + "."); - return server.waitForServer().then( - function() - { - var initData = id.clone(); - if(configuration.args !== undefined) - { - initData.properties = Ice.createProperties(configuration.args, id.properties); - } - return __test__(out, initData); - }); - }); - }); - return prev; + updateLocation(); } - }, - function(ex) - { - out.writeLine("failed! (" + ex + ")"); - throw ex; } - ).then( - function() + }; + worker.postMessage( { - if(server) + type: "RunTest", + test: { - return server.waitTestSuccess(); + name: current, + language: $("#language").val(), + defaultHost: document.location.hostname || "127.0.0.1", + protocol: $("#protocol").val(), + configurations: TestCases[current].configurations, + files: TestCases[current].files } + }); + } + else + { + runTest(current, + $("#language").val(), + document.location.hostname || "127.0.0.1", + $("#protocol").val(), + TestCases[current].configurations, out).finally( + function() + { + setRunning(false); } - ).exception( - function(ex) + ).then( + function() { - if(server) + if($("#loop").is(":checked")) { - return server.terminate().then( - function() - { - throw ex; - }, - function() - { - throw ex; - }); + nextTest(); } - else + else if(query.loop == "true") { - throw ex; + updateLocation(); } }); } - else - { - p = __test__(out, id); - } - - p.finally( - function() - { - $("#test").prop("disabled", false); - $("#protocol").prop("disabled", false); - $("#language").prop("disabled", false); - $("#run").removeClass("disabled"); - } - ).then( - function() - { - if($("#loop").is(":checked")) - { - var href = document.location.protocol + "//" + document.location.host; - if(!next) - { - next = "Ice/acm"; - if(protocol == "ws") - { - protocol = "wss"; - href = href.replace("http", "https"); - href = href.replace("8080", "9090"); - } - else - { - protocol = "ws"; - href = href.replace("https", "http"); - href = href.replace("9090", "8080"); - language = nextLanguage(language); - } - } - - href += document.location.pathname.replace(current, next); - href += "?loop=true&language=" + language; - document.location.assign(href); - } - } - ).exception( - function(ex, r) - { - out.writeLine(""); - if(r instanceof Ice.AsyncResult) - { - out.writeLine("exception occurred in call to " + r.operation); - } - out.writeLine(ex.toString()); - if(ex.stack) - { - out.writeLine(ex.stack); - } - }); } return false; }); - // - // Test case - // $("#test").on("change", - function(e) - { - document.location.assign($(this).val() + "?language=" + $("#language").val()); - return false; - }); + function(e) + { + updateLocation(); + return false; + }); $("#language").on("change", - function(e) - { - document.location.assign(document.location.pathname + "?language=" + $("#language").val()); - return false; - }); + function(e) + { + updateLocation(); + return false; + }); + + $("#worker").on("change", + function(e) + { + updateLocation(); + return false; + }); - // - // Protocol - // $("#protocol").on("change", - function(e) - { - var newProtocol = $(this).val(); - if(protocol !== newProtocol) - { - var href = document.location.protocol + "//" + document.location.host + - document.location.pathname; - if(newProtocol == "ws") - { - href = href.replace("https", "http"); - href = href.replace("9090", "8080"); - } - else - { - href = href.replace("http", "https"); - href = href.replace("8080", "9090"); - } - href += "?language=" + $("#language").val(); - document.location.assign(href); - } - }); - - - $(this).addClass("disabled"); - $("#test").prop("disabled", "disabled"); - $("#protocol").prop("disabled", "disabled"); - $("#language").prop("disabled", "disabled"); - - var scripts = TestCases[current].files.slice(0); - var head = document.getElementsByTagName("head")[0]; - function loadScript() + function(e) + { + if((document.location.protocol == "http:" && $(this).val() == "wss") || + (document.location.protocol == "https:" && $(this).val() == "ws")) + { + document.location.assign( + new URI() + .protocol($(this).val() == "ws" ? "http" : "https") + .hostname(document.location.hostname) + .port($(this).val() == "ws" ? 8080 : 9090) + .search( + { + language: $("#language").val(), + worker: $("#worker").is(":checked") + })); + return false; + } + }); + + if($("#loop").is(":checked")) { - if(scripts.length === 0) - { - $("#test").prop("disabled", false); - $("#protocol").prop("disabled", false); - $("#language").prop("disabled", false); - $("#run").removeClass("disabled"); - - // - // Check if we should start the test loop=true - // - var href = document.location.href; - var i = href.indexOf("?"); - - var languageIdx = i !== -1 ? href.substr(i).indexOf("language=") : -1; - if(languageIdx !== -1) - { - $("#language").val(href.substr(i + languageIdx + 9)); - } - else - { - $("#language").val("cpp"); - } - - var autoStart = i !== -1 && href.substr(i).indexOf("loop=true") !== -1; - if(autoStart) - { - $("#loop").prop("checked", true); - $("#run").click(); - } - return; - } - - var script = document.createElement("script"); - script.type = "text/javascript"; - script.src = "/test/" + current + "/" + scripts.shift(); - - var loaded = false; - script.onload = script.onreadystatechange = function() - { - if(!loaded && (!this.readyState || this.readyState == "complete" || this.readyState == "loaded")) - { - loaded = true; - loadScript(); - } - }; - - head.appendChild(script); + $("#loop").prop("checked", true); + $("#run").click(); } - loadScript(); }); diff --git a/js/test/Common/Worker.js b/js/test/Common/Worker.js new file mode 100644 index 00000000000..861bd608c41 --- /dev/null +++ b/js/test/Common/Worker.js @@ -0,0 +1,45 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +/* global + self : false, + runTest : false +*/ + +var Output = +{ + write: function(msg) + { + self.postMessage({type:"Write", message:msg}); + }, + writeLine: function(msg) + { + self.postMessage({type:"WriteLine", message:msg}); + } +}; + +self.onmessage = function(e) +{ + if(e.data.type == "RunTest") + { + var test = e.data.test; + self.importScripts("/lib/Ice.js"); + self.importScripts("/test/Common/Controller.js"); + self.importScripts("/test/Common/TestRunner.js"); + for(var i = 0; i < test.files.length; ++i) + { + self.importScripts("/test/" + test.name + "/" + test.files[i]); + } + runTest(test.name, test.language, test.defaultHost, test.protocol, test.configurations, Output).then( + function(r) + { + self.postMessage({type:"TestFinished", success:r}); + }); + } +}; diff --git a/js/test/Common/index.html b/js/test/Common/index.html index fb26feb2447..8d0e21f4e47 100644 --- a/js/test/Common/index.html +++ b/js/test/Common/index.html @@ -8,9 +8,13 @@ - - - + {{#scripts}} + + {{/scripts}} +
@@ -53,6 +60,9 @@
@@ -67,6 +77,14 @@ +
+
+ +
+
+ +
+
diff --git a/js/test/Glacier2/router/Client.js b/js/test/Glacier2/router/Client.js index 1f981582267..d3ce7c6220b 100644 --- a/js/test/Glacier2/router/Client.js +++ b/js/test/Glacier2/router/Client.js @@ -400,5 +400,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 65628559651..81379ad2507 100644 --- a/js/test/Ice/acm/Client.js +++ b/js/test/Ice/acm/Client.js @@ -534,5 +534,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 69b443a3832..3f8e50b3399 100644 --- a/js/test/Ice/ami/Client.js +++ b/js/test/Ice/ami/Client.js @@ -518,5 +518,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 ae19b4dd875..8d90abba6bb 100644 --- a/js/test/Ice/binding/Client.js +++ b/js/test/Ice/binding/Client.js @@ -29,6 +29,8 @@ return p; }; + var isBrowser = (typeof window !== 'undefined' || typeof WorkerGlobalScope !== 'undefined'); + var communicator; var com; var allTests = function(out, initData) @@ -191,8 +193,8 @@ }, function(ex) { - if(!(typeof(window) == 'undefined' && ex instanceof Ice.ConnectionRefusedException) && - !(typeof(window) != 'undefined' && ex instanceof Ice.ConnectFailedException)) + if(!(!isBrowser && ex instanceof Ice.ConnectionRefusedException) && + !(isBrowser && ex instanceof Ice.ConnectFailedException)) { throw ex; } @@ -806,8 +808,8 @@ }, function(ex) { - test((typeof(window) == 'undefined' && ex instanceof Ice.ConnectionRefusedException) || - (typeof(window) != 'undefined' && ex instanceof Ice.ConnectFailedException)); + test((!isBrowser && ex instanceof Ice.ConnectionRefusedException) || + (isBrowser && ex instanceof Ice.ConnectFailedException)); return prx.ice_getEndpoints(); } ).then( @@ -909,8 +911,8 @@ }, function(ex) { - test((typeof(window) == 'undefined' && ex instanceof Ice.ConnectionRefusedException) || - (typeof(window) != 'undefined' && ex instanceof Ice.ConnectFailedException)); + test((!isBrowser && ex instanceof Ice.ConnectionRefusedException) || + (isBrowser && ex instanceof Ice.ConnectFailedException)); }); }; return f1(); @@ -1077,8 +1079,8 @@ }, function(ex) { - test((typeof(window) == 'undefined' && ex instanceof Ice.ConnectionRefusedException) || - (typeof(window) != 'undefined' && ex instanceof Ice.ConnectFailedException)); + test((!isBrowser && ex instanceof Ice.ConnectionRefusedException) || + (isBrowser && ex instanceof Ice.ConnectFailedException)); return prx.ice_getEndpoints(); } ).then( @@ -1167,5 +1169,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 460f2f030eb..4ae6e74b83a 100644 --- a/js/test/Ice/defaultValue/Client.js +++ b/js/test/Ice/defaultValue/Client.js @@ -211,5 +211,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 7c20393af18..28f1d5fd45d 100644 --- a/js/test/Ice/enums/Client.js +++ b/js/test/Ice/enums/Client.js @@ -233,5 +233,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 5defef53b5d..eeded84d58b 100644 --- a/js/test/Ice/exceptions/Client.js +++ b/js/test/Ice/exceptions/Client.js @@ -503,5 +503,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/exceptionsBidir/AMDThrowerI.js b/js/test/Ice/exceptionsBidir/AMDThrowerI.js index 4e11da59999..6cdda5c4ab6 100644 --- a/js/test/Ice/exceptionsBidir/AMDThrowerI.js +++ b/js/test/Ice/exceptionsBidir/AMDThrowerI.js @@ -161,6 +161,6 @@ exports.AMDThrowerI = AMDThrowerI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/exceptionsBidir/Client.js b/js/test/Ice/exceptionsBidir/Client.js index 4e856a71a02..b19cd36fac0 100644 --- a/js/test/Ice/exceptionsBidir/Client.js +++ b/js/test/Ice/exceptionsBidir/Client.js @@ -101,5 +101,5 @@ exports.__runEchoServerOptions__ = ["Ice.Warn.Dispatch=0", "Ice.Warn.Connections=0"]; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/exceptionsBidir/ThrowerI.js b/js/test/Ice/exceptionsBidir/ThrowerI.js index e193d24580b..6dada1df355 100644 --- a/js/test/Ice/exceptionsBidir/ThrowerI.js +++ b/js/test/Ice/exceptionsBidir/ThrowerI.js @@ -162,5 +162,5 @@ exports.ThrowerI = ThrowerI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 4ef4e0b07fd..aa8e6cc876f 100644 --- a/js/test/Ice/facets/Client.js +++ b/js/test/Ice/facets/Client.js @@ -11,7 +11,6 @@ { var Ice = require("ice").Ice; var Test = require("Test").Test; - var Promise = Ice.Promise; var allTests = function(out, communicator) @@ -257,5 +256,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/facetsBidir/Client.js b/js/test/Ice/facetsBidir/Client.js index 6ed035de473..f0dc8cb737a 100644 --- a/js/test/Ice/facetsBidir/Client.js +++ b/js/test/Ice/facetsBidir/Client.js @@ -177,5 +177,5 @@ exports.__runEchoServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/facetsBidir/TestI.js b/js/test/Ice/facetsBidir/TestI.js index 1027487ed18..9fde2134fd5 100644 --- a/js/test/Ice/facetsBidir/TestI.js +++ b/js/test/Ice/facetsBidir/TestI.js @@ -70,6 +70,6 @@ exports.HI = HI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/hashmap/Client.js b/js/test/Ice/hashmap/Client.js index f72f2013bd0..2ef78be166d 100644 --- a/js/test/Ice/hashmap/Client.js +++ b/js/test/Ice/hashmap/Client.js @@ -249,5 +249,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 cb8a7b7f085..2691b96f9ec 100644 --- a/js/test/Ice/hold/Client.js +++ b/js/test/Ice/hold/Client.js @@ -354,5 +354,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/info/Client.js b/js/test/Ice/info/Client.js index 940b59048c9..aa797edf52f 100644 --- a/js/test/Ice/info/Client.js +++ b/js/test/Ice/info/Client.js @@ -186,5 +186,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 bec3a503df4..457ceff0707 100644 --- a/js/test/Ice/inheritance/Client.js +++ b/js/test/Ice/inheritance/Client.js @@ -297,5 +297,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/inheritanceBidir/Client.js b/js/test/Ice/inheritanceBidir/Client.js index 0271ba676a7..b778133cd4c 100644 --- a/js/test/Ice/inheritanceBidir/Client.js +++ b/js/test/Ice/inheritanceBidir/Client.js @@ -72,5 +72,5 @@ exports.__runEchoServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/inheritanceBidir/InitialI.js b/js/test/Ice/inheritanceBidir/InitialI.js index 93cd05ea0b4..d861ad95e5d 100644 --- a/js/test/Ice/inheritanceBidir/InitialI.js +++ b/js/test/Ice/inheritanceBidir/InitialI.js @@ -180,5 +180,5 @@ exports.InitialI = InitialI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 9a417545545..ea6588ea12b 100644 --- a/js/test/Ice/location/Client.js +++ b/js/test/Ice/location/Client.js @@ -1332,5 +1332,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 dcfe099937b..e927bece426 100644 --- a/js/test/Ice/number/Client.js +++ b/js/test/Ice/number/Client.js @@ -37,7 +37,7 @@ 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 // @@ -57,5 +57,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 83388124444..9357c8e8c03 100644 --- a/js/test/Ice/objects/Client.js +++ b/js/test/Ice/objects/Client.js @@ -511,5 +511,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 d1eeae89378..2632345e6da 100644 --- a/js/test/Ice/operations/BatchOneways.js +++ b/js/test/Ice/operations/BatchOneways.js @@ -164,5 +164,5 @@ exports.BatchOneways = { run: run }; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 ed467143831..f2b11dfbd5f 100644 --- a/js/test/Ice/operations/Client.js +++ b/js/test/Ice/operations/Client.js @@ -99,5 +99,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 c08689e1505..f0dd0830f27 100644 --- a/js/test/Ice/operations/Oneways.js +++ b/js/test/Ice/operations/Oneways.js @@ -108,6 +108,6 @@ exports.Oneways = { run: run }; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 f49c13ab79f..a5c78738fe9 100644 --- a/js/test/Ice/operations/Twoways.js +++ b/js/test/Ice/operations/Twoways.js @@ -1075,7 +1075,6 @@ test(retval.get(0xf1)[0] === 0xf2); test(retval.get(0xf1)[1] === 0xf3); - var si1 = [true, false]; var si2 = [false, true, true]; @@ -1493,7 +1492,7 @@ s.tesT = "Test.MyStruct1.s"; s.myClass = null; s.myStruct1 = "Test.MyStruct1.myStruct1"; - + var c = new Test.MyClass1(); c.tesT = "Test.MyClass1.testT"; c.myClass = null; @@ -1530,12 +1529,12 @@ test(arguments[8][0].size === 0); test(arguments[9][0].length === 0); test(arguments[10][0].size === 0); - + s = arguments[11][0]; test(s.tesT == "Test.MyStruct1.s"); test(s.myClass === null); test(s.myStruct1 == "Test.MyStruct1.myStruct1"); - + c = arguments[12][0]; test(c.tesT == "Test.MyClass1.testT"); test(c.myClass === null); @@ -1558,5 +1557,5 @@ exports.Twoways = { run: run }; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/operationsBidir/AMDMyDerivedClassI.js b/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js index a8864118671..578749cc2ee 100644 --- a/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js +++ b/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js @@ -30,37 +30,31 @@ { this._opByteSOnewayCount = 0; }, - ice_isA: function(id, current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_isA.call(this, id, current); }, - ice_ping: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); Ice.Object.prototype.ice_ping.call(this, current); }, - ice_ids: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_ids.call(this, current); }, - ice_id: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_id.call(this, current); }, - shutdown_async: function(cb, current) { current.adapter.getCommunicator().shutdown(); cb.ice_response(); }, - delay_async: function(cb, ms, current) { Ice.Timer.setTimeout( @@ -69,42 +63,35 @@ cb.ice_response(); }, ms); }, - opVoid_async: function(cb, current) { test(current.mode === Ice.OperationMode.Normal); cb.ice_response(); }, - opBool_async: function(cb, p1, p2, current) { cb.ice_response(p2, p1); }, - opBoolS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); cb.ice_response(p1.reverse(), p3); }, - opBoolSS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); cb.ice_response(p1.reverse(), p3); }, - opByte_async: function(cb, p1, p2, current) { cb.ice_response(p1, (p1 ^ p2) & 0xff); }, - opByteBoolD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opByteS_async: function(cb, p1, p2, current) { var i; @@ -125,39 +112,33 @@ } cb.ice_response(r, p3); }, - opByteSS_async: function(cb, p1, p2, current) { var r = p1.concat(p2); cb.ice_response(r, p1.reverse()); }, - opFloatDouble_async: function(cb, p1, p2, current) { cb.ice_response(p2, p1, p2); }, - opFloatDoubleS_async: function(cb, p1, p2, current) { var r = p2.concat(p1); var p4 = p2.reverse(); cb.ice_response(r, p1, p4); }, - opFloatDoubleSS_async: function(cb, p1, p2, current) { var r = p2.concat(p2); var p4 = p2.reverse(); cb.ice_response(r, p1, p4); }, - opLongFloatD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opMyClass_async: function(cb, p1, current) { var p2 = p1; @@ -166,67 +147,56 @@ var r = TestAMD.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)); cb.ice_response(r, p2, p3); }, - opMyEnum_async: function(cb, p1, current) { cb.ice_response(TestAMD.MyEnum.enum3, p1); }, - opShortIntD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opShortIntLong_async: function(cb, p1, p2, p3, current) { cb.ice_response(p3, p1, p2, p3); }, - opShortIntLongS_async: function(cb, p1, p2, p3, current) { cb.ice_response(p3, p1, p2.reverse(), p3.concat(p3)); }, - opShortIntLongSS_async: function(cb, p1, p2, p3, current) { cb.ice_response(p3, p1, p2.reverse(), p3.concat(p3)); }, - opString_async: function(cb, p1, p2, current) { cb.ice_response(p1 + " " + p2, p2 + " " + p1); }, - opStringMyEnumD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opMyEnumStringD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opMyStructMyEnumD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opByteBoolDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opShortIntDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); @@ -240,35 +210,30 @@ var r = p1.reverse(); cb.ice_response(r, p3); }, - opStringStringDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opStringMyEnumDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opMyEnumStringDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opMyStructMyEnumDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opByteByteSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -276,7 +241,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opBoolBoolSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -284,7 +248,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opShortShortSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -292,7 +255,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opIntIntSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -300,7 +262,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opLongLongSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -308,7 +269,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opStringFloatSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -316,7 +276,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opStringDoubleSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -324,7 +283,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opStringStringSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -332,7 +290,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opMyEnumMyEnumSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -340,30 +297,25 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opIntS_async: function(cb, s, current) { cb.ice_response(s.map(function(v, i, arr) { return -v; })); }, - opByteSOneway_async: function(cb, s, current) { this._opByteSOnewayCount += 1; cb.ice_response(); }, - opByteSOnewayCallCount_async: function(cb, current) { var count = this._opByteSOnewayCount; this._opByteSOnewayCount = 0; cb.ice_response(count); }, - opContext_async: function(cb, current) { cb.ice_response(current.ctx); }, - opDoubleMarshaling_async: function(cb, p1, p2, current) { var d = 1278312346.0 / 13.0; @@ -374,118 +326,97 @@ } cb.ice_response(); }, - opStringS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); var r = p1.reverse(); cb.ice_response(r, p3); }, - opStringSS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); var r = p2.reverse(); cb.ice_response(r, p3); }, - opStringSSS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); var r = p2.reverse(); cb.ice_response(r, p3); }, - opStringStringD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opStruct_async: function(cb, p1, p2, current) { p1.s.s = "a new string"; cb.ice_response(p2, p1); }, - opIdempotent_async: function(cb, current) { test(current.mode === Ice.OperationMode.Idempotent); cb.ice_response(); }, - opNonmutating_async: function(cb, current) { test(current.mode === Ice.OperationMode.Nonmutating); cb.ice_response(); }, - opDerived_async: function(cb, current) { cb.ice_response(); }, - opByte1_async: function(cb, value, current) { cb.ice_response(value); }, - opShort1_async: function(cb, value, current) { cb.ice_response(value); }, - opInt1_async: function(cb, value, current) { cb.ice_response(value); }, - opLong1_async: function(cb, value, current) { cb.ice_response(value); }, - opFloat1_async: function(cb, value, current) { cb.ice_response(value); }, - opDouble1_async: function(cb, value, current) { cb.ice_response(value); }, - opString1_async: function(cb, value, current) { cb.ice_response(value); }, - opStringS1_async: function(cb, value, current) { cb.ice_response(value); }, - opByteBoolD1_async: function(cb, value, current) { cb.ice_response(value); }, - opStringS2_async: function(cb, value, current) { cb.ice_response(value); }, - opByteBoolD2_async: function(cb, value, current) { cb.ice_response(value); }, - opMyClass1_async: function(cb, value, current) { return cb.ice_response(value); }, - opMyStruct1_async: function(cb, value, current) { return cb.ice_response(value); @@ -495,5 +426,5 @@ exports.AMDMyDerivedClassI = AMDMyDerivedClassI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/operationsBidir/Client.js b/js/test/Ice/operationsBidir/Client.js index b5f664b35ce..1425a82e1ac 100644 --- a/js/test/Ice/operationsBidir/Client.js +++ b/js/test/Ice/operationsBidir/Client.js @@ -90,5 +90,5 @@ exports.__runEchoServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/operationsBidir/MyDerivedClassI.js b/js/test/Ice/operationsBidir/MyDerivedClassI.js index 840c445a010..c128926d771 100644 --- a/js/test/Ice/operationsBidir/MyDerivedClassI.js +++ b/js/test/Ice/operationsBidir/MyDerivedClassI.js @@ -30,36 +30,30 @@ { this._opByteSOnewayCount = 0; }, - ice_isA: function(id, current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_isA.call(this, id, current); }, - ice_ping: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); Ice.Object.prototype.ice_ping.call(this, current); }, - ice_ids: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_ids.call(this, current); }, - ice_id: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_id.call(this, current); }, - shutdown: function(current) { current.adapter.getCommunicator().shutdown(); }, - delay: function(cb, ms, current) { Ice.Timer.setTimeout( @@ -68,41 +62,34 @@ cb.ice_response(); }, ms); }, - opVoid: function(current) { test(current.mode === Ice.OperationMode.Normal); }, - opBool: function(p1, p2, current) { return [p2, p1]; }, - opBoolS: function(p1, p2, current) { var p3 = p1.concat(p2); return [p1.reverse(), p3]; }, - opBoolSS: function(p1, p2, current) { var p3 = p1.concat(p2); return [p1.reverse(), p3]; }, - opByte: function(p1, p2, current) { return [p1, (p1 ^ p2) & 0xff]; }, - opByteBoolD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opByteS: function(p1, p2, current) { var i; @@ -123,39 +110,33 @@ } return [r, p3]; }, - opByteSS: function(p1, p2, current) { var r = p1.concat(p2); return [r, p1.reverse()]; }, - opFloatDouble: function(p1, p2, current) { return [p2, p1, p2]; }, - opFloatDoubleS: function(p1, p2, current) { var r = p2.concat(p1); var p4 = p2.reverse(); return [r, p1, p4]; }, - opFloatDoubleSS: function(p1, p2, current) { var r = p2.concat(p2); var p4 = p2.reverse(); return [r, p1, p4]; }, - opLongFloatD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opMyClass: function(p1, current) { var p2 = p1; @@ -164,109 +145,92 @@ var r = Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)); return [r, p2, p3]; }, - opMyEnum: function(p1, current) { return [Test.MyEnum.enum3, p1]; }, - opShortIntD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opShortIntLong: function(p1, p2, p3, current) { return [p3, p1, p2, p3]; }, - opShortIntLongS: function(p1, p2, p3, current) { return [p3, p1, p2.reverse(), p3.concat(p3)]; }, - opShortIntLongSS: function(p1, p2, p3, current) { return [p3, p1, p2.reverse(), p3.concat(p3)]; }, - opString: function(p1, p2, current) { return [p1 + " " + p2, p2 + " " + p1]; }, - opStringMyEnumD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opMyEnumStringD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opMyStructMyEnumD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opByteBoolDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opShortIntDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opLongFloatDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opStringStringDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opStringMyEnumDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opMyEnumStringDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opMyStructMyEnumDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opByteByteSD: function(p1, p2, current) { var r = p1.clone(); @@ -274,7 +238,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opBoolBoolSD: function(p1, p2, current) { var r = p1.clone(); @@ -282,7 +245,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opShortShortSD: function(p1, p2, current) { var r = p1.clone(); @@ -290,7 +252,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opIntIntSD: function(p1, p2, current) { var r = p1.clone(); @@ -298,7 +259,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opLongLongSD: function(p1, p2, current) { var r = p1.clone(); @@ -306,7 +266,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opStringFloatSD: function(p1, p2, current) { var r = p1.clone(); @@ -314,7 +273,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opStringDoubleSD: function(p1, p2, current) { var r = p1.clone(); @@ -322,7 +280,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opStringStringSD: function(p1, p2, current) { var r = p1.clone(); @@ -330,7 +287,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opMyEnumMyEnumSD: function(p1, p2, current) { var r = p1.clone(); @@ -338,29 +294,24 @@ var p3 = p2.clone(); return [r, p3]; }, - opIntS: function(s, current) { return s.map(function(v, i, arr) { return -v; }); }, - opByteSOneway: function(s, current) { this._opByteSOnewayCount += 1; }, - opByteSOnewayCallCount: function(current) { var count = this._opByteSOnewayCount; this._opByteSOnewayCount = 0; return count; }, - opContext: function(current) { return current.ctx; }, - opDoubleMarshaling: function(p1, p2, current) { var d = 1278312346.0 / 13.0; @@ -370,124 +321,102 @@ test(p2[i] === d); } }, - opStringS: function(p1, p2, current) { var p3 = p1.concat(p2); var r = p1.reverse(); return [r, p3]; }, - opStringSS: function(p1, p2, current) { var p3 = p1.concat(p2); var r = p2.reverse(); return [r, p3]; }, - opStringSSS: function(p1, p2, current) { var p3 = p1.concat(p2); var r = p2.reverse(); return [r, p3]; }, - opStringStringD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opStruct: function(p1, p2, current) { p1.s.s = "a new string"; return [p2, p1]; }, - opIdempotent: function(current) { test(current.mode === Ice.OperationMode.Idempotent); }, - opNonmutating: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); }, - opDerived: function(current) { }, - opByte1: function(value, current) { return value; }, - opShort1: function(value, current) { return value; }, - opInt1: function(value, current) { return value; }, - opLong1: function(value, current) { return value; }, - opFloat1: function(value, current) { return value; }, - opDouble1: function(value, current) { return value; }, - opString1: function(value, current) { return value; }, - opStringS1: function(value, current) { return value; }, - opByteBoolD1: function(value, current) { return value; }, - opStringS2: function(value, current) { return value; }, - opByteBoolD2: function(value, current) { return value; }, - opMyClass1: function(value, current) { return value; }, - opMyStruct1: function(value, current) { return value; } - }); exports.MyDerivedClassI = MyDerivedClassI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 2d23a42d4a4..723e6e9f404 100644 --- a/js/test/Ice/optional/Client.js +++ b/js/test/Ice/optional/Client.js @@ -1007,5 +1007,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/optionalBidir/AMDInitialI.js b/js/test/Ice/optionalBidir/AMDInitialI.js index 41302532b24..89e1ca49076 100644 --- a/js/test/Ice/optionalBidir/AMDInitialI.js +++ b/js/test/Ice/optionalBidir/AMDInitialI.js @@ -376,5 +376,5 @@ exports.AMDInitialI = AMDInitialI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/optionalBidir/Client.js b/js/test/Ice/optionalBidir/Client.js index 1d92c129a13..9a5f2ce4e76 100644 --- a/js/test/Ice/optionalBidir/Client.js +++ b/js/test/Ice/optionalBidir/Client.js @@ -101,5 +101,5 @@ exports.__runEchoServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/optionalBidir/InitialI.js b/js/test/Ice/optionalBidir/InitialI.js index 19d932a195c..a41644334b9 100644 --- a/js/test/Ice/optionalBidir/InitialI.js +++ b/js/test/Ice/optionalBidir/InitialI.js @@ -373,5 +373,5 @@ exports.InitialI = InitialI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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/promise/Client.js b/js/test/Ice/promise/Client.js index bcc42aa9550..7a6b4a2efb5 100644 --- a/js/test/Ice/promise/Client.js +++ b/js/test/Ice/promise/Client.js @@ -901,5 +901,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 9f2a3331875..770849c143e 100644 --- a/js/test/Ice/properties/Client.js +++ b/js/test/Ice/properties/Client.js @@ -65,34 +65,41 @@ } else { - // - // We are runing in a web browser load the properties file from the web server. - // - var p = new Promise(); - /*jshint jquery: true */ - $.ajax( + if(typeof window !== 'undefined') { - url: "escapes.cfg", // - // Use text data type to avoid problems interpreting the data. + //Skiped when running in a worker, we don't load JQuery in the workers + // + + // + // We are runing in a web browser load the properties file from the web server. // - dataType: "text" - }).done( - function(data) - { - properties.parse(data); - for(var key in props) + var p = new Promise(); + /*jshint jquery: true */ + $.ajax( { - test(props[key] == properties.getProperty(key)); - } - p.succeed(); - } - ).fail( - function() - { - p.fail(); - }); - return p; + url: "escapes.cfg", + // + // Use text data type to avoid problems interpreting the data. + // + dataType: "text" + }).done( + function(data) + { + properties.parse(data); + for(var key in props) + { + test(props[key] == properties.getProperty(key)); + } + p.succeed(); + } + ).fail( + function() + { + p.fail(); + }); + return p; + } } } ).then( @@ -104,5 +111,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 5796ba5c11d..073a838c01f 100644 --- a/js/test/Ice/proxy/Client.js +++ b/js/test/Ice/proxy/Client.js @@ -1057,8 +1057,8 @@ // // Ensure that non connectable endpoints are skipped. // - var p = (typeof window === 'undefined') ? - communicator.stringToProxy("test:ws -p 12010:default -p 12010") : + var p = (typeof window === 'undefined' && typeof WorkerGlobalScope === 'undefined') ? + communicator.stringToProxy("test:ws -p 12010:default -p 12010") : communicator.stringToProxy("test:tcp -p 12010:default -p 12010"); p = p.ice_endpointSelection(Ice.EndpointSelectionType.Ordered); @@ -1092,5 +1092,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 9fc5504d39b..f6c0adfcd19 100644 --- a/js/test/Ice/retry/Client.js +++ b/js/test/Ice/retry/Client.js @@ -79,8 +79,14 @@ }, function(ex) { - test((typeof(window) === undefined && ex instanceof Ice.ConnectionLostException) || - (typeof(window) !== undefined && ex instanceof Ice.SocketException)); + if(typeof(window) === 'undefined' && typeof(WorkerGlobalScope) === 'undefined') // Nodejs + { + test(ex instanceof Ice.ConnectionLostException); + } + else // Browser + { + test(ex instanceof Ice.SocketException); + } out.writeLine("ok"); out.write("calling regular operation with first proxy again... "); return retry1.op(false); @@ -181,5 +187,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 28478294a97..784c6d53a3b 100644 --- a/js/test/Ice/slicing/exceptions/Client.js +++ b/js/test/Ice/slicing/exceptions/Client.js @@ -282,5 +282,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 be1a068ca37..df5a684561e 100644 --- a/js/test/Ice/slicing/objects/Client.js +++ b/js/test/Ice/slicing/objects/Client.js @@ -871,5 +871,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + 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 47462aec495..5b5aad7b407 100644 --- a/js/test/Ice/timeout/Client.js +++ b/js/test/Ice/timeout/Client.js @@ -471,5 +471,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); -- cgit v1.2.3