summaryrefslogtreecommitdiff
path: root/python/test/Ice/acm/TestI.py
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2015-03-21 15:35:40 -0230
committerMatthew Newhook <matthew@zeroc.com>2015-03-21 15:35:40 -0230
commit630a37d2fe66f24518299e705f958b571803c522 (patch)
tree969723791bdc4d73bb099c19d45554d0ca241ad9 /python/test/Ice/acm/TestI.py
parentFix some README.md markdown formatting (diff)
downloadice-630a37d2fe66f24518299e705f958b571803c522.tar.bz2
ice-630a37d2fe66f24518299e705f958b571803c522.tar.xz
ice-630a37d2fe66f24518299e705f958b571803c522.zip
py -> python
rb -> ruby objc -> objective-c cs -> csharp
Diffstat (limited to 'python/test/Ice/acm/TestI.py')
-rw-r--r--python/test/Ice/acm/TestI.py78
1 files changed, 78 insertions, 0 deletions
diff --git a/python/test/Ice/acm/TestI.py b/python/test/Ice/acm/TestI.py
new file mode 100644
index 00000000000..6b63fd26d07
--- /dev/null
+++ b/python/test/Ice/acm/TestI.py
@@ -0,0 +1,78 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import Ice, Test, threading
+
+class RemoteCommunicatorI(Test.RemoteCommunicator):
+ def createObjectAdapter(self, timeout, close, heartbeat, current=None):
+ com = current.adapter.getCommunicator()
+ properties = com.getProperties()
+ protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+
+ name = Ice.generateUUID()
+ if timeout >= 0:
+ properties.setProperty(name + ".ACM.Timeout", str(timeout))
+ if close >= 0:
+ properties.setProperty(name + ".ACM.Close", str(close))
+ if heartbeat >= 0:
+ properties.setProperty(name + ".ACM.Heartbeat", str(heartbeat))
+ properties.setProperty(name + ".ThreadPool.Size", "2")
+ adapter = com.createObjectAdapterWithEndpoints(name, protocol + " -h 127.0.0.1")
+ return Test.RemoteObjectAdapterPrx.uncheckedCast(current.adapter.addWithUUID(RemoteObjectAdapterI(adapter)))
+
+ def shutdown(self, current=None):
+ current.adapter.getCommunicator().shutdown()
+
+class RemoteObjectAdapterI(Test.RemoteObjectAdapter):
+ def __init__(self, adapter):
+ self._adapter = adapter
+ self._testIntf = Test.TestIntfPrx.uncheckedCast(adapter.add(TestIntfI(),
+ adapter.getCommunicator().stringToIdentity("test")))
+ adapter.activate()
+
+ def getTestIntf(self, current=None):
+ return self._testIntf
+
+ def activate(self, current=None):
+ self._adapter.activate()
+
+ def hold(self, current=None):
+ self._adapter.hold()
+
+ def deactivate(self, current=None):
+ try:
+ self._adapter.destroy()
+ except Ice.ObjectAdapterDeactivatedException:
+ pass
+
+class TestIntfI(Test.TestIntf):
+ def __init__(self):
+ self.m = threading.Condition()
+
+ def sleep(self, delay, current=None):
+ self.m.acquire()
+ try:
+ self.m.wait(delay)
+ finally:
+ self.m.release()
+
+ def sleepAndHold(self, delay, current=None):
+ self.m.acquire()
+ try:
+ current.adapter.hold()
+ self.m.wait(delay)
+ finally:
+ self.m.release()
+
+ def interruptSleep(self, delay, current=None):
+ self.m.acquire()
+ try:
+ self.m.notifyAll()
+ finally:
+ self.m.release()