summaryrefslogtreecommitdiff
path: root/python/test/Ice/acm/TestI.py
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2017-01-30 13:45:21 -0800
committerMark Spruiell <mes@zeroc.com>2017-01-30 13:45:21 -0800
commit61270a10f980933cf582edb766f10c8ac6d86e8a (patch)
tree45ab4a7c2986954054fce613bc3c8f7967e7951e /python/test/Ice/acm/TestI.py
parentFix slice2cpp build failure (diff)
downloadice-61270a10f980933cf582edb766f10c8ac6d86e8a.tar.bz2
ice-61270a10f980933cf582edb766f10c8ac6d86e8a.tar.xz
ice-61270a10f980933cf582edb766f10c8ac6d86e8a.zip
merging IceBridge into master
Diffstat (limited to 'python/test/Ice/acm/TestI.py')
-rw-r--r--python/test/Ice/acm/TestI.py42
1 files changed, 20 insertions, 22 deletions
diff --git a/python/test/Ice/acm/TestI.py b/python/test/Ice/acm/TestI.py
index 10565ca9540..41f5afe93eb 100644
--- a/python/test/Ice/acm/TestI.py
+++ b/python/test/Ice/acm/TestI.py
@@ -9,6 +9,21 @@
import Ice, Test, threading
+class ConnectionCallbackI():
+ def __init__(self):
+ self.m = threading.Condition()
+ self.count = 0
+
+ def heartbeat(self, con):
+ with self.m:
+ self.count += 1
+ self.m.notifyAll()
+
+ def waitForCount(self, count):
+ with self.m:
+ while self.count < count:
+ self.m.wait()
+
class RemoteCommunicatorI(Test._RemoteCommunicatorDisp):
def createObjectAdapter(self, timeout, close, heartbeat, current=None):
com = current.adapter.getCommunicator()
@@ -68,26 +83,9 @@ class TestIntfI(Test._TestIntfDisp):
with self.m:
self.m.notifyAll()
- def waitForHeartbeat(self, count, current=None):
-
- class ConnectionCallbackI():
-
- def __init__(self):
- self.m = threading.Condition()
- self.count = 0
-
- def heartbeat(self, con):
- with self.m:
- self.count -= 1
- self.m.notifyAll()
-
- def waitForCount(self, count):
- with self.m:
- self.count = count
- while self.count > 0:
- self.m.wait()
-
- callback = ConnectionCallbackI()
- current.con.setHeartbeatCallback(lambda con: callback.heartbeat(con))
- callback.waitForCount(2)
+ def startHeartbeatCount(self, current=None):
+ self.callback = ConnectionCallbackI()
+ current.con.setHeartbeatCallback(lambda con: self.callback.heartbeat(con))
+ def waitForHeartbeatCount(self, count, current=None):
+ self.callback.waitForCount(2)