diff options
Diffstat (limited to 'cpp/test/Ice/binding')
-rw-r--r-- | cpp/test/Ice/binding/AllTests.cpp | 19 | ||||
-rw-r--r-- | cpp/test/Ice/binding/Client.cpp | 3 | ||||
-rw-r--r-- | cpp/test/Ice/binding/Server.cpp | 3 | ||||
-rw-r--r-- | cpp/test/Ice/binding/TestI.cpp | 23 | ||||
-rwxr-xr-x | cpp/test/Ice/binding/run.py | 24 |
5 files changed, 27 insertions, 45 deletions
diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp index 8754af1bd28..cc6bc02cdd6 100644 --- a/cpp/test/Ice/binding/AllTests.cpp +++ b/cpp/test/Ice/binding/AllTests.cpp @@ -916,19 +916,26 @@ allTests(const Ice::CommunicatorPtr& communicator) clientProps.push_back(bothPreferIPv4); clientProps.push_back(bothPreferIPv6); + string endpoint; + { + ostringstream str; + str << "tcp -p " << getTestPort(communicator->getProperties(), 2); + endpoint = str.str(); + } + Ice::PropertiesPtr anyipv4 = ipv4->clone(); - anyipv4->setProperty("Adapter.Endpoints", "tcp -p 12012"); - anyipv4->setProperty("Adapter.PublishedEndpoints", "tcp -h 127.0.0.1 -p 12012"); + anyipv4->setProperty("Adapter.Endpoints", endpoint); + anyipv4->setProperty("Adapter.PublishedEndpoints", endpoint + " -h 127.0.0.1"); Ice::PropertiesPtr anyipv6 = ipv6->clone(); - anyipv6->setProperty("Adapter.Endpoints", "tcp -p 12012"); - anyipv6->setProperty("Adapter.PublishedEndpoints", "tcp -h \"::1\" -p 12012"); + anyipv6->setProperty("Adapter.Endpoints", endpoint); + anyipv6->setProperty("Adapter.PublishedEndpoints", endpoint + " -h \"::1\""); Ice::PropertiesPtr anyboth = Ice::createProperties(); anyboth->setProperty("Ice.IPv4", "1"); anyboth->setProperty("Ice.IPv6", "1"); - anyboth->setProperty("Adapter.Endpoints", "tcp -p 12012"); - anyboth->setProperty("Adapter.PublishedEndpoints", "tcp -h \"::1\" -p 12012:tcp -h 127.0.0.1 -p 12012"); + anyboth->setProperty("Adapter.Endpoints", endpoint); + anyboth->setProperty("Adapter.PublishedEndpoints", endpoint + " -p 12012:" + endpoint + " -p 12012"); Ice::PropertiesPtr localipv4 = ipv4->clone(); localipv4->setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1"); diff --git a/cpp/test/Ice/binding/Client.cpp b/cpp/test/Ice/binding/Client.cpp index 9bc4acff3a4..c9ea03062c5 100644 --- a/cpp/test/Ice/binding/Client.cpp +++ b/cpp/test/Ice/binding/Client.cpp @@ -35,7 +35,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); RemoteConfig rc("Ice/binding", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/binding/Server.cpp b/cpp/test/Ice/binding/Server.cpp index 431e7dfe3f2..a7fae8974a7 100644 --- a/cpp/test/Ice/binding/Server.cpp +++ b/cpp/test/Ice/binding/Server.cpp @@ -41,7 +41,8 @@ main(int argc, char* argv[]) #endif 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/binding/TestI.cpp b/cpp/test/Ice/binding/TestI.cpp index 38c1b92e2e9..f191b1c176a 100644 --- a/cpp/test/Ice/binding/TestI.cpp +++ b/cpp/test/Ice/binding/TestI.cpp @@ -9,12 +9,13 @@ #include <Ice/Ice.h> #include <TestI.h> +#include <TestCommon.h> using namespace std; using namespace Ice; using namespace Test; -RemoteCommunicatorI::RemoteCommunicatorI() : _nextPort(10001) +RemoteCommunicatorI::RemoteCommunicatorI() : _nextPort(1) { } @@ -34,18 +35,14 @@ RemoteCommunicatorI::createObjectAdapter(const string& name, const string& endpt { if(endpoints.find("-p") == string::npos) { - // Use a fixed port if none is specified (bug 2896) - ostringstream os; - os << endpoints << " -h \"" - << (com->getProperties()->getPropertyWithDefault("Ice.Default.Host", "127.0.0.1")) - << "\" -p " << _nextPort++; - endpoints = os.str(); + endpoints = getTestEndpoint(com, _nextPort++, endpoints); } } - + com->getProperties()->setProperty(name + ".ThreadPool.Size", "1"); ObjectAdapterPtr adapter = com->createObjectAdapterWithEndpoints(name, endpoints); - return ICE_UNCHECKED_CAST(RemoteObjectAdapterPrx, current.adapter->addWithUUID(ICE_MAKE_SHARED(RemoteObjectAdapterI, adapter))); + return ICE_UNCHECKED_CAST(RemoteObjectAdapterPrx, + current.adapter->addWithUUID(ICE_MAKE_SHARED(RemoteObjectAdapterI, adapter))); } #ifdef ICE_CPP11_MAPPING @@ -65,10 +62,10 @@ RemoteCommunicatorI::shutdown(const Ice::Current& current) current.adapter->getCommunicator()->shutdown(); } -RemoteObjectAdapterI::RemoteObjectAdapterI(const Ice::ObjectAdapterPtr& adapter) : - _adapter(adapter), - _testIntf(ICE_UNCHECKED_CAST(TestIntfPrx, - _adapter->add(ICE_MAKE_SHARED(TestI), +RemoteObjectAdapterI::RemoteObjectAdapterI(const Ice::ObjectAdapterPtr& adapter) : + _adapter(adapter), + _testIntf(ICE_UNCHECKED_CAST(TestIntfPrx, + _adapter->add(ICE_MAKE_SHARED(TestI), stringToIdentity("test")))) { _adapter->activate(); diff --git a/cpp/test/Ice/binding/run.py b/cpp/test/Ice/binding/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/binding/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 - -TestUtil.queueClientServerTest() -TestUtil.runQueuedTests() |