summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-03-23 15:29:25 +0100
committerBenoit Foucher <benoit@zeroc.com>2017-03-23 15:29:25 +0100
commit1597a75419cd8049252cfbca6fce6ae95ef8b2c7 (patch)
tree2b2c858df1dbe68c1d576cae06c4713fd2ad5c40 /js
parentUse Ice\None with PHP namespace mapping (diff)
downloadice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.tar.bz2
ice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.tar.xz
ice-1597a75419cd8049252cfbca6fce6ae95ef8b2c7.zip
Fix for ICE-7125 - Added support for Ice.ClassGraphDepthMax
Diffstat (limited to 'js')
-rw-r--r--js/bin/HttpServer.js20
-rw-r--r--js/src/Ice/Buffer.js14
-rw-r--r--js/src/Ice/ConnectionI.js14
-rw-r--r--js/src/Ice/Exception.js15
-rw-r--r--js/src/Ice/IncomingAsync.js77
-rw-r--r--js/src/Ice/ObjectAdapterFactory.js2
-rw-r--r--js/src/Ice/PropertyNames.js3
-rw-r--r--js/src/Ice/Stream.js4
-rw-r--r--js/src/Ice/TraceUtil.js19
-rw-r--r--js/test/Common/ControllerI.js126
-rw-r--r--js/test/Common/ControllerWorker.js26
-rw-r--r--js/test/Common/TestRunner.js55
-rw-r--r--js/test/Common/TestSuites.json12
-rw-r--r--js/test/Common/controller.html8
-rwxr-xr-xjs/test/Common/run.js33
-rw-r--r--js/test/Ice/exceptions/AMDThrowerI.js1
-rw-r--r--js/test/Ice/exceptions/Client.js39
-rw-r--r--js/test/Ice/exceptions/Server.js56
-rw-r--r--js/test/Ice/exceptions/ServerAMD.js57
-rw-r--r--js/test/Ice/exceptions/Test.ice1
-rw-r--r--js/test/Ice/exceptions/ThrowerI.js2
-rw-r--r--js/test/Ice/facets/Server.js (renamed from js/test/Ice/facets/ClientBidir.js)92
-rw-r--r--js/test/Ice/facets/Test.ice1
-rw-r--r--js/test/Ice/inheritance/ClientBidir.js73
-rw-r--r--js/test/Ice/inheritance/Server.js49
-rw-r--r--js/test/Ice/inheritance/Test.ice1
-rw-r--r--js/test/Ice/objects/Client.js72
-rw-r--r--js/test/Ice/objects/InitialI.js319
-rw-r--r--js/test/Ice/objects/Server.js58
-rw-r--r--js/test/Ice/objects/Test.ice16
-rw-r--r--js/test/Ice/operations/AMDMyDerivedClassI.js10
-rw-r--r--js/test/Ice/operations/ClientBidir.js68
-rw-r--r--js/test/Ice/operations/MyDerivedClassI.js10
-rw-r--r--js/test/Ice/operations/Server.js49
-rw-r--r--js/test/Ice/operations/ServerAMD.js49
-rw-r--r--js/test/Ice/operations/Test.ice3
-rw-r--r--js/test/Ice/optional/AMDInitialI.js5
-rw-r--r--js/test/Ice/optional/Client.js9
-rw-r--r--js/test/Ice/optional/ClientBidir.js82
-rw-r--r--js/test/Ice/optional/ClientPrivate.ice16
-rw-r--r--js/test/Ice/optional/InitialI.js5
-rw-r--r--js/test/Ice/optional/Server.js48
-rw-r--r--js/test/Ice/optional/ServerAMD.js49
-rw-r--r--js/test/Ice/optional/Test.ice11
44 files changed, 1187 insertions, 492 deletions
diff --git a/js/bin/HttpServer.js b/js/bin/HttpServer.js
index 53c42327368..5390d306be3 100644
--- a/js/bin/HttpServer.js
+++ b/js/bin/HttpServer.js
@@ -26,13 +26,12 @@ function Init()
json: "application/json",
};
- var TestData =
- {
- languages: [{value: "cpp", name: "C++"}, {value: "java", name: "Java"}]
- };
+ var TestData = {};
+
+ var languages = [{value: "cpp", name: "C++"}, {value: "java", name: "Java"}]
if(process.platform == "win32")
{
- TestData.languages.push({value: "csharp", name: "C#"});
+ languages.push({value: "csharp", name: "C#"});
}
var libraries = ["/lib/Ice.js", "/lib/Ice.min.js",
@@ -98,9 +97,9 @@ function Init()
}
else
{
- var languages = TestData.languages.map(function(o) { return o.value; });
- var j = languages.indexOf(language);
- language = languages[j == languages.length - 1 ? 0 : j + 1];
+ var lgs = languages.map(function(o) { return o.value; });
+ var j = lgs.indexOf(language);
+ language = lgs[j == lgs.length - 1 ? 0 : j + 1];
worker = false;
protocol = "http";
}
@@ -159,6 +158,11 @@ function Init()
"/test/Common/TestSuite.js"
];
}
+ TestData.languages = languages.slice();
+ if(testSuite.files.indexOf("Server.js") >= 0)
+ {
+ TestData.languages.push({value: "js", name: "JavaScript"});
+ }
res.writeHead(200, {"Content-Type": "text/html"});
res.end(template.render(TestData));
console.log("HTTP/200 (Ok)" + req.method + " " + req.url.pathname);
diff --git a/js/src/Ice/Buffer.js b/js/src/Ice/Buffer.js
index d6f395629ba..499d8726cdc 100644
--- a/js/src/Ice/Buffer.js
+++ b/js/src/Ice/Buffer.js
@@ -371,12 +371,12 @@ class Buffer
s = decodeURIComponent(escape(s));
return s;
}
-
+
get position()
{
return this._position;
}
-
+
set position(value)
{
if(value >= 0 && value <= this._limit)
@@ -384,12 +384,12 @@ class Buffer
this._position = value;
}
}
-
+
get limit()
{
return this._limit;
}
-
+
set limit(value)
{
if(value <= this.capacity)
@@ -401,17 +401,17 @@ class Buffer
}
}
}
-
+
get capacity()
{
return this.b === null ? 0 : this.b.byteLength;
}
-
+
get remaining()
{
return this._limit - this._position;
}
-
+
//
// Create a native buffer from an array of bytes.
//
diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js
index 1bf5c7d0b28..d937186a6fb 100644
--- a/js/src/Ice/ConnectionI.js
+++ b/js/src/Ice/ConnectionI.js
@@ -1729,9 +1729,10 @@ class ConnectionI
}
return AsyncStatus.Sent;
}
+
message.doAdopt();
- this._writeStream.swap(stream);
+ this._writeStream.swap(message.stream);
this._sendStreams.push(message);
this.scheduleTimeout(SocketOperation.Write, this._endpoint.timeout());
@@ -1930,9 +1931,18 @@ class ConnectionI
{
this.invokeException(ex, invokeNum);
}
+ else if(ex instanceof Ice.ServantError)
+ {
+ // Ignore
+ }
else
{
- throw ex;
+ //
+ // An Error was raised outside of servant code (i.e., by Ice code).
+ // Attempt to log the error and clean up.
+ //
+ this._logger.error("unexpected exception:\n" + ex.toString());
+ this.invokeException(requestId, new Ice.UnknownException(ex), invokeNum, false);
}
}
}
diff --git a/js/src/Ice/Exception.js b/js/src/Ice/Exception.js
index 3ad61513fa7..14d9472df16 100644
--- a/js/src/Ice/Exception.js
+++ b/js/src/Ice/Exception.js
@@ -51,6 +51,17 @@ const toString = function(key, object, objectTable, ident)
return s;
};
+class ServantError extends Error
+{
+ constructor(cause)
+ {
+ super();
+ this.cause = cause;
+ }
+}
+
+Ice.ServantError = ServantError;
+
//
// Ice.Exception
//
@@ -99,7 +110,7 @@ class Exception extends Error
this._inToStringAlready = false;
return s;
}
-
+
static captureStackTrace(object)
{
const stack = new Error().stack;
@@ -112,7 +123,7 @@ class Exception extends Error
Object.defineProperty(object, "stack", {
get: function()
{
- return stack;
+ return stack;
}
});
}
diff --git a/js/src/Ice/IncomingAsync.js b/js/src/Ice/IncomingAsync.js
index 76e4a29666b..4ef1526eb44 100644
--- a/js/src/Ice/IncomingAsync.js
+++ b/js/src/Ice/IncomingAsync.js
@@ -150,22 +150,7 @@ class IncomingAsync
this._instance.initializationData().logger.warning(s.join(""));
}
- servantLocatorFinished()
- {
- Debug.assert(this._locator !== null && this._servant !== null);
- try
- {
- this._locator.finished(this._current, this._servant, this._cookie.value);
- return true;
- }
- catch(ex)
- {
- this.handleException(ex);
- }
- return false;
- }
-
- handleException(ex)
+ handleException(ex, amd)
{
Debug.assert(this._connection !== null);
@@ -366,6 +351,11 @@ class IncomingAsync
{
this._connection.sendNoResponse();
}
+
+ if(!amd)
+ {
+ throw new Ice.ServantError(ex);
+ }
}
this._connection = null;
@@ -431,7 +421,7 @@ class IncomingAsync
catch(ex)
{
this.skipReadParams(); // Required for batch requests.
- this.handleException(ex);
+ this.handleException(ex, false);
return;
}
}
@@ -457,7 +447,7 @@ class IncomingAsync
catch(ex)
{
this.skipReadParams(); // Required for batch requests.
- this.handleException(ex);
+ this.handleException(ex, false);
return;
}
}
@@ -468,16 +458,16 @@ class IncomingAsync
let promise = this._servant._iceDispatch(this, this._current);
if(promise !== null)
{
- promise.then(() => this.response(), (ex) => this.exception(ex));
+ promise.then(() => this.completed(null, true), (ex) => this.completed(ex, true));
return;
}
Debug.assert(!this._response || this._os !== null);
- this.response();
+ this.completed(null, false);
}
catch(ex)
{
- this.exception(ex);
+ this.completed(ex, false);
}
}
@@ -512,18 +502,31 @@ class IncomingAsync
this._current.encoding = this._is.skipEncapsulation();
}
- response()
+ completed(exc, amd)
{
try
{
- if(this._locator !== null && !this.servantLocatorFinished())
+ if(this._locator !== null && !this.servantLocatorFinished(amd))
{
- return;
+ Debug.assert(this._locator !== null && this._servant !== null);
+ try
+ {
+ this._locator.finished(this._current, this._servant, this._cookie.value);
+ }
+ catch(ex)
+ {
+ this.handleException(ex, amd);
+ return;
+ }
}
Debug.assert(this._connection !== null);
- if(this._response)
+ if(exc != null)
+ {
+ this.handleException(exc, amd);
+ }
+ else if(this._response)
{
this._connection.sendResponse(this._os);
}
@@ -534,26 +537,18 @@ class IncomingAsync
}
catch(ex)
{
- this._connection.invokeException(ex, 1);
- }
- this._connection = null;
- }
-
- exception(exc)
- {
- try
- {
- if(this._locator !== null && !this.servantLocatorFinished())
+ if(ex instanceof Ice.LocalException)
{
- return;
+ this._connection.invokeException(ex, 1);
+ }
+ else
+ {
+ throw ex;
}
- this.handleException(exc);
- }
- catch(ex)
- {
- this._connection.invokeException(ex, 1);
}
+ this._connection = null;
}
+
}
Ice.IncomingAsync = IncomingAsync;
diff --git a/js/src/Ice/ObjectAdapterFactory.js b/js/src/Ice/ObjectAdapterFactory.js
index 2115358984a..d68aa5ff46e 100644
--- a/js/src/Ice/ObjectAdapterFactory.js
+++ b/js/src/Ice/ObjectAdapterFactory.js
@@ -48,7 +48,7 @@ class ObjectAdapterFactory
this._instance = null;
this._communicator = null;
- this._shutdownPromise = _Promise.all(this._adapters.map(adapter => adapter.deactivate()));
+ _Promise.all(this._adapters.map(adapter => adapter.deactivate())).then(() => this._shutdownPromise.resolve());
return this._shutdownPromise;
}
diff --git a/js/src/Ice/PropertyNames.js b/js/src/Ice/PropertyNames.js
index 835a981434d..7271a5973c2 100644
--- a/js/src/Ice/PropertyNames.js
+++ b/js/src/Ice/PropertyNames.js
@@ -6,7 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue Feb 28 15:01:12 2017
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Mar 23 15:24:16 2017
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -80,6 +80,7 @@ PropertyNames.IceProps =
new Property("/^Ice\.BatchAutoFlush/", true, null),
new Property("/^Ice\.BatchAutoFlushSize/", false, null),
new Property("/^Ice\.ChangeUser/", false, null),
+ new Property("/^Ice\.ClassGraphDepthMax/", false, null),
new Property("/^Ice\.ClientAccessPolicyProtocol/", false, null),
new Property("/^Ice\.Compression\.Level/", false, null),
new Property("/^Ice\.CollectObjects/", false, null),
diff --git a/js/src/Ice/Stream.js b/js/src/Ice/Stream.js
index 85386ff8786..8ac72046c6e 100644
--- a/js/src/Ice/Stream.js
+++ b/js/src/Ice/Stream.js
@@ -1252,7 +1252,7 @@ class InputStream
{
if(this._encapsStack !== null)
{
- Debug.assert(this._encapsStack.next);
+ Debug.assert(this._encapsStack.next === null);
this._encapsStack.next = this._encapsCache;
this._encapsCache = this._encapsStack;
this._encapsCache.reset();
@@ -1840,7 +1840,7 @@ class InputStream
//
this._encapsStack.decoder.readValue.call(
this._encapsStack.decoder,
- obj =>
+ cb === null ? null : obj =>
{
if(obj !== null && !(obj instanceof T))
{
diff --git a/js/src/Ice/TraceUtil.js b/js/src/Ice/TraceUtil.js
index eee9a10d7b1..05452817e2f 100644
--- a/js/src/Ice/TraceUtil.js
+++ b/js/src/Ice/TraceUtil.js
@@ -25,18 +25,8 @@ const Protocol = Ice.Protocol;
const StringUtil = Ice.StringUtil;
const OperationMode = Ice.OperationMode;
const Identity = Ice.Identity;
-
const slicingIds = new Map();
-function traceSlicing(kind, typeId, slicingCat, logger)
-{
- if(!slicingIds.has(typeId))
- {
- logger.trace(slicingCat, `unknown ${kind} type \`${typeId}'`);
- slicingIds.set(typeId, 1);
- }
-}
-
function printIdentityFacetOperation(s, stream)
{
let toStringMode = Ice.ToStringMode.Unicode;
@@ -366,6 +356,15 @@ function getMessageTypeAsString(type)
class TraceUtil
{
+ static traceSlicing(kind, typeId, slicingCat, logger)
+ {
+ if(!slicingIds.has(typeId))
+ {
+ logger.trace(slicingCat, `unknown ${kind} type \`${typeId}'`);
+ slicingIds.set(typeId, 1);
+ }
+ }
+
static traceSend(stream, logger, traceLevels)
{
if(traceLevels.protocol >= 1)
diff --git a/js/test/Common/ControllerI.js b/js/test/Common/ControllerI.js
index f83b3fc7083..17433db22d6 100644
--- a/js/test/Common/ControllerI.js
+++ b/js/test/Common/ControllerI.js
@@ -33,17 +33,40 @@ function isWindows()
return navigator.userAgent.indexOf("Windows") != -1;
}
+class Logger extends Ice.Logger
+{
+ constructor(out)
+ {
+ super()
+ this._out = out
+ }
+
+ write(message, indent)
+ {
+ if(indent)
+ {
+ message = message.replace(/\n/g, "\n ");
+ }
+ this._out.writeLine(message);
+ }
+}
+
class ProcessI extends Test.Common.Process
{
- constructor(promise, output)
+ constructor(promise, output, ready)
{
super();
this._promise = promise;
this._output = output;
+ this._ready = ready;
}
waitReady(timeout, current)
{
+ if(this._ready)
+ {
+ return this._ready;
+ }
}
waitSuccess(timeout, current)
@@ -66,11 +89,11 @@ class ProcessI extends Test.Common.Process
class ProcessControllerI extends Test.Common.ProcessController
{
- constructor(output, logger, useWorker, scripts)
+ constructor(clientOutput, serverOutput, useWorker, scripts)
{
super();
- this._output = output;
- this._logger = logger;
+ this._clientOutput = clientOutput;
+ this._serverOutput = serverOutput;
this._useWorker = useWorker;
this._scripts = scripts;
}
@@ -78,9 +101,13 @@ class ProcessControllerI extends Test.Common.ProcessController
start(testSuite, exe, args, current)
{
let promise;
+ let ready = null;
+ if(exe === "Server" || exe === "ServerAMD")
+ {
+ ready = new Ice.Promise();
+ }
if(this._useWorker)
{
- let out = this._output;
let scripts = this._scripts;
promise = new Promise((resolve, reject) => {
let worker;
@@ -96,11 +123,23 @@ class ProcessControllerI extends Test.Common.ProcessController
worker.onmessage = function(e) {
if(e.data.type == "write")
{
- out.write(e.data.message);
+ this._clientOutput.write(e.data.message);
}
else if(e.data.type == "writeLine")
{
- out.writeLine(e.data.message);
+ this._clientOutput.writeLine(e.data.message);
+ }
+ if(e.data.type == "serverWrite")
+ {
+ this._serverOutput.write(e.data.message);
+ }
+ else if(e.data.type == "serverWriteLine")
+ {
+ this._serverOutput.writeLine(e.data.message);
+ }
+ else if(e.data.type == "ready" && (exe === "Server" || exe === "ServerAMD"))
+ {
+ ready.resolve();
}
else if(e.data.type == "finished")
{
@@ -121,19 +160,22 @@ class ProcessControllerI extends Test.Common.ProcessController
else
{
let initData = new Ice.InitializationData();
- initData.logger = this._logger;
initData.properties = Ice.createProperties(args);
process.argv = args
- if(exe === "ClientBidir")
+ if(exe === "Server" || exe === "ServerAMD")
{
- promise = _testBidir(this._output, initData);
+ initData.logger = new Logger(this._serverOutput);
+ let test = exe === "Server" ? _server : _serveramd;
+ promise = test(this._serverOutput, initData, ready);
}
else
{
- promise = _test(this._output, initData);
+ initData.logger = new Logger(this._clientOutput);
+ promise = _test(this._clientOutput, initData);
}
}
- return Test.Common.ProcessPrx.uncheckedCast(current.adapter.addWithUUID(new ProcessI(promise, this._output)));
+ let out = exe === "Server" || exe === "ServerAMD" ? this._serverOutput : this._clientOutput;
+ return Test.Common.ProcessPrx.uncheckedCast(current.adapter.addWithUUID(new ProcessI(promise, out, ready)));
}
getHost(protocol, ipv6, current)
@@ -142,25 +184,31 @@ class ProcessControllerI extends Test.Common.ProcessController
}
};
-function runController(output, scripts)
+function runController(clientOutput, serverOutput, scripts)
{
- let out =
+ function wrapOutput(output)
{
- write: function(msg)
- {
- let text = output.val();
- output.val((text === "") ? msg : (text + msg));
- },
- writeLine: function(msg)
- {
- out.write(msg + "\n");
- output.scrollTop(output.get(0).scrollHeight);
- },
- get: function()
- {
- return output.val()
- }
- };
+ return {
+ write: function(msg)
+ {
+ let text = output.val();
+ output.val((text === "") ? msg : (text + msg));
+ },
+ writeLine: function(msg)
+ {
+ msg = msg + "\n";
+ let text = output.val();
+ output.val((text === "") ? msg : (text + msg));
+ output.scrollTop(output.get(0).scrollHeight);
+ },
+ get: function()
+ {
+ return output.val()
+ }
+ };
+ }
+ let out = wrapOutput(clientOutput);
+ let serverOut = wrapOutput(serverOutput);
window.onerror = function(msg, url, line, column, err)
{
@@ -173,24 +221,6 @@ function runController(output, scripts)
return false;
};
- class Logger extends Ice.Logger
- {
- constructor(out)
- {
- super()
- this._out = out
- }
-
- write(message, indent)
- {
- if(indent)
- {
- message = message.replace(/\n/g, "\n ");
- }
- out.writeLine(message);
- }
- }
-
let uri = new URI(document.location.href)
let initData = new Ice.InitializationData();
let protocol = uri.protocol() === "http" ? "ws" : "wss";
@@ -226,7 +256,7 @@ function runController(output, scripts)
let registry = Test.Common.ProcessControllerRegistryPrx.uncheckedCast(comm.stringToProxy(str));
comm.createObjectAdapter("").then(adapter => {
let ident = new Ice.Identity("ProcessController", "Browser");
- let processController = adapter.add(new ProcessControllerI(out, initData.logger, worker, scripts), ident);
+ let processController = adapter.add(new ProcessControllerI(out, serverOut, worker, scripts), ident);
adapter.activate();
registerProcessController(adapter, registry, processController);
}).catch(ex => {
diff --git a/js/test/Common/ControllerWorker.js b/js/test/Common/ControllerWorker.js
index e01c557fe83..a9fa6071cf3 100644
--- a/js/test/Common/ControllerWorker.js
+++ b/js/test/Common/ControllerWorker.js
@@ -13,7 +13,7 @@
*/
var process = { argv : [] };
-let out =
+let clientOut =
{
write: function(msg)
{
@@ -25,6 +25,18 @@ let out =
}
};
+let serverOut =
+{
+ write: function(msg)
+ {
+ self.postMessage({type:"serverWrite", message:msg});
+ },
+ writeLine: function(msg)
+ {
+ self.postMessage({type:"serverWriteLine", message:msg});
+ }
+};
+
self.onmessage = function(e)
{
try
@@ -54,16 +66,20 @@ self.onmessage = function(e)
let promise
let initData = new Ice.InitializationData();
- initData.logger = new Logger(out);
initData.properties = Ice.createProperties(e.data.args);
process.argv = e.data.args;
- if(e.data.exe === "ClientBidir")
+ if(e.data.exe === "Server" || e.data.exe === "ServerAMD")
{
- promise = _testBidir(out, initData);
+ initData.logger = new Logger(serverOut);
+ let ready = new Ice.Promise();
+ let test = e.data.exe === "Server" ? _server : _serveramd;
+ promise = test(serverOut, initData, ready);
+ ready.then(() => self.postMessage({type:"ready"}));
}
else
{
- promise = _test(out, initData);
+ initData.logger = new Logger(clientOut);
+ promise = _test(clientOut, initData);
}
promise.then(function() {
self.postMessage({ type: "finished" });
diff --git a/js/test/Common/TestRunner.js b/js/test/Common/TestRunner.js
index 9725c0e9352..8fa5f6d1978 100644
--- a/js/test/Common/TestRunner.js
+++ b/js/test/Common/TestRunner.js
@@ -10,7 +10,7 @@
/* global
_test : false,
- _testBidir : false,
+ _runServer : false,
Test : false,
*/
@@ -108,7 +108,6 @@ function runTest(testsuite, language, host, protocol, testcases, out)
var communicator;
var id = new Ice.InitializationData();
var port = protocol == "ws" ? 15002 : 15003;
- var serverTestCase;
id.logger = Logger;
id.properties = Ice.createProperties();
id.properties.setProperty("Ice.Default.Host", host);
@@ -119,7 +118,7 @@ function runTest(testsuite, language, host, protocol, testcases, out)
return Ice.Promise.try(
function()
{
- if(typeof(_runServer) === "undefined" && typeof(_testBidir) === "undefined")
+ if(typeof(_runServer) === "undefined")
{
return _test(out, id);
}
@@ -140,17 +139,18 @@ function runTest(testsuite, language, host, protocol, testcases, out)
}
var runTestCase;
- if(typeof(_testBidir) !== "undefined" && client == _testBidir)
+ out.writeLine("[ running " + testcase.name + " test]");
+ if(language === "js")
{
- out.writeLine("[ running bidir " + testcase.name + " test]");
- runTestCase = function() { return controller.runTestCase("cpp", "Ice/echo", "server", language); };
+ runTestCase = function() { return controller.runTestCase("cpp", "Ice/echo", "server", ""); };
}
else
{
- out.writeLine("[ running " + testcase.name + " test]");
runTestCase = function() { return controller.runTestCase("js", testsuite, testcase.name, language) };
}
out.write("starting server side... ");
+ var serverTestCase;
+ var server;
return runTestCase().then(
function(proxy)
{
@@ -164,17 +164,40 @@ function runTest(testsuite, language, host, protocol, testcases, out)
function()
{
out.writeLine("ok")
+ process.argv = testcase.args;
+ if(language === "js")
+ {
+ var initData = id.clone();
+ if(testcase.args !== undefined)
+ {
+ initData.properties = Ice.createProperties(testcase.args, id.properties);
+ }
+ ready = new Ice.Promise();
+ server = _server(out, initData.clone(), ready)
+ return ready;
+ }
+ }
+ ).then(
+ function()
+ {
var initData = id.clone();
if(testcase.args !== undefined)
{
initData.properties = Ice.createProperties(testcase.args, id.properties);
- process.argv = testcase.args;
}
return client(out, initData);
}
).then(
function()
{
+ if(server)
+ {
+ return server; // Wait for server to terminate
+ }
+ }
+ ).then(
+ function()
+ {
return serverTestCase.stopServerSide(true);
}
).catch(
@@ -194,19 +217,9 @@ function runTest(testsuite, language, host, protocol, testcases, out)
}
var p = Ice.Promise.resolve();
- if(typeof(_runServer) !== "undefined")
- {
- testcases.forEach(function(testcase) {
- p = p.then(function() { return run(testcase, _test); })
- });
- }
- if(typeof(_testBidir) !== "undefined" && language === "cpp")
- {
- testcases.forEach(function(testcase) {
- options = typeof(_runEchoServerOptions) !== "undefined" ? _runEchoServerOptions : []
- p = p.then(function() { return run(testcase, _testBidir); })
- });
- }
+ testcases.forEach(function(testcase) {
+ p = p.then(function() { return run(testcase, _test); })
+ });
return p;
}
).finally(
diff --git a/js/test/Common/TestSuites.json b/js/test/Common/TestSuites.json
index feefddd79f9..c69de6be963 100644
--- a/js/test/Common/TestSuites.json
+++ b/js/test/Common/TestSuites.json
@@ -31,7 +31,7 @@
},
"Ice/exceptions":
{
- "files": ["Test.js", "Client.js", "ThrowerI.js", "AMDThrowerI.js", "ClientBidir.js"],
+ "files": ["Test.js", "Client.js", "ThrowerI.js", "AMDThrowerI.js", "Server.js", "ServerAMD.js"],
"testcases":
[
{
@@ -49,7 +49,7 @@
},
"Ice/facets":
{
- "files": ["Test.js", "Client.js", "TestI.js", "ClientBidir.js"]
+ "files": ["Test.js", "Client.js", "TestI.js", "Server.js"]
},
"Ice/hold":
{
@@ -61,16 +61,16 @@
},
"Ice/inheritance":
{
- "files": ["Test.js", "Client.js", "InitialI.js", "ClientBidir.js"]
+ "files": ["Test.js", "Client.js", "InitialI.js", "Server.js"]
},
"Ice/operations":
{
"files": ["Test.js", "Twoways.js", "Oneways.js", "BatchOneways.js", "Client.js",
- "MyDerivedClassI.js", "AMDMyDerivedClassI.js", "ClientBidir.js"]
+ "MyDerivedClassI.js", "AMDMyDerivedClassI.js", "Server.js", "ServerAMD.js"]
},
"Ice/objects":
{
- "files": ["Test.js", "Client.js"],
+ "files": ["Test.js", "Client.js", "InitialI.js", "Server.js"],
"testcases":
[
{
@@ -88,7 +88,7 @@
},
"Ice/optional":
{
- "files": ["Test.js", "Client.js", "ClientPrivate.js", "InitialI.js", "AMDInitialI.js", "ClientBidir.js"],
+ "files": ["Test.js", "Client.js", "ClientPrivate.js", "InitialI.js", "AMDInitialI.js", "Server.js", "ServerAMD.js"],
"testcases":
[
{
diff --git a/js/test/Common/controller.html b/js/test/Common/controller.html
index 24c547c5d97..33f53873f28 100644
--- a/js/test/Common/controller.html
+++ b/js/test/Common/controller.html
@@ -13,8 +13,9 @@
<script>
$(document).foundation();
$(document).ready(function() {
- $("#console").height(300);
- runController($("#console"), "{{{scripts}}}".split(","));
+ $("#clientConsole").height(300);
+ $("#serverConsole").height(100);
+ runController($("#clientConsole"), $("#serverConsole"), "{{{scripts}}}".split(","));
});
</script>
</head>
@@ -31,7 +32,8 @@
<section role="main" id="body">
<div class="row">
<div class="large-12 medium-12 columns">
- <textarea id="console" class="disabled" height="300" readonly></textarea>
+ <textarea id="clientConsole" class="disabled" height="300" readonly></textarea>
+ <textarea id="serverConsole" class="disabled" height="100" readonly></textarea>
</div>
</div>
</section>
diff --git a/js/test/Common/run.js b/js/test/Common/run.js
index f4fa106f176..105085ef5f2 100755
--- a/js/test/Common/run.js
+++ b/js/test/Common/run.js
@@ -25,19 +25,28 @@ var writeLine = function(msg)
this.write(msg + "\n");
};
+var exception = function(ex)
+{
+ console.log(ex.toString());
+ if(ex.stack)
+ {
+ console.log(ex.stack);
+ }
+ process.exit(1);
+};
+
var id = new Ice.InitializationData();
id.properties = Ice.createProperties(process.argv);
exe = process.argv[2]
var test = module.require(exe)
-test = exe === "ClientBidir" ? test._testBidir : test._test;
-
-test({write: write, writeLine: writeLine}, id).catch(
- ex =>
- {
- console.log(ex.toString());
- if(ex.stack)
- {
- console.log(ex.stack);
- }
- process.exit(1);
- });
+if(exe === "Server" || exe === "ServerAMD")
+{
+ var ready = new Ice.Promise();
+ test = exe === "Server" ? test._server : test._serveramd;
+ test({write: write, writeLine: writeLine}, id, ready).catch(exception)
+ ready.then(() => console.log("server ready"));
+}
+else
+{
+ test._test({write: write, writeLine: writeLine}, id).catch(exception)
+} \ No newline at end of file
diff --git a/js/test/Ice/exceptions/AMDThrowerI.js b/js/test/Ice/exceptions/AMDThrowerI.js
index a19e0904d07..b7adcbe5000 100644
--- a/js/test/Ice/exceptions/AMDThrowerI.js
+++ b/js/test/Ice/exceptions/AMDThrowerI.js
@@ -11,7 +11,6 @@
{
var Ice = require("ice").Ice;
var Test = require("Test").Test;
- var Class = Ice.Class;
var test = function(b)
{
diff --git a/js/test/Ice/exceptions/Client.js b/js/test/Ice/exceptions/Client.js
index a4841d61a0d..c613df0fa74 100644
--- a/js/test/Ice/exceptions/Client.js
+++ b/js/test/Ice/exceptions/Client.js
@@ -12,13 +12,13 @@
var Ice = require("ice").Ice;
var Test = require("Test").Test;
- var allTests = function(out, communicator, Test, bidir)
+ var allTests = function(out, communicator, Test)
{
class EmptyI extends Test.Empty
{
}
- class ServantLocatorI
+ class ServantLocatorI
{
locate(curr, cookie)
{
@@ -355,25 +355,22 @@
).then(
function()
{
- if(!bidir)
- {
- out.write("testing memory limit marshal exception...");
- return thrower.throwMemoryLimitException(null).then(
- failCB,
- function(ex)
- {
- test(ex instanceof Ice.MemoryLimitException);
- return thrower.throwMemoryLimitException(Ice.Buffer.createNative(20 * 1024));
- }
- ).then(
- failCB,
- function(ex)
- {
- test(ex instanceof Ice.ConnectionLostException);
- out.writeLine("ok");
- }
- );
- }
+ out.write("testing memory limit marshal exception...");
+ return thrower.throwMemoryLimitException(null).then(
+ failCB,
+ function(ex)
+ {
+ test(ex instanceof Ice.MemoryLimitException);
+ return thrower.throwMemoryLimitException(Ice.Buffer.createNative(20 * 1024));
+ }
+ ).then(
+ failCB,
+ function(ex)
+ {
+ test(ex.toString().indexOf("ConnectionLostException") > 0);
+ out.writeLine("ok");
+ }
+ );
}
).then(
function()
diff --git a/js/test/Ice/exceptions/Server.js b/js/test/Ice/exceptions/Server.js
new file mode 100644
index 00000000000..ffb45677831
--- /dev/null
+++ b/js/test/Ice/exceptions/Server.js
@@ -0,0 +1,56 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 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.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+ var ThrowerI = require("ThrowerI").ThrowerI;
+
+ var run = function(out, id, ready)
+ {
+ id.properties.setProperty("Ice.MessageSizeMax", "10");
+ id.properties.setProperty("Ice.Warn.Dispatch", "0");
+ id.properties.setProperty("Ice.Warn.Connections", "0");
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
+ return Ice.Promise.try(() =>
+ {
+ return communicator.createObjectAdapter("");
+ }
+ ).then(adpt =>
+ {
+ adapter = adpt;
+ adapter.add(new ThrowerI(), Ice.stringToIdentity("thrower"));
+ return echo.setConnection();
+ }
+ ).then(() =>
+ {
+ var 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))
+ });
+ connection.setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
+ }
+ ).then(() =>
+ {
+ return echo.shutdown();
+ }
+ ).finally(() => communicator.destroy());
+ };
+ 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));
diff --git a/js/test/Ice/exceptions/ServerAMD.js b/js/test/Ice/exceptions/ServerAMD.js
new file mode 100644
index 00000000000..f6383f2ee3d
--- /dev/null
+++ b/js/test/Ice/exceptions/ServerAMD.js
@@ -0,0 +1,57 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 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.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+ var AMDThrowerI = require("AMDThrowerI").AMDThrowerI;
+
+ var run = function(out, id, ready)
+ {
+ id.properties.setProperty("Ice.MessageSizeMax", "10");
+ id.properties.setProperty("Ice.Warn.Dispatch", "0");
+ id.properties.setProperty("Ice.Warn.Connections", "0");
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
+ return Ice.Promise.try(() =>
+ {
+ return communicator.createObjectAdapter("");
+ }
+ ).then(adpt =>
+ {
+ adapter = adpt;
+ adapter.add(new AMDThrowerI(), Ice.stringToIdentity("thrower"));
+ return echo.setConnection();
+ }
+ ).then(() =>
+ {
+ var 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))
+ });
+ connection.setAdapter(adapter);
+ echo.ice_getCachedConnection().setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
+ }
+ ).then(() =>
+ {
+ return echo.shutdown();
+ }
+ ).finally(() => communicator.destroy());
+ };
+ 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));
diff --git a/js/test/Ice/exceptions/Test.ice b/js/test/Ice/exceptions/Test.ice
index be0c5f0253e..1b3c3a49425 100644
--- a/js/test/Ice/exceptions/Test.ice
+++ b/js/test/Ice/exceptions/Test.ice
@@ -75,6 +75,7 @@ interface WrongOperation
interface Echo
{
+ void setConnection();
void startBatch();
void flushBatch();
void shutdown();
diff --git a/js/test/Ice/exceptions/ThrowerI.js b/js/test/Ice/exceptions/ThrowerI.js
index 7686ecb8a92..2725cf51c87 100644
--- a/js/test/Ice/exceptions/ThrowerI.js
+++ b/js/test/Ice/exceptions/ThrowerI.js
@@ -12,8 +12,6 @@
var Ice = require("ice").Ice;
var Test = require("Test").Test;
- var Class = Ice.Class;
-
var test = function(b)
{
if(!b)
diff --git a/js/test/Ice/facets/ClientBidir.js b/js/test/Ice/facets/Server.js
index c301dd5e39f..1c34aeac407 100644
--- a/js/test/Ice/facets/ClientBidir.js
+++ b/js/test/Ice/facets/Server.js
@@ -11,7 +11,6 @@
{
var Ice = require("ice").Ice;
var Test = require("Test").Test;
- var Client = require("Client");
var TestI = require("TestI");
var DI = TestI.DI;
@@ -19,26 +18,29 @@
var HI = TestI.HI;
var EmptyI = TestI.EmptyI;
- var allTests = function(out, communicator)
+ var test = function(b)
{
- var p = new Ice.Promise();
- var test = function(b)
+ if(!b)
{
- if(!b)
+ try
{
- try
- {
- throw new Error("test failed");
- }
- catch(err)
- {
- p.reject(err);
- throw err;
- }
+ throw new Error("test failed");
}
- };
+ catch(err)
+ {
+ p.reject(err);
+ throw err;
+ }
+ }
+ };
+
+ var run = function(out, id, ready)
+ {
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
- Ice.Promise.try(
+ return Ice.Promise.try(
function()
{
out.write("testing facet registration exceptions... ");
@@ -102,14 +104,13 @@
return adapter.deactivate();
}
- ).then(
- function(r)
+ ).then(() =>
{
return communicator.createObjectAdapter("");
}
- ).then(
- function(adapter)
+ ).then(adpt =>
{
+ adapter = adpt;
var di = new DI();
adapter.add(di, Ice.stringToIdentity("d"));
adapter.addFacet(di, Ice.stringToIdentity("d"), "facetABCD");
@@ -117,53 +118,22 @@
adapter.addFacet(fi, Ice.stringToIdentity("d"), "facetEF");
var hi = new HI();
adapter.addFacet(hi, Ice.stringToIdentity("d"), "facetGH");
-
- var prx = Ice.ObjectPrx.uncheckedCast(communicator.stringToProxy("d:default -p 12010"));
- return prx.ice_getConnection().then(
- function(conn)
- {
- conn.setAdapter(adapter);
- return Client._clientAllTests(out, communicator);
- });
+ return echo.setConnection();
}
- ).then(p.resolve, p.reject);
-
- return p;
- };
-
- var run = function(out, id)
- {
- var communicator = Ice.initialize(id);
- return Ice.Promise.try(
- function()
- {
- out.writeLine("testing bidir callbacks with synchronous dispatch...");
- return allTests(out, communicator);
- }
- ).then(
- function()
+ ).then(() =>
{
- return communicator.destroy();
+ echo.ice_getCachedConnection().setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
}
- ).then(
- function()
- {
- communicator = Ice.initialize(id);
- return Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010"));
- }
- ).then(
- function(prx)
- {
- return prx.shutdown();
- }
- ).finally(
- function()
+ ).then(() =>
{
- return communicator.destroy();
+ return echo.shutdown();
}
- );
+ ).finally(() => communicator.destroy());
};
- exports._testBidir = run;
+ exports._server = run;
}
(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined,
typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice._require,
diff --git a/js/test/Ice/facets/Test.ice b/js/test/Ice/facets/Test.ice
index 3ac9c3429f4..319b12bced0 100644
--- a/js/test/Ice/facets/Test.ice
+++ b/js/test/Ice/facets/Test.ice
@@ -59,6 +59,7 @@ interface H extends G
interface Echo
{
+ void setConnection();
void startBatch();
void flushBatch();
void shutdown();
diff --git a/js/test/Ice/inheritance/ClientBidir.js b/js/test/Ice/inheritance/ClientBidir.js
deleted file mode 100644
index 0c908cfd4f0..00000000000
--- a/js/test/Ice/inheritance/ClientBidir.js
+++ /dev/null
@@ -1,73 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 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.
-//
-// **********************************************************************
-
-(function(module, require, exports)
-{
- var Ice = require("ice").Ice;
- var Test = require("Test").Test;
- var InitialI = require("InitialI").InitialI;
- var Client = require("Client");
-
- var allTests = function(out, communicator)
- {
- return Ice.Promise.try(
- function()
- {
- return communicator.createObjectAdapter("").then(
- function(adapter)
- {
- var base = communicator.stringToProxy("initial:default -p 12010");
- adapter.add(new InitialI(adapter, base), Ice.stringToIdentity("initial"));
- return base.ice_getConnection().then(
- function(conn)
- {
- conn.setAdapter(adapter);
- return Client._clientAllTests(out, communicator);
- });
- });
- });
- };
-
- var run = function(out, id)
- {
- var communicator = Ice.initialize(id);
- return Ice.Promise.try(
- function()
- {
- out.writeLine("testing bidir callbacks with synchronous dispatch...");
- return allTests(out, communicator);
- }
- ).then(
- function()
- {
- return communicator.destroy();
- }
- ).then(
- function()
- {
- communicator = Ice.initialize(id);
- return Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010"));
- }
- ).then(
- function(prx)
- {
- return prx.shutdown();
- }
- ).finally(
- function()
- {
- return communicator.destroy();
- }
- );
- };
- exports._testBidir = 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/inheritance/Server.js b/js/test/Ice/inheritance/Server.js
new file mode 100644
index 00000000000..3b104cf02c0
--- /dev/null
+++ b/js/test/Ice/inheritance/Server.js
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 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.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+ var InitialI = require("InitialI").InitialI;
+
+ var run = function(out, id, ready)
+ {
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
+ return Ice.Promise.try(() =>
+ {
+ return communicator.createObjectAdapter("");
+ }
+ ).then(adpt =>
+ {
+ adapter = adpt;
+ var base = communicator.stringToProxy("initial:default -p 12010");
+ adapter.add(new InitialI(adapter, base), Ice.stringToIdentity("initial"));
+ return echo.setConnection();
+ }
+ ).then(() =>
+ {
+ echo.ice_getCachedConnection().setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
+ }
+ ).then(() =>
+ {
+ return echo.shutdown();
+ }
+ ).finally(() => communicator.destroy());
+ };
+ 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));
diff --git a/js/test/Ice/inheritance/Test.ice b/js/test/Ice/inheritance/Test.ice
index fe15a5c29bb..b0924bb8cdd 100644
--- a/js/test/Ice/inheritance/Test.ice
+++ b/js/test/Ice/inheritance/Test.ice
@@ -235,6 +235,7 @@ class D extends C
interface Echo
{
+ void setConnection();
void startBatch();
void flushBatch();
void shutdown();
diff --git a/js/test/Ice/objects/Client.js b/js/test/Ice/objects/Client.js
index 91413c1d1d7..175519b65cf 100644
--- a/js/test/Ice/objects/Client.js
+++ b/js/test/Ice/objects/Client.js
@@ -12,6 +12,19 @@
var Ice = require("ice").Ice;
var Test = require("Test").Test;
+ function loop(fn, repetitions) {
+ var i = 0;
+ var next = function next() {
+ while (i++ < repetitions) {
+ var r = fn.call(null, i);
+ if (r) {
+ return r.then(next);
+ }
+ }
+ };
+ return next();
+ }
+
class BI extends Test.B
{
ice_preMarshal()
@@ -377,8 +390,55 @@
var [retS, outS] = r;
test(retS.length === 1 && outS.length === 1);
out.writeLine("ok");
- out.write("testing compact ID... ");
+ out.write("testing recursive types... ");
+
+ var top = new Test.Recursive();
+ var p = top;
+ return loop(depth => {
+ p.v = new Test.Recursive();
+ p = p.v;
+ if((depth < 10 && (depth % 10) == 0) ||
+ (depth < 1000 && (depth % 100) == 0) ||
+ (depth < 10000 && (depth % 1000) == 0) ||
+ (depth % 10000) == 0)
+ {
+ return initial.setRecursive(top);
+ }
+ return null;
+ }, 20001);
+ }
+ ).then(() =>
+ {
+ return initial.supportsClassGraphDepthMax().then(function(v) { test(!v); });
+ },
+ (ex) =>
+ {
+ if(ex instanceof Ice.UnknownLocalException)
+ {
+ // Expected marshal exception from the server (max class graph depth reached)
+ }
+ else if(ex instanceof Ice.UnknownException)
+ {
+ // Expected stack overflow from the server (Java only)
+ }
+ else if(ex instanceof RangeError)
+ {
+ }
+ else
+ {
+ throw ex;
+ }
+ }
+ ).then(()=>
+ {
+ return initial.setRecursive(new Test.Recursive());
+ }
+ ).then(()=>
+ {
+ out.writeLine("ok");
+
+ out.write("testing compact ID... ");
return initial.getCompact();
}
).then(compact =>
@@ -413,9 +473,12 @@
},
ex =>
{
- test(ex instanceof Ice.UnexpectedObjectException);
- test(ex.type == "::Test::AlsoEmpty");
- test(ex.expectedType == "::Test::Empty");
+ if(!(ex instanceof Ice.ObjectNotExistException))
+ {
+ test(ex instanceof Ice.UnexpectedObjectException);
+ test(ex.type == "::Test::AlsoEmpty");
+ test(ex.expectedType == "::Test::Empty");
+ }
}
).then(() =>
{
@@ -466,6 +529,7 @@
return Ice.Promise.try(() => allTests(out, c)).finally(() => c.destroy());
};
exports._test = run;
+ exports._clientAllTests = allTests;
exports._runServer = true;
}
(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined,
diff --git a/js/test/Ice/objects/InitialI.js b/js/test/Ice/objects/InitialI.js
new file mode 100644
index 00000000000..e8cd5c4a3db
--- /dev/null
+++ b/js/test/Ice/objects/InitialI.js
@@ -0,0 +1,319 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICEthis._LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+
+ var test = function(b)
+ {
+ if(!b)
+ {
+ throw new Error("test failed");
+ }
+ };
+
+ class BI extends Test.B
+ {
+ ice_preMarshal()
+ {
+ this.preMarshalInvoked = true;
+ }
+
+ ice_postUnmarshal()
+ {
+ this.postUnmarshalInvoked = true;
+ }
+ };
+
+ class CI extends Test.C
+ {
+ ice_preMarshal()
+ {
+ this.preMarshalInvoked = true;
+ }
+
+ ice_postUnmarshal()
+ {
+ this.postUnmarshalInvoked = true;
+ }
+ };
+
+ class DI extends Test.D
+ {
+ ice_preMarshal()
+ {
+ this.preMarshalInvoked = true;
+ }
+
+ ice_postUnmarshal()
+ {
+ this.postUnmarshalInvoked = true;
+ }
+ };
+
+ class EI extends Test.E
+ {
+ constructor()
+ {
+ super(1, "hello");
+ }
+
+ checkValues()
+ {
+ return this.i == 1 && this.s == "hello";
+ }
+ };
+
+ class FI extends Test.F
+ {
+ constructor(e)
+ {
+ super(e, e);
+ }
+
+ checkValues()
+ {
+ return this.e1 !== null && this.e1 === this.e2;
+ }
+ };
+
+ class HI extends Test.H
+ {
+ };
+
+ class II extends Ice.InterfaceByValue
+ {
+ constructor()
+ {
+ super(Test.I.ice_staticId());
+ }
+ };
+
+ class JI extends Ice.InterfaceByValue
+ {
+ constructor()
+ {
+ super(Test.J.ice_staticId());
+ }
+ };
+
+ function MyValueFactory(type)
+ {
+ switch(type)
+ {
+ case "::Test::B":
+ return new BI();
+ case "::Test::C":
+ return new CI();
+ case "::Test::D":
+ return new DI();
+ case "::Test::E":
+ return new EI();
+ case "::Test::F":
+ return new FI();
+ case "::Test::I":
+ return new II();
+ case "::Test::J":
+ return new JI();
+ case "::Test::H":
+ return new HI();
+ case "::Test::Inner::A":
+ return new Test.Inner.A();
+ case "::Test::Inner::Sub::A":
+ return new Test.Inner.Sub.A();
+ default:
+ break;
+ }
+ return null;
+ }
+
+ class InitialI extends Test.Initial
+ {
+ constructor(communicator)
+ {
+ super();
+ if(communicator !== undefined)
+ {
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::B");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::C");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::D");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::E");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::F");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::I");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::J");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::H");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::Inner::A");
+ communicator.getValueFactoryManager().add(MyValueFactory, "::Test::Inner::Sub::A");
+ }
+
+ this._b1 = new BI();
+ this._b2 = new BI();
+ this._c = new CI();
+ this._d = new DI();
+ this._e = new EI();
+ this._f = new FI(this._e, this._e);
+
+ this._b1.theA = this._b2; // Cyclic reference to another B
+ this._b1.theB = this._b1; // Self reference.
+ this._b1.theC = null; // Null reference.
+
+ this._b2.theA = this._b2; // Self reference, using base.
+ this._b2.theB = this._b1; // Cyclic reference to another B
+ this._b2.theC = this._c; // Cyclic reference to a C.
+
+ this._c.theB = this._b2; // Cyclic reference to a B.
+
+ this._d.theA = this._b1; // Reference to a B.
+ this._d.theB = this._b2; // Reference to a B.
+ this._d.theC = null; // Reference to a C.
+ }
+
+ getAll(current)
+ {
+ this._b1.preMarshalInvoked = false;
+ this._b2.preMarshalInvoked = false;
+ this._c.preMarshalInvoked = false;
+ this._d.preMarshalInvoked = false;
+ return [this._b1, this._b2, this._c, this._d]
+ }
+
+ getB1(current)
+ {
+ this._b1.preMarshalInvoked = false;
+ this._b2.preMarshalInvoked = false;
+ this._c.preMarshalInvoked = false;
+ return this._b1;
+ }
+
+ getB2(current)
+ {
+ this._b1.preMarshalInvoked = false;
+ this._b2.preMarshalInvoked = false;
+ this._c.preMarshalInvoked = false;
+ return this._b2;
+ }
+
+ getC(current)
+ {
+ this._b1.preMarshalInvoked = false;
+ this._b2.preMarshalInvoked = false;
+ this._c.preMarshalInvoked = false;
+ return this._c;
+ }
+
+ getD(current)
+ {
+ this._b1.preMarshalInvoked = false;
+ this._b2.preMarshalInvoked = false;
+ this._c.preMarshalInvoked = false;
+ this._d.preMarshalInvoked = false;
+ return this._d;
+ }
+
+ getE(current)
+ {
+ return this._e;
+ }
+
+ getF(current)
+ {
+ return this._f;
+ }
+
+ setRecursive(r, current)
+ {
+ }
+
+ supportsClassGraphDepthMax(current)
+ {
+ return false;
+ }
+
+ getMB(current)
+ {
+ return this._b1;
+ }
+
+ getAMDMB(current)
+ {
+ return Ice.Promise.resolve(this._b1);
+ }
+
+ getI(current)
+ {
+ return new II();
+ }
+
+ getJ(current)
+ {
+ return new JI();
+ }
+
+ getH(current)
+ {
+ return new HI();
+ }
+
+ getD1(d1, current)
+ {
+ return d1;
+ }
+
+ throwEDerived(current)
+ {
+ throw new Test.EDerived(new Test.A1("a1"), new Test.A1("a2"), new Test.A1("a3"), new Test.A1("a4"));
+ }
+
+ setI(theI, current)
+ {
+ }
+
+ opBaseSeq(inS, current)
+ {
+ return [inS, inS];
+ }
+
+ getCompact(current)
+ {
+ return new Test.CompactExt();
+ }
+
+ getInnerA(current)
+ {
+ return new Test.Inner.A(this._b1);
+ }
+
+ getInnerSubA(current)
+ {
+ return new Test.Inner.Sub.A(new Test.Inner.A(this._b1));
+ }
+
+ throwInnerEx(current)
+ {
+ throw new Test.Inner.Ex("Inner::Ex");
+ }
+
+ throwInnerSubEx(current)
+ {
+ throw new Test.Inner.Sub.Ex("Inner::Sub::Ex");
+ }
+
+ shutdown(current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+ }
+
+ 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));
diff --git a/js/test/Ice/objects/Server.js b/js/test/Ice/objects/Server.js
new file mode 100644
index 00000000000..b15a4cde8fc
--- /dev/null
+++ b/js/test/Ice/objects/Server.js
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 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.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+ var InitialI = require("InitialI").InitialI;
+
+ class UnexpectedObjectExceptionTestI extends Test.UnexpectedObjectExceptionTest
+ {
+ op(current)
+ {
+ return new Test.AlsoEmpty();
+ }
+ };
+
+ var run = function(out, id, ready)
+ {
+ id.properties.setProperty("Ice.Warn.Dispatch", "0");
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
+ return Ice.Promise.try(() =>
+ {
+ return communicator.createObjectAdapter("");
+ }
+ ).then(adpt =>
+ {
+ adapter = adpt;
+ adapter.add(new InitialI(communicator), Ice.stringToIdentity("initial"));
+ adapter.add(new UnexpectedObjectExceptionTestI(), Ice.stringToIdentity("uoet"));
+ return echo.setConnection();
+ }
+ ).then(() =>
+ {
+ echo.ice_getCachedConnection().setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
+ }
+ ).then(() =>
+ {
+ return echo.shutdown();
+ }
+ ).finally(() => communicator.destroy());
+ };
+ 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));
diff --git a/js/test/Ice/objects/Test.ice b/js/test/Ice/objects/Test.ice
index b49ecf6f887..3bc810f5848 100644
--- a/js/test/Ice/objects/Test.ice
+++ b/js/test/Ice/objects/Test.ice
@@ -167,7 +167,12 @@ exception Ex
};
-class Initial
+class Recursive
+{
+ Recursive v;
+};
+
+interface Initial
{
void shutdown();
B getB1();
@@ -177,6 +182,9 @@ class Initial
E getE();
F getF();
+ void setRecursive(Recursive p);
+ bool supportsClassGraphDepthMax();
+
["marshaled-result"] B getMB();
["amd", "marshaled-result"] B getAMDMB();
@@ -255,4 +263,10 @@ struct STwoMembers
dictionary<int, COneMember> DOneMember;
dictionary<int, CTwoMembers> DTwoMembers;
+interface Echo
+{
+ void setConnection();
+ void shutdown();
+};
+
};
diff --git a/js/test/Ice/operations/AMDMyDerivedClassI.js b/js/test/Ice/operations/AMDMyDerivedClassI.js
index 54f969cfc61..e62488edd95 100644
--- a/js/test/Ice/operations/AMDMyDerivedClassI.js
+++ b/js/test/Ice/operations/AMDMyDerivedClassI.js
@@ -25,10 +25,11 @@
//
// Override the Object "pseudo" operations to verify the operation mode.
//
- constructor()
+ constructor(endpoints)
{
super();
this._opByteSOnewayCount = 0;
+ this._endpoints = endpoints;
}
ice_isA(id, current)
@@ -154,7 +155,7 @@
var p3 = Test.MyClassPrx.uncheckedCast(
current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity")));
var r = Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id));
- return Promise.resolve([r, p2, p3]);
+ return Promise.resolve([r.ice_endpoints(this._endpoints), p2, p3.ice_endpoints(this._endpoints)]);
}
opMyEnum(p1, current)
@@ -490,6 +491,11 @@
Test.su0, Test.su1, Test.su2]);
}
+ opWStringLiterals(current)
+ {
+ return this.opStringLiterals(current);
+ }
+
opMStruct1(current)
{
return Promise.resolve(new Test.Structure());
diff --git a/js/test/Ice/operations/ClientBidir.js b/js/test/Ice/operations/ClientBidir.js
deleted file mode 100644
index 5aaa3775a37..00000000000
--- a/js/test/Ice/operations/ClientBidir.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 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.
-//
-// **********************************************************************
-
-(function(module, require, exports)
-{
- var Ice = require("ice").Ice;
- var Test = require("Test").Test;
- var MyDerivedClassI = require("MyDerivedClassI").MyDerivedClassI;
- var AMDMyDerivedClassI = require("AMDMyDerivedClassI").AMDMyDerivedClassI;
- var Client = require("Client.js");
-
- var allTests = function(out, communicator, amd)
- {
- return communicator.createObjectAdapter("").then(adapter =>
- {
- if(amd)
- {
- adapter.add(new AMDMyDerivedClassI(), Ice.stringToIdentity("test"));
- }
- else
- {
- adapter.add(new MyDerivedClassI(), Ice.stringToIdentity("test"));
- }
- var base = communicator.stringToProxy("test:default -p 12010");
- return base.ice_getConnection().then(conn =>
- {
- conn.setAdapter(adapter);
- return Client._clientAllTests(out, communicator, Test, true);
- });
- });
- };
-
- var run = function(out, id)
- {
- id.properties.setProperty("Ice.BatchAutoFlushSize", "100");
- var communicator = Ice.initialize(id);
- return Ice.Promise.try(() =>
- {
- out.writeLine("testing bidir callbacks with synchronous dispatch...");
- return allTests(out, communicator, false);
- }
- ).then(() => communicator.destroy()
- ).then(() =>
- {
- communicator = Ice.initialize(id);
- out.writeLine("testing bidir callbacks with asynchronous dispatch...");
- return allTests(out, communicator, true);
- }
- ).then(() => communicator.destroy()
- ).then(() =>
- {
- communicator = Ice.initialize(id);
- return Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:default -p 12010"));
- }
- ).then(prx => prx.shutdown()
- ).finally(() => communicator.destroy());
- };
- exports._testBidir = 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/MyDerivedClassI.js b/js/test/Ice/operations/MyDerivedClassI.js
index dcb945ef8cb..f550f28f574 100644
--- a/js/test/Ice/operations/MyDerivedClassI.js
+++ b/js/test/Ice/operations/MyDerivedClassI.js
@@ -25,10 +25,11 @@
//
// Override the Object "pseudo" operations to verify the operation mode.
//
- constructor()
+ constructor(endpoints)
{
super();
this._opByteSOnewayCount = 0;
+ this._endpoints = endpoints;
}
ice_isA(id, current)
@@ -152,7 +153,7 @@
var p3 = Test.MyClassPrx.uncheckedCast(
current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity")));
var r = Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id));
- return [r, p2, p3];
+ return [r.ice_endpoints(this._endpoints), p2, p3.ice_endpoints(this._endpoints)];
}
opMyEnum(p1, current)
@@ -483,6 +484,11 @@
Test.su0, Test.su1, Test.su2];
}
+ opWStringLiterals(current)
+ {
+ return this.opStringLiterals(current);
+ }
+
opMStruct1(current)
{
return new Test.Structure();
diff --git a/js/test/Ice/operations/Server.js b/js/test/Ice/operations/Server.js
new file mode 100644
index 00000000000..e1d21e10495
--- /dev/null
+++ b/js/test/Ice/operations/Server.js
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 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.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+ var MyDerivedClassI = require("MyDerivedClassI").MyDerivedClassI;
+
+ var run = function(out, id, ready)
+ {
+ id.properties.setProperty("Ice.BatchAutoFlushSize", "100");
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
+ return Ice.Promise.try(() =>
+ {
+ return communicator.createObjectAdapter("");
+ }
+ ).then(adpt =>
+ {
+ adapter = adpt;
+ adapter.add(new MyDerivedClassI(echo.ice_getEndpoints()), Ice.stringToIdentity("test"));
+ return echo.setConnection();
+ }
+ ).then(() =>
+ {
+ echo.ice_getCachedConnection().setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
+ }
+ ).then(() =>
+ {
+ return echo.shutdown();
+ }
+ ).finally(() => communicator.destroy());
+ };
+ 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));
diff --git a/js/test/Ice/operations/ServerAMD.js b/js/test/Ice/operations/ServerAMD.js
new file mode 100644
index 00000000000..60b87b2f8de
--- /dev/null
+++ b/js/test/Ice/operations/ServerAMD.js
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 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.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+ var AMDMyDerivedClassI = require("AMDMyDerivedClassI").AMDMyDerivedClassI;
+
+ var run = function(out, id, ready)
+ {
+ id.properties.setProperty("Ice.BatchAutoFlushSize", "100");
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
+ return Ice.Promise.try(() =>
+ {
+ return communicator.createObjectAdapter("");
+ }
+ ).then(adpt =>
+ {
+ adapter = adpt;
+ adapter.add(new AMDMyDerivedClassI(echo.ice_getEndpoints()), Ice.stringToIdentity("test"));
+ return echo.setConnection();
+ }
+ ).then(() =>
+ {
+ echo.ice_getCachedConnection().setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
+ }
+ ).then(() =>
+ {
+ return echo.shutdown();
+ }
+ ).finally(() => communicator.destroy());
+ };
+ 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));
diff --git a/js/test/Ice/operations/Test.ice b/js/test/Ice/operations/Test.ice
index 7899646dcfd..c9056b5c581 100644
--- a/js/test/Ice/operations/Test.ice
+++ b/js/test/Ice/operations/Test.ice
@@ -43,6 +43,7 @@ sequence<long> LongS;
sequence<float> FloatS;
sequence<double> DoubleS;
sequence<string> StringS;
+sequence<["cpp:type:wstring"]string> WStringS;
sequence<MyEnum> MyEnumS;
sequence<MyClass*> MyClassS;
@@ -248,6 +249,7 @@ interface MyClass
ByteBoolD opByteBoolD2(ByteBoolD byteBoolD);
StringS opStringLiterals();
+ WStringS opWStringLiterals();
["marshaled-result"] Structure opMStruct1();
["marshaled-result"] Structure opMStruct2(Structure p1, out Structure p2);
@@ -282,6 +284,7 @@ interface MyDerivedClass extends MyClass
interface Echo
{
+ void setConnection();
void startBatch();
void flushBatch();
void shutdown();
diff --git a/js/test/Ice/optional/AMDInitialI.js b/js/test/Ice/optional/AMDInitialI.js
index 9a5706f10ca..7b90fa13697 100644
--- a/js/test/Ice/optional/AMDInitialI.js
+++ b/js/test/Ice/optional/AMDInitialI.js
@@ -337,6 +337,11 @@
return Promise.resolve(false);
}
+ supportsCppStringView(current)
+ {
+ return false;
+ }
+
supportsCsharpSerializable(current)
{
return Promise.resolve(false);
diff --git a/js/test/Ice/optional/Client.js b/js/test/Ice/optional/Client.js
index dd45a676ed6..0847fb98194 100644
--- a/js/test/Ice/optional/Client.js
+++ b/js/test/Ice/optional/Client.js
@@ -319,6 +319,15 @@
}
).then(() =>
{
+ var recursive1 = [new Test.Recursive()];
+ var recursive2 = [new Test.Recursive()];
+ recursive1[0].value = recursive2;
+ var outer = new Test.Recursive();
+ outer.value = recursive1;
+ initial.pingPong(outer);
+ }
+ ).then(() =>
+ {
var g = new Test.G();
g.gg1Opt = new Test.G1("gg1Opt");
g.gg2 = new Test.G2(new Ice.Long(0, 10));
diff --git a/js/test/Ice/optional/ClientBidir.js b/js/test/Ice/optional/ClientBidir.js
deleted file mode 100644
index d61abfeb8af..00000000000
--- a/js/test/Ice/optional/ClientBidir.js
+++ /dev/null
@@ -1,82 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 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.
-//
-// **********************************************************************
-
-(function(module, require, exports)
-{
- var Ice = require("ice").Ice;
- var Test = require("Test").Test;
- var InitialI = require("InitialI").InitialI;
- var AMDInitialI = require("AMDInitialI").AMDInitialI;
- var Client = require("Client");
-
- var ArrayUtil = Ice.ArrayUtil;
-
- var allTests = function(out, communicator, amd)
- {
- var base;
- return Ice.Promise.try(() =>
- {
- base = communicator.stringToProxy("initial:default -p 12010");
- return communicator.createObjectAdapter("");
- }
- ).then(adapter =>
- {
- if(amd)
- {
- adapter.add(new AMDInitialI(), Ice.stringToIdentity("initial"));
- }
- else
- {
- adapter.add(new InitialI(), Ice.stringToIdentity("initial"));
- }
- return base.ice_getConnection().then(conn =>
- {
- conn.setAdapter(adapter);
- return Client._clientAllTests(out, communicator, Test);
- });
- });
- };
-
- var run = function(out, id)
- {
- var communicator = null;
- return Ice.Promise.try(() =>
- {
- communicator = Ice.initialize(id);
- out.writeLine("testing bidir callbacks with synchronous dispatch...");
- return allTests(out, communicator, false);
- }
- ).then(() => communicator.destroy()
- ).then(() =>
- {
- communicator = Ice.initialize(id);
- out.writeLine("testing bidir callbacks with asynchronous dispatch...");
- return allTests(out, communicator, true);
- }
- ).then(() => communicator.destroy()
- ).then(() =>
- {
- communicator = Ice.initialize(id);
- var base = communicator.stringToProxy("__echo:default -p 12010");
- return Test.EchoPrx.checkedCast(base);
- }
- ).then(prx => prx.shutdown()
- ).finally(() =>
- {
- if(communicator)
- {
- return communicator.destroy();
- }
- });
- };
- exports._testBidir = 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/ClientPrivate.ice b/js/test/Ice/optional/ClientPrivate.ice
index ddb03cd4aa5..ea6072ee803 100644
--- a/js/test/Ice/optional/ClientPrivate.ice
+++ b/js/test/Ice/optional/ClientPrivate.ice
@@ -17,12 +17,16 @@ module Test
//
// The server doesn't know this class.
//
-class D extends B
-{
- string ds;
- optional(990) StringSeq seq;
- optional(1000) A ao;
-};
+// We don't define it in JavaScript to allow the cross tests to work when running
+// only the JavaScript server within the browser (which loads ClientPrivate.js for
+// the server as well)
+//
+// class D extends B
+// {
+// string ds;
+// optional(990) StringSeq seq;
+// optional(1000) A ao;
+// };
//
// This class is a hack that allows us to invoke the opClassAndUnknownOptional operation
diff --git a/js/test/Ice/optional/InitialI.js b/js/test/Ice/optional/InitialI.js
index ec7e7f6b99e..efc5ff788b7 100644
--- a/js/test/Ice/optional/InitialI.js
+++ b/js/test/Ice/optional/InitialI.js
@@ -333,6 +333,11 @@
return false;
}
+ supportsCppStringView(current)
+ {
+ return false;
+ }
+
supportsCsharpSerializable(current)
{
return false;
diff --git a/js/test/Ice/optional/Server.js b/js/test/Ice/optional/Server.js
new file mode 100644
index 00000000000..2442eaa3f09
--- /dev/null
+++ b/js/test/Ice/optional/Server.js
@@ -0,0 +1,48 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 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.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+ var InitialI = require("InitialI").InitialI;
+
+ var run = function(out, id, ready)
+ {
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
+ return Ice.Promise.try(() =>
+ {
+ return communicator.createObjectAdapter("");
+ }
+ ).then(adpt =>
+ {
+ adapter = adpt;
+ adapter.add(new InitialI(), Ice.stringToIdentity("initial"));
+ return echo.setConnection();
+ }
+ ).then(() =>
+ {
+ echo.ice_getCachedConnection().setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
+ }
+ ).then(() =>
+ {
+ return echo.shutdown();
+ }
+ ).finally(() => communicator.destroy());
+ };
+ 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));
diff --git a/js/test/Ice/optional/ServerAMD.js b/js/test/Ice/optional/ServerAMD.js
new file mode 100644
index 00000000000..86779fd2d76
--- /dev/null
+++ b/js/test/Ice/optional/ServerAMD.js
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 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.
+//
+// **********************************************************************
+
+(function(module, require, exports)
+{
+ var Ice = require("ice").Ice;
+ var Test = require("Test").Test;
+ var AMDInitialI = require("AMDInitialI").AMDInitialI;
+
+
+ var run = function(out, id, ready)
+ {
+ var communicator = Ice.initialize(id);
+ var adapter;
+ var echo = Test.EchoPrx.uncheckedCast(communicator.stringToProxy("__echo:default -p 12010"));
+ return Ice.Promise.try(() =>
+ {
+ return communicator.createObjectAdapter("");
+ }
+ ).then(adpt =>
+ {
+ adapter = adpt;
+ adapter.add(new AMDInitialI(), Ice.stringToIdentity("initial"));
+ return echo.setConnection();
+ }
+ ).then(() =>
+ {
+ echo.ice_getCachedConnection().setAdapter(adapter);
+ adapter.activate();
+ ready.resolve();
+ return communicator.waitForShutdown();
+ }
+ ).then(() =>
+ {
+ return echo.shutdown();
+ }
+ ).finally(() => communicator.destroy());
+ };
+ 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));
diff --git a/js/test/Ice/optional/Test.ice b/js/test/Ice/optional/Test.ice
index 70262e8cd6f..4c206934991 100644
--- a/js/test/Ice/optional/Test.ice
+++ b/js/test/Ice/optional/Test.ice
@@ -189,6 +189,14 @@ class G
G1 gg1;
};
+class Recursive;
+sequence<Recursive> RecursiveSeq;
+
+class Recursive
+{
+ optional(0) RecursiveSeq value;
+};
+
interface Initial
{
void shutdown();
@@ -298,11 +306,14 @@ interface Initial
bool supportsCsharpSerializable();
+ bool supportsCppStringView();
+
bool supportsNullOptional();
};
interface Echo
{
+ void setConnection();
void startBatch();
void flushBatch();
void shutdown();