summaryrefslogtreecommitdiff
path: root/py/test/Ice/exceptions/ServerAMD.py
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2004-09-14 03:08:05 +0000
committerMark Spruiell <mes@zeroc.com>2004-09-14 03:08:05 +0000
commitef665fca81ad2ea87f18d1f978eaf698edfe0f17 (patch)
treedcda4691f96aac3334453db1b0074796e654d702 /py/test/Ice/exceptions/ServerAMD.py
parentChanged --impl fix for syntax error to omit leading global scope qualifier (diff)
downloadice-ef665fca81ad2ea87f18d1f978eaf698edfe0f17.tar.bz2
ice-ef665fca81ad2ea87f18d1f978eaf698edfe0f17.tar.xz
ice-ef665fca81ad2ea87f18d1f978eaf698edfe0f17.zip
adding AMD tests
Diffstat (limited to 'py/test/Ice/exceptions/ServerAMD.py')
-rw-r--r--py/test/Ice/exceptions/ServerAMD.py138
1 files changed, 138 insertions, 0 deletions
diff --git a/py/test/Ice/exceptions/ServerAMD.py b/py/test/Ice/exceptions/ServerAMD.py
new file mode 100644
index 00000000000..b524e3b22c8
--- /dev/null
+++ b/py/test/Ice/exceptions/ServerAMD.py
@@ -0,0 +1,138 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2004 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.
+#
+# **********************************************************************
+
+import sys, Ice
+
+Ice.loadSlice('TestAMD.ice')
+import Test
+
+class ThrowerI(Test.Thrower):
+ def __init__(self, adapter):
+ self._adapter = adapter
+
+ def shutdown_async(self, cb, current=None):
+ self._adapter.getCommunicator().shutdown()
+ cb.ice_response()
+
+ def supportsUndeclaredExceptions_async(self, cb, current=None):
+ cb.ice_response(True)
+
+ def supportsAssertException_async(self, cb, current=None):
+ cb.ice_response(False)
+
+ def throwAasA_async(self, cb, a, current=None):
+ ex = Test.A()
+ ex.aMem = a
+ cb.ice_exception(ex)
+
+ def throwAorDasAorD_async(self, cb, a, current=None):
+ if a > 0:
+ ex = Test.A()
+ ex.aMem = a
+ cb.ice_exception(ex)
+ else:
+ ex = Test.D()
+ ex.dMem = a
+ cb.ice_exception(ex)
+
+ def throwBasA_async(self, cb, a, b, current=None):
+ ex = Test.B()
+ ex.aMem = a
+ ex.bMem = b
+ raise ex
+ #cb.ice_exception(ex)
+
+ def throwCasA_async(self, cb, a, b, c, current=None):
+ ex = Test.C()
+ ex.aMem = a
+ ex.bMem = b
+ ex.cMem = c
+ cb.ice_exception(ex)
+
+ def throwBasB_async(self, cb, a, b, current=None):
+ ex = Test.B()
+ ex.aMem = a
+ ex.bMem = b
+ raise ex
+ #cb.ice_exception(ex)
+
+ def throwCasB_async(self, cb, a, b, c, current=None):
+ ex = Test.C()
+ ex.aMem = a
+ ex.bMem = b
+ ex.cMem = c
+ cb.ice_exception(ex)
+
+ def throwCasC_async(self, cb, a, b, c, current=None):
+ ex = Test.C()
+ ex.aMem = a
+ ex.bMem = b
+ ex.cMem = c
+ cb.ice_exception(ex)
+
+ def throwModA_async(self, cb, a, a2, current=None):
+ ex = Test.Mod.A()
+ ex.aMem = a
+ ex.a2Mem = a2
+ raise ex
+
+ def throwUndeclaredA_async(self, cb, a, current=None):
+ ex = Test.A()
+ ex.aMem = a
+ cb.ice_exception(ex)
+
+ def throwUndeclaredB_async(self, cb, a, b, current=None):
+ ex = Test.B()
+ ex.aMem = a
+ ex.bMem = b
+ raise ex
+ #cb.ice_exception(ex)
+
+ def throwUndeclaredC_async(self, cb, a, b, c, current=None):
+ ex = Test.C()
+ ex.aMem = a
+ ex.bMem = b
+ ex.cMem = c
+ cb.ice_exception(ex)
+
+ def throwLocalException_async(self, cb, current=None):
+ cb.ice_exception(Ice.TimeoutException())
+
+ def throwNonIceException_async(self, cb, current=None):
+ cb.ice_exception(RuntimeError("12345"))
+
+ def throwAssertException_async(self, cb, current=None):
+ raise RuntimeError("operation `throwAssertException' not supported")
+
+def run(args, communicator):
+ properties = communicator.getProperties()
+ properties.setProperty("Ice.Warn.Dispatch", "0")
+ properties.setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ object = ThrowerI(adapter)
+ adapter.add(object, Ice.stringToIdentity("thrower"))
+ adapter.activate()
+ communicator.waitForShutdown()
+ return True
+
+try:
+ communicator = Ice.initialize(sys.argv)
+ status = run(sys.argv, communicator)
+except Ice.Exception, ex:
+ print ex
+ status = False
+
+if communicator:
+ try:
+ communicator.destroy()
+ except Ice.Exception, ex:
+ print ex
+ status = False
+
+sys.exit(not status)