summaryrefslogtreecommitdiff
path: root/js/test/Ice/optionalBidir/Client.js
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2014-03-19 12:45:55 -0700
committerMark Spruiell <mes@zeroc.com>2014-03-19 12:45:55 -0700
commitcdcffbcc3c3c052afdeb772ff0167e7a90b525bb (patch)
tree4f16ee41ef7d33394c44e9db81e4d6cd89908250 /js/test/Ice/optionalBidir/Client.js
parentfixing testicedist.py for 5487 (diff)
downloadice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.tar.bz2
ice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.tar.xz
ice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.zip
merging javascript branch
Diffstat (limited to 'js/test/Ice/optionalBidir/Client.js')
-rw-r--r--js/test/Ice/optionalBidir/Client.js106
1 files changed, 106 insertions, 0 deletions
diff --git a/js/test/Ice/optionalBidir/Client.js b/js/test/Ice/optionalBidir/Client.js
new file mode 100644
index 00000000000..5632bccb3ab
--- /dev/null
+++ b/js/test/Ice/optionalBidir/Client.js
@@ -0,0 +1,106 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 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(global){
+ var require = typeof(module) !== "undefined" ? module.require : function(){};
+ require("Ice/Ice");
+ var Ice = global.Ice;
+
+ var Promise = Ice.Promise;
+ var ArrayUtil = Ice.ArrayUtil;
+
+ require("Test");
+ require("TestAMD");
+
+ require("InitialI");
+ require("AMDInitialI");
+ require("../optional/Client");
+ var InitialI = global.InitialI;
+ var AMDInitialI = global.AMDInitialI;
+
+ var allTests = function(out, communicator, amd)
+ {
+ var Test = amd ? global.TestAMD : global.Test;
+ var base;
+ return Promise.try(
+ function()
+ {
+ base = communicator.stringToProxy("initial:default -p 12010");
+ return communicator.createObjectAdapter("");
+ }
+ ).then(
+ function(adapter)
+ {
+ if(amd)
+ {
+ adapter.add(new AMDInitialI(), communicator.stringToIdentity("initial"));
+ }
+ else
+ {
+ adapter.add(new InitialI(), communicator.stringToIdentity("initial"));
+ }
+ return base.ice_getConnection().then(
+ function(conn)
+ {
+ conn.setAdapter(adapter);
+ return __clientAllTests__(out, communicator, Test);
+ });
+ }
+ );
+ };
+
+ var run = function(out, id)
+ {
+ var communicator;
+ return Promise.try(
+ function()
+ {
+ communicator = Ice.initialize(id);
+ out.writeLine("testing bidir callbacks with synchronous dispatch...");
+ return allTests(out, communicator, false);
+ }
+ ).then(
+ function()
+ {
+ return communicator.destroy();
+ }
+ ).then(
+ function()
+ {
+ communicator = Ice.initialize(id);
+ out.writeLine("testing bidir callbacks with asynchronous dispatch...");
+ return allTests(out, communicator, true);
+ }
+ ).then(
+ function()
+ {
+ return communicator.destroy();
+ }
+ ).then(
+ function()
+ {
+ communicator = Ice.initialize(id);
+ var base = communicator.stringToProxy("__echo:default -p 12010");
+ return global.Test.EchoPrx.checkedCast(base);
+ }
+ ).then(
+ function(prx)
+ {
+ return prx.shutdown();
+ }
+ ).finally(
+ function()
+ {
+ return communicator.destroy();
+ });
+ };
+ global.__test__ = run;
+ global.__runEchoServer__ = true;
+}(typeof (global) === "undefined" ? window : global));
+