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/operations/Oneways.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/operations/Oneways.js')
-rw-r--r-- | js/test/Ice/operations/Oneways.js | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/js/test/Ice/operations/Oneways.js b/js/test/Ice/operations/Oneways.js new file mode 100644 index 00000000000..6dc01f2d987 --- /dev/null +++ b/js/test/Ice/operations/Oneways.js @@ -0,0 +1,107 @@ +// ********************************************************************** +// +// 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 Ice = global.Ice; + + var run = function(communicator, prx, Test, bidir) + { + var p = new Ice.Promise(); + var test = function(b) + { + if(!b) + { + try + { + throw new Error("test failed"); + } + catch(err) + { + p.fail(err); + throw err; + } + } + }; + + Ice.Promise.try( + function() + { + prx = prx.ice_oneway(); + return prx.ice_ping(); + } + ).then( + function() + { + try + { + prx.ice_isA(Test.MyClass.ice_staticId()); + test(false); + } + catch(ex) + { + // Expected: twoway proxy required + } + try + { + prx.ice_id(); + test(false); + } + catch(ex) + { + // Expected: twoway proxy required + } + try + { + prx.ice_ids(); + test(false); + } + catch(ex) + { + // Expected: twoway proxy required + } + + return prx.opVoid(); + } + ).then( + function() + { + return prx.opIdempotent(); + } + ).then( + function() + { + return prx.opNonmutating(); + } + ).then( + function() + { + try + { + prx.opByte(0xff, 0x0f); + test(false); + } + catch(ex) + { + // Expected: twoway proxy required + } + } + ).then( + function() + { + p.succeed(); + }, + function(ex) + { + p.fail(ex); + }); + return p; + }; + + global.Oneways = { run: run }; +}(typeof (global) === "undefined" ? window : global)); |