diff options
author | Mark Spruiell <mes@zeroc.com> | 2014-03-19 12:45:55 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2014-03-19 12:45:55 -0700 |
commit | cdcffbcc3c3c052afdeb772ff0167e7a90b525bb (patch) | |
tree | 4f16ee41ef7d33394c44e9db81e4d6cd89908250 /js/test/Ice/exceptionsBidir/Client.js | |
parent | fixing testicedist.py for 5487 (diff) | |
download | ice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.tar.bz2 ice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.tar.xz ice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.zip |
merging javascript branch
Diffstat (limited to 'js/test/Ice/exceptionsBidir/Client.js')
-rw-r--r-- | js/test/Ice/exceptionsBidir/Client.js | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/js/test/Ice/exceptionsBidir/Client.js b/js/test/Ice/exceptionsBidir/Client.js new file mode 100644 index 00000000000..5c193f744a1 --- /dev/null +++ b/js/test/Ice/exceptionsBidir/Client.js @@ -0,0 +1,102 @@ +// ********************************************************************** +// +// 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; + + require("Test"); + require("TestAMD"); + require("../exceptions/Client"); + + require("ThrowerI"); + var ThrowerI = global.ThrowerI; + require("AMDThrowerI"); + var AMDThrowerI = global.AMDThrowerI; + + + var allTests = function(out, communicator, amd) + { + return Promise.try( + function() + { + return communicator.createObjectAdapter("").then( + function(adapter) + { + if(amd) + { + adapter.add(new AMDThrowerI(), communicator.stringToIdentity("thrower")); + } + else + { + adapter.add(new ThrowerI(), communicator.stringToIdentity("thrower")); + } + var base = communicator.stringToProxy("thrower:default -p 12010"); + return base.ice_getConnection().then( + function(conn) + { + conn.setAdapter(adapter); + return __clientAllTests__(out, communicator, amd ? global.TestAMD : global.Test); + }); + }); + }); + }; + + var run = function(out, id) + { + return Promise.try( + function() + { + id.properties.setProperty("Ice.MessageSizeMax", "10"); + id.properties.setProperty("Ice.Warn.Dispatch", "0"); + var 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 ref = "__echo:default -p 12010"; + var base = communicator.stringToProxy(ref); + return global.Test.EchoPrx.checkedCast(base); + } + ).then( + function(prx) + { + return prx.shutdown(); + } + ).then( + function() + { + return communicator.destroy(); + }); + }); + return p; + }; + global.__test__ = run; + global.__runEchoServer__ = true; +}(typeof (global) === "undefined" ? window : global)); |