diff options
Diffstat (limited to 'python/test/Ice/slicing/objects/ServerAMD.py')
-rwxr-xr-x | python/test/Ice/slicing/objects/ServerAMD.py | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/python/test/Ice/slicing/objects/ServerAMD.py b/python/test/Ice/slicing/objects/ServerAMD.py index 908765049d5..4822b2ba28c 100755 --- a/python/test/Ice/slicing/objects/ServerAMD.py +++ b/python/test/Ice/slicing/objects/ServerAMD.py @@ -8,16 +8,17 @@ # # ********************************************************************** -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 SBaseAsObject(self, current=None): sb = Test.SBase() @@ -400,22 +401,15 @@ class TestI(Test.TestIntf): def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() -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() |