diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-11-25 13:13:22 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-11-25 13:13:22 +0100 |
commit | dcdc32af1fced49d80a8ccd93230e15d91ab45d8 (patch) | |
tree | eb69e2555fbd54496fce8a33f4dd610e1473ff51 /cpp/test/Common/TestCommon.cpp | |
parent | C# IceSSL/configuration log expired certificate exceptions. (diff) | |
download | ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.tar.bz2 ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.tar.xz ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.zip |
Refactored test scripts
Diffstat (limited to 'cpp/test/Common/TestCommon.cpp')
-rw-r--r-- | cpp/test/Common/TestCommon.cpp | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/cpp/test/Common/TestCommon.cpp b/cpp/test/Common/TestCommon.cpp index c0ebd57c449..e869c7fd0f4 100644 --- a/cpp/test/Common/TestCommon.cpp +++ b/cpp/test/Common/TestCommon.cpp @@ -13,15 +13,23 @@ #include <Ice/Communicator.h> std::string -getTestEndpoint(const Ice::CommunicatorPtr& communicator, int num, const std::string prot) +getTestEndpoint(const Ice::CommunicatorPtr& communicator, int num, const std::string& protocol) +{ + return getTestEndpoint(communicator->getProperties(), num, protocol); +} + +std::string +getTestEndpoint(const Ice::PropertiesPtr& properties, int num, const std::string& prot) { std::ostringstream ostr; std::string protocol = prot; if(protocol.empty()) { - protocol = communicator->getProperties()->getPropertyWithDefault("Ice.Default.Protocol", "default"); + protocol = properties->getPropertyWithDefault("Ice.Default.Protocol", "default"); } + int basePort = properties->getPropertyAsIntWithDefault("Test.BasePort", 12010); + if(protocol == "bt") { // @@ -45,11 +53,40 @@ getTestEndpoint(const Ice::CommunicatorPtr& communicator, int num, const std::st } else { - ostr << protocol << " -p " << (12010 + num); + ostr << protocol << " -p " << (basePort + num); } return ostr.str(); } +std::string +getTestHost(const Ice::PropertiesPtr& properties) +{ + return properties->getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); +} + +std::string +getTestProtocol(const Ice::PropertiesPtr& properties) +{ + return properties->getPropertyWithDefault("Ice.Default.Protocol", "tcp"); +} + +int +getTestPort(const Ice::PropertiesPtr& properties, int num) +{ + return properties->getPropertyAsIntWithDefault("Test.BasePort", 12010) + num; +} + +Ice::InitializationData +getTestInitData(int& argc, char* argv[]) +{ + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); + Ice::StringSeq args = Ice::argsToStringSeq(argc, argv); + args = initData.properties->parseCommandLineOptions("Test", args); + Ice::stringSeqToArgs(args, argc, argv); + return initData; +} + RemoteConfig::RemoteConfig(const std::string& name, int argc, char** argv, const Ice::CommunicatorPtr& communicator) : _status(1) { |