diff options
Diffstat (limited to 'cpp/test/IceGrid')
36 files changed, 465 insertions, 760 deletions
diff --git a/cpp/test/IceGrid/activation/Client.cpp b/cpp/test/IceGrid/activation/Client.cpp index d1f1cacf8d0..f95f7d0e44c 100644 --- a/cpp/test/IceGrid/activation/Client.cpp +++ b/cpp/test/IceGrid/activation/Client.cpp @@ -30,7 +30,8 @@ main(int argc, char* argv[]) try { - communicator = Ice::initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) diff --git a/cpp/test/IceGrid/activation/run.py b/cpp/test/IceGrid/activation/run.py deleted file mode 100755 index a63c91df643..00000000000 --- a/cpp/test/IceGrid/activation/run.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -IceGridAdmin.iceGridTest("application.xml", - applicationOptions = ("properties-override='%s' icegridnode.exe='%s' server.dir='%s'" % - (IceGridAdmin.iceGridNodePropertiesOverride(), - TestUtil.getIceGridNode(), - TestUtil.getTestDirectory("server")))) diff --git a/cpp/test/IceGrid/activation/test.py b/cpp/test/IceGrid/activation/test.py new file mode 100644 index 00000000000..46d8a9bba8b --- /dev/null +++ b/cpp/test/IceGrid/activation/test.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +TestSuite(__file__, [IceGridTestCase()], multihost=False)
\ No newline at end of file diff --git a/cpp/test/IceGrid/admin/run.py b/cpp/test/IceGrid/admin/run.py deleted file mode 100755 index 5a97714f410..00000000000 --- a/cpp/test/IceGrid/admin/run.py +++ /dev/null @@ -1,262 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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, signal - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -if not TestUtil.isWin32() and os.getuid() == 0: - sys.stdout.write("\n") - sys.stdout.write("*** can't run test as root ***\n") - sys.stdout.write("\n") - sys.exit(0) - -testdir = os.getcwd(); - -router = TestUtil.getGlacier2Router() -targets = [] -if TestUtil.appverifier: - targets = [ TestUtil.getIceGridNode(), TestUtil.getIceGridRegistry(), router] - TestUtil.setAppVerifierSettings(targets) - -registryProcs = IceGridAdmin.startIceGridRegistry(testdir) -nodeProc = IceGridAdmin.startIceGridNode(testdir) - -sys.stdout.write("starting glacier2... ") -sys.stdout.flush() - -args = ' --Glacier2.SessionTimeout=5' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Glacier2.SessionManager=TestIceGrid/AdminSessionManager' + \ - ' --Glacier2.PermissionsVerifier=Glacier2/NullPermissionsVerifier' + \ - ' --Glacier2.SSLSessionManager=TestIceGrid/AdminSSLSessionManager' + \ - ' --Glacier2.SSLPermissionsVerifier=Glacier2/NullSSLPermissionsVerifier' + \ - ' --Ice.Default.Locator="TestIceGrid/Locator:default -p 12010"' + \ - ' --IceSSL.VerifyPeer=1' -routerProc = TestUtil.startServer(router, args, count=2) -print("ok") - -sys.stdout.write("testing login with username/password... ") -sys.stdout.flush() - -# Direct registry connection with username/password -icegridadmin = TestUtil.getIceGridAdmin() -args = ' --Ice.Default.Locator="TestIceGrid/Locator:default -p 12010"' + \ - ' --IceGridAdmin.Username=demo' + \ - ' --IceGridAdmin.Password=dummy' -admin = TestUtil.startClient(icegridadmin, args, None, None, False) -admin.expect('>>> ') -admin.sendline("server list") -admin.expect('>>> ') -admin.sendline('exit') -admin.waitTestSuccess(timeout=120) - -# Glacier2 connection with username/password -args = ' --Ice.Default.Router="Glacier2/router:default -p 12347"' + \ - ' --IceGridAdmin.Username=demo' + \ - ' --IceGridAdmin.Password=dummy' -admin = TestUtil.startClient(icegridadmin, args, None, None, False) -admin.expect('>>> ') -admin.sendline("server list") -admin.expect('>>> ') -admin.sendline('exit') -admin.waitTestSuccess(timeout=120) -print("ok") - -if TestUtil.protocol == "ssl": - - sys.stdout.write("testing login with ssl... ") - sys.stdout.flush() - - # Direct registry connection with SSL - icegridadmin = TestUtil.getIceGridAdmin() - args = ' --Ice.Default.Locator="TestIceGrid/Locator:default -p 12010" --ssl' - admin = TestUtil.startClient(icegridadmin, args, None, None, False) - admin.expect('>>> ') - admin.sendline("server list") - admin.expect('>>> ') - admin.sendline('exit') - admin.waitTestSuccess(timeout=120) - - # Glacier2 connection with username/password - args = ' --Ice.Default.Router="Glacier2/router:default -p 12347" --ssl' - admin = TestUtil.startClient(icegridadmin, args, None, None, False) - admin.expect('>>> ') - admin.sendline("server list") - admin.expect('>>> ') - admin.sendline('exit') - admin.waitTestSuccess(timeout=120) - - print("ok") - -sys.stdout.write("testing commands... ") -sys.stdout.flush() -icegridadmin = TestUtil.getIceGridAdmin() -args = ' --Ice.Default.Locator="TestIceGrid/Locator:default -p 12010"' + \ - ' --IceGridAdmin.Username=demo' + \ - ' --IceGridAdmin.Password=dummy' -admin = TestUtil.startClient(icegridadmin, args, None, None, False) -try: - admin.expect('>>> ') - admin.sendline('application add application.xml server.dir=%s' % TestUtil.getTestDirectory("server")) - admin.expect('>>> ') - admin.sendline('application list') - admin.expect('Test') - admin.sendline('application describe Test') - admin.expect('application `Test\'') - admin.expect('\{.*\}') - admin.expect('>>> ') - admin.sendline('application diff application.xml server.dir=%s' % TestUtil.getTestDirectory("server")) - admin.expect('application `Test\'\n\{.*\}') - admin.expect('>>> ') - admin.sendline('application update application.xml server.dir=%s' % TestUtil.getTestDirectory("server")) - admin.expect('>>> ') - admin.sendline('application patch Test') - admin.expect('>>> ') - admin.sendline('server list') - admin.expect('server') - admin.expect('>>> ') - admin.sendline('server describe server') - admin.expect('server `server\'\n\{.*\}') - admin.expect('>>> ') - admin.sendline('server start server') - admin.expect('>>> ') - admin.sendline('server state server') - admin.expect('^active \(.*\)') - admin.expect('>>> ') - admin.sendline('server pid server') - admin.expect('[0-9]+') - admin.expect('>>> ') - admin.sendline('server properties server') - admin.expect('>>> ') - admin.sendline('server property server Ice.Admin.ServerId') - admin.expect("^server") - admin.expect('>>> ') - admin.sendline('server patch server') - admin.expect('>>> ') - admin.sendline('server disable server') - admin.expect('>>> ') - admin.sendline('server enable server') - admin.expect('>>> ') - admin.sendline('adapter list') - admin.expect('TestAdapter') - admin.expect('>>> ') - admin.sendline('adapter endpoints TestAdapter') - admin.expect(['tcp', 'ssl']) - admin.expect('>>> ') - admin.sendline('object list') - admin.expect('test') - admin.expect('>>> ') - admin.sendline('object describe') - admin.expect('proxy = `.*\' type = `.*\'') - admin.expect('>>> ') - admin.sendline('object find Test') - admin.expect('test') - admin.expect('>>> ') - admin.sendline('server stop server') - admin.expect('>>> ') - admin.sendline('application remove Test') - admin.expect('>>> ') - admin.sendline('registry list') - admin.expect('Master') - admin.expect('>>> ') - admin.sendline('registry ping Master') - admin.expect('registry is up') - admin.expect('>>> ') - admin.sendline('registry describe Master') - admin.expect('registry `Master\'\n{.*}') - admin.expect('>>> ') - admin.sendline('node list') - admin.expect('localnode') - admin.expect('>>> ') - admin.sendline('node describe localnode') - admin.expect('node `localnode\'\n{.*}') - admin.expect('>>> ') - admin.sendline('node load localnode') - admin.expect('load average.*\n') - admin.expect('>>> ') - admin.sendline('node ping localnode') - admin.expect('node is up') - admin.expect('>>> ') - admin.sendline('exit') - admin.waitTestSuccess(timeout=120) - print("ok") -except Exception as e: - admin.terminate() - print("error: " + str(e)) - print("failed!") - -# sys.stdout.write("testing icegridadmin... ") -# sys.stdout.flush() - -# admin = Util.spawn('icegridadmin --Ice.Config=config.admin --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"') -# admin.expect('>>> ') -# admin.sendline("server list") -# admin.expect('SimpleServer') -# admin.expect('>>> ') -# admin.sendline('exit') -# admin.waitTestSuccess(timeout=120) - -# admin = Util.spawn('icegridadmin --Ice.Config=config.admin --ssl') -# admin.expect('>>> ') -# admin.sendline("server list") -# admin.expect('SimpleServer') -# admin.expect('>>> ') -# admin.sendline('exit') -# admin.waitTestSuccess(timeout=120) - -# admin = Util.spawn('icegridadmin --Ice.Config=config.admin --ssl --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"') -# admin.expect('>>> ') -# admin.sendline("server list") -# admin.expect('SimpleServer') -# admin.expect('>>> ') -# admin.sendline('exit') -# admin.waitTestSuccess(timeout=120) - -# print("ok") - -# sys.stdout.write("completing shutdown... ") -# sys.stdout.flush() - -# admin = Util.spawn('icegridadmin --Ice.Config=config.admin') -# admin.expect('>>> ') - -# admin.sendline('node shutdown Node') -# admin.expect('>>> ') -# node.waitTestSuccess(timeout=120) - -# admin.sendline('registry shutdown Master') -# admin.expect('>>> ') -# registry.waitTestSuccess() - -# admin.sendline('exit') -# admin.waitTestSuccess(timeout=120) - -sys.stdout.write("stopping glacier2... ") -sys.stdout.flush() -routerProc.kill(signal.SIGINT) -routerProc.waitTestSuccess() -print("ok") - -IceGridAdmin.iceGridAdmin("node shutdown localnode") -IceGridAdmin.shutdownIceGridRegistry(registryProcs) -nodeProc.waitTestSuccess() - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets) diff --git a/cpp/test/IceGrid/admin/test.py b/cpp/test/IceGrid/admin/test.py new file mode 100644 index 00000000000..7821d0dfe57 --- /dev/null +++ b/cpp/test/IceGrid/admin/test.py @@ -0,0 +1,167 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +class IceGridAdminTestCase(IceGridTestCase): + + def __init__(self): + self.glacier2router = Glacier2Router(props=routerProps, waitForShutdown=False) + IceGridTestCase.__init__(self, application=None, server=self.glacier2router) + + def runClientSide(self, current): + + current.write("testing login with username/password... ") + + admin=IceGridAdmin() + + admin.start(current) + admin.expect('>>> ') + admin.sendline("server list") + admin.expect('>>> ') + admin.sendline('exit') + admin.stop(current, True) + + defaultRouterProps = { "Ice.Default.Router" : self.glacier2router.getClientProxy(current) } + + admin.start(current, props=defaultRouterProps) + admin.expect('>>> ') + admin.sendline("server list") + admin.expect('>>> ') + admin.sendline('exit') + admin.stop(current, True) + + current.writeln("ok") + + if current.config.protocol == "ssl": + + current.write("testing login with ssl... ") + + # Direct registry connection with SSL + admin.start(current, args=["--ssl"]) + admin.expect('>>> ') + admin.sendline("server list") + admin.expect('>>> ') + admin.sendline('exit') + admin.stop(current, True) + + # Glacier2 connection with username/password + admin.start(current, args=["--ssl"], props=defaultRouterProps) + admin.expect('>>> ') + admin.sendline("server list") + admin.expect('>>> ') + admin.sendline('exit') + admin.stop(current, True) + + current.writeln("ok") + + current.write("testing commands... ") + admin.start(current) + try: + serverDir = current.getBuildDir("server") + + admin.expect('>>> ') + admin.sendline('application add application.xml server.dir=%s' % serverDir) + admin.expect('>>> ') + admin.sendline('application list') + admin.expect('Test') + admin.sendline('application describe Test') + admin.expect('application `Test\'') + admin.expect('\{.*\}') + admin.expect('>>> ') + admin.sendline('application diff application.xml server.dir=%s' % serverDir) + admin.expect('application `Test\'\n\{.*\}') + admin.expect('>>> ') + admin.sendline('application update application.xml server.dir=%s' % serverDir) + admin.expect('>>> ') + admin.sendline('application patch Test') + admin.expect('>>> ') + admin.sendline('server list') + admin.expect('server') + admin.expect('>>> ') + admin.sendline('server describe server') + admin.expect('server `server\'\n\{.*\}') + admin.expect('>>> ') + admin.sendline('server start server') + admin.expect('>>> ') + admin.sendline('server state server') + admin.expect('^active \(.*\)') + admin.expect('>>> ') + admin.sendline('server pid server') + admin.expect('[0-9]+') + admin.expect('>>> ') + admin.sendline('server properties server') + admin.expect('>>> ') + admin.sendline('server property server Ice.Admin.ServerId') + admin.expect("^server") + admin.expect('>>> ') + admin.sendline('server patch server') + admin.expect('>>> ') + admin.sendline('server disable server') + admin.expect('>>> ') + admin.sendline('server enable server') + admin.expect('>>> ') + admin.sendline('adapter list') + admin.expect('TestAdapter') + admin.expect('>>> ') + admin.sendline('adapter endpoints TestAdapter') + admin.expect(['tcp', 'ssl', 'ws', 'wss']) + admin.expect('>>> ') + admin.sendline('object list') + admin.expect('test') + admin.expect('>>> ') + admin.sendline('object describe') + admin.expect('proxy = `.*\' type = `.*\'') + admin.expect('>>> ') + admin.sendline('object find Test') + admin.expect('test') + admin.expect('>>> ') + admin.sendline('server stop server') + admin.expect('>>> ') + admin.sendline('application remove Test') + admin.expect('>>> ') + admin.sendline('registry list') + admin.expect('Master') + admin.expect('>>> ') + admin.sendline('registry ping Master') + admin.expect('registry is up') + admin.expect('>>> ') + admin.sendline('registry describe Master') + admin.expect('registry `Master\'\n{.*}') + admin.expect('>>> ') + admin.sendline('node list') + admin.expect('localnode') + admin.expect('>>> ') + admin.sendline('node describe localnode') + admin.expect('node `localnode\'\n{.*}') + admin.expect('>>> ') + admin.sendline('node load localnode') + admin.expect('load average.*\n') + admin.expect('>>> ') + admin.sendline('node ping localnode') + admin.expect('node is up') + admin.expect('>>> ') + admin.sendline('exit') + admin.stop(current, True) + current.writeln("ok") + except Exception as e: + admin.stop(current, False) + print("error: " + str(e)) + print("failed!") + +routerProps= lambda process, current: { + 'Glacier2.SessionTimeout' : 5, + 'Glacier2.SessionManager' : 'TestIceGrid/AdminSessionManager', + 'Glacier2.PermissionsVerifier' : 'Glacier2/NullPermissionsVerifier', + 'Glacier2.SSLSessionManager' : 'TestIceGrid/AdminSSLSessionManager', + 'Glacier2.SSLPermissionsVerifier' : 'Glacier2/NullSSLPermissionsVerifier', + 'Ice.Default.Locator' : current.testcase.getLocator(current), + 'IceSSL.VerifyPeer' : 1 +} + +TestSuite(__file__, [ IceGridAdminTestCase() ], multihost=False)
\ No newline at end of file diff --git a/cpp/test/IceGrid/allocation/Client.cpp b/cpp/test/IceGrid/allocation/Client.cpp index 9ae4d662dad..f5cbbb67e8f 100644 --- a/cpp/test/IceGrid/allocation/Client.cpp +++ b/cpp/test/IceGrid/allocation/Client.cpp @@ -27,8 +27,9 @@ main(int argc, char* argv[]) int status; Ice::CommunicatorPtr communicator; try - { - communicator = Ice::initialize(argc, argv); + { + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv)); status = run(argc, argv, communicator); } diff --git a/cpp/test/IceGrid/allocation/run.py b/cpp/test/IceGrid/allocation/run.py deleted file mode 100755 index 1134bcb4756..00000000000 --- a/cpp/test/IceGrid/allocation/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -IceGridAdmin.iceGridTest("application.xml", applicationOptions = "server.dir='%s' verifier.dir='%s'" % - (TestUtil.getTestDirectory("server"), TestUtil.getTestDirectory("verifier"))) diff --git a/cpp/test/IceGrid/allocation/test.py b/cpp/test/IceGrid/allocation/test.py new file mode 100644 index 00000000000..5c741aaa38c --- /dev/null +++ b/cpp/test/IceGrid/allocation/test.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +TestSuite(__file__, [IceGridTestCase(exevars={ "verifier.dir": "verifier" })], runOnMainThread=True, multihost=False)
\ No newline at end of file diff --git a/cpp/test/IceGrid/deployer/Client.cpp b/cpp/test/IceGrid/deployer/Client.cpp index b0d3e136eb3..b1afe894a0b 100644 --- a/cpp/test/IceGrid/deployer/Client.cpp +++ b/cpp/test/IceGrid/deployer/Client.cpp @@ -57,7 +57,8 @@ main(int argc, char* argv[]) try { - communicator = Ice::initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) diff --git a/cpp/test/IceGrid/deployer/run.py b/cpp/test/IceGrid/deployer/run.py deleted file mode 100755 index a1ea4e587eb..00000000000 --- a/cpp/test/IceGrid/deployer/run.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testservice"))]) -serverDir = os.path.join(os.getcwd(), TestUtil.getTestDirectory("server")) -os.environ["MY_FOO"] = "12" -IceGridAdmin.iceGridTest("application.xml", '--TestDir="%s"' % serverDir, ("icebox.exe='%s' server.dir='%s'" % - (TestUtil.getIceBox(), serverDir))) - -# Tests with targets -IceGridAdmin.iceGridTest("application.xml", '-t --TestDir="%s"' % serverDir, - ("icebox.exe='%s' server.dir='%s' moreservers moreservices moreproperties" % - (TestUtil.getIceBox(), serverDir))) diff --git a/cpp/test/IceGrid/deployer/test.py b/cpp/test/IceGrid/deployer/test.py new file mode 100644 index 00000000000..d64fbf4b9a4 --- /dev/null +++ b/cpp/test/IceGrid/deployer/test.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +clientProps=lambda process, current: { "TestDir" : current.getBuildDir("server") } + +TestSuite(__file__, [ + IceGridTestCase("without targets", + icegridnode=IceGridNode(envs={ "MY_FOO" : 12 }), + client=IceGridClient(props=clientProps)), + IceGridTestCase("with targets", + icegridnode=IceGridNode(envs={ "MY_FOO" : 12 }), + client=IceGridClient(props=clientProps), + targets=["moreservers", "moreservices", "moreproperties"]) +], libDirs=["testservice"], multihost=False) diff --git a/cpp/test/IceGrid/distribution/Client.cpp b/cpp/test/IceGrid/distribution/Client.cpp index 9ae4d662dad..f5cbbb67e8f 100644 --- a/cpp/test/IceGrid/distribution/Client.cpp +++ b/cpp/test/IceGrid/distribution/Client.cpp @@ -27,8 +27,9 @@ main(int argc, char* argv[]) int status; Ice::CommunicatorPtr communicator; try - { - communicator = Ice::initialize(argc, argv); + { + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv)); status = run(argc, argv, communicator); } diff --git a/cpp/test/IceGrid/distribution/run.py b/cpp/test/IceGrid/distribution/run.py deleted file mode 100755 index 8e44b30915d..00000000000 --- a/cpp/test/IceGrid/distribution/run.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -def icepatch2Calc(datadir, dirname): - icePatch2Calc = os.path.join(TestUtil.getCppBinDir(), "icepatch2calc") - commandProc = TestUtil.spawn('"%s" "%s"' % (icePatch2Calc, os.path.join(datadir, dirname))) - commandProc.waitTestSuccess() - -datadir = os.path.join(os.getcwd(), "data") - -files = [ - [ "original/rootfile", "rootfile" ], - [ "original/dir1/file1", "dummy-file1"], - [ "original/dir1/file2", "dummy-file2"], - [ "original/dir2/file3", "dummy-file3"], - [ "updated/rootfile", "rootfile-updated!" ], - [ "updated/dir1/file2", "dummy-file2-updated!"], - [ "updated/dir2/file3", "dummy-file3"], - [ "updated/dir2/file4", "dummy-file4"], -] - - -sys.stdout.write("creating IcePatch2 data directory... ") -sys.stdout.flush() -if not os.path.exists(datadir): - os.mkdir(datadir) -else: - IceGridAdmin.cleanDbDir(datadir) - -for [file, content] in files: - file = os.path.join(datadir, file) - if not os.path.exists(os.path.dirname(file)): - os.makedirs(os.path.dirname(file)) - f = open(file, 'w') - f.write(content) - f.close() - -icepatch2Calc(datadir, "original") -icepatch2Calc(datadir, "updated") -print("ok") - -IceGridAdmin.iceGridTest("application.xml", "", "server.dir='%s'" % TestUtil.getTestDirectory("server")) - -IceGridAdmin.cleanDbDir(datadir) -os.rmdir(datadir) diff --git a/cpp/test/IceGrid/distribution/test.py b/cpp/test/IceGrid/distribution/test.py new file mode 100644 index 00000000000..1c7d8313781 --- /dev/null +++ b/cpp/test/IceGrid/distribution/test.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +class IceGridDistributionTestCase(IceGridTestCase): + + def setupClientSide(self, current): + IceGridTestCase.setupClientSide(self, current) + + datadir = os.path.join(self.getPath(), "data") + + files = [ + [ "original/rootfile", "rootfile" ], + [ "original/dir1/file1", "dummy-file1"], + [ "original/dir1/file2", "dummy-file2"], + [ "original/dir2/file3", "dummy-file3"], + [ "updated/rootfile", "rootfile-updated!" ], + [ "updated/dir1/file2", "dummy-file2-updated!"], + [ "updated/dir2/file3", "dummy-file3"], + [ "updated/dir2/file4", "dummy-file4"], + ] + + current.write("creating IcePatch2 data directory... ") + self.mkdirs(datadir) + + for [file, content] in files: + file = os.path.join(datadir, file) + if not os.path.exists(os.path.dirname(file)): + os.makedirs(os.path.dirname(file)) + f = open(file, 'w') + f.write(content) + f.close() + + IcePatch2Calc(args=[os.path.join(datadir, "original")]).run(current) + IcePatch2Calc(args=[os.path.join(datadir, "updated")]).run(current) + + current.writeln("ok") + +TestSuite(__file__, [ IceGridDistributionTestCase() ], runOnMainThread=True, multihost=False)
\ No newline at end of file diff --git a/cpp/test/IceGrid/fileLock/run.py b/cpp/test/IceGrid/fileLock/run.py deleted file mode 100755 index 52358f410f6..00000000000 --- a/cpp/test/IceGrid/fileLock/run.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -testdir = os.getcwd(); - -# No need to spawn replicas for this test. -IceGridAdmin.nreplicas = 0 - -def runIceGridRegistry(): - iceGrid = TestUtil.getIceGridRegistry() - command = ' --nowarn ' + IceGridAdmin.registryOptions - - dataDir = os.path.join(testdir, "db", "registry") - if not os.path.exists(dataDir): - os.mkdir(dataDir) - - cmd = command + ' ' + \ - r' --Ice.ProgramName=registry' + \ - r' --IceGrid.Registry.Client.Endpoints="default -p ' + str(IceGridAdmin.iceGridPort) + '" ' + \ - r' --IceGrid.Registry.LMDB.MapSize=1 --IceGrid.Registry.LMDB.Path="' + dataDir + '"' - - driverConfig = TestUtil.DriverConfig("server") - driverConfig.lang = "cpp" - - cmd = TestUtil.getCommandLine(iceGrid, driverConfig) + ' ' + cmd - proc = TestUtil.spawn(cmd) - return proc - -registryProcs = IceGridAdmin.startIceGridRegistry(testdir) - -sys.stdout.write("testing IceGrid file lock... ") -IceGridAdmin.iceGridPort = 12011 -iceGrid = runIceGridRegistry() -iceGrid.expect(".*IceUtil::FileLockException.*") -iceGrid.wait() -IceGridAdmin.iceGridPort = 12010 -print("ok") - -IceGridAdmin.shutdownIceGridRegistry(registryProcs) diff --git a/cpp/test/IceGrid/fileLock/test.py b/cpp/test/IceGrid/fileLock/test.py new file mode 100644 index 00000000000..9a9ee60ece1 --- /dev/null +++ b/cpp/test/IceGrid/fileLock/test.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +class IceGridAdminTestCase(IceGridTestCase): + + def runClientSide(self, current): + + sys.stdout.write("testing IceGrid file lock... ") + registry = IceGridRegistryMaster(portnum=25, readyCount=0, quiet=True); + registry.start(current) + registry.expect(".*IceUtil::FileLockException.*") + registry.stop(current, False) + print("ok") + + +TestSuite(__file__, [ IceGridAdminTestCase(application=None) ], runOnMainThread=True, multihost=False)
\ No newline at end of file diff --git a/cpp/test/IceGrid/noRestartUpdate/Client.cpp b/cpp/test/IceGrid/noRestartUpdate/Client.cpp index 9ae4d662dad..f5cbbb67e8f 100644 --- a/cpp/test/IceGrid/noRestartUpdate/Client.cpp +++ b/cpp/test/IceGrid/noRestartUpdate/Client.cpp @@ -27,8 +27,9 @@ main(int argc, char* argv[]) int status; Ice::CommunicatorPtr communicator; try - { - communicator = Ice::initialize(argc, argv); + { + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv)); status = run(argc, argv, communicator); } diff --git a/cpp/test/IceGrid/noRestartUpdate/run.py b/cpp/test/IceGrid/noRestartUpdate/run.py deleted file mode 100755 index 89cdc8ad8df..00000000000 --- a/cpp/test/IceGrid/noRestartUpdate/run.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -name = os.path.join("IceGrid", "noRestartUpdate") - -node1Dir = os.path.join(os.getcwd(), "db", "node-1") -if not os.path.exists(node1Dir): - os.mkdir(node1Dir) -else: - IceGridAdmin.cleanDbDir(node1Dir) - -node2Dir = os.path.join(os.getcwd(), "db", "node-2") -if not os.path.exists(node2Dir): - os.mkdir(node2Dir) -else: - IceGridAdmin.cleanDbDir(node2Dir) - - -nodeOverrideOptions = '--IceBinDir="%s" --ServerDir="%s" --ServiceDir="%s" --NodePropertiesOverride="%s Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"' % ( - TestUtil.getCppBinDir("cpp"), - TestUtil.getTestDirectory("server"), - TestUtil.getTestDirectory("testservice"), - TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).replace("--", "")) - -IceGridAdmin.iceGridTest("", nodeOverrideOptions) diff --git a/cpp/test/IceGrid/noRestartUpdate/test.py b/cpp/test/IceGrid/noRestartUpdate/test.py new file mode 100644 index 00000000000..220ca4ef8b3 --- /dev/null +++ b/cpp/test/IceGrid/noRestartUpdate/test.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +class IceGridNoRestartUpdateTestCase(IceGridTestCase): + + def setupClientSide(self, current): + IceGridTestCase.setupClientSide(self, current) + self.mkdirs("db/node1") + self.mkdirs("db/node2") + +clientProps = lambda process, current: { + "IceBinDir" : current.testcase.getMapping().getBinDir(current), + "ServerDir" : current.getBuildDir("server"), + "ServiceDir" : current.getBuildDir("testservice") +} + +TestSuite(__file__, + [IceGridNoRestartUpdateTestCase(application=None, client=IceGridClient(props=clientProps))], + multihost=False)
\ No newline at end of file diff --git a/cpp/test/IceGrid/replicaGroup/Client.cpp b/cpp/test/IceGrid/replicaGroup/Client.cpp index 63bb6395585..5ca10eeb8c4 100644 --- a/cpp/test/IceGrid/replicaGroup/Client.cpp +++ b/cpp/test/IceGrid/replicaGroup/Client.cpp @@ -29,7 +29,8 @@ main(int argc, char* argv[]) try { - communicator = Ice::initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) diff --git a/cpp/test/IceGrid/replicaGroup/run.py b/cpp/test/IceGrid/replicaGroup/run.py deleted file mode 100755 index 69671e7e188..00000000000 --- a/cpp/test/IceGrid/replicaGroup/run.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -# -# Don't use a slave registry for this test. This can lead to race -# conditions when resolving endpoints of round-robin replica groups if -# the slave didn't fully load the servers at the time of the client -# invocation -# -IceGridAdmin.nreplicas=0 - -IceGridAdmin.registryOptions += " --Ice.Plugin.RegistryPlugin=RegistryPlugin:createRegistryPlugin" -IceGridAdmin.registryOptions += " --IceGrid.Registry.DynamicRegistration" - - -TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("registryplugin"))]) -TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testservice"))]) - -IceGridAdmin.iceGridTest("application.xml", - "--Ice.RetryIntervals=\"0 50 100 250\"", "icebox.exe='%s' server.dir='%s'" % (TestUtil.getIceBox(), TestUtil.getTestDirectory("server"))) diff --git a/cpp/test/IceGrid/replicaGroup/test.py b/cpp/test/IceGrid/replicaGroup/test.py new file mode 100644 index 00000000000..3ad7fdbbe9b --- /dev/null +++ b/cpp/test/IceGrid/replicaGroup/test.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +registryProps = { + "Ice.Plugin.RegistryPlugin" : "RegistryPlugin:createRegistryPlugin", + "IceGrid.Registry.DynamicRegistration" : 1 +} + +clientProps = { + "Ice.RetryIntervals" : "0 50 100 250" +} + +TestSuite(__file__, + [IceGridTestCase(icegridregistry=[IceGridRegistryMaster(props=registryProps)], + client=IceGridClient(props=clientProps))], + libDirs=["registryplugin", "testservice"], + multihost=False) diff --git a/cpp/test/IceGrid/replication/Client.cpp b/cpp/test/IceGrid/replication/Client.cpp index 09723c6d4a4..9fd0d611644 100644 --- a/cpp/test/IceGrid/replication/Client.cpp +++ b/cpp/test/IceGrid/replication/Client.cpp @@ -29,7 +29,8 @@ main(int argc, char* argv[]) try { - communicator = Ice::initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv)); status = run(argc, argv, communicator); } diff --git a/cpp/test/IceGrid/replication/run.py b/cpp/test/IceGrid/replication/run.py deleted file mode 100755 index bf8a8b4ef91..00000000000 --- a/cpp/test/IceGrid/replication/run.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -TestUtil.addLdPath(os.getcwd()) - -serverdir = os.path.join(os.getcwd(), TestUtil.getTestDirectory("server")) -variables = ("properties-override='%s' icegridnode.exe='%s' icegridregistry.exe='%s' server.dir='%s'" % - (IceGridAdmin.iceGridNodePropertiesOverride(), TestUtil.getIceGridNode(), TestUtil.getIceGridRegistry(), serverdir)) - -IceGridAdmin.iceGridTest("application.xml", '--IceDir="%s" --ServerDir="%s"' % (TestUtil.toplevel, serverdir), - variables) diff --git a/cpp/test/IceGrid/replication/test.py b/cpp/test/IceGrid/replication/test.py new file mode 100644 index 00000000000..984b83bc069 --- /dev/null +++ b/cpp/test/IceGrid/replication/test.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +clientProps = lambda process, current: { + "IceDir" : toplevel, + "ServerDir" : current.getBuildDir("server"), +} + +TestSuite(__file__, [ IceGridTestCase(client=IceGridClient(props=clientProps)) ], runOnMainThread=True, multihost=False)
\ No newline at end of file diff --git a/cpp/test/IceGrid/session/Client.cpp b/cpp/test/IceGrid/session/Client.cpp index 4105cbaaaf7..bf5487c553b 100644 --- a/cpp/test/IceGrid/session/Client.cpp +++ b/cpp/test/IceGrid/session/Client.cpp @@ -27,8 +27,7 @@ main(int argc, char* argv[]) Ice::CommunicatorPtr communicator; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); communicator = Ice::initialize(argc, argv, initData); communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv)); diff --git a/cpp/test/IceGrid/session/PermissionsVerifier.cpp b/cpp/test/IceGrid/session/PermissionsVerifier.cpp index ec8444d7f00..c7c70a34007 100644 --- a/cpp/test/IceGrid/session/PermissionsVerifier.cpp +++ b/cpp/test/IceGrid/session/PermissionsVerifier.cpp @@ -11,6 +11,7 @@ #include <Glacier2/PermissionsVerifier.h> #include <IceSSL/Plugin.h> #include <Test.h> +#include <TestCommon.h> using namespace std; @@ -25,11 +26,6 @@ public: { throw Test::ExtendedPermissionDeniedException("reason"); } - if(userId == "shutdown") - { - c.adapter->getCommunicator()->shutdown(); - return true; - } return (userId == "admin1" && passwd == "test1") || (userId == "admin2" && passwd == "test2") || (userId == "admin3" && passwd == "test3"); } @@ -41,8 +37,7 @@ public: virtual int run(int, char*[]) { - Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints( - "PermissionsVerifier", "tcp -p 12002"); + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PermissionsVerifier"); adapter->add(new AdminPermissionsVerifierI, Ice::stringToIdentity("AdminPermissionsVerifier")); adapter->activate(); communicator()->waitForShutdown(); @@ -54,5 +49,7 @@ int main(int argc, char* argv[]) { PermissionsVerifierServer app; - return app.main(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + initData.properties->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv)); + return app.main(argc, argv, initData); } diff --git a/cpp/test/IceGrid/session/run.py b/cpp/test/IceGrid/session/run.py deleted file mode 100755 index 0ff6d646f51..00000000000 --- a/cpp/test/IceGrid/session/run.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -if not TestUtil.isWin32() and os.getuid() == 0: - sys.stdout.write("\n") - sys.stdout.write("*** can't run test as root ***\n") - sys.stdout.write("\n") - sys.exit(0) - -name = os.path.join("IceGrid", "session") - -node1Dir = os.path.join(os.getcwd(), "db", "node-1") -if not os.path.exists(node1Dir): - os.mkdir(node1Dir) -else: - IceGridAdmin.cleanDbDir(node1Dir) - -print("Running test with default encoding...") - -verifier = os.path.join(os.getcwd(), TestUtil.getTestExecutable("verifier")) -sys.stdout.write("starting admin permissions verifier... ") -verifierProc = TestUtil.startServer(verifier, config=TestUtil.DriverConfig("server")) -print("ok") - -IceGridAdmin.registryOptions += \ - r' --Ice.Warn.Dispatch=0' + \ - r' --IceGrid.Registry.DynamicRegistration' + \ - r' --IceGrid.Registry.SessionFilters' + \ - r' --IceGrid.Registry.AdminSessionFilters' + \ - r' --IceGrid.Registry.PermissionsVerifier="ClientPermissionsVerifier"' + \ - r' --IceGrid.Registry.AdminPermissionsVerifier="AdminPermissionsVerifier:tcp -p 12002"'+ \ - r' --IceGrid.Registry.SSLPermissionsVerifier="SSLPermissionsVerifier"' + \ - r' --IceGrid.Registry.AdminSSLPermissionsVerifier="SSLPermissionsVerifier"' - -bindir = TestUtil.getCppBinDir() -testdir = os.getcwd() -serverdir = TestUtil.getTestDirectory("server") - -IceGridAdmin.iceGridTest("application.xml", - '--IceBinDir="%s" --TestDir="%s" --ServerDir="%s"' % (bindir, testdir, serverdir), - 'properties-override=\'%s\' server.dir="%s"' % (IceGridAdmin.iceGridNodePropertiesOverride(), serverdir)) - -verifierProc.waitTestSuccess() - -print("Running test with 1.0 encoding...") - -sys.stdout.write("starting admin permissions verifier... ") -verifierProc = TestUtil.startServer(verifier, config=TestUtil.DriverConfig("server")) -print("ok") - -IceGridAdmin.iceGridTest("application.xml", - '--Ice.Default.EncodingVersion=1.0 --IceBinDir="%s" --TestDir="%s" --ServerDir="%s"' % (bindir, testdir, serverdir), - 'properties-override=\'%s\' server.dir="%s"' % (IceGridAdmin.iceGridNodePropertiesOverride(), serverdir)) - -verifierProc.waitTestSuccess() diff --git a/cpp/test/IceGrid/session/test.py b/cpp/test/IceGrid/session/test.py new file mode 100644 index 00000000000..c720fcf79de --- /dev/null +++ b/cpp/test/IceGrid/session/test.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +class IceGridSessionTestCase(IceGridTestCase): + + def setupClientSide(self, current): + IceGridTestCase.setupClientSide(self, current) + self.mkdirs("db/node-1") + + def setupServerSide(self, current): + self.verifier = Server(exe="verifier", waitForShutdown=False, props={ + "PermissionsVerifier.Endpoints" : "tcp -p 12002" + }) + current.write("starting permission verifier... ") + self.verifier.start(current) + current.writeln("ok") + + def teardownServerSide(self, current, success): + self.verifier.stop(current, success) + self.verifier = None + +registryProps = { + 'Ice.Warn.Dispatch' : '0', + 'IceGrid.Registry.DynamicRegistration' : True, + 'IceGrid.Registry.SessionFilters' : True, + 'IceGrid.Registry.AdminSessionFilters' : True, + 'IceGrid.Registry.PermissionsVerifier' : 'ClientPermissionsVerifier', + 'IceGrid.Registry.AdminPermissionsVerifier' : 'AdminPermissionsVerifier:tcp -p 12002', + 'IceGrid.Registry.SSLPermissionsVerifier' : 'SSLPermissionsVerifier', + 'IceGrid.Registry.AdminSSLPermissionsVerifier' : 'SSLPermissionsVerifier', +} + +clientProps = lambda process, current: { + "IceBinDir" : current.testcase.getMapping().getBinDir(current), + "ServerDir" : current.getBuildDir("server"), + "TestDir" : "{testdir}", +} + +clientProps10 = lambda process, current: { + "IceBinDir" : current.testcase.getMapping().getBinDir(current), + "ServerDir" : current.getBuildDir("server"), + "TestDir" : "{testdir}", + "Ice.Default.EncodingVersion" : "1.0" +} + +icegridregistry = [IceGridRegistryMaster(props=registryProps)] + +TestSuite(__file__, + [ IceGridSessionTestCase("with default encoding", icegridregistry=icegridregistry, + client=IceGridClient(props=clientProps)), + IceGridSessionTestCase("with 1.0 encoding", icegridregistry=icegridregistry, + client=IceGridClient(props=clientProps10))], + runOnMainThread=True, multihost=False) diff --git a/cpp/test/IceGrid/simple/AllTests.cpp b/cpp/test/IceGrid/simple/AllTests.cpp index 26ba499de28..30a6cda5cd1 100644 --- a/cpp/test/IceGrid/simple/AllTests.cpp +++ b/cpp/test/IceGrid/simple/AllTests.cpp @@ -69,13 +69,19 @@ allTests(const Ice::CommunicatorPtr& communicator) Ice::InitializationData initData; initData.properties = communicator->getProperties()->clone(); initData.properties->setProperty("Ice.Default.Locator", ""); - initData.properties->setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:createIceLocatorDiscovery"); + initData.properties->setProperty("Ice.Plugin.IceLocatorDiscovery", + "IceLocatorDiscovery:createIceLocatorDiscovery"); #ifdef __APPLE__ if(initData.properties->getPropertyAsInt("Ice.PreferIPv6Address") > 0) { initData.properties->setProperty("IceLocatorDiscovery.Interface", "::1"); } #endif + { + ostringstream port; + port << getTestPort(initData.properties, 99); + initData.properties->setProperty("IceLocatorDiscovery.Port", port.str()); + } initData.properties->setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter"); initData.properties->setProperty("AdapterForDiscoveryTest.Endpoints", "default"); diff --git a/cpp/test/IceGrid/simple/Client.cpp b/cpp/test/IceGrid/simple/Client.cpp index 0ae43f15ffc..a6a2fe738c0 100644 --- a/cpp/test/IceGrid/simple/Client.cpp +++ b/cpp/test/IceGrid/simple/Client.cpp @@ -19,7 +19,7 @@ int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { bool withDeploy = false; - + for(int i = 1; i < argc; ++i) { if(strcmp(argv[i], "--with-deploy") == 0) @@ -52,7 +52,8 @@ main(int argc, char* argv[]) try { - communicator = Ice::initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Ice::Exception& ex) diff --git a/cpp/test/IceGrid/simple/simple_server.xml b/cpp/test/IceGrid/simple/application.xml index 28119c79715..28119c79715 100644 --- a/cpp/test/IceGrid/simple/simple_server.xml +++ b/cpp/test/IceGrid/simple/application.xml diff --git a/cpp/test/IceGrid/simple/run.py b/cpp/test/IceGrid/simple/run.py deleted file mode 100755 index 9116ada5dad..00000000000 --- a/cpp/test/IceGrid/simple/run.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -# Test IceGrid discovery with multiple replicas -IceGridAdmin.nreplicas=2 - -testdir = os.path.join(os.getcwd(),) -# -# Test client/server without on demand activation. -# -IceGridAdmin.iceGridClientServerTest("", "--TestAdapter.Endpoints=default --TestAdapter.AdapterId=TestAdapter") - -# -# Test client/server with on demand activation. -# -IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy", - "server.dir='%s'" % TestUtil.getTestDirectory("server")) diff --git a/cpp/test/IceGrid/update/Client.cpp b/cpp/test/IceGrid/update/Client.cpp index 9ae4d662dad..f5cbbb67e8f 100644 --- a/cpp/test/IceGrid/update/Client.cpp +++ b/cpp/test/IceGrid/update/Client.cpp @@ -27,8 +27,9 @@ main(int argc, char* argv[]) int status; Ice::CommunicatorPtr communicator; try - { - communicator = Ice::initialize(argc, argv); + { + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv)); status = run(argc, argv, communicator); } diff --git a/cpp/test/IceGrid/update/run.py b/cpp/test/IceGrid/update/run.py deleted file mode 100755 index 79f5e8ca202..00000000000 --- a/cpp/test/IceGrid/update/run.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 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 - -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, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil, IceGridAdmin - -name = os.path.join("IceGrid", "update") - -node1Dir = os.path.join(os.getcwd(), "db", "node-1") -if not os.path.exists(node1Dir): - os.mkdir(node1Dir) -else: - IceGridAdmin.cleanDbDir(node1Dir) - -node2Dir = os.path.join(os.getcwd(), "db", "node-2") -if not os.path.exists(node2Dir): - os.mkdir(node2Dir) -else: - IceGridAdmin.cleanDbDir(node2Dir) - -bindir = TestUtil.getCppBinDir() -testdir = os.getcwd() -serverdir = os.path.join(os.getcwd(), TestUtil.getTestDirectory("server")) - -nodeOverrideOptions = '--IceBinDir="%s" --TestDir="%s" --ServerDir="%s" ' % (bindir, testdir, serverdir) + \ - '--NodePropertiesOverride=\"%s Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0\"' % \ - IceGridAdmin.iceGridNodePropertiesOverride() - -IceGridAdmin.iceGridTest("", nodeOverrideOptions) diff --git a/cpp/test/IceGrid/update/test.py b/cpp/test/IceGrid/update/test.py new file mode 100644 index 00000000000..3decb0431e9 --- /dev/null +++ b/cpp/test/IceGrid/update/test.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# ********************************************************************** +# +# Copyright (c) 2003-2016 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. +# +# ********************************************************************** + +class IceGridUpdateTestCase(IceGridTestCase): + + def setupClientSide(self, current): + IceGridTestCase.setupClientSide(self, current) + self.mkdirs("db/node-1") + self.mkdirs("db/node-2") + +clientProps = lambda process, current: { + "NodePropertiesOverride" : current.testcase.icegridnode[0].getPropertiesOverride(current), + "IceBinDir" : current.testcase.getMapping().getBinDir(current), + "ServerDir" : current.getBuildDir("server"), + "TestDir" : "{testdir}" +} + +TestSuite(__file__, [IceGridUpdateTestCase(application=None, client=IceGridClient(props=clientProps))], multihost=False)
\ No newline at end of file |