diff options
Diffstat (limited to 'python/test/Ice/operations/Server.py')
-rwxr-xr-x | python/test/Ice/operations/Server.py | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/python/test/Ice/operations/Server.py b/python/test/Ice/operations/Server.py index 173e4419de7..f5de973acb6 100755 --- a/python/test/Ice/operations/Server.py +++ b/python/test/Ice/operations/Server.py @@ -8,37 +8,26 @@ # # ********************************************************************** -import os, sys, traceback +from TestHelper import TestHelper +TestHelper.loadSlice("Test.ice") import Ice -slice_dir = Ice.getSliceDir() -if not slice_dir: - print(sys.argv[0] + ': Slice directory not found.') - sys.exit(1) +import TestI -Ice.loadSlice('"-I' + slice_dir + '" Test.ice') -import Test, TestI -def run(args, communicator): - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010") - adapter = communicator.createObjectAdapter("TestAdapter") - adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) - adapter.activate() - communicator.waitForShutdown() - return True +class Server(TestHelper): -try: - initData = Ice.InitializationData() - initData.properties = Ice.createProperties(sys.argv) - # - # Its possible to have batch oneway requests dispatched after the - # adapter is deactivated due to thread scheduling so we supress - # this warning. - # - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - with Ice.initialize(sys.argv, initData) as communicator: - status = run(sys.argv, communicator) -except: - traceback.print_exc() - status = False + def run(self, args): + properties = self.createTestProperties(args) + # + # Its possible to have batch oneway requests dispatched after the + # adapter is deactivated due to thread scheduling so we supress + # this warning. + # + properties.setProperty("Ice.Warn.Dispatch", "0") -sys.exit(not status) + with self.initialize(properties=properties) as communicator: + communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + adapter = communicator.createObjectAdapter("TestAdapter") + adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) + adapter.activate() + communicator.waitForShutdown() |