summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2005-09-14 19:44:51 +0000
committerMark Spruiell <mes@zeroc.com>2005-09-14 19:44:51 +0000
commit48918d87206d3cc754f5741f9b0f844c0799ca3a (patch)
tree74189a0639c5dce5bd39a0ddbd7c6301ca6d44d2 /py
parentfix for bug 282 (diff)
downloadice-48918d87206d3cc754f5741f9b0f844c0799ca3a.tar.bz2
ice-48918d87206d3cc754f5741f9b0f844c0799ca3a.tar.xz
ice-48918d87206d3cc754f5741f9b0f844c0799ca3a.zip
adding collocated tests
Diffstat (limited to 'py')
-rw-r--r--py/config/TestUtil.py31
-rw-r--r--py/test/Ice/adapterDeactivation/AllTests.py49
-rw-r--r--py/test/Ice/adapterDeactivation/Client.py38
-rw-r--r--py/test/Ice/adapterDeactivation/Collocated.py42
-rw-r--r--py/test/Ice/adapterDeactivation/Server.py50
-rw-r--r--py/test/Ice/adapterDeactivation/TestI.py58
-rwxr-xr-xpy/test/Ice/adapterDeactivation/run.py1
-rw-r--r--py/test/Ice/exceptions/AllTests.py5
-rw-r--r--py/test/Ice/exceptions/Client.py4
-rw-r--r--py/test/Ice/exceptions/Collocated.py54
-rw-r--r--py/test/Ice/exceptions/Server.py87
-rw-r--r--py/test/Ice/exceptions/TestI.py94
-rwxr-xr-xpy/test/Ice/exceptions/run.py2
-rw-r--r--py/test/Ice/facets/AllTests.py5
-rw-r--r--py/test/Ice/facets/Client.py5
-rw-r--r--py/test/Ice/facets/Collocated.py58
-rw-r--r--py/test/Ice/facets/Server.py49
-rw-r--r--py/test/Ice/facets/TestI.py52
-rwxr-xr-xpy/test/Ice/facets/run.py1
-rw-r--r--py/test/Ice/inheritance/AllTests.py5
-rw-r--r--py/test/Ice/inheritance/Client.py4
-rw-r--r--py/test/Ice/inheritance/Collocated.py52
-rw-r--r--py/test/Ice/inheritance/Server.py79
-rw-r--r--py/test/Ice/inheritance/TestI.py82
-rwxr-xr-xpy/test/Ice/inheritance/run.py1
-rw-r--r--py/test/Ice/objects/AllTests.py28
-rw-r--r--py/test/Ice/objects/Client.py23
-rw-r--r--py/test/Ice/objects/Collocated.py55
-rw-r--r--py/test/Ice/objects/Server.py59
-rw-r--r--py/test/Ice/objects/TestI.py59
-rwxr-xr-xpy/test/Ice/objects/run.py1
-rw-r--r--py/test/Ice/operations/AllTests.py15
-rw-r--r--py/test/Ice/operations/Client.py14
-rw-r--r--py/test/Ice/operations/Collocated.py63
-rw-r--r--py/test/Ice/operations/Server.py178
-rw-r--r--py/test/Ice/operations/TestI.py179
-rwxr-xr-xpy/test/Ice/operations/run.py2
37 files changed, 1005 insertions, 579 deletions
diff --git a/py/config/TestUtil.py b/py/config/TestUtil.py
index a1c5c0dd124..c8bcfaa4a5d 100644
--- a/py/config/TestUtil.py
+++ b/py/config/TestUtil.py
@@ -225,10 +225,13 @@ commonServerOptions = " --Ice.PrintProcessId --Ice.PrintAdapterReady --Ice.NullH
" --Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=3" + \
" --Ice.ThreadPool.Server.SizeWarn=0"
+commonCollocatedOptions = " --Ice.ThreadPool.Server.Size=1 --Ice.ThreadPool.Server.SizeMax=3" + \
+ " --Ice.ThreadPool.Server.SizeWarn=0"
+
clientOptions = clientProtocol + defaultHost + commonClientOptions
serverOptions = serverProtocol + defaultHost + commonServerOptions
clientServerOptions = clientServerProtocol + defaultHost + commonServerOptions
-collocatedOptions = clientServerProtocol + defaultHost
+collocatedOptions = clientServerProtocol + defaultHost + commonCollocatedOptions
def clientServerTestWithOptionsAndNames(name, additionalServerOptions, additionalClientOptions, \
serverName, clientName):
@@ -308,6 +311,32 @@ def mixedClientServerTest(name):
mixedClientServerTestWithOptions(name, "", "")
+def collocatedTestWithOptions(name, additionalOptions):
+
+ testdir = os.path.join(toplevel, "test", name)
+ collocated = "Collocated.py"
+
+ cwd = os.getcwd()
+ os.chdir(testdir)
+
+ print "starting collocated...",
+ collocatedPipe = os.popen("python " + collocated + collocatedOptions + additionalOptions + " 2>&1")
+ print "ok"
+
+ printOutputFromPipe(collocatedPipe)
+
+ collocatedStatus = collocatedPipe.close()
+
+ if collocatedStatus:
+ killServers()
+ sys.exit(1)
+
+ os.chdir(cwd)
+
+def collocatedTest(name):
+
+ collocatedTestWithOptions(name, "")
+
def cleanDbDir(path):
files = os.listdir(path)
diff --git a/py/test/Ice/adapterDeactivation/AllTests.py b/py/test/Ice/adapterDeactivation/AllTests.py
new file mode 100644
index 00000000000..4c78daac146
--- /dev/null
+++ b/py/test/Ice/adapterDeactivation/AllTests.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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, Test
+
+def test(b):
+ if not b:
+ raise RuntimeError('test assertion failed')
+
+def allTests(communicator):
+ print "testing stringToProxy... ",
+ sys.stdout.flush()
+ base = communicator.stringToProxy("test:default -p 12345 -t 10000")
+ test(base)
+ print "ok"
+
+ print "testing checked cast... ",
+ sys.stdout.flush()
+ obj = Test.TestIntfPrx.checkedCast(base)
+ test(obj)
+ test(obj == base)
+ print "ok"
+
+ print "creating/activating/deactivating object adapter in one operation... ",
+ sys.stdout.flush()
+ obj.transient()
+ print "ok"
+
+ print "deactivating object adapter in the server... ",
+ sys.stdout.flush()
+ obj.deactivate()
+ print "ok"
+
+ print "testing whether server is gone... ",
+ sys.stdout.flush()
+ try:
+ obj.ice_ping()
+ test(False)
+ except Ice.LocalException:
+ print "ok"
+
+ return obj
diff --git a/py/test/Ice/adapterDeactivation/Client.py b/py/test/Ice/adapterDeactivation/Client.py
index 5bcfa0bf5b9..db2c531586f 100644
--- a/py/test/Ice/adapterDeactivation/Client.py
+++ b/py/test/Ice/adapterDeactivation/Client.py
@@ -22,45 +22,11 @@ sys.path.insert(0, os.path.join(toplevel, "lib"))
import Ice
Ice.loadSlice('Test.ice')
-import Test
-
-def test(b):
- if not b:
- raise RuntimeError('test assertion failed')
+import Test, AllTests
class TestClient(Ice.Application):
def run(self, args):
- print "testing stringToProxy... ",
- sys.stdout.flush()
- base = self.communicator().stringToProxy("test:default -p 12345 -t 10000")
- test(base)
- print "ok"
-
- print "testing checked cast... ",
- sys.stdout.flush()
- obj = Test.TestIntfPrx.checkedCast(base)
- test(obj)
- test(obj == base)
- print "ok"
-
- print "creating/activating/deactivating object adapter in one operation... ",
- sys.stdout.flush()
- obj.transient()
- print "ok"
-
- print "deactivating object adapter in the server... ",
- sys.stdout.flush()
- obj.deactivate()
- print "ok"
-
- print "testing whether server is gone... ",
- sys.stdout.flush()
- try:
- obj.ice_ping()
- test(False)
- except Ice.LocalException:
- print "ok"
-
+ AllTests.allTests(self.communicator())
return 0
app = TestClient()
diff --git a/py/test/Ice/adapterDeactivation/Collocated.py b/py/test/Ice/adapterDeactivation/Collocated.py
new file mode 100644
index 00000000000..c0f4fbd3c72
--- /dev/null
+++ b/py/test/Ice/adapterDeactivation/Collocated.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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 os, sys, traceback, time
+
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "python", "Ice.py")):
+ break
+else:
+ raise "can't find toplevel directory!"
+
+sys.path.insert(0, os.path.join(toplevel, "python"))
+sys.path.insert(0, os.path.join(toplevel, "lib"))
+
+import Ice
+Ice.loadSlice('Test.ice')
+import Test, TestI, AllTests
+
+class TestServer(Ice.Application):
+ def run(self, args):
+ self.communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
+ adapter = self.communicator().createObjectAdapter("TestAdapter")
+ locator = TestI.ServantLocatorI()
+
+ adapter.addServantLocator(locator, "")
+ adapter.activate()
+
+ AllTests.allTests(self.communicator())
+
+ adapter.waitForDeactivate()
+ return 0
+
+app = TestServer()
+sys.exit(app.main(sys.argv))
diff --git a/py/test/Ice/adapterDeactivation/Server.py b/py/test/Ice/adapterDeactivation/Server.py
index 51df7f9629a..da6189ce0e0 100644
--- a/py/test/Ice/adapterDeactivation/Server.py
+++ b/py/test/Ice/adapterDeactivation/Server.py
@@ -22,59 +22,13 @@ sys.path.insert(0, os.path.join(toplevel, "lib"))
import Ice
Ice.loadSlice('Test.ice')
-import Test
-
-def test(b):
- if not b:
- raise RuntimeError('test assertion failed')
-
-class TestI(Test.TestIntf):
- def transient(self, current=None):
- communicator = current.adapter.getCommunicator()
- adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999")
- adapter.activate()
- adapter.deactivate()
- adapter.waitForDeactivate()
-
- def deactivate(self, current=None):
- current.adapter.deactivate()
- time.sleep(1)
-
-class CookieI(Test.Cookie):
- def message(self):
- return 'blahblah'
-
-class ServantLocatorI(Ice.ServantLocator):
- def __init__(self):
- self._deactivated = False
-
- def __del__(self):
- test(self._deactivated)
-
- def locate(self, current):
- test(not self._deactivated)
-
- test(current.id.category == '')
- test(current.id.name == 'test')
-
- return (TestI(), CookieI())
-
- def finished(self, current, servant, cookie):
- test(not self._deactivated)
-
- test(isinstance(cookie, Test.Cookie))
- test(cookie.message() == 'blahblah')
-
- def deactivate(self, category):
- test(not self._deactivated)
-
- self._deactivated = True
+import Test, TestI
class TestServer(Ice.Application):
def run(self, args):
self.communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
adapter = self.communicator().createObjectAdapter("TestAdapter")
- locator = ServantLocatorI()
+ locator = TestI.ServantLocatorI()
adapter.addServantLocator(locator, "")
adapter.activate()
diff --git a/py/test/Ice/adapterDeactivation/TestI.py b/py/test/Ice/adapterDeactivation/TestI.py
new file mode 100644
index 00000000000..75dc534d720
--- /dev/null
+++ b/py/test/Ice/adapterDeactivation/TestI.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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 os, sys, traceback, time
+import Ice, Test
+
+def test(b):
+ if not b:
+ raise RuntimeError('test assertion failed')
+
+class TestI(Test.TestIntf):
+ def transient(self, current=None):
+ communicator = current.adapter.getCommunicator()
+ adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999")
+ adapter.activate()
+ adapter.deactivate()
+ adapter.waitForDeactivate()
+
+ def deactivate(self, current=None):
+ current.adapter.deactivate()
+ time.sleep(1)
+
+class CookieI(Test.Cookie):
+ def message(self):
+ return 'blahblah'
+
+class ServantLocatorI(Ice.ServantLocator):
+ def __init__(self):
+ self._deactivated = False
+
+ def __del__(self):
+ test(self._deactivated)
+
+ def locate(self, current):
+ test(not self._deactivated)
+
+ test(current.id.category == '')
+ test(current.id.name == 'test')
+
+ return (TestI(), CookieI())
+
+ def finished(self, current, servant, cookie):
+ test(not self._deactivated)
+
+ test(isinstance(cookie, Test.Cookie))
+ test(cookie.message() == 'blahblah')
+
+ def deactivate(self, category):
+ test(not self._deactivated)
+
+ self._deactivated = True
diff --git a/py/test/Ice/adapterDeactivation/run.py b/py/test/Ice/adapterDeactivation/run.py
index b1c61848f24..280008e1ce8 100755
--- a/py/test/Ice/adapterDeactivation/run.py
+++ b/py/test/Ice/adapterDeactivation/run.py
@@ -23,4 +23,5 @@ import TestUtil
name = os.path.join("Ice", "adapterDeactivation")
TestUtil.clientServerTest(name)
+TestUtil.collocatedTest(name)
sys.exit(0)
diff --git a/py/test/Ice/exceptions/AllTests.py b/py/test/Ice/exceptions/AllTests.py
index d679e949976..eec9a016f0f 100644
--- a/py/test/Ice/exceptions/AllTests.py
+++ b/py/test/Ice/exceptions/AllTests.py
@@ -8,10 +8,7 @@
#
# **********************************************************************
-import Ice, threading, sys
-
-Ice.loadSlice('Test.ice')
-import Test
+import Ice, Test, threading, sys
def test(b):
if not b:
diff --git a/py/test/Ice/exceptions/Client.py b/py/test/Ice/exceptions/Client.py
index 4bbadf909b0..7fdec9c5781 100644
--- a/py/test/Ice/exceptions/Client.py
+++ b/py/test/Ice/exceptions/Client.py
@@ -20,7 +20,9 @@ else:
sys.path.insert(0, os.path.join(toplevel, "python"))
sys.path.insert(0, os.path.join(toplevel, "lib"))
-import Ice, AllTests
+import Ice
+Ice.loadSlice('Test.ice')
+import AllTests
def run(args, communicator):
thrower = AllTests.allTests(communicator)
diff --git a/py/test/Ice/exceptions/Collocated.py b/py/test/Ice/exceptions/Collocated.py
new file mode 100644
index 00000000000..0d60f411c80
--- /dev/null
+++ b/py/test/Ice/exceptions/Collocated.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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 os, sys, traceback
+
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "python", "Ice.py")):
+ break
+else:
+ raise "can't find toplevel directory!"
+
+sys.path.insert(0, os.path.join(toplevel, "python"))
+sys.path.insert(0, os.path.join(toplevel, "lib"))
+
+import Ice
+Ice.loadSlice('Test.ice')
+import Test, TestI, AllTests
+
+def run(args, communicator):
+ properties = communicator.getProperties()
+ properties.setProperty("Ice.Warn.Dispatch", "0")
+ properties.setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ object = TestI.ThrowerI(adapter)
+ adapter.add(object, Ice.stringToIdentity("thrower"))
+ adapter.activate()
+
+ thrower = AllTests.allTests(communicator)
+
+ return True
+
+try:
+ communicator = Ice.initialize(sys.argv)
+ status = run(sys.argv, communicator)
+except:
+ traceback.print_exc()
+ status = False
+
+if communicator:
+ try:
+ communicator.destroy()
+ except:
+ traceback.print_exc()
+ status = False
+
+sys.exit(not status)
diff --git a/py/test/Ice/exceptions/Server.py b/py/test/Ice/exceptions/Server.py
index bae725dc1bf..ee6fb861fcc 100644
--- a/py/test/Ice/exceptions/Server.py
+++ b/py/test/Ice/exceptions/Server.py
@@ -22,97 +22,14 @@ sys.path.insert(0, os.path.join(toplevel, "lib"))
import Ice
Ice.loadSlice('Test.ice')
-import Test
-
-class ThrowerI(Test.Thrower):
- def __init__(self, adapter):
- self._adapter = adapter
-
- def shutdown(self, current=None):
- self._adapter.getCommunicator().shutdown()
-
- def supportsUndeclaredExceptions(self, current=None):
- return True
-
- def supportsAssertException(self, current=None):
- return False
-
- def throwAasA(self, a, current=None):
- ex = Test.A()
- ex.aMem = a
- raise ex
-
- def throwAorDasAorD(self, a, current=None):
- if a > 0:
- ex = Test.A()
- ex.aMem = a
- raise ex
- else:
- ex = Test.D()
- ex.dMem = a
- raise ex
-
- def throwBasA(self, a, b, current=None):
- self.throwBasB(a, b, current)
-
- def throwCasA(self, a, b, c, current=None):
- self.throwCasC(a, b, c, current)
-
- def throwBasB(self, a, b, current=None):
- ex = Test.B()
- ex.aMem = a
- ex.bMem = b
- raise ex
-
- def throwCasB(self, a, b, c, current=None):
- self.throwCasC(a, b, c, current)
-
- def throwCasC(self, a, b, c, current=None):
- ex = Test.C()
- ex.aMem = a
- ex.bMem = b
- ex.cMem = c
- raise ex
-
- def throwModA(self, a, a2, current=None):
- ex = Test.Mod.A()
- ex.aMem = a
- ex.a2Mem = a2
- raise ex
-
- def throwUndeclaredA(self, a, current=None):
- ex = Test.A()
- ex.aMem = a
- raise ex
-
- def throwUndeclaredB(self, a, b, current=None):
- ex = Test.B()
- ex.aMem = a
- ex.bMem = b
- raise ex
-
- def throwUndeclaredC(self, a, b, c, current=None):
- ex = Test.C()
- ex.aMem = a
- ex.bMem = b
- ex.cMem = c
- raise ex
-
- def throwLocalException(self, current=None):
- raise Ice.TimeoutException()
-
- def throwNonIceException(self, current=None):
- raise RuntimeError("12345")
-
- def throwAssertException(self, current=None):
- raise RuntimeError("operation `throwAssertException' not supported")
+import Test, TestI
def run(args, communicator):
properties = communicator.getProperties()
properties.setProperty("Ice.Warn.Dispatch", "0")
properties.setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
adapter = communicator.createObjectAdapter("TestAdapter")
- object = ThrowerI(adapter)
+ object = TestI.ThrowerI(adapter)
adapter.add(object, Ice.stringToIdentity("thrower"))
adapter.activate()
communicator.waitForShutdown()
diff --git a/py/test/Ice/exceptions/TestI.py b/py/test/Ice/exceptions/TestI.py
new file mode 100644
index 00000000000..4708b8bf306
--- /dev/null
+++ b/py/test/Ice/exceptions/TestI.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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
+
+class ThrowerI(Test.Thrower):
+ def __init__(self, adapter):
+ self._adapter = adapter
+
+ def shutdown(self, current=None):
+ self._adapter.getCommunicator().shutdown()
+
+ def supportsUndeclaredExceptions(self, current=None):
+ return True
+
+ def supportsAssertException(self, current=None):
+ return False
+
+ def throwAasA(self, a, current=None):
+ ex = Test.A()
+ ex.aMem = a
+ raise ex
+
+ def throwAorDasAorD(self, a, current=None):
+ if a > 0:
+ ex = Test.A()
+ ex.aMem = a
+ raise ex
+ else:
+ ex = Test.D()
+ ex.dMem = a
+ raise ex
+
+ def throwBasA(self, a, b, current=None):
+ self.throwBasB(a, b, current)
+
+ def throwCasA(self, a, b, c, current=None):
+ self.throwCasC(a, b, c, current)
+
+ def throwBasB(self, a, b, current=None):
+ ex = Test.B()
+ ex.aMem = a
+ ex.bMem = b
+ raise ex
+
+ def throwCasB(self, a, b, c, current=None):
+ self.throwCasC(a, b, c, current)
+
+ def throwCasC(self, a, b, c, current=None):
+ ex = Test.C()
+ ex.aMem = a
+ ex.bMem = b
+ ex.cMem = c
+ raise ex
+
+ def throwModA(self, a, a2, current=None):
+ ex = Test.Mod.A()
+ ex.aMem = a
+ ex.a2Mem = a2
+ raise ex
+
+ def throwUndeclaredA(self, a, current=None):
+ ex = Test.A()
+ ex.aMem = a
+ raise ex
+
+ def throwUndeclaredB(self, a, b, current=None):
+ ex = Test.B()
+ ex.aMem = a
+ ex.bMem = b
+ raise ex
+
+ def throwUndeclaredC(self, a, b, c, current=None):
+ ex = Test.C()
+ ex.aMem = a
+ ex.bMem = b
+ ex.cMem = c
+ raise ex
+
+ def throwLocalException(self, current=None):
+ raise Ice.TimeoutException()
+
+ def throwNonIceException(self, current=None):
+ raise RuntimeError("12345")
+
+ def throwAssertException(self, current=None):
+ raise RuntimeError("operation `throwAssertException' not supported")
diff --git a/py/test/Ice/exceptions/run.py b/py/test/Ice/exceptions/run.py
index be8aafad276..51376f12695 100755
--- a/py/test/Ice/exceptions/run.py
+++ b/py/test/Ice/exceptions/run.py
@@ -26,4 +26,6 @@ print "tests with regular server."
TestUtil.clientServerTest(name)
print "tests with AMD server."
TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "ServerAMD.py", "Client.py")
+print "tests with collocated server."
+TestUtil.collocatedTest(name)
sys.exit(0)
diff --git a/py/test/Ice/facets/AllTests.py b/py/test/Ice/facets/AllTests.py
index 2254996af6d..94c949dbdc1 100644
--- a/py/test/Ice/facets/AllTests.py
+++ b/py/test/Ice/facets/AllTests.py
@@ -8,10 +8,7 @@
#
# **********************************************************************
-import Ice
-
-Ice.loadSlice('Test.ice')
-import Test
+import Ice, Test
def test(b):
if not b:
diff --git a/py/test/Ice/facets/Client.py b/py/test/Ice/facets/Client.py
index cdf74468347..8902e2fed1e 100644
--- a/py/test/Ice/facets/Client.py
+++ b/py/test/Ice/facets/Client.py
@@ -20,7 +20,10 @@ else:
sys.path.insert(0, os.path.join(toplevel, "python"))
sys.path.insert(0, os.path.join(toplevel, "lib"))
-import Ice, AllTests
+import Ice
+
+Ice.loadSlice('Test.ice')
+import AllTests
def run(args, communicator):
g = AllTests.allTests(communicator)
diff --git a/py/test/Ice/facets/Collocated.py b/py/test/Ice/facets/Collocated.py
new file mode 100644
index 00000000000..09ea18dfcd2
--- /dev/null
+++ b/py/test/Ice/facets/Collocated.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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 os, sys, traceback
+
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "python", "Ice.py")):
+ break
+else:
+ raise "can't find toplevel directory!"
+
+sys.path.insert(0, os.path.join(toplevel, "python"))
+sys.path.insert(0, os.path.join(toplevel, "lib"))
+
+import Ice
+Ice.loadSlice('Test.ice')
+import Test, TestI, AllTests
+
+def run(args, communicator):
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ d = TestI.DI()
+ adapter.add(d, Ice.stringToIdentity("d"))
+ adapter.addFacet(d, Ice.stringToIdentity("d"), "facetABCD")
+ f = TestI.FI()
+ adapter.addFacet(f, Ice.stringToIdentity("d"), "facetEF")
+ h = TestI.HI(communicator)
+ adapter.addFacet(h, Ice.stringToIdentity("d"), "facetGH")
+
+ adapter.activate()
+
+ AllTests.allTests(communicator)
+
+ return True
+
+try:
+ communicator = Ice.initialize(sys.argv)
+ status = run(sys.argv, communicator)
+except:
+ traceback.print_exc()
+ status = False
+
+if communicator:
+ try:
+ communicator.destroy()
+ except:
+ traceback.print_exc()
+ status = False
+
+sys.exit(not status)
diff --git a/py/test/Ice/facets/Server.py b/py/test/Ice/facets/Server.py
index 0dd9d526e56..efa87f17355 100644
--- a/py/test/Ice/facets/Server.py
+++ b/py/test/Ice/facets/Server.py
@@ -22,58 +22,17 @@ sys.path.insert(0, os.path.join(toplevel, "lib"))
import Ice
Ice.loadSlice('Test.ice')
-import Test
-
-class AI(Test.A):
- def callA(self, current=None):
- return "A"
-
-class BI(Test.B, AI):
- def callB(self, current=None):
- return "B"
-
-class CI(Test.C, AI):
- def callC(self, current=None):
- return "C"
-
-class DI(Test.D, BI, CI):
- def callD(self, current=None):
- return "D"
-
-class EI(Test.E):
- def callE(self, current=None):
- return "E"
-
-class FI(Test.F, EI):
- def callF(self, current=None):
- return "F"
-
-class GI(Test.G):
- def __init__(self, communicator):
- self._communicator = communicator
-
- def shutdown(self, current=None):
- self._communicator.shutdown()
-
- def callG(self, current=None):
- return "G"
-
-class HI(Test.H, GI):
- def __init__(self, communicator):
- GI.__init__(self, communicator)
-
- def callH(self, current=None):
- return "H"
+import Test, TestI
def run(args, communicator):
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
adapter = communicator.createObjectAdapter("TestAdapter")
- d = DI()
+ d = TestI.DI()
adapter.add(d, Ice.stringToIdentity("d"))
adapter.addFacet(d, Ice.stringToIdentity("d"), "facetABCD")
- f = FI()
+ f = TestI.FI()
adapter.addFacet(f, Ice.stringToIdentity("d"), "facetEF")
- h = HI(communicator)
+ h = TestI.HI(communicator)
adapter.addFacet(h, Ice.stringToIdentity("d"), "facetGH")
adapter.activate()
diff --git a/py/test/Ice/facets/TestI.py b/py/test/Ice/facets/TestI.py
new file mode 100644
index 00000000000..66157cda131
--- /dev/null
+++ b/py/test/Ice/facets/TestI.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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 Test
+
+class AI(Test.A):
+ def callA(self, current=None):
+ return "A"
+
+class BI(Test.B, AI):
+ def callB(self, current=None):
+ return "B"
+
+class CI(Test.C, AI):
+ def callC(self, current=None):
+ return "C"
+
+class DI(Test.D, BI, CI):
+ def callD(self, current=None):
+ return "D"
+
+class EI(Test.E):
+ def callE(self, current=None):
+ return "E"
+
+class FI(Test.F, EI):
+ def callF(self, current=None):
+ return "F"
+
+class GI(Test.G):
+ def __init__(self, communicator):
+ self._communicator = communicator
+
+ def shutdown(self, current=None):
+ self._communicator.shutdown()
+
+ def callG(self, current=None):
+ return "G"
+
+class HI(Test.H, GI):
+ def __init__(self, communicator):
+ GI.__init__(self, communicator)
+
+ def callH(self, current=None):
+ return "H"
diff --git a/py/test/Ice/facets/run.py b/py/test/Ice/facets/run.py
index bfa4e195d91..de41c146a2a 100755
--- a/py/test/Ice/facets/run.py
+++ b/py/test/Ice/facets/run.py
@@ -23,4 +23,5 @@ import TestUtil
name = os.path.join("Ice", "facets")
TestUtil.clientServerTest(name)
+TestUtil.collocatedTest(name)
sys.exit(0)
diff --git a/py/test/Ice/inheritance/AllTests.py b/py/test/Ice/inheritance/AllTests.py
index 70afedcd5f8..2f057380696 100644
--- a/py/test/Ice/inheritance/AllTests.py
+++ b/py/test/Ice/inheritance/AllTests.py
@@ -8,10 +8,7 @@
#
# **********************************************************************
-import Ice
-
-Ice.loadSlice('Test.ice')
-import Test
+import Ice, Test
def test(b):
if not b:
diff --git a/py/test/Ice/inheritance/Client.py b/py/test/Ice/inheritance/Client.py
index b0f7ae4b55f..007159c601d 100644
--- a/py/test/Ice/inheritance/Client.py
+++ b/py/test/Ice/inheritance/Client.py
@@ -20,7 +20,9 @@ else:
sys.path.insert(0, os.path.join(toplevel, "python"))
sys.path.insert(0, os.path.join(toplevel, "lib"))
-import Ice, AllTests
+import Ice
+Ice.loadSlice('Test.ice')
+import AllTests
def run(args, communicator):
initial = AllTests.allTests(communicator)
diff --git a/py/test/Ice/inheritance/Collocated.py b/py/test/Ice/inheritance/Collocated.py
new file mode 100644
index 00000000000..df62db9e9c9
--- /dev/null
+++ b/py/test/Ice/inheritance/Collocated.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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 os, sys, traceback
+
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "python", "Ice.py")):
+ break
+else:
+ raise "can't find toplevel directory!"
+
+sys.path.insert(0, os.path.join(toplevel, "python"))
+sys.path.insert(0, os.path.join(toplevel, "lib"))
+
+import Ice
+Ice.loadSlice('Test.ice')
+import Test, TestI, AllTests
+
+def run(args, communicator):
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ object = TestI.InitialI(adapter)
+ adapter.add(object, Ice.stringToIdentity("initial"))
+ adapter.activate()
+
+ AllTests.allTests(communicator)
+
+ return True
+
+try:
+ communicator = Ice.initialize(sys.argv)
+ status = run(sys.argv, communicator)
+except:
+ traceback.print_exc()
+ status = False
+
+if communicator:
+ try:
+ communicator.destroy()
+ except:
+ traceback.print_exc()
+ status = False
+
+sys.exit(not status)
diff --git a/py/test/Ice/inheritance/Server.py b/py/test/Ice/inheritance/Server.py
index cae0c8b16ab..349ca7823f7 100644
--- a/py/test/Ice/inheritance/Server.py
+++ b/py/test/Ice/inheritance/Server.py
@@ -22,87 +22,12 @@ sys.path.insert(0, os.path.join(toplevel, "lib"))
import Ice
Ice.loadSlice('Test.ice')
-import Test
-
-def test(b):
- if not b:
- raise RuntimeError('test assertion failed')
-
-class CAI(Test.MA.CA):
- def caop(self, p, current=None):
- return p
-
-class CBI(Test.MB.CB, CAI):
- def cbop(self, p, current=None):
- return p
-
-class CCI(Test.MA.CC, CBI):
- def ccop(self, p, current=None):
- return p
-
-class IAI(Test.MA.IA):
- def iaop(self, p, current=None):
- return p
-
-class IB1I(Test.MB.IB1, IAI):
- def ib1op(self, p, current=None):
- return p
-
-class IB2I(Test.MB.IB2, IAI):
- def ib2op(self, p, current=None):
- return p
-
-class ICI(Test.MA.IC, IB1I, IB2I):
- def icop(self, p, current=None):
- return p
-
-class CDI(Test.MA.CD, CCI, IB1I, IB2I):
- def cdop(self, p, current=None):
- return p
-
-class InitialI(Test.Initial):
- def __init__(self, adapter):
- self._adapter = adapter
- self._ca = Test.MA.CAPrx.uncheckedCast(self._adapter.addWithUUID(CAI()))
- self._cb = Test.MB.CBPrx.uncheckedCast(self._adapter.addWithUUID(CBI()))
- self._cc = Test.MA.CCPrx.uncheckedCast(self._adapter.addWithUUID(CCI()))
- self._cd = Test.MA.CDPrx.uncheckedCast(self._adapter.addWithUUID(CDI()))
- self._ia = Test.MA.IAPrx.uncheckedCast(self._adapter.addWithUUID(IAI()))
- self._ib1 = Test.MB.IB1Prx.uncheckedCast(self._adapter.addWithUUID(IB1I()))
- self._ib2 = Test.MB.IB2Prx.uncheckedCast(self._adapter.addWithUUID(IB2I()))
- self._ic = Test.MA.ICPrx.uncheckedCast(self._adapter.addWithUUID(ICI()))
-
- def shutdown(self, current=None):
- self._adapter.getCommunicator().shutdown()
-
- def caop(self, current=None):
- return self._ca
-
- def cbop(self, current=None):
- return self._cb
-
- def ccop(self, current=None):
- return self._cc
-
- def cdop(self, current=None):
- return self._cd
-
- def iaop(self, current=None):
- return self._ia
-
- def ib1op(self, current=None):
- return self._ib1
-
- def ib2op(self, current=None):
- return self._ib2
-
- def icop(self, current=None):
- return self._ic
+import Test, TestI
def run(args, communicator):
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
adapter = communicator.createObjectAdapter("TestAdapter")
- object = InitialI(adapter)
+ object = TestI.InitialI(adapter)
adapter.add(object, Ice.stringToIdentity("initial"))
adapter.activate()
communicator.waitForShutdown()
diff --git a/py/test/Ice/inheritance/TestI.py b/py/test/Ice/inheritance/TestI.py
new file mode 100644
index 00000000000..d3cd15734c4
--- /dev/null
+++ b/py/test/Ice/inheritance/TestI.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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
+
+class CAI(Test.MA.CA):
+ def caop(self, p, current=None):
+ return p
+
+class CBI(Test.MB.CB, CAI):
+ def cbop(self, p, current=None):
+ return p
+
+class CCI(Test.MA.CC, CBI):
+ def ccop(self, p, current=None):
+ return p
+
+class IAI(Test.MA.IA):
+ def iaop(self, p, current=None):
+ return p
+
+class IB1I(Test.MB.IB1, IAI):
+ def ib1op(self, p, current=None):
+ return p
+
+class IB2I(Test.MB.IB2, IAI):
+ def ib2op(self, p, current=None):
+ return p
+
+class ICI(Test.MA.IC, IB1I, IB2I):
+ def icop(self, p, current=None):
+ return p
+
+class CDI(Test.MA.CD, CCI, IB1I, IB2I):
+ def cdop(self, p, current=None):
+ return p
+
+class InitialI(Test.Initial):
+ def __init__(self, adapter):
+ self._adapter = adapter
+ self._ca = Test.MA.CAPrx.uncheckedCast(self._adapter.addWithUUID(CAI()))
+ self._cb = Test.MB.CBPrx.uncheckedCast(self._adapter.addWithUUID(CBI()))
+ self._cc = Test.MA.CCPrx.uncheckedCast(self._adapter.addWithUUID(CCI()))
+ self._cd = Test.MA.CDPrx.uncheckedCast(self._adapter.addWithUUID(CDI()))
+ self._ia = Test.MA.IAPrx.uncheckedCast(self._adapter.addWithUUID(IAI()))
+ self._ib1 = Test.MB.IB1Prx.uncheckedCast(self._adapter.addWithUUID(IB1I()))
+ self._ib2 = Test.MB.IB2Prx.uncheckedCast(self._adapter.addWithUUID(IB2I()))
+ self._ic = Test.MA.ICPrx.uncheckedCast(self._adapter.addWithUUID(ICI()))
+
+ def shutdown(self, current=None):
+ self._adapter.getCommunicator().shutdown()
+
+ def caop(self, current=None):
+ return self._ca
+
+ def cbop(self, current=None):
+ return self._cb
+
+ def ccop(self, current=None):
+ return self._cc
+
+ def cdop(self, current=None):
+ return self._cd
+
+ def iaop(self, current=None):
+ return self._ia
+
+ def ib1op(self, current=None):
+ return self._ib1
+
+ def ib2op(self, current=None):
+ return self._ib2
+
+ def icop(self, current=None):
+ return self._ic
diff --git a/py/test/Ice/inheritance/run.py b/py/test/Ice/inheritance/run.py
index 742b6baa1f5..71b14f85ee7 100755
--- a/py/test/Ice/inheritance/run.py
+++ b/py/test/Ice/inheritance/run.py
@@ -23,4 +23,5 @@ import TestUtil
name = os.path.join("Ice", "inheritance")
TestUtil.clientServerTest(name)
+TestUtil.collocatedTest(name)
sys.exit(0)
diff --git a/py/test/Ice/objects/AllTests.py b/py/test/Ice/objects/AllTests.py
index c54448eac35..5d5bb99dd46 100644
--- a/py/test/Ice/objects/AllTests.py
+++ b/py/test/Ice/objects/AllTests.py
@@ -8,16 +8,38 @@
#
# **********************************************************************
-import Ice
+import Ice, Test, TestI
-Ice.loadSlice('Test.ice')
-import Test
+#
+# Ice for Python behaves differently than Ice for C++, because
+# collocated invocations are still sent "over the wire". Therefore
+# we always need to install the factories, even for the collocated
+# case.
+#
+class MyObjectFactory(Ice.ObjectFactory):
+ def create(self, type):
+ if type == '::Test::B':
+ return TestI.BI()
+ elif type == '::Test::C':
+ return TestI.CI()
+ elif type == '::Test::D':
+ return TestI.DI()
+ assert(False) # Should never be reached
+
+ def destroy(self):
+ # Nothing to do
+ pass
def test(b):
if not b:
raise RuntimeError('test assertion failed')
def allTests(communicator):
+ factory = MyObjectFactory()
+ communicator.addObjectFactory(factory, '::Test::B')
+ communicator.addObjectFactory(factory, '::Test::C')
+ communicator.addObjectFactory(factory, '::Test::D')
+
print "testing stringToProxy... ",
ref = "initial:default -p 12345 -t 10000"
base = communicator.stringToProxy(ref)
diff --git a/py/test/Ice/objects/Client.py b/py/test/Ice/objects/Client.py
index 6c31dbdbfc2..007159c601d 100644
--- a/py/test/Ice/objects/Client.py
+++ b/py/test/Ice/objects/Client.py
@@ -20,28 +20,11 @@ else:
sys.path.insert(0, os.path.join(toplevel, "python"))
sys.path.insert(0, os.path.join(toplevel, "lib"))
-import Ice, AllTests, TestI
-
-class MyObjectFactory(Ice.ObjectFactory):
- def create(self, type):
- if type == '::Test::B':
- return TestI.BI()
- elif type == '::Test::C':
- return TestI.CI()
- elif type == '::Test::D':
- return TestI.DI()
- assert(False) # Should never be reached
-
- def destroy(self):
- # Nothing to do
- pass
+import Ice
+Ice.loadSlice('Test.ice')
+import AllTests
def run(args, communicator):
- factory = MyObjectFactory()
- communicator.addObjectFactory(factory, '::Test::B')
- communicator.addObjectFactory(factory, '::Test::C')
- communicator.addObjectFactory(factory, '::Test::D')
-
initial = AllTests.allTests(communicator)
initial.shutdown()
return True
diff --git a/py/test/Ice/objects/Collocated.py b/py/test/Ice/objects/Collocated.py
new file mode 100644
index 00000000000..45e3b194a45
--- /dev/null
+++ b/py/test/Ice/objects/Collocated.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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 os, sys, traceback
+
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "python", "Ice.py")):
+ break
+else:
+ raise "can't find toplevel directory!"
+
+sys.path.insert(0, os.path.join(toplevel, "python"))
+sys.path.insert(0, os.path.join(toplevel, "lib"))
+
+import Ice
+Ice.loadSlice('Test.ice')
+import Test, TestI, AllTests
+
+def run(args, communicator):
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ initial = TestI.InitialI(adapter)
+ adapter.add(initial, Ice.stringToIdentity("initial"))
+ adapter.activate()
+
+ AllTests.allTests(communicator)
+
+ # We must call shutdown even in the collocated case for cyclic dependency cleanup
+ initial.shutdown()
+
+ return True
+
+try:
+ communicator = Ice.initialize(sys.argv)
+ status = run(sys.argv, communicator)
+except:
+ traceback.print_exc()
+ status = False
+
+if communicator:
+ try:
+ communicator.destroy()
+ except:
+ traceback.print_exc()
+ status = False
+
+sys.exit(not status)
diff --git a/py/test/Ice/objects/Server.py b/py/test/Ice/objects/Server.py
index a9d1790ba8d..2b4ae46e693 100644
--- a/py/test/Ice/objects/Server.py
+++ b/py/test/Ice/objects/Server.py
@@ -24,67 +24,10 @@ import 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)
+ initial = TestI.InitialI(adapter)
adapter.add(initial, Ice.stringToIdentity("initial"))
adapter.activate()
communicator.waitForShutdown()
diff --git a/py/test/Ice/objects/TestI.py b/py/test/Ice/objects/TestI.py
index 95908a13855..feb02fe2715 100644
--- a/py/test/Ice/objects/TestI.py
+++ b/py/test/Ice/objects/TestI.py
@@ -8,7 +8,7 @@
#
# **********************************************************************
-import sys, Ice, Test
+import Ice, Test
class BI(Test.B):
def __init__(self):
@@ -51,3 +51,60 @@ class DI(Test.D):
def ice_postUnmarshal(self):
self._postUnmarshalInvoked = True
+
+class InitialI(Test.Initial):
+ def __init__(self, adapter):
+ self._adapter = adapter
+ self._b1 = BI()
+ self._b2 = BI()
+ self._c = CI()
+ self._d = 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)
diff --git a/py/test/Ice/objects/run.py b/py/test/Ice/objects/run.py
index d7628210754..1019c7f36a9 100755
--- a/py/test/Ice/objects/run.py
+++ b/py/test/Ice/objects/run.py
@@ -23,4 +23,5 @@ import TestUtil
name = os.path.join("Ice", "objects")
TestUtil.clientServerTest(name)
+TestUtil.collocatedTest(name)
sys.exit(0)
diff --git a/py/test/Ice/operations/AllTests.py b/py/test/Ice/operations/AllTests.py
index 09abd20e0bc..8f7cae1ce8e 100644
--- a/py/test/Ice/operations/AllTests.py
+++ b/py/test/Ice/operations/AllTests.py
@@ -8,20 +8,7 @@
#
# **********************************************************************
-import Ice, os, sys, math
-
-#
-# Find Slice directory.
-#
-slice_dir = os.getenv('ICEPY_HOME', '')
-if len(slice_dir) == 0 or not os.path.exists(os.path.join(slice_dir, "slice")):
- slice_dir = os.getenv('ICE_HOME', '')
-if len(slice_dir) == 0 or not os.path.exists(os.path.join(slice_dir, "slice")):
- print sys.argv[0] + ': Slice directory not found. Define ICEPY_HOME or ICE_HOME.'
- sys.exit(1)
-
-Ice.loadSlice('-I' + slice_dir + '/slice Test.ice')
-import Test, Twoways, TwowaysAMI
+import Ice, Test, Twoways, TwowaysAMI
def test(b):
if not b:
diff --git a/py/test/Ice/operations/Client.py b/py/test/Ice/operations/Client.py
index 9257f070b7f..89bf8de03c6 100644
--- a/py/test/Ice/operations/Client.py
+++ b/py/test/Ice/operations/Client.py
@@ -20,7 +20,19 @@ else:
sys.path.insert(0, os.path.join(toplevel, "python"))
sys.path.insert(0, os.path.join(toplevel, "lib"))
-import Ice, AllTests
+#
+# Find Slice directory.
+#
+slice_dir = os.getenv('ICEPY_HOME', '')
+if len(slice_dir) == 0 or not os.path.exists(os.path.join(slice_dir, "slice")):
+ slice_dir = os.getenv('ICE_HOME', '')
+if len(slice_dir) == 0 or not os.path.exists(os.path.join(slice_dir, "slice")):
+ print sys.argv[0] + ': Slice directory not found. Define ICEPY_HOME or ICE_HOME.'
+ sys.exit(1)
+
+import Ice
+Ice.loadSlice('-I' + slice_dir + '/slice Test.ice')
+import AllTests
def test(b):
if not b:
diff --git a/py/test/Ice/operations/Collocated.py b/py/test/Ice/operations/Collocated.py
new file mode 100644
index 00000000000..8d8553352a2
--- /dev/null
+++ b/py/test/Ice/operations/Collocated.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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 os, sys, traceback
+
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "python", "Ice.py")):
+ break
+else:
+ raise "can't find toplevel directory!"
+
+sys.path.insert(0, os.path.join(toplevel, "python"))
+sys.path.insert(0, os.path.join(toplevel, "lib"))
+
+#
+# Find Slice directory.
+#
+slice_dir = os.getenv('ICEPY_HOME', '')
+if len(slice_dir) == 0 or not os.path.exists(os.path.join(slice_dir, "slice")):
+ slice_dir = os.getenv('ICE_HOME', '')
+if len(slice_dir) == 0 or not os.path.exists(os.path.join(slice_dir, "slice")):
+ print sys.argv[0] + ': Slice directory not found. Define ICEPY_HOME or ICE_HOME.'
+ sys.exit(1)
+
+import Ice
+Ice.loadSlice('-I' + slice_dir + '/slice Test.ice')
+import Test, TestI, AllTests
+
+def run(args, communicator):
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
+ adapter = communicator.createObjectAdapter("TestAdapter")
+ id = Ice.stringToIdentity("test")
+ adapter.add(TestI.MyDerivedClassI(adapter, id), id)
+ adapter.add(TestI.TestCheckedCastI(), Ice.stringToIdentity("context"))
+ adapter.activate()
+
+ AllTests.allTests(communicator)
+
+ return True
+
+try:
+ communicator = Ice.initialize(sys.argv)
+ status = run(sys.argv, communicator)
+except:
+ traceback.print_exc()
+ status = False
+
+if communicator:
+ try:
+ communicator.destroy()
+ except:
+ traceback.print_exc()
+ status = False
+
+sys.exit(not status)
diff --git a/py/test/Ice/operations/Server.py b/py/test/Ice/operations/Server.py
index 549559c605a..47479c84420 100644
--- a/py/test/Ice/operations/Server.py
+++ b/py/test/Ice/operations/Server.py
@@ -33,186 +33,14 @@ if len(slice_dir) == 0 or not os.path.exists(os.path.join(slice_dir, "slice")):
sys.exit(1)
Ice.loadSlice('-I' + slice_dir + '/slice Test.ice')
-import Test
-
-def test(b):
- if not b:
- raise RuntimeError('test assertion failed')
-
-class MyDerivedClassI(Test.MyDerivedClass):
- def __init__(self, adapter, identity):
- self.adapter = adapter
- self.identity = identity
-
- def shutdown(self, current=None):
- self.adapter.getCommunicator().shutdown()
-
- def opVoid(self, current=None):
- pass
-
- def opByte(self, p1, p2, current=None):
- return (p1, p1 ^ p2)
-
- def opBool(self, p1, p2, current=None):
- return (p2, p1)
-
- def opShortIntLong(self, p1, p2, p3, current=None):
- return (p3, p1, p2, p3)
-
- def opFloatDouble(self, p1, p2, current=None):
- return (p2, p1, p2)
-
- def opString(self, p1, p2, current=None):
- return (p1 + " " + p2, p2 + " " + p1)
-
- def opMyEnum(self, p1, current=None):
- return (Test.MyEnum.enum3, p1)
-
- def opMyClass(self, p1, current=None):
- return (Test.MyClassPrx.uncheckedCast(self.adapter.createProxy(self.identity)), p1,
- Test.MyClassPrx.uncheckedCast(self.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity"))))
-
- def opStruct(self, p1, p2, current=None):
- p1.s.s = "a new string"
- return (p2, p1)
-
- def opByteS(self, p1, p2, current=None):
- p3 = p1[0:]
- p3.reverse()
- r = p1[0:]
- r.extend(p2)
- return (r, p3)
-
- def opBoolS(self, p1, p2, current=None):
- p3 = p1[0:]
- p3.extend(p2)
- r = p1[0:]
- r.reverse();
- return (r, p3)
-
- def opShortIntLongS(self, p1, p2, p3, current=None):
- p4 = p1[0:]
- p5 = p2[0:]
- p5.reverse()
- p6 = p3[0:]
- p6.extend(p3)
- return (p3, p4, p5, p6)
-
- def opFloatDoubleS(self, p1, p2, current=None):
- p3 = p1[0:]
- p4 = p2[0:]
- p4.reverse()
- r = p2[0:]
- r.extend(p1)
- return (r, p3, p4)
-
- def opStringS(self, p1, p2, current=None):
- p3 = p1[0:]
- p3.extend(p2)
- r = p1[0:]
- r.reverse()
- return (r, p3)
-
- def opByteSS(self, p1, p2, current=None):
- p3 = p1[0:]
- p3.reverse()
- r = p1[0:]
- r.extend(p2)
- return (r, p3)
-
- def opBoolSS(self, p1, p2, current=None):
- p3 = p1[0:]
- p3.extend(p2)
- r = p1[0:]
- r.reverse()
- return (r, p3)
-
- def opShortIntLongSS(self, p1, p2, p3, current=None):
- p4 = p1[0:]
- p5 = p2[0:]
- p5.reverse()
- p6 = p3[0:]
- p6.extend(p3)
- return (p3, p4, p5, p6)
-
- def opFloatDoubleSS(self, p1, p2, current=None):
- p3 = p1[0:]
- p4 = p2[0:]
- p4.reverse()
- r = p2[0:]
- r.extend(p2)
- return (r, p3, p4)
-
- def opStringSS(self, p1, p2, current=None):
- p3 = p1[0:]
- p3.extend(p2)
- r = p2[0:]
- r.reverse()
- return (r, p3)
-
- def opStringSSS(self, p1, p2, current=None):
- p3 = p1[0:]
- p3.extend(p2)
- r = p2[0:]
- r.reverse()
- return (r, p3)
-
- def opByteBoolD(self, p1, p2, current=None):
- p3 = p1.copy()
- r = p1.copy()
- r.update(p2)
- return (r, p3)
-
- def opShortIntD(self, p1, p2, current=None):
- p3 = p1.copy()
- r = p1.copy()
- r.update(p2)
- return (r, p3)
-
- def opLongFloatD(self, p1, p2, current=None):
- p3 = p1.copy()
- r = p1.copy()
- r.update(p2)
- return (r, p3)
-
- def opStringStringD(self, p1, p2, current=None):
- p3 = p1.copy()
- r = p1.copy()
- r.update(p2)
- return (r, p3)
-
- def opStringMyEnumD(self, p1, p2, current=None):
- p3 = p1.copy()
- r = p1.copy()
- r.update(p2)
- return (r, p3)
-
- def opIntS(self, s, current=None):
- return [-x for x in s]
-
- def opContext(self, current=None):
- return current.ctx
-
- def opDerived(self, current=None):
- pass
-
-class TestCheckedCastI(Test.TestCheckedCast):
- def __init__(self):
- self.ctx = None
-
- def getContext(self, current):
- return self.ctx;
-
- def ice_isA(self, s, current):
- self.ctx = current.ctx
- return Test.TestCheckedCast.ice_isA(self, s, current)
+import Test, TestI
def run(args, communicator):
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12345 -t 10000")
adapter = communicator.createObjectAdapter("TestAdapter")
id = Ice.stringToIdentity("test")
- adapter.add(MyDerivedClassI(adapter, id), id)
- adapter.add(TestCheckedCastI(), Ice.stringToIdentity("context"))
+ adapter.add(TestI.MyDerivedClassI(adapter, id), id)
+ adapter.add(TestI.TestCheckedCastI(), Ice.stringToIdentity("context"))
adapter.activate()
communicator.waitForShutdown()
return True
diff --git a/py/test/Ice/operations/TestI.py b/py/test/Ice/operations/TestI.py
new file mode 100644
index 00000000000..8948cda13d8
--- /dev/null
+++ b/py/test/Ice/operations/TestI.py
@@ -0,0 +1,179 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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
+
+class MyDerivedClassI(Test.MyDerivedClass):
+ def __init__(self, adapter, identity):
+ self.adapter = adapter
+ self.identity = identity
+
+ def shutdown(self, current=None):
+ self.adapter.getCommunicator().shutdown()
+
+ def opVoid(self, current=None):
+ pass
+
+ def opByte(self, p1, p2, current=None):
+ return (p1, p1 ^ p2)
+
+ def opBool(self, p1, p2, current=None):
+ return (p2, p1)
+
+ def opShortIntLong(self, p1, p2, p3, current=None):
+ return (p3, p1, p2, p3)
+
+ def opFloatDouble(self, p1, p2, current=None):
+ return (p2, p1, p2)
+
+ def opString(self, p1, p2, current=None):
+ return (p1 + " " + p2, p2 + " " + p1)
+
+ def opMyEnum(self, p1, current=None):
+ return (Test.MyEnum.enum3, p1)
+
+ def opMyClass(self, p1, current=None):
+ return (Test.MyClassPrx.uncheckedCast(self.adapter.createProxy(self.identity)), p1,
+ Test.MyClassPrx.uncheckedCast(self.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity"))))
+
+ def opStruct(self, p1, p2, current=None):
+ p1.s.s = "a new string"
+ return (p2, p1)
+
+ def opByteS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p3.reverse()
+ r = p1[0:]
+ r.extend(p2)
+ return (r, p3)
+
+ def opBoolS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p3.extend(p2)
+ r = p1[0:]
+ r.reverse();
+ return (r, p3)
+
+ def opShortIntLongS(self, p1, p2, p3, current=None):
+ p4 = p1[0:]
+ p5 = p2[0:]
+ p5.reverse()
+ p6 = p3[0:]
+ p6.extend(p3)
+ return (p3, p4, p5, p6)
+
+ def opFloatDoubleS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p4 = p2[0:]
+ p4.reverse()
+ r = p2[0:]
+ r.extend(p1)
+ return (r, p3, p4)
+
+ def opStringS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p3.extend(p2)
+ r = p1[0:]
+ r.reverse()
+ return (r, p3)
+
+ def opByteSS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p3.reverse()
+ r = p1[0:]
+ r.extend(p2)
+ return (r, p3)
+
+ def opBoolSS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p3.extend(p2)
+ r = p1[0:]
+ r.reverse()
+ return (r, p3)
+
+ def opShortIntLongSS(self, p1, p2, p3, current=None):
+ p4 = p1[0:]
+ p5 = p2[0:]
+ p5.reverse()
+ p6 = p3[0:]
+ p6.extend(p3)
+ return (p3, p4, p5, p6)
+
+ def opFloatDoubleSS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p4 = p2[0:]
+ p4.reverse()
+ r = p2[0:]
+ r.extend(p2)
+ return (r, p3, p4)
+
+ def opStringSS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p3.extend(p2)
+ r = p2[0:]
+ r.reverse()
+ return (r, p3)
+
+ def opStringSSS(self, p1, p2, current=None):
+ p3 = p1[0:]
+ p3.extend(p2)
+ r = p2[0:]
+ r.reverse()
+ return (r, p3)
+
+ def opByteBoolD(self, p1, p2, current=None):
+ p3 = p1.copy()
+ r = p1.copy()
+ r.update(p2)
+ return (r, p3)
+
+ def opShortIntD(self, p1, p2, current=None):
+ p3 = p1.copy()
+ r = p1.copy()
+ r.update(p2)
+ return (r, p3)
+
+ def opLongFloatD(self, p1, p2, current=None):
+ p3 = p1.copy()
+ r = p1.copy()
+ r.update(p2)
+ return (r, p3)
+
+ def opStringStringD(self, p1, p2, current=None):
+ p3 = p1.copy()
+ r = p1.copy()
+ r.update(p2)
+ return (r, p3)
+
+ def opStringMyEnumD(self, p1, p2, current=None):
+ p3 = p1.copy()
+ r = p1.copy()
+ r.update(p2)
+ return (r, p3)
+
+ def opIntS(self, s, current=None):
+ return [-x for x in s]
+
+ def opContext(self, current=None):
+ return current.ctx
+
+ def opDerived(self, current=None):
+ pass
+
+class TestCheckedCastI(Test.TestCheckedCast):
+ def __init__(self):
+ self.ctx = None
+
+ def getContext(self, current):
+ return self.ctx;
+
+ def ice_isA(self, s, current):
+ self.ctx = current.ctx
+ return Test.TestCheckedCast.ice_isA(self, s, current)
diff --git a/py/test/Ice/operations/run.py b/py/test/Ice/operations/run.py
index c5bcb44b5be..e7f87fbfcf1 100755
--- a/py/test/Ice/operations/run.py
+++ b/py/test/Ice/operations/run.py
@@ -26,4 +26,6 @@ print "tests with regular server."
TestUtil.clientServerTest(name)
print "tests with AMD server."
TestUtil.clientServerTestWithOptionsAndNames(name, "", "", "ServerAMD.py", "Client.py")
+print "tests with collocated server."
+TestUtil.collocatedTestWithOptions(name, " --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0")
sys.exit(0)