summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2015-09-14 15:43:34 +0200
committerBenoit Foucher <benoit@zeroc.com>2015-09-14 15:43:34 +0200
commit13bed6dec104b53fadf723aead0dc15dc3f2afd8 (patch)
treed6401dbe7d70d65e04e448439e4056c1fa4d7e8c /python
parentRemoved ARM configuraton from WinRT testsuite solutions (diff)
downloadice-13bed6dec104b53fadf723aead0dc15dc3f2afd8.tar.bz2
ice-13bed6dec104b53fadf723aead0dc15dc3f2afd8.tar.xz
ice-13bed6dec104b53fadf723aead0dc15dc3f2afd8.zip
Fixed ICE-6812 - JavaScript ACM monitor bug
Diffstat (limited to 'python')
-rw-r--r--python/test/Ice/acm/AllTests.py16
-rw-r--r--python/test/Ice/acm/Test.ice1
-rw-r--r--python/test/Ice/acm/TestI.py33
3 files changed, 43 insertions, 7 deletions
diff --git a/python/test/Ice/acm/AllTests.py b/python/test/Ice/acm/AllTests.py
index 6cfae071a24..60844870090 100644
--- a/python/test/Ice/acm/AllTests.py
+++ b/python/test/Ice/acm/AllTests.py
@@ -349,26 +349,28 @@ def allTests(communicator):
class SetACMTest(TestCase):
def __init__(self, com):
TestCase.__init__(self, "setACM/getACM", com)
- self.setClientACM(15, 4, 2)
+ self.setClientACM(15, 4, 0)
def runTestCase(self, adapter, proxy):
acm = proxy.ice_getCachedConnection().getACM()
test(acm.timeout == 15)
test(acm.close == Ice.ACMClose.CloseOnIdleForceful)
- test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOnIdle)
+ test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOff)
proxy.ice_getCachedConnection().setACM(Ice.Unset, Ice.Unset, Ice.Unset)
acm = proxy.ice_getCachedConnection().getACM()
test(acm.timeout == 15)
test(acm.close == Ice.ACMClose.CloseOnIdleForceful)
- test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOnIdle)
+ test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOff)
- proxy.ice_getCachedConnection().setACM(20, Ice.ACMClose.CloseOnInvocationAndIdle,
- Ice.ACMHeartbeat.HeartbeatOnInvocation)
+ proxy.ice_getCachedConnection().setACM(1, Ice.ACMClose.CloseOnInvocationAndIdle,
+ Ice.ACMHeartbeat.HeartbeatAlways)
acm = proxy.ice_getCachedConnection().getACM()
- test(acm.timeout == 20)
+ test(acm.timeout == 1)
test(acm.close == Ice.ACMClose.CloseOnInvocationAndIdle)
- test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOnInvocation)
+ test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatAlways)
+
+ proxy.waitForHeartbeat(2)
tests.append(InvocationHeartbeatTest(com))
tests.append(InvocationHeartbeatOnHoldTest(com))
diff --git a/python/test/Ice/acm/Test.ice b/python/test/Ice/acm/Test.ice
index b1c8b749109..0c4c3b105ca 100644
--- a/python/test/Ice/acm/Test.ice
+++ b/python/test/Ice/acm/Test.ice
@@ -17,6 +17,7 @@ interface TestIntf
void sleep(int seconds);
void sleepAndHold(int seconds);
void interruptSleep();
+ void waitForHeartbeat(int count);
};
interface RemoteObjectAdapter
diff --git a/python/test/Ice/acm/TestI.py b/python/test/Ice/acm/TestI.py
index 6b63fd26d07..024899b8640 100644
--- a/python/test/Ice/acm/TestI.py
+++ b/python/test/Ice/acm/TestI.py
@@ -76,3 +76,36 @@ class TestIntfI(Test.TestIntf):
self.m.notifyAll()
finally:
self.m.release()
+
+ def waitForHeartbeat(self, count, current=None):
+
+ class ConnectionCallbackI(Ice.ConnectionCallback):
+
+ def __init__(self):
+ self.m = threading.Condition()
+ self.count = 0
+
+ def heartbeat(self, con):
+ self.m.acquire()
+ try:
+ self.count -= 1
+ self.m.notifyAll()
+ finally:
+ self.m.release()
+
+ def closed(self, con):
+ pass
+
+ def waitForCount(self, count):
+ self.m.acquire()
+ self.count = count
+ try:
+ while self.count > 0:
+ self.m.wait()
+ finally:
+ self.m.release()
+
+ callback = ConnectionCallbackI()
+ current.con.setCallback(callback)
+ callback.waitForCount(2)
+