summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cs/demo/Ice/properties/Client.cs7
-rw-r--r--py/demo/Ice/README6
-rw-r--r--py/demo/Ice/properties/Client.py113
-rw-r--r--py/demo/Ice/properties/Props.ice26
-rw-r--r--py/demo/Ice/properties/README13
-rw-r--r--py/demo/Ice/properties/Server.py74
-rw-r--r--py/demo/Ice/properties/config.client51
-rw-r--r--py/demo/Ice/properties/config.server61
-rwxr-xr-xpy/demo/Ice/properties/expect.py31
-rw-r--r--py/modules/IcePy/Communicator.cpp4
-rw-r--r--py/modules/IcePy/PropertiesAdmin.cpp2
-rw-r--r--py/python/Ice.py4
-rw-r--r--py/test/Ice/admin/AllTests.py100
-rw-r--r--py/test/Ice/admin/Client.py1
-rw-r--r--py/test/Ice/admin/Server.py2
-rw-r--r--py/test/Ice/admin/TestI.py38
16 files changed, 471 insertions, 62 deletions
diff --git a/cs/demo/Ice/properties/Client.cs b/cs/demo/Ice/properties/Client.cs
index 42ed4ce73ee..801e20688a7 100644
--- a/cs/demo/Ice/properties/Client.cs
+++ b/cs/demo/Ice/properties/Client.cs
@@ -45,13 +45,6 @@ public class Client : Ice.Application
return 1;
}
- //
- // Since this is an interactive demo we want to clear the
- // Application installed interrupt callback and install our
- // own shutdown hook.
- //
- //setInterruptHook(new ShutdownHook());
-
PropsPrx props = PropsPrxHelper.checkedCast(communicator().propertyToProxy("Props.Proxy"));
if(props == null)
{
diff --git a/py/demo/Ice/README b/py/demo/Ice/README
index 0ac4d943801..a83fa63648b 100644
--- a/py/demo/Ice/README
+++ b/py/demo/Ice/README
@@ -38,6 +38,12 @@ Demos in this directory:
This demo illustrates a minimal Ice application.
+- properties
+
+ Shows how to access a server's PropertiesAdmin facet in order to
+ retrieve and modify its configuration properties, and how the server
+ can receive notifications whenever its properties are changed.
+
- session
This demo shows how to use sessions to clean up client-specific
diff --git a/py/demo/Ice/properties/Client.py b/py/demo/Ice/properties/Client.py
new file mode 100644
index 00000000000..4a197cd8f19
--- /dev/null
+++ b/py/demo/Ice/properties/Client.py
@@ -0,0 +1,113 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2012 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, traceback, Ice
+
+slice_dir = Ice.getSliceDir()
+if not slice_dir:
+ print(sys.argv[0] + ': Slice directory not found.')
+ sys.exit(1)
+
+Ice.loadSlice("'-I" + slice_dir + "' Props.ice")
+import Demo
+
+def menu():
+ print("""
+usage:
+1: set properties (batch 1)
+2: set properties (batch 2)
+c: show current properties
+s: shutdown server
+x: exit
+?: help
+""")
+
+def show(admin):
+ props = admin.getPropertiesForPrefix("Demo")
+ print "Server's current settings:"
+ for k,v in props.items():
+ print " " + k + "=" + v
+
+class Client(Ice.Application):
+ def run(self, args):
+ if len(args) > 1:
+ print(self.appName() + ": too many arguments")
+ return 1
+
+ props = Demo.PropsPrx.checkedCast(self.communicator().propertyToProxy("Props.Proxy"))
+ if props == None:
+ print("invalid proxy")
+ return 1
+
+ admin = Ice.PropertiesAdminPrx.checkedCast(self.communicator().propertyToProxy("Admin.Proxy"))
+
+ batch1 = {}
+ batch1["Demo.Prop1"] = "1"
+ batch1["Demo.Prop2"] = "2"
+ batch1["Demo.Prop3"] = "3"
+
+ batch2 = {}
+ batch2["Demo.Prop1"] = "10"
+ batch2["Demo.Prop2"] = "" # An empty value removes this property
+ batch2["Demo.Prop3"] = "30"
+
+ show(admin)
+ menu()
+
+ c = None
+ while c != 'x':
+ try:
+ sys.stdout.write("==> ")
+ sys.stdout.flush()
+ c = sys.stdin.readline().strip()
+ if c == "1" or c == "2":
+ propsDict = c == "1" and batch1 or batch2
+ print("Sending:")
+ for k, v in propsDict.items():
+ if k.startswith("Demo"):
+ print(" " + k + "=" + v)
+ print
+
+ admin.setProperties(propsDict)
+
+ print("Changes:")
+ changes = props.getChanges()
+ if len(changes) == 0:
+ print(" None.")
+ else:
+ for k, v in changes.items():
+ sys.stdout.write(" " + k)
+ if len(v) == 0:
+ print(" was removed")
+ else:
+ print(" is now " + v)
+ elif c == "c":
+ show(admin)
+ elif c == "s":
+ props.shutdown()
+ elif c == "x":
+ # Nothing to do
+ pass
+ elif c == "?":
+ menu()
+ else:
+ print("unknown command `" + c + "'")
+ menu()
+ except KeyboardInterrupt:
+ break
+ except EOFError:
+ break
+ except Ice.Exception as ex:
+ print(ex)
+
+ return 0
+
+app = Client()
+sys.exit(app.main(sys.argv, "config.client"))
diff --git a/py/demo/Ice/properties/Props.ice b/py/demo/Ice/properties/Props.ice
new file mode 100644
index 00000000000..428904c7691
--- /dev/null
+++ b/py/demo/Ice/properties/Props.ice
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2010 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.
+//
+// **********************************************************************
+
+#ifndef DEMO_ICE
+#define DEMO_ICE
+
+#include <Ice/Properties.ice>
+
+module Demo
+{
+
+interface Props
+{
+ idempotent Ice::PropertyDict getChanges();
+ void shutdown();
+};
+
+};
+
+#endif
diff --git a/py/demo/Ice/properties/README b/py/demo/Ice/properties/README
new file mode 100644
index 00000000000..b945ce9c00f
--- /dev/null
+++ b/py/demo/Ice/properties/README
@@ -0,0 +1,13 @@
+This demo illustrates how to access a server's PropertiesAdmin facet
+in order to retrieve and modify its configuration properties. This
+demo also shows how the server can receive notifications whenever its
+properties are changed.
+
+To run the demo, first start the server:
+
+$ python Server.py
+
+In a separate window, start the client:
+
+$ python Client.py
+
diff --git a/py/demo/Ice/properties/Server.py b/py/demo/Ice/properties/Server.py
new file mode 100644
index 00000000000..dc9264595a6
--- /dev/null
+++ b/py/demo/Ice/properties/Server.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2012 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, traceback, Ice, threading
+
+slice_dir = Ice.getSliceDir()
+if not slice_dir:
+ print(sys.argv[0] + ': Slice directory not found.')
+ sys.exit(1)
+
+Ice.loadSlice("'-I" + slice_dir + "' Props.ice")
+import Demo
+
+class PropsI(Demo.Props, Ice.PropertiesAdminUpdateCallback):
+ def __init__(self):
+ self.called = False
+ self.m = threading.Condition()
+
+ def getChanges(self, current = None):
+ self.m.acquire()
+ try:
+ #
+ # Make sure that we have received the property updates before we
+ # return the results.
+ #
+ while not self.called:
+ self.m.wait()
+ self.called = False;
+ return self.changes
+ finally:
+ self.m.release()
+
+ def shutdown(self, current = None):
+ current.adapter.getCommunicator().shutdown();
+
+ def updated(self, changes):
+ self.m.acquire()
+ try:
+ self.changes = changes;
+ self.called = True
+ self.m.notify()
+ finally:
+ self.m.release()
+
+class Server(Ice.Application):
+ def run(self, args):
+ if len(args) > 1:
+ print(self.appName() + ": too many arguments")
+ return 1
+
+ servant = PropsI()
+
+ #
+ # Retrieve the PropertiesAdmin facet and register the servant as the update callback.
+ #
+ admin = self.communicator().findAdminFacet("Properties");
+ admin.addUpdateCallback(servant);
+
+ adapter = self.communicator().createObjectAdapter("Props")
+ adapter.add(servant, self.communicator().stringToIdentity("props"))
+ adapter.activate()
+ self.communicator().waitForShutdown()
+ return 0
+
+sys.stdout.flush()
+app = Server()
+sys.exit(app.main(sys.argv, "config.server"))
diff --git a/py/demo/Ice/properties/config.client b/py/demo/Ice/properties/config.client
new file mode 100644
index 00000000000..8b079dfc267
--- /dev/null
+++ b/py/demo/Ice/properties/config.client
@@ -0,0 +1,51 @@
+#
+# The client reads this property to create the reference to the
+# "props" object in the server.
+#
+Props.Proxy=props:default -p 10000
+
+#
+# This proxy allows the client to communicate with the
+# PropertiesAdmin facet of the Ice administrative facility.
+#
+Admin.Proxy=Demo/admin -f Properties:default -p 10001
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
+
+#
+# Security Tracing
+#
+# 0 = no security tracing
+# 1 = trace messages
+#
+#IceSSL.Trace.Security=1
+
+#
+# SSL Configuration
+#
+Ice.Plugin.IceSSL=IceSSL:createIceSSL
+IceSSL.DefaultDir=../../../../certs
+IceSSL.CertAuthFile=cacert.pem
+IceSSL.CertFile=c_rsa1024_pub.pem
+IceSSL.KeyFile=c_rsa1024_priv.pem
diff --git a/py/demo/Ice/properties/config.server b/py/demo/Ice/properties/config.server
new file mode 100644
index 00000000000..3fae2c52d4d
--- /dev/null
+++ b/py/demo/Ice/properties/config.server
@@ -0,0 +1,61 @@
+#
+# The server creates an object adapter with the name
+# "Props". The following line sets the endpoints for this
+# adapter.
+#
+Props.Endpoints=default -p 10000
+
+#
+# Enable the Ice administrative facility by setting the
+# following properties.
+#
+Ice.Admin.Endpoints=default -p 10001
+Ice.Admin.InstanceName=Demo
+Ice.Trace.Admin.Properties=2
+
+#
+# Initial values for the demo properties.
+#
+Demo.Prop1=0
+Demo.Prop2=0
+Demo.Prop3=0
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
+
+#
+# Security Tracing
+#
+# 0 = no security tracing
+# 1 = trace messages
+#
+#IceSSL.Trace.Security=1
+
+#
+# SSL Configuration
+#
+Ice.Plugin.IceSSL=IceSSL:createIceSSL
+IceSSL.DefaultDir=../../../../certs
+IceSSL.CertAuthFile=cacert.pem
+IceSSL.CertFile=s_rsa1024_pub.pem
+IceSSL.KeyFile=s_rsa1024_priv.pem
diff --git a/py/demo/Ice/properties/expect.py b/py/demo/Ice/properties/expect.py
new file mode 100755
index 00000000000..a4ba7a75ae0
--- /dev/null
+++ b/py/demo/Ice/properties/expect.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2012 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, os
+
+path = [ ".", "..", "../..", "../../..", "../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ]
+if len(path) == 0:
+ raise RuntimeError("can't find toplevel directory!")
+sys.path.append(path[0])
+sys.path.append(os.path.join(path[0], "scripts"))
+
+from demoscript import Util
+from demoscript.Ice import properties
+
+server = Util.spawn('Server.py --Ice.PrintAdapterReady --Ice.Warn.Connections=0')
+server.expect('.* ready')
+client = Util.spawn('Client.py --Ice.Warn.Connections=0')
+client.expect('.*==>')
+
+properties.run(client, server)
diff --git a/py/modules/IcePy/Communicator.cpp b/py/modules/IcePy/Communicator.cpp
index d9fd5bfeaae..221b45704b0 100644
--- a/py/modules/IcePy/Communicator.cpp
+++ b/py/modules/IcePy/Communicator.cpp
@@ -902,6 +902,10 @@ communicatorFindAdminFacet(CommunicatorObject* self, PyObject* args)
{
return createNativePropertiesAdmin(props);
}
+
+ // If the facet isn't supported in Python, just return an Ice.Object.
+ PyTypeObject* objectType = reinterpret_cast<PyTypeObject*>(lookupType("Ice.Object"));
+ return objectType->tp_alloc(objectType, 0);
}
}
catch(const Ice::Exception& ex)
diff --git a/py/modules/IcePy/PropertiesAdmin.cpp b/py/modules/IcePy/PropertiesAdmin.cpp
index ca87b04261b..4b308288ec5 100644
--- a/py/modules/IcePy/PropertiesAdmin.cpp
+++ b/py/modules/IcePy/PropertiesAdmin.cpp
@@ -69,6 +69,8 @@ IcePy::UpdateCallbackWrapper::getObject() const
void
IcePy::UpdateCallbackWrapper::updated(const Ice::PropertyDict& dict)
{
+ AdoptThread adoptThread; // Ensure the current thread is able to call into Python.
+
PyObjectHandle result = PyDict_New();
if(result.get())
{
diff --git a/py/python/Ice.py b/py/python/Ice.py
index 54380097453..fd43c535cdc 100644
--- a/py/python/Ice.py
+++ b/py/python/Ice.py
@@ -351,6 +351,7 @@ import Ice_Locator_ice
import Ice_Logger_ice
import Ice_ObjectAdapter_ice
import Ice_ObjectFactory_ice
+import Ice_Process_ice
import Ice_Properties_ice
import Ice_Router_ice
import Ice_ServantLocator_ice
@@ -532,6 +533,9 @@ class CommunicatorI(Communicator):
def addAdminFacet(self, servant, facet):
self._impl.addAdminFacet(servant, facet)
+ def findAdminFacet(self, facet):
+ return self._impl.findAdminFacet(facet)
+
def removeAdminFacet(self, facet):
return self._impl.removeAdminFacet(facet)
diff --git a/py/test/Ice/admin/AllTests.py b/py/test/Ice/admin/AllTests.py
index 03802de912a..f215a4239be 100644
--- a/py/test/Ice/admin/AllTests.py
+++ b/py/test/Ice/admin/AllTests.py
@@ -7,7 +7,7 @@
#
# **********************************************************************
-import Ice, Test, sys
+import Ice, Test, sys, TestI
def test(b):
if not b:
@@ -60,42 +60,42 @@ def allTests(communicator):
#
# Test: Exercise addAdminFacet, findAdminFacet, removeAdminFacet with a typical configuration.
#
- init = new Ice.InitializationData()
- init.properties = Ice.Util.createProperties()
+ init = Ice.InitializationData()
+ init.properties = Ice.createProperties()
init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1")
init.properties.setProperty("Ice.Admin.InstanceName", "Test")
- com = Ice.Util.initialize(init)
+ com = Ice.initialize(init)
testFacets(com)
com.destroy()
#
# Test: Verify that the operations work correctly in the presence of facet filters.
#
- init = new Ice.InitializationData()
- init.properties = Ice.Util.createProperties()
+ init = Ice.InitializationData()
+ init.properties = Ice.createProperties()
init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1")
init.properties.setProperty("Ice.Admin.InstanceName", "Test")
init.properties.setProperty("Ice.Admin.Facets", "Properties")
- com = Ice.Util.initialize(init)
+ com = Ice.initialize(init)
testFacets(com)
com.destroy()
#
# Test: Verify that the operations work correctly with the Admin object disabled.
#
- com = Ice.Util.initialize()
+ com = Ice.initialize()
testFacets(com)
com.destroy()
#
# Test: Verify that the operations work correctly when creation of the Admin object is delayed.
#
- init = new Ice.InitializationData()
- init.properties = Ice.Util.createProperties()
+ init = Ice.InitializationData()
+ init.properties = Ice.createProperties()
init.properties.setProperty("Ice.Admin.Endpoints", "tcp -h 127.0.0.1")
init.properties.setProperty("Ice.Admin.InstanceName", "Test")
init.properties.setProperty("Ice.Admin.DelayCreation", "1")
- com = Ice.Util.initialize(init)
+ com = Ice.initialize(init)
testFacets(com)
com.getAdmin()
testFacets(com)
@@ -103,7 +103,7 @@ def allTests(communicator):
print("ok")
ref = "factory:default -p 12010 -t 10000"
- factory = RemoteCommunicatorFactoryPrx.uncheckedCast(communicator.stringToProxy(@ref))
+ factory = Test.RemoteCommunicatorFactoryPrx.uncheckedCast(communicator.stringToProxy(ref))
sys.stdout.write("testing process facet... ")
sys.stdout.flush()
@@ -146,19 +146,20 @@ def allTests(communicator):
# Test: PropertiesAdmin::getProperties()
#
pd = pa.getPropertiesForPrefix("")
- test(len(pd) == 5)
+ test(len(pd) == 6)
+ test(pd["Ice.Default.CollocationOptimized"] == "0")
test(pd["Ice.Admin.Endpoints"] == "tcp -h 127.0.0.1")
test(pd["Ice.Admin.InstanceName"] == "Test")
test(pd["Prop1"] == "1")
test(pd["Prop2"] == "2")
test(pd["Prop3"] == "3")
- Dictionary<string, string> changes
+ changes = {}
#
# Test: PropertiesAdmin::setProperties()
#
- Dictionary<string, string> setProps = new Dictionary<string, string>()
+ setProps = {}
setProps["Prop1"] = "10" # Changed
setProps["Prop2"] = "20" # Changed
setProps["Prop3"] = "" # Removed
@@ -196,7 +197,7 @@ def allTests(communicator):
props["Ice.Admin.InstanceName"] = "Test"
com = factory.createCommunicator(props)
obj = com.getAdmin()
- tf = TestFacetPrx.checkedCast(obj, "TestFacet")
+ tf = Test.TestFacetPrx.checkedCast(obj, "TestFacet")
tf.op()
com.destroy()
@@ -215,10 +216,18 @@ def allTests(communicator):
props["Ice.Admin.Facets"] = "Properties"
com = factory.createCommunicator(props)
obj = com.getAdmin()
- proc = Ice.ProcessPrx.checkedCast(obj, "Process")
- test(proc == None)
- tf = TestFacetPrx.checkedCast(obj, "TestFacet")
- test(tf == None)
+ # TODO: Remote the try/catch once ICE-4862 is fixed
+ try:
+ proc = Ice.ProcessPrx.checkedCast(obj, "Process")
+ test(proc == None)
+ except Ice.FacetNotExistException:
+ pass
+ try:
+ tf = Test.TestFacetPrx.checkedCast(obj, "TestFacet")
+ test(tf == None)
+ except Ice.FacetNotExistException:
+ pass
+
com.destroy()
#
@@ -231,10 +240,17 @@ def allTests(communicator):
props["Ice.Admin.Facets"] = "Process"
com = factory.createCommunicator(props)
obj = com.getAdmin()
- pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties")
- test(pa == None)
- tf = TestFacetPrx.checkedCast(obj, "TestFacet")
- test(tf == None)
+ # TODO: Remote the try/catch once ICE-4862 is fixed
+ try:
+ pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties")
+ test(pa == None)
+ except Ice.FacetNotExistException:
+ pass
+ try:
+ tf = Test.TestFacetPrx.checkedCast(obj, "TestFacet")
+ test(tf == None)
+ except Ice.FacetNotExistException:
+ pass
com.destroy()
#
@@ -247,10 +263,17 @@ def allTests(communicator):
props["Ice.Admin.Facets"] = "TestFacet"
com = factory.createCommunicator(props)
obj = com.getAdmin()
- pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties")
- test(pa == None)
- proc = Ice.ProcessPrx.checkedCast(obj, "Process")
- test(proc == None)
+ # TODO: Remote the try/catch once ICE-4862 is fixed
+ try:
+ pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties")
+ test(pa == None)
+ except Ice.FacetNotExistException:
+ pass
+ try:
+ proc = Ice.ProcessPrx.checkedCast(obj, "Process")
+ test(proc == None)
+ except Ice.FacetNotExistException:
+ pass
com.destroy()
#
@@ -265,10 +288,15 @@ def allTests(communicator):
obj = com.getAdmin()
pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties")
test(pa.getProperty("Ice.Admin.InstanceName") == "Test")
- tf = TestFacetPrx.checkedCast(obj, "TestFacet")
+ tf = Test.TestFacetPrx.checkedCast(obj, "TestFacet")
tf.op()
- proc = Ice.ProcessPrx.checkedCast(obj, "Process")
- test(proc == None)
+ # TODO: Remote the try/catch once ICE-4862 is fixed
+ try:
+ proc = Ice.ProcessPrx.checkedCast(obj, "Process")
+ test(proc == None)
+ except Ice.FacetNotExistException:
+ pass
+
com.destroy()
#
@@ -281,9 +309,13 @@ def allTests(communicator):
props["Ice.Admin.Facets"] = "TestFacet, Process"
com = factory.createCommunicator(props)
obj = com.getAdmin()
- pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties")
- test(pa == None)
- tf = TestFacetPrx.checkedCast(obj, "TestFacet")
+ # TODO: Remote the try/catch once ICE-4862 is fixed
+ try:
+ pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties")
+ test(pa == None)
+ except Ice.FacetNotExistException:
+ pass
+ tf = Test.TestFacetPrx.checkedCast(obj, "TestFacet")
tf.op()
proc = Ice.ProcessPrx.checkedCast(obj, "Process")
proc.shutdown()
diff --git a/py/test/Ice/admin/Client.py b/py/test/Ice/admin/Client.py
index 56895045f51..0c65476c217 100644
--- a/py/test/Ice/admin/Client.py
+++ b/py/test/Ice/admin/Client.py
@@ -25,6 +25,7 @@ def test(b):
def run(args, communicator):
AllTests.allTests(communicator)
+ return True
try:
communicator = Ice.initialize(sys.argv)
diff --git a/py/test/Ice/admin/Server.py b/py/test/Ice/admin/Server.py
index 56cbdebd0a8..0a689471bf2 100644
--- a/py/test/Ice/admin/Server.py
+++ b/py/test/Ice/admin/Server.py
@@ -27,7 +27,7 @@ def run(args, communicator):
adapter.activate();
communicator.waitForShutdown();
- return 0;
+ return True;
try:
communicator = Ice.initialize(sys.argv)
diff --git a/py/test/Ice/admin/TestI.py b/py/test/Ice/admin/TestI.py
index 30eb3d8386a..d7f2a5d20f5 100644
--- a/py/test/Ice/admin/TestI.py
+++ b/py/test/Ice/admin/TestI.py
@@ -7,7 +7,7 @@
#
# **********************************************************************
-import Ice, Test
+import Ice, Test, threading
def test(b):
if not b:
@@ -23,10 +23,10 @@ class RemoteCommunicatorI(Test.RemoteCommunicator, Ice.PropertiesAdminUpdateCall
self.called = False
self.m = threading.Condition()
- def getAdmin(current = None):
+ def getAdmin(self, current = None):
return self.communicator.getAdmin()
- def getChanges(current = None):
+ def getChanges(self, current = None):
self.m.acquire()
try:
#
@@ -36,52 +36,52 @@ class RemoteCommunicatorI(Test.RemoteCommunicator, Ice.PropertiesAdminUpdateCall
# updated() method is called. We block here to ensure that updated()
# gets called before we return the most recent set of changes.
#
- while !self.called:
+ while not self.called:
self.m.wait()
- self.called = false
+ self.called = False
return self.changes
finally:
self.m.release()
- def shutdown(current = None):
+ def shutdown(self, current = None):
self.communicator.shutdown()
- def waitForShutdown(current = None):
+ def waitForShutdown(self, current = None):
#
# Note that we are executing in a thread of the *main* communicator,
# not the one that is being shut down.
#
self.communicator.waitForShutdown()
- def destroy(current = None):
+ def destroy(self, current = None):
self.communicator.destroy()
- def updated(changes):
+ def updated(self, changes):
self.m.acquire()
try:
self.changes = changes
- self.called = true
+ self.called = True
self.m.notify()
finally:
self.m.release()
class RemoteCommunicatorFactoryI(Test.RemoteCommunicatorFactory):
- def createCommunicator(props, current = None):
+ def createCommunicator(self, props, current = None):
#
# Prepare the property set using the given properties.
#
init = Ice.InitializationData()
- init.properties = Ice.Util.createProperties()
- for k, v in props:
+ init.properties = Ice.createProperties()
+ for k, v in props.items():
init.properties.setProperty(k, v)
#
# Initialize a new communicator.
#
- communicator = Ice.Util.initialize(init)
+ communicator = Ice.initialize(init)
#
# Install a custom admin facet.
@@ -92,16 +92,14 @@ class RemoteCommunicatorFactoryI(Test.RemoteCommunicatorFactory):
# The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback.
# Set the callback on the admin facet.
#
- RemoteCommunicatorI servant = RemoteCommunicatorI(communicator)
- propFacet = communicator.findAdminFacet("Properties")
-
- admin = (Ice.NativePropertiesAdmin)propFacet
+ servant = RemoteCommunicatorI(communicator)
+ admin = communicator.findAdminFacet("Properties")
test(admin != None)
admin.addUpdateCallback(servant)
proxy = current.adapter.addWithUUID(servant)
- return RemoteCommunicatorPrxHelper.uncheckedCast(proxy)
+ return Test.RemoteCommunicatorPrx.uncheckedCast(proxy)
- def shutdown(current = None)
+ def shutdown(self, current = None):
current.adapter.getCommunicator().shutdown()