summaryrefslogtreecommitdiff
path: root/python/test/Ice/ami/Collocated.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/test/Ice/ami/Collocated.py')
-rwxr-xr-xpython/test/Ice/ami/Collocated.py63
1 files changed, 25 insertions, 38 deletions
diff --git a/python/test/Ice/ami/Collocated.py b/python/test/Ice/ami/Collocated.py
index e87e3ac7ea5..0b449be5866 100755
--- a/python/test/Ice/ami/Collocated.py
+++ b/python/test/Ice/ami/Collocated.py
@@ -8,53 +8,40 @@
#
# **********************************************************************
-import os, sys, traceback
-
+from TestHelper import TestHelper
+TestHelper.loadSlice("Test.ice")
+import AllTests
+import TestI
import Ice
-slice_dir = Ice.getSliceDir()
-if not slice_dir:
- print(sys.argv[0] + ': Slice directory not found.')
- sys.exit(1)
-
-Ice.loadSlice('"-I' + slice_dir + '" Test.ice')
-import Test, TestI, AllTests
-
-def run(args, communicator):
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010")
- communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011")
- communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1")
- adapter = communicator.createObjectAdapter("TestAdapter")
- adapter2 = communicator.createObjectAdapter("ControllerAdapter")
- testController = TestI.TestIntfControllerI(adapter)
+class Collocated(TestHelper):
- adapter.add(TestI.TestIntfI(), Ice.stringToIdentity("test"))
- adapter.add(TestI.TestIntfII(), Ice.stringToIdentity("test2"))
- #adapter.activate() # Collocated test doesn't need to active the OA
+ def run(self, args):
- adapter2.add(testController, Ice.stringToIdentity("testController"))
- #adapter2.activate() # Collocated test doesn't need to active the OA
+ properties = self.createTestProperties(args)
+ properties.setProperty("Ice.Warn.AMICallback", "0")
+ #
+ # This test kills connections, so we don't want warnings.
+ #
+ properties.setProperty("Ice.Warn.Connections", "0")
- AllTests.allTests(communicator, True)
+ with self.initialize(properties=properties) as communicator:
- return True
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010")
+ communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011")
+ communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1")
-try:
- initData = Ice.InitializationData()
- initData.properties = Ice.createProperties(sys.argv)
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ adapter2 = communicator.createObjectAdapter("ControllerAdapter")
- initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ testController = TestI.TestIntfControllerI(adapter)
- #
- # This test kills connections, so we don't want warnings.
- #
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ adapter.add(TestI.TestIntfI(), Ice.stringToIdentity("test"))
+ adapter.add(TestI.TestIntfII(), Ice.stringToIdentity("test2"))
+ # adapter.activate() # Collocated test doesn't need to active the OA
- with Ice.initialize(sys.argv, initData) as communicator:
- status = run(sys.argv, communicator)
-except:
- traceback.print_exc()
- status = False
+ adapter2.add(testController, Ice.stringToIdentity("testController"))
+ # adapter2.activate() # Collocated test doesn't need to active the OA
-sys.exit(not status)
+ AllTests.allTests(self, communicator, True)