diff options
Diffstat (limited to 'cpp/test/Ice/networkProxy')
-rw-r--r-- | cpp/test/Ice/networkProxy/AllTests.cpp | 10 | ||||
-rw-r--r-- | cpp/test/Ice/networkProxy/Client.cpp | 6 | ||||
-rw-r--r-- | cpp/test/Ice/networkProxy/Server.cpp | 5 | ||||
-rwxr-xr-x | cpp/test/Ice/networkProxy/run.py | 45 |
4 files changed, 14 insertions, 52 deletions
diff --git a/cpp/test/Ice/networkProxy/AllTests.cpp b/cpp/test/Ice/networkProxy/AllTests.cpp index f1d2fa1fe71..49cd8789232 100644 --- a/cpp/test/Ice/networkProxy/AllTests.cpp +++ b/cpp/test/Ice/networkProxy/AllTests.cpp @@ -36,10 +36,16 @@ getIPConnectionInfo(const Ice::ConnectionInfoPtr& info) void allTests(const Ice::CommunicatorPtr& communicator) { - string sref = "test:default -p 12010"; + string sref = "test:" + getTestEndpoint(communicator, 0); Ice::ObjectPrxPtr obj = communicator->stringToProxy(sref); test(obj); + int proxyPort = communicator->getProperties()->getPropertyAsInt("Ice.HTTPProxyPort"); + if(proxyPort == 0) + { + proxyPort = communicator->getProperties()->getPropertyAsInt("Ice.SOCKSProxyPort"); + } + TestIntfPrxPtr test = ICE_CHECKED_CAST(TestIntfPrx, obj); test(test); @@ -52,7 +58,7 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing connection information... " << flush; { Ice::IPConnectionInfoPtr info = getIPConnectionInfo(test->ice_getConnection()->getInfo()); - test(info->remotePort == 12030 || info->remotePort == 12031); // make sure we are connected to the proxy port. + test(info->remotePort == proxyPort); // make sure we are connected to the proxy port. } cout << "ok" << endl; diff --git a/cpp/test/Ice/networkProxy/Client.cpp b/cpp/test/Ice/networkProxy/Client.cpp index ca8c629df93..d8b93814226 100644 --- a/cpp/test/Ice/networkProxy/Client.cpp +++ b/cpp/test/Ice/networkProxy/Client.cpp @@ -17,8 +17,7 @@ using namespace std; using namespace Test; int -run(int, char**, const Ice::CommunicatorPtr& communicator) -{ +run(int, char**, const Ice::CommunicatorPtr& communicator){ void allTests(const Ice::CommunicatorPtr&); allTests(communicator); return EXIT_SUCCESS; @@ -33,7 +32,8 @@ main(int argc, char* argv[]) try { - Ice::CommunicatorHolder ich = Ice::initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator()); } catch(const Ice::Exception& ex) diff --git a/cpp/test/Ice/networkProxy/Server.cpp b/cpp/test/Ice/networkProxy/Server.cpp index 07dac51360a..02ca25d574b 100644 --- a/cpp/test/Ice/networkProxy/Server.cpp +++ b/cpp/test/Ice/networkProxy/Server.cpp @@ -34,7 +34,7 @@ public: int run(int, char**, const Ice::CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0) + ":udp"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = ICE_MAKE_SHARED(TestI); adapter->add(object, Ice::stringToIdentity("test")); @@ -53,7 +53,8 @@ main(int argc, char* argv[]) try { - Ice::CommunicatorHolder ich = Ice::initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator()); } catch(const Ice::Exception& ex) diff --git a/cpp/test/Ice/networkProxy/run.py b/cpp/test/Ice/networkProxy/run.py deleted file mode 100755 index 8a5a87c9f42..00000000000 --- a/cpp/test/Ice/networkProxy/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, NetworkProxy - -sys.stdout.write("starting SOCKS proxy... ") -sys.stdout.flush() -socksProxy = NetworkProxy.SocksProxy(12030) -print("ok") - -TestUtil.clientServerTest(additionalClientOptions="--Ice.SOCKSProxyHost=localhost --Ice.SOCKSProxyPort=12030") - -sys.stdout.write("terminating SOCKS proxy... ") -sys.stdout.flush() -socksProxy.terminate() -print("ok") - -sys.stdout.write("starting HTTP proxy... ") -sys.stdout.flush() -httpProxy = NetworkProxy.HttpProxy(12031) -print("ok") - -TestUtil.clientServerTest(additionalClientOptions="--Ice.HTTPProxyHost=localhost --Ice.HTTPProxyPort=12031") - -sys.stdout.write("terminating HTTP proxy... ") -sys.stdout.flush() -httpProxy.terminate() -print("ok") |