summaryrefslogtreecommitdiff
path: root/py/test/Ice/objects/Server.py
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2004-09-01 23:31:53 +0000
committerMark Spruiell <mes@zeroc.com>2004-09-01 23:31:53 +0000
commit1db674bef8908186760e6b3f22cf3875bd445af0 (patch)
tree20a18397cae95f2213cfabc797b3f71afc63ec1e /py/test/Ice/objects/Server.py
parentremove collocated flag (diff)
downloadice-1db674bef8908186760e6b3f22cf3875bd445af0.tar.bz2
ice-1db674bef8908186760e6b3f22cf3875bd445af0.tar.xz
ice-1db674bef8908186760e6b3f22cf3875bd445af0.zip
initial check-in
Diffstat (limited to 'py/test/Ice/objects/Server.py')
-rw-r--r--py/test/Ice/objects/Server.py95
1 files changed, 95 insertions, 0 deletions
diff --git a/py/test/Ice/objects/Server.py b/py/test/Ice/objects/Server.py
new file mode 100644
index 00000000000..b49f7aee30d
--- /dev/null
+++ b/py/test/Ice/objects/Server.py
@@ -0,0 +1,95 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2004 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 sys, Ice
+
+Ice.loadSlice('Test.ice')
+import Test, TestI
+
+class InitialI(Test.Initial):
+ def __init__(self, adapter):
+ self._adapter = adapter
+ self._b1 = TestI.BI()
+ self._b2 = TestI.BI()
+ self._c = TestI.CI()
+ self._d = TestI.DI()
+
+ self._b1.theA = self._b2 # Cyclic reference to another B
+ self._b1.theB = self._b1 # Self reference.
+ self._b1.theC = None # Null reference.
+
+ self._b2.theA = self._b2 # Self reference, using base.
+ self._b2.theB = self._b1 # Cyclic reference to another B
+ self._b2.theC = self._c # Cyclic reference to a C.
+
+ self._c.theB = self._b2 # Cyclic reference to a B.
+
+ self._d.theA = self._b1 # Reference to a B.
+ self._d.theB = self._b2 # Reference to a B.
+ self._d.theC = None # Reference to a C.
+
+ def shutdown(self, current=None):
+ self._adapter.getCommunicator().shutdown()
+
+ def getB1(self, current=None):
+ self._b1.preMarshalInvoked = False
+ self._b2.preMarshalInvoked = False
+ self._c.preMarshalInvoked = False
+ return self._b1
+
+ def getB2(self, current=None):
+ self._b1.preMarshalInvoked = False
+ self._b2.preMarshalInvoked = False
+ self._c.preMarshalInvoked = False
+ return self._b2
+
+ def getC(self, current=None):
+ self._b1.preMarshalInvoked = False
+ self._b2.preMarshalInvoked = False
+ self._c.preMarshalInvoked = False
+ return self._c
+
+ def getD(self, current=None):
+ self._b1.preMarshalInvoked = False
+ self._b2.preMarshalInvoked = False
+ self._c.preMarshalInvoked = False
+ self._d.preMarshalInvoked = False
+ return self._d
+
+ def getAll(self, current=None):
+ self._b1.preMarshalInvoked = False
+ self._b2.preMarshalInvoked = False
+ self._c.preMarshalInvoked = False
+ self._d.preMarshalInvoked = False
+ return (self._b1, self._b2, self._c, self._d)
+
+def run(args, communicator):
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ initial = InitialI(adapter)
+ adapter.add(initial, Ice.stringToIdentity("initial"))
+ adapter.activate()
+ communicator.waitForShutdown()
+ return True
+
+try:
+ communicator = Ice.initialize(sys.argv)
+ status = run(sys.argv, communicator)
+except Ice.Exception, ex:
+ print ex
+ status = False
+
+if communicator:
+ try:
+ communicator.destroy()
+ except Ice.Exception, ex:
+ print ex
+ status = False
+
+sys.exit(not status)