diff options
Diffstat (limited to 'python/test/Ice/slicing/exceptions/ServerAMD.py')
-rwxr-xr-x | python/test/Ice/slicing/exceptions/ServerAMD.py | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/python/test/Ice/slicing/exceptions/ServerAMD.py b/python/test/Ice/slicing/exceptions/ServerAMD.py index 73ab20b8eaa..f497895516d 100755 --- a/python/test/Ice/slicing/exceptions/ServerAMD.py +++ b/python/test/Ice/slicing/exceptions/ServerAMD.py @@ -8,13 +8,19 @@ # # ********************************************************************** -import os, sys, traceback - +from TestHelper import TestHelper +TestHelper.loadSlice("-I. --all ServerPrivate.ice") import Ice -Ice.loadSlice('-I. --all ServerPrivate.ice') import Test + +def test(b): + if not b: + raise RuntimeError('test assertion failed') + + class TestI(Test.TestIntf): + def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -216,22 +222,16 @@ class TestI(Test.TestIntf): f.set_exception(ex) return f -def run(args, communicator): - properties = communicator.getProperties() - properties.setProperty("Ice.Warn.Dispatch", "0") - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000") - adapter = communicator.createObjectAdapter("TestAdapter") - object = TestI() - adapter.add(object, Ice.stringToIdentity("Test")) - adapter.activate() - communicator.waitForShutdown() - return True - -try: - with Ice.initialize(sys.argv) as communicator: - status = run(sys.argv, communicator) -except: - traceback.print_exc() - status = False - -sys.exit(not status) + +class ServerAMD(TestHelper): + + def run(self, args): + properties = self.createTestProperties(args) + properties.setProperty("Ice.Warn.Dispatch", "0") + with self.initialize(properties=properties) as communicator: + communicator.getProperties().setProperty("TestAdapter.Endpoints", + "{0} -t 10000".format(self.getTestEndpoint())) + adapter = communicator.createObjectAdapter("TestAdapter") + adapter.add(TestI(), Ice.stringToIdentity("Test")) + adapter.activate() + communicator.waitForShutdown() |