summaryrefslogtreecommitdiff
path: root/py/test/Ice/servantLocator/TestAMDI.py
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2007-11-05 12:19:49 -0800
committerMark Spruiell <mes@zeroc.com>2007-11-05 12:19:49 -0800
commit3c8924663df8629b33c2ddd38907c4bf2eeb83cd (patch)
tree83b63f2396201019163d140555e42d79f82e46d3 /py/test/Ice/servantLocator/TestAMDI.py
parentMerge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff)
downloadice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.tar.bz2
ice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.tar.xz
ice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.zip
- Fixing bug 2522 for Python. This involved adding the C++ class
UserExceptionWriter so that the Python extension can wrap a native Python user exception into something that the C++ run time can marshal. Also ported the changes to the servantLocator test. - Implementing UserExceptionWriter in Java and C#. - Consolidating the source files for the C# streaming API.
Diffstat (limited to 'py/test/Ice/servantLocator/TestAMDI.py')
-rw-r--r--py/test/Ice/servantLocator/TestAMDI.py45
1 files changed, 33 insertions, 12 deletions
diff --git a/py/test/Ice/servantLocator/TestAMDI.py b/py/test/Ice/servantLocator/TestAMDI.py
index b19211b0b57..189702a4225 100644
--- a/py/test/Ice/servantLocator/TestAMDI.py
+++ b/py/test/Ice/servantLocator/TestAMDI.py
@@ -38,6 +38,29 @@ class TestI(Test.TestIntf):
def pythonException_async(self, cb, current=None):
cb.ice_response()
+ def unknownExceptionWithServantException_async(self, cb, current=None):
+ cb.ice_exception(Ice.ObjectNotExistException())
+
+ def impossibleException_async(self, cb, throw, current=None):
+ if throw:
+ cb.ice_exception(Test.TestImpossibleException())
+ else:
+ #
+ # Return a value so we can be sure that the stream position
+ # is reset correctly if finished() throws.
+ #
+ cb.ice_response("Hello")
+
+ def intfUserException_async(self, cb, throw, current=None):
+ if throw:
+ cb.ice_exception(Test.TestIntfUserException())
+ else:
+ #
+ # Return a value so we can be sure that the stream position
+ # is reset correctly if finished() throws.
+ #
+ cb.ice_response("Hello")
+
def shutdown_async(self, cb, current=None):
current.adapter.deactivate()
cb.ice_response()
@@ -89,22 +112,20 @@ class ServantLocatorI(Ice.ServantLocator):
if current.operation == "requestFailedException":
raise Ice.ObjectNotExistException()
elif current.operation == "unknownUserException":
- ex = Ice.UnknownUserException()
- ex.unknown = "reason"
- raise ex
+ raise Ice.UnknownUserException("reason")
elif current.operation == "unknownLocalException":
- ex = Ice.UnknownLocalException()
- ex.unknown = "reason"
- raise ex
+ raise Ice.UnknownLocalException("reason")
elif current.operation == "unknownException":
- ex = Ice.UnknownException()
- ex.unknown = "reason"
- raise ex
+ raise Ice.UnknownException("reason")
elif current.operation == "userException":
raise Test.TestIntfUserException()
elif current.operation == "localException":
- ex = Ice.SocketException()
- ex.error = 0
- raise ex
+ raise Ice.SocketException(0)
elif current.operation == "pythonException":
raise RuntimeError("message")
+ elif current.operation == "unknownExceptionWithServantException":
+ raise Ice.UnknownException("reason")
+ elif current.operation == "impossibleException":
+ raise Test.TestIntfUserException() # Yes, it really is meant to be TestIntfUserException.
+ elif current.operation == "intfUserException":
+ raise Test.TestImpossibleException() # Yes, it really is meant to be TestImpossibleException.