diff options
1388 files changed, 12071 insertions, 27514 deletions
diff --git a/.travis.yml b/.travis.yml index 4d09f0a1df0..14701aa8b09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ env: - JAVA_HOME=/usr/lib/jvm/java-8-oracle matrix: - - WORK_DIR=${TRAVIS_BUILD_DIR}/cpp SKIP="IceBT" CONFIGS="cpp11-shared" TEST_FLAGS="--c++11" + - WORK_DIR=${TRAVIS_BUILD_DIR}/cpp SKIP="IceBT" CONFIGS="cpp11-shared" - WORK_DIR=${TRAVIS_BUILD_DIR} cache: @@ -59,7 +59,7 @@ install: script: - cd ${WORK_DIR} -- python allTests.py ${TEST_FLAGS} --protocol=ssl +- python allTests.py --workers=3 --protocol=ssl notifications: email: travis-ci@zeroc.com diff --git a/allTests.py b/allTests.py index f65508ec9ac..5b0470cf439 100755 --- a/allTests.py +++ b/allTests.py @@ -8,30 +8,9 @@ # # ********************************************************************** -import os, sys, imp - +import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), "scripts")) -import TestUtil - -testGroups = [] - -languages = [ "cpp", "java", "java-compat", "python", "ruby", "php", "js" ] -if TestUtil.isWin32(): - languages.append("csharp") -if TestUtil.isDarwin(): - languages.append("objective-c") - -for d in languages: - - filename = os.path.abspath(os.path.join(os.path.dirname(__file__), d, "allTests.py")) - f = open(filename, "r") - current_mod = imp.load_module("allTests", f, filename, (".py", "r", imp.PY_SOURCE)) - f.close() - - tests = [] - tests = [ (os.path.join(d, "test", os.path.normpath(x)), y) for x, y in current_mod.tests ] - if len(tests) > 0: - testGroups.extend(tests) +from Util import runTests -TestUtil.run(testGroups, root=True) +runTests()
\ No newline at end of file diff --git a/config/Make.project.rules b/config/Make.project.rules index 774bb03959f..2d34bd52bee 100644 --- a/config/Make.project.rules +++ b/config/Make.project.rules @@ -102,7 +102,7 @@ endif .PRECIOUS: $3/%.d -ifeq ($(filter %clean,$(MAKECMDGOALS)),) +ifeq ($(filter %clean print,$(MAKECMDGOALS)),) # Include the dependencies -include $(addprefix $3/,$(call source-to-dependency,$4)) endif @@ -158,7 +158,7 @@ define make-slices .PRECIOUS: $2/%.ice.d -ifeq ($(filter %clean,$(MAKECMDGOALS)),) +ifeq ($(filter %clean print,$(MAKECMDGOALS)),) # Include the dependencies -include $(addprefix $2/,$(call source-to-dependency,$4)) endif @@ -698,7 +698,7 @@ $1_objdirs := $$(call unique,$$($1_objdirs)) # # Create object directories and generated directory if we're not cleaning. # -ifeq ($(filter %clean,$(MAKECMDGOALS)),) +ifeq ($(filter %clean print,$(MAKECMDGOALS)),) ifneq ($$($1_objdirs),) $$($1_objdirs): diff --git a/config/Make.rules.Linux b/config/Make.rules.Linux index b47666d5d44..aae04c8c820 100644 --- a/config/Make.rules.Linux +++ b/config/Make.rules.Linux @@ -51,6 +51,7 @@ $1_cc = $$($1_gnu_type)-$(CC) $1_cxx = $$($1_gnu_type)-$(CXX) $1_libtool = $$($1_gnu_type)-$(AR) $1_targetdir = /$$($1_multiarch) +$1_objdir = /$$($1_multiarch) $1_installdir = $$(if $$(and $(is-bin-program),$(usr_dir_install)),,/$$($1_multiarch)) $1_excludes = $(if $(filter-out $1,$(build-platform)),Slice) diff --git a/cpp/allTests.py b/cpp/allTests.py index c93dc9f1747..e4360c465d3 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -8,121 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("IceUtil/condvar", ["once", "win32only"]), - ("IceUtil/thread", ["once"]), - ("IceUtil/unicode", ["once"]), - ("IceUtil/inputUtil", ["once"]), - ("IceUtil/uuid", ["once", "noappverifier"]), # This test is very slow with appverifier. - ("IceUtil/timer", ["once"]), - ("IceUtil/sha1", ["once"]), - ("IceUtil/stacktrace", ["once", "noc++11"]), - ("Slice/errorDetection", ["once"]), - ("Slice/keyword", ["once"]), - ("Slice/structure", ["once"]), - ("Slice/macros", ["once"]), - ("Slice/headers", ["once", "nowin32"]), - ("Slice/unicodePaths", ["once"]), - ("Ice/properties", ["once", "nomingw"]), - ("Ice/proxy", ["core", "bt"]), - ("Ice/operations", ["core", "bt"]), - ("Ice/exceptions", ["core", "bt"]), - ("Ice/ami", ["core", "nocompress", "bt"]), - ("Ice/info", ["core", "noipv6", "nocompress", "nosocks"]), - ("Ice/inheritance", ["core", "bt"]), - ("Ice/facets", ["core", "bt"]), - ("Ice/objects", ["core", "bt"]), - ("Ice/optional", ["core", "bt"]), - ("Ice/binding", ["core", "nosocks", "bt"]), - ("Ice/faultTolerance", ["core", "novalgrind"]), # valgrind reports leak with aborted servers - ("Ice/location", ["core"]), - ("Ice/adapterDeactivation", ["core"]), - ("Ice/slicing/exceptions", ["core", "bt"]), - ("Ice/slicing/objects", ["core", "bt"]), - ("Ice/gc", ["once", "noc++11"]), - ("Ice/dispatcher", ["once"]), - ("Ice/checksum", ["core"]), - ("Ice/stream", ["core"]), - ("Ice/hold", ["core", "bt"]), - ("Ice/custom", ["core", "nossl", "nows"]), - ("Ice/retry", ["core"]), - ("Ice/timeout", ["core", "nocompress", "nosocks"]), - ("Ice/acm", ["core", "bt"]), - ("Ice/background", ["core", "nomingw", "nosocks"]), - ("Ice/servantLocator", ["core", "bt"]), - ("Ice/interceptor", ["core"]), - ("Ice/library", ["once", "nostatic"]), - ("Ice/stringConverter", ["core"]), - ("Ice/udp", ["core"]), - ("Ice/defaultServant", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/invoke", ["core"]), - ("Ice/plugin", ["core", "nomingw"]), - ("Ice/hash", ["once"]), - ("Ice/admin", ["core", "noipv6"]), - ("Ice/metrics", ["core", "nows", "noipv6", "nocompress", "nomingw", "nosocks"]), - ("Ice/enums", ["once", "bt"]), - ("Ice/logger", ["once"]), - ("Ice/networkProxy", ["core", "noipv6", "nosocks"]), - ("Ice/services", ["once", "nomingw"]), - ("IceSSL/configuration", ["once", "novalgrind"]), # valgrind doesn't work well with openssl - ("IceBox/configuration", ["core", "noipv6", "novc100", "nomingw", "nomx"]), - ("IceBox/admin", ["core", "noipv6", "novc100", "nomingw", "nomx", "noc++11"]), - ("IceStorm/single", ["service", "novc100", "noappverifier", "nomingw", "noc++11"]), # This test doesn't work with appverifier - ("IceStorm/federation", ["service", "novc100", "nomingw", "noc++11"]), - ("IceStorm/federation2", ["service", "novc100", "nomingw", "noc++11"]), - ("IceStorm/stress", ["service", "stress", "novc100", "nomingw", "noc++11"]), # Too slow with appverifier. - ("IceStorm/rep1", ["service", "novc100", "nomingw", "noc++11"]), - ("IceStorm/repgrid", ["service", "novc100", "nomingw", "noc++11"]), - ("IceStorm/repstress", ["service", "noipv6", "stress", "novc100", "nomingw", "noc++11"]), - ("IceDiscovery/simple", ["service"]), - ("IceGrid/simple", ["service", "novc100", "nomingw", "noc++11"]), - ("IceGrid/fileLock", ["service", "novc100", "nomingw", "noc++11"]), - ("IceGrid/deployer", ["service", "novc100", "nomingw", "noc++11"]), - ("IceGrid/session", ["service", "novc100", "nomingw", "nows", "noc++11"]), - ("IceGrid/update", ["service", "novc100", "nomingw", "noc++11"]), - ("IceGrid/noRestartUpdate", ["service", "novc100", "nomingw", "noc++11"]), - ("IceGrid/activation", ["service", "novc100", "nomingw", "noc++11"]), - ("IceGrid/replicaGroup", ["service", "novc100", "nomingw", "noc++11", "nomultiarch"]), - ("IceGrid/replication", ["service", "novc100", "nomingw", "nomx", "noc++11"]), - ("IceGrid/allocation", ["service", "novc100", "nomingw", "noc++11"]), - ("IceGrid/distribution", ["service", "novc100", "nomingw", "noc++11"]), - ("IceGrid/admin", ["service", "novc100", "nomingw","nows", "noc++11"]), - ("Glacier2/router", ["service", "novc100", "nomingw", "noc++11"]), - ("Glacier2/attack", ["service", "novc100", "nomingw", "nomx", "noc++11"]), - ("Glacier2/override", ["service", "novc100", "nomingw", "noc++11"]), - ("Glacier2/sessionControl", ["service", "novc100", "nomingw", "noc++11"]), - ("Glacier2/ssl", ["service", "novalgrind", "novc100", "nomingw", "noc++11"]), # valgrind doesn't work well with openssl - ("Glacier2/dynamicFiltering", ["service", "novc100", "nomingw", "noc++11"]), - ("Glacier2/staticFiltering", ["service", "noipv6", "novc100", "nomingw", "nomx", "noc++11"]), - ("Glacier2/sessionHelper", ["core", "novc100", "nomingw", "noc++11"]), - ("Glacier2/hashpassword", ["once", "nomingw", "novalgrind", "noappverifier", "noc++11"]) - ] - -# -# Run priority tests only if running as root on Unix. -# -if TestUtil.isWin32() or os.getuid() == 0: - tests += [ - ("IceUtil/priority", ["core", "nodarwin"]), - ("Ice/threadPoolPriority", ["core", "nodarwin", "nomx"]) - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/cpp/src/Ice/IPEndpointI.cpp b/cpp/src/Ice/IPEndpointI.cpp index 10983ccc672..a33405d8118 100644 --- a/cpp/src/Ice/IPEndpointI.cpp +++ b/cpp/src/Ice/IPEndpointI.cpp @@ -623,23 +623,20 @@ IceInternal::EndpointHostResolver::run() } } - r.callback->connectors(r.endpoint->connectors(getAddresses(r.host, - r.port, - protocol, - r.selType, - _preferIPv6, - true), - networkProxy)); + vector<Address> addresses = getAddresses(r.host, r.port, protocol, r.selType, _preferIPv6, true); + if(r.observer) + { + r.observer->detach(); + r.observer = 0; + } + + r.callback->connectors(r.endpoint->connectors(addresses, networkProxy)); if(threadObserver) { threadObserver->stateChanged(ThreadStateInUseForOther, ThreadStateIdle); } - if(r.observer) - { - r.observer->detach(); - } } catch(const Ice::LocalException& ex) { diff --git a/cpp/src/Ice/MetricsAdminI.cpp b/cpp/src/Ice/MetricsAdminI.cpp index d8f03c8b0f6..cf76bac59cb 100644 --- a/cpp/src/Ice/MetricsAdminI.cpp +++ b/cpp/src/Ice/MetricsAdminI.cpp @@ -23,7 +23,7 @@ using namespace Ice; using namespace IceInternal; using namespace IceMX; -namespace +namespace { const string suffixes[] = @@ -102,7 +102,7 @@ MetricsMapI::RegExp::RegExp(const string& attribute, const string& regexp) : _at #elif !defined(ICE_CPP11_COMPILER_REGEXP) if(regcomp(&_preg, regexp.c_str(), REG_EXTENDED | REG_NOSUB) != 0) { - throw SyscallException(__FILE__, __LINE__); + throw SyscallException(__FILE__, __LINE__); } #else # if _MSC_VER < 1600 @@ -169,7 +169,7 @@ MetricsMapI::MetricsMapI(const std::string& mapPrefix, const PropertiesPtr& prop { groupByAttributes.push_back(""); } - + for(string::const_iterator p = groupBy.begin(); p != groupBy.end(); ++p) { bool isAlphaNum = IceUtilInternal::isAlpha(*p) || IceUtilInternal::isDigit(*p) || *p == '.'; @@ -233,7 +233,7 @@ MetricsMapFactory::update() assert(_updater); _updater->update(); } - + MetricsViewI::MetricsViewI(const string& name) : _name(name) { } @@ -248,7 +248,7 @@ MetricsViewI::destroy() } bool -MetricsViewI::addOrUpdateMap(const PropertiesPtr& properties, const string& mapName, +MetricsViewI::addOrUpdateMap(const PropertiesPtr& properties, const string& mapName, const MetricsMapFactoryPtr& factory, const ::Ice::LoggerPtr& logger) { const string viewPrefix = "IceMX.Metrics." + _name + "."; @@ -391,7 +391,7 @@ MetricsViewI::getMap(const string& mapName) const return ICE_NULLPTR; } -MetricsAdminI::MetricsAdminI(const PropertiesPtr& properties, const LoggerPtr& logger) : +MetricsAdminI::MetricsAdminI(const PropertiesPtr& properties, const LoggerPtr& logger) : _logger(logger), _properties(properties) { updateViews(); @@ -465,7 +465,7 @@ MetricsAdminI::updateViews() } } _views.swap(views); - + // // Go through removed views to collect maps to update. // @@ -482,7 +482,7 @@ MetricsAdminI::updateViews() } } } - + // // Call the updaters to update the maps. // @@ -533,7 +533,7 @@ MetricsAdminI::getMetricsViewNames(Ice::StringSeq& disabledViews, const Current& #else disabledViews.insert(disabledViews.end(), _disabledViews.begin(), _disabledViews.end()); -#endif +#endif return enabledViews; } @@ -617,7 +617,7 @@ MetricsAdminI::getMetricsFailures(const string& viewName, const string& map, con return MetricsFailures(); } -vector<MetricsMapIPtr> +vector<MetricsMapIPtr> MetricsAdminI::getMaps(const string& mapName) const { Lock sync(*this); @@ -654,7 +654,7 @@ MetricsAdminI::getMetricsView(const std::string& name) return p->second; } -void +void MetricsAdminI::updated(const PropertyDict& props) { for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p) diff --git a/cpp/src/Ice/ios/StreamTransceiver.cpp b/cpp/src/Ice/ios/StreamTransceiver.cpp index 8c9305f4031..863428190d1 100644 --- a/cpp/src/Ice/ios/StreamTransceiver.cpp +++ b/cpp/src/Ice/ios/StreamTransceiver.cpp @@ -16,7 +16,6 @@ #include <Ice/LoggerUtil.h> #include <Ice/Buffer.h> #include <Ice/Network.h> -#include <IceSSL/ConnectionInfo.h> #include <CoreFoundation/CoreFoundation.h> diff --git a/cpp/src/IceGrid/SessionServantManager.cpp b/cpp/src/IceGrid/SessionServantManager.cpp index bc22aff6327..70b0d004e98 100644 --- a/cpp/src/IceGrid/SessionServantManager.cpp +++ b/cpp/src/IceGrid/SessionServantManager.cpp @@ -16,7 +16,7 @@ using namespace std; using namespace IceGrid; -SessionServantManager::SessionServantManager(const Ice::ObjectAdapterPtr& adapter, +SessionServantManager::SessionServantManager(const Ice::ObjectAdapterPtr& adapter, const string& instanceName, bool checkConnection, const string& serverAdminCategory, @@ -25,7 +25,7 @@ SessionServantManager::SessionServantManager(const Ice::ObjectAdapterPtr& adapte const Ice::ObjectPtr& nodeAdminRouter, const string& replicaAdminCategory, const Ice::ObjectPtr& replicaAdminRouter, - const AdminCallbackRouterPtr& adminCallbackRouter) : + const AdminCallbackRouterPtr& adminCallbackRouter) : _adapter(adapter), _instanceName(instanceName), _checkConnection(checkConnection), @@ -61,7 +61,7 @@ SessionServantManager::locate(const Ice::Current& current, Ice::LocalObjectPtr&) else { plainServant = true; - + map<Ice::Identity, ServantInfo>::const_iterator p = _servants.find(current.id); if(p == _servants.end() || (_checkConnection && p->second.connection != current.con)) { @@ -72,14 +72,14 @@ SessionServantManager::locate(const Ice::Current& current, Ice::LocalObjectPtr&) servant = p->second.servant; } } - - if(!plainServant && servant && _checkConnection && + + if(!plainServant && servant && _checkConnection && _adminConnections.find(current.con) == _adminConnections.end()) { servant = 0; } - return servant; + return servant; } void @@ -120,7 +120,7 @@ SessionServantManager::addSession(const Ice::ObjectPtr& session, const Ice::Conn void SessionServantManager::setSessionControl(const Ice::ObjectPtr& session, - const Glacier2::SessionControlPrx& ctl, + const Glacier2::SessionControlPrx& ctl, const Ice::IdentitySeq& ids) { Lock sync(*this); @@ -141,7 +141,7 @@ SessionServantManager::setSessionControl(const Ice::ObjectPtr& session, // // Allow invocations on server admin objects. // - if(!p->second.category.empty() && _serverAdminRouter) + if(!p->second.category.empty() && _serverAdminRouter) { Ice::StringSeq seq; seq.push_back(_serverAdminCategory); @@ -236,7 +236,7 @@ SessionServantManager::remove(const Ice::Identity& id) assert(p != _servants.end()); // - // Find the session associated to the servant and remove the servant identity from the + // Find the session associated to the servant and remove the servant identity from the // session identities. // map<Ice::ObjectPtr, SessionInfo>::iterator q = _sessions.find(p->second.session); diff --git a/cpp/src/IceSSL/OpenSSLEngine.cpp b/cpp/src/IceSSL/OpenSSLEngine.cpp index 84238614220..8a6af245907 100644 --- a/cpp/src/IceSSL/OpenSSLEngine.cpp +++ b/cpp/src/IceSSL/OpenSSLEngine.cpp @@ -50,7 +50,7 @@ extern "C" { // -// OpenSSL 1.1.0 introduces a new thread API and removes +// OpenSSL 1.1.0 introduces a new thread API and removes // the need to use a custom thread callback. // #if OPENSSL_VERSION_NUMBER < 0x10100000L @@ -151,7 +151,7 @@ public: ~Init() { // - // OpenSSL 1.1.0 introduces a new thread API and removes + // OpenSSL 1.1.0 introduces a new thread API and removes // the need to use a custom thread callback. // #if OPENSSL_VERSION_NUMBER < 0x10100000L @@ -162,7 +162,7 @@ public: delete[] locks; locks = 0; } - + if(CRYPTO_get_id_callback() == IceSSL_opensslThreadIdCallback) { CRYPTO_set_id_callback(0); 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) { diff --git a/cpp/test/Glacier2/attack/Client.cpp b/cpp/test/Glacier2/attack/Client.cpp index b028a45e4a3..69022d72a15 100644 --- a/cpp/test/Glacier2/attack/Client.cpp +++ b/cpp/test/Glacier2/attack/Client.cpp @@ -32,8 +32,7 @@ main(int argc, char* argv[]) Ice::registerIceSSL(); #endif - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // We want to check whether the client retries for evicted @@ -49,7 +48,7 @@ int AttackClient::run(int, char**) { cout << "getting router... " << flush; - ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347"); + ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10)); Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase); test(router); communicator()->setDefaultRouter(router); @@ -60,7 +59,7 @@ AttackClient::run(int, char**) cout << "ok" << endl; cout << "making thousands of invocations on proxies... " << flush; - ObjectPrx backendBase = communicator()->stringToProxy("dummy:tcp -p 12010"); + ObjectPrx backendBase = communicator()->stringToProxy("dummy:" + getTestEndpoint(communicator(), 0)); BackendPrx backend = BackendPrx::uncheckedCast(backendBase); backend->ice_ping(); @@ -118,7 +117,8 @@ AttackClient::run(int, char**) cout << "testing server and router shutdown... " << flush; backend->shutdown(); communicator()->setDefaultRouter(0); - ObjectPrx adminBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); + ObjectPrx adminBase = communicator()->stringToProxy("Glacier2/admin -f Process:" + + getTestEndpoint(communicator(), 11, "tcp")); Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(adminBase); test(process); process->shutdown(); diff --git a/cpp/test/Glacier2/attack/Server.cpp b/cpp/test/Glacier2/attack/Server.cpp index 04db46171ac..89df9f0a9bb 100644 --- a/cpp/test/Glacier2/attack/Server.cpp +++ b/cpp/test/Glacier2/attack/Server.cpp @@ -8,6 +8,7 @@ // ********************************************************************** #include <Ice/Application.h> +#include <TestCommon.h> #include <BackendI.h> using namespace std; @@ -56,13 +57,14 @@ main(int argc, char* argv[]) #endif BackendServer app; - return app.main(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + return app.main(argc, argv, initData); } int BackendServer::run(int, char**) { - communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", "tcp -p 12010"); + communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", getTestEndpoint(communicator(), 0)); ObjectAdapterPtr adapter = communicator()->createObjectAdapter("BackendAdapter"); adapter->addServantLocator(new ServantLocatorI, ""); adapter->activate(); diff --git a/cpp/test/Glacier2/attack/run.py b/cpp/test/Glacier2/attack/run.py deleted file mode 100755 index dc2b17c162d..00000000000 --- a/cpp/test/Glacier2/attack/run.py +++ /dev/null @@ -1,50 +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 - -testdir = os.getcwd() -router = TestUtil.getGlacier2Router() - -if TestUtil.appverifier: - TestUtil.setAppVerifierSettings([router]) - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Glacier2.RoutingTable.MaxSize=10' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(testdir, "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -starterProc = TestUtil.startServer(router, args, count=2) -print("ok") - -TestUtil.clientServerTest() - -starterProc.waitTestSuccess() - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd([router]) diff --git a/cpp/test/Glacier2/attack/test.py b/cpp/test/Glacier2/attack/test.py new file mode 100644 index 00000000000..b499394b559 --- /dev/null +++ b/cpp/test/Glacier2/attack/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. +# +# ********************************************************************** + +Glacier2TestSuite(__name__, routerProps = { "Glacier2.RoutingTable.MaxSize" : 10 }) diff --git a/cpp/test/Glacier2/dynamicFiltering/Client.cpp b/cpp/test/Glacier2/dynamicFiltering/Client.cpp index 4941dea7c5f..e29d7afacf5 100644 --- a/cpp/test/Glacier2/dynamicFiltering/Client.cpp +++ b/cpp/test/Glacier2/dynamicFiltering/Client.cpp @@ -32,8 +32,7 @@ main(int argc, char* argv[]) SessionControlClient app; - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // We want to check whether the client retries for evicted @@ -57,7 +56,7 @@ SessionControlClient::run(int argc, char* argv[]) initData.properties = communicator()->getProperties(); Ice::CommunicatorPtr controlComm = Ice::initialize(argc, argv, initData); TestControllerPrx controller = TestControllerPrx::checkedCast( - controlComm->stringToProxy("testController:tcp -p 12013")); + controlComm->stringToProxy("testController:" + getTestEndpoint(communicator(), 2, "tcp"))); test(controller); TestToken currentState; TestToken newState; @@ -70,7 +69,7 @@ SessionControlClient::run(int argc, char* argv[]) cout << "ok" << endl; cout << "getting router... " << flush; - ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347"); + ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10)); Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase); test(router); communicator()->setDefaultRouter(router); @@ -164,7 +163,8 @@ SessionControlClient::run(int argc, char* argv[]) // Shut down the router. // communicator()->setDefaultRouter(0); - ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -p 12348"); + ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" + + getTestEndpoint(communicator(), 11, "tcp")); Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(processBase); test(process); process->shutdown(); diff --git a/cpp/test/Glacier2/dynamicFiltering/Server.cpp b/cpp/test/Glacier2/dynamicFiltering/Server.cpp index 82fc03b1598..883778ca047 100644 --- a/cpp/test/Glacier2/dynamicFiltering/Server.cpp +++ b/cpp/test/Glacier2/dynamicFiltering/Server.cpp @@ -10,6 +10,7 @@ #include <Ice/Application.h> #include <Ice/Locator.h> #include <Glacier2/PermissionsVerifier.h> +#include <TestCommon.h> #include <TestControllerI.h> #include <SessionI.h> #include <BackendI.h> @@ -126,7 +127,8 @@ main(int argc, char* argv[]) #endif SessionControlServer app; - return app.main(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + return app.main(argc, argv, initData); } int @@ -143,19 +145,20 @@ SessionControlServer::run(int, char*[]) // servant, allowing us to use any reference as long as the client // expects to use a proxy for the correct type of object. // - communicator()->getProperties()->setProperty("TestControllerAdapter.Endpoints", "tcp -p 12013"); + communicator()->getProperties()->setProperty("TestControllerAdapter.Endpoints", + getTestEndpoint(communicator(), 2, "tcp")); ObjectAdapterPtr controllerAdapter = communicator()->createObjectAdapter("TestControllerAdapter"); - TestControllerIPtr controller = new TestControllerI; + TestControllerIPtr controller = new TestControllerI(getTestEndpoint(communicator(), 1)); controllerAdapter->add(controller, Ice::stringToIdentity("testController")); controllerAdapter->activate(); - communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", "tcp -p 12010"); + communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", getTestEndpoint(communicator(), 0)); ObjectAdapterPtr adapter = communicator()->createObjectAdapter("SessionControlAdapter"); adapter->add(new SessionManagerI(controller), Ice::stringToIdentity("SessionManager")); adapter->activate(); BackendPtr backend = new BackendI; - communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", "default -p 12012"); + communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", getTestEndpoint(communicator(), 1)); ObjectAdapterPtr backendAdapter = communicator()->createObjectAdapter("BackendAdapter"); backendAdapter->addServantLocator(new ServantLocatorI(backend), ""); backendAdapter->activate(); diff --git a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp index 6f2cf003845..10b93a5c397 100644 --- a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp +++ b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <TestControllerI.h> +#include <TestCommon.h> #include <vector> #include <string> @@ -20,23 +21,23 @@ using namespace std; // TODO: More test cases. // -TestControllerI::TestControllerI() +TestControllerI::TestControllerI(const string& endpoint) { TestConfiguration current; current.description = "No filters at all"; - current.cases.push_back(TestCase("foo/bar:default -p 12012", true)); + current.cases.push_back(TestCase("foo/bar:" + endpoint, true)); _configurations.push_back(current); current = TestConfiguration(); current.description = "Category filter"; - current.cases.push_back(TestCase("foo/barA:default -p 12012", true)); - current.cases.push_back(TestCase("bar/fooA:default -p 12012", false)); - current.cases.push_back(TestCase("\"a cat with spaces/fooX\":default -p 12012", true)); + current.cases.push_back(TestCase("foo/barA:" + endpoint, true)); + current.cases.push_back(TestCase("bar/fooA:" + endpoint, false)); + current.cases.push_back(TestCase("\"a cat with spaces/fooX\":" + endpoint, true)); current.categoryFiltersAccept.push_back("foo"); current.categoryFiltersAccept.push_back("a cat with spaces"); _configurations.push_back(current); - + current = TestConfiguration(); current.description = "Adapter id filter"; current.cases.push_back(TestCase("fooB @ bar", true)); @@ -46,8 +47,8 @@ TestControllerI::TestControllerI() current = TestConfiguration(); current.description = "Object id filter"; - current.cases.push_back(TestCase("foo/barC:default -p 12012", true)); - current.cases.push_back(TestCase("bar/fooC:default -p 12012", false)); + current.cases.push_back(TestCase("foo/barC:" + endpoint, true)); + current.cases.push_back(TestCase("bar/fooC:" + endpoint, false)); Identity id; id.category = "foo"; id.name = "barC"; @@ -66,13 +67,13 @@ TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToke assert("TestController::step() shouldn't have been called with a state of Finished" == 0); break; } - + case Test::Running: { TestConfiguration& config = _configurations[currentState.config]; assert(!config.description.empty()); - + bool found = false; SessionTuple session; for(vector<SessionTuple>::const_iterator i = _sessions.begin(); i != _sessions.end() && !found; ++i) @@ -95,7 +96,7 @@ TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToke // We start with the previous known state. // newState = currentState; - + ++newState.caseIndex; if(!(newState.caseIndex < (long)config.cases.size())) { @@ -134,14 +135,14 @@ TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToke Glacier2::StringSetPrx adapterIds = session.sessionControl->adapterIds(); adapterIds->add(config.adapterIdFiltersAccept); - + Glacier2::IdentitySetPrx ids = session.sessionControl->identities(); ids->add(config.objectIdFiltersAccept); session.configured = true; } break; } - + default: { newState.code = Running; diff --git a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h index 7e21639a8d9..75b07c22c66 100644 --- a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h +++ b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h @@ -54,7 +54,7 @@ struct TestCase std::string proxy; bool expectedResult; - TestCase(const char* s, const bool b) : proxy(s), expectedResult(b) {} + TestCase(const std::string& s, const bool b) : proxy(s), expectedResult(b) {} }; struct TestConfiguration @@ -74,7 +74,7 @@ struct TestConfiguration class TestControllerI : public Test::TestController { public: - TestControllerI(); + TestControllerI(const std::string&); // // Slice to C++ mapping. // @@ -93,7 +93,7 @@ public: private: std::vector<SessionTuple> _sessions; std::vector<TestConfiguration> _configurations; - + }; typedef IceUtil::Handle<TestControllerI> TestControllerIPtr; diff --git a/cpp/test/Glacier2/dynamicFiltering/run.py b/cpp/test/Glacier2/dynamicFiltering/run.py deleted file mode 100755 index 81e4b7a753d..00000000000 --- a/cpp/test/Glacier2/dynamicFiltering/run.py +++ /dev/null @@ -1,62 +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 - -server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -router = os.path.join(TestUtil.getGlacier2Router()) - -targets = [] -if TestUtil.appverifier: - targets = [server, client, router] - TestUtil.setAppVerifierSettings(targets) - - -sys.stdout.write("starting server... ") -sys.stdout.flush() -serverProc = TestUtil.startServer(server, count=3) -print("ok") - -args = r' --Glacier2.Client.Endpoints="default -p 12347"' + \ - r' --Ice.Admin.Endpoints="tcp -p 12348"' + \ - r' --Ice.Admin.InstanceName=Glacier2' + \ - r' --Glacier2.Server.Endpoints="default -p 12349"' + \ - r' --Glacier2.SessionManager="SessionManager:tcp -p 12010"' + \ - r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' + \ - r' --Ice.Default.Locator="locator:default -p 12012"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -starterProc = TestUtil.startServer(router, args, count=2) -print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -proc = TestUtil.startClient(client, startReader = False) -print("ok") -proc.startReader() -proc.waitTestSuccess() - -serverProc.waitTestSuccess() -starterProc.waitTestSuccess() - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets) diff --git a/cpp/test/Glacier2/dynamicFiltering/test.py b/cpp/test/Glacier2/dynamicFiltering/test.py new file mode 100644 index 00000000000..cbf251816ae --- /dev/null +++ b/cpp/test/Glacier2/dynamicFiltering/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. +# +# ********************************************************************** + +# +# Note: we limit the send buffer size with Ice.TCP.SndSize, the +# test relies on send() blocking +# +routerProps = lambda process, current : { + 'Glacier2.SessionManager' : 'SessionManager:{0}'.format(current.getTestEndpoint(0)), + 'Glacier2.PermissionsVerifier' : 'Glacier2/NullPermissionsVerifier', + 'Ice.Default.Locator' : 'locator:{0}'.format(current.getTestEndpoint(1)), +} + +Glacier2TestSuite(__name__, + testcases=[ClientServerTestCase(servers=[Glacier2Router(props=routerProps, passwords=None), + Server(readyCount=3)])]) diff --git a/cpp/test/Glacier2/hashpassword/run.py b/cpp/test/Glacier2/hashpassword/run.py deleted file mode 100755 index 7abe7831eec..00000000000 --- a/cpp/test/Glacier2/hashpassword/run.py +++ /dev/null @@ -1,111 +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, passlib.hash, subprocess - -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 - -hashpassword = os.path.join(path[0], "scripts", "icehashpassword.py") - -def test(b): - if not b: - raise RuntimeError('test assertion failed') - -def hashPasswords(password, args = ""): - p = subprocess.Popen('%s "%s" %s' % (sys.executable, hashpassword, args), shell=True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, stdin=subprocess.PIPE) - p.stdin.write(password.encode('UTF-8')) - p.stdin.write('\r\n'.encode('UTF-8')) - p.stdin.flush() - if(p.wait() != 0): - print("icehashpassword.py failed:\n" + p.stdout.read().decode('UTF-8').strip()) - sys.exit(1) - hash = p.stdout.readline().decode('UTF-8').strip() - return hash - - -usePBKDF2 = sys.platform == "win32" or sys.platform == "darwin" -useCryptExt = sys.platform.startswith("linux") - -if usePBKDF2: - - sys.stdout.write("Testing PBKDF2 crypt passwords...") - sys.stdout.flush() - - test(passlib.hash.pbkdf2_sha256.verify("abc123", hashPasswords("abc123"))) - test(not passlib.hash.pbkdf2_sha256.verify("abc123", hashPasswords("abc"))) - - test(passlib.hash.pbkdf2_sha1.verify("abc123", hashPasswords("abc123", "-d sha1"))) - test(not passlib.hash.pbkdf2_sha1.verify("abc123", hashPasswords("abc", "-d sha1"))) - - test(passlib.hash.pbkdf2_sha512.verify("abc123", hashPasswords("abc123", "-d sha512"))) - test(not passlib.hash.pbkdf2_sha512.verify("abc123", hashPasswords("abc", "-d sha512"))) - - # - # Now use custom rounds - # - hash = hashPasswords("abc123", "-r 1000") - if hash.find("$pbkdf2-sha256$1000$") == -1: - test(False) - test(passlib.hash.pbkdf2_sha256.verify("abc123", hash)) - - hash = hashPasswords("abc123", "-r 1000 -d sha1") - if hash.find("$pbkdf2$1000$") == -1: - test(False) - test(passlib.hash.pbkdf2_sha1.verify("abc123", hash)) - - hash = hashPasswords("abc123", "-r 1000 -d sha512") - if hash.find("$pbkdf2-sha512$1000$") == -1: - test(False) - test(passlib.hash.pbkdf2_sha512.verify("abc123", hash)) - - print("ok") - -elif useCryptExt: - - sys.stdout.write("Testing Linux crypt passwords...") - sys.stdout.flush() - - test(passlib.hash.sha512_crypt.verify("abc123", hashPasswords("abc123"))) - test(not passlib.hash.sha512_crypt.verify("abc123", hashPasswords("abc"))) - - test(passlib.hash.sha256_crypt.verify("abc123", hashPasswords("abc123", "-d sha256"))) - test(not passlib.hash.sha256_crypt.verify("abc123", hashPasswords("abc", "-d sha256"))) - - # - # Now use custom rounds - # - hash = hashPasswords("abc123", "-r 5000") - if hash.find("rounds=") != -1: - test(False) - test(passlib.hash.sha512_crypt.verify("abc123", hash)) - hash = hashPasswords("abc123", "-d sha256 -r 5000") - if hash.find("rounds=") != -1: - test(False) - test(passlib.hash.sha256_crypt.verify("abc123", hash)) - - hash = hashPasswords("abc123", "-r 10000") - if hash.find("$rounds=10000$") == -1: - test(False) - test(passlib.hash.sha512_crypt.verify("abc123", hash)) - hash = hashPasswords("abc123", "-d sha256 -r 10000") - if hash.find("$rounds=10000$") == -1: - test(False) - test(passlib.hash.sha256_crypt.verify("abc123", hash)) - - print("ok") diff --git a/cpp/test/Glacier2/hashpassword/test.py b/cpp/test/Glacier2/hashpassword/test.py new file mode 100644 index 00000000000..7560276a141 --- /dev/null +++ b/cpp/test/Glacier2/hashpassword/test.py @@ -0,0 +1,103 @@ +# -*- 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 Glacier2HashPasswordTestCase(ClientTestCase): + + def runClientSide(self, current): + + import passlib.hash + + hashpassword = os.path.join(toplevel, "scripts", "icehashpassword.py") + + def test(b): + if not b: + raise RuntimeError('test assertion failed') + + def hashPasswords(password, args = ""): + p = subprocess.Popen('%s "%s" %s' % (sys.executable, hashpassword, args), shell=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, stdin=subprocess.PIPE) + p.stdin.write(password.encode('UTF-8')) + p.stdin.write('\r\n'.encode('UTF-8')) + p.stdin.flush() + if(p.wait() != 0): + raise RuntimeError("icehashpassword.py failed:\n" + p.stdout.read().decode('UTF-8').strip()) + hash = p.stdout.readline().decode('UTF-8').strip() + return hash + + usePBKDF2 = sys.platform == "win32" or sys.platform == "darwin" + useCryptExt = sys.platform.startswith("linux") + + if usePBKDF2: + + current.write("Testing PBKDF2 crypt passwords...") + + test(passlib.hash.pbkdf2_sha256.verify("abc123", hashPasswords("abc123"))) + test(not passlib.hash.pbkdf2_sha256.verify("abc123", hashPasswords("abc"))) + + test(passlib.hash.pbkdf2_sha1.verify("abc123", hashPasswords("abc123", "-d sha1"))) + test(not passlib.hash.pbkdf2_sha1.verify("abc123", hashPasswords("abc", "-d sha1"))) + + test(passlib.hash.pbkdf2_sha512.verify("abc123", hashPasswords("abc123", "-d sha512"))) + test(not passlib.hash.pbkdf2_sha512.verify("abc123", hashPasswords("abc", "-d sha512"))) + + # + # Now use custom rounds + # + hash = hashPasswords("abc123", "-r 1000") + if hash.find("$pbkdf2-sha256$1000$") == -1: + test(False) + test(passlib.hash.pbkdf2_sha256.verify("abc123", hash)) + + hash = hashPasswords("abc123", "-r 1000 -d sha1") + if hash.find("$pbkdf2$1000$") == -1: + test(False) + test(passlib.hash.pbkdf2_sha1.verify("abc123", hash)) + + hash = hashPasswords("abc123", "-r 1000 -d sha512") + if hash.find("$pbkdf2-sha512$1000$") == -1: + test(False) + test(passlib.hash.pbkdf2_sha512.verify("abc123", hash)) + + current.writeln("ok") + + elif useCryptExt: + + current.write("Testing Linux crypt passwords...") + + test(passlib.hash.sha512_crypt.verify("abc123", hashPasswords("abc123"))) + test(not passlib.hash.sha512_crypt.verify("abc123", hashPasswords("abc"))) + + test(passlib.hash.sha256_crypt.verify("abc123", hashPasswords("abc123", "-d sha256"))) + test(not passlib.hash.sha256_crypt.verify("abc123", hashPasswords("abc", "-d sha256"))) + + # + # Now use custom rounds + # + hash = hashPasswords("abc123", "-r 5000") + if hash.find("rounds=") != -1: + test(False) + test(passlib.hash.sha512_crypt.verify("abc123", hash)) + hash = hashPasswords("abc123", "-d sha256 -r 5000") + if hash.find("rounds=") != -1: + test(False) + test(passlib.hash.sha256_crypt.verify("abc123", hash)) + + hash = hashPasswords("abc123", "-r 10000") + if hash.find("$rounds=10000$") == -1: + test(False) + test(passlib.hash.sha512_crypt.verify("abc123", hash)) + hash = hashPasswords("abc123", "-d sha256 -r 10000") + if hash.find("$rounds=10000$") == -1: + test(False) + test(passlib.hash.sha256_crypt.verify("abc123", hash)) + + current.writeln("ok") + +TestSuite(__name__, [Glacier2HashPasswordTestCase()]) diff --git a/cpp/test/Glacier2/override/Client.cpp b/cpp/test/Glacier2/override/Client.cpp index 651cc31883b..8e351d2d574 100644 --- a/cpp/test/Glacier2/override/Client.cpp +++ b/cpp/test/Glacier2/override/Client.cpp @@ -17,9 +17,6 @@ using namespace std; using namespace Ice; using namespace Test; -static Ice::InitializationData initData; - - class CallbackClient : public Application { public: @@ -39,7 +36,7 @@ main(int argc, char* argv[]) // the router before session establishment, as well as after // session destruction. Both will cause a ConnectionLostException. // - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.ThreadPool.Client.Serialize", "1"); @@ -50,11 +47,11 @@ main(int argc, char* argv[]) int CallbackClient::run(int, char**) { - ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347"); + ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10)); Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase); communicator()->setDefaultRouter(router); - ObjectPrx base = communicator()->stringToProxy("c/callback:tcp -p 12010"); + ObjectPrx base = communicator()->stringToProxy("c/callback:" + getTestEndpoint(communicator(), 0)); Glacier2::SessionPrx session = router->createSession("userid", "abc123"); base->ice_ping(); @@ -213,7 +210,8 @@ CallbackClient::run(int, char**) } communicator()->setDefaultRouter(0); - ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); + ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" + + getTestEndpoint(communicator(), 11, "tcp")); Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(processBase); process->shutdown(); try diff --git a/cpp/test/Glacier2/override/Server.cpp b/cpp/test/Glacier2/override/Server.cpp index e7317bf1108..16d84f6fb0b 100644 --- a/cpp/test/Glacier2/override/Server.cpp +++ b/cpp/test/Glacier2/override/Server.cpp @@ -8,6 +8,7 @@ // ********************************************************************** #include <Ice/Application.h> +#include <TestCommon.h> #include <CallbackI.h> using namespace std; @@ -28,8 +29,7 @@ main(int argc, char* argv[]) Ice::registerIceSSL(); #endif - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); @@ -42,7 +42,7 @@ main(int argc, char* argv[]) int CallbackServer::run(int, char**) { - communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "tcp -p 12010"); + communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", getTestEndpoint(communicator(), 0)); ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter"); adapter->add(new CallbackI(), Ice::stringToIdentity("c/callback")); adapter->activate(); diff --git a/cpp/test/Glacier2/override/run.py b/cpp/test/Glacier2/override/run.py deleted file mode 100755 index 1bd6be79285..00000000000 --- a/cpp/test/Glacier2/override/run.py +++ /dev/null @@ -1,66 +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 - -router = TestUtil.getGlacier2Router() - -if TestUtil.appverifier: - TestUtil.setAppVerifierSettings([router]) - -def startRouter(): - # - # Note: we limit the send buffer size with Ice.TCP.SndSize, the - # test relies on send() blocking - # - args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Ice.TCP.SndSize=100000' + \ - ' --Ice.ThreadPool.Server.Serialize=1' + \ - ' --Ice.ThreadPool.Client.Serialize=1' + \ - ' --Glacier2.Filter.Category.Accept="c"' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Glacier2.PermissionsVerifier=Glacier2/NullPermissionsVerifier' + \ - ' --Glacier2.Client.ForwardContext=1' + \ - ' --Glacier2.Client.Trace.Override=0' + \ - ' --Glacier2.Client.Trace.Request=0' + \ - ' --Glacier2.Server.Trace.Override=0' + \ - ' --Glacier2.Server.Trace.Request=0' + \ - ' --Ice.Admin.InstanceName="Glacier2"' + \ - ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' + \ - ' --Glacier2.Client.SleepTime=50 --Glacier2.Server.SleepTime=50' - - sys.stdout.write("starting router in buffered mode... ") - sys.stdout.flush() - starterProc = TestUtil.startServer(router, args, count=2) - print("ok") - return starterProc - -name = os.path.join("Glacier2", "override") - -starterProc = startRouter() -TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown") -starterProc.waitTestSuccess() - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd([router]) diff --git a/cpp/test/Glacier2/override/test.py b/cpp/test/Glacier2/override/test.py new file mode 100644 index 00000000000..2678f78d835 --- /dev/null +++ b/cpp/test/Glacier2/override/test.py @@ -0,0 +1,33 @@ +# -*- 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. +# +# ********************************************************************** + +# +# Note: we limit the send buffer size with Ice.TCP.SndSize, the +# test relies on send() blocking +# +routerProps = { + 'Ice.Warn.Dispatch' : '0', + 'Ice.Warn.Connections' : '0', + 'Ice.TCP.SndSize' : '100000', + 'Ice.ThreadPool.Server.Serialize' : '1', + 'Ice.ThreadPool.Client.Serialize' : '1', + 'Glacier2.Filter.Category.Accept' : '"c"', + 'Glacier2.SessionTimeout' : '"30"', + 'Glacier2.PermissionsVerifier' : 'Glacier2/NullPermissionsVerifier', + 'Glacier2.Client.ForwardContext' : '1', + 'Glacier2.Client.Trace.Override' : '0', + 'Glacier2.Client.Trace.Request' : '0', + 'Glacier2.Server.Trace.Override' : '0', + 'Glacier2.Server.Trace.Request' : '0', + 'Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered' : '1', + 'Glacier2.Client.SleepTime=50 --Glacier2.Server.SleepTime' : '50', +} + +Glacier2TestSuite(__name__, routerProps=routerProps) diff --git a/cpp/test/Glacier2/router/Client.cpp b/cpp/test/Glacier2/router/Client.cpp index 937a114e053..1a27a8726c1 100644 --- a/cpp/test/Glacier2/router/Client.cpp +++ b/cpp/test/Glacier2/router/Client.cpp @@ -82,7 +82,7 @@ public: void run() { CommunicatorPtr communicator = initialize(initData); - ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347"); + ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator, 10)); Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase); communicator->setDefaultRouter(router); @@ -109,7 +109,7 @@ public: ident.category = category; CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident)); - ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010"); + ObjectPrx base = communicator->stringToProxy("c1/callback:" + getTestEndpoint(communicator, 0)); base = base->ice_oneway(); CallbackPrx callback = CallbackPrx::uncheckedCast(base); @@ -189,7 +189,7 @@ public: void run() { CommunicatorPtr communicator = initialize(initData); - ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347"); + ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator, 10)); _router = Glacier2::RouterPrx::checkedCast(routerBase); communicator->setDefaultRouter(_router); @@ -207,7 +207,7 @@ public: ident.category = category; CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident)); - ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010"); + ObjectPrx base = communicator->stringToProxy("c1/callback:" + getTestEndpoint(communicator, 0)); base = base->ice_oneway(); CallbackPrx callback = CallbackPrx::uncheckedCast(base); @@ -428,7 +428,7 @@ main(int argc, char* argv[]) // the router before session establishment, as well as after // session destruction. Both will cause a ConnectionLostException. // - initData.properties = Ice::createProperties(argc, argv); + initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); CallbackClient app; @@ -442,7 +442,7 @@ CallbackClient::run(int argc, char* argv[]) { cout << "testing stringToProxy for router... " << flush; - routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347"); + routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10)); cout << "ok" << endl; } @@ -458,7 +458,8 @@ CallbackClient::run(int argc, char* argv[]) { cout << "testing router finder... " << flush; Ice::RouterFinderPrx finder = - RouterFinderPrx::uncheckedCast(communicator()->stringToProxy("Ice/RouterFinder:default -p 12347")); + RouterFinderPrx::uncheckedCast(communicator()->stringToProxy("Ice/RouterFinder:" + + getTestEndpoint(communicator(), 10))); test(finder->getRouter()->ice_getIdentity() == router->ice_getIdentity()); cout << "ok" << endl; } @@ -480,7 +481,7 @@ CallbackClient::run(int argc, char* argv[]) { cout << "testing stringToProxy for server object... " << flush; - base = communicator()->stringToProxy("c1/callback:tcp -p 12010"); + base = communicator()->stringToProxy("c1/callback:" + getTestEndpoint(communicator(), 0)); cout << "ok" << endl; } @@ -849,6 +850,7 @@ CallbackClient::run(int argc, char* argv[]) cout << "ok" << endl; } + if(argc >= 2 && strcmp(argv[1], "--shutdown") == 0) { cout << "testing server shutdown... " << flush; twoway->shutdown(); @@ -908,7 +910,8 @@ CallbackClient::run(int argc, char* argv[]) { cout << "testing stringToProxy for admin process facet... " << flush; - processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); + processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" + + getTestEndpoint(communicator(), 11, "tcp")); cout << "ok" << endl; } diff --git a/cpp/test/Glacier2/router/Server.cpp b/cpp/test/Glacier2/router/Server.cpp index f07ce8fc713..350a8ae3a03 100644 --- a/cpp/test/Glacier2/router/Server.cpp +++ b/cpp/test/Glacier2/router/Server.cpp @@ -8,6 +8,7 @@ // ********************************************************************** #include <Ice/Application.h> +#include <TestCommon.h> #include <CallbackI.h> using namespace std; @@ -28,8 +29,7 @@ main(int argc, char* argv[]) Ice::registerIceSSL(); #endif - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); @@ -41,7 +41,7 @@ main(int argc, char* argv[]) int CallbackServer::run(int, char**) { - communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "tcp -p 12010"); + communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", getTestEndpoint(communicator(), 0)); ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter"); adapter->add(new CallbackI(), Ice::stringToIdentity("c1/callback")); // The test allows "c1" as category. adapter->add(new CallbackI(), Ice::stringToIdentity("c2/callback")); // The test allows "c2" as category. diff --git a/cpp/test/Glacier2/router/run.py b/cpp/test/Glacier2/router/run.py deleted file mode 100755 index 436b1a8df9c..00000000000 --- a/cpp/test/Glacier2/router/run.py +++ /dev/null @@ -1,86 +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 - -router = TestUtil.getGlacier2Router() - -if TestUtil.appverifier: - TestUtil.setAppVerifierSettings([router]) - -def startRouter(buffered): - - args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - ' --Glacier2.Filter.Category.AcceptUser="2"' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Ice.Admin.InstanceName="Glacier2"' + \ - ' --Glacier2.CryptPasswords="%s"' % os.path.join(os.getcwd(), "passwords") - - if buffered: - args += ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' - sys.stdout.write("starting router in buffered mode... ") - sys.stdout.flush() - else: - args += ' --Glacier2.Client.Buffered=0 --Glacier2.Server.Buffered=0' - sys.stdout.write("starting router in unbuffered mode... ") - sys.stdout.flush() - - starterProc = TestUtil.startServer(router, args, count=2) - - print("ok") - return starterProc - -name = os.path.join("Glacier2", "router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), - {"userid": "abc123", "userid-0": "abc123", "userid-1": "abc123", - "userid-2": "abc123", "userid-3": "abc123","userid-4": "abc123"}) -# -# We first run the test with unbuffered mode. -# -starterProc = startRouter(False) -TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown") -starterProc.waitTestSuccess() - -# -# Then we run the test in buffered mode. -# -starterProc = startRouter(True) -TestUtil.clientServerTest() - -# -# We run the test again, to check whether the glacier router can -# handle multiple clients. Also, when we run for the second time, we -# want the client to shutdown the router after running the tests. -# -TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown") - -starterProc.waitTestSuccess() - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd([router]) diff --git a/cpp/test/Glacier2/sessionControl/Client.cpp b/cpp/test/Glacier2/sessionControl/Client.cpp index 3e1bd96b9ba..4c437886367 100644 --- a/cpp/test/Glacier2/sessionControl/Client.cpp +++ b/cpp/test/Glacier2/sessionControl/Client.cpp @@ -31,8 +31,7 @@ main(int argc, char* argv[]) Ice::registerIceSSL(); #endif - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // We want to check whether the client retries for evicted @@ -49,7 +48,7 @@ int SessionControlClient::run(int, char**) { cout << "getting router... " << flush; - ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347"); + ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10)); Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase); test(router); communicator()->setDefaultRouter(router); @@ -103,7 +102,8 @@ SessionControlClient::run(int, char**) session = Test::SessionPrx::uncheckedCast(router->createSession("userid", "abc123")); session->shutdown(); communicator()->setDefaultRouter(0); - ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -p 12348"); + ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" + + getTestEndpoint(communicator(), 11, "tcp")); Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(processBase); test(process); process->shutdown(); diff --git a/cpp/test/Glacier2/sessionControl/Server.cpp b/cpp/test/Glacier2/sessionControl/Server.cpp index cffa77ec01a..2ba45328230 100644 --- a/cpp/test/Glacier2/sessionControl/Server.cpp +++ b/cpp/test/Glacier2/sessionControl/Server.cpp @@ -8,6 +8,7 @@ // ********************************************************************** #include <Ice/Application.h> +#include <TestCommon.h> #include <Glacier2/PermissionsVerifier.h> #include <SessionI.h> @@ -30,13 +31,14 @@ main(int argc, char* argv[]) #endif SessionControlServer app; - return app.main(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + return app.main(argc, argv, initData); } int SessionControlServer::run(int, char**) { - communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", "tcp -p 12010"); + communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", getTestEndpoint(communicator(), 0)); ObjectAdapterPtr adapter = communicator()->createObjectAdapter("SessionControlAdapter"); adapter->add(new SessionManagerI, Ice::stringToIdentity("SessionManager")); adapter->activate(); diff --git a/cpp/test/Glacier2/sessionControl/SessionI.cpp b/cpp/test/Glacier2/sessionControl/SessionI.cpp index ef34316c4ce..acb1b9927e7 100644 --- a/cpp/test/Glacier2/sessionControl/SessionI.cpp +++ b/cpp/test/Glacier2/sessionControl/SessionI.cpp @@ -22,7 +22,7 @@ public: { } - void + void response() { _cb->ice_response(); @@ -66,8 +66,8 @@ void SessionI::destroyFromClient_async(const Test::AMD_Session_destroyFromClientPtr& cb, const Ice::Current&) { DestroyCBPtr asyncCB = new DestroyCB(cb); - Glacier2::Callback_SessionControl_destroyPtr amiCB = Glacier2::newCallback_SessionControl_destroy(asyncCB, - &DestroyCB::response, + Glacier2::Callback_SessionControl_destroyPtr amiCB = Glacier2::newCallback_SessionControl_destroy(asyncCB, + &DestroyCB::response, &DestroyCB::exception); _sessionControl->begin_destroy(amiCB); } diff --git a/cpp/test/Glacier2/sessionControl/run.py b/cpp/test/Glacier2/sessionControl/run.py deleted file mode 100755 index 3499a044fb4..00000000000 --- a/cpp/test/Glacier2/sessionControl/run.py +++ /dev/null @@ -1,65 +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, time - -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 - -server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) -router = TestUtil.getGlacier2Router() -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -targets = [] -if TestUtil.appverifier: - targets = [server, client, router] - TestUtil.setAppVerifierSettings(targets) - -sys.stdout.write("starting server... ") -sys.stdout.flush() -serverProc = TestUtil.startServer(server) -print("ok") - -args = ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Ice.Admin.Endpoints="tcp -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.Server.Endpoints="default -p 12349"' + \ - ' --Glacier2.SessionManager="SessionManager:tcp -p 12010"' \ - ' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -starterProc = TestUtil.startServer(router, args, count = 2) -print("ok") - -# -# The test may sporadically fail without this slight pause. -# -time.sleep(1) - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -serverProc.waitTestSuccess() -starterProc.waitTestSuccess() - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets) diff --git a/cpp/test/Glacier2/sessionControl/test.py b/cpp/test/Glacier2/sessionControl/test.py new file mode 100644 index 00000000000..480a1741b7a --- /dev/null +++ b/cpp/test/Glacier2/sessionControl/test.py @@ -0,0 +1,20 @@ +# -*- 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. +# +# ********************************************************************** + +# +# Note: we limit the send buffer size with Ice.TCP.SndSize, the +# test relies on send() blocking +# +routerProps = lambda process, current : { + 'Glacier2.SessionManager' : 'SessionManager:{0}'.format(current.getTestEndpoint(0)), + 'Glacier2.PermissionsVerifier' : 'Glacier2/NullPermissionsVerifier', +} + +Glacier2TestSuite(__name__, testcases=[ClientServerTestCase(servers=[Glacier2Router(props=routerProps), Server()])]) diff --git a/cpp/test/Glacier2/sessionHelper/Client.cpp b/cpp/test/Glacier2/sessionHelper/Client.cpp index 29363f71a1f..7bb1649f1f4 100644 --- a/cpp/test/Glacier2/sessionHelper/Client.cpp +++ b/cpp/test/Glacier2/sessionHelper/Client.cpp @@ -211,7 +211,7 @@ public: cout << "ok" << endl; instance->notify(); } - catch(...) + catch(const Ice::LocalException&) { test(false); } @@ -273,10 +273,11 @@ public: int run(int argc, char* argv[]) { instance = this; - string protocol = communicator()->getProperties()->getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - string host = communicator()->getProperties()->getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); + string protocol = getTestProtocol(communicator()->getProperties()); + string host = getTestHost(communicator()->getProperties()); _initData.properties = Ice::createProperties(argc, argv, communicator()->getProperties()); - _initData.properties->setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347"); + _initData.properties->setProperty("Ice.Default.Router", "Glacier2/router:" + + getTestEndpoint(communicator(), 10)); DispatcherPtr dispatcher = new Dispatcher(); dispatcher->start(); @@ -313,7 +314,7 @@ public: IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); cout << "testing SessionHelper connect interrupt... " << flush; _factory->setRouterHost(host); - _factory->setPort(12011); + _factory->setPort(getTestPort(_initData.properties, 1)); _factory->setProtocol(protocol); _session = _factory->connect("userid", "abc123"); @@ -333,7 +334,7 @@ public: IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); cout << "testing SessionHelper connect... " << flush; _factory->setRouterHost(host); - _factory->setPort(12347); + _factory->setPort(getTestPort(_initData.properties, 10)); _factory->setProtocol(protocol); _session = _factory->connect("userid", "abc123"); @@ -367,7 +368,8 @@ public: // } cout << "testing stringToProxy for server object... " << flush; - Ice::ObjectPrx base = _session->communicator()->stringToProxy("callback:default -p 12010"); + Ice::ObjectPrx base = _session->communicator()->stringToProxy("callback:" + + getTestEndpoint(_session->communicator(), 0)); cout << "ok" << endl; cout << "pinging server after session creation... " << flush; @@ -450,7 +452,8 @@ public: Ice::ObjectPrx processBase; { cout << "testing stringToProxy for process object... " << flush; - processBase = communicator()->stringToProxy("Glacier2/admin -f Process:default -h \"" + host + "\" -p 12348"); + processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" + + getTestEndpoint(communicator(), 11, "tcp")); cout << "ok" << endl; } @@ -490,7 +493,7 @@ public: IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor); cout << "testing SessionHelper connect after router shutdown... " << flush; _factory->setRouterHost(host); - _factory->setPort(12347); + _factory->setPort(getTestPort(_initData.properties, 10)); _factory->setProtocol(protocol); _session = _factory->connect("userid", "abc123"); @@ -557,5 +560,6 @@ main(int argc, char* argv[]) #endif SessionHelperClient c; - return c.main(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + return c.main(argc, argv, initData); } diff --git a/cpp/test/Glacier2/sessionHelper/Server.cpp b/cpp/test/Glacier2/sessionHelper/Server.cpp index f359b5f557d..9f33dc89d78 100644 --- a/cpp/test/Glacier2/sessionHelper/Server.cpp +++ b/cpp/test/Glacier2/sessionHelper/Server.cpp @@ -9,7 +9,7 @@ #include <IceUtil/IceUtil.h> #include <Ice/Ice.h> - +#include <TestCommon.h> #include <Callback.h> using namespace std; @@ -54,10 +54,10 @@ public: int SessionHelperServer::run(int, char**) { - communicator()->getProperties()->setProperty("DeactivatedAdapter.Endpoints", "default -p 12011"); + communicator()->getProperties()->setProperty("DeactivatedAdapter.Endpoints", getTestEndpoint(communicator(), 1)); communicator()->createObjectAdapter("DeactivatedAdapter"); - communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "default -p 12010"); + communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", getTestEndpoint(communicator(), 0)); Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter"); adapter->add(new CallbackI(), Ice::stringToIdentity("callback")); adapter->activate(); @@ -74,6 +74,7 @@ main(int argc, char* argv[]) #endif SessionHelperServer app; - return app.main(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + return app.main(argc, argv, initData); } diff --git a/cpp/test/Glacier2/sessionHelper/run.py b/cpp/test/Glacier2/sessionHelper/run.py deleted file mode 100755 index 48bae2a0f31..00000000000 --- a/cpp/test/Glacier2/sessionHelper/run.py +++ /dev/null @@ -1,48 +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 - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="default"' \ - ' --Ice.Admin.Endpoints="default -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest(additionalClientOptions=" --shutdown") - -starterProc.waitTestSuccess() diff --git a/cpp/test/Glacier2/ssl/Client.cpp b/cpp/test/Glacier2/ssl/Client.cpp index 4859e556e16..6ed1c17550a 100644 --- a/cpp/test/Glacier2/ssl/Client.cpp +++ b/cpp/test/Glacier2/ssl/Client.cpp @@ -34,10 +34,8 @@ main(int argc, char* argv[]) // the router before session establishment, as well as after // session destruction. Both will cause a ConnectionLostException. // - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); - CallbackClient app; return app.main(argc, argv, initData); } @@ -46,7 +44,7 @@ int CallbackClient::run(int, char**) { Glacier2::RouterPrx router = Glacier2::RouterPrx::uncheckedCast( - communicator()->stringToProxy("Glacier2/router:tcp -h 127.0.0.1 -p 12347")); + communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 0, "tcp"))); communicator()->setDefaultRouter(router); // @@ -82,7 +80,7 @@ CallbackClient::run(int, char**) // communicator()->setDefaultRouter(Glacier2::RouterPrx()); router = Glacier2::RouterPrx::uncheckedCast( - communicator()->stringToProxy("Glacier2/router:ssl -h 127.0.0.1 -p 12348")); + communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 1, "ssl"))); communicator()->setDefaultRouter(router); // @@ -116,7 +114,7 @@ CallbackClient::run(int, char**) communicator()->setDefaultRouter(0); Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast( - communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12349")); + communicator()->stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(communicator(), 2, "tcp"))); process->shutdown(); return EXIT_SUCCESS; diff --git a/cpp/test/Glacier2/ssl/Server.cpp b/cpp/test/Glacier2/ssl/Server.cpp index fcaf8d411b9..ad112cb23c2 100644 --- a/cpp/test/Glacier2/ssl/Server.cpp +++ b/cpp/test/Glacier2/ssl/Server.cpp @@ -18,18 +18,22 @@ using namespace std; namespace { -void testContext(bool ssl, const Ice::Context& context) +void testContext(bool ssl, const Ice::CommunicatorPtr& communicator, const Ice::Context& context) { Ice::Context ctx = context; if(!ssl) { test(ctx["_con.type"] == "tcp"); - test(ctx["_con.localPort"] == "12347"); + ostringstream port; + port << getTestPort(communicator->getProperties(), 0); + test(ctx["_con.localPort"] == port.str()); } else { test(ctx["_con.type"] == "ssl"); - test(ctx["_con.localPort"] == "12348"); + ostringstream port; + port << getTestPort(communicator->getProperties(), 1); + test(ctx["_con.localPort"] == port.str()); } test(ctx["_con.localAddress"] == "127.0.0.1"); test(ctx["_con.remotePort"] != ""); @@ -45,7 +49,7 @@ public: virtual bool checkPermissions(const string& userId, const string&, string&, const Ice::Current& current) const { - testContext(userId == "ssl", current.ctx); + testContext(userId == "ssl", current.adapter->getCommunicator(), current.ctx); return true; } }; @@ -57,7 +61,7 @@ public: virtual bool authorize(const Glacier2::SSLInfo& info, string&, const Ice::Current& current) const { - testContext(true, current.ctx); + testContext(true, current.adapter->getCommunicator(), current.ctx); IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]); test(cert->getIssuerDN() == IceSSL::DistinguishedName( @@ -81,7 +85,7 @@ public: virtual void destroy(const Ice::Current& current) { - testContext(_ssl, current.ctx); + testContext(_ssl, current.adapter->getCommunicator(), current.ctx); current.adapter->remove(current.id); if(_shutdown) @@ -93,7 +97,7 @@ public: virtual void ice_ping(const Ice::Current& current) const { - testContext(_ssl, current.ctx); + testContext(_ssl, current.adapter->getCommunicator(), current.ctx); } private: @@ -109,7 +113,7 @@ public: virtual Glacier2::SessionPrx create(const string& userId, const Glacier2::SessionControlPrx&, const Ice::Current& current) { - testContext(userId == "ssl", current.ctx); + testContext(userId == "ssl", current.adapter->getCommunicator(), current.ctx); Glacier2::SessionPtr session = new SessionI(false, userId == "ssl"); return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(session)); @@ -123,11 +127,11 @@ public: virtual Glacier2::SessionPrx create(const Glacier2::SSLInfo& info, const Glacier2::SessionControlPrx&, const Ice::Current& current) { - testContext(true, current.ctx); + testContext(true, current.adapter->getCommunicator(), current.ctx); test(info.remoteHost == "127.0.0.1"); test(info.localHost == "127.0.0.1"); - test(info.localPort == 12348); + test(info.localPort == getTestPort(current.adapter->getCommunicator()->getProperties(), 1)); try { @@ -163,14 +167,15 @@ main(int argc, char* argv[]) #endif SessionServer app; - return app.main(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + return app.main(argc, argv, initData); } int SessionServer::run(int, char**) { - Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints( - "SessionServer", "tcp -h 127.0.0.1 -p 12350"); + Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("SessionServer", + getTestEndpoint(communicator(), 3, "tcp")); adapter->add(new PermissionsVerifierI, Ice::stringToIdentity("verifier")); adapter->add(new SSLPermissionsVerifierI, Ice::stringToIdentity("sslverifier")); adapter->add(new SessionManagerI, Ice::stringToIdentity("sessionmanager")); diff --git a/cpp/test/Glacier2/ssl/run.py b/cpp/test/Glacier2/ssl/run.py deleted file mode 100755 index a28b3c7a83b..00000000000 --- a/cpp/test/Glacier2/ssl/run.py +++ /dev/null @@ -1,69 +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 - -server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -router = TestUtil.getGlacier2Router() - -targets = [] -if TestUtil.appverifier: - targets = [server, client, router] - TestUtil.setAppVerifierSettings(targets) - -sys.stdout.write("starting server... ") -sys.stdout.flush() -serverProc = TestUtil.startServer(server) -print("ok") - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Glacier2.AddConnectionContext=1' + \ - ' --Glacier2.Client.Endpoints="tcp -h 127.0.0.1 -p 12347:ssl -h 127.0.0.1 -p 12348"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12349"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.SessionManager="sessionmanager:tcp -h 127.0.0.1 -p 12350"' + \ - ' --Glacier2.PermissionsVerifier="verifier:tcp -h 127.0.0.1 -p 12350"' + \ - ' --Glacier2.SSLSessionManager="sslsessionmanager:tcp -h 127.0.0.1 -p 12350"' + \ - ' --Glacier2.SSLPermissionsVerifier="sslverifier:tcp -h 127.0.0.1 -p 12350"' - -routerCfg = TestUtil.DriverConfig("server") -routerCfg.protocol = "ssl" -sys.stdout.write("starting router... ") -sys.stdout.flush() -starterProc = TestUtil.startServer(router, args, routerCfg, count = 2) -print("ok") - -clientCfg = TestUtil.DriverConfig("client") -clientCfg.protocol = "ssl" - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, "", clientCfg, startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -serverProc.waitTestSuccess() -starterProc.waitTestSuccess() - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets) diff --git a/cpp/test/Glacier2/ssl/test.py b/cpp/test/Glacier2/ssl/test.py new file mode 100644 index 00000000000..d63c1f866ac --- /dev/null +++ b/cpp/test/Glacier2/ssl/test.py @@ -0,0 +1,29 @@ +# -*- 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. +# +# ********************************************************************** + +routerProps = lambda process, current : { + 'Ice.Warn.Dispatch' : '0', + 'Glacier2.AddConnectionContext' : '1', + 'Glacier2.Client.Endpoints' : '{0}:{1}'.format(current.getTestEndpoint(0, "tcp"), current.getTestEndpoint(1, "ssl")), + 'Ice.Admin.Endpoints' : current.getTestEndpoint(2, "tcp"), + 'Glacier2.SessionManager' : 'sessionmanager:{0}'.format(current.getTestEndpoint(3, "tcp")), + 'Glacier2.PermissionsVerifier' : 'verifier:{0}'.format(current.getTestEndpoint(3, "tcp")), + 'Glacier2.SSLSessionManager' : 'sslsessionmanager:{0}'.format(current.getTestEndpoint(3, "tcp")), + 'Glacier2.SSLPermissionsVerifier' : 'sslverifier:{0}'.format(current.getTestEndpoint(3, "tcp")), +} + +# +# Always enable SSL for the Glacier2 router and client +# +sslProps = lambda process, current: current.testcase.getMapping().getSSLProps(process) + +Glacier2TestSuite(__name__, routerProps=routerProps, options={ "ipv6" : [ False ] }, multihost=False, + testcases=[ClientServerTestCase(servers=[Glacier2Router(props=sslProps), Server()], + client=Client(props=sslProps))]) diff --git a/cpp/test/Glacier2/staticFiltering/.gitignore b/cpp/test/Glacier2/staticFiltering/.gitignore index 896ef01805f..91cc546abba 100644 --- a/cpp/test/Glacier2/staticFiltering/.gitignore +++ b/cpp/test/Glacier2/staticFiltering/.gitignore @@ -1,3 +1,3 @@ -attack.cfg +client.cfg router.cfg server.cfg diff --git a/cpp/test/Glacier2/staticFiltering/Client.cpp b/cpp/test/Glacier2/staticFiltering/Client.cpp index 9e115fecd41..64223ab657f 100644 --- a/cpp/test/Glacier2/staticFiltering/Client.cpp +++ b/cpp/test/Glacier2/staticFiltering/Client.cpp @@ -30,8 +30,7 @@ main(int argc, char* argv[]) Ice::registerIceSSL(); #endif - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // We want to check whether the client retries for evicted @@ -46,7 +45,7 @@ main(int argc, char* argv[]) int AttackClient::run(int, char**) { - ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347"); + ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10)); Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase); test(router); communicator()->setDefaultRouter(router); @@ -152,7 +151,8 @@ AttackClient::run(int, char**) test(false); } - ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); + ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" + + getTestEndpoint(communicator(), 11, "tcp")); Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(processBase); test(process); process->shutdown(); diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py deleted file mode 100755 index d84921d2778..00000000000 --- a/cpp/test/Glacier2/staticFiltering/run.py +++ /dev/null @@ -1,367 +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, time, socket - -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 - -hostname = socket.gethostname().lower() -fqdn = socket.getfqdn().lower() - -limitedTests = False - -router = TestUtil.getGlacier2Router() -clientCmd = os.path.join(os.getcwd(), TestUtil.getTestExecutable('client')) -serverCmd = os.path.join(os.getcwd(), TestUtil.getTestExecutable('server')) - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -targets = [] -if TestUtil.appverifier: - targets = [serverCmd, clientCmd, router] - TestUtil.setAppVerifierSettings(targets) - -# -# Try and figure out what tests are reasonable with this host's -# configuration. -# -if fqdn.endswith("localdomain") or fqdn.endswith("local") or fqdn.endswith("domain"): - # - # No real configured domain name, this means that anything that - # requires a domain name isn't likely going to work. Furthermore, it - # might be the case that the hostname contains this suffix, so we - # should just toss it and pretend that there is no 'hostname' - # configured for this box. - # - hostname = "127.0.0.1" - fqdn = "" - domainname = "" - limitedTests = True -elif hostname.startswith("localhost"): - # - # No configured host name (and possibly no domain name), minimal - # tests. - # - hostname = "127.0.0.1" - fqdn = "" - domainname = "" - limitedTests = True -elif fqdn.find(".") == -1: - # - # No real configured domain. - # - hostname = "127.0.0.1" - fqdn = "" - domainname = "" - limitedTests = True -else: - dot = fqdn.find(".") - domainname = fqdn[dot+1:] - # - # Some Python installs are going to return a FQDN for gethostname(). - # This invalidates the tests that need to differentiate between the - # hostname and the FQDN. If these tests fail because of a DNS error, - # it may be that an alias is not present for the host partition of - # the FQDN. - # - if fqdn == hostname: - hostname = hostname[:dot] - if domainname == "": - limitedTests = True -try: - testaddr1 = socket.gethostbyname(fqdn) - testaddr2 = socket.gethostbyname(hostname) - - # On SuSE distributions, 127.0.0.2 is sometime used in /etc/hosts - # for the hostname (apparently if no network interface was found - # when the OS was installed). However, connecting to this IP addr - # doesn't work (even if can be "ping"). - if testaddr1 == "127.0.0.2" or testaddr2 == "127.0.0.2": - limitedTests = True - hostname = "127.0.0.1" - fqdn = "" - domainname = "" -except: - limitedTests = True - hostname = "127.0.0.1" - fqdn = "" - domainname = "" - -testcases = [ - ('testing category filter', - ('', '', '', 'foo "a cat with spaces"', '', ''), - [(True, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'), - (True, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), - (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), - (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010')], []), - ('testing adapter id filter', - ('', '*', '', '', '', 'foo "an adapter with spaces"'), - [(False, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'), - (False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), - (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), - (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'), - (False, 'helloE @ bar'), - (True, 'helloF1 @ "an adapter with spaces"'), - (True, 'helloF @ foo')], []), - ('test identity filters', - ('', '', '', '', 'myident cata/fooa "a funny id/that might mess it up"', ''), - [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), - (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), - (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'), - (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'), - (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'), - (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'), - (True, 'myident:tcp -h 127.0.0.1 -p 12010'), - (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'), - (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []), - ('test mixing filters', - ('', '', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up" "a\\"nother"', - 'myadapter'), - [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), - (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), - (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'), - (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'), - (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'), - (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'), - (True, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'), - (True, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'), - (True, 'mycat/foo @ jimbo'), - (False, 'hiscatA @ jimbo'), - (True, 'hiscat @ myadapter'), - (True, 'a\"nother @ jimbo'), - (True, 'myident:tcp -h 127.0.0.1 -p 12010'), - (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'), - (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []), - ('test mixing filters (indirect only)', - ('', '*', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up"', 'myadapter'), - [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), - (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), - (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'), - (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'), - (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'), - (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'), - (False, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'), - (False, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'), - (True, 'mycat/foo @ jimbo'), - (False, 'hiscatA @ jimbo'), - (True, 'hiscat @ myadapter'), - (False, 'myident:tcp -h 127.0.0.1 -p 12010'), - (False, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'), - (True, '"a funny id/that might mess it up" @ myadapter'), - (False, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []), - ] - -if not limitedTests: - testcases.extend([ - ('testing reject all', - ('', '*', '', '', '', ''), - [(False, 'helloA:tcp -h %s -p 12010' % fqdn), - (False, 'helloB:tcp -h %s -p 12010' % hostname), - (False, 'helloC:tcp -h 127.0.0.1 -p 12010'), - (True, 'bar @ foo')], []), - ('testing loopback only rule', - ('127.0.0.1 localhost', '', '', '', '', ''), - [(False, 'hello:tcp -h %s -p 12010' % fqdn), - (False, 'hello:tcp -h %s -p 12010' % hostname), - (False, '127.0.0.1:tcp -h %s -p 12010' % hostname), - (False, 'localhost:tcp -h %s -p 12010' % hostname), - (False, 'localhost/127.0.0.1:tcp -h %s -p 12010' % hostname), - (True, 'localhost:tcp -h 127.0.0.1 -p 12010'), - (True, 'localhost/127.0.0.1:tcp -h localhost -p 12010'), - (True, 'hello:tcp -h 127.0.0.1 -p 12010'), - (True, 'hello/somecat:tcp -h localhost -p 12010')], []), - ('testing port filter rule', - ('127.0.0.1:12010 localhost:12010', '', '', '', '', ''), - [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), - (False, 'hello2:tcp -h localhost -p 12011'), - (False, 'hello5:tcp -h %s -p 12010' % hostname), - (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), - (True, 'hello4:tcp -h localhost -p 12010')], []), - ('testing reject port filter rule', - ('', '127.0.0.1:[0-12009,12011-65535] localhost:[0-12009,12011-65535]', '', '', '', ''), - [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), - (False, 'hello2:tcp -h localhost -p 12011'), - (True, 'hello5:tcp -h %s -p 12010' % hostname), - (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), - (True, 'hello4:tcp -h localhost -p 12010')], []), - ('testing port filter rule with wildcard address rule', - ('*:12010', '', '', '', '', ''), - [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), - (False, 'hello2:tcp -h localhost -p 12011'), - (True, 'hello5:tcp -h %s -p 12010' % hostname), - (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), - (True, 'hello4:tcp -h localhost -p 12010')], []), - ('testing domain filter rule (accept)', - ("*" + domainname, '', '', '', '', ''), - [(True, 'hello:tcp -h %s -p 12010' % fqdn), - (False, 'hello:tcp -h %s -p 12010' % hostname)], []), - ('testing domain filter rule (reject)', - ('', "*" + domainname, '', '', '', ''), - [(False, 'hello:tcp -h %s -p 12010' % fqdn), - (True, 'hello:tcp -h %s -p 12010' % hostname), - (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []), - ('testing domain filter rule (mixed)', - ("127.0.0.1", fqdn, '', '', '', ''), - [(False, 'hello:tcp -h %s -p 12010:tcp -h 127.0.0.1 -p 12010' % fqdn), - (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []), - ('testing maximum proxy length rule', - ('', '', '53', '', '', ''), - [(True, 'hello:tcp -h 127.0.0.1 -p 12010 -t infinite'), - (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []), - ]) - -if len(testcases) == 0: - print("WARNING: You are running this test with SSL disabled and the network ") - print(" configuration for this host does not permit the other tests ") - print(" to run correctly.") - sys.exit(0) -elif len(testcases) < 6: - print("WARNING: The network configuration for this host does not permit all ") - print(" tests to run correctly, some tests have been disabled.") - -def pingProgress(): - sys.stdout.write('.') - sys.stdout.flush() - -for testcase in testcases: - description, args, attacks, xtraConfig = testcase - acceptFilter, rejectFilter, maxEndpoints, categoryFilter, idFilter, adapterFilter = args - # - # The test client performs multiple tests during one 'run'. We could - # use command line arguments to pass the test cases in, but a - # configuration file is easier. - # - attackcfg = open(os.path.join(os.getcwd(), 'attack.cfg'), 'w') - accepts=0 - rejects=0 - sys.stdout.write(description) - - for expect, proxy in attacks: - if expect: - attackcfg.write('Accept.Proxy.' + str(accepts) + '=') - accepts +=1 - else: - attackcfg.write('Reject.Proxy.' + str(rejects) + '=') - rejects +=1 - attackcfg.write(proxy + '\n') - - attackcfg.close() - pingProgress() - - hostArg = "" - if limitedTests: - hostArg = " --Ice.Default.Host=127.0.0.1" - # - # This test causes connections to be terminated which will cause - # warnings if we use the default test flags. So we need to define - # our own. - # - commonClientOptions = " --Ice.NullHandleAbort=1 --Ice.Warn.Connections=0 " + hostArg - commonServerOptions = ' --Ice.PrintAdapterReady --Ice.NullHandleAbort=1' + \ - ' --Ice.ServerIdleTime=600 --Ice.ThreadPool.Server.Size=2 --Ice.ThreadPool.Server.SizeMax=10' + \ - ' --Glacier2.RoutingTable.MaxSize=10 --Ice.Warn.Connections=0 ' + hostArg - - # - # We cannot use the TestUtil options because they use localhost as the default host which doesn't really work for - # these tests. - # - - routerArgs = ' --Ice.Config="' + os.path.join(os.getcwd(), "router.cfg") + '"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - - routerConfig = open(os.path.join(os.getcwd(), "router.cfg"), "w") - - routerConfig.write("Ice.Default.Locator=locator:tcp -h %s -p 12010\n" % hostname) - routerConfig.write("Glacier2.Client.Trace.Reject=0\n") - routerConfig.write("#\n") - - for l in xtraConfig: - routerConfig.write(l) - routerConfig.write("\n") - - # - # We configure the AddProxy constraints as a configuration file. - # Regular expression syntax can easily confuse the command line. - # - if not len(acceptFilter) == 0: - routerConfig.write("Glacier2.Filter.Address.Accept=%s\n" % acceptFilter) - if not len(rejectFilter) == 0: - routerConfig.write("Glacier2.Filter.Address.Reject=%s\n" % rejectFilter) - if not len(maxEndpoints) == 0: - routerConfig.write("Glacier2.Filter.ProxySizeMax=%s\n" % maxEndpoints) - if not len(categoryFilter) == 0: - routerConfig.write("Glacier2.Filter.Category.Accept=%s\n" % categoryFilter) - if not len(idFilter) == 0: - routerConfig.write("Glacier2.Filter.Identity.Accept=%s\n" % idFilter) - if not len(adapterFilter) == 0: - routerConfig.write("Glacier2.Filter.AdapterId.Accept=%s\n" % adapterFilter) - - routerConfig.close() - - # - # We need to override the test driver defaults for the Ice.Default.Host if - # it is set to loopback. - # - routerDriver = TestUtil.DriverConfig("server") - if routerDriver.host == None: - routerDriver.host = "" - routerDriver.overrides = commonServerOptions + routerArgs - - starterProc = TestUtil.startServer(router, config=routerDriver, count=2) - pingProgress() - - if TestUtil.protocol != "ssl": - serverConfig = open(os.path.join(os.getcwd(), "server.cfg"), "w") - serverOptions = ' --Ice.Config="' + os.path.join(os.getcwd(), "server.cfg") + '" ' - serverConfig.write("BackendAdapter.Endpoints=tcp -p 12010\n") - serverConfig.close() - else: - serverOptions = "" - - serverDriver = TestUtil.DriverConfig("server") - if serverDriver.host == None: - serverDriver.host = "" - serverDriver.overrides = commonServerOptions - serverProc = TestUtil.startServer(serverCmd, serverOptions, serverDriver) - pingProgress() - - sys.stdout.write(' ') - sys.stdout.flush() - - # - # The client is responsible for reporting success or failure. A test - # failure will result in an assertion and the test will abort. - # - clientDriver = TestUtil.DriverConfig("client") - if clientDriver.host == None: - clientDriver.host = "" - clientDriver.host = commonClientOptions - clientArgs = ' --Ice.Config="%s"' % os.path.join(os.getcwd(), 'attack.cfg') - clientProc = TestUtil.startClient(clientCmd, clientArgs, clientDriver) - clientProc.waitTestSuccess() - serverProc.waitTestSuccess() - starterProc.waitTestSuccess() - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets) diff --git a/cpp/test/Glacier2/staticFiltering/test.py b/cpp/test/Glacier2/staticFiltering/test.py new file mode 100644 index 00000000000..710ba3faabc --- /dev/null +++ b/cpp/test/Glacier2/staticFiltering/test.py @@ -0,0 +1,294 @@ +# -*- 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 Glacier2StaticFilteringTestCase(ClientServerTestCase): + + def __init__(self, testcase, hostname): + self.hostname = hostname + description, self.tcArgs, self.attacks, self.xtraConfig = testcase + + clientProps = { "Ice.Config" : "{testdir}/client.cfg", "Ice.Warn.Connections" : 0 } + serverProps = { "Ice.Config" : "{testdir}/server.cfg", "Ice.Warn.Connections" : 0 } + routerProps = { "Ice.Config" : "{testdir}/router.cfg", "Glacier2.RoutingTable.MaxSize" : 10 } + + ClientServerTestCase.__init__(self, + description, + desc=description, + servers=[Glacier2Router(props=routerProps), Server(props=serverProps)], + client=Client(props=clientProps)) + + def setupClientSide(self, current): + current.write("testing {0}... ".format(self)) + + def setupServerSide(self, current): + acceptFilter, rejectFilter, maxEndpoints, categoryFilter, idFilter, adapterFilter = self.tcArgs + + # + # The test client performs multiple tests during one 'run'. We could + # use command line arguments to pass the test cases in, but a + # configuration file is easier. + # + with open(os.path.join(self.getTestSuite().getPath(), 'client.cfg'), 'w') as clientConfig: + accepts=0 + rejects=0 + for expect, proxy in self.attacks: + if expect: + clientConfig.write('Accept.Proxy.' + str(accepts) + '=') + accepts +=1 + else: + clientConfig.write('Reject.Proxy.' + str(rejects) + '=') + rejects +=1 + clientConfig.write(proxy + '\n') + + with open(os.path.join(self.getTestSuite().getPath(), 'server.cfg'), 'w') as serverConfig: + if current.config.protocol != "ssl": + serverConfig.write("BackendAdapter.Endpoints=tcp -p 12010\n") + + with open(os.path.join(self.getTestSuite().getPath(), "router.cfg"), "w") as routerConfig: + routerConfig.write("Ice.Default.Locator=locator:tcp -h %s -p 12010\n" % self.hostname) + routerConfig.write("Glacier2.Client.Trace.Reject=0\n") + routerConfig.write("#\n") + + for l in self.xtraConfig: + routerConfig.write(l) + routerConfig.write("\n") + + # + # We configure the AddProxy constraints as a configuration file. + # Regular expression syntax can easily confuse the command line. + # + if not len(acceptFilter) == 0: + routerConfig.write("Glacier2.Filter.Address.Accept=%s\n" % acceptFilter) + if not len(rejectFilter) == 0: + routerConfig.write("Glacier2.Filter.Address.Reject=%s\n" % rejectFilter) + if not len(maxEndpoints) == 0: + routerConfig.write("Glacier2.Filter.ProxySizeMax=%s\n" % maxEndpoints) + if not len(categoryFilter) == 0: + routerConfig.write("Glacier2.Filter.Category.Accept=%s\n" % categoryFilter) + if not len(idFilter) == 0: + routerConfig.write("Glacier2.Filter.Identity.Accept=%s\n" % idFilter) + if not len(adapterFilter) == 0: + routerConfig.write("Glacier2.Filter.AdapterId.Accept=%s\n" % adapterFilter) + +class Glacier2StaticFilteringTestSuite(Glacier2TestSuite): + + def setup(self, current): + + Glacier2TestSuite.setup(self, current) + + import socket + + hostname = socket.gethostname().lower() + fqdn = socket.getfqdn().lower() + + limitedTests = False + + # + # Try and figure out what tests are reasonable with this host's + # configuration. + # + if fqdn.endswith("localdomain") or fqdn.endswith("local") or fqdn.endswith("domain"): + # + # No real configured domain name, this means that anything that + # requires a domain name isn't likely going to work. Furthermore, it + # might be the case that the hostname contains this suffix, so we + # should just toss it and pretend that there is no 'hostname' + # configured for this box. + # + hostname = "127.0.0.1" + fqdn = "" + domainname = "" + limitedTests = True + elif hostname.startswith("localhost"): + # + # No configured host name (and possibly no domain name), minimal + # tests. + # + hostname = "127.0.0.1" + fqdn = "" + domainname = "" + limitedTests = True + elif fqdn.find(".") == -1: + # + # No real configured domain. + # + hostname = "127.0.0.1" + fqdn = "" + domainname = "" + limitedTests = True + else: + dot = fqdn.find(".") + domainname = fqdn[dot+1:] + # + # Some Python installs are going to return a FQDN for gethostname(). + # This invalidates the tests that need to differentiate between the + # hostname and the FQDN. If these tests fail because of a DNS error, + # it may be that an alias is not present for the host partition of + # the FQDN. + # + if fqdn == hostname: + hostname = hostname[:dot] + if domainname == "": + limitedTests = True + try: + testaddr1 = socket.gethostbyname(fqdn) + testaddr2 = socket.gethostbyname(hostname) + + # On SuSE distributions, 127.0.0.2 is sometime used in /etc/hosts + # for the hostname (apparently if no network interface was found + # when the OS was installed). However, connecting to this IP addr + # doesn't work (even if can be "ping"). + if testaddr1 == "127.0.0.2" or testaddr2 == "127.0.0.2": + limitedTests = True + hostname = "127.0.0.1" + fqdn = "" + domainname = "" + except: + limitedTests = True + hostname = "127.0.0.1" + fqdn = "" + domainname = "" + + testcases = [ + ('testing category filter', + ('', '', '', 'foo "a cat with spaces"', '', ''), + [(True, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'), + (True, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), + (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), + (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010')], []), + ('testing adapter id filter', + ('', '*', '', '', '', 'foo "an adapter with spaces"'), + [(False, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'), + (False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), + (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), + (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'), + (False, 'helloE @ bar'), + (True, 'helloF1 @ "an adapter with spaces"'), + (True, 'helloF @ foo')], []), + ('test identity filters', + ('', '', '', '', 'myident cata/fooa "a funny id/that might mess it up"', ''), + [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), + (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), + (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'), + (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'), + (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'), + (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'), + (True, 'myident:tcp -h 127.0.0.1 -p 12010'), + (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'), + (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []), + ('test mixing filters', + ('', '', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up" "a\\"nother"', + 'myadapter'), + [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), + (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), + (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'), + (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'), + (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'), + (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'), + (True, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'), + (True, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'), + (True, 'mycat/foo @ jimbo'), + (False, 'hiscatA @ jimbo'), + (True, 'hiscat @ myadapter'), + (True, 'a\"nother @ jimbo'), + (True, 'myident:tcp -h 127.0.0.1 -p 12010'), + (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'), + (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []), + ('test mixing filters (indirect only)', + ('', '*', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up"', 'myadapter'), + [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'), + (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'), + (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'), + (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'), + (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'), + (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'), + (False, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'), + (False, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'), + (True, 'mycat/foo @ jimbo'), + (False, 'hiscatA @ jimbo'), + (True, 'hiscat @ myadapter'), + (False, 'myident:tcp -h 127.0.0.1 -p 12010'), + (False, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'), + (True, '"a funny id/that might mess it up" @ myadapter'), + (False, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []), + ] + + if not limitedTests: + testcases.extend([ + ('testing reject all', + ('', '*', '', '', '', ''), + [(False, 'helloA:tcp -h %s -p 12010' % fqdn), + (False, 'helloB:tcp -h %s -p 12010' % hostname), + (False, 'helloC:tcp -h 127.0.0.1 -p 12010'), + (True, 'bar @ foo')], []), + ('testing loopback only rule', + ('127.0.0.1 localhost', '', '', '', '', ''), + [(False, 'hello:tcp -h %s -p 12010' % fqdn), + (False, 'hello:tcp -h %s -p 12010' % hostname), + (False, '127.0.0.1:tcp -h %s -p 12010' % hostname), + (False, 'localhost:tcp -h %s -p 12010' % hostname), + (False, 'localhost/127.0.0.1:tcp -h %s -p 12010' % hostname), + (True, 'localhost:tcp -h 127.0.0.1 -p 12010'), + (True, 'localhost/127.0.0.1:tcp -h localhost -p 12010'), + (True, 'hello:tcp -h 127.0.0.1 -p 12010'), + (True, 'hello/somecat:tcp -h localhost -p 12010')], []), + ('testing port filter rule', + ('127.0.0.1:12010 localhost:12010', '', '', '', '', ''), + [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), + (False, 'hello2:tcp -h localhost -p 12011'), + (False, 'hello5:tcp -h %s -p 12010' % hostname), + (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), + (True, 'hello4:tcp -h localhost -p 12010')], []), + ('testing reject port filter rule', + ('', '127.0.0.1:[0-12009,12011-65535] localhost:[0-12009,12011-65535]', '', '', '', ''), + [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), + (False, 'hello2:tcp -h localhost -p 12011'), + (True, 'hello5:tcp -h %s -p 12010' % hostname), + (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), + (True, 'hello4:tcp -h localhost -p 12010')], []), + ('testing port filter rule with wildcard address rule', + ('*:12010', '', '', '', '', ''), + [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'), + (False, 'hello2:tcp -h localhost -p 12011'), + (True, 'hello5:tcp -h %s -p 12010' % hostname), + (True, 'hello3:tcp -h 127.0.0.1 -p 12010'), + (True, 'hello4:tcp -h localhost -p 12010')], []), + ('testing domain filter rule (accept)', + ("*" + domainname, '', '', '', '', ''), + [(True, 'hello:tcp -h %s -p 12010' % fqdn), + (False, 'hello:tcp -h %s -p 12010' % hostname)], []), + ('testing domain filter rule (reject)', + ('', "*" + domainname, '', '', '', ''), + [(False, 'hello:tcp -h %s -p 12010' % fqdn), + (True, 'hello:tcp -h %s -p 12010' % hostname), + (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []), + ('testing domain filter rule (mixed)', + ("127.0.0.1", fqdn, '', '', '', ''), + [(False, 'hello:tcp -h %s -p 12010:tcp -h 127.0.0.1 -p 12010' % fqdn), + (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []), + ('testing maximum proxy length rule', + ('', '', '53', '', '', ''), + [(True, 'hello:tcp -h 127.0.0.1 -p 12010 -t infinite'), + (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []), + ]) + + if len(testcases) == 0: + current.writeln("WARNING: You are running this test with SSL disabled and the network ") + current.writeln(" configuration for this host does not permit the other tests ") + current.writeln(" to run correctly.") + elif len(testcases) < 6: + current.writeln("WARNING: The network configuration for this host does not permit all ") + current.writeln(" tests to run correctly, some tests have been disabled.") + + self.testcases = {} + for testcase in testcases: + self.addTestCase(Glacier2StaticFilteringTestCase(testcase, hostname)) + +Glacier2StaticFilteringTestSuite(__name__, testcases=[], runOnMainThread=True, options={ "ipv6" : [False] }, multihost=False) diff --git a/cpp/test/Ice/acm/Client.cpp b/cpp/test/Ice/acm/Client.cpp index 55f24fafec1..50ff5687f93 100644 --- a/cpp/test/Ice/acm/Client.cpp +++ b/cpp/test/Ice/acm/Client.cpp @@ -35,8 +35,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/acm/Server.cpp b/cpp/test/Ice/acm/Server.cpp index d2af92e45f8..068441bada3 100644 --- a/cpp/test/Ice/acm/Server.cpp +++ b/cpp/test/Ice/acm/Server.cpp @@ -42,8 +42,7 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.ACM.Timeout", "1"); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/acm/run.py b/cpp/test/Ice/acm/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/acm/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() diff --git a/cpp/test/Ice/adapterDeactivation/AllTests.cpp b/cpp/test/Ice/adapterDeactivation/AllTests.cpp index c1aa649be20..558c939d5ef 100644 --- a/cpp/test/Ice/adapterDeactivation/AllTests.cpp +++ b/cpp/test/Ice/adapterDeactivation/AllTests.cpp @@ -42,26 +42,20 @@ allTests(const CommunicatorPtr& communicator) if(!winrt || (communicator->getProperties()->getProperty("Ice.Default.Protocol") != "ssl" && communicator->getProperties()->getProperty("Ice.Default.Protocol") != "wss")) { - string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? - "127.0.0.1" : "\"0:0:0:0:0:0:0:1\""; cout << "creating/destroying/recreating object adapter... " << flush; - ObjectAdapterPtr adapter = - communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host); + ObjectAdapterPtr adpt = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); try { - communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host); + communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); test(false); } catch(const AlreadyRegisteredException&) { } - adapter->destroy(); + adpt->destroy(); - // - // Use a different port than the first adapter to avoid an "address already in use" error. - // - adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host); - adapter->destroy(); + adpt = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); + adpt->destroy(); cout << "ok" << endl; } } diff --git a/cpp/test/Ice/adapterDeactivation/Client.cpp b/cpp/test/Ice/adapterDeactivation/Client.cpp index 57d213db18c..10bb6c1ddc8 100644 --- a/cpp/test/Ice/adapterDeactivation/Client.cpp +++ b/cpp/test/Ice/adapterDeactivation/Client.cpp @@ -36,7 +36,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/adapterDeactivation/Collocated.cpp b/cpp/test/Ice/adapterDeactivation/Collocated.cpp index 1314d809f42..2be431c8db5 100644 --- a/cpp/test/Ice/adapterDeactivation/Collocated.cpp +++ b/cpp/test/Ice/adapterDeactivation/Collocated.cpp @@ -48,7 +48,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/adapterDeactivation/ServantLocatorI.cpp b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp index 02ae90f5771..b73ef715829 100644 --- a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp +++ b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp @@ -44,11 +44,9 @@ ServantLocatorI::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie void #ifdef ICE_CPP11_MAPPING -ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&, - const std::shared_ptr<void>& cookie) +ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&, const std::shared_ptr<void>& cookie) #else -ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&, - const Ice::LocalObjectPtr& cookie) +ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr& cookie) #endif { test(!_deactivated); diff --git a/cpp/test/Ice/adapterDeactivation/Server.cpp b/cpp/test/Ice/adapterDeactivation/Server.cpp index 622787f1676..b737e236f68 100644 --- a/cpp/test/Ice/adapterDeactivation/Server.cpp +++ b/cpp/test/Ice/adapterDeactivation/Server.cpp @@ -38,7 +38,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/adapterDeactivation/TestI.cpp b/cpp/test/Ice/adapterDeactivation/TestI.cpp index 2f8f2e29e77..f318420ab1d 100644 --- a/cpp/test/Ice/adapterDeactivation/TestI.cpp +++ b/cpp/test/Ice/adapterDeactivation/TestI.cpp @@ -10,6 +10,7 @@ #include <IceUtil/IceUtil.h> #include <Ice/Ice.h> #include <TestI.h> +#include <TestCommon.h> using namespace std; using namespace Ice; @@ -18,9 +19,8 @@ void TestI::transient(const Current& current) { CommunicatorPtr communicator = current.adapter->getCommunicator(); - - ObjectAdapterPtr adapter = - communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", + getTestEndpoint(communicator, 1)); adapter->activate(); adapter->destroy(); } diff --git a/cpp/test/Ice/adapterDeactivation/run.py b/cpp/test/Ice/adapterDeactivation/run.py deleted file mode 100755 index 2d96b653cfa..00000000000 --- a/cpp/test/Ice/adapterDeactivation/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/admin/Client.cpp b/cpp/test/Ice/admin/Client.cpp index 2b954f4ac2a..1fcfc0a05ad 100644 --- a/cpp/test/Ice/admin/Client.cpp +++ b/cpp/test/Ice/admin/Client.cpp @@ -32,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/admin/Server.cpp b/cpp/test/Ice/admin/Server.cpp index c18d954e2ef..729f9bd73ea 100644 --- a/cpp/test/Ice/admin/Server.cpp +++ b/cpp/test/Ice/admin/Server.cpp @@ -37,7 +37,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/admin/run.py b/cpp/test/Ice/admin/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/admin/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() diff --git a/cpp/test/Ice/ami/Client.cpp b/cpp/test/Ice/ami/Client.cpp index 9e4c0e234c7..660157236f5 100644 --- a/cpp/test/Ice/ami/Client.cpp +++ b/cpp/test/Ice/ami/Client.cpp @@ -35,8 +35,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.AMICallback", "0"); // diff --git a/cpp/test/Ice/ami/Collocated.cpp b/cpp/test/Ice/ami/Collocated.cpp index 0f9abd96355..46d1aec0736 100644 --- a/cpp/test/Ice/ami/Collocated.cpp +++ b/cpp/test/Ice/ami/Collocated.cpp @@ -48,8 +48,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.AMICallback", "0"); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/ami/Server.cpp b/cpp/test/Ice/ami/Server.cpp index 7c0ebd03b42..b021aa221eb 100644 --- a/cpp/test/Ice/ami/Server.cpp +++ b/cpp/test/Ice/ami/Server.cpp @@ -48,8 +48,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // This test kills connections, so we don't want warnings. diff --git a/cpp/test/Ice/ami/run.py b/cpp/test/Ice/ami/run.py deleted file mode 100755 index 2d96b653cfa..00000000000 --- a/cpp/test/Ice/ami/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/background/Client.cpp b/cpp/test/Ice/background/Client.cpp index f0c60ee8128..c4b2e4fe416 100644 --- a/cpp/test/Ice/background/Client.cpp +++ b/cpp/test/Ice/background/Client.cpp @@ -32,8 +32,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // For this test, we want to disable retries. @@ -46,7 +45,7 @@ main(int argc, char* argv[]) initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "50000"); - + // This test relies on filling the TCP send/recv buffer, so // we rely on a fixed value for these buffers. initData.properties->setProperty("Ice.TCP.SndSize", "50000"); diff --git a/cpp/test/Ice/background/Server.cpp b/cpp/test/Ice/background/Server.cpp index 3f13ca8fbb3..84545c8a271 100644 --- a/cpp/test/Ice/background/Server.cpp +++ b/cpp/test/Ice/background/Server.cpp @@ -149,8 +149,7 @@ main(int argc, char* argv[]) { try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // This test kills connections, so we don't want warnings. diff --git a/cpp/test/Ice/background/run.py b/cpp/test/Ice/background/run.py deleted file mode 100755 index b53b591197e..00000000000 --- a/cpp/test/Ice/background/run.py +++ /dev/null @@ -1,25 +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.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testtransport"))]) -TestUtil.queueClientServerTest() -TestUtil.runQueuedTests() 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() diff --git a/cpp/test/Ice/checksum/Client.cpp b/cpp/test/Ice/checksum/Client.cpp index 03a6010177e..e2b795b39bf 100644 --- a/cpp/test/Ice/checksum/Client.cpp +++ b/cpp/test/Ice/checksum/Client.cpp @@ -31,8 +31,9 @@ main(int argc, char* argv[]) Ice::registerIceSSL(); #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/checksum/Server.cpp b/cpp/test/Ice/checksum/Server.cpp index 42d986b2dbf..8e11a544e0e 100644 --- a/cpp/test/Ice/checksum/Server.cpp +++ b/cpp/test/Ice/checksum/Server.cpp @@ -35,7 +35,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/checksum/run.py b/cpp/test/Ice/checksum/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/checksum/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() diff --git a/cpp/test/Ice/custom/Client.cpp b/cpp/test/Ice/custom/Client.cpp index 0ab1c20d832..b7880e9021f 100644 --- a/cpp/test/Ice/custom/Client.cpp +++ b/cpp/test/Ice/custom/Client.cpp @@ -40,7 +40,8 @@ main(int argc, char** argv) setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); - 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/Ice/custom/Collocated.cpp b/cpp/test/Ice/custom/Collocated.cpp index 6eda30c718a..0d5e50e9aff 100644 --- a/cpp/test/Ice/custom/Collocated.cpp +++ b/cpp/test/Ice/custom/Collocated.cpp @@ -46,7 +46,8 @@ main(int argc, char** argv) setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); - 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/Ice/custom/Server.cpp b/cpp/test/Ice/custom/Server.cpp index c6361f7c0c5..c3b8a90e21a 100644 --- a/cpp/test/Ice/custom/Server.cpp +++ b/cpp/test/Ice/custom/Server.cpp @@ -47,7 +47,8 @@ main(int argc, char** argv) setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); - 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/Ice/custom/ServerAMD.cpp b/cpp/test/Ice/custom/ServerAMD.cpp index c64aca0aac4..275c7147158 100644 --- a/cpp/test/Ice/custom/ServerAMD.cpp +++ b/cpp/test/Ice/custom/ServerAMD.cpp @@ -47,7 +47,8 @@ main(int argc, char** argv) setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI)); setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI)); - 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/Ice/custom/run.py b/cpp/test/Ice/custom/run.py deleted file mode 100755 index 7921ce9e9ff..00000000000 --- a/cpp/test/Ice/custom/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server = TestUtil.getTestExecutable("serveramd")) -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/custom/test.py b/cpp/test/Ice/custom/test.py new file mode 100644 index 00000000000..0e56af0590d --- /dev/null +++ b/cpp/test/Ice/custom/test.py @@ -0,0 +1,12 @@ +# -*- 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. +# +# ********************************************************************** + +# Don't run this test with SSL, it doesn't work on Windows, see ICE-4588 +TestSuite(__name__, options = { "protocol" : ["tcp", "ws"] }) diff --git a/cpp/test/Ice/defaultServant/Client.cpp b/cpp/test/Ice/defaultServant/Client.cpp index d6600fdce36..c8c6f178e64 100644 --- a/cpp/test/Ice/defaultServant/Client.cpp +++ b/cpp/test/Ice/defaultServant/Client.cpp @@ -32,7 +32,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/defaultServant/run.py b/cpp/test/Ice/defaultServant/run.py deleted file mode 100755 index 874ef6a5125..00000000000 --- a/cpp/test/Ice/defaultServant/run.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -# -# This copy of Ice-E is licensed to you under the terms described in the -# ICEE_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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client) diff --git a/cpp/test/Ice/defaultValue/run.py b/cpp/test/Ice/defaultValue/run.py deleted file mode 100755 index 1a758d84c41..00000000000 --- a/cpp/test/Ice/defaultValue/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/Ice/dispatcher/Client.cpp b/cpp/test/Ice/dispatcher/Client.cpp index 6440ce065f3..6bb5c265977 100644 --- a/cpp/test/Ice/dispatcher/Client.cpp +++ b/cpp/test/Ice/dispatcher/Client.cpp @@ -33,8 +33,7 @@ main(int argc, char* argv[]) int status; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // Limit the send buffer size, this test relies on the socket diff --git a/cpp/test/Ice/dispatcher/Collocated.cpp b/cpp/test/Ice/dispatcher/Collocated.cpp index 05592f5a8ed..6d91c93a3c4 100644 --- a/cpp/test/Ice/dispatcher/Collocated.cpp +++ b/cpp/test/Ice/dispatcher/Collocated.cpp @@ -48,8 +48,7 @@ main(int argc, char* argv[]) int status; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); #ifdef ICE_CPP11_MAPPING IceUtil::Handle<Dispatcher> dispatcher = new Dispatcher; initData.dispatcher = [=](function<void()> call, const shared_ptr<Ice::Connection>& conn) diff --git a/cpp/test/Ice/dispatcher/Server.cpp b/cpp/test/Ice/dispatcher/Server.cpp index 08dc9b75e17..fa8cf0a1323 100644 --- a/cpp/test/Ice/dispatcher/Server.cpp +++ b/cpp/test/Ice/dispatcher/Server.cpp @@ -49,8 +49,7 @@ main(int argc, char* argv[]) int status; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // Limit the recv buffer size, this test relies on the socket diff --git a/cpp/test/Ice/dispatcher/run.py b/cpp/test/Ice/dispatcher/run.py deleted file mode 100755 index 2d96b653cfa..00000000000 --- a/cpp/test/Ice/dispatcher/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/echo/Server.cpp b/cpp/test/Ice/echo/Server.cpp index 9d80f8833a9..397509df120 100644 --- a/cpp/test/Ice/echo/Server.cpp +++ b/cpp/test/Ice/echo/Server.cpp @@ -69,8 +69,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); } diff --git a/cpp/test/Ice/echo/run.py b/cpp/test/Ice/echo/run.py deleted file mode 100755 index 2f0c3b6439d..00000000000 --- a/cpp/test/Ice/echo/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting server... ") -sys.stdout.flush() -server = server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) -p = TestUtil.startServer(server) -print("ok") -sys.stdout.flush() -p.waitTestSuccess() diff --git a/cpp/test/Ice/echo/test.py b/cpp/test/Ice/echo/test.py new file mode 100644 index 00000000000..27ced12e84c --- /dev/null +++ b/cpp/test/Ice/echo/test.py @@ -0,0 +1,15 @@ +# ********************************************************************** +# +# 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 EchoServerTestCase(ClientServerTestCase): + + def runClientSide(self, current): + pass + +TestSuite(__name__, [EchoServerTestCase(name="server", server=Server(waitForShutdown=False))]) diff --git a/cpp/test/Ice/enums/Client.cpp b/cpp/test/Ice/enums/Client.cpp index 14156675eb7..981c32ec106 100644 --- a/cpp/test/Ice/enums/Client.cpp +++ b/cpp/test/Ice/enums/Client.cpp @@ -37,7 +37,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/enums", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/enums/Server.cpp b/cpp/test/Ice/enums/Server.cpp index 45dec2632e4..f73bd41e86a 100644 --- a/cpp/test/Ice/enums/Server.cpp +++ b/cpp/test/Ice/enums/Server.cpp @@ -38,7 +38,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/enums/run.py b/cpp/test/Ice/enums/run.py deleted file mode 100755 index 22809a25c68..00000000000 --- a/cpp/test/Ice/enums/run.py +++ /dev/null @@ -1,28 +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(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "1.1", message = "Running test with 1.1 encoding.") -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/exceptions/Client.cpp b/cpp/test/Ice/exceptions/Client.cpp index 650503900ba..ea868afb18a 100644 --- a/cpp/test/Ice/exceptions/Client.cpp +++ b/cpp/test/Ice/exceptions/Client.cpp @@ -37,8 +37,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max diff --git a/cpp/test/Ice/exceptions/Collocated.cpp b/cpp/test/Ice/exceptions/Collocated.cpp index 063bbd25e1a..6a2e5ad8f2b 100644 --- a/cpp/test/Ice/exceptions/Collocated.cpp +++ b/cpp/test/Ice/exceptions/Collocated.cpp @@ -39,8 +39,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp index 2a95948c06a..51ad11f564f 100644 --- a/cpp/test/Ice/exceptions/Server.cpp +++ b/cpp/test/Ice/exceptions/Server.cpp @@ -47,8 +47,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max diff --git a/cpp/test/Ice/exceptions/ServerAMD.cpp b/cpp/test/Ice/exceptions/ServerAMD.cpp index 528b0e7ee03..c6d87272714 100644 --- a/cpp/test/Ice/exceptions/ServerAMD.cpp +++ b/cpp/test/Ice/exceptions/ServerAMD.cpp @@ -47,8 +47,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max diff --git a/cpp/test/Ice/exceptions/run.py b/cpp/test/Ice/exceptions/run.py deleted file mode 100755 index 00f2bf56951..00000000000 --- a/cpp/test/Ice/exceptions/run.py +++ /dev/null @@ -1,50 +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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "compactAMD", localOnly = True, - message = "Running test with compact (default) format and AMD server.", - server=TestUtil.getTestExecutable("serveramd")) - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server=TestUtil.getTestExecutable("serveramd"), - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server=TestUtil.getTestExecutable("serveramd"), - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/facets/Client.cpp b/cpp/test/Ice/facets/Client.cpp index 9e970a20bc8..94f9d76a1e0 100644 --- a/cpp/test/Ice/facets/Client.cpp +++ b/cpp/test/Ice/facets/Client.cpp @@ -37,7 +37,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/facets", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/facets/Collocated.cpp b/cpp/test/Ice/facets/Collocated.cpp index 21460a5806c..f5c372212f1 100644 --- a/cpp/test/Ice/facets/Collocated.cpp +++ b/cpp/test/Ice/facets/Collocated.cpp @@ -44,7 +44,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/facets/Server.cpp b/cpp/test/Ice/facets/Server.cpp index 92d0b838bd5..12230ed64e4 100644 --- a/cpp/test/Ice/facets/Server.cpp +++ b/cpp/test/Ice/facets/Server.cpp @@ -43,7 +43,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/facets/run.py b/cpp/test/Ice/facets/run.py deleted file mode 100755 index 2d96b653cfa..00000000000 --- a/cpp/test/Ice/facets/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/faultTolerance/AllTests.cpp b/cpp/test/Ice/faultTolerance/AllTests.cpp index 5a861677c08..2bb1fbd862b 100644 --- a/cpp/test/Ice/faultTolerance/AllTests.cpp +++ b/cpp/test/Ice/faultTolerance/AllTests.cpp @@ -116,7 +116,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports) ref << "test"; for(vector<int>::const_iterator p = ports.begin(); p != ports.end(); ++p) { - ref << ":default -p " << *p; + ref << ":" << getTestEndpoint(communicator, *p); } Ice::ObjectPrxPtr base = communicator->stringToProxy(ref.str()); test(base); @@ -282,7 +282,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports) #else cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent AMI call... " << flush; CallbackPtr cb = new Callback; - obj->begin_idempotentAbort(newCallback_TestIntf_idempotentAbort(cb, &Callback::response, + obj->begin_idempotentAbort(newCallback_TestIntf_idempotentAbort(cb, &Callback::response, &Callback::exceptAbortI)); cb->check(); cout << "ok" << endl; diff --git a/cpp/test/Ice/faultTolerance/Client.cpp b/cpp/test/Ice/faultTolerance/Client.cpp index 5636653ac06..ef39a9be5b6 100644 --- a/cpp/test/Ice/faultTolerance/Client.cpp +++ b/cpp/test/Ice/faultTolerance/Client.cpp @@ -65,8 +65,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); // test aborts Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/faultTolerance/Server.cpp b/cpp/test/Ice/faultTolerance/Server.cpp index c731d007786..9a6b0e63e75 100644 --- a/cpp/test/Ice/faultTolerance/Server.cpp +++ b/cpp/test/Ice/faultTolerance/Server.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <TestI.h> +#include <TestCommon.h> using namespace std; @@ -49,7 +50,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } ostringstream endpts; - endpts << "default -p " << port << ":udp"; + endpts << getTestEndpoint(communicator, port) << ":udp"; communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpts.str()); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPtr object = ICE_MAKE_SHARED(TestI); @@ -73,8 +74,7 @@ main(int argc, char* argv[]) // our test servers may time out before they are used in the // test. // - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.ServerIdleTime", "120"); // Two minutes. Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py deleted file mode 100755 index a581594fbbb..00000000000 --- a/cpp/test/Ice/faultTolerance/run.py +++ /dev/null @@ -1,48 +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 - -server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -num = 12 -base = 12340 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, "%d" % (base + i))) - print("ok") - -ports = "" -for i in range(0, num): - ports = "%s %d" % (ports, base + i) - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, ports, startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py deleted file mode 100755 index 6423deb32a1..00000000000 --- a/cpp/test/Ice/gc/run.py +++ /dev/null @@ -1,23 +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.simpleTest(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))) diff --git a/cpp/test/Ice/gc/test.py b/cpp/test/Ice/gc/test.py new file mode 100644 index 00000000000..f371bb23ced --- /dev/null +++ b/cpp/test/Ice/gc/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(__name__, options = { "cpp11" : [False] }) diff --git a/cpp/test/Ice/hash/run.py b/cpp/test/Ice/hash/run.py deleted file mode 100755 index 4ca27f9e829..00000000000 --- a/cpp/test/Ice/hash/run.py +++ /dev/null @@ -1,25 +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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client) diff --git a/cpp/test/Ice/hold/Client.cpp b/cpp/test/Ice/hold/Client.cpp index f69c263d682..3a74970a720 100644 --- a/cpp/test/Ice/hold/Client.cpp +++ b/cpp/test/Ice/hold/Client.cpp @@ -36,7 +36,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/hold", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/hold/Server.cpp b/cpp/test/Ice/hold/Server.cpp index 261d83d4660..3ed04c280ac 100644 --- a/cpp/test/Ice/hold/Server.cpp +++ b/cpp/test/Ice/hold/Server.cpp @@ -56,7 +56,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/hold/run.py b/cpp/test/Ice/hold/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/hold/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() diff --git a/cpp/test/Ice/impl/Server.cpp b/cpp/test/Ice/impl/Server.cpp index 91cb3580b0d..dab7a8f6c7b 100644 --- a/cpp/test/Ice/impl/Server.cpp +++ b/cpp/test/Ice/impl/Server.cpp @@ -38,8 +38,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // Its possible to have batch oneway requests dispatched after // the adapter is deactivated due to thread scheduling so we diff --git a/cpp/test/Ice/impl/ServerAMD.cpp b/cpp/test/Ice/impl/ServerAMD.cpp index 88a22188406..35c7123fce8 100644 --- a/cpp/test/Ice/impl/ServerAMD.cpp +++ b/cpp/test/Ice/impl/ServerAMD.cpp @@ -38,8 +38,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // Its possible to have batch oneway requests dispatched after // the adapter is deactivated due to thread scheduling so we diff --git a/cpp/test/Ice/info/AllTests.cpp b/cpp/test/Ice/info/AllTests.cpp index 18fb252424c..542d3194e59 100644 --- a/cpp/test/Ice/info/AllTests.cpp +++ b/cpp/test/Ice/info/AllTests.cpp @@ -116,7 +116,8 @@ allTests(const Ice::CommunicatorPtr& communicator) { cout << "test object adapter endpoint information... " << flush; { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", + "default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::EndpointSeq endpoints = adapter->getEndpoints(); @@ -140,8 +141,11 @@ allTests(const Ice::CommunicatorPtr& communicator) adapter->destroy(); - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h * -p 12020"); - communicator->getProperties()->setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020"); + int port = getTestPort(communicator->getProperties(), 1); + ostringstream portStr; + portStr << port; + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h * -p " + portStr.str()); + communicator->getProperties()->setProperty("TestAdapter.PublishedEndpoints", getTestEndpoint(communicator, 1)); adapter = communicator->createObjectAdapter("TestAdapter"); endpoints = adapter->getEndpoints(); @@ -152,26 +156,28 @@ allTests(const Ice::CommunicatorPtr& communicator) for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { ipEndpoint = getTCPEndpointInfo((*p)->getInfo()); - test(ipEndpoint->port == 12020); + test(ipEndpoint->port == port); } ipEndpoint = getTCPEndpointInfo(publishedEndpoints[0]->getInfo()); test(ipEndpoint->host == "127.0.0.1"); - test(ipEndpoint->port == 12020); + test(ipEndpoint->port == port); adapter->destroy(); } cout << "ok" << endl; } - - Ice::ObjectPrxPtr base = communicator->stringToProxy("test:default -p 12010:udp -p 12010 -c"); + + string endpoints = getTestEndpoint(communicator, 0) + ":" + getTestEndpoint(communicator, 0, "udp") + " -c"; + int port = getTestPort(communicator->getProperties(), 0); + Ice::ObjectPrxPtr base = communicator->stringToProxy("test:" + endpoints); TestIntfPrxPtr testIntf = ICE_CHECKED_CAST(TestIntfPrx, base); cout << "test connection endpoint information... " << flush; { Ice::EndpointInfoPtr info = base->ice_getConnection()->getEndpoint()->getInfo(); Ice::TCPEndpointInfoPtr tcpinfo = getTCPEndpointInfo(info); - test(tcpinfo->port == 12010); + test(tcpinfo->port == port); test(!tcpinfo->compress); test(tcpinfo->host == defaultHost); @@ -188,7 +194,7 @@ allTests(const Ice::CommunicatorPtr& communicator) info = base->ice_datagram()->ice_getConnection()->getEndpoint()->getInfo(); Ice::UDPEndpointInfoPtr udp = ICE_DYNAMIC_CAST(Ice::UDPEndpointInfo, info); test(udp); - test(udp->port == 12010); + test(udp->port == port); test(udp->host == defaultHost); } cout << "ok" << endl; @@ -203,7 +209,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(!info->incoming); test(info->adapterName.empty()); test(info->localPort > 0); - test(info->remotePort == 12010); + test(info->remotePort == port); if(defaultHost == "127.0.0.1") { test(info->remoteAddress == defaultHost); @@ -264,7 +270,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(!udpinfo->incoming); test(udpinfo->adapterName.empty()); test(udpinfo->localPort > 0); - test(udpinfo->remotePort == 12010); + test(udpinfo->remotePort == port); if(defaultHost == "127.0.0.1") { test(udpinfo->remoteAddress == defaultHost); diff --git a/cpp/test/Ice/info/Client.cpp b/cpp/test/Ice/info/Client.cpp index 6aa30209e92..2029090b95f 100644 --- a/cpp/test/Ice/info/Client.cpp +++ b/cpp/test/Ice/info/Client.cpp @@ -32,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/info/Server.cpp b/cpp/test/Ice/info/Server.cpp index 47c8bbb3332..78765c87b94 100644 --- a/cpp/test/Ice/info/Server.cpp +++ b/cpp/test/Ice/info/Server.cpp @@ -18,7 +18,8 @@ using namespace std; int run(int, char**, const Ice::CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010"); + string endpoints = getTestEndpoint(communicator, 0) + ":" + getTestEndpoint(communicator, 0, "udp"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpoints); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(TestI), Ice::stringToIdentity("test")); adapter->activate(); @@ -36,7 +37,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/info/run.py b/cpp/test/Ice/info/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/info/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() diff --git a/cpp/test/Ice/inheritance/Client.cpp b/cpp/test/Ice/inheritance/Client.cpp index c64080f96ab..6e44696210a 100644 --- a/cpp/test/Ice/inheritance/Client.cpp +++ b/cpp/test/Ice/inheritance/Client.cpp @@ -37,7 +37,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/inheritance", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/inheritance/Collocated.cpp b/cpp/test/Ice/inheritance/Collocated.cpp index 0f640de9b8b..13bd1b564d6 100644 --- a/cpp/test/Ice/inheritance/Collocated.cpp +++ b/cpp/test/Ice/inheritance/Collocated.cpp @@ -39,7 +39,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/inheritance/Server.cpp b/cpp/test/Ice/inheritance/Server.cpp index 8ec0c761076..69c5a2ba868 100644 --- a/cpp/test/Ice/inheritance/Server.cpp +++ b/cpp/test/Ice/inheritance/Server.cpp @@ -37,7 +37,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/inheritance/run.py b/cpp/test/Ice/inheritance/run.py deleted file mode 100755 index 2d96b653cfa..00000000000 --- a/cpp/test/Ice/inheritance/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/interceptor/Client.cpp b/cpp/test/Ice/interceptor/Client.cpp index d77b076c157..4776dd942b8 100644 --- a/cpp/test/Ice/interceptor/Client.cpp +++ b/cpp/test/Ice/interceptor/Client.cpp @@ -57,8 +57,7 @@ public: virtual int _main(int argc, char** argv) { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); _communicator = Ice::initialize(initData); return run(argc, argv); diff --git a/cpp/test/Ice/interceptor/run.py b/cpp/test/Ice/interceptor/run.py deleted file mode 100755 index dc73f0e0506..00000000000 --- a/cpp/test/Ice/interceptor/run.py +++ /dev/null @@ -1,26 +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.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("interceptortest"))]) -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client, " --Ice.Warn.Dispatch=0") diff --git a/cpp/test/Ice/invoke/Client.cpp b/cpp/test/Ice/invoke/Client.cpp index f2d45cb2990..120d3555a98 100644 --- a/cpp/test/Ice/invoke/Client.cpp +++ b/cpp/test/Ice/invoke/Client.cpp @@ -40,8 +40,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator, initData); } diff --git a/cpp/test/Ice/invoke/Server.cpp b/cpp/test/Ice/invoke/Server.cpp index c25e72fddf4..7bbd28e143b 100644 --- a/cpp/test/Ice/invoke/Server.cpp +++ b/cpp/test/Ice/invoke/Server.cpp @@ -123,8 +123,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); } diff --git a/cpp/test/Ice/invoke/run.py b/cpp/test/Ice/invoke/run.py deleted file mode 100755 index a9b2d78339f..00000000000 --- a/cpp/test/Ice/invoke/run.py +++ /dev/null @@ -1,31 +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(configName = "blobject", message = "Running test with Blobject server.") -TestUtil.queueClientServerTest(configName = "blobjectArray", message = "Running test with BlobjectArray server.", - additionalServerOptions = "--array") -TestUtil.queueClientServerTest(configName = "blobjectAsync", message = "Running test with BlobjectAsync server.", - additionalServerOptions = "--async") -TestUtil.queueClientServerTest(configName = "blobjectAsyncArray", - message = "Running test with BlobjectAsyncArray server.", - additionalServerOptions = "--array --async") -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/library/Client.cpp b/cpp/test/Ice/library/Client.cpp index bc8371e95a2..109efc1c4e6 100644 --- a/cpp/test/Ice/library/Client.cpp +++ b/cpp/test/Ice/library/Client.cpp @@ -26,7 +26,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); // Collocated-only OA Ice::ObjectAdapterPtr oa = ich->createObjectAdapter(""); diff --git a/cpp/test/Ice/library/run.py b/cpp/test/Ice/library/run.py deleted file mode 100644 index da3317138ad..00000000000 --- a/cpp/test/Ice/library/run.py +++ /dev/null @@ -1,29 +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.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("gencode"))]) -TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("consumer"))]) -TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("alltests"))]) - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client) diff --git a/cpp/test/Ice/library/test.py b/cpp/test/Ice/library/test.py new file mode 100644 index 00000000000..6184d25b675 --- /dev/null +++ b/cpp/test/Ice/library/test.py @@ -0,0 +1,10 @@ +# ********************************************************************** +# +# 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__, libDirs=["gencode", "consumer", "alltests"]) diff --git a/cpp/test/Ice/location/Client.cpp b/cpp/test/Ice/location/Client.cpp index 44fe67ee19a..cd586168359 100644 --- a/cpp/test/Ice/location/Client.cpp +++ b/cpp/test/Ice/location/Client.cpp @@ -31,9 +31,8 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); - initData.properties->setProperty("Ice.Default.Locator", "locator:default -p 12010"); + Ice::InitializationData initData = getTestInitData(argc, argv); + initData.properties->setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(initData.properties, 0)); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator()); } diff --git a/cpp/test/Ice/location/Server.cpp b/cpp/test/Ice/location/Server.cpp index fb2f29a2226..79c0a9abf0c 100644 --- a/cpp/test/Ice/location/Server.cpp +++ b/cpp/test/Ice/location/Server.cpp @@ -17,8 +17,7 @@ DEFINE_TEST("server") using namespace std; int -run(int, char**, const Ice::CommunicatorPtr& communicator, - const Ice::InitializationData& initData) +run(int, char**, const Ice::CommunicatorPtr& communicator, const Ice::InitializationData& initData) { // // Register the server manager. The server manager creates a new @@ -63,8 +62,7 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); assert(initData.properties != ich->getProperties()); return run(argc, argv, ich.communicator(), initData); diff --git a/cpp/test/Ice/location/TestI.cpp b/cpp/test/Ice/location/TestI.cpp index 80e391b2a8d..fb55391c3b0 100644 --- a/cpp/test/Ice/location/TestI.cpp +++ b/cpp/test/Ice/location/TestI.cpp @@ -10,6 +10,7 @@ #include <Ice/Ice.h> #include <Ice/Locator.h> #include <TestI.h> +#include <TestCommon.h> using namespace Test; @@ -17,10 +18,10 @@ ServerManagerI::ServerManagerI(const ServerLocatorRegistryPtr& registry, const Ice::InitializationData& initData) : _registry(registry), _initData(initData), - _nextPort(12011) + _nextPort(1) { _initData.properties->setProperty("TestAdapter.AdapterId", "TestAdapter"); - _initData.properties->setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); + _initData.properties->setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); _initData.properties->setProperty("TestAdapter2.AdapterId", "TestAdapter2"); _initData.properties->setProperty("Ice.PrintAdapterReady", "0"); } @@ -50,21 +51,14 @@ ServerManagerI::startServer(const Ice::Current&) // Use fixed port to ensure that OA re-activation doesn't re-use previous port from // another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter). // - { - std::ostringstream os; - os << "default -p " << _nextPort++; - serverCommunicator->getProperties()->setProperty("TestAdapter.Endpoints", os.str()); - } - { - std::ostringstream os; - os << "default -p " << _nextPort++; - serverCommunicator->getProperties()->setProperty("TestAdapter2.Endpoints", os.str()); - } + Ice::PropertiesPtr props = _initData.properties; + serverCommunicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(props, _nextPort++)); + serverCommunicator->getProperties()->setProperty("TestAdapter2.Endpoints", getTestEndpoint(props, _nextPort++)); Ice::ObjectAdapterPtr adapter = serverCommunicator->createObjectAdapter("TestAdapter"); Ice::ObjectAdapterPtr adapter2 = serverCommunicator->createObjectAdapter("TestAdapter2"); - Ice::ObjectPrxPtr locator = serverCommunicator->stringToProxy("locator:default -p 12010"); + Ice::ObjectPrxPtr locator = serverCommunicator->stringToProxy("locator:" + getTestEndpoint(props, 0)); adapter->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator)); adapter2->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator)); @@ -88,8 +82,8 @@ ServerManagerI::shutdown(const Ice::Current& current) } -TestI::TestI(const Ice::ObjectAdapterPtr& adapter, - const Ice::ObjectAdapterPtr& adapter2, +TestI::TestI(const Ice::ObjectAdapterPtr& adapter, + const Ice::ObjectAdapterPtr& adapter2, const ServerLocatorRegistryPtr& registry) : _adapter1(adapter), _adapter2(adapter2), _registry(registry) { diff --git a/cpp/test/Ice/location/run.py b/cpp/test/Ice/location/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/location/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() diff --git a/cpp/test/Ice/logger/run.py b/cpp/test/Ice/logger/run.py deleted file mode 100755 index 4744ede4eb4..00000000000 --- a/cpp/test/Ice/logger/run.py +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -import os, sys, subprocess, glob, atexit, shutil - -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 - -def test(cmd, match, enc): - p = subprocess.Popen([cmd], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) - out, err = p.communicate() - ret = p.poll() - if ret != 0: - print("%s failed! status %s " % (cmd, ret)) - if out.decode(enc).find(match.decode(enc)) == -1: - raise RuntimeError("test failed") - -TestUtil.simpleTest(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client1"))) -env = TestUtil.getTestEnv("cpp", os.getcwd()) - -sys.stdout.write("testing logger ISO-8859-15 output... ") -test(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client2")), b'aplicaci\xf3n', "ISO-8859-15") -print("ok") - -sys.stdout.write("testing logger UTF8 output without string converter... ") -test(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client3")), b'aplicaci\xc3\xb3n', "UTF8") -print("ok") - -sys.stdout.write("testing logger UTF8 output with ISO-8859-15 narrow string converter... ") -# -# In Windows expected output is UTF8, because the console output code page is set to UTF-8 -# in Linux and OS X, the expected output is ISO-8859-15 because that is the narrow string -# encoding used by the application. -# -if TestUtil.isWin32(): - test(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client4")), b'aplicaci\xc3\xb3n', "UTF8") -else: - test(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client4")), b'aplicaci\xf3n', "ISO-8859-15") -print("ok") - -sys.stdout.write("testing logger file rotation... ") - -def cleanup(): - for f in glob.glob("client5-*.log"): - os.remove(f) - if os.path.exists("log/client5-4.log"): - os.remove("log/client5-4.log") - -cleanup() - -atexit.register(cleanup) - -if not os.path.exists("log"): - os.makedirs("log") - -open("log/client5-4.log", 'a').close() - -if TestUtil.isWin32(): - os.system("echo Y|cacls log /P \"%USERNAME%\":R 1> nul") -else: - os.system("chmod -w log") - -p = subprocess.Popen(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client5")), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) -out, err = p.communicate() -ret = p.poll() -if ret != 0: - print("failed! status %s " % ret) - sys.exit(1) - -if TestUtil.isWin32(): - os.system("echo Y|cacls log /P \"%USERNAME%\":F 1> nul") -else: - os.system("chmod +w log") - -if (not os.path.isfile("client5-0.log") or - not os.stat("client5-0.log").st_size == 512 or - len(glob.glob("client5-0-*.log")) != 19): - print("failed!") - sys.exit(1) - -for f in glob.glob("client5-0-*.log"): - if not os.stat(f).st_size == 512: - print("failed! file {0} size: {1} unexpected".format(f, os.stat(f).st_size)) - sys.exit(1) - -if (not os.path.isfile("client5-1.log") or - not os.stat("client5-1.log").st_size == 1024 or - len(glob.glob("client5-1-*.log")) != 0): - print("failed!") - sys.exit(1) - -if (not os.path.isfile("client5-2.log") or - not os.stat("client5-2.log").st_size == 128 or - len(glob.glob("client5-2-*.log")) != 7): - print("failed!") - sys.exit(1) - -for f in glob.glob("client5-2-*.log"): - if not os.stat(f).st_size == 128: - print("failed! file {0} size: {1} unexpected".format(f, os.stat(f).st_size)) - sys.exit(1) - -if (not os.path.isfile("client5-3.log") or - not os.stat("client5-2.log").st_size == 128 or - len(glob.glob("client5-2-*.log")) != 7): - print("failed!") - sys.exit(1) - -for f in glob.glob("client5-3-*.log"): - if not os.stat(f).st_size == 128: - print("failed! file {0} size: {1} unexpected".format(f, os.stat(f).st_size)) - sys.exit(1) - -# -# When running as root log rotation will not fail as -# root always has write access. -# -if TestUtil.isWin32() or os.getuid() != 0: - if (not os.path.isfile("log/client5-4.log") or - os.stat("log/client5-4.log").st_size < 1024 or - len(glob.glob("log/client5-4-*.log")) > 0): - print("failed!") - sys.exit(1) - - with open("log/client5-4.log", 'r') as f: - if f.read().count("error: FileLogger: cannot rename `log/client5-4.log'") != 1: - print("failed!") - sys.exit(1) - -shutil.rmtree("log") - -print("ok") diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index c5d692fd2d7..3faea063c8d 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -55,10 +55,18 @@ private: }; typedef IceUtil::Handle<Callback> CallbackPtr; +string +getPort(const Ice::PropertiesAdminPrxPtr& p) +{ + ostringstream os; + os << getTestPort(p->ice_getCommunicator()->getProperties(), 0); + return os.str(); +} + Ice::PropertyDict -getClientProps(const Ice::PropertiesAdminPrxPtr& p, const Ice::PropertyDict& orig, const string& m = string()) +getClientProps(const Ice::PropertiesAdminPrxPtr& pa, const Ice::PropertyDict& orig, const string& m = string()) { - Ice::PropertyDict props = p->getPropertiesForPrefix("IceMX.Metrics"); + Ice::PropertyDict props = pa->getPropertiesForPrefix("IceMX.Metrics"); for(Ice::PropertyDict::iterator p = props.begin(); p != props.end(); ++p) { p->second = ""; @@ -73,15 +81,15 @@ getClientProps(const Ice::PropertiesAdminPrxPtr& p, const Ice::PropertyDict& ori map += "Map." + m + '.'; } props["IceMX.Metrics.View." + map + "Reject.parent"] = "Ice\\.Admin"; - props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = "12010"; + props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = getPort(pa); props["IceMX.Metrics.View." + map + "Reject.identity"] = ".*/admin|controller"; return props; } Ice::PropertyDict -getServerProps(const Ice::PropertiesAdminPrxPtr& p, const Ice::PropertyDict& orig, const string& m = string()) +getServerProps(const Ice::PropertiesAdminPrxPtr& pa, const Ice::PropertyDict& orig, const string& m = string()) { - Ice::PropertyDict props = p->getPropertiesForPrefix("IceMX.Metrics"); + Ice::PropertyDict props = pa->getPropertiesForPrefix("IceMX.Metrics"); for(Ice::PropertyDict::iterator p = props.begin(); p != props.end(); ++p) { p->second = ""; @@ -96,7 +104,7 @@ getServerProps(const Ice::PropertiesAdminPrxPtr& p, const Ice::PropertyDict& ori map += "Map." + m + '.'; } props["IceMX.Metrics.View." + map + "Reject.parent"] = "Ice\\.Admin|Controller"; - props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = "12010"; + props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = getPort(pa); return props; } @@ -408,7 +416,24 @@ toMap(const IceMX::MetricsMap& mmap) MetricsPrxPtr allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& obsv) { - MetricsPrxPtr metrics = ICE_CHECKED_CAST(MetricsPrx, communicator->stringToProxy("metrics:default -p 12010")); + Ice::PropertiesPtr properties = communicator->getProperties(); + string host = getTestHost(properties); + string port; + { + ostringstream os; + os << getTestPort(properties, 0); + port = os.str(); + } + string hostAndPort = host + ":" + port; + string protocol = getTestProtocol(properties); + string endpoint; + { + ostringstream os; + os << protocol << " -h " << host << " -p " << port; + endpoint = os.str(); + } + + MetricsPrxPtr metrics = ICE_CHECKED_CAST(MetricsPrx, communicator->stringToProxy("metrics:" + endpoint)); bool collocated = !metrics->ice_getConnection(); cout << "testing metrics admin facet checkedCast... " << flush; @@ -522,12 +547,6 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt map<string, IceMX::MetricsPtr> map; - string endpoint; - { - ostringstream os; - os << communicator->getProperties()->getPropertyWithDefault("Ice.Default.Protocol", "tcp") << " -h 127.0.0.1 -p 12010"; - endpoint = os.str(); - } string type; string isSecure; if(!collocated) @@ -617,7 +636,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]); test(map["active"]->current == 1); - ControllerPrxPtr controller = ICE_CHECKED_CAST(ControllerPrx, communicator->stringToProxy("controller:default -p 12011")); + Ice::ObjectPrxPtr cprx = communicator->stringToProxy("controller:" + getTestEndpoint(communicator, 1)); + ControllerPrxPtr controller = ICE_CHECKED_CAST(ControllerPrx, cprx); controller->hold(); map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]); @@ -684,16 +704,16 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointIsSecure", isSecure); testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointTimeout", "500"); testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointCompress", "false"); - testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointHost", "127.0.0.1"); - testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointPort", "12010"); + testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointHost", host); + testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointPort", port); testAttribute(clientMetrics, clientProps, update.get(), "Connection", "incoming", "false"); testAttribute(clientMetrics, clientProps, update.get(), "Connection", "adapterName", ""); testAttribute(clientMetrics, clientProps, update.get(), "Connection", "connectionId", "Con1"); - testAttribute(clientMetrics, clientProps, update.get(), "Connection", "localHost", "127.0.0.1"); + testAttribute(clientMetrics, clientProps, update.get(), "Connection", "localHost", host); //testAttribute(clientMetrics, clientProps, update.get(), "Connection", "localPort", ""); - testAttribute(clientMetrics, clientProps, update.get(), "Connection", "remoteHost", "127.0.0.1"); - testAttribute(clientMetrics, clientProps, update.get(), "Connection", "remotePort", "12010"); + testAttribute(clientMetrics, clientProps, update.get(), "Connection", "remoteHost", host); + testAttribute(clientMetrics, clientProps, update.get(), "Connection", "remotePort", port); testAttribute(clientMetrics, clientProps, update.get(), "Connection", "mcastHost", ""); testAttribute(clientMetrics, clientProps, update.get(), "Connection", "mcastPort", ""); @@ -714,13 +734,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1); IceMX::MetricsPtr m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0]; - test(m1->current == 0 && m1->total == 1 && m1->id == "127.0.0.1:12010"); + test(m1->current == 0 && m1->total == 1 && m1->id == hostAndPort); metrics->ice_getConnection()->close(false); controller->hold(); try { - communicator->stringToProxy("test:tcp -p 12010 -h 127.0.0.1")->ice_timeout(10)->ice_ping(); + communicator->stringToProxy("test:" + endpoint)->ice_timeout(10)->ice_ping(); test(false); } catch(const Ice::ConnectTimeoutException&) @@ -733,13 +753,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt controller->resume(); test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1); m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0]; - test(m1->id == "127.0.0.1:12010" && m1->total == 3 && m1->failures == 2); + test(m1->id == hostAndPort && m1->total == 3 && m1->failures == 2); checkFailure(clientMetrics, "ConnectionEstablishment", m1->id, "::Ice::ConnectTimeoutException", 2); Connect c(metrics); testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "parent", "Communicator", c); - testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "id", "127.0.0.1:12010", c); + testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "id", hostAndPort, c); testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpoint", endpoint + " -t 60000", c); @@ -748,8 +768,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointIsSecure", isSecure, c); testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointTimeout", "60000", c); testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointCompress", "false", c); - testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointHost", "127.0.0.1", c); - testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointPort", "12010", c); + testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointHost", host, c); + testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointPort", port, c); cout << "ok" << endl; @@ -760,24 +780,28 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt #if !defined(ICE_OS_WINRT) && TARGET_OS_IPHONE==0 cout << "testing endpoint lookup metrics... " << flush; - props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id"; + props["IceMX.Metrics.View.Map.EndpointLookup.GroupBy"] = "id"; updateProps(clientProps, serverProps, update.get(), props, "EndpointLookup"); test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].empty()); - Ice::ObjectPrxPtr prx = communicator->stringToProxy("metrics:default -p 12010 -h localhost -t infinite"); - prx->ice_ping(); + Ice::ObjectPrxPtr prx = communicator->stringToProxy("metrics:" + protocol + " -h localhost -t 500 -p " + port); + try + { + prx->ice_ping(); + prx->ice_getConnection()->close(false); + } + catch(const Ice::LocalException&) + { + } test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 1); m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][0]; - - test(m1->current <= 1 && m1->total == 1 && m1->id == prx->ice_getConnection()->getEndpoint()->toString()); - - prx->ice_getConnection()->close(false); + test(m1->current <= 1 && (m1->total == 1 || m1->total == 2)); bool dnsException = false; try { - communicator->stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com")->ice_ping(); + communicator->stringToProxy("test:tcp -t 500 -h unknownfoo.zeroc.com -p " + port)->ice_ping(); test(false); } catch(const Ice::DNSException&) @@ -790,7 +814,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt } test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 2); m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][1]; - test(m1->id == "tcp -h unknownfoo.zeroc.com -p 12010 -t 500" && m1->total == 2 && + test(m1->id == "tcp -h unknownfoo.zeroc.com -p " + port + " -t 500" && m1->total == 2 && (!dnsException || m1->failures == 2)); if(dnsException) { @@ -808,10 +832,10 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointType", type, c); testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointIsDatagram", "false", c); testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointIsSecure", isSecure, c); - testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointTimeout", "-1", c); + testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointTimeout", "500", c); testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointCompress", "false", c); testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointHost", "localhost", c); - testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointPort", "12010", c); + testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointPort", port, c); cout << "ok" << endl; #endif @@ -915,16 +939,16 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointIsSecure", isSecure, op); testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointTimeout", "60000", op); testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointCompress", "false", op); - testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointHost", "127.0.0.1", op); - testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointPort", "12010", op); + testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointHost", host, op); + testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointPort", port, op); testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "incoming", "true", op); testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "adapterName", "TestAdapter", op); testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "connectionId", "", op); - testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "localHost", "127.0.0.1", op); - testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "localPort", "12010", op); - testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "remoteHost", "127.0.0.1", op); - //testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "remotePort", "12010", op); + testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "localHost", host, op); + testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "localPort", port, op); + testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "remoteHost", host, op); + //testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "remotePort", port, op); testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "mcastHost", "", op); testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "mcastPort", "", op); } diff --git a/cpp/test/Ice/metrics/Client.cpp b/cpp/test/Ice/metrics/Client.cpp index 65611a7de95..0e2c3e95b95 100644 --- a/cpp/test/Ice/metrics/Client.cpp +++ b/cpp/test/Ice/metrics/Client.cpp @@ -34,14 +34,12 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Admin.Endpoints", "default"); initData.properties->setProperty("Ice.Admin.InstanceName", "client"); initData.properties->setProperty("Ice.Admin.DelayCreation", "1"); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "50000"); - initData.properties->setProperty("Ice.Default.Host", "127.0.0.1"); CommunicatorObserverIPtr observer = ICE_MAKE_SHARED(CommunicatorObserverI); initData.observer = observer; Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/metrics/Collocated.cpp b/cpp/test/Ice/metrics/Collocated.cpp index dd314954612..f79a4ca8d6e 100644 --- a/cpp/test/Ice/metrics/Collocated.cpp +++ b/cpp/test/Ice/metrics/Collocated.cpp @@ -20,12 +20,12 @@ using namespace Test; int run(int, char**, const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& observer) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0)); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics")); //adapter->activate(); // Don't activate OA to ensure collocation is used. - communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1)); Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter"); controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller")); //controllerAdapter->activate(); // Don't activate OA to ensure collocation is used. @@ -44,15 +44,13 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Admin.Endpoints", "tcp"); initData.properties->setProperty("Ice.Admin.InstanceName", "client"); initData.properties->setProperty("Ice.Admin.DelayCreation", "1"); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "50000"); - initData.properties->setProperty("Ice.Default.Host", "127.0.0.1"); CommunicatorObserverIPtr observer = ICE_MAKE_SHARED(CommunicatorObserverI); initData.observer = observer; Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/metrics/Server.cpp b/cpp/test/Ice/metrics/Server.cpp index e5daf413204..970739640f8 100644 --- a/cpp/test/Ice/metrics/Server.cpp +++ b/cpp/test/Ice/metrics/Server.cpp @@ -18,12 +18,12 @@ using namespace std; int run(int, char**, const Ice::CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0)); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics")); adapter->activate(); - communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1)); Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter"); controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller")); controllerAdapter->activate(); @@ -42,8 +42,7 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); //initData.properties->setProperty("Ice.ThreadPool.Server.Size", "1"); //initData.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "1"); initData.properties->setProperty("Ice.Admin.Endpoints", "tcp"); @@ -51,7 +50,6 @@ main(int argc, char* argv[]) initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "50000"); - initData.properties->setProperty("Ice.Default.Host", "127.0.0.1"); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator()); } diff --git a/cpp/test/Ice/metrics/ServerAMD.cpp b/cpp/test/Ice/metrics/ServerAMD.cpp index 40aee438374..ec6e9fcbf38 100644 --- a/cpp/test/Ice/metrics/ServerAMD.cpp +++ b/cpp/test/Ice/metrics/ServerAMD.cpp @@ -18,12 +18,12 @@ using namespace std; int run(int, char**, const Ice::CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0)); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics")); adapter->activate(); - communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1)); Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter"); controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller")); controllerAdapter->activate(); @@ -40,11 +40,9 @@ main(int argc, char* argv[]) #ifdef ICE_STATIC_LIBS Ice::registerIceSSL(); #endif - Ice::CommunicatorPtr communicator; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); //initData.properties->setProperty("Ice.ThreadPool.Server.Size", "1"); //initData.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "1"); initData.properties->setProperty("Ice.Admin.Endpoints", "tcp"); @@ -52,9 +50,8 @@ main(int argc, char* argv[]) initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); initData.properties->setProperty("Ice.MessageSizeMax", "50000"); - initData.properties->setProperty("Ice.Default.Host", "127.0.0.1"); - communicator = Ice::initialize(argc, argv, initData); - return run(argc, argv, communicator); + 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/metrics/run.py b/cpp/test/Ice/metrics/run.py deleted file mode 100755 index 7921ce9e9ff..00000000000 --- a/cpp/test/Ice/metrics/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server = TestUtil.getTestExecutable("serveramd")) -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() 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") diff --git a/cpp/test/Ice/objects/Client.cpp b/cpp/test/Ice/objects/Client.cpp index bceb4001e3a..5b93e93fddd 100644 --- a/cpp/test/Ice/objects/Client.cpp +++ b/cpp/test/Ice/objects/Client.cpp @@ -14,7 +14,7 @@ // // Required to trigger initialization of Derived object factory. // -#include <Derived.h> +#include <Derived.h> // // Required to trigger initialization of DerivedEx exception factory. @@ -161,7 +161,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/objects", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/objects/Collocated.cpp b/cpp/test/Ice/objects/Collocated.cpp index 6443ed13252..e0df2f04303 100644 --- a/cpp/test/Ice/objects/Collocated.cpp +++ b/cpp/test/Ice/objects/Collocated.cpp @@ -153,7 +153,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/objects/Server.cpp b/cpp/test/Ice/objects/Server.cpp index c63b2d7c415..8bffdbfdc00 100644 --- a/cpp/test/Ice/objects/Server.cpp +++ b/cpp/test/Ice/objects/Server.cpp @@ -87,7 +87,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/objects/run.py b/cpp/test/Ice/objects/run.py deleted file mode 100755 index bd13835d1c7..00000000000 --- a/cpp/test/Ice/objects/run.py +++ /dev/null @@ -1,34 +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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/operations/Client.cpp b/cpp/test/Ice/operations/Client.cpp index 65d65d35701..a3d6e76cb4b 100644 --- a/cpp/test/Ice/operations/Client.cpp +++ b/cpp/test/Ice/operations/Client.cpp @@ -63,8 +63,7 @@ main(int argc, char* argv[]) // In this test, we need at least two threads in the // client side thread pool for nested AMI. // - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); initData.properties->setProperty("Ice.BatchAutoFlushSize", "100"); diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp index cfce947446d..3cff4ccfb74 100644 --- a/cpp/test/Ice/operations/Collocated.cpp +++ b/cpp/test/Ice/operations/Collocated.cpp @@ -41,8 +41,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.BatchAutoFlushSize", "100"); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp index 80f89467fe7..e7082f75486 100644 --- a/cpp/test/Ice/operations/Server.cpp +++ b/cpp/test/Ice/operations/Server.cpp @@ -37,8 +37,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // Its possible to have batch oneway requests dispatched after // the adapter is deactivated due to thread scheduling so we diff --git a/cpp/test/Ice/operations/ServerAMD.cpp b/cpp/test/Ice/operations/ServerAMD.cpp index f291f11a5a4..3b77a048c19 100644 --- a/cpp/test/Ice/operations/ServerAMD.cpp +++ b/cpp/test/Ice/operations/ServerAMD.cpp @@ -37,8 +37,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // Its possible to have batch oneway requests dispatched after // the adapter is deactivated due to thread scheduling so we diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index 1e96c80cae4..4731ece4dce 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -177,7 +177,7 @@ public: // // We can't do the callbacks below in connection serialization mode. // - if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize")) + if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0) { r->opVoid(); c1->opVoid(); @@ -204,7 +204,7 @@ public: // // We can't do the callbacks below in connection serialization mode. // - if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize")) + if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0) { so.p->opVoid(); } diff --git a/cpp/test/Ice/operations/run.py b/cpp/test/Ice/operations/run.py deleted file mode 100755 index e4c188e8960..00000000000 --- a/cpp/test/Ice/operations/run.py +++ /dev/null @@ -1,28 +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(additionalClientOptions = "--Ice.Warn.AMICallback=0") -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", - server = TestUtil.getTestExecutable("serveramd")) -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/optional/Client.cpp b/cpp/test/Ice/optional/Client.cpp index 4983ad69a88..7dc9b1c3ae7 100644 --- a/cpp/test/Ice/optional/Client.cpp +++ b/cpp/test/Ice/optional/Client.cpp @@ -37,7 +37,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/optional", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/optional/Server.cpp b/cpp/test/Ice/optional/Server.cpp index aacddd084ed..3d75a924ca6 100644 --- a/cpp/test/Ice/optional/Server.cpp +++ b/cpp/test/Ice/optional/Server.cpp @@ -40,7 +40,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/Ice/optional/ServerAMD.cpp b/cpp/test/Ice/optional/ServerAMD.cpp index c47b19721b5..ddbc1a2eb28 100644 --- a/cpp/test/Ice/optional/ServerAMD.cpp +++ b/cpp/test/Ice/optional/ServerAMD.cpp @@ -39,7 +39,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); } diff --git a/cpp/test/Ice/optional/run.py b/cpp/test/Ice/optional/run.py deleted file mode 100755 index a3ccc80fc2e..00000000000 --- a/cpp/test/Ice/optional/run.py +++ /dev/null @@ -1,29 +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(configName = "compact", message = "Running test with compact (default) format.") -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server = TestUtil.getTestExecutable("serveramd")) -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/plugin/Client.cpp b/cpp/test/Ice/plugin/Client.cpp index 85a060f89f7..2a677456bbe 100644 --- a/cpp/test/Ice/plugin/Client.cpp +++ b/cpp/test/Ice/plugin/Client.cpp @@ -87,6 +87,7 @@ main(int argc, char* argv[]) if(argc < 2) { cerr << "usage: " << argv[0] << " <plugindir>"; + return 1; } // @@ -105,7 +106,8 @@ main(int argc, char* argv[]) cout << "testing static plugin factory... " << flush; try { - communicator = Ice::initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = Ice::initialize(argc, argv, initData); MyPluginPtr plugin = ICE_DYNAMIC_CAST(MyPlugin, communicator->getPluginManager()->getPlugin("Static1")); test(plugin && plugin->isInitialized()); try @@ -124,8 +126,7 @@ main(int argc, char* argv[]) } try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.Static2", "1"); communicator = Ice::initialize(argc, argv, initData); MyPluginPtr plugin = ICE_DYNAMIC_CAST(MyPlugin, communicator->getPluginManager()->getPlugin("Static1")); @@ -144,8 +145,7 @@ main(int argc, char* argv[]) cout << "testing a simple plug-in... " << flush; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.Test", pluginDir + "TestPlugin:createPlugin"); communicator = Ice::initialize(argc, argv, initData); communicator->destroy(); @@ -172,8 +172,7 @@ main(int argc, char* argv[]) os << 'a' << (patchVersion - 50); } os << ":createPlugin"; - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.Test", os.str()); communicator = Ice::initialize(argc, argv, initData); communicator->destroy(); @@ -185,8 +184,7 @@ main(int argc, char* argv[]) } try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.Test", pluginDir + "TestPlugin,10:createPlugin"); communicator = Ice::initialize(argc, argv, initData); test(false); @@ -196,8 +194,7 @@ main(int argc, char* argv[]) } try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.Test", "TestPlugin,1.0.0:createPlugin"); communicator = Ice::initialize(argc, argv, initData); test(false); @@ -207,8 +204,7 @@ main(int argc, char* argv[]) } try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.Test", pluginDir + "TestPlugin:createPluginWithArgs 'C:\\Program Files\\' --DatabasePath " "'C:\\Program Files\\Application\\db'" ); @@ -226,8 +222,7 @@ main(int argc, char* argv[]) communicator = 0; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.Test", pluginDir + "TestPlugin:createPluginInitializeFail"); communicator = Ice::initialize(argc, argv, initData); test(false); @@ -242,8 +237,7 @@ main(int argc, char* argv[]) cout << "testing plug-in load order... " << flush; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.PluginOne", pluginDir + "TestPlugin:createPluginOne"); initData.properties->setProperty("Ice.Plugin.PluginTwo", pluginDir + "TestPlugin:createPluginTwo"); initData.properties->setProperty("Ice.Plugin.PluginThree", pluginDir + "TestPlugin:createPluginThree"); @@ -261,8 +255,7 @@ main(int argc, char* argv[]) cout << "testing plug-in manager... " << flush; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.PluginOne", pluginDir + "TestPlugin:createPluginOne"); initData.properties->setProperty("Ice.Plugin.PluginTwo", pluginDir + "TestPlugin:createPluginTwo"); initData.properties->setProperty("Ice.Plugin.PluginThree", pluginDir + "TestPlugin:createPluginThree"); @@ -298,8 +291,7 @@ main(int argc, char* argv[]) communicator = 0; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Plugin.PluginOneFail", pluginDir + "TestPlugin:createPluginOneFail"); initData.properties->setProperty("Ice.Plugin.PluginTwoFail", pluginDir + "TestPlugin:createPluginTwoFail"); initData.properties->setProperty("Ice.Plugin.PluginThreeFail", pluginDir + "TestPlugin:createPluginThreeFail"); diff --git a/cpp/test/Ice/plugin/run.py b/cpp/test/Ice/plugin/run.py deleted file mode 100755 index 604c9cec295..00000000000 --- a/cpp/test/Ice/plugin/run.py +++ /dev/null @@ -1,25 +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.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testplugin"))]) -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client, options=TestUtil.getTestDirectory("testplugin")) diff --git a/cpp/test/Ice/plugin/test.py b/cpp/test/Ice/plugin/test.py new file mode 100644 index 00000000000..407e36f05c8 --- /dev/null +++ b/cpp/test/Ice/plugin/test.py @@ -0,0 +1,12 @@ +# ********************************************************************** +# +# 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__, + [ClientTestCase(client=SimpleClient(args=lambda process, current: [current.getBuildDir("testplugin")]))], + libDirs=["testplugin"]) diff --git a/cpp/test/Ice/properties/run.py b/cpp/test/Ice/properties/run.py deleted file mode 100755 index c31a553ab06..00000000000 --- a/cpp/test/Ice/properties/run.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -import os, sys, locale - -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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -if TestUtil.isAIX(): - encoding = locale.getdefaultlocale()[1] - if encoding != "UTF-8": - print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8") - print("Skipping test") - sys.exit(0) - -# -# Write config -# -if sys.version_info[0] == 2: - configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config" - decodedPath = configPath.decode("utf-8") -else: - configPath = "./config/\u4e2d\u56fd_client.config" - decodedPath = configPath # No need to decode with Python3, strings are already Unicode - - -TestUtil.createFile(decodedPath, - ["# Automatically generated by Ice test driver.", - "Ice.Trace.Protocol=1", - "Ice.Trace.Network=1", - "Ice.ProgramName=PropertiesClient", - "Config.Path=" + configPath], - "utf-8") - -TestUtil.simpleTest(client) - -if os.path.exists(decodedPath): - os.remove(decodedPath) diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index 03f6d87b367..25ce9ac8ffb 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -1260,10 +1260,6 @@ allTests(const Ice::CommunicatorPtr& communicator) } const bool tcp = communicator->getProperties()->getProperty("Ice.Default.Protocol") == "tcp"; - if(tcp) - { - p1->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); - } // Two legal TCP endpoints expressed as opaque endpoints p1 = communicator->stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); @@ -1288,23 +1284,6 @@ allTests(const Ice::CommunicatorPtr& communicator) } // - // Try to invoke on the endpoint to verify that we get a - // NoEndpointException (or ConnectionRefusedException when - // running with SSL). - // - if(ssl) - { - try - { - p1->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); - test(false); - } - catch(const Ice::ConnectFailedException&) - { - } - } - - // // Test that the proxy with an SSL endpoint and a nonsense // endpoint (which the server doesn't understand either) can be // sent over the wire and returned by the server without losing diff --git a/cpp/test/Ice/proxy/Client.cpp b/cpp/test/Ice/proxy/Client.cpp index dfd2ae3820f..9ba427230dd 100644 --- a/cpp/test/Ice/proxy/Client.cpp +++ b/cpp/test/Ice/proxy/Client.cpp @@ -38,7 +38,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/proxy", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/proxy/Collocated.cpp b/cpp/test/Ice/proxy/Collocated.cpp index 2c7e91d3106..4979865f18b 100644 --- a/cpp/test/Ice/proxy/Collocated.cpp +++ b/cpp/test/Ice/proxy/Collocated.cpp @@ -38,8 +38,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/proxy/Server.cpp b/cpp/test/Ice/proxy/Server.cpp index ac9b496ae68..793fb95f7a6 100644 --- a/cpp/test/Ice/proxy/Server.cpp +++ b/cpp/test/Ice/proxy/Server.cpp @@ -36,10 +36,8 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); - Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator()); } diff --git a/cpp/test/Ice/proxy/ServerAMD.cpp b/cpp/test/Ice/proxy/ServerAMD.cpp index db603a4570a..ee5d4556be9 100644 --- a/cpp/test/Ice/proxy/ServerAMD.cpp +++ b/cpp/test/Ice/proxy/ServerAMD.cpp @@ -36,8 +36,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); diff --git a/cpp/test/Ice/proxy/run.py b/cpp/test/Ice/proxy/run.py deleted file mode 100755 index 38e60970744..00000000000 --- a/cpp/test/Ice/proxy/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server = TestUtil.getTestExecutable("serveramd")) -TestUtil.queueCollocatedTest(additionalOptions = "--Ice.ToStringMode=Compat") -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/retry/Client.cpp b/cpp/test/Ice/retry/Client.cpp index 176071a2f71..082d50c3290 100644 --- a/cpp/test/Ice/retry/Client.cpp +++ b/cpp/test/Ice/retry/Client.cpp @@ -36,8 +36,7 @@ main(int argc, char* argv[]) { initCounts(); - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.observer = getObserver(); // // This test kills connections, so we don't want warnings. diff --git a/cpp/test/Ice/retry/Collocated.cpp b/cpp/test/Ice/retry/Collocated.cpp index 1c83cb7c996..8802c73bf0f 100644 --- a/cpp/test/Ice/retry/Collocated.cpp +++ b/cpp/test/Ice/retry/Collocated.cpp @@ -46,8 +46,7 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.observer = getObserver(); initData.properties->setProperty("Ice.RetryIntervals", "0 1 10 1"); diff --git a/cpp/test/Ice/retry/Server.cpp b/cpp/test/Ice/retry/Server.cpp index a0e37557fbf..ae448e377a7 100644 --- a/cpp/test/Ice/retry/Server.cpp +++ b/cpp/test/Ice/retry/Server.cpp @@ -36,8 +36,7 @@ main(int argc, char* argv[]) int status = EXIT_FAILURE; try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Dispatch", "0"); initData.properties->setProperty("Ice.PrintStackTraces", "0"); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); diff --git a/cpp/test/Ice/retry/run.py b/cpp/test/Ice/retry/run.py deleted file mode 100755 index 2d96b653cfa..00000000000 --- a/cpp/test/Ice/retry/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/servantLocator/Client.cpp b/cpp/test/Ice/servantLocator/Client.cpp index 2f36a63a9d0..a3805686f23 100644 --- a/cpp/test/Ice/servantLocator/Client.cpp +++ b/cpp/test/Ice/servantLocator/Client.cpp @@ -37,8 +37,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); RemoteConfig rc("Ice/servantLocator", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); diff --git a/cpp/test/Ice/servantLocator/Collocated.cpp b/cpp/test/Ice/servantLocator/Collocated.cpp index aeb02c0e36d..abc9c70b24d 100644 --- a/cpp/test/Ice/servantLocator/Collocated.cpp +++ b/cpp/test/Ice/servantLocator/Collocated.cpp @@ -113,8 +113,7 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator()); } diff --git a/cpp/test/Ice/servantLocator/Server.cpp b/cpp/test/Ice/servantLocator/Server.cpp index c5c78e23881..5215bb762c0 100644 --- a/cpp/test/Ice/servantLocator/Server.cpp +++ b/cpp/test/Ice/servantLocator/Server.cpp @@ -113,8 +113,7 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator()); } diff --git a/cpp/test/Ice/servantLocator/ServerAMD.cpp b/cpp/test/Ice/servantLocator/ServerAMD.cpp index 740d6072b33..d2b3b82568d 100644 --- a/cpp/test/Ice/servantLocator/ServerAMD.cpp +++ b/cpp/test/Ice/servantLocator/ServerAMD.cpp @@ -112,8 +112,7 @@ main(int argc, char* argv[]) #endif try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator()); } diff --git a/cpp/test/Ice/servantLocator/run.py b/cpp/test/Ice/servantLocator/run.py deleted file mode 100755 index 7921ce9e9ff..00000000000 --- a/cpp/test/Ice/servantLocator/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server = TestUtil.getTestExecutable("serveramd")) -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/services/AllTests.cpp b/cpp/test/Ice/services/AllTests.cpp index 7720dfaab94..3696729a06b 100644 --- a/cpp/test/Ice/services/AllTests.cpp +++ b/cpp/test/Ice/services/AllTests.cpp @@ -143,7 +143,7 @@ allTests(const Ice::CommunicatorPtr& communicator) { cout << "Testing IceGrid stub... " << flush; - Ice::ObjectPrxPtr base = communicator->stringToProxy("test:default -p 12010"); + Ice::ObjectPrxPtr base = communicator->stringToProxy("test:" + getTestEndpoint(communicator, 0)); IceGrid::RegistryPrxPtr registry = ICE_UNCHECKED_CAST(IceGrid::RegistryPrx, base); IceGrid::AdminSessionPrxPtr session; IceGrid::AdminPrxPtr admin; diff --git a/cpp/test/Ice/services/Client.cpp b/cpp/test/Ice/services/Client.cpp index c8268911231..b54125cf926 100644 --- a/cpp/test/Ice/services/Client.cpp +++ b/cpp/test/Ice/services/Client.cpp @@ -33,8 +33,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.NullHandleAbort", "0"); Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); return run(argc, argv, ich.communicator(), initData); diff --git a/cpp/test/Ice/services/run.py b/cpp/test/Ice/services/run.py deleted file mode 100755 index 1a758d84c41..00000000000 --- a/cpp/test/Ice/services/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/Ice/slicing/exceptions/Client.cpp b/cpp/test/Ice/slicing/exceptions/Client.cpp index 76bbf7f7f8f..270e4e3e6b2 100644 --- a/cpp/test/Ice/slicing/exceptions/Client.cpp +++ b/cpp/test/Ice/slicing/exceptions/Client.cpp @@ -37,7 +37,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/slicing/exceptions", argc, argv, ich.communicator()); int status = run(argc, argv, ich.communicator()); rc.finished(status); diff --git a/cpp/test/Ice/slicing/exceptions/Server.cpp b/cpp/test/Ice/slicing/exceptions/Server.cpp index 909b87b7fc0..c69fcfdb43e 100644 --- a/cpp/test/Ice/slicing/exceptions/Server.cpp +++ b/cpp/test/Ice/slicing/exceptions/Server.cpp @@ -37,7 +37,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/slicing/exceptions/ServerAMD.cpp b/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp index c5534dcc207..831bb423f9c 100644 --- a/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp +++ b/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp @@ -37,7 +37,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/slicing/exceptions/run.py b/cpp/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index cbec6614fa6..00000000000 --- a/cpp/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,37 +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(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", server=TestUtil.getTestExecutable("serveramd")) - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server=TestUtil.getTestExecutable("serveramd"), - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/slicing/objects/Client.cpp b/cpp/test/Ice/slicing/objects/Client.cpp index d4c9018909b..0b0b9cce780 100644 --- a/cpp/test/Ice/slicing/objects/Client.cpp +++ b/cpp/test/Ice/slicing/objects/Client.cpp @@ -37,8 +37,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // For this test, we enable object collection. // diff --git a/cpp/test/Ice/slicing/objects/Server.cpp b/cpp/test/Ice/slicing/objects/Server.cpp index 093997a59ef..50685cf1384 100644 --- a/cpp/test/Ice/slicing/objects/Server.cpp +++ b/cpp/test/Ice/slicing/objects/Server.cpp @@ -39,7 +39,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/slicing/objects/ServerAMD.cpp b/cpp/test/Ice/slicing/objects/ServerAMD.cpp index 28e3b390606..92c679ec31b 100644 --- a/cpp/test/Ice/slicing/objects/ServerAMD.cpp +++ b/cpp/test/Ice/slicing/objects/ServerAMD.cpp @@ -39,7 +39,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/slicing/objects/run.py b/cpp/test/Ice/slicing/objects/run.py deleted file mode 100755 index 6fe120a056c..00000000000 --- a/cpp/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,37 +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(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", server=TestUtil.getTestExecutable("serveramd")) - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server=TestUtil.getTestExecutable("serveramd"), - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index eb3fb613280..c7455d7c012 100644 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -1306,7 +1306,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/Ice/stream/run.py b/cpp/test/Ice/stream/run.py deleted file mode 100755 index 06bc2ab56a0..00000000000 --- a/cpp/test/Ice/stream/run.py +++ /dev/null @@ -1,29 +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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -print("Running test with default encoding...") -TestUtil.simpleTest(client) - -print("Running test with 1.0 encoding...") -TestUtil.simpleTest(client, "--Ice.Default.EncodingVersion=1.0") diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index f0d7f4df1cd..f4e0101897e 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -27,8 +27,7 @@ main(int argc, char* argv[]) Ice::registerIceStringConverter(); #endif - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); string narrowEncoding; string wideEncoding; diff --git a/cpp/test/Ice/stringConverter/Server.cpp b/cpp/test/Ice/stringConverter/Server.cpp index e82f6caf0ab..63248a612ce 100644 --- a/cpp/test/Ice/stringConverter/Server.cpp +++ b/cpp/test/Ice/stringConverter/Server.cpp @@ -65,8 +65,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); } diff --git a/cpp/test/Ice/stringConverter/run.py b/cpp/test/Ice/stringConverter/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/stringConverter/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() diff --git a/cpp/test/Ice/threadPoolPriority/Client.cpp b/cpp/test/Ice/threadPoolPriority/Client.cpp index b3797d00feb..5ca601e09d8 100644 --- a/cpp/test/Ice/threadPoolPriority/Client.cpp +++ b/cpp/test/Ice/threadPoolPriority/Client.cpp @@ -36,7 +36,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/Ice/threadPoolPriority/Server.cpp b/cpp/test/Ice/threadPoolPriority/Server.cpp index b1957badf2f..1eed7ce28c4 100644 --- a/cpp/test/Ice/threadPoolPriority/Server.cpp +++ b/cpp/test/Ice/threadPoolPriority/Server.cpp @@ -67,7 +67,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/Ice/threadPoolPriority/ServerCustomThreadPool.cpp b/cpp/test/Ice/threadPoolPriority/ServerCustomThreadPool.cpp index 3d67cc16c3f..559752de5f9 100644 --- a/cpp/test/Ice/threadPoolPriority/ServerCustomThreadPool.cpp +++ b/cpp/test/Ice/threadPoolPriority/ServerCustomThreadPool.cpp @@ -71,7 +71,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/Ice/threadPoolPriority/run.py b/cpp/test/Ice/threadPoolPriority/run.py deleted file mode 100755 index bc73b82596f..00000000000 --- a/cpp/test/Ice/threadPoolPriority/run.py +++ /dev/null @@ -1,26 +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(message = "Running test with default server thread pool.") -TestUtil.queueClientServerTest(configName = "custom", message = "Running test with custom server thread pool.", - server = TestUtil.getTestExecutable("servercustom")) -TestUtil.runQueuedTests() diff --git a/cpp/test/Ice/threadPoolPriority/test.py b/cpp/test/Ice/threadPoolPriority/test.py new file mode 100644 index 00000000000..350997731e9 --- /dev/null +++ b/cpp/test/Ice/threadPoolPriority/test.py @@ -0,0 +1,14 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +if not isinstance(platform, Darwin) and (isinstance(platform, Windows) or os.getuid() == 0): + TestSuite(__file__, [ + ClientServerTestCase(), + ClientServerTestCase(name="client/custom server", server="servercustom") + ], options={ "mx" : [False] }) diff --git a/cpp/test/Ice/timeout/Client.cpp b/cpp/test/Ice/timeout/Client.cpp index fa78aa30002..86325621840 100644 --- a/cpp/test/Ice/timeout/Client.cpp +++ b/cpp/test/Ice/timeout/Client.cpp @@ -34,8 +34,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); // // For this test, we want to disable retries. diff --git a/cpp/test/Ice/timeout/Server.cpp b/cpp/test/Ice/timeout/Server.cpp index f355ce381fa..67294383853 100644 --- a/cpp/test/Ice/timeout/Server.cpp +++ b/cpp/test/Ice/timeout/Server.cpp @@ -38,8 +38,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); #if TARGET_OS_IPHONE != 0 // diff --git a/cpp/test/Ice/timeout/run.py b/cpp/test/Ice/timeout/run.py deleted file mode 100755 index eb60390efe1..00000000000 --- a/cpp/test/Ice/timeout/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() diff --git a/cpp/test/Ice/udp/AllTests.cpp b/cpp/test/Ice/udp/AllTests.cpp index 5c63a380442..b9945f8d724 100644 --- a/cpp/test/Ice/udp/AllTests.cpp +++ b/cpp/test/Ice/udp/AllTests.cpp @@ -62,14 +62,14 @@ ICE_DEFINE_PTR(PingReplyIPtr, PingReplyI); void allTests(const CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("ReplyAdapter.Endpoints", "udp -p 12030"); + communicator->getProperties()->setProperty("ReplyAdapter.Endpoints", "udp"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ReplyAdapter"); PingReplyIPtr replyI = ICE_MAKE_SHARED(PingReplyI); PingReplyPrxPtr reply = ICE_UNCHECKED_CAST(PingReplyPrx, adapter->addWithUUID(replyI))->ice_datagram(); adapter->activate(); cout << "testing udp... " << flush; - ObjectPrxPtr base = communicator->stringToProxy("test -d:udp -p 12010"); + ObjectPrxPtr base = communicator->stringToProxy("test -d:" + getTestEndpoint(communicator, 0, "udp")); TestIntfPrxPtr obj = ICE_UNCHECKED_CAST(TestIntfPrx, base); int nRetry = 5; @@ -87,7 +87,7 @@ allTests(const CommunicatorPtr& communicator) } // If the 3 datagrams were not received within the 2 seconds, we try again to - // receive 3 new datagrams using a new object. We give up after 5 retries. + // receive 3 new datagrams using a new object. We give up after 5 retries. replyI = ICE_MAKE_SHARED(PingReplyI); reply = ICE_UNCHECKED_CAST(PingReplyPrx, adapter->addWithUUID(replyI))->ice_datagram(); } @@ -175,7 +175,7 @@ allTests(const CommunicatorPtr& communicator) } #endif - cout << "testing udp bi-dir connection... " << flush; + cout << "testing udp bi-dir connection... " << flush; obj->ice_getConnection()->setAdapter(adapter); objMcast->ice_getConnection()->setAdapter(adapter); nRetry = 5; @@ -192,7 +192,7 @@ allTests(const CommunicatorPtr& communicator) } // If the 3 datagrams were not received within the 2 seconds, we try again to - // receive 3 new datagrams using a new object. We give up after 5 retries. + // receive 3 new datagrams using a new object. We give up after 5 retries. replyI = ICE_MAKE_SHARED(PingReplyI); reply = ICE_UNCHECKED_CAST(PingReplyPrx, adapter->addWithUUID(replyI))->ice_datagram(); } @@ -204,8 +204,8 @@ allTests(const CommunicatorPtr& communicator) // platform (it works for OS X Leopard but not Snow Leopard, doesn't work on SLES, // Windows...). For Windows, see UdpTransceiver constructor for the details. So // we don't run this test. - // -// cout << "testing udp bi-dir connection... " << flush; + // +// cout << "testing udp bi-dir connection... " << flush; // nRetry = 5; // while(nRetry-- > 0) // { @@ -215,7 +215,7 @@ allTests(const CommunicatorPtr& communicator) // if(ret) // { // break; // Success -// } +// } // replyI = new PingReplyI; // reply = PingReplyPrx::uncheckedCast(adapter->addWithUUID(replyI))->ice_datagram(); // } diff --git a/cpp/test/Ice/udp/Client.cpp b/cpp/test/Ice/udp/Client.cpp index b52a9cbbccd..596f7adca6d 100644 --- a/cpp/test/Ice/udp/Client.cpp +++ b/cpp/test/Ice/udp/Client.cpp @@ -26,7 +26,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) for(int i = 0; i < num; i++) { ostringstream os; - os << "control:tcp -p " << (12010 + i); + os << "control:" << getTestEndpoint(communicator, i, "tcp"); ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy(os.str()))->shutdown(); } return EXIT_SUCCESS; @@ -41,8 +41,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.UDP.RcvSize", "16384"); initData.properties->setProperty("Ice.UDP.SndSize", "16384"); diff --git a/cpp/test/Ice/udp/Server.cpp b/cpp/test/Ice/udp/Server.cpp index 9574f504ed7..0203728919a 100644 --- a/cpp/test/Ice/udp/Server.cpp +++ b/cpp/test/Ice/udp/Server.cpp @@ -22,16 +22,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) int num = argc == 2 ? atoi(argv[1]) : 0; - ostringstream os; - os << "tcp -p " << (12010 + num); - properties->setProperty("ControlAdapter.Endpoints", os.str()); + properties->setProperty("ControlAdapter.Endpoints", getTestEndpoint(communicator, num, "tcp")); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ControlAdapter"); adapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("control")); adapter->activate(); if(num == 0) { - properties->setProperty("TestAdapter.Endpoints", "udp -p 12010"); + properties->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, num, "udp")); Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("TestAdapter"); adapter2->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("test")); adapter2->activate(); @@ -70,8 +68,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Warn.Connections", "0"); initData.properties->setProperty("Ice.UDP.SndSize", "16384"); initData.properties->setProperty("Ice.UDP.RcvSize", "16384"); diff --git a/cpp/test/Ice/udp/run.py b/cpp/test/Ice/udp/run.py deleted file mode 100755 index b4bb1cde735..00000000000 --- a/cpp/test/Ice/udp/run.py +++ /dev/null @@ -1,52 +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 - -# -# COMPILERFIX: The server fails to start on Solaris when IPv6 is -# enabled. It's apparently not possible to use multicast on a -# linked-local configured link. -# -if TestUtil.isSolaris() and TestUtil.ipv6: - print("test not supported on Solaris with IPv6") - sys.exit(0) - -server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -num = 5 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, "%d" % i , adapter="McastTestAdapter")) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, "%d" % num, startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/cpp/test/IceBox/admin/Client.cpp b/cpp/test/IceBox/admin/Client.cpp index ed265a9da1a..07b6c88b0c2 100644 --- a/cpp/test/IceBox/admin/Client.cpp +++ b/cpp/test/IceBox/admin/Client.cpp @@ -38,8 +38,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Default.Host", "127.0.0.1"); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); diff --git a/cpp/test/IceBox/admin/run.py b/cpp/test/IceBox/admin/run.py deleted file mode 100755 index 29ced943cfb..00000000000 --- a/cpp/test/IceBox/admin/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 - -icebox = TestUtil.getIceBox() - -config = os.path.join(os.getcwd(), "config.icebox") - -TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testservice"))]) -TestUtil.clientServerTest(additionalServerOptions= '--Ice.Config=\"%s\"' % config, server = icebox) - -sys.stdout.write("testing iceboxadmin... ") -sys.stdout.flush() - -admin = TestUtil.getIceBoxAdmin() -adminconfig = os.path.join(os.getcwd(), "config.admin") - -ib = TestUtil.startServer(icebox, args = '--Ice.Config=\"%s\"' % config) -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" stop TestService' % adminconfig) -iba.waitTestSuccess() -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" start TestService' % adminconfig) -iba.waitTestSuccess() -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" shutdown' % adminconfig) -iba.waitTestSuccess() -ib.waitTestSuccess() - -print("ok") diff --git a/cpp/test/IceBox/configuration/AllTests.cpp b/cpp/test/IceBox/configuration/AllTests.cpp index 6f45cee8e6d..e17fd2fe0a3 100644 --- a/cpp/test/IceBox/configuration/AllTests.cpp +++ b/cpp/test/IceBox/configuration/AllTests.cpp @@ -15,12 +15,12 @@ using namespace std; using namespace Test; void -allTests(const Ice::CommunicatorPtr& communicator) +allTests(const Ice::CommunicatorPtr& com) { - TestIntfPrxPtr service1 = ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy("test:tcp -p 12010")); - TestIntfPrxPtr service2 = ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy("test:tcp -p 12011")); - TestIntfPrxPtr service3 = ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy("test:tcp -p 12012")); - TestIntfPrxPtr service4 = ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy("test:tcp -p 12013")); + TestIntfPrxPtr service1 = ICE_UNCHECKED_CAST(TestIntfPrx, com->stringToProxy("test:" + getTestEndpoint(com, 0))); + TestIntfPrxPtr service2 = ICE_UNCHECKED_CAST(TestIntfPrx, com->stringToProxy("test:" + getTestEndpoint(com, 1))); + TestIntfPrxPtr service3 = ICE_UNCHECKED_CAST(TestIntfPrx, com->stringToProxy("test:" + getTestEndpoint(com, 2))); + TestIntfPrxPtr service4 = ICE_UNCHECKED_CAST(TestIntfPrx, com->stringToProxy("test:" + getTestEndpoint(com, 3))); if(service1->getProperty("IceBox.InheritProperties") == "") { diff --git a/cpp/test/IceBox/configuration/Client.cpp b/cpp/test/IceBox/configuration/Client.cpp index ed265a9da1a..07b6c88b0c2 100644 --- a/cpp/test/IceBox/configuration/Client.cpp +++ b/cpp/test/IceBox/configuration/Client.cpp @@ -38,8 +38,7 @@ main(int argc, char* argv[]) try { - Ice::InitializationData initData; - initData.properties = Ice::createProperties(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); initData.properties->setProperty("Ice.Default.Host", "127.0.0.1"); communicator = Ice::initialize(argc, argv, initData); status = run(argc, argv, communicator); diff --git a/cpp/test/IceBox/configuration/config.service1 b/cpp/test/IceBox/configuration/config.service1 index 6028e615ff5..3e38245a5d0 100644 --- a/cpp/test/IceBox/configuration/config.service1 +++ b/cpp/test/IceBox/configuration/config.service1 @@ -1,4 +1,4 @@ -Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1 +Service1OA.Endpoints=default -p 12010 -h 127.0.0.1 #Ice.ProgramName Service=1 diff --git a/cpp/test/IceBox/configuration/config.service1-2 b/cpp/test/IceBox/configuration/config.service1-2 index c173914db2a..835acbadfc9 100644 --- a/cpp/test/IceBox/configuration/config.service1-2 +++ b/cpp/test/IceBox/configuration/config.service1-2 @@ -1,4 +1,4 @@ -Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1 +Service1OA.Endpoints=default -p 12010 -h 127.0.0.1 #Ice.ProgramName Service1.Prop=1 diff --git a/cpp/test/IceBox/configuration/config.service2 b/cpp/test/IceBox/configuration/config.service2 index 78e08aadba6..95d33831a14 100644 --- a/cpp/test/IceBox/configuration/config.service2 +++ b/cpp/test/IceBox/configuration/config.service2 @@ -1,4 +1,4 @@ -Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1 +Service2OA.Endpoints=default -p 12011 -h 127.0.0.1 Ice.ProgramName=Test Service=2 diff --git a/cpp/test/IceBox/configuration/config.service2-2 b/cpp/test/IceBox/configuration/config.service2-2 index 36c8d0812cb..6ed8dc9df49 100644 --- a/cpp/test/IceBox/configuration/config.service2-2 +++ b/cpp/test/IceBox/configuration/config.service2-2 @@ -1,4 +1,4 @@ -Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1 +Service2OA.Endpoints=default -p 12011 -h 127.0.0.1 #Ice.ProgramName Service2.Prop=1 diff --git a/cpp/test/IceBox/configuration/config.service3 b/cpp/test/IceBox/configuration/config.service3 index c93ed144701..6cba4b351b0 100644 --- a/cpp/test/IceBox/configuration/config.service3 +++ b/cpp/test/IceBox/configuration/config.service3 @@ -1,4 +1,4 @@ -Service3OA.Endpoints=tcp -p 12012 -h 127.0.0.1 +Service3OA.Endpoints=default -p 12012 -h 127.0.0.1 #Ice.ProgramName Service=3 diff --git a/cpp/test/IceBox/configuration/config.service4 b/cpp/test/IceBox/configuration/config.service4 index 182fb3a7289..a70120dd192 100644 --- a/cpp/test/IceBox/configuration/config.service4 +++ b/cpp/test/IceBox/configuration/config.service4 @@ -1,4 +1,4 @@ -Service4OA.Endpoints=tcp -p 12013 -h 127.0.0.1 +Service4OA.Endpoints=default -p 12013 -h 127.0.0.1 #Ice.ProgramName Service=4 diff --git a/cpp/test/IceBox/configuration/run.py b/cpp/test/IceBox/configuration/run.py deleted file mode 100755 index d76fa51b96f..00000000000 --- a/cpp/test/IceBox/configuration/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 - -icebox = TestUtil.getIceBox() - -config = os.path.join(os.getcwd(), "config.icebox") -config2 = os.path.join(os.getcwd(), "config.icebox2") - -TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testservice"))]) -TestUtil.clientServerTest(additionalServerOptions= '--Ice.Config="%s"' % config, server = icebox) -TestUtil.clientServerTest(additionalServerOptions= '--Ice.Config="%s"' % config2, server = icebox) diff --git a/cpp/test/IceDiscovery/simple/AllTests.cpp b/cpp/test/IceDiscovery/simple/AllTests.cpp index e373f443cdd..558207c8c4e 100644 --- a/cpp/test/IceDiscovery/simple/AllTests.cpp +++ b/cpp/test/IceDiscovery/simple/AllTests.cpp @@ -83,7 +83,7 @@ allTests(const CommunicatorPtr& communicator, int num) } } cout << "ok" << endl; - + cout << "testing object adapter migration..." << flush; { proxies[0]->activateObjectAdapter("oa", "oa1", ""); diff --git a/cpp/test/IceDiscovery/simple/Client.cpp b/cpp/test/IceDiscovery/simple/Client.cpp index 4c26f7679b0..5a7ceb63473 100644 --- a/cpp/test/IceDiscovery/simple/Client.cpp +++ b/cpp/test/IceDiscovery/simple/Client.cpp @@ -42,7 +42,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/IceDiscovery/simple/Server.cpp b/cpp/test/IceDiscovery/simple/Server.cpp index ef543fa090e..dd694fd3778 100644 --- a/cpp/test/IceDiscovery/simple/Server.cpp +++ b/cpp/test/IceDiscovery/simple/Server.cpp @@ -24,7 +24,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { ostringstream os; - os << "default -p " << (12010 + num); + os << getTestEndpoint(communicator, num); + cerr << os.str() << endl; properties->setProperty("ControlAdapter.Endpoints", os.str()); } { @@ -60,7 +61,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/IceDiscovery/simple/run.py b/cpp/test/IceDiscovery/simple/run.py deleted file mode 100755 index 01400997d04..00000000000 --- a/cpp/test/IceDiscovery/simple/run.py +++ /dev/null @@ -1,52 +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 - -server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -num = 3 - -args = " --IceDiscovery.Timeout=50" -args += " --IceDiscovery.RetryCount=5" -if not TestUtil.ipv6: - args += " --IceDiscovery.Interface=127.0.0.1" -elif TestUtil.isDarwin(): - args += " --IceDiscovery.Interface=\"::1\"" - -# Set the plugin property only for the server, the client uses Ice::registerIceDiscovery() -serverArgs = " --Ice.Plugin.IceDiscovery=IceDiscovery:createIceDiscovery" + args -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, "%d %s " % (i, serverArgs), count = 4)) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, "%d %s" % (num, args), startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() 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 diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp index 24047abfabf..d8cf659450f 100644 --- a/cpp/test/IceSSL/configuration/AllTests.cpp +++ b/cpp/test/IceSSL/configuration/AllTests.cpp @@ -699,7 +699,7 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12) elCapitanUpdate2OrLower = (majorVersion == 15) && (minorVersion <= 2); } #endif - string factoryRef = "factory:tcp -p 12010"; + string factoryRef = "factory:" + getTestEndpoint(communicator, 0); ObjectPrxPtr base = communicator->stringToProxy(factoryRef); test(base); Test::ServerFactoryPrxPtr factory = ICE_CHECKED_CAST(Test::ServerFactoryPrx, base); diff --git a/cpp/test/IceSSL/configuration/Client.cpp b/cpp/test/IceSSL/configuration/Client.cpp index 44acba98ffb..fb42ae4efe0 100644 --- a/cpp/test/IceSSL/configuration/Client.cpp +++ b/cpp/test/IceSSL/configuration/Client.cpp @@ -71,7 +71,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/IceSSL/configuration/Server.cpp b/cpp/test/IceSSL/configuration/Server.cpp index 44c76dc5cb5..07a6fb6acd0 100644 --- a/cpp/test/IceSSL/configuration/Server.cpp +++ b/cpp/test/IceSSL/configuration/Server.cpp @@ -18,7 +18,7 @@ using namespace std; int run(int, char**, const Ice::CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "tcp -p 12010"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0)); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::Identity id = Ice::stringToIdentity("factory"); adapter->add(ICE_MAKE_SHARED(ServerFactoryI), id); @@ -36,7 +36,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/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py deleted file mode 100755 index 8edf98af0f8..00000000000 --- a/cpp/test/IceSSL/configuration/run.py +++ /dev/null @@ -1,56 +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, atexit, re - -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 - -# Filter-out the deprecated property warnings -TestUtil.clientTraceFilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.KeyFile\n", "", x) ] -TestUtil.serverTraceFilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.KeyFile\n", "", x) ] - -certsPath = os.path.abspath(os.path.join(os.getcwd(), "..", "certs")) -keychainPath = os.path.abspath(os.path.join(certsPath, "Find.keychain")) - -def cleanup(): - if TestUtil.isDarwin(): - os.system("rm -rf %s ../certs/keychain" % keychainPath) - elif TestUtil.isLinux(): - for c in ["cacert1.pem", "cacert2.pem"]: - pem = os.path.join(certsPath, c) - os.system("rm -f {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath)) - -cleanup() -atexit.register(cleanup) - -if TestUtil.isDarwin(): - os.system("mkdir -p ../certs/keychain") - os.system("security create-keychain -p password %s" % keychainPath) - for cert in ["s_rsa_ca1.p12", "c_rsa_ca1.p12"]: - os.system("security import %s -f pkcs12 -A -P password -k %s" % (os.path.join(certsPath, cert), keychainPath)) -elif TestUtil.iceUseOpenSSL(): - # - # Create copies of the CA certificates named after the subject - # hash. This is used by the tests to find the CA certificates in - # the IceSSL.DefaultDir - # - for c in ["cacert1.pem", "cacert2.pem"]: - pem = os.path.join(certsPath, c) - os.system("cp {pem} {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath)) - -TestUtil.clientServerTest(additionalClientOptions = '"%s"' % os.getcwd()) diff --git a/cpp/test/IceStorm/federation/0.db/.gitignore b/cpp/test/IceStorm/federation/0.db/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/cpp/test/IceStorm/federation/0.db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/cpp/test/IceStorm/federation/1.db/.gitignore b/cpp/test/IceStorm/federation/1.db/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/cpp/test/IceStorm/federation/1.db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/cpp/test/IceStorm/federation/2.db/.gitignore b/cpp/test/IceStorm/federation/2.db/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/cpp/test/IceStorm/federation/2.db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/cpp/test/IceStorm/federation/Publisher.cpp b/cpp/test/IceStorm/federation/Publisher.cpp index 4cee72d4da7..befcf51b8dc 100644 --- a/cpp/test/IceStorm/federation/Publisher.cpp +++ b/cpp/test/IceStorm/federation/Publisher.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <IceStorm/IceStorm.h> +#include <TestCommon.h> #include <Event.h> using namespace std; @@ -45,7 +46,7 @@ run(int, char* argv[], const CommunicatorPtr& communicator) { cerr << argv[0] << ": NoSuchTopic: " << e.name << endl; return EXIT_FAILURE; - + } TopicPrx fed2; @@ -57,7 +58,7 @@ run(int, char* argv[], const CommunicatorPtr& communicator) { cerr << argv[0] << ": NoSuchTopic: " << e.name << endl; return EXIT_FAILURE; - + } TopicPrx fed3; @@ -69,7 +70,7 @@ run(int, char* argv[], const CommunicatorPtr& communicator) { cerr << argv[0] << ": NoSuchTopic: " << e.name << endl; return EXIT_FAILURE; - + } EventPrx eventFed1 = EventPrx::uncheckedCast(fed1->getPublisher()->ice_oneway()); @@ -131,10 +132,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/federation/Subscriber.cpp b/cpp/test/IceStorm/federation/Subscriber.cpp index f99a0722437..20ef6c29bc8 100644 --- a/cpp/test/IceStorm/federation/Subscriber.cpp +++ b/cpp/test/IceStorm/federation/Subscriber.cpp @@ -196,10 +196,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py deleted file mode 100755 index 0681ac656db..00000000000 --- a/cpp/test/IceStorm/federation/run.py +++ /dev/null @@ -1,96 +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 -import time - -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, IceStormUtil - -publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher")) -subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber")) - -targets = [] -if TestUtil.appverifier: - targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin()] - TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) - -def doTest(icestorm, batch): - - if batch: - name = "batch subscriber" - batchOptions = " -b" - else: - name = "subscriber" - batchOptions = "" - - subscriberProc = TestUtil.startServer(subscriber, batchOptions + icestorm.reference()) - - # - # Start the publisher. This should publish events which eventually - # causes subscriber to terminate. - # - publisherProc = TestUtil.startClient(publisher, icestorm.reference()) - subscriberProc.waitTestSuccess() - publisherProc.waitTestSuccess() - -def runtest(type, **args): - icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, **args) - - icestorm.start() - - sys.stdout.write("setting up topics... ") - sys.stdout.flush() - icestorm.admin("create fed1 fed2 fed3; link fed1 fed2 10; link fed2 fed3 5") - print("ok") - - # - # Test oneway subscribers. - # - sys.stdout.write("testing oneway subscribers... ") - sys.stdout.flush() - doTest(icestorm, 0) - print("ok") - - # - # Test batch oneway subscribers. - # - sys.stdout.write("testing batch subscribers... ") - sys.stdout.flush() - doTest(icestorm, 1) - print("ok") - - # - # Destroy the topics. - # - sys.stdout.write("destroying topics... ") - sys.stdout.flush() - icestorm.admin("destroy fed1 fed2 fed3") - print("ok") - - # - # Shutdown icestorm. - # - icestorm.stop() - -runtest("persistent") -runtest("transient") -runtest("replicated", replicatedPublisher = False) -runtest("replicated", replicatedPublisher = True) - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd()) diff --git a/cpp/test/IceStorm/federation/test.py b/cpp/test/IceStorm/federation/test.py new file mode 100644 index 00000000000..e38f8d25a8c --- /dev/null +++ b/cpp/test/IceStorm/federation/test.py @@ -0,0 +1,39 @@ +# -*- 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 IceStormFederationTestCase(IceStormTestCase): + + def setupClientSide(self, current): + self.runadmin(current, "create fed1 fed2 fed3; link fed1 fed2 10; link fed2 fed3 5") + + def runClientSide(self, current): + current.write("testing oneway subscribers...") + ClientServerTestCase(client=Publisher(), server=Subscriber()).run(current) + current.writeln("ok") + + current.write("testing batch subscribers...") + ClientServerTestCase(client=Publisher(), server=Subscriber(args=["-b"])).run(current) + current.writeln("ok") + + def teardownClientSide(self, current, success): + self.runadmin(current, "destroy fed1 fed2 fed3") + self.shutdown(current) + +# Override ReplicatedPublishEndpoints property to empty for testing without replicated publisher +props = {'IceStorm.ReplicatedPublishEndpoints' : ''} + +TestSuite(__file__, [ + IceStormFederationTestCase("persistent", icestorm=IceStorm()), + IceStormFederationTestCase("transient", icestorm=IceStorm(transient=True)), + IceStormFederationTestCase("replicated with non-replicated publisher", + icestorm=[IceStorm(replica=i, nreplicas=3, props=props) for i in range(0,3)]), + IceStormFederationTestCase("replicated with replicated publisher", + icestorm=[IceStorm(replica=i, nreplicas=3) for i in range(0,3)]), +], multihost=False) diff --git a/cpp/test/IceStorm/federation2/0.db/.gitignore b/cpp/test/IceStorm/federation2/0.db/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/cpp/test/IceStorm/federation2/0.db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/cpp/test/IceStorm/federation2/Publisher.cpp b/cpp/test/IceStorm/federation2/Publisher.cpp index 8daf34a8297..c07f3df88c5 100644 --- a/cpp/test/IceStorm/federation2/Publisher.cpp +++ b/cpp/test/IceStorm/federation2/Publisher.cpp @@ -12,6 +12,7 @@ #include <Ice/Ice.h> #include <IceStorm/IceStorm.h> #include <Event.h> +#include <TestCommon.h> using namespace std; using namespace Ice; @@ -60,7 +61,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) { cerr << argv[0] << ": NoSuchTopic: " << e.name << endl; return EXIT_FAILURE; - + } EventPrx eventFed1 = EventPrx::uncheckedCast(fed1->getPublisher()->ice_oneway()); @@ -71,7 +72,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator) { count = atoi(arg.c_str()); } - + while(true) { for(int i = 0; i < 10; ++i) @@ -100,10 +101,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/federation2/Subscriber.cpp b/cpp/test/IceStorm/federation2/Subscriber.cpp index 28e006f7bf9..6bce9c9d84d 100644 --- a/cpp/test/IceStorm/federation2/Subscriber.cpp +++ b/cpp/test/IceStorm/federation2/Subscriber.cpp @@ -189,10 +189,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py deleted file mode 100755 index f479c7b411c..00000000000 --- a/cpp/test/IceStorm/federation2/run.py +++ /dev/null @@ -1,275 +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, time, threading, re - -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, IceStormUtil, Expect - -iceStormAdmin = os.path.join(TestUtil.getCppBinDir(), "icestormadmin") - -publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher")) -subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber")) - -targets = [] -if TestUtil.appverifier: - targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin()] - TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) - -def admin(ref, command): - proc = TestUtil.startClient(iceStormAdmin, ref + ' -e "%s"' % command, echo = False) - proc.waitTestSuccess() - return proc.buf - -def runPublisher(icestorm1, opt = ""): - proc = TestUtil.startClient(publisher, opt + icestorm1.reference()) - proc.waitTestSuccess() - -def doTest(icestorm1, icestorm2, batch, subscriberRef = None): - if batch: - name = "batch subscriber" - batchOptions = " -b" - else: - name = "subscriber" - batchOptions = "" - - if subscriberRef == None: - subscriberRef = icestorm2.reference() - - subscriberProc = TestUtil.startServer(subscriber, batchOptions + subscriberRef) - - # - # Start the publisher. This should publish events which eventually - # causes subscriber to terminate. - # - runPublisher(icestorm1) - - subscriberProc.waitTestSuccess() - -# -# Test #1: -# -# create a cross service link fed1->fed2 and ensure the events are -# published between them correctly. -# -def runtest(type, **args): - icestorm1 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional = '--IceStorm.Discard.Interval=2', - dbDir = "db", instanceName = "TestIceStorm1", port = 12000, **args) - icestorm1.start() - icestorm2 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional = '--IceStorm.Discard.Interval=2', - dbDir = "db2", instanceName = "TestIceStorm2", port = 12500, **args) - icestorm2.start() - - adminIceStormReference = ' --IceStormAdmin.TopicManager.Proxy="%s" --IceStormAdmin.TopicManager.Proxy2="%s"' % ( - icestorm1.proxy(), icestorm2.proxy()) - - sys.stdout.write("setting up the topics... ") - sys.stdout.flush() - admin(adminIceStormReference, "create TestIceStorm1/fed1 TestIceStorm2/fed1; link TestIceStorm1/fed1 TestIceStorm2/fed1") - print("ok") - - # - # Test oneway subscribers. - # - sys.stdout.write("testing federation with oneway subscribers... ") - sys.stdout.flush() - doTest(icestorm1, icestorm2, 0) - print("ok") - - # - # Test batch oneway subscribers. - # - sys.stdout.write("testing federation with batch subscribers... ") - sys.stdout.flush() - doTest(icestorm1, icestorm2, 1) - print("ok") - - # - # Test #2: - # - # Stop and restart the service and repeat the test. This ensures that - # the database is correct. - # - sys.stdout.write("restarting services to ensure that the database content is preserved... ") - sys.stdout.flush() - - # - # Shutdown icestorm. - # - icestorm1.stop() - icestorm2.stop() - - icestorm1.start(echo=False) - icestorm2.start(echo=False) - print("ok") - - # - # Test oneway subscribers. - # - sys.stdout.write("retesting federation with oneway subscribers... ") - sys.stdout.flush() - doTest(icestorm1, icestorm2, 0) - print("ok") - - # - # Test batch oneway subscribers. - # - sys.stdout.write("retesting federation with batch subscribers... ") - sys.stdout.flush() - doTest(icestorm1, icestorm2, 1) - print("ok") - - # - # Shutdown icestorm. - # - icestorm1.stop() - icestorm2.stop() - - # - # Restart the first server and publish some events. Attach a - # subscriber to the channel and make sure the events are received. - # - # Then re-start the linked downstream server and publish the events. - # Ensure they are received by the linked server. - # - if type != "replicated": - sys.stdout.write("restarting only one IceStorm server... ") - sys.stdout.flush() - proc = icestorm1.start(echo=False) - - #proc.expect("topic.fed1.*subscriber offline") - #proc.expect("connection refused") - print("ok") - - # - # Test oneway subscribers. - # - sys.stdout.write("testing that the federation link reports an error... ") - sys.stdout.flush() - doTest(icestorm1, icestorm2, 0, icestorm1.reference()) - - # Give some time for the output to be sent. - time.sleep(2) - - proc.expect("topic.fed1.*subscriber offline") - print("ok") - - sys.stdout.write("starting downstream icestorm server... ") - sys.stdout.flush() - icestorm2.start(echo=False) - print("ok") - - # - # Need to sleep for at least the discard interval. - # - time.sleep(3) - - # - # Test oneway subscribers. - # - sys.stdout.write("testing link is reestablished... ") - sys.stdout.flush() - doTest(icestorm1, icestorm2, 0) - print("ok") - - try: - proc.expect("topic.fed1.*subscriber offline") - assert False - except Expect.TIMEOUT: - pass - - icestorm1.stop() - icestorm2.stop() - - # - # Test #4: - # - # Trash the TestIceStorm2 database. Then restart the servers and - # verify that the link is removed. - # - sys.stdout.write("destroying the downstream IceStorm service database... ") - sys.stdout.flush() - icestorm2.clean() - - print("ok") - - sys.stdout.write("restarting IceStorm servers... ") - sys.stdout.flush() - icestorm1.start(echo = False) - icestorm2.start(echo = False) - print("ok") - - sys.stdout.write("checking link still exists... ") - sys.stdout.flush() - line = admin(adminIceStormReference, "links TestIceStorm1") - if not re.compile("fed1 with cost 0").search(line): - print(line) - sys.exit(1) - print("ok") - - sys.stdout.write("publishing some events... ") - sys.stdout.flush() - # The publisher must be run twice because all the events can be - # sent out in one batch to the linked subscriber which means that - # the link is not reaped until the next batch is - # sent. Furthermore, with a replicated IceStorm both sets of - # events must be set to the same replica. - runPublisher(icestorm1, opt = " --count 2") - print("ok") - - # Give the unsubscription time to propagate. - time.sleep(1) - - # Verify that the link has disappeared. - sys.stdout.write("verifying that the link has been destroyed... ") - sys.stdout.flush() - line = admin(adminIceStormReference, "links TestIceStorm1") - nRetry = 5 - while len(line) > 0 and nRetry > 0: - line = admin(adminIceStormReference, "links TestIceStorm1") - time.sleep(1) # Give more time for unsubscription to propagate. - nRetry -= 1 - if len(line) > 0: - print(line) - sys.exit(1) - print("ok") - - # - # Destroy the remaining topic. - # - sys.stdout.write("destroying topics... ") - sys.stdout.flush() - admin(adminIceStormReference, "destroy TestIceStorm1/fed1") - print("ok") - - # - # Shutdown icestorm. - # - sys.stdout.write("shutting down icestorm services... ") - sys.stdout.flush() - icestorm1.stop() - icestorm2.stop() - print("ok") - -runtest("persistent") -runtest("replicated", replicatedPublisher = False) -runtest("replicated", replicatedPublisher = True) - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd()) - -sys.exit(0) diff --git a/cpp/test/IceStorm/federation2/test.py b/cpp/test/IceStorm/federation2/test.py new file mode 100644 index 00000000000..5ac2f315555 --- /dev/null +++ b/cpp/test/IceStorm/federation2/test.py @@ -0,0 +1,196 @@ +# -*- 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. +# +# ********************************************************************** + +# +# Publisher/subscriber test cases, publisher publishes on TestIceStorm1 instance(s) and +# the subscriber subscribes to the TestIceStorm2 instance(s) +# +pub1Sub2Oneway=ClientServerTestCase(client=Publisher("TestIceStorm1"), server=Subscriber("TestIceStorm2")) +pub1Sub2Batch=ClientServerTestCase(client=Publisher("TestIceStorm1"), server=Subscriber("TestIceStorm2", args=["-b"])) + +pub1Sub1Oneway=ClientServerTestCase(client=Publisher("TestIceStorm1"), server=Subscriber("TestIceStorm1")) + +class IceStormFederation2TestCase(IceStormTestCase): + + def runClientSide(self, current): + + current.write("setting up the topics... ") + self.runadmin(current, "create TestIceStorm1/fed1 TestIceStorm2/fed1; link TestIceStorm1/fed1 TestIceStorm2/fed1") + current.writeln("ok") + + # + # Test oneway subscribers. + # + current.write("testing federation with oneway subscribers... ") + pub1Sub2Oneway.run(current) + current.writeln("ok") + + # + # Test batch oneway subscribers. + # + current.write("testing federation with batch subscribers... ") + pub1Sub2Batch.run(current) + current.writeln("ok") + + # + # Test #2: + # + # Stop and restart the service and repeat the test. This ensures that + # the database is correct. + # + current.write("restarting services to ensure that the database content is preserved... ") + self.restartIceStorm(current) + current.writeln("ok") + + # + # Test oneway subscribers. + # + current.write("retesting federation with oneway subscribers... ") + pub1Sub2Oneway.run(current) + current.writeln("ok") + + # + # Test batch oneway subscribers. + # + current.write("retesting federation with batch subscribers... ") + pub1Sub2Batch.run(current) + current.writeln("ok") + + # + # Shutdown icestorm. + # + self.stopIceStorm(current) + + icestorm1 = [icestorm for icestorm in self.icestorm if icestorm.getInstanceName() == "TestIceStorm1"] + icestorm2 = [icestorm for icestorm in self.icestorm if icestorm.getInstanceName() == "TestIceStorm2"] + + # + # Restart the first server and publish some events. Attach a + # subscriber to the channel and make sure the events are received. + # + # Then re-start the linked downstream server and publish the events. + # Ensure they are received by the linked server. + # + if self.getName().find("replicated") == -1: + + current.write("restarting only one IceStorm server... ") + icestorm1[0].start(current) + current.writeln("ok") + + # + # Test oneway subscribers. + # + current.write("testing that the federation link reports an error... ") + pub1Sub1Oneway.run(current) + + # Give some time for the output to be sent. + time.sleep(2) + + icestorm1[0].expect("topic.fed1.*subscriber offline") + current.writeln("ok") + + current.write("starting downstream icestorm server... ") + icestorm2[0].start(current) + current.writeln("ok") + + # + # Need to sleep for at least the discard interval. + # + time.sleep(3) + + # + # Test oneway subscribers. + # + current.write("testing link is reestablished... ") + pub1Sub2Oneway.run(current) + current.writeln("ok") + + try: + icestorm1[0].expect("topic.fed1.*subscriber offline", timeout=1) + assert False + except Expect.TIMEOUT: + pass + + self.stopIceStorm(current) + + # + # Test #4: + # + # Trash the TestIceStorm2 database. Then restart the servers and + # verify that the link is removed. + # + current.write("destroying the downstream IceStorm service database... ") + for s in icestorm2: + s.teardown(current, True) + s.setup(current) + + current.writeln("ok") + + current.write("restarting IceStorm servers... ") + self.startIceStorm(current) + current.writeln("ok") + + current.write("checking link still exists... ") + line = self.runadmin(current, "links TestIceStorm1", quiet=True) + if not re.compile("fed1 with cost 0").search(line): + raise RuntimeError("unexpected output (`{0}')".format(line)) + current.writeln("ok") + + current.write("publishing some events... ") + # The publisher must be run twice because all the events can be + # sent out in one batch to the linked subscriber which means that + # the link is not reaped until the next batch is + # sent. Furthermore, with a replicated IceStorm both sets of + # events must be set to the same replica. + Publisher("TestIceStorm1", args=["--count", 2]).run(current) + current.writeln("ok") + + # Give the unsubscription time to propagate. + time.sleep(1) + + # Verify that the link has disappeared. + current.write("verifying that the link has been destroyed... ") + line = self.runadmin(current, "links TestIceStorm1") + nRetry = 5 + while len(line) > 0 and nRetry > 0: + line = self.runadmin(current, "links TestIceStorm1") + time.sleep(1) # Give more time for unsubscription to propagate. + nRetry -= 1 + if len(line) > 0: + raise RuntimeError("unexpected output (`{0}')".format(line)) + current.writeln("ok") + + # + # Destroy the remaining topic. + # + current.write("destroying topics... ") + self.runadmin(current, "destroy TestIceStorm1/fed1links TestIceStorm1", quiet=True) + current.writeln("ok") + + self.stopIceStorm(current) + +# Override ReplicatedPublishEndpoints property to empty for testing without replicated publisher +props = { 'IceStorm.Discard.Interval' : 2 } +nonRepProps = { 'IceStorm.Discard.Interval' : 2, 'IceStorm.ReplicatedPublishEndpoints' : '' } + +TestSuite(__file__, [ + + IceStormFederation2TestCase("persistent", icestorm= + [IceStorm("TestIceStorm1", quiet=True, props=props), + IceStorm("TestIceStorm2", quiet=True,portnum=20, props=props)]), + + IceStormFederation2TestCase("replicated with non-replicated publisher", icestorm= + [IceStorm("TestIceStorm1", i, 3, quiet=True, props=nonRepProps) for i in range(0,3)] + + [IceStorm("TestIceStorm2", i, 3, quiet=True, portnum=20, props=nonRepProps) for i in range(0,3)]), + + IceStormFederation2TestCase("replicated with replicated publisher", icestorm= + [IceStorm("TestIceStorm1", i, 3, quiet=True, props=props) for i in range(0,3)] + + [IceStorm("TestIceStorm2", i, 3, quiet=True, portnum=20, props=props) for i in range(0,3)]), +], multihost=False) diff --git a/cpp/test/IceStorm/rep1/Publisher.cpp b/cpp/test/IceStorm/rep1/Publisher.cpp index a06662e4b29..b90f8f7300a 100644 --- a/cpp/test/IceStorm/rep1/Publisher.cpp +++ b/cpp/test/IceStorm/rep1/Publisher.cpp @@ -11,6 +11,7 @@ #include <IceUtil/Options.h> #include <IceUtil/IceUtil.h> #include <IceStorm/IceStorm.h> +#include <TestCommon.h> #include <Single.h> using namespace std; @@ -120,10 +121,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/rep1/Sub.cpp b/cpp/test/IceStorm/rep1/Sub.cpp index 5192f61e548..55423322069 100644 --- a/cpp/test/IceStorm/rep1/Sub.cpp +++ b/cpp/test/IceStorm/rep1/Sub.cpp @@ -94,10 +94,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/rep1/Subscriber.cpp b/cpp/test/IceStorm/rep1/Subscriber.cpp index fe23907529f..be1b8e0e36c 100644 --- a/cpp/test/IceStorm/rep1/Subscriber.cpp +++ b/cpp/test/IceStorm/rep1/Subscriber.cpp @@ -186,10 +186,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/rep1/run.py b/cpp/test/IceStorm/rep1/run.py deleted file mode 100755 index 2d058a12d22..00000000000 --- a/cpp/test/IceStorm/rep1/run.py +++ /dev/null @@ -1,292 +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, time, re - -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, IceStormUtil - -publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher")) -subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber")) -subscriber2 = os.path.join(os.getcwd(), TestUtil.getTestExecutable("sub")) - -targets = [] -if TestUtil.appverifier: - targets = [TestUtil.getIceBox(), publisher, subscriber, subscriber2, TestUtil.getIceBoxAdmin(), \ - TestUtil.getIceStormAdmin()] - TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) - -def runsub(opt, ref, arg = "", echo=False): - qos = "" - if opt == "twoway": - qos = " --twoway" - if opt == "ordered": - qos = " --ordered" - return TestUtil.startServer(subscriber, ref + arg + qos) - -def runpub(ref, arg = "", echo=False): - return TestUtil.startClient(publisher, ref + arg) - -def runtest(opt, ref, subopt="", pubopt=""): - subscriberProc = runsub(opt, ref, subopt) - publisherProc = runpub(ref, pubopt) - publisherProc.waitTestSuccess() - subscriberProc.waitTestSuccess() - -def runsub2(replica = -1, expect = None): - proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo', count=0, echo = False) - if expect: - proc.expect(expect) - proc.wait() - else: - proc.waitTestSuccess() - -def rununsub2(replica = -1, expect = None): - if replica == -1: - proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo --unsub', count=0) - proc.waitTestSuccess() - # Else we first subscribe to this replica, then unsub. We - # shouldn't get an AlreadySubscribedException. - proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo', count=0, echo = False) - if expect: - proc.expect(expect) - proc.wait() - return - else: - proc.waitTestSuccess() - proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo --unsub', count=0) - proc.waitTestSuccess() - -icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), "replicated", replicatedPublisher=True, additional = - ' --IceStorm.Election.MasterTimeout=2' + - ' --IceStorm.Election.ElectionTimeout=2' + - ' --IceStorm.Election.ResponseTimeout=2') -icestorm.start() - -sys.stdout.write("testing topic creation across replicas... ") -sys.stdout.flush() -icestorm.admin("create single") - -for replica in range(0, 3): - icestorm.adminForReplica(replica, "create single", "error: topic `single' exists") -print("ok") - -sys.stdout.write("testing topic destruction across replicas... ") -sys.stdout.flush() -icestorm.admin("destroy single") - -for replica in range(0, 3): - icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") -print("ok") - -sys.stdout.write("testing topic creation without replica... ") -sys.stdout.flush() - -icestorm.stopReplica(0) -icestorm.admin("create single") - -for replica in range(1, 3): - icestorm.adminForReplica(replica, "create single", "error: topic `single' exists") - -icestorm.adminForReplica(0, "create single", ["ConnectionRefused", "ConnectFailed"]) - -icestorm.startReplica(0, echo=False) - -icestorm.adminForReplica(0, "create single", "error: topic `single' exists") -print("ok") - -icestorm.admin("destroy single") - -sys.stdout.write("testing topic creation without master... ") -sys.stdout.flush() -icestorm.stopReplica(2) - -icestorm.admin("create single") - -for replica in range(0, 2): - icestorm.adminForReplica(replica, "create single", "error: topic `single' exists") - -icestorm.adminForReplica(2, "create single", ["ConnectionRefused", "ConnectFailed"]) - -icestorm.startReplica(2, echo=False) - -icestorm.adminForReplica(2, "create single", "error: topic `single' exists") -print("ok") - -# All replicas are running - -sys.stdout.write("testing topic destruction without replica... ") -sys.stdout.flush() -icestorm.stopReplica(0) - -icestorm.admin("destroy single") - -for replica in range(1, 3): - icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") - -icestorm.adminForReplica(0, "destroy single", ["ConnectionRefused", "ConnectFailed"]) - -icestorm.startReplica(0, echo=False) - -icestorm.adminForReplica(0, "destroy single", "error: couldn't find topic `single'") -print("ok") - -sys.stdout.write("testing topic destruction without master... ") -sys.stdout.flush() - -icestorm.admin("create single") -icestorm.stopReplica(2) - -icestorm.admin("destroy single") - -for replica in range(0, 2): - icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") - -icestorm.adminForReplica(2, "destroy single", ["ConnectionRefused", "ConnectFailed"]) - -icestorm.startReplica(2, echo=False) - -icestorm.adminForReplica(2, "destroy single", "error: couldn't find topic `single'") -print("ok") - -# Now test subscription/unsubscription on all replicas. - -icestorm.admin("create single") - -sys.stdout.write("testing subscription across replicas... ") -sys.stdout.flush() -runsub2() - -for replica in range(0, 3): - runsub2(replica, "IceStorm::AlreadySubscribed") -print("ok") - -sys.stdout.write("testing unsubscription across replicas... ") -sys.stdout.flush() -rununsub2() - -for replica in range(0, 3): - rununsub2(replica) -print("ok") - -sys.stdout.write("testing subscription without master... ") -sys.stdout.flush() -icestorm.stopReplica(2) - -runsub2() - -for replica in range(0, 2): - runsub2(replica, "IceStorm::AlreadySubscribed") - -runsub2(2, ["ConnectionRefused", "ConnectFailed"]) - -icestorm.startReplica(2, echo=False) - -runsub2(2, "IceStorm::AlreadySubscribed") -print("ok") - -sys.stdout.write("testing unsubscription without master... ") -sys.stdout.flush() -icestorm.stopReplica(2) - -rununsub2() - -for replica in range(0, 2): - rununsub2(replica) - -rununsub2(2, ["ConnectionRefused", "ConnectFailed"]) - -icestorm.startReplica(2, echo=False) - -rununsub2(2) -print("ok") - -sys.stdout.write("testing subscription without replica... ") -sys.stdout.flush() -icestorm.stopReplica(0) - -runsub2() - -for replica in range(1, 3): - runsub2(replica, "IceStorm::AlreadySubscribed") - -runsub2(0, ["ConnectionRefused", "ConnectFailed"]) - -icestorm.startReplica(0, echo=False) - -runsub2(0, "IceStorm::AlreadySubscribed") -print("ok") - -sys.stdout.write("testing unsubscription without replica... ") -sys.stdout.flush() -icestorm.stopReplica(0) - -rununsub2() - -for replica in range(1, 3): - rununsub2(replica) - -rununsub2(0, ["ConnectionRefused", "ConnectFailed"]) - -icestorm.startReplica(0, echo=False) - -rununsub2(0) -print("ok") - -# All replicas are running - -sys.stdout.write("running twoway subscription test... ") -sys.stdout.flush() -runtest("twoway", icestorm.reference()) -print("ok") - -sys.stdout.write("running ordered subscription test... ") -sys.stdout.flush() -runtest("ordered", icestorm.reference()) -print("ok") - -icestorm.stopReplica(2) - -sys.stdout.write("running twoway, ordered subscription test without master... ") -sys.stdout.flush() -runtest("twoway", icestorm.reference()) -runtest("ordered", icestorm.reference()) -print("ok") - -icestorm.startReplica(2, echo = False) -icestorm.stopReplica(0) - -sys.stdout.write("running twoway, ordered subscription test without replica... ") -sys.stdout.flush() -runtest("twoway", icestorm.reference()) -runtest("ordered", icestorm.reference()) -print("ok") - -icestorm.startReplica(0, echo = False) - -sys.stdout.write("running cycle publishing test... ") -sys.stdout.flush() -runtest("twoway", icestorm.reference(), pubopt=" --cycle") -print("ok") - -sys.stdout.write("stopping replicas... ") -sys.stdout.flush() -icestorm.stop() -print("ok") - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd()) diff --git a/cpp/test/IceStorm/rep1/test.py b/cpp/test/IceStorm/rep1/test.py new file mode 100644 index 00000000000..7385a9d8d25 --- /dev/null +++ b/cpp/test/IceStorm/rep1/test.py @@ -0,0 +1,290 @@ +# -*- 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. +# +# ********************************************************************** + +# +# Make sure IceStorm and the subscriber use the same buffer size for +# sending/receiving datagrams. This ensures the test works with bogus +# OS configurations where the reicever buffer size is smaller than the +# send buffer size (causing the received messages to be +# truncated). See also bug #6070. +# +props = { + "IceStorm.Election.MasterTimeout" : 2, + "IceStorm.Election.ElectionTimeout" : 2, + "IceStorm.Election.ResponseTimeout" : 2 +} + +icestorm = [ IceStorm(replica=i, nreplicas=3, props = props) for i in range(0,3) ] + +class IceStormRep1TestCase(IceStormTestCase): + + def runClientSide(self, current): + + def checkExpect(output, expect): + if not expect: + return + + if type(expect) == str: + expect = [expect] + + for e in expect: + if output.find(e) >= 0: + return + else: + raise RuntimeError("unexected output `{0}' (expected `{1}')".format(output, expect)) + + def adminForReplica(replica, cmd, expect): + checkExpect(self.runadmin(current, cmd, instance=self.icestorm[replica], quiet=True, exitstatus=1), + expect) + + def stopReplica(num): + self.icestorm[num].shutdown(current) + self.icestorm[num].stop(current, True) + + def startReplica(num): + self.icestorm[num].start(current) + + def runtest(s="", p=""): + ClientServerTestCase(client=Publisher(args=p.split(" ")), + server=Subscriber(args=s.split(" "))).run(current) + + def runsub2(replica=None, expect=None): + subscriber = Subscriber(exe="sub", + instance=None if replica is None else self.icestorm[replica], + args=["--id", "foo"], + readyCount=0, + quiet=True) + subscriber.run(current, exitstatus=1 if expect else 0) + checkExpect(subscriber.getOutput(), expect) + + def rununsub2(replica=None, expect=None): + sub = Subscriber(exe="sub", + instance=None if replica is None else self.icestorm[replica], + args=["--id", "foo"], + readyCount=0, + quiet=True) + + if replica is None: + sub.run(current, args=["--unsub"]) + # Else we first subscribe to this replica, then unsub. We + # shouldn't get an AlreadySubscribedException. + sub.run(current, exitstatus=1 if expect else 0) + if expect: + checkExpect(sub.getOutput(), expect) + return + + sub.run(current, args=["--unsub"]) + + current.write("testing topic creation across replicas... ") + self.runadmin(current, "create single") + for replica in range(0, 3): + adminForReplica(replica, "create single", "error: topic `single' exists") + current.writeln("ok") + + current.write("testing topic destruction across replicas... ") + sys.stdout.flush() + self.runadmin(current, "destroy single") + + for replica in range(0, 3): + adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") + current.writeln("ok") + + current.write("testing topic creation without replica... ") + + stopReplica(0) + + self.runadmin(current, "create single") + + for replica in range(1, 3): + adminForReplica(replica, "create single", "error: topic `single' exists") + + adminForReplica(0, "create single", ["ConnectionRefused", "ConnectFailed"]) + + startReplica(0) + + adminForReplica(0, "create single", "error: topic `single' exists") + current.writeln("ok") + + self.runadmin(current, "destroy single") + + current.write("testing topic creation without master... ") + sys.stdout.flush() + + stopReplica(2) + + self.runadmin(current, "create single") + + for replica in range(0, 2): + adminForReplica(replica, "create single", "error: topic `single' exists") + + adminForReplica(2, "create single", ["ConnectionRefused", "ConnectFailed"]) + + startReplica(2) + + adminForReplica(2, "create single", "error: topic `single' exists") + current.writeln("ok") + + # All replicas are running + + current.write("testing topic destruction without replica... ") + + stopReplica(0) + + self.runadmin(current, "destroy single") + + for replica in range(1, 3): + adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") + + adminForReplica(0, "destroy single", ["ConnectionRefused", "ConnectFailed"]) + + startReplica(0) + + adminForReplica(0, "destroy single", "error: couldn't find topic `single'") + current.writeln("ok") + + current.write("testing topic destruction without master... ") + sys.stdout.flush() + + self.runadmin(current, "create single") + stopReplica(2) + + self.runadmin(current, "destroy single") + + for replica in range(0, 2): + adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") + + adminForReplica(2, "destroy single", ["ConnectionRefused", "ConnectFailed"]) + + startReplica(2) + + adminForReplica(2, "destroy single", "error: couldn't find topic `single'") + current.writeln("ok") + + # Now test subscription/unsubscription on all replicas. + + self.runadmin(current, "create single") + + current.write("testing subscription across replicas... ") + sys.stdout.flush() + runsub2() + + for replica in range(0, 3): + runsub2(replica, "IceStorm::AlreadySubscribed") + current.writeln("ok") + + current.write("testing unsubscription across replicas... ") + sys.stdout.flush() + rununsub2() + + for replica in range(0, 3): + rununsub2(replica) + current.writeln("ok") + + current.write("testing subscription without master... ") + sys.stdout.flush() + stopReplica(2) + + runsub2() + + for replica in range(0, 2): + runsub2(replica, "IceStorm::AlreadySubscribed") + + runsub2(2, ["ConnectionRefused", "ConnectFailed"]) + + startReplica(2) + + runsub2(2, "IceStorm::AlreadySubscribed") + current.writeln("ok") + + current.write("testing unsubscription without master... ") + sys.stdout.flush() + stopReplica(2) + + rununsub2() + + for replica in range(0, 2): + rununsub2(replica) + + rununsub2(2, ["ConnectionRefused", "ConnectFailed"]) + + startReplica(2) + + rununsub2(2) + current.writeln("ok") + + current.write("testing subscription without replica... ") + sys.stdout.flush() + stopReplica(0) + + runsub2() + + for replica in range(1, 3): + runsub2(replica, "IceStorm::AlreadySubscribed") + + runsub2(0, ["ConnectionRefused", "ConnectFailed"]) + + startReplica(0) + + runsub2(0, "IceStorm::AlreadySubscribed") + current.writeln("ok") + + current.write("testing unsubscription without replica... ") + stopReplica(0) + + rununsub2() + + for replica in range(1, 3): + rununsub2(replica) + + rununsub2(0, ["ConnectionRefused", "ConnectFailed"]) + + startReplica(0) + + rununsub2(0) + current.writeln("ok") + + # All replicas are running + + current.write("running twoway subscription test... ") + runtest("--twoway") + current.writeln("ok") + + current.write("running ordered subscription test... ") + runtest("--ordered") + current.writeln("ok") + + stopReplica(2) + + current.write("running twoway, ordered subscription test without master... ") + runtest("--twoway") + runtest("--ordered") + current.writeln("ok") + + startReplica(2) + stopReplica(0) + + current.write("running twoway, ordered subscription test without replica... ") + runtest("--twoway") + runtest("--ordered") + current.writeln("ok") + + startReplica(0) + + current.write("running cycle publishing test... ") + sys.stdout.flush() + runtest("--twoway", "--cycle") + current.writeln("ok") + + current.write("stopping replicas... ") + sys.stdout.flush() + self.stopIceStorm(current) + current.writeln("ok") + +TestSuite(__file__, [ IceStormRep1TestCase("replicated", icestorm=icestorm) ], multihost=False) diff --git a/cpp/test/IceStorm/repgrid/Client.cpp b/cpp/test/IceStorm/repgrid/Client.cpp index 7941f6fea77..f13afb1cf46 100644 --- a/cpp/test/IceStorm/repgrid/Client.cpp +++ b/cpp/test/IceStorm/repgrid/Client.cpp @@ -117,10 +117,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/repgrid/run.py b/cpp/test/IceStorm/repgrid/run.py deleted file mode 100755 index 5a798964755..00000000000 --- a/cpp/test/IceStorm/repgrid/run.py +++ /dev/null @@ -1,42 +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, IceStormUtil, IceGridAdmin - -targets = [] -if TestUtil.appverifier: - targets = [TestUtil.getIceBox()] - TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) - - -variables = "icebox.exe='%s'" % TestUtil.getIceBox() - -# -# Don't use a slave registry for this test. -# -IceGridAdmin.nreplicas=0 - -# -# Test client/server without on demand activation. -# -IceGridAdmin.iceGridTest("application.xml", "", variables) - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd()) diff --git a/cpp/test/IceStorm/repgrid/test.py b/cpp/test/IceStorm/repgrid/test.py new file mode 100644 index 00000000000..5beb3296d89 --- /dev/null +++ b/cpp/test/IceStorm/repgrid/test.py @@ -0,0 +1,13 @@ +# -*- 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(icegridregistry=IceGridRegistryMaster(), + client=IceGridClient()) ], + runOnMainThread=True, multihost=False)
\ No newline at end of file diff --git a/cpp/test/IceStorm/repstress/Control.cpp b/cpp/test/IceStorm/repstress/Control.cpp index 1fe321b5533..c04289cdbad 100644 --- a/cpp/test/IceStorm/repstress/Control.cpp +++ b/cpp/test/IceStorm/repstress/Control.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <Controller.h> +#include <TestCommon.h> using namespace std; using namespace Ice; @@ -34,10 +35,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/repstress/Publisher.cpp b/cpp/test/IceStorm/repstress/Publisher.cpp index b38212ff427..b8a91876a9e 100644 --- a/cpp/test/IceStorm/repstress/Publisher.cpp +++ b/cpp/test/IceStorm/repstress/Publisher.cpp @@ -12,6 +12,7 @@ #include <IceStorm/IceStorm.h> #include <Single.h> #include <Controller.h> +#include <TestCommon.h> using namespace std; using namespace Ice; @@ -71,7 +72,7 @@ public: Lock sync(*this); _destroy = true; } - + private: const SinglePrx _single; @@ -109,7 +110,7 @@ run(int, char* argv[], const CommunicatorPtr& communicator) { cerr << argv[0] << ": NoSuchTopic: " << e.name << endl; return EXIT_FAILURE; - + } assert(topic); @@ -140,10 +141,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/repstress/Subscriber.cpp b/cpp/test/IceStorm/repstress/Subscriber.cpp index a19aea9aca6..6ac382ce38c 100644 --- a/cpp/test/IceStorm/repstress/Subscriber.cpp +++ b/cpp/test/IceStorm/repstress/Subscriber.cpp @@ -132,10 +132,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/repstress/run.py b/cpp/test/IceStorm/repstress/run.py deleted file mode 100755 index 6e616437cf1..00000000000 --- a/cpp/test/IceStorm/repstress/run.py +++ /dev/null @@ -1,125 +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, time, re - -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, IceStormUtil - -publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher")) -subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber")) -control = os.path.join(os.getcwd(), TestUtil.getTestExecutable("control")) - -targets = [] -if TestUtil.appverifier: - targets = [TestUtil.getIceBox(), publisher, subscriber, control, TestUtil.getIceBoxAdmin(), \ - TestUtil.getIceStormAdmin()] - TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) - -def runcontrol(proxy): - proc = TestUtil.startClient(control, ' "%s"' % proxy) - proc.waitTestSuccess() - -icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), "replicated", replicatedPublisher=True, additional = - ' --IceStorm.Election.MasterTimeout=2' + - ' --IceStorm.Election.ElectionTimeout=2' + - ' --IceStorm.Election.ResponseTimeout=2') -icestorm.start() - -sys.stdout.write("creating topic... ") -sys.stdout.flush() -icestorm.admin("create single") -print("ok") - -sys.stdout.write("running subscriber... ") -sys.stdout.flush() -subscriberProc = TestUtil.startServer(subscriber, ' --Ice.ServerIdleTime=0 ' + icestorm.reference(), echo = False) -subscriberProc.expect("([^\n]+)\n") -subControl = subscriberProc.match.group(1) -print("ok") - -sys.stdout.write("running publisher... ") -sys.stdout.flush() -publisherProc = TestUtil.startServer(publisher, ' --Ice.ServerIdleTime=0 ' + icestorm.reference(), echo = False) -publisherProc.expect("([^\n]+)\n") -pubControl = publisherProc.match.group(1) -print("ok") - -time.sleep(2) - -for i in range(0, 3): - # 0, 1 - sys.stdout.write("stopping replica 2 (0, 1 running)... ") - sys.stdout.flush() - icestorm.stopReplica(2) - print("ok") - time.sleep(2) - - # 1, 2 - sys.stdout.write("starting 2, stopping 0 (1, 2 running)... ") - sys.stdout.flush() - icestorm.startReplica(2, echo=False) - icestorm.stopReplica(0) - print("ok") - # This waits for the replication to startup - #icestorm.admin("list") - time.sleep(2) - - # 0, 2 - sys.stdout.write("starting 0, stopping 1 (0, 2 running)... ") - sys.stdout.flush() - icestorm.startReplica(0, echo=False) - icestorm.stopReplica(1) - print("ok") - # This waits for the replication to startup - #icestorm.admin("list") - time.sleep(2) - - sys.stdout.write("starting 1 (all running)... ") - sys.stdout.flush() - icestorm.startReplica(1, echo=False) - print("ok") - # This waits for the replication to startup - #icestorm.admin("list") - - time.sleep(2) - -sys.stdout.write("stopping publisher... ") -sys.stdout.flush() -runcontrol(pubControl) -publisherProc.expect("([^\n]+)\n") -publisherCount = publisherProc.match.group(1) -publisherProc.waitTestSuccess() -print("ok") - -sys.stdout.write("stopping replicas... ") -sys.stdout.flush() -icestorm.stop() -print("ok") - -sys.stdout.write("stopping subscriber... ") -sys.stdout.flush() -runcontrol(subControl) -subscriberProc.expect("([^\n]+)\n") -subscriberCount = subscriberProc.match.group(1) -subscriberProc.waitTestSuccess() -print("ok") - -print("publisher published %s events, subscriber received %s events" % (publisherCount, subscriberCount)) - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd()) diff --git a/cpp/test/IceStorm/repstress/test.py b/cpp/test/IceStorm/repstress/test.py new file mode 100644 index 00000000000..f61befa8961 --- /dev/null +++ b/cpp/test/IceStorm/repstress/test.py @@ -0,0 +1,113 @@ +# -*- 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. +# +# ********************************************************************** + +# +# Make sure IceStorm and the subscriber use the same buffer size for +# sending/receiving datagrams. This ensures the test works with bogus +# OS configurations where the reicever buffer size is smaller than the +# send buffer size (causing the received messages to be +# truncated). See also bug #6070. +# +props = { + "IceStorm.Election.MasterTimeout" : 2, + "IceStorm.Election.ElectionTimeout" : 2, + "IceStorm.Election.ResponseTimeout" : 2, + "Ice.Warn.Dispatch" : 0 +} + +icestorm = [ IceStorm(replica=i, nreplicas=3, props = props) for i in range(0,3) ] + +class IceStormRepStressTestCase(IceStormTestCase): + + def runClientSide(self, current): + + def stopReplica(num): + self.icestorm[num].shutdown(current) + self.icestorm[num].stop(current, True) + + def startReplica(num): + self.icestorm[num].start(current) + + current.write("creating topic... ") + self.runadmin(current, "create single") + current.writeln("ok") + + current.write("running subscriber... ") + subscriber = Subscriber(quiet=True) + subscriber.start(current) + subscriber.expect("([^\n]+)\n") + subControl = subscriber.process.match.group(1) + current.writeln("ok") + + current.write("running publisher... ") + publisher = Publisher(quiet=True) + publisher.start(current) + publisher.expect("([^\n]+)\n") + pubControl = publisher.process.match.group(1) + current.writeln("ok") + + time.sleep(2) + + for i in range(0, 3): + # 0, 1 + current.write("stopping replica 2 (0, 1 running)... ") + stopReplica(2) + current.writeln("ok") + time.sleep(2) + + # 1, 2 + current.write("starting 2, stopping 0 (1, 2 running)... ") + startReplica(2) + stopReplica(0) + current.writeln("ok") + # This waits for the replication to startup + #self.runadmin(current, "list") + time.sleep(2) + + # 0, 2 + current.write("starting 0, stopping 1 (0, 2 running)... ") + startReplica(0) + stopReplica(1) + current.writeln("ok") + # This waits for the replication to startup + #self.runadmin(current, "list") + time.sleep(2) + + current.write("starting 1 (all running)... ") + startReplica(1) + current.writeln("ok") + # This waits for the replication to startup + #self.runadmin(current, "list") + time.sleep(2) + + current.write("stopping publisher... ") + Client(exe="control", args=[pubControl]).run(current) + publisher.expect("([^\n]+)\n") + publisherCount = publisher.process.match.group(1) + publisher.stop(current, True) + current.writeln("ok") + + current.write("stopping replicas... ") + self.stopIceStorm(current) + current.writeln("ok") + + current.write("stopping subscriber... ") + Client(exe="control", args=[subControl]).run(current) + subscriber.expect("([^\n]+)\n") + subscriberCount = subscriber.process.match.group(1) + subscriber.stop(current, True) + current.writeln("ok") + + current.writeln("publisher published %s events, subscriber received %s events" % (publisherCount, subscriberCount)) + +TestSuite(__file__, + [ IceStormRepStressTestCase("replicated", icestorm=icestorm) ], + options={ "ipv6" : [False] }, + multihost=False) diff --git a/cpp/test/IceStorm/single/0.db/.gitignore b/cpp/test/IceStorm/single/0.db/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/cpp/test/IceStorm/single/0.db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/cpp/test/IceStorm/single/1.db/.gitignore b/cpp/test/IceStorm/single/1.db/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/cpp/test/IceStorm/single/1.db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/cpp/test/IceStorm/single/2.db/.gitignore b/cpp/test/IceStorm/single/2.db/.gitignore deleted file mode 100644 index 72e8ffc0db8..00000000000 --- a/cpp/test/IceStorm/single/2.db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/cpp/test/IceStorm/single/Publisher.cpp b/cpp/test/IceStorm/single/Publisher.cpp index 8c06e428955..a88dff82add 100644 --- a/cpp/test/IceStorm/single/Publisher.cpp +++ b/cpp/test/IceStorm/single/Publisher.cpp @@ -9,6 +9,7 @@ #include <Ice/Ice.h> #include <IceStorm/IceStorm.h> +#include <TestCommon.h> #include <Single.h> using namespace std; @@ -70,7 +71,8 @@ main(int argc, char* argv[]) try { - communicator = initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp index f2ee78ee554..7b4c0a17351 100644 --- a/cpp/test/IceStorm/single/Subscriber.cpp +++ b/cpp/test/IceStorm/single/Subscriber.cpp @@ -251,7 +251,8 @@ main(int argc, char* argv[]) try { - communicator = initialize(argc, argv); + Ice::InitializationData initData = getTestInitData(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/single/db/.gitignore b/cpp/test/IceStorm/single/db/.gitignore deleted file mode 100644 index 39af5887579..00000000000 --- a/cpp/test/IceStorm/single/db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -# Dummy file, so that git retains this otherwise empty directory. diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py deleted file mode 100755 index 162854b9084..00000000000 --- a/cpp/test/IceStorm/single/run.py +++ /dev/null @@ -1,89 +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 -import time - -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, IceStormUtil - -publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher")) -subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber")) - -# -# Make sure IceStorm and the subscriber use the same buffer size for -# sending/receiving datagrams. This ensures the test works with bogus -# OS configurations where the reicever buffer size is smaller than the -# send buffer size (causing the received messages to be -# truncated). See also bug #6070. -# -iceStormArgs = " --Ice.UDP.SndSize=4096" -subscriberArgs = " --Ice.UDP.RcvSize=4096" - -targets = [] -if TestUtil.appverifier: - targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin()] - TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) - -def dotest(type): - icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional=iceStormArgs) - icestorm.start() - - sys.stdout.write("creating topic... ") - sys.stdout.flush() - icestorm.admin("create single") - print("ok") - - sys.stdout.write("starting subscriber... ") - sys.stdout.flush() - subscriberProc = TestUtil.startServer(subscriber, icestorm.reference() + subscriberArgs + " " + type, count = 3) - print("ok") - - # - # Start the publisher. This should publish 10 events which eventually - # causes subscriber to terminate. - # - sys.stdout.write("starting publisher... ") - sys.stdout.flush() - publisherProc = TestUtil.startClient(publisher, icestorm.reference(), startReader = False) - print("ok") - publisherProc.startReader() - - subscriberProc.waitTestSuccess() - publisherProc.waitTestSuccess() - - # - # Destroy the topic. - # - sys.stdout.write("destroy topic... ") - sys.stdout.flush() - icestorm.admin("destroy single") - print("ok") - - # - # Shutdown icestorm. - # - icestorm.stop() - -dotest("persistent") -dotest("transient") -dotest("replicated") - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd([targets], cwd = os.getcwd()) - -sys.exit(0) diff --git a/cpp/test/IceStorm/single/test.py b/cpp/test/IceStorm/single/test.py new file mode 100644 index 00000000000..b4e5848e2b0 --- /dev/null +++ b/cpp/test/IceStorm/single/test.py @@ -0,0 +1,39 @@ +# -*- 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. +# +# ********************************************************************** + +# +# Make sure IceStorm and the subscriber use the same buffer size for +# sending/receiving datagrams. This ensures the test works with bogus +# OS configurations where the reicever buffer size is smaller than the +# send buffer size (causing the received messages to be +# truncated). See also bug #6070. +# +props = { "Ice.UDP.SndSize" : 4096, "Ice.Warn.Dispatch" : 0 } +persistent = IceStorm(props = props) +transient = IceStorm(props = props, transient=True) +replicated = [ IceStorm(replica=i, nreplicas=3, props = props) for i in range(0,3) ] + +sub = Subscriber(args=["{testcase.parent.name}"], props = { "Ice.UDP.RcvSize" : 4096 }, readyCount=3) +pub = Publisher(args=["{testcase.parent.name}"]) + +class IceStormSingleTestCase(IceStormTestCase): + + def setupClientSide(self, current): + self.runadmin(current, "create single") + + def teardownClientSide(self, current, success): + self.runadmin(current, "destroy single") + self.shutdown(current) + +TestSuite(__file__, [ + IceStormSingleTestCase("persistent", icestorm=persistent, client=ClientServerTestCase(client=pub, server=sub)), + IceStormSingleTestCase("transient", icestorm=transient, client=ClientServerTestCase(client=pub, server=sub)), + IceStormSingleTestCase("replicated", icestorm=replicated, client=ClientServerTestCase(client=pub, server=sub)), +], multihost=False) diff --git a/cpp/test/IceStorm/stress/Publisher.cpp b/cpp/test/IceStorm/stress/Publisher.cpp index 6b9c7801f68..7d41977191a 100644 --- a/cpp/test/IceStorm/stress/Publisher.cpp +++ b/cpp/test/IceStorm/stress/Publisher.cpp @@ -11,6 +11,7 @@ #include <IceUtil/Options.h> #include <IceStorm/IceStorm.h> #include <Event.h> +#include <TestCommon.h> using namespace std; using namespace Ice; @@ -117,10 +118,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/stress/Subscriber.cpp b/cpp/test/IceStorm/stress/Subscriber.cpp index 132bd5c4d34..1baa978ae3f 100644 --- a/cpp/test/IceStorm/stress/Subscriber.cpp +++ b/cpp/test/IceStorm/stress/Subscriber.cpp @@ -515,10 +515,10 @@ main(int argc, char* argv[]) { int status; CommunicatorPtr communicator; - + InitializationData initData = getTestInitData(argc, argv); try { - communicator = initialize(argc, argv); + communicator = initialize(argc, argv, initData); status = run(argc, argv, communicator); } catch(const Exception& ex) diff --git a/cpp/test/IceStorm/stress/run.py b/cpp/test/IceStorm/stress/run.py deleted file mode 100755 index ea56f3ed0a5..00000000000 --- a/cpp/test/IceStorm/stress/run.py +++ /dev/null @@ -1,204 +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, time, threading, re - -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, IceStormUtil - -iceStormAdmin = TestUtil.getIceStormAdmin() - -publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher")) -subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber")) - -targets = [] -if TestUtil.appverifier: - targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), \ - TestUtil.getIceStormAdmin()] - TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd()) - -def doTest(server1, server2, subOpts, pubOpts): - - subscriberProcs = [] - if type(subOpts) != type([]): - subOpts = [ subOpts ] - for opts in subOpts: - # We don't want the subscribers to time out. - proc = TestUtil.startServer(subscriber, ' --Ice.ServerIdleTime=0 ' + opts) - subscriberProcs.append(proc) - - publisherProc = TestUtil.startClient(publisher, server1.reference() + r' ' + pubOpts) - publisherProc.waitTestSuccess() - for p in subscriberProcs: - sys.stdout.flush() - p.waitTestSuccess() - - return 0 - -def runAdmin(cmd, desc = None): - global iceStormAdmin - global iceStormAdminReference - if desc: - sys.stdout.write(desc + " ") - sys.stdout.flush() - proc = TestUtil.startClient(iceStormAdmin, adminIceStormReference + r' -e "%s"' % cmd, startReader = True) - proc.waitTestSuccess() - if desc: - print("ok") - -def runtest(type): - # Clear the idle timeout otherwise the IceBox ThreadPool will timeout. - server1 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, dbDir = "db", instanceName = "TestIceStorm1", - port = 12000) - server2 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, dbDir = "db2", instanceName = "TestIceStorm2", - port = 12500) - global adminIceStormReference - adminIceStormReference = ' --IceStormAdmin.TopicManager.Proxy="%s" --IceStormAdmin.TopicManager.Proxy2="%s"' % ( - server1.proxy(), server2.proxy()) - - sys.stdout.write("starting icestorm services... ") - sys.stdout.flush() - server1.start(echo=False) - server2.start(echo=False) - print("ok") - - runAdmin("create TestIceStorm1/fed1 TestIceStorm2/fed1", "setting up the topics...") - - sys.stdout.write("Sending 5000 ordered events... ") - sys.stdout.flush() - doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server1.reference(), '--events 5000') - print("ok") - - runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - sys.stdout.write("Sending 5000 ordered events across a link... ") - sys.stdout.flush() - doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server2.reference(), '--events 5000') - print("ok") - - runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") - sys.stdout.write("Sending 20000 unordered events... ") - sys.stdout.flush() - doTest(server1, server2, '--events 20000 ' + server1.reference(), '--events 20000 --oneway') - print("ok") - - runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - sys.stdout.write("Sending 20000 unordered events across a link... ") - sys.stdout.flush() - doTest(server1, server2, '--events 20000 ' + server2.reference(), '--events 20000 --oneway') - print("ok") - - runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") - sys.stdout.write("Sending 20000 unordered batch events... ") - sys.stdout.flush() - doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server1.reference(), '--events 20000 --oneway') - print("ok") - - runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - sys.stdout.write("Sending 20000 unordered batch events across a link... ") - sys.stdout.flush() - doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server2.reference(), '--events 20000 --oneway') - print("ok") - - runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") - sys.stdout.write("Sending 20000 unordered events with slow subscriber... ") - sys.stdout.flush() - doTest(server1, server2, ['--events 2 --slow ' + server1.reference(), '--events 20000 ' + server1.reference()], '--events 20000 --oneway') - print("ok") - - runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - sys.stdout.write("Sending 20000 unordered events with slow subscriber & link... ") - sys.stdout.flush() - doTest(server1, server2, ['--events 2 --slow' + server1.reference(), '--events 20000' + server1.reference(), '--events 2 --slow' + server2.reference(), '--events 20000' + server2.reference()], '--events 20000 --oneway') - print("ok") - - sys.stdout.write("shutting down icestorm services... ") - sys.stdout.flush() - server1.stop() - server2.stop() - print("ok") - - sys.stdout.write("starting icestorm services... ") - sys.stdout.flush() - # - # The erratic tests emit lots of connection warnings so they are - # disabled here. The IceStorm servers are stopped and restarted so the - # settings will take effect. - # - server1.start(echo=False, additionalOptions = ' --Ice.Warn.Connections=0') - server2.start(echo=False, additionalOptions = ' --Ice.Warn.Connections=0') - print("ok") - - runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") - - sys.stdout.write("Sending 20000 unordered events with erratic subscriber... ") - sys.stdout.flush() - doTest(server1, server2, - [ '--erratic 5 --qos "reliability,ordered" --events 20000' + server1.reference(), - '--erratic 5 --events 20000' + server1.reference(), - '--events 20000' + server1.reference()], - '--events 20000 --oneway') - print("ok") - - runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - sys.stdout.write("Sending 20000 unordered events with erratic subscriber across a link... ") - sys.stdout.flush() - doTest(server1, server2, - [ '--events 20000' + server1.reference(), - '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server1.reference(), - '--erratic 5 --events 20000 ' + server1.reference(), - '--events 20000' + server2.reference(), - '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server2.reference(), - '--erratic 5 --events 20000 ' + server2.reference()], - '--events 20000 --oneway ') - print("ok") - - # - # Shutdown icestorm. - # - sys.stdout.write("shutting down icestorm services... ") - sys.stdout.flush() - server1.stop() - server2.stop() - print("ok") - - sys.stdout.write("Sending 5000 ordered events with max queue size drop events... ") - sys.stdout.flush() - opts = " --IceStorm.Send.QueueSizeMax=2000 --IceStorm.Send.QueueSizeMaxPolicy=DropEvents" - server1.start(echo=False, additionalOptions = opts) - doTest(server1, server2, - '--events 5000 --qos "reliability,ordered" --maxQueueDropEvents=2000 ' + server1.reference(), - '--events 5000 --maxQueueTest') - server1.stop() - print("ok") - - sys.stdout.write("Sending 5000 ordered events with max queue size remove subscriber... ") - sys.stdout.flush() - opts = " --IceStorm.Send.QueueSizeMax=2000 --IceStorm.Send.QueueSizeMaxPolicy=RemoveSubscriber" - server1.start(echo=False, additionalOptions = opts) - doTest(server1, server2, - '--events 5000 --qos "reliability,ordered" --maxQueueRemoveSub=2000 ' + server1.reference(), - '--events 5000 --maxQueueTest') - server1.stop() - print("ok") - - - -runtest("persistent") -runtest("replicated") - -if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd()) diff --git a/cpp/test/IceStorm/stress/test.py b/cpp/test/IceStorm/stress/test.py new file mode 100644 index 00000000000..16f30f28a30 --- /dev/null +++ b/cpp/test/IceStorm/stress/test.py @@ -0,0 +1,155 @@ +# -*- 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. +# +# ********************************************************************** + +# +# Publisher/subscriber test cases, publisher publishes on TestIceStorm1 instance(s) and +# the subscriber subscribes to the TestIceStorm2 instance(s) +# +pubSub=lambda si, pi, s={}, p={}: ClientServerTestCase(client=Publisher(args=s), server=Subscriber(args=p)) + +class IceStormStressTestCase(IceStormTestCase): + + def runClientSide(self, current): + + icestorm1 = [icestorm for icestorm in self.icestorm if icestorm.getInstanceName() == "TestIceStorm1"] + icestorm2 = [icestorm for icestorm in self.icestorm if icestorm.getInstanceName() == "TestIceStorm2"] + + def doTest(subOpts, pubOpts): + # Create the subscribers + subscribers = [] + for (instanceName, opts) in subOpts if type(subOpts) == list else [subOpts]: + subscribers.append(Subscriber(instanceName or "TestIceStorm1", args=opts.split(" "))) + + # Create the publisher + publisher = Publisher("TestIceStorm1", args=pubOpts.split(" ")) + + # Run the test case + ClientServerTestCase(client=publisher, servers=subscribers).run(current) + + current.write("setting up the topics...") + self.runadmin(current, "create TestIceStorm1/fed1 TestIceStorm2/fed1") + current.writeln("ok") + + current.write("Sending 5000 ordered events... ") + doTest(("TestIceStorm1", '--events 5000 --qos "reliability,ordered"'), '--events 5000') + current.writeln("ok") + + self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 5000 ordered events across a link... ") + doTest(("TestIceStorm2", '--events 5000 --qos "reliability,ordered"'), '--events 5000') + current.writeln("ok") + + self.runadmin(current, "unlink TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 20000 unordered events... ") + doTest(("TestIceStorm1", '--events 20000'), '--events 20000 --oneway') + current.writeln("ok") + + self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 20000 unordered events across a link... ") + doTest(("TestIceStorm2", '--events 20000'), '--events 20000 --oneway') + current.writeln("ok") + + self.runadmin(current, "unlink TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 20000 unordered batch events... ") + doTest(("TestIceStorm1", '--events 20000 --qos "reliability,batch"'), '--events 20000 --oneway') + current.writeln("ok") + + self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 20000 unordered batch events across a link... ") + doTest(("TestIceStorm2", '--events 20000 --qos "reliability,batch"'), '--events 20000 --oneway') + current.writeln("ok") + + self.runadmin(current, "unlink TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 20000 unordered events with slow subscriber... ") + doTest([("TestIceStorm1", '--events 2 --slow'), + ("TestIceStorm1", '--events 20000 ')], + '--events 20000 --oneway') + current.writeln("ok") + + self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 20000 unordered events with slow subscriber & link... ") + doTest([("TestIceStorm1", '--events 2 --slow'), + ("TestIceStorm1", '--events 20000'), + ("TestIceStorm2", '--events 2 --slow'), + ("TestIceStorm2", '--events 20000')], + '--events 20000 --oneway') + current.writeln("ok") + + current.write("shutting down icestorm services... ") + self.stopIceStorm(current) + current.writeln("ok") + + current.write("starting icestorm services... ") + # + # The erratic tests emit lots of connection warnings so they are + # disabled here. The IceStorm servers are stopped and restarted so the + # settings will take effect. + # + self.startIceStorm(current) + current.writeln("ok") + + self.runadmin(current, "unlink TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 20000 unordered events with erratic subscriber... ") + doTest([ ("TestIceStorm1", '--erratic 5 --qos "reliability,ordered" --events 20000'), + ("TestIceStorm1", '--erratic 5 --events 20000'), + ("TestIceStorm1", '--events 20000')], + '--events 20000 --oneway') + current.writeln("ok") + + self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1") + current.write("Sending 20000 unordered events with erratic subscriber across a link... ") + doTest([ ("TestIceStorm1", '--events 20000'), + ("TestIceStorm1", '--erratic 5 --qos "reliability,ordered" --events 20000 '), + ("TestIceStorm1", '--erratic 5 --events 20000 '), + ("TestIceStorm2", '--events 20000'), + ("TestIceStorm2", '--erratic 5 --qos "reliability,ordered" --events 20000 '), + ("TestIceStorm2", '--erratic 5 --events 20000 ')], + '--events 20000 --oneway ') + current.writeln("ok") + + # + # Shutdown icestorm. + # + current.write("shutting down icestorm services... ") + self.stopIceStorm(current) + current.writeln("ok") + + current.write("Sending 5000 ordered events with max queue size drop events... ") + opts = " --IceStorm.Send.QueueSizeMax=2000 --IceStorm.Send.QueueSizeMaxPolicy=DropEvents" + for s in icestorm1: + s.start(current, args=opts.split(" ")) + doTest(("TestIceStorm1", '--events 5000 --qos "reliability,ordered" --maxQueueDropEvents=2000'), + '--events 5000 --maxQueueTest') + for s in icestorm1: + s.shutdown(current) + s.stop(current, True) + current.writeln("ok") + + current.write("Sending 5000 ordered events with max queue size remove subscriber... ") + opts = " --IceStorm.Send.QueueSizeMax=2000 --IceStorm.Send.QueueSizeMaxPolicy=RemoveSubscriber" + for s in icestorm1: + s.start(current, args=opts.split(" ")) + doTest(("TestIceStorm1", '--events 5000 --qos "reliability,ordered" --maxQueueRemoveSub=2000'), + '--events 5000 --maxQueueTest') + for s in icestorm1: + s.shutdown(current) + s.stop(current, True) + current.writeln("ok") + +TestSuite(__file__, [ + + IceStormStressTestCase("persistent", icestorm=[IceStorm("TestIceStorm1", quiet=True), + IceStorm("TestIceStorm2", quiet=True, portnum=20)]), + + IceStormStressTestCase("replicated with replicated publisher", icestorm= + [IceStorm("TestIceStorm1", i, 3, quiet=True) for i in range(0,3)] + + [IceStorm("TestIceStorm2", i, 3, portnum=20, quiet=True) for i in range(0,3)]), + +], multihost=False) diff --git a/cpp/test/IceUtil/condvar/run.py b/cpp/test/IceUtil/condvar/run.py deleted file mode 100755 index 2d25b9060d4..00000000000 --- a/cpp/test/IceUtil/condvar/run.py +++ /dev/null @@ -1,33 +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 - -workqueue = os.path.join(os.getcwd(), TestUtil.getTestExecutable("workqueue")) - -TestUtil.simpleTest(workqueue) - -match = os.path.join(os.getcwd(), TestUtil.getTestExecutable("match")) - -TestUtil.simpleTest(match) - -# Don't use simpleTest(match + " -b") this will confuse -# appverifier about the name of target exe -TestUtil.simpleTest(match, " -b") diff --git a/cpp/test/IceUtil/ctrlCHandler/test.py b/cpp/test/IceUtil/ctrlCHandler/test.py new file mode 100644 index 00000000000..6dda05ec6ec --- /dev/null +++ b/cpp/test/IceUtil/ctrlCHandler/test.py @@ -0,0 +1,10 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +# Dummy file to not run this test which is only ran manually.
\ No newline at end of file diff --git a/cpp/test/IceUtil/inputUtil/run.py b/cpp/test/IceUtil/inputUtil/run.py deleted file mode 100755 index cc23013f5c5..00000000000 --- a/cpp/test/IceUtil/inputUtil/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client, os.getcwd()) diff --git a/cpp/test/IceUtil/priority/run.py b/cpp/test/IceUtil/priority/run.py deleted file mode 100755 index fb7a3661cd8..00000000000 --- a/cpp/test/IceUtil/priority/run.py +++ /dev/null @@ -1,25 +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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client, os.getcwd()) diff --git a/cpp/test/IceUtil/priority/test.py b/cpp/test/IceUtil/priority/test.py new file mode 100644 index 00000000000..30e287825fb --- /dev/null +++ b/cpp/test/IceUtil/priority/test.py @@ -0,0 +1,11 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +if not isinstance(platform, Darwin) and (isinstance(platform, Windows) or os.getuid() == 0): + TestSuite(__name__) diff --git a/cpp/test/IceUtil/sha1/run.py b/cpp/test/IceUtil/sha1/run.py deleted file mode 100755 index d06758d0994..00000000000 --- a/cpp/test/IceUtil/sha1/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/IceUtil/stacktrace/run.py b/cpp/test/IceUtil/stacktrace/run.py deleted file mode 100755 index d06758d0994..00000000000 --- a/cpp/test/IceUtil/stacktrace/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/IceUtil/stacktrace/test.py b/cpp/test/IceUtil/stacktrace/test.py new file mode 100644 index 00000000000..f371bb23ced --- /dev/null +++ b/cpp/test/IceUtil/stacktrace/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(__name__, options = { "cpp11" : [False] }) diff --git a/cpp/test/IceUtil/thread/run.py b/cpp/test/IceUtil/thread/run.py deleted file mode 100755 index fb7a3661cd8..00000000000 --- a/cpp/test/IceUtil/thread/run.py +++ /dev/null @@ -1,25 +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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client, os.getcwd()) diff --git a/cpp/test/IceUtil/timer/run.py b/cpp/test/IceUtil/timer/run.py deleted file mode 100755 index d06758d0994..00000000000 --- a/cpp/test/IceUtil/timer/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/IceUtil/unicode/run.py b/cpp/test/IceUtil/unicode/run.py deleted file mode 100755 index 3a33273413b..00000000000 --- a/cpp/test/IceUtil/unicode/run.py +++ /dev/null @@ -1,25 +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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client, '"%s"' % os.getcwd()) diff --git a/cpp/test/IceUtil/unicode/test.py b/cpp/test/IceUtil/unicode/test.py new file mode 100644 index 00000000000..b3da595727d --- /dev/null +++ b/cpp/test/IceUtil/unicode/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(__name__, [ ClientTestCase(client=SimpleClient(args=["{testdir}"])) ]) diff --git a/cpp/test/IceUtil/uuid/run.py b/cpp/test/IceUtil/uuid/run.py deleted file mode 100755 index d06758d0994..00000000000 --- a/cpp/test/IceUtil/uuid/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py deleted file mode 100755 index d1a194258d4..00000000000 --- a/cpp/test/Slice/errorDetection/run.py +++ /dev/null @@ -1,69 +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, re - -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 os.getcwd()!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -slice2cpp = '"%s"' % TestUtil.getSliceTranslator() - -regex1 = re.compile("\.ice$", re.IGNORECASE) -files = [] -for file in os.listdir(os.getcwd()): - if(regex1.search(file)): - files.append(file) - -files.sort() - -for file in files: - - sys.stdout.write(file + "... ") - sys.stdout.flush() - - if file.find("Underscore") != -1: - command = slice2cpp + ' --underscore -I. "%s"' % os.path.join(os.getcwd(), file) - else: - command = slice2cpp + ' -I. "%s"' % os.path.join(os.getcwd(), file) - p = TestUtil.runCommand(command) - (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr) - - lines1 = stderr.readlines() - lines2 = open(os.path.join(os.getcwd(), regex1.sub(".err", file)), "r").readlines() - if len(lines1) != len(lines2): - print("failed!") - sys.exit(1) - - regex2 = re.compile("^.*(?=" + file + ")") - i = 0 - while i < len(lines1): - if sys.version_info[0] == 2: - line1 = regex2.sub("", lines1[i]).strip() - line2 = regex2.sub("", lines2[i]).strip() - else: - line1 = regex2.sub("", lines1[i].decode("utf-8")).strip() - line2 = regex2.sub("", lines2[i]).strip() - if line1 != line2: - print("\n" + line1) - print("\n" + line2) - print("failed!") - sys.exit(1) - i = i + 1 - else: - print("ok") - -sys.exit(0) diff --git a/cpp/test/Slice/errorDetection/test.py b/cpp/test/Slice/errorDetection/test.py new file mode 100644 index 00000000000..71953c3086c --- /dev/null +++ b/cpp/test/Slice/errorDetection/test.py @@ -0,0 +1,49 @@ +# -*- 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. +# +# ********************************************************************** + +import glob + +class SliceErrorDetectionTestCase(ClientTestCase): + + def runClientSide(self, current): + testdir = self.getPath() + slice2cpp = SliceTranslator("slice2cpp") + + files = glob.glob("{0}/*.ice".format(testdir)) + files.sort() + for file in files: + current.write(os.path.basename(file) + "... ") + + args = ["-I.", file] + if file.find("Underscore") >= 0: + args.append("--underscore") + + # Don't print out slice2cpp output and expect failures + slice2cpp.run(current, args=args, exitstatus=1) + output = slice2cpp.getOutput() + + regex1 = re.compile("\.ice$", re.IGNORECASE) + lines1 = output.strip().split("\n") + lines2 = open(os.path.join(testdir, regex1.sub(".err", file)), "r").readlines() + if len(lines1) != len(lines2): + raise RuntimeError("failed (lines1 = {0}, lines2 = {1})!".format(len(lines1), len(lines2))) + + regex2 = re.compile("^.*(?=" + os.path.basename(file) + ")") + i = 0 + while i < len(lines1): + line1 = regex2.sub("", lines1[i]).strip() + line2 = regex2.sub("", lines2[i]).strip() + if line1 != line2: + raise RuntimeError("failed! (line1 = \"{0}\", line2 = \"{1}\"".format(line1, line2)) + i = i + 1 + else: + current.writeln("ok") + +TestSuite(__name__, [ SliceErrorDetectionTestCase() ]) diff --git a/cpp/test/Slice/headers/run.py b/cpp/test/Slice/headers/run.py deleted file mode 100755 index 0747f0c8e63..00000000000 --- a/cpp/test/Slice/headers/run.py +++ /dev/null @@ -1,156 +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, re - -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 - -def clean(): - for f in ["iceslices", - "linktoslices", - os.path.join("slices", "linktodir2"), - os.path.join("slices", "linktodir1"), - os.path.join("slices", "dir1", "linktoa3.ice")]: - if os.path.exists(f): - os.unlink(f) - os.system("rm -rf project1 tmp") - -clean() -os.symlink("slices", "linktoslices") -os.symlink("dir1", os.path.join("slices", "linktodir1")) -os.symlink("a3.ice", os.path.join("slices", "dir1", "linktoa3.ice")) -os.symlink("dir2", os.path.join("slices", "linktodir2")) - -slice2cpp = TestUtil.getSliceTranslator() -TestUtil.addLdPath(TestUtil.getCppLibDir()) - -basedir = os.path.dirname(os.path.abspath(__file__)) -slicedir = TestUtil.getSliceDir() -os.symlink(slicedir, "iceslices") - -def runTest(cmd): - os.system(cmd) - f = open("b.h") - if not re.search('#include <dir1\/a1\.h>\n' - '#include <linktodir1\/a2\.h>\n' - '#include <linktodir1\/linktoa3\.h>\n' - '#include <Ice\/Identity\.h>\n', f.read(), re.S): - print("failed!") - sys.exit(1) - os.unlink("b.h") - os.unlink("b.cpp") - -sys.stdout.write("compiling slice files and checking headers... ") -sys.stdout.flush() -runTest("%s -Iiceslices -Islices slices/dir2/b.ice" % (slice2cpp)) -runTest("%s -Iiceslices -I../headers/slices slices/dir2/b.ice" % (slice2cpp)) -runTest("%s -Iiceslices -Ilinktoslices slices/dir2/b.ice" % (slice2cpp)) -runTest("%s -Iiceslices -Ilinktoslices/../linktoslices slices/dir2/b.ice" % (slice2cpp)) -runTest("%s -I%s -Islices linktoslices/dir2/b.ice" % (slice2cpp, slicedir)) -runTest("%s -I%s -Ilinktoslices linktoslices/linktodir2/b.ice" % (slice2cpp, slicedir)) - -# Also ensure it works with case insensitive file system -if os.path.exists("SLICES"): - runTest("%s -IICESLICES -ISLICES SLICES/DIR2/B.ice" % (slice2cpp)) - runTest("%s -IICESLICES -ILINKTOSLICES LINKTOSLICES/LINKTODIR2/B.ice" % (slice2cpp)) - -# -# Slice files are symlinks, include dir is a regular directory -# -os.system("mkdir -p project1/git/services.settings.slices") -os.system("mkdir -p project1/src/services/settings") -os.system("cd project1/src/services/settings && ln -s ../../../git/services.settings.slices slices") - -f = open("project1/git/services.settings.slices/A.ice", "w") -f.write("// dumy file") -f.close() -f = open("project1/git/services.settings.slices/B.ice", "w") -f.write("#include <services/settings/slices/A.ice>") -f.close() - -os.system("cd project1 && %s -Isrc src/services/settings/slices/B.ice" % slice2cpp) -f = open("project1/B.h") - -if not re.search(re.escape('#include <services/settings/slices/A.h>'), f.read()): - print("failed!") - sys.exit(1) - -clean() - -# -# Slice file is regular file, include dir is a symlink to a second symlink -# -os.system("mkdir -p tmp/Ice-x.y.z/share") -os.system("cd tmp/Ice-x.y.z/share && ln -s %s" % slicedir) - - -os.system("mkdir -p project1/share") -os.system("cd project1/share && ln -s %s/tmp/Ice-x.y.z/share/slice" % basedir) -f = open("project1/A.ice", "w") -f.write("#include <Ice/Identity.ice>") -f.close() -os.system("cd project1 && %s -Ishare/slice A.ice" % slice2cpp) -f = open("project1/A.h") -if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()): - print("failed!") - sys.exit(1) - -clean() - -# -# Typical Ice install with symlink Ice-x.y -> Ice-x.y.z -# -os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice") -os.system("cd tmp && ln -s Ice-x.y.z Ice-x.y") -f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w") -f.write("// dumy file") - -os.system("mkdir -p project1") -f = open("project1/A.ice", "w") -f.write("#include <Ice/Identity.ice>") -f.close() -os.system("cd project1 && %s -I%s/tmp/Ice-x.y/slice A.ice" % (slice2cpp, basedir)) -f = open("project1/A.h") -if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()): - print("failed!") - sys.exit(1) - -clean() - -# -# symlink directory with extra / at end -# -# -os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice") -os.system("mkdir -p tmp/Ice") -os.system("cd tmp/Ice && ln -s ../Ice-x.y.z/slice/ .") -f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w") -f.write("// dumy file") -f.close() -os.system("mkdir -p project1") -f = open("project1/A.ice", "w") -f.write("#include <Ice/Identity.ice>") -f.close() -os.system("cd project1 && %s -I%s/tmp/Ice/slice A.ice" % (slice2cpp, basedir)) -f = open("project1/A.h") -if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()): - print("failed!2") - sys.exit(1) -clean() - -print("ok") diff --git a/cpp/test/Slice/headers/test.py b/cpp/test/Slice/headers/test.py new file mode 100644 index 00000000000..a5c169ede49 --- /dev/null +++ b/cpp/test/Slice/headers/test.py @@ -0,0 +1,154 @@ +# -*- 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. +# +# ********************************************************************** + +import glob + +class SliceHeadersTestCase(ClientTestCase): + + def runClientSide(self, current): + self.clean() + + slice2cpp = SliceTranslator("slice2cpp") + + os.symlink("slices", "linktoslices") + os.symlink("dir1", os.path.join("slices", "linktodir1")) + os.symlink("a3.ice", os.path.join("slices", "dir1", "linktoa3.ice")) + os.symlink("dir2", os.path.join("slices", "linktodir2")) + + basedir = self.testsuite.getPath() + slicedir = current.driver.getSliceDir() + os.symlink(slicedir, "iceslices") + + def runTest(args): + slice2cpp.run(current, args=args.split(" ")) + f = open("b.h") + if not re.search('#include <dir1\/a1\.h>\n' + '#include <linktodir1\/a2\.h>\n' + '#include <linktodir1\/linktoa3\.h>\n' + '#include <Ice\/Identity\.h>\n', f.read(), re.S): + raise RuntimeError("failed!") + + os.unlink("b.h") + os.unlink("b.cpp") + + current.write("compiling slice files and checking headers... ") + runTest("-Iiceslices -Islices slices/dir2/b.ice") + runTest("-Iiceslices -I../headers/slices slices/dir2/b.ice") + runTest("-Iiceslices -Ilinktoslices slices/dir2/b.ice") + runTest("-Iiceslices -Ilinktoslices/../linktoslices slices/dir2/b.ice") + runTest("-I%s -Islices linktoslices/dir2/b.ice" % slicedir) + runTest("-I%s -Ilinktoslices linktoslices/linktodir2/b.ice" % slicedir) + + # Also ensure it works with case insensitive file system + if os.path.exists("SLICES"): + runTest("-IICESLICES -ISLICES SLICES/DIR2/B.ice") + runTest("-IICESLICES -ILINKTOSLICES LINKTOSLICES/LINKTODIR2/B.ice") + + slice2cpp = slice2cpp.getCommandLine(current) + + # + # Slice files are symlinks, include dir is a regular directory + # + os.system("mkdir -p project1/git/services.settings.slices") + os.system("mkdir -p project1/src/services/settings") + os.system("cd project1/src/services/settings && ln -s ../../../git/services.settings.slices slices") + + f = open("project1/git/services.settings.slices/A.ice", "w") + f.write("// dumy file") + f.close() + f = open("project1/git/services.settings.slices/B.ice", "w") + f.write("#include <services/settings/slices/A.ice>") + f.close() + + os.system("cd project1 && %s -Isrc src/services/settings/slices/B.ice" % slice2cpp) + f = open("project1/B.h") + if not re.search(re.escape('#include <services/settings/slices/A.h>'), f.read()): + raise RuntimeError("failed!") + + self.clean() + + # + # Slice file is regular file, include dir is a symlink to a second symlink + # + os.system("mkdir -p tmp/Ice-x.y.z/share") + os.system("cd tmp/Ice-x.y.z/share && ln -s %s" % slicedir) + + os.system("mkdir -p project1/share") + os.system("cd project1/share && ln -s %s/tmp/Ice-x.y.z/share/slice" % basedir) + f = open("project1/A.ice", "w") + f.write("#include <Ice/Identity.ice>") + f.close() + os.system("cd project1 && %s -Ishare/slice A.ice" % slice2cpp) + f = open("project1/A.h") + if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()): + raise RuntimeError("failed!") + + self.clean() + + # + # Typical Ice install with symlink Ice-x.y -> Ice-x.y.z + # + os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice") + os.system("cd tmp && ln -s Ice-x.y.z Ice-x.y") + f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w") + f.write("// dumy file") + + os.system("mkdir -p project1") + f = open("project1/A.ice", "w") + f.write("#include <Ice/Identity.ice>") + f.close() + os.system("cd project1 && %s -I%s/tmp/Ice-x.y/slice A.ice" % (slice2cpp, basedir)) + f = open("project1/A.h") + if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()): + raise RuntimeError("failed!") + + self.clean() + + # + # symlink directory with extra / at end + # + # + os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice") + os.system("mkdir -p tmp/Ice") + os.system("cd tmp/Ice && ln -s ../Ice-x.y.z/slice/ .") + f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w") + f.write("// dumy file") + f.close() + os.system("mkdir -p project1") + f = open("project1/A.ice", "w") + f.write("#include <Ice/Identity.ice>") + f.close() + os.system("cd project1 && %s -I%s/tmp/Ice/slice A.ice" % (slice2cpp, basedir)) + f = open("project1/A.h") + if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()): + raise RuntimeError("failed!") + self.clean() + + current.writeln("ok") + + def teardownClientSide(self, current, success): + self.clean() + + def clean(self): + for f in ["iceslices", + "linktoslices", + os.path.join("slices", "linktodir2"), + os.path.join("slices", "linktodir1"), + os.path.join("slices", "dir1", "linktoa3.ice")]: + if os.path.lexists(f): + os.unlink(f) + + if os.path.exists("project1"): shutil.rmtree("project1") + if os.path.exists("tmp"): shutil.rmtree("tmp") + +if not isinstance(platform, Windows): + TestSuite(__name__, [ SliceHeadersTestCase() ], chdir=True) + + diff --git a/cpp/test/Slice/keyword/Client.cpp b/cpp/test/Slice/keyword/Client.cpp index 87f1556485b..661b0b223ac 100644 --- a/cpp/test/Slice/keyword/Client.cpp +++ b/cpp/test/Slice/keyword/Client.cpp @@ -170,7 +170,7 @@ testtypes() int run(const Ice::CommunicatorPtr& communicator) { - communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(charI), Ice::stringToIdentity("test")); adapter->activate(); diff --git a/cpp/test/Slice/keyword/run.py b/cpp/test/Slice/keyword/run.py deleted file mode 100755 index d06758d0994..00000000000 --- a/cpp/test/Slice/keyword/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/Slice/macros/run.py b/cpp/test/Slice/macros/run.py deleted file mode 100755 index d06758d0994..00000000000 --- a/cpp/test/Slice/macros/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/Slice/structure/run.py b/cpp/test/Slice/structure/run.py deleted file mode 100755 index d06758d0994..00000000000 --- a/cpp/test/Slice/structure/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/cpp/test/Slice/unicodePaths/run.py b/cpp/test/Slice/unicodePaths/run.py deleted file mode 100644 index c8f999a0cab..00000000000 --- a/cpp/test/Slice/unicodePaths/run.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -import os, sys, locale, shutil - -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 - -def test(b): - if not b: - print("failed!") - sys.exit(1) - -if TestUtil.isAIX() or TestUtil.isLinux(): - encoding = locale.getdefaultlocale()[1] - if encoding != "UTF-8": - print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8") - print("Skipping test") - sys.exit(0) - -if sys.version_info[0] == 2 and TestUtil.isWin32(): - print("To run this test on Windows you need to be using Python 3.x") - print("Python 2.x subprocess module doesn't support unicode on Windows") - print("Skipping tes") - sys.exit(0) - -sys.stdout.write("testing Slice compiler and unicode file paths... ") -sys.stdout.flush() -tests = [ - ("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++11"), - ("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++98"), - ("cs", ["Test.cs", "TestI.cs"], "--impl"), - ("html", ["index.html"], ""), - ("java", ["Test/Point.java", "Test/CanvasI.java"], "--impl"), - ("js", ["Test.js"], ""), - ("objc", ["Test.m"], ""), - ("php", ["Test.php"], "")] - -# -# Write config -# -if sys.version_info[0] == 2: - srcPath = "./\xe4\xb8\xad\xe5\x9b\xbd".decode("utf-8") -else: - srcPath = "./\u4e2d\u56fd" -if os.path.exists(srcPath): - shutil.rmtree(srcPath) -os.mkdir(srcPath) -TestUtil.createFile("%s/Test.ice" % srcPath, ["module Test { ", - "class Point{int x; int y; };", - "interface Canvas{ void draw(Point p); };", - "};"], "utf-8") - -for language, generated, args in tests: - compiler = '%s' % TestUtil.getSliceTranslator(language) - if not os.path.isfile(compiler): - continue - p = TestUtil.runCommand('"%s" %s/Test.ice --output-dir %s %s' % (compiler, srcPath, srcPath, args)) - test(p.wait() == 0) - for f in generated: - test(os.path.isfile(os.path.join(srcPath, f))) - os.remove(os.path.join(srcPath, f)) - - -if os.path.exists(srcPath): - shutil.rmtree(srcPath) -print("ok") diff --git a/cpp/test/Slice/unicodePaths/test.py b/cpp/test/Slice/unicodePaths/test.py new file mode 100644 index 00000000000..95923fc10c2 --- /dev/null +++ b/cpp/test/Slice/unicodePaths/test.py @@ -0,0 +1,71 @@ +# -*- 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. +# +# ********************************************************************** + +import shutil, locale + +class SliceUnicodePathsTestCase(ClientTestCase): + + def runClientSide(self, current): + + if isinstance(platform, Linux) or isinstance(platform, AIX): + encoding = locale.getdefaultlocale()[1] + if encoding != "UTF-8": + current.writeln("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8") + current.writeln("Skipping test") + return + elif isinstance(platform, Windows) and isPython2: + current.writeln("To run this test on Windows you need to be using Python 3.x") + current.writeln("Python 2.x subprocess module doesn't support unicode on Windows") + current.writeln("Skipping test") + return + + current.write("testing Slice compiler and unicode file paths... ") + + srcPath = "./\xe4\xb8\xad\xe5\x9b\xbd" if isPython2 else "./\u4e2d\u56fd" + + if os.path.exists(srcPath): shutil.rmtree(srcPath) + os.mkdir(srcPath) + + self.createFile("%s/Test.ice" % srcPath, + ["module Test { ", + "class Point{int x; int y; };", + "interface Canvas{ void draw(Point p); };", + "};"], "utf-8") + + tests = [ + ("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++11"), + ("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++98"), + ("cs", ["Test.cs", "TestI.cs"], "--impl"), + ("html", ["index.html"], ""), + ("java", ["Test/Point.java", "Test/CanvasI.java"], "--impl"), + ("js", ["Test.js"], ""), + ("objc", ["Test.m"], ""), + ("php", ["Test.php"], "")] + + try: + for language, generated, args in tests: + compiler = SliceTranslator('slice2%s' % language) + if not os.path.isfile(compiler.getCommandLine(current)): + continue + + args = [srcPath + "/Test.ice", "--output-dir", srcPath] + args.split(" ") + compiler.run(current, args=args) + + for f in generated: + if not os.path.isfile(os.path.join(srcPath, f)): + raise RuntimeError("failed! (can't find {0})".format(os.path.join(srcPath, f))) + os.remove(os.path.join(srcPath, f)) + + current.writeln("ok") + + finally: + if os.path.exists(srcPath): shutil.rmtree(srcPath) + +TestSuite(__name__, [ SliceUnicodePathsTestCase() ], chdir=True) diff --git a/cpp/test/include/TestCommon.h b/cpp/test/include/TestCommon.h index e8605f5c1b4..acc3b8d2152 100644 --- a/cpp/test/include/TestCommon.h +++ b/cpp/test/include/TestCommon.h @@ -18,6 +18,7 @@ #include <Ice/CommunicatorF.h> #include <Ice/ProxyF.h> +#include <Ice/Initialize.h> #if defined(ICE_OS_WINRT) || (TARGET_OS_IPHONE) # include <Ice/Initialize.h> @@ -49,7 +50,12 @@ inline println(const std::string& msg) std::cout << msg << std::endl; } -TEST_API std::string getTestEndpoint(const Ice::CommunicatorPtr&, int, const std::string = std::string()); +TEST_API std::string getTestEndpoint(const Ice::CommunicatorPtr&, int, const std::string& = std::string()); +TEST_API std::string getTestEndpoint(const Ice::PropertiesPtr&, int, const std::string& = std::string()); +TEST_API std::string getTestProtocol(const Ice::PropertiesPtr&); +TEST_API std::string getTestHost(const Ice::PropertiesPtr&); +TEST_API int getTestPort(const Ice::PropertiesPtr&, int); +TEST_API Ice::InitializationData getTestInitData(int&, char*[]); class TEST_API RemoteConfig { diff --git a/csharp/allTests.py b/csharp/allTests.py index 1dd37b2f83a..e4360c465d3 100755..100644 --- a/csharp/allTests.py +++ b/csharp/allTests.py @@ -8,74 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("Slice/keyword", ["once"]), - ("Slice/structure", ["once"]), - ("Slice/macros", ["once"]), - ("IceUtil/inputUtil", ["once"]), - ("Ice/proxy", ["core"]), - ("Ice/properties", ["once"]), - ("Ice/operations", ["core"]), - ("Ice/exceptions", ["core"]), - ("Ice/ami", ["core", "nocompress"]), - ("Ice/info", ["core", "noipv6", "nocompress", "nosocks", "nomono"]), - ("Ice/inheritance", ["core"]), - ("Ice/facets", ["core"]), - ("Ice/hold", ["core"]), - ("Ice/objects", ["core"]), - ("Ice/binding", ["core"]), - ("Ice/faultTolerance", ["core"]), - ("Ice/location", ["core"]), - ("Ice/adapterDeactivation", ["core"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/checksum", ["core", "nocompact"]), - ("Ice/dispatcher", ["core"]), - ("Ice/stream", ["core"]), - ("Ice/retry", ["core"]), - ("Ice/timeout", ["core", "nocompress"]), - ("Ice/acm", ["core"]), - ("Ice/servantLocator", ["core"]), - ("Ice/interceptor", ["core"]), - ("Ice/dictMapping", ["core"]), - ("Ice/seqMapping", ["core"]), - ("Ice/background", ["core", "nosocks"]), - ("Ice/udp", ["core"]), - ("Ice/defaultServant", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/threadPoolPriority", ["core", "nomono"]), - ("Ice/invoke", ["core"]), - ("Ice/hash", ["once"]), - ("Ice/plugin", ["core"]), - ("Ice/optional", ["core"]), - ("Ice/admin", ["core"]), - ("Ice/metrics", ["core", "nows", "noipv6", "nocompress", "nosocks"]), - ("Ice/enums", ["core"]), - ("Ice/serialize", ["core"]), - ("Ice/networkProxy", ["core", "noipv6", "nosocks"]), - ("IceBox/admin", ["core", "noipv6", "nomx"]), - ("IceBox/configuration", ["core", "noipv6", "nomx"]), - ("Glacier2/router", ["service"]), - ("Glacier2/sessionHelper", ["core"]), - ("IceGrid/simple", ["service"]), - ("IceSSL/configuration", ["once", "novista", "nomono", "nocompact"]), - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/csharp/msbuild/ice.common.props b/csharp/msbuild/ice.common.props index fce543be75c..1d4744d23ae 100644 --- a/csharp/msbuild/ice.common.props +++ b/csharp/msbuild/ice.common.props @@ -4,6 +4,7 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <Prefer32Bit>false</Prefer32Bit> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ErrorReport>prompt</ErrorReport> diff --git a/csharp/msbuild/ice.test.sln b/csharp/msbuild/ice.test.sln index 449e4cc483a..e5282a435f8 100644 --- a/csharp/msbuild/ice.test.sln +++ b/csharp/msbuild/ice.test.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +VisualStudioVersion = 14.0.24720.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ice", "Ice", "{484370F6-E5AC-4355-8667-4E4E79CEF6FE}" EndProject diff --git a/csharp/src/Ice/EndpointHostResolver.cs b/csharp/src/Ice/EndpointHostResolver.cs index 886b5cc484c..f1d4316ac8e 100644 --- a/csharp/src/Ice/EndpointHostResolver.cs +++ b/csharp/src/Ice/EndpointHostResolver.cs @@ -131,7 +131,7 @@ namespace IceInternal if(threadObserver != null) { - threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateIdle, + threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateIdle, Ice.Instrumentation.ThreadState.ThreadStateInUseForOther); } @@ -149,19 +149,21 @@ namespace IceInternal } } - r.callback.connectors(r.endpoint.connectors(Network.getAddresses(r.host, - r.port, - protocol, - r.selType, - _preferIPv6, - true), - networkProxy)); + List<EndPoint> addrs = Network.getAddresses(r.host, r.port, protocol, r.selType, _preferIPv6, true); + if(r.observer != null) + { + r.observer.detach(); + r.observer = null; + } + + r.callback.connectors(r.endpoint.connectors(addrs, networkProxy)); } catch(Ice.LocalException ex) { if(r.observer != null) { r.observer.failed(ex.ice_id()); + r.observer.detach(); } r.callback.exception(ex); } @@ -169,13 +171,9 @@ namespace IceInternal { if(threadObserver != null) { - threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, + threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, Ice.Instrumentation.ThreadState.ThreadStateIdle); } - if(r.observer != null) - { - r.observer.detach(); - } } } @@ -205,16 +203,16 @@ namespace IceInternal Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer; if(obsv != null) { - _observer = obsv.getThreadObserver("Communicator", - _thread.getName(), - Ice.Instrumentation.ThreadState.ThreadStateIdle, + _observer = obsv.getThreadObserver("Communicator", + _thread.getName(), + Ice.Instrumentation.ThreadState.ThreadStateIdle, _observer); if(_observer != null) { _observer.attach(); } } - } + } } private class ResolveEntry diff --git a/csharp/test/Glacier2/router/Client.cs b/csharp/test/Glacier2/router/Client.cs index a767709c22c..45c138b3394 100644 --- a/csharp/test/Glacier2/router/Client.cs +++ b/csharp/test/Glacier2/router/Client.cs @@ -18,424 +18,413 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) + Ice.ObjectPrx routerBase; { - Ice.ObjectPrx routerBase; + Console.Out.Write("testing stringToProxy for router... "); + Console.Out.Flush(); + routerBase = communicator().stringToProxy("Glacier2/router:" + getTestEndpoint(10)); + Console.Out.WriteLine("ok"); + } + + Glacier2.RouterPrx router; + { + Console.Out.Write("testing checked cast for router... "); + Console.Out.Flush(); + router = Glacier2.RouterPrxHelper.checkedCast(routerBase); + test(router != null); + Console.Out.WriteLine("ok"); + } + + + { + Console.Out.Write("testing router finder... "); + Console.Out.Flush(); + Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast( + communicator().stringToProxy("Ice/RouterFinder:" + getTestEndpoint(10))); + test(finder.getRouter().ice_getIdentity().Equals(router.ice_getIdentity())); + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("installing router with communicator... "); + Console.Out.Flush(); + communicator().setDefaultRouter(router); + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("getting the session timeout... "); + Console.Out.Flush(); + long timeout = router.getSessionTimeout(); + test(timeout == 30); + Console.Out.WriteLine("ok"); + } + + Ice.ObjectPrx @base; + + { + Console.Out.Write("testing stringToProxy for server object... "); + Console.Out.Flush(); + @base = communicator().stringToProxy("c1/callback:" + getTestEndpoint(0)); + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("trying to ping server before session creation... "); + Console.Out.Flush(); + try { - Console.Out.Write("testing stringToProxy for router... "); - Console.Out.Flush(); - routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347"); - Console.Out.WriteLine("ok"); + @base.ice_ping(); + test(false); } - - Glacier2.RouterPrx router; + catch(Ice.ConnectionLostException) { - Console.Out.Write("testing checked cast for router... "); - Console.Out.Flush(); - router = Glacier2.RouterPrxHelper.checkedCast(routerBase); - test(router != null); Console.Out.WriteLine("ok"); } + catch(Ice.SocketException) + { + test(false); + } + } + { + Console.Out.Write("trying to create session with wrong password... "); + Console.Out.Flush(); + try { - Console.Out.Write("testing router finder... "); - Console.Out.Flush(); - Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast( - communicator().stringToProxy("Ice/RouterFinder:default -p 12347")); - test(finder.getRouter().ice_getIdentity().Equals(router.ice_getIdentity())); - Console.Out.WriteLine("ok"); + router.createSession("userid", "xxx"); + test(false); } - + catch(Glacier2.PermissionDeniedException) { - Console.Out.Write("installing router with communicator... "); - Console.Out.Flush(); - communicator().setDefaultRouter(router); Console.Out.WriteLine("ok"); } - + catch(Glacier2.CannotCreateSessionException) { - Console.Out.Write("getting the session timeout... "); - Console.Out.Flush(); - long timeout = router.getSessionTimeout(); - test(timeout == 30); - Console.Out.WriteLine("ok"); + test(false); } + } - Ice.ObjectPrx @base; - + { + Console.Out.Write("trying to destroy non-existing session... "); + Console.Out.Flush(); + try + { + router.destroySession(); + test(false); + } + catch(Glacier2.SessionNotExistException) { - Console.Out.Write("testing stringToProxy for server object... "); - Console.Out.Flush(); - @base = communicator().stringToProxy("c1/callback:tcp -p 12010"); Console.Out.WriteLine("ok"); } + } + { + Console.Out.Write("creating session with correct password... "); + Console.Out.Flush(); + try { - Console.Out.Write("trying to ping server before session creation... "); - Console.Out.Flush(); - try - { - @base.ice_ping(); - test(false); - } - catch(Ice.ConnectionLostException) - { - Console.Out.WriteLine("ok"); - } - catch(Ice.SocketException) - { - test(false); - } + router.createSession("userid", "abc123"); } - - + catch(Glacier2.PermissionDeniedException) { - Console.Out.Write("trying to create session with wrong password... "); - Console.Out.Flush(); - try - { - router.createSession("userid", "xxx"); - test(false); - } - catch(Glacier2.PermissionDeniedException) - { - Console.Out.WriteLine("ok"); - } - catch(Glacier2.CannotCreateSessionException) - { - test(false); - } + test(false); } - + catch(Glacier2.CannotCreateSessionException) { - Console.Out.Write("trying to destroy non-existing session... "); - Console.Out.Flush(); - try - { - router.destroySession(); - test(false); - } - catch(Glacier2.SessionNotExistException) - { - Console.Out.WriteLine("ok"); - } + test(false); } + Console.Out.WriteLine("ok"); + } + { + Console.Out.Write("trying to create a second session... "); + Console.Out.Flush(); + try { - Console.Out.Write("creating session with correct password... "); - Console.Out.Flush(); - try - { - router.createSession("userid", "abc123"); - } - catch(Glacier2.PermissionDeniedException) - { - test(false); - } - catch(Glacier2.CannotCreateSessionException) - { - test(false); - } - Console.Out.WriteLine("ok"); + router.createSession("userid", "abc123"); + test(false); } - + catch(Glacier2.PermissionDeniedException) { - Console.Out.Write("trying to create a second session... "); - Console.Out.Flush(); - try - { - router.createSession("userid", "abc123"); - test(false); - } - catch(Glacier2.PermissionDeniedException) - { - test(false); - } - catch(Glacier2.CannotCreateSessionException) - { - Console.Out.WriteLine("ok"); - } + test(false); } - + catch(Glacier2.CannotCreateSessionException) { - Console.Out.Write("pinging server after session creation... "); - Console.Out.Flush(); - @base.ice_ping(); Console.Out.WriteLine("ok"); } + } - CallbackPrx twoway; + { + Console.Out.Write("pinging server after session creation... "); + Console.Out.Flush(); + @base.ice_ping(); + Console.Out.WriteLine("ok"); + } - { - Console.Out.Write("testing checked cast for server object... "); - Console.Out.Flush(); - twoway = CallbackPrxHelper.checkedCast(@base); - test(twoway != null); - Console.Out.WriteLine("ok"); - } + CallbackPrx twoway; + + { + Console.Out.Write("testing checked cast for server object... "); + Console.Out.Flush(); + twoway = CallbackPrxHelper.checkedCast(@base); + test(twoway != null); + Console.Out.WriteLine("ok"); + } + + Ice.ObjectAdapter adapter; + + { + Console.Out.Write("creating and activating callback receiver adapter... "); + Console.Out.Flush(); + communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0"); + adapter = communicator().createObjectAdapterWithRouter("CallbackReceiverAdapter", router); + adapter.activate(); + Console.Out.WriteLine("ok"); + } + + String category; + + { + Console.Out.Write("getting category from router... "); + Console.Out.Flush(); + category = router.getCategoryForClient(); + Console.Out.WriteLine("ok"); + } - Ice.ObjectAdapter adapter; + CallbackReceiverI callbackReceiverImpl; + Ice.Object callbackReceiver; + CallbackReceiverPrx twowayR; + CallbackReceiverPrx fakeTwowayR; + { + Console.Out.Write("creating and adding callback receiver object... "); + Console.Out.Flush(); + callbackReceiverImpl = new CallbackReceiverI(); + callbackReceiver = callbackReceiverImpl; + Ice.Identity callbackReceiverIdent = new Ice.Identity(); + callbackReceiverIdent.name = "callbackReceiver"; + callbackReceiverIdent.category = category; + twowayR = CallbackReceiverPrxHelper.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent)); + Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity(); + fakeCallbackReceiverIdent.name = "callbackReceiver"; + fakeCallbackReceiverIdent.category = "dummy"; + fakeTwowayR = CallbackReceiverPrxHelper.uncheckedCast( + adapter.add(callbackReceiver, fakeCallbackReceiverIdent)); + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("testing oneway callback... "); + Console.Out.Flush(); + CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway()); + CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway()); + Dictionary<string, string> context = new Dictionary<string, string>(); + context["_fwd"] = "o"; + oneway.initiateCallback(onewayR, context); + callbackReceiverImpl.callbackOK(); + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("testing twoway callback... "); + Console.Out.Flush(); + Dictionary<string, string> context = new Dictionary<string, string>(); + context["_fwd"] = "t"; + twoway.initiateCallback(twowayR, context); + callbackReceiverImpl.callbackOK(); + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("ditto, but with user exception... "); + Console.Out.Flush(); + Dictionary<string, string> context = new Dictionary<string, string>(); + context["_fwd"] = "t"; + try { - Console.Out.Write("creating and activating callback receiver adapter... "); - Console.Out.Flush(); - communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0"); - adapter = communicator().createObjectAdapterWithRouter("CallbackReceiverAdapter", router); - adapter.activate(); - Console.Out.WriteLine("ok"); + twoway.initiateCallbackEx(twowayR, context); + test(false); } + catch(CallbackException ex) + { + test(ex.someValue == 3.14); + test(ex.someString.Equals("3.14")); + } + callbackReceiverImpl.callbackOK(); + Console.Out.WriteLine("ok"); + } - String category; - + { + Console.Out.Write("trying twoway callback with fake category... "); + Console.Out.Flush(); + Dictionary<string, string> context = new Dictionary<string, string>(); + context["_fwd"] = "t"; + try + { + twoway.initiateCallback(fakeTwowayR, context); + test(false); + } + catch(Ice.ObjectNotExistException) { - Console.Out.Write("getting category from router... "); - Console.Out.Flush(); - category = router.getCategoryForClient(); Console.Out.WriteLine("ok"); } + } - CallbackReceiverI callbackReceiverImpl; - Ice.Object callbackReceiver; - CallbackReceiverPrx twowayR; - CallbackReceiverPrx fakeTwowayR; + { + Console.Out.Write("testing whether other allowed category is accepted... "); + Console.Out.Flush(); + Dictionary<string, string> context = new Dictionary<string, string>(); + context["_fwd"] = "t"; + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(Ice.Util.stringToIdentity("c2/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + callbackReceiverImpl.callbackOK(); + Console.Out.WriteLine("ok"); + } + { + Console.Out.Write("testing whether disallowed category gets rejected... "); + Console.Out.Flush(); + Dictionary<string, string> context = new Dictionary<string, string>(); + context["_fwd"] = "t"; + try { - Console.Out.Write("creating and adding callback receiver object... "); - Console.Out.Flush(); - callbackReceiverImpl = new CallbackReceiverI(); - callbackReceiver = callbackReceiverImpl; - Ice.Identity callbackReceiverIdent = new Ice.Identity(); - callbackReceiverIdent.name = "callbackReceiver"; - callbackReceiverIdent.category = category; - twowayR = CallbackReceiverPrxHelper.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent)); - Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity(); - fakeCallbackReceiverIdent.name = "callbackReceiver"; - fakeCallbackReceiverIdent.category = "dummy"; - fakeTwowayR = CallbackReceiverPrxHelper.uncheckedCast( - adapter.add(callbackReceiver, fakeCallbackReceiverIdent)); - Console.Out.WriteLine("ok"); + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(Ice.Util.stringToIdentity("c3/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + test(false); } - + catch(Ice.ObjectNotExistException) { - Console.Out.Write("testing oneway callback... "); - Console.Out.Flush(); - CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway()); - CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway()); - Dictionary<string, string> context = new Dictionary<string, string>(); - context["_fwd"] = "o"; - oneway.initiateCallback(onewayR, context); - callbackReceiverImpl.callbackOK(); Console.Out.WriteLine("ok"); } + } + { + Console.Out.Write("testing whether user-id as category is accepted... "); + Console.Out.Flush(); + Dictionary<string, string> context = new Dictionary<string, string>(); + context["_fwd"] = "t"; + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(Ice.Util.stringToIdentity("_userid/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + callbackReceiverImpl.callbackOK(); + Console.Out.WriteLine("ok"); + } + + if(args.Length >= 1 && args[0].Equals("--shutdown")) + { + Console.Out.Write("testing server shutdown... "); + Console.Out.Flush(); + twoway.shutdown(); + // No ping, otherwise the router prints a warning message if it's + // started with --Ice.Warn.Connections. + Console.Out.WriteLine("ok"); + /* + try + { + base.ice_ping(); + test(false); + } + // If we use the glacier router, the exact exception reason gets + // lost. + catch(Ice.UnknownLocalException ex) + { + Console.Out.WriteLine("ok"); + } + */ + } + + { + Console.Out.Write("destroying session... "); + Console.Out.Flush(); + try { - Console.Out.Write("testing twoway callback... "); - Console.Out.Flush(); - Dictionary<string, string> context = new Dictionary<string, string>(); - context["_fwd"] = "t"; - twoway.initiateCallback(twowayR, context); - callbackReceiverImpl.callbackOK(); - Console.Out.WriteLine("ok"); + router.destroySession(); } - + catch(Ice.LocalException) { - Console.Out.Write("ditto, but with user exception... "); - Console.Out.Flush(); - Dictionary<string, string> context = new Dictionary<string, string>(); - context["_fwd"] = "t"; - try - { - twoway.initiateCallbackEx(twowayR, context); - test(false); - } - catch(CallbackException ex) - { - test(ex.someValue == 3.14); - test(ex.someString.Equals("3.14")); - } - callbackReceiverImpl.callbackOK(); - Console.Out.WriteLine("ok"); + test(false); } + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("trying to ping server after session destruction... "); + Console.Out.Flush(); + try { - Console.Out.Write("trying twoway callback with fake category... "); - Console.Out.Flush(); - Dictionary<string, string> context = new Dictionary<string, string>(); - context["_fwd"] = "t"; - try - { - twoway.initiateCallback(fakeTwowayR, context); - test(false); - } - catch(Ice.ObjectNotExistException) - { - Console.Out.WriteLine("ok"); - } + @base.ice_ping(); + test(false); } - + catch(Ice.ConnectionLostException) { - Console.Out.Write("testing whether other allowed category is accepted... "); - Console.Out.Flush(); - Dictionary<string, string> context = new Dictionary<string, string>(); - context["_fwd"] = "t"; - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(Ice.Util.stringToIdentity("c2/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - callbackReceiverImpl.callbackOK(); Console.Out.WriteLine("ok"); } - + catch(Ice.SocketException) { - Console.Out.Write("testing whether disallowed category gets rejected... "); - Console.Out.Flush(); - Dictionary<string, string> context = new Dictionary<string, string>(); - context["_fwd"] = "t"; - try - { - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(Ice.Util.stringToIdentity("c3/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - test(false); - } - catch(Ice.ObjectNotExistException) - { - Console.Out.WriteLine("ok"); - } + test(false); } + } + if(args.Length >= 1 && args[0].Equals("--shutdown")) + { { - Console.Out.Write("testing whether user-id as category is accepted... "); + Console.Out.Write("uninstalling router with communicator... "); Console.Out.Flush(); - Dictionary<string, string> context = new Dictionary<string, string>(); - context["_fwd"] = "t"; - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(Ice.Util.stringToIdentity("_userid/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - callbackReceiverImpl.callbackOK(); + communicator().setDefaultRouter(null); Console.Out.WriteLine("ok"); } + Ice.ObjectPrx processBase; + { - Console.Out.Write("testing server shutdown... "); - Console.Out.Flush(); - twoway.shutdown(); - // No ping, otherwise the router prints a warning message if it's - // started with --Ice.Warn.Connections. + Console.Out.Write("testing stringToProxy for admin object... "); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp")); Console.Out.WriteLine("ok"); - /* - try - { - base.ice_ping(); - test(false); - } - // If we use the glacier router, the exact exception reason gets - // lost. - catch(Ice.UnknownLocalException ex) - { - Console.Out.WriteLine("ok"); - } - */ } +/* { - Console.Out.Write("destroying session... "); - Console.Out.Flush(); - try - { - router.destroySession(); - } - catch(Ice.LocalException) - { - test(false); - } - + Console.Out.Write("uninstalling router with process object... "); + processBase.ice_router(null); Console.Out.WriteLine("ok"); } +*/ + + Ice.ProcessPrx process; { - Console.Out.Write("trying to ping server after session destruction... "); - Console.Out.Flush(); - try - { - @base.ice_ping(); - test(false); - } - catch(Ice.ConnectionLostException) - { - Console.Out.WriteLine("ok"); - } - catch(Ice.SocketException) - { - test(false); - } + Console.Out.Write("testing checked cast for process object... "); + process = Ice.ProcessPrxHelper.checkedCast(processBase); + test(process != null); + Console.Out.WriteLine("ok"); } - if(args.Length >= 1 && args[0].Equals("--shutdown")) + Console.Out.Write("testing Glacier2 shutdown... "); + process.shutdown(); + try { - { - Console.Out.Write("uninstalling router with communicator... "); - Console.Out.Flush(); - communicator().setDefaultRouter(null); - Console.Out.WriteLine("ok"); - } - - Ice.ObjectPrx processBase; - - { - Console.Out.Write("testing stringToProxy for admin object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); - Console.Out.WriteLine("ok"); - } - - /* - { - Console.Out.Write("uninstalling router with process object... "); - processBase.ice_router(null); - Console.Out.WriteLine("ok"); - } - */ - - Ice.ProcessPrx process; - - { - Console.Out.Write("testing checked cast for process object... "); - process = Ice.ProcessPrxHelper.checkedCast(processBase); - test(process != null); - Console.Out.WriteLine("ok"); - } - - Console.Out.Write("testing Glacier2 shutdown... "); - process.shutdown(); - try - { - process.ice_ping(); - test(false); - } - catch(Ice.LocalException) - { - Console.Out.WriteLine("ok"); - } + process.ice_ping(); + test(false); } - - return 0; - } - - private static void - test(bool b) - { - if(!b) + catch(Ice.LocalException) { - throw new Exception(); + Console.Out.WriteLine("ok"); } } + + return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { // // We must disable connection warnings, because we attempt to @@ -443,11 +432,14 @@ public class Client // after session destruction. Both will cause a // ConnectionLostException. // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - + Ice.InitializationData initData = base.getInitData(ref args); initData.properties.setProperty("Ice.Warn.Connections", "0"); - App app = new App(); - return app.main(args, initData); + return initData; + } + + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Glacier2/router/Server.cs b/csharp/test/Glacier2/router/Server.cs index 4f8ae5a9e1c..f70adc61e6d 100644 --- a/csharp/test/Glacier2/router/Server.cs +++ b/csharp/test/Glacier2/router/Server.cs @@ -17,33 +17,24 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - public class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) - { - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); - adapter.add(new CallbackI(), - Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category. - adapter.add(new CallbackI(), - Ice.Util.stringToIdentity("c2/callback")); // The test allows "c2" as category. - adapter.add(new CallbackI(), - Ice.Util.stringToIdentity("c3/callback")); // The test rejects "c3" as category. - adapter.add(new CallbackI(), - Ice.Util.stringToIdentity("_userid/callback")); // The test allows the prefixed userid. - adapter.activate(); - communicator().waitForShutdown(); - return 0; - } + communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); + adapter.add(new CallbackI(), Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category. + adapter.add(new CallbackI(), Ice.Util.stringToIdentity("c2/callback")); // The test allows "c2" as category. + adapter.add(new CallbackI(), Ice.Util.stringToIdentity("c3/callback")); // The test rejects "c3" as category. + adapter.add(new CallbackI(), Ice.Util.stringToIdentity("_userid/callback")); // The test allows the prefixed userid. + adapter.activate(); + communicator().waitForShutdown(); + return 0; } public static int Main(string[] args) { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - App app = new App(); - return app.main(args, initData); + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Glacier2/router/msbuild/client/client.csproj b/csharp/test/Glacier2/router/msbuild/client/client.csproj index 96bbae3b0c6..c6bb052c7a9 100644 --- a/csharp/test/Glacier2/router/msbuild/client/client.csproj +++ b/csharp/test/Glacier2/router/msbuild/client/client.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\CallbackI.cs"> <Link>CallbackI.cs</Link> </Compile> diff --git a/csharp/test/Glacier2/router/msbuild/server/server.csproj b/csharp/test/Glacier2/router/msbuild/server/server.csproj index 84d40c5ef7d..12f5c47b42c 100644 --- a/csharp/test/Glacier2/router/msbuild/server/server.csproj +++ b/csharp/test/Glacier2/router/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\CallbackI.cs"> <Link>CallbackI.cs</Link> </Compile> diff --git a/csharp/test/Glacier2/router/run.py b/csharp/test/Glacier2/router/run.py deleted file mode 100755 index 429857cc84a..00000000000 --- a/csharp/test/Glacier2/router/run.py +++ /dev/null @@ -1,57 +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, getopt - -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 - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - ' --Glacier2.Filter.Category.AcceptUser="2"' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest() - -# -# We run the test again, to check whether the glacier router can -# handle multiple clients. Also, when we run for the second time, we -# want the client to shutdown the router after running the tests. -# -TestUtil.clientServerTest(additionalClientOptions=" --shutdown") - -starterProc.waitTestSuccess() diff --git a/csharp/test/Glacier2/sessionHelper/Client.cs b/csharp/test/Glacier2/sessionHelper/Client.cs index 9d00931328c..cb0e1709b45 100644 --- a/csharp/test/Glacier2/sessionHelper/Client.cs +++ b/csharp/test/Glacier2/sessionHelper/Client.cs @@ -18,480 +18,482 @@ using System.Threading; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public class App : Ice.Application + public class SessionCallback1 : Glacier2.SessionCallback { - public App(string[] args) + public + SessionCallback1(Client app) { - me = this; + _app = app; + } - _initData = new Ice.InitializationData(); - _initData.properties = Ice.Util.createProperties(ref args); - _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347"); - _initData.dispatcher = delegate(Action action, Ice.Connection connection) - { - action(); - }; + public void + connected(Glacier2.SessionHelper session) + { + test(false); } - public class SessionCalback1 : Glacier2.SessionCallback + public void + disconnected(Glacier2.SessionHelper session) { - public void - connected(Glacier2.SessionHelper session) - { - test(false); - } + test(false); + } - public void - disconnected(Glacier2.SessionHelper session) + public void + connectFailed(Glacier2.SessionHelper session, Exception exception) + { + try { - test(false); + throw exception; } - - public void - connectFailed(Glacier2.SessionHelper session, Exception exception) + catch(Glacier2.PermissionDeniedException) { - try - { - throw exception; - } - catch(Glacier2.PermissionDeniedException) - { - Console.Out.WriteLine("ok"); - lock(me) - { - wakeUp(); - } - } - catch(Exception) - { - test(false); - } + Console.Out.WriteLine("ok"); + _app.wakeUp(); } - - public void - createdCommunicator(Glacier2.SessionHelper session) + catch(Exception) { - test(session.communicator() != null); + test(false); } } - public class SessionCalback2 : Glacier2.SessionCallback + public void + createdCommunicator(Glacier2.SessionHelper session) { - public void - connected(Glacier2.SessionHelper session) + test(session.communicator() != null); + } + + private Client _app; + } + + public class SessionCallback2 : Glacier2.SessionCallback + { + public + SessionCallback2(Client app) + { + _app = app; + } + + public void + connected(Glacier2.SessionHelper session) + { + Console.Out.WriteLine("ok"); + _app.wakeUp(); + } + + public void + disconnected(Glacier2.SessionHelper session) + { + Console.Out.WriteLine("ok"); + _app.wakeUp(); + } + + public void + connectFailed(Glacier2.SessionHelper session, Exception ex) + { + Console.Out.WriteLine(ex.ToString()); + test(false); + } + + public void + createdCommunicator(Glacier2.SessionHelper session) + { + test(session.communicator() != null); + } + + private Client _app; + } + + public class SessionCallback3 : Glacier2.SessionCallback + { + public + SessionCallback3(Client app) + { + _app = app; + } + + public void + connected(Glacier2.SessionHelper session) + { + test(false); + } + + public void + disconnected(Glacier2.SessionHelper session) + { + test(false); + } + + public void + connectFailed(Glacier2.SessionHelper session, Exception exception) + { + try { - Console.Out.WriteLine("ok"); - lock(me) - { - wakeUp(); - } + throw exception; } - - public void - disconnected(Glacier2.SessionHelper session) + catch(Ice.ConnectionRefusedException) { Console.Out.WriteLine("ok"); - lock(me) - { - wakeUp(); - } + _app.wakeUp(); } - - public void - connectFailed(Glacier2.SessionHelper session, Exception ex) + catch(Exception) { - Console.Out.WriteLine(ex.ToString()); test(false); } - - public void - createdCommunicator(Glacier2.SessionHelper session) - { - test(session.communicator() != null); - } } - public class SessionCalback3 : Glacier2.SessionCallback + public void + createdCommunicator(Glacier2.SessionHelper session) { - public void - connected(Glacier2.SessionHelper session) - { - test(false); - } + test(session.communicator() != null); + } - public void - disconnected(Glacier2.SessionHelper session) - { - test(false); - } + private Client _app; + } - public void - connectFailed(Glacier2.SessionHelper session, Exception exception) - { - try - { - throw exception; - } - catch(Ice.ConnectionRefusedException) - { - Console.Out.WriteLine("ok"); - lock(me) - { - wakeUp(); - } - } - catch(Exception) - { - test(false); - } - } + public class SessionCallback4 : Glacier2.SessionCallback + { + public + SessionCallback4(Client app) + { + _app = app; + } - public void - createdCommunicator(Glacier2.SessionHelper session) - { - test(session.communicator() != null); - } + public void + connected(Glacier2.SessionHelper session) + { + test(false); } - public class SessionCalback4 : Glacier2.SessionCallback + public void + disconnected(Glacier2.SessionHelper session) { - public void - connected(Glacier2.SessionHelper session) - { - test(false); - } + test(false); + } - public void - disconnected(Glacier2.SessionHelper session) + public void + connectFailed(Glacier2.SessionHelper session, Exception exception) + { + try { - test(false); + throw exception; } - - public void - connectFailed(Glacier2.SessionHelper session, Exception exception) + catch(Ice.CommunicatorDestroyedException) { - try - { - throw exception; - } - catch(Ice.CommunicatorDestroyedException) - { - Console.Out.WriteLine("ok"); - lock(me) - { - wakeUp(); - } - } - catch(Exception) - { - test(false); - } + Console.Out.WriteLine("ok"); + _app.wakeUp(); } - - public void - createdCommunicator(Glacier2.SessionHelper session) + catch(Exception) { - test(session.communicator() != null); + test(false); } } - public Ice.InitializationData getInitData() + public void + createdCommunicator(Glacier2.SessionHelper session) { - return _initData; + test(session.communicator() != null); } - public override int run(string[] args) - { - String protocol = communicator().getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - String host = communicator().getProperties().getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); - _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCalback1()); - - // - // Test to create a session with wrong userid/password - // - lock(this) - { - Console.Out.Write("testing SessionHelper connect with wrong userid/password... "); - Console.Out.Flush(); - - _factory.setProtocol(protocol); - _session = _factory.connect("userid", "xxx"); - while(true) - { - try - { - Monitor.Wait(this); - break; - } - catch(ThreadInterruptedException) - { - } - } - } + private Client _app; + } - _initData.properties.setProperty("Ice.Default.Router", ""); - _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCalback4()); - lock(this) - { - Console.Out.Write("testing SessionHelper connect interrupt... "); - Console.Out.Flush(); - _factory.setRouterHost(host); - _factory.setPort(12011); - _factory.setProtocol(protocol); - _session = _factory.connect("userid", "abc123"); + public override int run(string[] args) + { + string protocol = getTestProtocol(); + string host = getTestHost(); - Thread.Sleep(100); - _session.destroy(); + _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCallback1(this)); - while(true) - { - try - { - Monitor.Wait(this); - break; - } - catch(ThreadInterruptedException) - { - } - } - } + // + // Test to create a session with wrong userid/password + // + lock(this) + { + Console.Out.Write("testing SessionHelper connect with wrong userid/password... "); + Console.Out.Flush(); - _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCalback2()); - lock(this) + _factory.setProtocol(protocol); + _session = _factory.connect("userid", "xxx"); + while(true) { - Console.Out.Write("testing SessionHelper connect... "); - Console.Out.Flush(); - _factory.setRouterHost(host); - _factory.setPort(12347); - _factory.setProtocol(protocol); - _session = _factory.connect("userid", "abc123"); - while(true) - { - try - { - Monitor.Wait(this); - break; - } - catch(ThreadInterruptedException) - { - } - } - - Console.Out.Write("testing SessionHelper isConnected after connect... "); - Console.Out.Flush(); - test(_session.isConnected()); - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing SessionHelper categoryForClient after connect... "); - Console.Out.Flush(); try { - test(!_session.categoryForClient().Equals("")); + Monitor.Wait(this); + break; } - catch(Glacier2.SessionNotExistException) + catch(ThreadInterruptedException) { - test(false); } - Console.Out.WriteLine("ok"); - - // try - // { - // test(_session.session() != null); - // } - // catch(Glacier2.SessionNotExistException ex) - // { - // test(false); - // } - - Console.Out.Write("testing stringToProxy for server object... "); - Console.Out.Flush(); - Ice.ObjectPrx @base = _session.communicator().stringToProxy("callback:default -p 12010"); - Console.Out.WriteLine("ok"); - - Console.Out.Write("pinging server after session creation... "); - Console.Out.Flush(); - @base.ice_ping(); - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing checked cast for server object... "); - Console.Out.Flush(); - CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base); - test(twoway != null); - Console.Out.WriteLine("ok"); + } + } - Console.Out.Write("testing server shutdown... "); - Console.Out.Flush(); - twoway.shutdown(); - Console.Out.WriteLine("ok"); + _initData.properties.setProperty("Ice.Default.Router", ""); + _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCallback4(this)); + lock(this) + { + Console.Out.Write("testing SessionHelper connect interrupt... "); + Console.Out.Flush(); + _factory.setRouterHost(host); + _factory.setPort(getTestPort(1)); + _factory.setProtocol(protocol); + _session = _factory.connect("userid", "abc123"); - test(_session.communicator() != null); - Console.Out.Write("testing SessionHelper destroy... "); - Console.Out.Flush(); - _session.destroy(); - while(true) - { - try - { - Monitor.Wait(this); - break; - } - catch(ThreadInterruptedException) - { - } - } + Thread.Sleep(100); + _session.destroy(); - Console.Out.Write("testing SessionHelper isConnected after destroy... "); - Console.Out.Flush(); - test(_session.isConnected() == false); - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing SessionHelper categoryForClient after destroy... "); - Console.Out.Flush(); + while(true) + { try { - test(!_session.categoryForClient().Equals("")); - test(false); + Monitor.Wait(this); + break; } - catch(Glacier2.SessionNotExistException) + catch(ThreadInterruptedException) { } - Console.Out.WriteLine("ok"); + } + } - Console.Out.Write("testing SessionHelper session after destroy... "); + _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCallback2(this)); + lock(this) + { + Console.Out.Write("testing SessionHelper connect... "); + Console.Out.Flush(); + _factory.setRouterHost(host); + _factory.setPort(getTestPort(10)); + _factory.setProtocol(protocol); + _session = _factory.connect("userid", "abc123"); + while(true) + { try { - _session.session(); - test(false); + Monitor.Wait(this); + break; } - catch(Glacier2.SessionNotExistException) + catch(ThreadInterruptedException) { } - Console.Out.WriteLine("ok"); + } + + Console.Out.Write("testing SessionHelper isConnected after connect... "); + Console.Out.Flush(); + test(_session.isConnected()); + Console.Out.WriteLine("ok"); - Console.Out.Write("testing SessionHelper communicator after destroy... "); - Console.Out.Flush(); + Console.Out.Write("testing SessionHelper categoryForClient after connect... "); + Console.Out.Flush(); + try + { + test(!_session.categoryForClient().Equals("")); + } + catch(Glacier2.SessionNotExistException) + { + test(false); + } + Console.Out.WriteLine("ok"); + +// try +// { +// test(_session.session() != null); +// } +// catch(Glacier2.SessionNotExistException ex) +// { +// test(false); +// } + + Console.Out.Write("testing stringToProxy for server object... "); + Console.Out.Flush(); + Ice.ObjectPrx @base = _session.communicator().stringToProxy("callback:" + getTestEndpoint(0)); + Console.Out.WriteLine("ok"); + + Console.Out.Write("pinging server after session creation... "); + Console.Out.Flush(); + @base.ice_ping(); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing checked cast for server object... "); + Console.Out.Flush(); + CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base); + test(twoway != null); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing server shutdown... "); + Console.Out.Flush(); + twoway.shutdown(); + Console.Out.WriteLine("ok"); + + test(_session.communicator() != null); + Console.Out.Write("testing SessionHelper destroy... "); + Console.Out.Flush(); + _session.destroy(); + while(true) + { try { - test(_session.communicator() != null); - _session.communicator().stringToProxy("dummy"); - test(false); + Monitor.Wait(this); + break; } - catch(Ice.CommunicatorDestroyedException) + catch(ThreadInterruptedException) { } - Console.Out.WriteLine("ok"); + } + Console.Out.Write("testing SessionHelper isConnected after destroy... "); + Console.Out.Flush(); + test(_session.isConnected() == false); + Console.Out.WriteLine("ok"); - Console.Out.Write("uninstalling router with communicator... "); - Console.Out.Flush(); - communicator().setDefaultRouter(null); - Console.Out.WriteLine("ok"); + Console.Out.Write("testing SessionHelper categoryForClient after destroy... "); + Console.Out.Flush(); + try + { + test(!_session.categoryForClient().Equals("")); + test(false); + } + catch(Glacier2.SessionNotExistException) + { + } + Console.Out.WriteLine("ok"); - Ice.ObjectPrx processBase; - { - Console.Out.Write("testing stringToProxy for process object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:default -h \"" + host + "\" -p 12348"); - Console.Out.WriteLine("ok"); - } + Console.Out.Write("testing SessionHelper session after destroy... "); + try + { + _session.session(); + test(false); + } + catch(Glacier2.SessionNotExistException) + { + } + Console.Out.WriteLine("ok"); + Console.Out.Write("testing SessionHelper communicator after destroy... "); + Console.Out.Flush(); + try + { + test(_session.communicator() != null); + _session.communicator().stringToProxy("dummy"); + test(false); + } + catch(Ice.CommunicatorDestroyedException) + { + } + Console.Out.WriteLine("ok"); - Ice.ProcessPrx process; - { - Console.Out.Write("testing checked cast for admin object... "); - process = Ice.ProcessPrxHelper.checkedCast(processBase); - test(process != null); - Console.Out.WriteLine("ok"); - } - Console.Out.Write("testing Glacier2 shutdown... "); - process.shutdown(); - try - { - process.ice_ping(); - test(false); - } - catch(Ice.LocalException) - { - Console.Out.WriteLine("ok"); - } + Console.Out.Write("uninstalling router with communicator... "); + Console.Out.Flush(); + communicator().setDefaultRouter(null); + Console.Out.WriteLine("ok"); + + Ice.ObjectPrx processBase; + { + Console.Out.Write("testing stringToProxy for process object... "); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp")); + Console.Out.WriteLine("ok"); } - _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCalback3()); - lock(this) + + Ice.ProcessPrx process; { - Console.Out.Write("testing SessionHelper connect after router shutdown... "); - Console.Out.Flush(); - - _factory.setRouterHost(host); - _factory.setPort(12347); - _factory.setProtocol(protocol); - _session = _factory.connect("userid", "abc123"); - while(true) - { - try - { - Monitor.Wait(this); - break; - } - catch(ThreadInterruptedException) - { - } - } + Console.Out.Write("testing checked cast for admin object... "); + process = Ice.ProcessPrxHelper.checkedCast(processBase); + test(process != null); + Console.Out.WriteLine("ok"); + } - Console.Out.Write("testing SessionHelper isConnect after connect failure... "); - Console.Out.Flush(); - test(_session.isConnected() == false); + Console.Out.Write("testing Glacier2 shutdown... "); + process.shutdown(); + try + { + process.ice_ping(); + test(false); + } + catch(Ice.LocalException) + { Console.Out.WriteLine("ok"); + } + } - Console.Out.Write("testing SessionHelper communicator after connect failure... "); - Console.Out.Flush(); + _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCallback3(this)); + lock(this) + { + Console.Out.Write("testing SessionHelper connect after router shutdown... "); + Console.Out.Flush(); + + _factory.setRouterHost(host); + _factory.setPort(getTestPort(10)); + _factory.setProtocol(protocol); + _session = _factory.connect("userid", "abc123"); + while(true) + { try { - test(_session.communicator() != null); - _session.communicator().stringToProxy("dummy"); - test(false); + Monitor.Wait(this); + break; } - catch(Ice.CommunicatorDestroyedException) + catch(ThreadInterruptedException) { } - Console.Out.WriteLine("ok"); + } - Console.Out.Write("testing SessionHelper destroy after connect failure... "); - Console.Out.Flush(); - _session.destroy(); - Console.Out.WriteLine("ok"); + Console.Out.Write("testing SessionHelper isConnect after connect failure... "); + Console.Out.Flush(); + test(_session.isConnected() == false); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing SessionHelper communicator after connect failure... "); + Console.Out.Flush(); + try + { + test(_session.communicator() != null); + _session.communicator().stringToProxy("dummy"); + test(false); + } + catch(Ice.CommunicatorDestroyedException) + { } + Console.Out.WriteLine("ok"); - return 0; + Console.Out.Write("testing SessionHelper destroy after connect failure... "); + Console.Out.Flush(); + _session.destroy(); + Console.Out.WriteLine("ok"); } - public static void - wakeUp() - { - Monitor.Pulse(me); - } + return 0; + } - private static void - test(bool b) + public void + wakeUp() + { + lock(this) { - if(!b) - { - throw new Exception(); - } + Monitor.Pulse(this); } + } - public static App me; - private Ice.InitializationData _initData; - private Glacier2.SessionHelper _session; - private Glacier2.SessionFactoryHelper _factory; + protected override Ice.InitializationData getInitData(ref string[] args) + { + _initData = base.getInitData(ref args); + _initData.properties.setProperty("Ice.Warn.Connections", "0"); + _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:" + + getTestEndpoint(_initData.properties, 10)); + _initData.dispatcher = delegate(Action action, Ice.Connection connection) + { + action(); + }; + return _initData; } public static int Main(string[] args) { - App app = new App(args); - app.getInitData().properties.setProperty("Ice.Warn.Connections", "0"); - return app.main(args, app.getInitData()); + Client app = new Client(); + return app.runmain(args); } + + private Glacier2.SessionHelper _session; + private Glacier2.SessionFactoryHelper _factory; + private Ice.InitializationData _initData; } diff --git a/csharp/test/Glacier2/sessionHelper/Server.cs b/csharp/test/Glacier2/sessionHelper/Server.cs index 0b518572cbf..1a7d8e73673 100644 --- a/csharp/test/Glacier2/sessionHelper/Server.cs +++ b/csharp/test/Glacier2/sessionHelper/Server.cs @@ -16,27 +16,24 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - public class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) - { - communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", "default -p 12011"); - communicator().createObjectAdapter("DeactivatedAdapter"); + communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", getTestEndpoint(1)); + communicator().createObjectAdapter("DeactivatedAdapter"); - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); - adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback")); - adapter.activate(); - communicator().waitForShutdown(); - return 0; - } + communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); + adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback")); + adapter.activate(); + communicator().waitForShutdown(); + return 0; } public static int Main(string[] args) { - App app = new App(); - return app.main(args); + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj b/csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj index ef5a3db3f89..eabb39ab33d 100644 --- a/csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj +++ b/csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\CallbackI.cs"> <Link>CallbackI.cs</Link> </Compile> diff --git a/csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj b/csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj index 25b7f3f222b..473ea1ffafc 100644 --- a/csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj +++ b/csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\CallbackI.cs"> <Link>CallbackI.cs</Link> </Compile> diff --git a/csharp/test/Glacier2/sessionHelper/run.py b/csharp/test/Glacier2/sessionHelper/run.py deleted file mode 100755 index 3e8c8b6e2d3..00000000000 --- a/csharp/test/Glacier2/sessionHelper/run.py +++ /dev/null @@ -1,48 +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 - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints=default' \ - ' --Ice.Admin.Endpoints="default -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest(additionalClientOptions=" --shutdown") - -starterProc.waitTestSuccess() diff --git a/csharp/test/Ice/acm/AllTests.cs b/csharp/test/Ice/acm/AllTests.cs index 4991e562454..4059809084d 100644 --- a/csharp/test/Ice/acm/AllTests.cs +++ b/csharp/test/Ice/acm/AllTests.cs @@ -253,7 +253,7 @@ abstract class TestCase protected bool _closed; }; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { class InvocationHeartbeatTest : TestCase { @@ -515,9 +515,10 @@ public class AllTests : TestCommon.TestApp } }; - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { - string @ref = "communicator:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string @ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref)); List<TestCase> tests = new List<TestCase>(); diff --git a/csharp/test/Ice/acm/Client.cs b/csharp/test/Ice/acm/Client.cs index 1774765bfdf..c00cae416a5 100644 --- a/csharp/test/Ice/acm/Client.cs +++ b/csharp/test/Ice/acm/Client.cs @@ -17,46 +17,24 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/acm/Server.cs b/csharp/test/Ice/acm/Server.cs index 1482464c5cb..4ff3c7fc856 100644 --- a/csharp/test/Ice/acm/Server.cs +++ b/csharp/test/Ice/acm/Server.cs @@ -17,56 +17,34 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - communicator.getProperties().setProperty("TestAdapter.ACM.Timeout", "0"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + communicator().getProperties().setProperty("TestAdapter.ACM.Timeout", "0"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Identity id = Ice.Util.stringToIdentity("communicator"); adapter.add(new RemoteCommunicatorI(), id); adapter.activate(); - communicator.getProperties().setProperty("Ice.PrintAdapterReady", "0"); + communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0"); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.ACM.Timeout", "1"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.ACM.Timeout", "1"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/acm/msbuild/server/server.csproj b/csharp/test/Ice/acm/msbuild/server/server.csproj index f00ee8268b7..b1bb314fc5b 100644 --- a/csharp/test/Ice/acm/msbuild/server/server.csproj +++ b/csharp/test/Ice/acm/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/acm/run.py b/csharp/test/Ice/acm/run.py deleted file mode 100755 index bfec815018d..00000000000 --- a/csharp/test/Ice/acm/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, getopt - -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() diff --git a/csharp/test/Ice/adapterDeactivation/AllTests.cs b/csharp/test/Ice/adapterDeactivation/AllTests.cs index 1236e202fd8..43290043aff 100644 --- a/csharp/test/Ice/adapterDeactivation/AllTests.cs +++ b/csharp/test/Ice/adapterDeactivation/AllTests.cs @@ -10,13 +10,14 @@ using System; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static TestIntfPrx allTests(Ice.Communicator communicator) + public static TestIntfPrx allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); - string @ref = "test:default -p 12010"; + string @ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx @base = communicator.stringToProxy(@ref); test(@base != null); WriteLine("ok"); @@ -65,7 +66,7 @@ public class AllTests : TestCommon.TestApp Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties().ice_clone_(); Ice.Communicator comm = Ice.Util.initialize(initData); - comm.stringToProxy("test:default -p 12010").begin_ice_ping(); + comm.stringToProxy("test:" + app.getTestEndpoint(0)).begin_ice_ping(); comm.destroy(); } WriteLine("ok"); diff --git a/csharp/test/Ice/adapterDeactivation/Client.cs b/csharp/test/Ice/adapterDeactivation/Client.cs index ec0bcbf9ccb..d0f32efec89 100644 --- a/csharp/test/Ice/adapterDeactivation/Client.cs +++ b/csharp/test/Ice/adapterDeactivation/Client.cs @@ -18,20 +18,17 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - internal class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) - { - AllTests.allTests(communicator()); - return 0; - } + AllTests.allTests(this); + return 0; } - + public static int Main(string[] args) { - App app = new App(); - return app.main(args); + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/adapterDeactivation/Collocated.cs b/csharp/test/Ice/adapterDeactivation/Collocated.cs index 30a4fa2c598..0bede6c409e 100644 --- a/csharp/test/Ice/adapterDeactivation/Collocated.cs +++ b/csharp/test/Ice/adapterDeactivation/Collocated.cs @@ -16,33 +16,30 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - internal class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); - // - // 2 threads are necessary to dispatch the collocated transient() call with AMI - // - communicator().getProperties().setProperty("TestAdapter.ThreadPool.Size", "2"); + // + // 2 threads are necessary to dispatch the collocated transient() call with AMI + // + communicator().getProperties().setProperty("TestAdapter.ThreadPool.Size", "2"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - Ice.ServantLocator locator = new ServantLocatorI(); - adapter.addServantLocator(locator, ""); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ServantLocator locator = new ServantLocatorI(); + adapter.addServantLocator(locator, ""); - AllTests.allTests(communicator()); + AllTests.allTests(this); - adapter.waitForDeactivate(); - return 0; - } + adapter.waitForDeactivate(); + return 0; } public static int Main(string[] args) { - App app = new App(); - return app.main(args); + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/adapterDeactivation/Server.cs b/csharp/test/Ice/adapterDeactivation/Server.cs index a7cc8b99fc9..6af39d08350 100644 --- a/csharp/test/Ice/adapterDeactivation/Server.cs +++ b/csharp/test/Ice/adapterDeactivation/Server.cs @@ -16,25 +16,22 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - internal class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - Ice.ServantLocator locator = new ServantLocatorI(); - adapter.addServantLocator(locator, ""); - adapter.activate(); - adapter.waitForDeactivate(); - return 0; - } + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ServantLocator locator = new ServantLocatorI(); + adapter.addServantLocator(locator, ""); + adapter.activate(); + adapter.waitForDeactivate(); + return 0; } - + public static int Main(string[] args) { - App app = new App(); - return app.main(args); + Server app = new Server(); + return app.runmain(args); } -} +}
\ No newline at end of file diff --git a/csharp/test/Ice/adapterDeactivation/TestI.cs b/csharp/test/Ice/adapterDeactivation/TestI.cs index c259c8c855f..fd53fa02018 100644 --- a/csharp/test/Ice/adapterDeactivation/TestI.cs +++ b/csharp/test/Ice/adapterDeactivation/TestI.cs @@ -15,8 +15,7 @@ public sealed class TestI : TestIntfDisp_ { Ice.Communicator communicator = current.adapter.getCommunicator(); - Ice.ObjectAdapter adapter = - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); adapter.activate(); adapter.destroy(); } diff --git a/csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj b/csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj index 2b5db259b7e..2ba0dbdabf7 100644 --- a/csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj +++ b/csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\CookieI.cs"> <Link>CookieI.cs</Link> </Compile> diff --git a/csharp/test/Ice/adapterDeactivation/run.py b/csharp/test/Ice/adapterDeactivation/run.py deleted file mode 100755 index df7bc2b4ac3..00000000000 --- a/csharp/test/Ice/adapterDeactivation/run.py +++ /dev/null @@ -1,25 +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, getopt - -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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/admin/AllTests.cs b/csharp/test/Ice/admin/AllTests.cs index 198232d96ec..75071ea151b 100644 --- a/csharp/test/Ice/admin/AllTests.cs +++ b/csharp/test/Ice/admin/AllTests.cs @@ -14,7 +14,7 @@ using System.Threading; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { static void testFacets(Ice.Communicator com, bool builtInFacets) @@ -92,8 +92,9 @@ public class AllTests : TestCommon.TestApp } } - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Write("testing communicator operations... "); Flush(); { @@ -172,7 +173,7 @@ public class AllTests : TestCommon.TestApp } WriteLine("ok"); - string @ref = "factory:default -p 12010 -t 10000"; + string @ref = "factory:" + app.getTestEndpoint(0) + " -t 10000"; RemoteCommunicatorFactoryPrx factory = RemoteCommunicatorFactoryPrxHelper.uncheckedCast(communicator.stringToProxy(@ref)); @@ -264,30 +265,30 @@ public class AllTests : TestCommon.TestApp props.Add("Ice.Admin.InstanceName", "Test"); props.Add("NullLogger", "1"); RemoteCommunicatorPrx com = factory.createCommunicator(props); - + com.trace("testCat", "trace"); com.warning("warning"); com.error("error"); com.print("print"); - + Ice.ObjectPrx obj = com.getAdmin(); Ice.LoggerAdminPrx logger = Ice.LoggerAdminPrxHelper.checkedCast(obj, "Logger"); test(logger != null); string prefix = null; - + // // Get all // Ice.LogMessage[] logMessages = logger.getLog(null, null, -1, out prefix); - + test(logMessages.Length == 4); test(prefix.Equals("NullLogger")); - test(logMessages[0].traceCategory.Equals("testCat") && logMessages[0].message.Equals("trace")); + test(logMessages[0].traceCategory.Equals("testCat") && logMessages[0].message.Equals("trace")); test(logMessages[1].message.Equals("warning")); test(logMessages[2].message.Equals("error")); test(logMessages[3].message.Equals("print")); - + // // Get only errors and warnings // @@ -295,35 +296,35 @@ public class AllTests : TestCommon.TestApp com.print("print2"); com.trace("testCat", "trace2"); com.warning("warning2"); - + Ice.LogMessageType[] messageTypes = {Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.WarningMessage}; - + logMessages = logger.getLog(messageTypes, null, -1, out prefix); - + test(logMessages.Length == 4); test(prefix.Equals("NullLogger")); - + foreach(var msg in logMessages) { test(msg.type == Ice.LogMessageType.ErrorMessage || msg.type == Ice.LogMessageType.WarningMessage); } - + // // Get only errors and traces with Cat = "testCat" // com.trace("testCat2", "A"); com.trace("testCat", "trace3"); com.trace("testCat2", "B"); - + messageTypes = new Ice.LogMessageType[]{Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.TraceMessage}; string[] categories = {"testCat"}; logMessages = logger.getLog(messageTypes, categories, -1, out prefix); test(logMessages.Length == 5); test(prefix.Equals("NullLogger")); - + foreach(var msg in logMessages) - { - test(msg.type == Ice.LogMessageType.ErrorMessage || + { + test(msg.type == Ice.LogMessageType.ErrorMessage || (msg.type == Ice.LogMessageType.TraceMessage && msg.traceCategory.Equals("testCat"))); } @@ -335,20 +336,20 @@ public class AllTests : TestCommon.TestApp logMessages = logger.getLog(messageTypes, categories, 2, out prefix); test(logMessages.Length == 2); test(prefix.Equals("NullLogger")); - + test(logMessages[0].message.Equals("trace3")); test(logMessages[1].message.Equals("error3")); - + // // Now, test RemoteLogger // - Ice.ObjectAdapter adapter = + Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("RemoteLoggerAdapter", "tcp -h localhost"); - + RemoteLoggerI remoteLogger = new RemoteLoggerI(); - + Ice.RemoteLoggerPrx myProxy = Ice.RemoteLoggerPrxHelper.uncheckedCast(adapter.addWithUUID(remoteLogger)); - + adapter.activate(); // @@ -356,25 +357,25 @@ public class AllTests : TestCommon.TestApp // logMessages = logger.getLog(null, null, -1, out prefix); remoteLogger.checkNextInit(prefix, logMessages); - + logger.attachRemoteLogger(myProxy, null, null, -1); remoteLogger.wait(1); - + remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace", "testCat"); remoteLogger.checkNextLog(Ice.LogMessageType.WarningMessage, "rwarning", ""); remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror", ""); remoteLogger.checkNextLog(Ice.LogMessageType.PrintMessage, "rprint", ""); - + com.trace("testCat", "rtrace"); com.warning("rwarning"); com.error("rerror"); com.print("rprint"); remoteLogger.wait(4); - + test(logger.detachRemoteLogger(myProxy)); test(!logger.detachRemoteLogger(myProxy)); - + // // Use Error + Trace with "traceCat" filter with 4 limit // @@ -384,10 +385,10 @@ public class AllTests : TestCommon.TestApp logger.attachRemoteLogger(myProxy, messageTypes, categories, 4); remoteLogger.wait(1); - + remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace2", "testCat"); remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror2", ""); - + com.warning("rwarning2"); com.trace("testCat", "rtrace2"); com.warning("rwarning3"); @@ -395,13 +396,13 @@ public class AllTests : TestCommon.TestApp com.print("rprint2"); remoteLogger.wait(2); - + // // Attempt reconnection with slightly different proxy // try { - logger.attachRemoteLogger(Ice.RemoteLoggerPrxHelper.uncheckedCast(myProxy.ice_oneway()), + logger.attachRemoteLogger(Ice.RemoteLoggerPrxHelper.uncheckedCast(myProxy.ice_oneway()), messageTypes, categories, 4); test(false); } @@ -409,7 +410,7 @@ public class AllTests : TestCommon.TestApp { // expected } - + com.destroy(); } WriteLine("ok"); @@ -541,7 +542,7 @@ public class AllTests : TestCommon.TestApp Monitor.PulseAll(this); } } - + override public void log(Ice.LogMessage logMessage, Ice.Current current) { lock(this) @@ -549,12 +550,12 @@ public class AllTests : TestCommon.TestApp Ice.LogMessage front = _expectedLogMessages.Dequeue(); test(front.type == logMessage.type && front.message.Equals(logMessage.message) && front.traceCategory.Equals(logMessage.traceCategory)); - + _receivedCalls++; Monitor.PulseAll(this); } } - + internal void checkNextInit(string prefix, Ice.LogMessage[] logMessages) { lock(this) @@ -563,7 +564,7 @@ public class AllTests : TestCommon.TestApp _expectedInitMessages = logMessages; } } - + internal void checkNextLog(Ice.LogMessageType messageType,string message, string category) { lock(this) @@ -572,20 +573,20 @@ public class AllTests : TestCommon.TestApp _expectedLogMessages.Enqueue(logMessage); } } - + internal void wait(int calls) { lock(this) { _receivedCalls -= calls; - + while(_receivedCalls < 0) { Monitor.Wait(this); } } } - + private int _receivedCalls = 0; private string _expectedPrefix; private Ice.LogMessage[] _expectedInitMessages; diff --git a/csharp/test/Ice/admin/Client.cs b/csharp/test/Ice/admin/Client.cs index 0c8c690e755..3371a595aeb 100644 --- a/csharp/test/Ice/admin/Client.cs +++ b/csharp/test/Ice/admin/Client.cs @@ -17,45 +17,17 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - Debug.Listeners.Add(new ConsoleTraceListener()); - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/admin/Server.cs b/csharp/test/Ice/admin/Server.cs index 048d076412c..5413ae94984 100644 --- a/csharp/test/Ice/admin/Server.cs +++ b/csharp/test/Ice/admin/Server.cs @@ -16,49 +16,23 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 10000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Identity id = Ice.Util.stringToIdentity("factory"); adapter.add(new RemoteCommunicatorFactoryI(), id); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/admin/msbuild/server/server.csproj b/csharp/test/Ice/admin/msbuild/server/server.csproj index 96ea322e9f2..e6a5bcad856 100644 --- a/csharp/test/Ice/admin/msbuild/server/server.csproj +++ b/csharp/test/Ice/admin/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/admin/run.py b/csharp/test/Ice/admin/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/csharp/test/Ice/admin/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() diff --git a/csharp/test/Ice/ami/AllTests.cs b/csharp/test/Ice/ami/AllTests.cs index 723097ca599..cf6e642e0dc 100644 --- a/csharp/test/Ice/ami/AllTests.cs +++ b/csharp/test/Ice/ami/AllTests.cs @@ -14,7 +14,7 @@ using System.Threading; using System.Threading.Tasks; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Cookie { @@ -700,15 +700,16 @@ public class AllTests : TestCommon.TestApp ThrowType _t; } - public static void allTests(Ice.Communicator communicator, bool collocated) + public static void allTests(TestCommon.Application app, bool collocated) { - string sref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); Test.TestIntfPrx p = Test.TestIntfPrxHelper.uncheckedCast(obj); - sref = "testController:default -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/csharp/test/Ice/ami/Client.cs b/csharp/test/Ice/ami/Client.cs index 6a6e407ea27..bc64d64276a 100644 --- a/csharp/test/Ice/ami/Client.cs +++ b/csharp/test/Ice/ami/Client.cs @@ -16,52 +16,29 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator, false); + AllTests.allTests(this, false); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.AMICallback", "0"); - // - // Limit the send buffer size, this test relies on the socket - // send() blocking after sending a given amount of data. - // - initData.properties.setProperty("Ice.TCP.SndSize", "50000"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.AMICallback", "0"); + // + // Limit the send buffer size, this test relies on the socket + // send() blocking after sending a given amount of data. + // + initData.properties.setProperty("Ice.TCP.SndSize", "50000"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/ami/Collocated.cs b/csharp/test/Ice/ami/Collocated.cs index 0627679d450..f229fbfeae8 100644 --- a/csharp/test/Ice/ami/Collocated.cs +++ b/csharp/test/Ice/ami/Collocated.cs @@ -16,58 +16,41 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); + communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Collocated test doesn't need to activate the OA adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Collocated test doesn't need to activate the OA - AllTests.allTests(communicator, true); + AllTests.allTests(this, true); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.AMICallback", "0"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.AMICallback", "0"); + // + // Limit the send buffer size, this test relies on the socket + // send() blocking after sending a given amount of data. + // + initData.properties.setProperty("Ice.TCP.SndSize", "50000"); + return initData; + } - return status; + public static int Main(string[] args) + { + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/ami/Server.cs b/csharp/test/Ice/ami/Server.cs index 4d544317ca3..d07fb4e30bf 100644 --- a/csharp/test/Ice/ami/Server.cs +++ b/csharp/test/Ice/ami/Server.cs @@ -16,69 +16,47 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); + communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); adapter.activate(); adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); adapter2.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ServerIdleTime", "30"); - - // - // Disable collocation optimization to test async/await dispatch. - // - initData.properties.setProperty("Ice.Default.CollocationOptimized", "0"); - - // - // Limit the recv buffer size, this test relies on the socket - // send() blocking after sending a given amount of data. - // - initData.properties.setProperty("Ice.TCP.RcvSize", "50000"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ServerIdleTime", "30"); + + // + // Disable collocation optimization to test async/await dispatch. + // + initData.properties.setProperty("Ice.Default.CollocationOptimized", "0"); + + // + // Limit the recv buffer size, this test relies on the socket + // send() blocking after sending a given amount of data. + // + initData.properties.setProperty("Ice.TCP.RcvSize", "50000"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/ami/msbuild/server/server.csproj b/csharp/test/Ice/ami/msbuild/server/server.csproj index 12c447b7a1c..428d2935f11 100644 --- a/csharp/test/Ice/ami/msbuild/server/server.csproj +++ b/csharp/test/Ice/ami/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/ami/run.py b/csharp/test/Ice/ami/run.py deleted file mode 100755 index df7bc2b4ac3..00000000000 --- a/csharp/test/Ice/ami/run.py +++ /dev/null @@ -1,25 +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, getopt - -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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/application/test.py b/csharp/test/Ice/application/test.py new file mode 100644 index 00000000000..305861e65c4 --- /dev/null +++ b/csharp/test/Ice/application/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. +# +# ********************************************************************** + +# Run this test manually diff --git a/csharp/test/Ice/background/AllTests.cs b/csharp/test/Ice/background/AllTests.cs index b92ddfdf635..0a81a8e6d7a 100644 --- a/csharp/test/Ice/background/AllTests.cs +++ b/csharp/test/Ice/background/AllTests.cs @@ -193,15 +193,16 @@ public class AllTests private Thread _thread; } - public static Test.BackgroundPrx allTests(Ice.Communicator communicator) + public static Test.BackgroundPrx allTests(TestCommon.Application app) { - string sref = "background:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string sref = "background:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj); - sref = "backgroundController:tcp -p 12011"; + sref = "backgroundController:" + app.getTestEndpoint(1, "tcp"); obj = communicator.stringToProxy(sref); test(obj != null); @@ -241,7 +242,7 @@ public class AllTests Console.Out.Flush(); { Ice.LocatorPrx locator; - obj = communicator.stringToProxy("locator:default -p 12010").ice_invocationTimeout(250); + obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)).ice_invocationTimeout(250); locator = Ice.LocatorPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway(); @@ -256,7 +257,7 @@ public class AllTests } backgroundController.resumeCall("findAdapterById"); - obj = communicator.stringToProxy("locator:default -p 12010"); + obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)); locator = Ice.LocatorPrxHelper.uncheckedCast(obj); obj = obj.ice_locator(locator); obj.ice_ping(); @@ -282,7 +283,7 @@ public class AllTests { Ice.RouterPrx router; - obj = communicator.stringToProxy("router:default -p 12010").ice_invocationTimeout(250); + obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)).ice_invocationTimeout(250); router = Ice.RouterPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway(); @@ -297,7 +298,7 @@ public class AllTests } backgroundController.resumeCall("getClientProxy"); - obj = communicator.stringToProxy("router:default -p 12010"); + obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)); router = Ice.RouterPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router); BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); diff --git a/csharp/test/Ice/background/Client.cs b/csharp/test/Ice/background/Client.cs index da54678ded4..92fabf45672 100644 --- a/csharp/test/Ice/background/Client.cs +++ b/csharp/test/Ice/background/Client.cs @@ -16,73 +16,48 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.BackgroundPrx background = AllTests.allTests(communicator); + PluginI plugin = new PluginI(communicator()); + plugin.initialize(); + communicator().getPluginManager().addPlugin("Test", plugin); + Test.BackgroundPrx background = AllTests.allTests(this); background.shutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - - // - // For this test, we want to disable retries. - // - initData.properties.setProperty("Ice.RetryIntervals", "-1"); - - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - initData.properties.setProperty("Ice.MessageSizeMax", "50000"); - - // This test relies on filling the TCP send/recv buffer, so - // we rely on a fixed value for these buffers. - initData.properties.setProperty("Ice.TCP.SndSize", "50000"); - - // - // Setup the test transport plug-in. - // - string defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); - - communicator = Ice.Util.initialize(ref args, initData); - PluginI plugin = new PluginI(communicator); - plugin.initialize(); - communicator.getPluginManager().addPlugin("Test", plugin); - - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + // + // For this test, we want to disable retries. + // + initData.properties.setProperty("Ice.RetryIntervals", "-1"); + + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + + initData.properties.setProperty("Ice.MessageSizeMax", "50000"); + + // This test relies on filling the TCP send/recv buffer, so + // we rely on a fixed value for these buffers. + initData.properties.setProperty("Ice.TCP.SndSize", "50000"); + + // + // Setup the test transport plug-in. + // + string defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/background/Server.cs b/csharp/test/Ice/background/Server.cs index 2e1dcb3b7f7..f387b8a8729 100644 --- a/csharp/test/Ice/background/Server.cs +++ b/csharp/test/Ice/background/Server.cs @@ -18,7 +18,7 @@ using System.Threading.Tasks; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { internal class LocatorI : Ice.LocatorDisp_ { @@ -77,25 +77,29 @@ public class Server private BackgroundControllerI _controller; } - public static int run(string[] args, Ice.Communicator communicator, TextWriter @out) + public override int run(string[] args) { + PluginI plugin = new PluginI(communicator()); + plugin.initialize(); + communicator().getPluginManager().addPlugin("Test", plugin); + // // When running as a MIDlet the properties for the server may be // overridden by configuration. If it isn't then we assume // defaults. // - if(communicator.getProperties().getProperty("TestAdapter.Endpoints").Length == 0) + if(communicator().getProperties().getProperty("TestAdapter.Endpoints").Length == 0) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); } - if(communicator.getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0) + if(communicator().getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0) { - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); + communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1, "tcp")); + communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); } - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); BackgroundControllerI backgroundController = new BackgroundControllerI(adapter); @@ -107,63 +111,36 @@ public class Server adapter2.add(backgroundController, Ice.Util.stringToIdentity("backgroundController")); adapter2.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); + Ice.InitializationData initData = base.getInitData(ref args); - initData.properties.setProperty("Ice.MessageSizeMax", "50000"); - - // This test relies on filling the TCP send/recv buffer, so - // we rely on a fixed value for these buffers. - initData.properties.setProperty("Ice.TCP.RcvSize", "50000"); + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); - // - // Setup the test transport plug-in. - // - string defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); + initData.properties.setProperty("Ice.MessageSizeMax", "50000"); - communicator = Ice.Util.initialize(ref args, initData); - PluginI plugin = new PluginI(communicator); - plugin.initialize(); - communicator.getPluginManager().addPlugin("Test", plugin); + // This test relies on filling the TCP send/recv buffer, so + // we rely on a fixed value for these buffers. + initData.properties.setProperty("Ice.TCP.RcvSize", "50000"); - status = run(args, communicator, Console.Out); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + // + // Setup the test transport plug-in. + // + string defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/background/msbuild/server/server.csproj b/csharp/test/Ice/background/msbuild/server/server.csproj index c1181cb04cc..5f224c503d8 100644 --- a/csharp/test/Ice/background/msbuild/server/server.csproj +++ b/csharp/test/Ice/background/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Acceptor.cs"> <Link>Acceptor.cs</Link> </Compile> diff --git a/csharp/test/Ice/background/run.py b/csharp/test/Ice/background/run.py deleted file mode 100755 index bfec815018d..00000000000 --- a/csharp/test/Ice/background/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, getopt - -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() diff --git a/csharp/test/Ice/binding/AllTests.cs b/csharp/test/Ice/binding/AllTests.cs index de76daa74f8..edd2e316928 100644 --- a/csharp/test/Ice/binding/AllTests.cs +++ b/csharp/test/Ice/binding/AllTests.cs @@ -12,7 +12,7 @@ using System.Collections.Generic; using System.Diagnostics; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private static string getAdapterNameWithAMI(TestIntfPrx testIntf) { @@ -89,9 +89,10 @@ public class AllTests : TestCommon.TestApp } }; - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { - string @ref = "communicator:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string @ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref)); System.Random rand = new System.Random(unchecked((int)System.DateTime.Now.Ticks)); @@ -840,19 +841,21 @@ public class AllTests : TestCommon.TestApp clientProps.Add(bothPreferIPv4); clientProps.Add(bothPreferIPv6); + string endpoint = "tcp -p " + app.getTestPort(2).ToString(); + Ice.Properties anyipv4 = ipv4.ice_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.Properties anyipv6 = ipv6.ice_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.Properties anyboth = Ice.Util.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 + " -h \"::1\":" + endpoint + " -h 127.0.0.1"); Ice.Properties localipv4 = ipv4.ice_clone_(); localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1"); diff --git a/csharp/test/Ice/binding/Client.cs b/csharp/test/Ice/binding/Client.cs index 7c7b51e3b37..fcc80eedcff 100644 --- a/csharp/test/Ice/binding/Client.cs +++ b/csharp/test/Ice/binding/Client.cs @@ -16,43 +16,17 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.Error.WriteLine(ex.ToString()); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/binding/RemoteCommunicatorI.cs b/csharp/test/Ice/binding/RemoteCommunicatorI.cs index 7c9ffc15479..ed33ad23ce6 100644 --- a/csharp/test/Ice/binding/RemoteCommunicatorI.cs +++ b/csharp/test/Ice/binding/RemoteCommunicatorI.cs @@ -11,17 +11,19 @@ using Test; public class RemoteCommunicatorI : RemoteCommunicatorDisp_ { + + public RemoteCommunicatorI(TestCommon.Application app) + { + _app = app; + } + public override RemoteObjectAdapterPrx createObjectAdapter(string name, string endpts, Ice.Current current) { string endpoints = endpts; if(endpoints.IndexOf("-p") < 0) { - // Use a fixed port if none is specified (bug 2896) - endpoints += " -h \"" + - (current.adapter.getCommunicator().getProperties().getPropertyWithDefault( - "Ice.Default.Host", "127.0.0.1")) + - "\" -p " + _nextPort++; + endpoints = _app.getTestEndpoint(_nextPort++, endpoints); } Ice.Communicator com = current.adapter.getCommunicator(); @@ -43,5 +45,6 @@ public class RemoteCommunicatorI : RemoteCommunicatorDisp_ current.adapter.getCommunicator().shutdown(); } - private int _nextPort = 10001; + private TestCommon.Application _app; + private int _nextPort = 10; }; diff --git a/csharp/test/Ice/binding/Server.cs b/csharp/test/Ice/binding/Server.cs index f427698fbd3..04fea198ac2 100644 --- a/csharp/test/Ice/binding/Server.cs +++ b/csharp/test/Ice/binding/Server.cs @@ -16,52 +16,30 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Identity id = Ice.Util.stringToIdentity("communicator"); - adapter.add(new RemoteCommunicatorI(), id); + adapter.add(new RemoteCommunicatorI(this), id); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ServerIdleTime", "30"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ServerIdleTime", "30"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/binding/msbuild/server/server.csproj b/csharp/test/Ice/binding/msbuild/server/server.csproj index 6b8d8e6a658..c0ff88ad39b 100644 --- a/csharp/test/Ice/binding/msbuild/server/server.csproj +++ b/csharp/test/Ice/binding/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\RemoteCommunicatorI.cs"> <Link>RemoteCommunicatorI.cs</Link> </Compile> diff --git a/csharp/test/Ice/binding/run.py b/csharp/test/Ice/binding/run.py deleted file mode 100755 index bfec815018d..00000000000 --- a/csharp/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, getopt - -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() diff --git a/csharp/test/Ice/checksum/AllTests.cs b/csharp/test/Ice/checksum/AllTests.cs index 4831da2b0ce..353b4763c40 100644 --- a/csharp/test/Ice/checksum/AllTests.cs +++ b/csharp/test/Ice/checksum/AllTests.cs @@ -10,21 +10,13 @@ using System; using System.Collections.Generic; -public class AllTests +public class AllTests : TestCommon.AllTests { - private static void - test(bool b) - { - if(!b) - { - throw new Exception(); - } - } - public static Test.ChecksumPrx - allTests(Ice.Communicator communicator, bool collocated) + allTests(TestCommon.Application app, bool collocated) { - string rf = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string rf = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf); test(baseProxy != null); diff --git a/csharp/test/Ice/checksum/Client.cs b/csharp/test/Ice/checksum/Client.cs index 6969ea91115..d98cf02d4da 100644 --- a/csharp/test/Ice/checksum/Client.cs +++ b/csharp/test/Ice/checksum/Client.cs @@ -10,44 +10,18 @@ using System; using System.Diagnostics; -public class Client +public class Client : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.ChecksumPrx checksum = AllTests.allTests(communicator, false); + Test.ChecksumPrx checksum = AllTests.allTests(this, false); checksum.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/checksum/msbuild/client/client.csproj b/csharp/test/Ice/checksum/msbuild/client/client.csproj index 73b8cc2a4f2..a292f0e3914 100644 --- a/csharp/test/Ice/checksum/msbuild/client/client.csproj +++ b/csharp/test/Ice/checksum/msbuild/client/client.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\AllTests.cs"> <Link>AllTests.cs</Link> </Compile> diff --git a/csharp/test/Ice/checksum/run.py b/csharp/test/Ice/checksum/run.py deleted file mode 100755 index 8d960dffc1d..00000000000 --- a/csharp/test/Ice/checksum/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, getopt - -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(server = os.path.join(os.getcwd(), "server", "server")) -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/checksum/server/Server.cs b/csharp/test/Ice/checksum/server/Server.cs index 50cde4c714f..29bdc48e609 100644 --- a/csharp/test/Ice/checksum/server/Server.cs +++ b/csharp/test/Ice/checksum/server/Server.cs @@ -9,48 +9,22 @@ using System; -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object @object = new Test.ChecksumI(); adapter.add(@object, Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/checksum/server/msbuild/server/server.csproj b/csharp/test/Ice/checksum/server/msbuild/server/server.csproj index d558b16a746..e6a1b313310 100644 --- a/csharp/test/Ice/checksum/server/msbuild/server/server.csproj +++ b/csharp/test/Ice/checksum/server/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/checksum/test.py b/csharp/test/Ice/checksum/test.py new file mode 100644 index 00000000000..38254e6d252 --- /dev/null +++ b/csharp/test/Ice/checksum/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(__name__, [ClientServerTestCase(server="server\server")]) diff --git a/csharp/test/Ice/defaultServant/AllTests.cs b/csharp/test/Ice/defaultServant/AllTests.cs index b966da4da25..6701ccdde82 100644 --- a/csharp/test/Ice/defaultServant/AllTests.cs +++ b/csharp/test/Ice/defaultServant/AllTests.cs @@ -20,8 +20,9 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator) + allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost"); oa.activate(); diff --git a/csharp/test/Ice/defaultServant/Client.cs b/csharp/test/Ice/defaultServant/Client.cs index 00d9b182597..93793376dd9 100644 --- a/csharp/test/Ice/defaultServant/Client.cs +++ b/csharp/test/Ice/defaultServant/Client.cs @@ -16,44 +16,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/defaultServant/run.py b/csharp/test/Ice/defaultServant/run.py deleted file mode 100755 index 09987879f33..00000000000 --- a/csharp/test/Ice/defaultServant/run.py +++ /dev/null @@ -1,31 +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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0", startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/csharp/test/Ice/defaultValue/AllTests.cs b/csharp/test/Ice/defaultValue/AllTests.cs index d637192a5c9..832608a8187 100644 --- a/csharp/test/Ice/defaultValue/AllTests.cs +++ b/csharp/test/Ice/defaultValue/AllTests.cs @@ -7,7 +7,7 @@ // // ********************************************************************** -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { public static void allTests() { diff --git a/csharp/test/Ice/defaultValue/Client.cs b/csharp/test/Ice/defaultValue/Client.cs index 8896ff77f82..eecb6e28e6f 100644 --- a/csharp/test/Ice/defaultValue/Client.cs +++ b/csharp/test/Ice/defaultValue/Client.cs @@ -16,30 +16,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args) + public override int run(string[] args) { AllTests.allTests(); - return 0; } public static int Main(string[] args) { - int status = 0; - - try - { - status = run(args); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/defaultValue/run.py b/csharp/test/Ice/defaultValue/run.py deleted file mode 100755 index d414711377b..00000000000 --- a/csharp/test/Ice/defaultValue/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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -sys.stdout.write("starting client...") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/csharp/test/Ice/dictMapping/AllTests.cs b/csharp/test/Ice/dictMapping/AllTests.cs index cabf73185b6..4b0f29cc4b3 100644 --- a/csharp/test/Ice/dictMapping/AllTests.cs +++ b/csharp/test/Ice/dictMapping/AllTests.cs @@ -7,12 +7,13 @@ // // ********************************************************************** -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static Test.MyClassPrx allTests(Ice.Communicator communicator, bool collocated) + public static Test.MyClassPrx allTests(TestCommon.Application app, bool collocated) { + Ice.Communicator communicator = app.communicator(); Flush(); - string rf = "test:default -p 12010"; + string rf = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf); Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy); diff --git a/csharp/test/Ice/dictMapping/Client.cs b/csharp/test/Ice/dictMapping/Client.cs index a17768dc7a3..5227260717b 100644 --- a/csharp/test/Ice/dictMapping/Client.cs +++ b/csharp/test/Ice/dictMapping/Client.cs @@ -17,11 +17,11 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.MyClassPrx myClass = AllTests.allTests(communicator, false); + Test.MyClassPrx myClass = AllTests.allTests(this, false); Console.Out.Write("shutting down server... "); Console.Out.Flush(); @@ -32,33 +32,7 @@ public class Client public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/dictMapping/Collocated.cs b/csharp/test/Ice/dictMapping/Collocated.cs index d2edaf61525..286925b70de 100644 --- a/csharp/test/Ice/dictMapping/Collocated.cs +++ b/csharp/test/Ice/dictMapping/Collocated.cs @@ -16,49 +16,23 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator, true); + AllTests.allTests(this, true); return 0; } public static int Main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/dictMapping/Server.cs b/csharp/test/Ice/dictMapping/Server.cs index e1485f81a45..abefefaf580 100644 --- a/csharp/test/Ice/dictMapping/Server.cs +++ b/csharp/test/Ice/dictMapping/Server.cs @@ -16,48 +16,22 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/dictMapping/msbuild/server/server.csproj b/csharp/test/Ice/dictMapping/msbuild/server/server.csproj index 6fac50ddec5..8a64d9beb10 100644 --- a/csharp/test/Ice/dictMapping/msbuild/server/server.csproj +++ b/csharp/test/Ice/dictMapping/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MyClassI.cs"> <Link>MyClassI.cs</Link> </Compile> diff --git a/csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj index 864df6b6f68..d00af7b2de6 100644 --- a/csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MyClassAMDI.cs"> <Link>MyClassAMDI.cs</Link> </Compile> diff --git a/csharp/test/Ice/dictMapping/run.py b/csharp/test/Ice/dictMapping/run.py deleted file mode 100755 index d0771952158..00000000000 --- a/csharp/test/Ice/dictMapping/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="serveramd") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/dispatcher/AllTests.cs b/csharp/test/Ice/dispatcher/AllTests.cs index 61e7413236a..8c019347a07 100644 --- a/csharp/test/Ice/dispatcher/AllTests.cs +++ b/csharp/test/Ice/dispatcher/AllTests.cs @@ -11,8 +11,7 @@ using System.Diagnostics; using Test; - -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Callback { @@ -75,15 +74,16 @@ public class AllTests : TestCommon.TestApp private bool _called; } - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { - string sref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); Test.TestIntfPrx p = Test.TestIntfPrxHelper.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/csharp/test/Ice/dispatcher/Client.cs b/csharp/test/Ice/dispatcher/Client.cs index e7a69b700be..35d82a3e596 100644 --- a/csharp/test/Ice/dispatcher/Client.cs +++ b/csharp/test/Ice/dispatcher/Client.cs @@ -16,54 +16,37 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.AMICallback", "0"); + // + // Limit the send buffer size, this test relies on the socket + // send() blocking after sending a given amount of data. + // + initData.properties.setProperty("Ice.TCP.SndSize", "50000"); + initData.dispatcher = new Dispatcher().dispatch; + return initData; + } + public static int Main(string[] args) + { + Client app = new Client(); try { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.AMICallback", "0"); - // - // Limit the send buffer size, this test relies on the socket - // send() blocking after sending a given amount of data. - // - initData.properties.setProperty("Ice.TCP.SndSize", "50000"); - initData.dispatcher = new Dispatcher().dispatch; - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); + return app.runmain(args); } - catch(Exception ex) + finally { - Console.Error.WriteLine(ex); - status = 1; + Dispatcher.terminate(); } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - } - - Dispatcher.terminate(); - - return status; } } diff --git a/csharp/test/Ice/dispatcher/Collocated.cs b/csharp/test/Ice/dispatcher/Collocated.cs index ae25fc29faf..fe7fd156df7 100644 --- a/csharp/test/Ice/dispatcher/Collocated.cs +++ b/csharp/test/Ice/dispatcher/Collocated.cs @@ -16,61 +16,44 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); + communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.AMICallback", "0"); + initData.dispatcher = new Dispatcher().dispatch; + return initData; + } + public static int Main(string[] args) + { + Collocated app = new Collocated(); try { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.AMICallback", "0"); - initData.dispatcher = new Dispatcher().dispatch; - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); + return app.runmain(args); } - catch(Exception ex) + finally { - Console.Error.WriteLine(ex); - status = 1; + Dispatcher.terminate(); } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - Dispatcher.terminate(); - - return status; } } diff --git a/csharp/test/Ice/dispatcher/Server.cs b/csharp/test/Ice/dispatcher/Server.cs index f0f87059499..fe0771a6b16 100644 --- a/csharp/test/Ice/dispatcher/Server.cs +++ b/csharp/test/Ice/dispatcher/Server.cs @@ -16,66 +16,49 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); + communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); adapter.activate(); adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); adapter2.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ServerIdleTime", "30"); + // + // Limit the recv buffer size, this test relies on the socket + // send() blocking after sending a given amount of data. + // + initData.properties.setProperty("Ice.TCP.RcvSize", "50000"); + initData.dispatcher = new Dispatcher().dispatch; + return initData; + } + public static int Main(string[] args) + { + Server app = new Server(); try { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ServerIdleTime", "30"); - // - // Limit the recv buffer size, this test relies on the socket - // send() blocking after sending a given amount of data. - // - initData.properties.setProperty("Ice.TCP.RcvSize", "50000"); - initData.dispatcher = new Dispatcher().dispatch; - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); + return app.runmain(args); } - catch(System.Exception ex) + finally { - System.Console.Error.WriteLine(ex); - status = 1; + Dispatcher.terminate(); } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - } - - Dispatcher.terminate(); - - return status; } } diff --git a/csharp/test/Ice/dispatcher/msbuild/server/server.csproj b/csharp/test/Ice/dispatcher/msbuild/server/server.csproj index 4fad8ba4bc8..04e30888141 100644 --- a/csharp/test/Ice/dispatcher/msbuild/server/server.csproj +++ b/csharp/test/Ice/dispatcher/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Dispatcher.cs"> <Link>Dispatcher.cs</Link> </Compile> diff --git a/csharp/test/Ice/dispatcher/run.py b/csharp/test/Ice/dispatcher/run.py deleted file mode 100755 index df7bc2b4ac3..00000000000 --- a/csharp/test/Ice/dispatcher/run.py +++ /dev/null @@ -1,25 +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, getopt - -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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/echo/Server.cs b/csharp/test/Ice/echo/Server.cs index 28cd7d37aaa..871a6bc0aa3 100644 --- a/csharp/test/Ice/echo/Server.cs +++ b/csharp/test/Ice/echo/Server.cs @@ -16,7 +16,7 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { private class EchoI : Test.EchoDisp_ { @@ -43,50 +43,22 @@ public class Server private BlobjectI _blob; } - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); BlobjectI blob = new BlobjectI(); adapter.addDefaultServant(blob, ""); adapter.add(new EchoI(blob), Ice.Util.stringToIdentity("__echo")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/echo/msbuild/server/server.csproj b/csharp/test/Ice/echo/msbuild/server/server.csproj index 55484eb16e7..985b3cec79a 100644 --- a/csharp/test/Ice/echo/msbuild/server/server.csproj +++ b/csharp/test/Ice/echo/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\BlobjectI.cs"> <Link>BlobjectI.cs</Link> </Compile> diff --git a/csharp/test/Ice/echo/run.py b/csharp/test/Ice/echo/run.py deleted file mode 100755 index b4443ff6130..00000000000 --- a/csharp/test/Ice/echo/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 - -sys.stdout.write("starting server... ") -sys.stdout.flush() -server = os.path.join(os.getcwd(), "server") -p = TestUtil.startServer(server) -print("ok") -sys.stdout.flush() - -p.waitTestSuccess() diff --git a/csharp/test/Ice/enums/AllTests.cs b/csharp/test/Ice/enums/AllTests.cs index 2204b4cbf23..9b3d16c9834 100644 --- a/csharp/test/Ice/enums/AllTests.cs +++ b/csharp/test/Ice/enums/AllTests.cs @@ -10,11 +10,12 @@ using System; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static TestIntfPrx allTests(Ice.Communicator communicator) + public static TestIntfPrx allTests(TestCommon.Application app) { - string sref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); TestIntfPrx proxy = TestIntfPrxHelper.uncheckedCast(obj); diff --git a/csharp/test/Ice/enums/Client.cs b/csharp/test/Ice/enums/Client.cs index 1585a8ba793..e225e0c480f 100644 --- a/csharp/test/Ice/enums/Client.cs +++ b/csharp/test/Ice/enums/Client.cs @@ -17,46 +17,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.TestIntfPrx proxy = AllTests.allTests(communicator); + Test.TestIntfPrx proxy = AllTests.allTests(this); proxy.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - Debug.Listeners.Add(new ConsoleTraceListener()); - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/enums/Server.cs b/csharp/test/Ice/enums/Server.cs index 8a34cfd5a48..a6b6e03daaf 100644 --- a/csharp/test/Ice/enums/Server.cs +++ b/csharp/test/Ice/enums/Server.cs @@ -17,55 +17,31 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - Debug.Listeners.Add(new ConsoleTraceListener()); - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ServerIdleTime", "30"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ServerIdleTime", "30"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/enums/msbuild/server/server.csproj b/csharp/test/Ice/enums/msbuild/server/server.csproj index 96e314fb535..4129c58bf9f 100644 --- a/csharp/test/Ice/enums/msbuild/server/server.csproj +++ b/csharp/test/Ice/enums/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/enums/run.py b/csharp/test/Ice/enums/run.py deleted file mode 100755 index b7e267999af..00000000000 --- a/csharp/test/Ice/enums/run.py +++ /dev/null @@ -1,28 +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(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "1.1", message = "Running test with 1.1 encoding.") -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/exceptions/AllTests.cs b/csharp/test/Ice/exceptions/AllTests.cs index c7fe94f7497..30b5702b2db 100644 --- a/csharp/test/Ice/exceptions/AllTests.cs +++ b/csharp/test/Ice/exceptions/AllTests.cs @@ -12,7 +12,7 @@ using System.Diagnostics; using System.Threading; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Callback { @@ -48,8 +48,9 @@ public class AllTests : TestCommon.TestApp } - public static ThrowerPrx allTests(Ice.Communicator communicator) + public static ThrowerPrx allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); { Write("testing object adapter registration exceptions... "); Ice.ObjectAdapter first; @@ -175,7 +176,7 @@ public class AllTests : TestCommon.TestApp Write("testing stringToProxy... "); Flush(); - String @ref = "thrower:default -p 12010"; + String @ref = "thrower:" + app.getTestEndpoint(0); Ice.ObjectPrx @base = communicator.stringToProxy(@ref); test(@base != null); WriteLine("ok"); @@ -431,7 +432,7 @@ public class AllTests : TestCommon.TestApp } ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast( - communicator.stringToProxy("thrower:default -p 12011")); + communicator.stringToProxy("thrower:" + app.getTestEndpoint(1))); try { thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits) @@ -440,7 +441,7 @@ public class AllTests : TestCommon.TestApp { } ThrowerPrx thrower3 = ThrowerPrxHelper.uncheckedCast( - communicator.stringToProxy("thrower:default -p 12012")); + communicator.stringToProxy("thrower:" + app.getTestEndpoint(2))); try { thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit diff --git a/csharp/test/Ice/exceptions/Client.cs b/csharp/test/Ice/exceptions/Client.cs index 5974abde6e0..660197e44cc 100644 --- a/csharp/test/Ice/exceptions/Client.cs +++ b/csharp/test/Ice/exceptions/Client.cs @@ -17,49 +17,27 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - ThrowerPrx thrower = AllTests.allTests(communicator); + ThrowerPrx thrower = AllTests.allTests(this); thrower.shutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); + initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/exceptions/Collocated.cs b/csharp/test/Ice/exceptions/Collocated.cs index f5b4787dc7a..6d406d406e0 100644 --- a/csharp/test/Ice/exceptions/Collocated.cs +++ b/csharp/test/Ice/exceptions/Collocated.cs @@ -16,51 +16,31 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object obj = new ThrowerI(); adapter.add(obj, Ice.Util.stringToIdentity("thrower")); - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); + initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max + return initData; + } - return status; + public static int Main(string[] args) + { + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/exceptions/Server.cs b/csharp/test/Ice/exceptions/Server.cs index a8af5586552..41c1d39e4d6 100644 --- a/csharp/test/Ice/exceptions/Server.cs +++ b/csharp/test/Ice/exceptions/Server.cs @@ -35,23 +35,23 @@ public sealed class DummyLogger : Ice.Logger } public string getPrefix() - { + { return ""; - } - + } + public Ice.Logger cloneWithPrefix(string prefix) { return new DummyLogger(); } } -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2"); - Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter2"); + Ice.ObjectAdapter adapter3 = communicator().createObjectAdapter("TestAdapter3"); Ice.Object obj = new ThrowerI(); adapter.add(obj, Ice.Util.stringToIdentity("thrower")); adapter2.add(obj, Ice.Util.stringToIdentity("thrower")); @@ -59,50 +59,27 @@ public class Server adapter.activate(); adapter2.activate(); adapter3.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); - initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); - initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); + initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max + initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(initData.properties, 1)); + initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); + initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(initData.properties, 2)); + initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/exceptions/msbuild/server/server.csproj b/csharp/test/Ice/exceptions/msbuild/server/server.csproj index b895e9990d4..3078314ea2c 100644 --- a/csharp/test/Ice/exceptions/msbuild/server/server.csproj +++ b/csharp/test/Ice/exceptions/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\EmptyI.cs"> <Link>EmptyI.cs</Link> </Compile> diff --git a/csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj index ab8448afac5..a8b8e2b560f 100644 --- a/csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\EmptyI.cs"> <Link>EmptyI.cs</Link> </Compile> diff --git a/csharp/test/Ice/exceptions/run.py b/csharp/test/Ice/exceptions/run.py deleted file mode 100755 index 4ee5f87d923..00000000000 --- a/csharp/test/Ice/exceptions/run.py +++ /dev/null @@ -1,50 +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, getopt - -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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "compactAMD", localOnly = True, - message = "Running test with compact (default) format and AMD server.", - server="serveramd") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server="serveramd", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="serveramd", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/facets/AllTests.cs b/csharp/test/Ice/facets/AllTests.cs index d0f94544531..a54d1521ab2 100644 --- a/csharp/test/Ice/facets/AllTests.cs +++ b/csharp/test/Ice/facets/AllTests.cs @@ -12,11 +12,13 @@ using System.Collections.Generic; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static GPrx allTests(Ice.Communicator communicator) + public static GPrx allTests(TestCommon.Application app) { - + + Ice.Communicator communicator = app.communicator(); + Write("testing Ice.Admin.Facets property... "); test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").Length == 0); communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); @@ -96,7 +98,7 @@ public class AllTests : TestCommon.TestApp Write("testing stringToProxy... "); Flush(); - string @ref = "d:default -p 12010"; + string @ref = "d:" + app.getTestEndpoint(0); Ice.ObjectPrx db = communicator.stringToProxy(@ref); test(db != null); WriteLine("ok"); @@ -151,7 +153,7 @@ public class AllTests : TestCommon.TestApp test(d.callC().Equals("C")); test(d.callD().Equals("D")); WriteLine("ok"); - + Write("testing facets A, B, C, and D... "); Flush(); df = DPrxHelper.checkedCast(d, "facetABCD"); @@ -161,7 +163,7 @@ public class AllTests : TestCommon.TestApp test(df.callC().Equals("C")); test(df.callD().Equals("D")); WriteLine("ok"); - + Write("testing facets E and F... "); Flush(); FPrx ff = FPrxHelper.checkedCast(d, "facetEF"); @@ -169,14 +171,14 @@ public class AllTests : TestCommon.TestApp test(ff.callE().Equals("E")); test(ff.callF().Equals("F")); WriteLine("ok"); - + Write("testing facet G... "); Flush(); GPrx gf = GPrxHelper.checkedCast(ff, "facetGH"); test(gf != null); test(gf.callG().Equals("G")); WriteLine("ok"); - + Write("testing whether casting preserves the facet... "); Flush(); HPrx hf = HPrxHelper.checkedCast(gf); diff --git a/csharp/test/Ice/facets/Client.cs b/csharp/test/Ice/facets/Client.cs index e080de59e8e..77b3fb62bd6 100644 --- a/csharp/test/Ice/facets/Client.cs +++ b/csharp/test/Ice/facets/Client.cs @@ -17,44 +17,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - GPrx g = AllTests.allTests(communicator); + GPrx g = AllTests.allTests(this); g.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/facets/Collocated.cs b/csharp/test/Ice/facets/Collocated.cs index 5d8c3f63257..5e8e43c92e4 100644 --- a/csharp/test/Ice/facets/Collocated.cs +++ b/csharp/test/Ice/facets/Collocated.cs @@ -16,54 +16,28 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); adapter.add(d, Ice.Util.stringToIdentity("d")); adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD"); Ice.Object f = new FI(); adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF"); - Ice.Object h = new HI(communicator); + Ice.Object h = new HI(communicator()); adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.WriteLine(ex); - status = 1; - } - } - - return status; + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/facets/Server.cs b/csharp/test/Ice/facets/Server.cs index 63d297d9e8b..b1e07674f05 100644 --- a/csharp/test/Ice/facets/Server.cs +++ b/csharp/test/Ice/facets/Server.cs @@ -16,55 +16,29 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); adapter.add(d, Ice.Util.stringToIdentity("d")); adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD"); Ice.Object f = new FI(); adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF"); - Ice.Object h = new HI(communicator); + Ice.Object h = new HI(communicator()); adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/facets/msbuild/server/server.csproj b/csharp/test/Ice/facets/msbuild/server/server.csproj index 5b0ebe99adf..8b4885f85f1 100644 --- a/csharp/test/Ice/facets/msbuild/server/server.csproj +++ b/csharp/test/Ice/facets/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\AI.cs"> <Link>AI.cs</Link> </Compile> diff --git a/csharp/test/Ice/facets/run.py b/csharp/test/Ice/facets/run.py deleted file mode 100755 index df7bc2b4ac3..00000000000 --- a/csharp/test/Ice/facets/run.py +++ /dev/null @@ -1,25 +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, getopt - -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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/faultTolerance/AllTests.cs b/csharp/test/Ice/faultTolerance/AllTests.cs index 7d47a3edf96..54541e5fec2 100644 --- a/csharp/test/Ice/faultTolerance/AllTests.cs +++ b/csharp/test/Ice/faultTolerance/AllTests.cs @@ -12,7 +12,7 @@ using System.Diagnostics; using System.Collections.Generic; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Callback { @@ -69,14 +69,15 @@ public class AllTests : TestCommon.TestApp } } - public static void allTests(Ice.Communicator communicator, List<int> ports) + public static void allTests(TestCommon.Application app, List<int> ports) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); string refString = "test"; for(int i = 0; i < ports.Count; i++) { - refString += ":default -p " + ports[i]; + refString += ":" + app.getTestEndpoint(ports[i]); } Ice.ObjectPrx basePrx = communicator.stringToProxy(refString); test(basePrx != null); diff --git a/csharp/test/Ice/faultTolerance/Client.cs b/csharp/test/Ice/faultTolerance/Client.cs index fdb28f904f6..c76f205d245 100644 --- a/csharp/test/Ice/faultTolerance/Client.cs +++ b/csharp/test/Ice/faultTolerance/Client.cs @@ -16,14 +16,14 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { private static void usage() { Console.Error.WriteLine("Usage: client port..."); } - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { System.Collections.Generic.List<int> ports = new System.Collections.Generic.List<int>(); for(int i = 0; i < args.Length; i++) @@ -48,46 +48,20 @@ public class Client return 1; } - AllTests.allTests(communicator, ports); + AllTests.allTests(this, ports); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - // - // This test aborts servers, so we don't want warnings. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/faultTolerance/Server.cs b/csharp/test/Ice/faultTolerance/Server.cs index 57101bf3edf..acbf8ccbf6c 100644 --- a/csharp/test/Ice/faultTolerance/Server.cs +++ b/csharp/test/Ice/faultTolerance/Server.cs @@ -16,14 +16,14 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { private static void usage() { Console.Error.WriteLine("Usage: Server port"); } - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { int port = 0; for(int i = 0; i < args.Length; i++) @@ -61,53 +61,25 @@ public class Server return 1; } - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(port)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object obj = new TestI(); adapter.add(obj, Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - // - // In this test, we need longer server idle time, - // otherwise our test servers may time out before they are - // used in the test. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ServerIdleTime", "120"); // Two minutes - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ServerIdleTime", "120"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/faultTolerance/msbuild/server/server.csproj b/csharp/test/Ice/faultTolerance/msbuild/server/server.csproj index c790d7616f2..81baf79c862 100644 --- a/csharp/test/Ice/faultTolerance/msbuild/server/server.csproj +++ b/csharp/test/Ice/faultTolerance/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/faultTolerance/run.py b/csharp/test/Ice/faultTolerance/run.py deleted file mode 100755 index 519cfa7c16d..00000000000 --- a/csharp/test/Ice/faultTolerance/run.py +++ /dev/null @@ -1,55 +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, getopt - -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 - -server = os.path.join(os.getcwd(), "server") -client = os.path.join(os.getcwd(), "client") - -if TestUtil.isCygwin(): - print("\nYou may get spurious \"Signal 127\" messages during this test run.") - print("These are expected and can be safely ignored.\n") - -num = 12 -base = 12340 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, " %d" % (base + i))) - print("ok") - -ports = "" -for i in range(0, num): - ports = "%s %d" % (ports, base + i) - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, ports, startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - #p.waitTestSuccess() - # We simuluate the abort of the server by calling Process.Kill(). However, this - # results in a non-zero exit status. Therefore we ignore the status. - p.wait() diff --git a/csharp/test/Ice/hash/Client.cs b/csharp/test/Ice/hash/Client.cs index 489c800dc9a..a1c4aa0165c 100644 --- a/csharp/test/Ice/hash/Client.cs +++ b/csharp/test/Ice/hash/Client.cs @@ -19,9 +19,10 @@ using System.Collections.Generic; public class Client { - private static void test(bool b) + private static void + test(bool b) { - if(!b) + if (!b) { throw new Exception(); } @@ -50,8 +51,8 @@ public class Client communicator = Ice.Util.initialize(ref args, initData); { Random rand = new Random(); - for(i = 0; proxyCollisions < maxCollisions && - endpointCollisions < maxCollisions && + for(i = 0; proxyCollisions < maxCollisions && + endpointCollisions < maxCollisions && i < maxIterations; ++i) { System.IO.StringWriter sw = new System.IO.StringWriter(); @@ -67,7 +68,7 @@ public class Client Ice.ObjectPrx obj = communicator.stringToProxy(sw.ToString()); List<Ice.Endpoint> endpoints = new List<Ice.Endpoint>(obj.ice_getEndpoints()); - + if(seenProxy.ContainsKey(obj.GetHashCode())) { @@ -81,7 +82,7 @@ public class Client { seenProxy[obj.GetHashCode()] = obj; } - + foreach(Ice.Endpoint endpoint in endpoints) { if(seenEndpoint.ContainsKey(endpoint.GetHashCode())) @@ -244,7 +245,7 @@ public class Client Random rand = new Random(); int exceptionCollisions = 0; - for(i = 0; i < maxIterations && + for(i = 0; i < maxIterations && exceptionCollisions < maxCollisions; ++i) { Test.OtherException ex = new Test.OtherException(rand.Next(100), rand.Next(100), 0, false); @@ -276,7 +277,7 @@ public class Client Random rand = new Random(); int exceptionCollisions = 0; - for(i = 0; i < maxIterations && + for(i = 0; i < maxIterations && exceptionCollisions < maxCollisions; ++i) { Test.OtherException ex = new Test.OtherException(rand.Next(100) * 2^30, rand.Next(100) * 2^30, rand.Next(100) * 2^30, false); @@ -305,7 +306,7 @@ public class Client Random rand = new Random(); int exceptionCollisions = 0; - for(i = 0; i < maxIterations && + for(i = 0; i < maxIterations && exceptionCollisions < maxCollisions; ++i) { int v = rand.Next(1000); @@ -358,7 +359,7 @@ public class Client int structCollisions = 0; for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i) { - Test.PointF pf = new Test.PointF((float)rand.NextDouble(), (float)rand.NextDouble(), + Test.PointF pf = new Test.PointF((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble()); if(seenPointF.ContainsKey(pf.GetHashCode())) { @@ -383,7 +384,7 @@ public class Client structCollisions = 0; for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i) { - Test.PointD pd = new Test.PointD(rand.NextDouble(), rand.NextDouble(), + Test.PointD pd = new Test.PointD(rand.NextDouble(), rand.NextDouble(), rand.NextDouble()); if(seenPointD.ContainsKey(pd.GetHashCode())) { @@ -496,7 +497,7 @@ public class Client { Test.Draw draw = new Test.Draw( new Test.Color(rand.Next(255), rand.Next(255), rand.Next(255), rand.Next(255)), - new Test.Pen(rand.Next(10), + new Test.Pen(rand.Next(10), new Test.Color(rand.Next(255), rand.Next(255), rand.Next(255), rand.Next(255))), false); diff --git a/csharp/test/Ice/hash/run.py b/csharp/test/Ice/hash/run.py deleted file mode 100755 index 0ddc0891279..00000000000 --- a/csharp/test/Ice/hash/run.py +++ /dev/null @@ -1,23 +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, getopt - -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.simpleTest() diff --git a/csharp/test/Ice/hold/AllTests.cs b/csharp/test/Ice/hold/AllTests.cs index 813f1e3a59a..41c2aab173f 100644 --- a/csharp/test/Ice/hold/AllTests.cs +++ b/csharp/test/Ice/hold/AllTests.cs @@ -10,7 +10,7 @@ using System; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Condition { @@ -18,7 +18,7 @@ public class AllTests : TestCommon.TestApp { _value = value; } - + public void set(bool value) { @@ -36,7 +36,7 @@ public class AllTests : TestCommon.TestApp return _value; } } - + private bool _value; } @@ -67,18 +67,19 @@ public class AllTests : TestCommon.TestApp private int _expected; } - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); - String @ref = "hold:default -p 12010"; + String @ref = "hold:" + app.getTestEndpoint(0); Ice.ObjectPrx @base = communicator.stringToProxy(@ref); test(@base != null); - String refSerialized = "hold:default -p 12011"; + String refSerialized = "hold:" + app.getTestEndpoint(1); Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized); test(baseSerialized != null); WriteLine("ok"); - + Write("testing checked cast... "); Flush(); HoldPrx hold = HoldPrxHelper.checkedCast(@base); @@ -90,7 +91,7 @@ public class AllTests : TestCommon.TestApp test(holdSerialized != null); test(holdSerialized.Equals(baseSerialized)); WriteLine("ok"); - + Write("changing state between active and hold rapidly... "); Flush(); for(int i = 0; i < 100; ++i) @@ -110,7 +111,7 @@ public class AllTests : TestCommon.TestApp holdSerializedOneway.putOnHold(0); } WriteLine("ok"); - + Write("testing without serialize mode... "); Flush(); System.Random rand = new System.Random(); @@ -209,7 +210,7 @@ public class AllTests : TestCommon.TestApp hold.putOnHold(-1); hold.ice_ping(); hold.putOnHold(-1); - hold.ice_ping(); + hold.ice_ping(); } WriteLine("ok"); @@ -219,4 +220,4 @@ public class AllTests : TestCommon.TestApp WriteLine("ok"); } } - + diff --git a/csharp/test/Ice/hold/Client.cs b/csharp/test/Ice/hold/Client.cs index d0f293fe44e..fcc80eedcff 100644 --- a/csharp/test/Ice/hold/Client.cs +++ b/csharp/test/Ice/hold/Client.cs @@ -16,43 +16,17 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/hold/Server.cs b/csharp/test/Ice/hold/Server.cs index 1b3ad90b04b..163c0009e76 100644 --- a/csharp/test/Ice/hold/Server.cs +++ b/csharp/test/Ice/hold/Server.cs @@ -16,32 +16,32 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { Timer timer = new Timer(); - communicator.getProperties().setProperty("TestAdapter1.Endpoints", "default -p 12010:udp"); - communicator.getProperties().setProperty("TestAdapter1.ThreadPool.Size", "5"); - communicator.getProperties().setProperty("TestAdapter1.ThreadPool.SizeMax", "5"); - communicator.getProperties().setProperty("TestAdapter1.ThreadPool.SizeWarn", "0"); - communicator.getProperties().setProperty("TestAdapter1.ThreadPool.Serialize", "0"); - Ice.ObjectAdapter adapter1 = communicator.createObjectAdapter("TestAdapter1"); + communicator().getProperties().setProperty("TestAdapter1.Endpoints", getTestEndpoint(0) + ":udp"); + communicator().getProperties().setProperty("TestAdapter1.ThreadPool.Size", "5"); + communicator().getProperties().setProperty("TestAdapter1.ThreadPool.SizeMax", "5"); + communicator().getProperties().setProperty("TestAdapter1.ThreadPool.SizeWarn", "0"); + communicator().getProperties().setProperty("TestAdapter1.ThreadPool.Serialize", "0"); + Ice.ObjectAdapter adapter1 = communicator().createObjectAdapter("TestAdapter1"); adapter1.add(new HoldI(timer, adapter1), Ice.Util.stringToIdentity("hold")); - communicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p 12011:udp"); - communicator.getProperties().setProperty("TestAdapter2.ThreadPool.Size", "5"); - communicator.getProperties().setProperty("TestAdapter2.ThreadPool.SizeMax", "5"); - communicator.getProperties().setProperty("TestAdapter2.ThreadPool.SizeWarn", "0"); - communicator.getProperties().setProperty("TestAdapter2.ThreadPool.Serialize", "1"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2"); + communicator().getProperties().setProperty("TestAdapter2.Endpoints", getTestEndpoint(1) + ":udp"); + communicator().getProperties().setProperty("TestAdapter2.ThreadPool.Size", "5"); + communicator().getProperties().setProperty("TestAdapter2.ThreadPool.SizeMax", "5"); + communicator().getProperties().setProperty("TestAdapter2.ThreadPool.SizeWarn", "0"); + communicator().getProperties().setProperty("TestAdapter2.ThreadPool.Serialize", "1"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter2"); adapter2.add(new HoldI(timer, adapter2), Ice.Util.stringToIdentity("hold")); adapter1.activate(); adapter2.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); timer.shutdown(); timer.waitForShutdown(); @@ -51,33 +51,7 @@ public class Server public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/hold/msbuild/server/server.csproj b/csharp/test/Ice/hold/msbuild/server/server.csproj index f3d11e87f30..a90b40fc4bc 100644 --- a/csharp/test/Ice/hold/msbuild/server/server.csproj +++ b/csharp/test/Ice/hold/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\HoldI.cs"> <Link>HoldI.cs</Link> </Compile> diff --git a/csharp/test/Ice/hold/run.py b/csharp/test/Ice/hold/run.py deleted file mode 100755 index bfec815018d..00000000000 --- a/csharp/test/Ice/hold/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, getopt - -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() diff --git a/csharp/test/Ice/info/AllTests.cs b/csharp/test/Ice/info/AllTests.cs index 138bc702d1a..cb62a19f513 100644 --- a/csharp/test/Ice/info/AllTests.cs +++ b/csharp/test/Ice/info/AllTests.cs @@ -11,7 +11,7 @@ using System.Collections.Generic; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private static Ice.TCPEndpointInfo getTCPEndpointInfo(Ice.EndpointInfo info) { @@ -37,8 +37,9 @@ public class AllTests : TestCommon.TestApp return null; } - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Write("testing proxy endpoint information... "); Flush(); { @@ -113,8 +114,9 @@ public class AllTests : TestCommon.TestApp adapter.destroy(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p 12020"); - communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020"); + int port = app.getTestPort(1); + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p " + port); + communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", app.getTestEndpoint(1)); adapter = communicator.createObjectAdapter("TestAdapter"); endpoints = adapter.getEndpoints(); @@ -125,18 +127,22 @@ public class AllTests : TestCommon.TestApp foreach(Ice.Endpoint endpoint in endpoints) { tcpEndpoint = getTCPEndpointInfo(endpoint.getInfo()); - test(tcpEndpoint.port == 12020); + test(tcpEndpoint.port == port); } tcpEndpoint = getTCPEndpointInfo(publishedEndpoints[0].getInfo()); test(tcpEndpoint.host.Equals("127.0.0.1")); - test(tcpEndpoint.port == 12020); + test(tcpEndpoint.port == port); adapter.destroy(); } WriteLine("ok"); - Ice.ObjectPrx @base = communicator.stringToProxy("test:default -p 12010:udp -p 12010"); + int endpointPort = app.getTestPort(0); + + Ice.ObjectPrx @base = communicator.stringToProxy("test:" + + app.getTestEndpoint(0) + ":" + + app.getTestEndpoint(0, "udp")); TestIntfPrx testIntf = TestIntfPrxHelper.checkedCast(@base); Write("test connection endpoint information... "); @@ -144,7 +150,7 @@ public class AllTests : TestCommon.TestApp { Ice.EndpointInfo info = @base.ice_getConnection().getEndpoint().getInfo(); Ice.TCPEndpointInfo tcpinfo = getTCPEndpointInfo(info); - test(tcpinfo.port == 12010); + test(tcpinfo.port == endpointPort); test(!tcpinfo.compress); test(tcpinfo.host.Equals(defaultHost)); @@ -156,7 +162,7 @@ public class AllTests : TestCommon.TestApp info = @base.ice_datagram().ice_getConnection().getEndpoint().getInfo(); Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)info; - test(udp.port == 12010); + test(udp.port == endpointPort); test(udp.host.Equals(defaultHost)); } WriteLine("ok"); @@ -171,7 +177,7 @@ public class AllTests : TestCommon.TestApp Ice.TCPConnectionInfo ipInfo = getTCPConnectionInfo(info); test(!info.incoming); test(info.adapterName.Length == 0); - test(ipInfo.remotePort == 12010); + test(ipInfo.remotePort == endpointPort); test(ipInfo.localPort > 0); if(defaultHost.Equals("127.0.0.1")) { @@ -211,7 +217,7 @@ public class AllTests : TestCommon.TestApp test(!udpInfo.incoming); test(udpInfo.adapterName.Length == 0); test(udpInfo.localPort > 0); - test(udpInfo.remotePort == 12010); + test(udpInfo.remotePort == endpointPort); if(defaultHost.Equals("127.0.0.1")) { diff --git a/csharp/test/Ice/info/Client.cs b/csharp/test/Ice/info/Client.cs index d0f293fe44e..fcc80eedcff 100644 --- a/csharp/test/Ice/info/Client.cs +++ b/csharp/test/Ice/info/Client.cs @@ -16,43 +16,17 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/info/Server.cs b/csharp/test/Ice/info/Server.cs index 82b0a7d08ef..b447b093168 100644 --- a/csharp/test/Ice/info/Server.cs +++ b/csharp/test/Ice/info/Server.cs @@ -16,50 +16,23 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":" + + getTestEndpoint(0, "udp")); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/info/msbuild/server/server.csproj b/csharp/test/Ice/info/msbuild/server/server.csproj index e86d820f535..aeb7b7f41b9 100644 --- a/csharp/test/Ice/info/msbuild/server/server.csproj +++ b/csharp/test/Ice/info/msbuild/server/server.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/info/run.py b/csharp/test/Ice/info/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/csharp/test/Ice/info/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() diff --git a/csharp/test/Ice/inheritance/AllTests.cs b/csharp/test/Ice/inheritance/AllTests.cs index a3e48def188..6c2b4fd088c 100644 --- a/csharp/test/Ice/inheritance/AllTests.cs +++ b/csharp/test/Ice/inheritance/AllTests.cs @@ -9,24 +9,25 @@ using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static InitialPrx allTests(Ice.Communicator communicator) + public static InitialPrx allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); - string ref_Renamed = "initial:default -p 12010"; + string ref_Renamed = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx @base = communicator.stringToProxy(ref_Renamed); test(@base != null); WriteLine("ok"); - + Write("testing checked cast... "); Flush(); InitialPrx initial = InitialPrxHelper.checkedCast(@base); test(initial != null); test(initial.Equals(@base)); WriteLine("ok"); - + Write("getting proxies for class hierarchy... "); Flush(); Test.MA.CAPrx ca = initial.caop(); @@ -40,7 +41,7 @@ public class AllTests : TestCommon.TestApp test(cb != cd); test(cc != cd); WriteLine("ok"); - + Write("getting proxies for interface hierarchy... "); Flush(); Test.MA.IAPrx ia = initial.iaop(); @@ -53,13 +54,13 @@ public class AllTests : TestCommon.TestApp test(ib1 != ic); test(ib2 != ic); WriteLine("ok"); - + Write("invoking proxy operations on class hierarchy... "); Flush(); Test.MA.CAPrx cao; Test.MB.CBPrx cbo; Test.MA.CCPrx cco; - + cao = ca.caop(ca); test(cao.Equals(ca)); cao = ca.caop(cb); @@ -78,7 +79,7 @@ public class AllTests : TestCommon.TestApp test(cao.Equals(cb)); cao = cc.caop(cc); test(cao.Equals(cc)); - + cao = cb.cbop(cb); test(cao.Equals(cb)); cbo = cb.cbop(cb); @@ -95,7 +96,7 @@ public class AllTests : TestCommon.TestApp test(cao.Equals(cc)); cbo = cc.cbop(cc); test(cbo.Equals(cc)); - + cao = cc.ccop(cc); test(cao.Equals(cc)); cbo = cc.ccop(cc); @@ -103,14 +104,14 @@ public class AllTests : TestCommon.TestApp cco = cc.ccop(cc); test(cco.Equals(cc)); WriteLine("ok"); - + Write("ditto, but for interface hierarchy... "); Flush(); Test.MA.IAPrx iao; Test.MB.IB1Prx ib1o; Test.MB.IB2Prx ib2o; Test.MA.ICPrx ico; - + iao = ia.iaop(ia); test(iao.Equals(ia)); iao = ia.iaop(ib1); @@ -143,7 +144,7 @@ public class AllTests : TestCommon.TestApp test(iao.Equals(ib2)); iao = ic.iaop(ic); test(iao.Equals(ic)); - + iao = ib1.ib1op(ib1); test(iao.Equals(ib1)); ib1o = ib1.ib1op(ib1); @@ -160,7 +161,7 @@ public class AllTests : TestCommon.TestApp test(iao.Equals(ic)); ib1o = ic.ib1op(ic); test(ib1o.Equals(ic)); - + iao = ib2.ib2op(ib2); test(iao.Equals(ib2)); ib2o = ib2.ib2op(ib2); @@ -177,7 +178,7 @@ public class AllTests : TestCommon.TestApp test(iao.Equals(ic)); ib2o = ic.ib2op(ic); test(ib2o.Equals(ic)); - + iao = ic.icop(ic); test(iao.Equals(ic)); ib1o = ic.icop(ic); @@ -187,31 +188,31 @@ public class AllTests : TestCommon.TestApp ico = ic.icop(ic); test(ico.Equals(ic)); WriteLine("ok"); - + Write("ditto, but for class implementing interfaces... "); Flush(); - + cao = cd.caop(cd); test(cao.Equals(cd)); cbo = cd.cbop(cd); test(cbo.Equals(cd)); cco = cd.ccop(cd); test(cco.Equals(cd)); - + iao = cd.iaop(cd); test(iao.Equals(cd)); ib1o = cd.ib1op(cd); test(ib1o.Equals(cd)); ib2o = cd.ib2op(cd); test(ib2o.Equals(cd)); - + cao = cd.cdop(cd); test(cao.Equals(cd)); cbo = cd.cdop(cd); test(cbo.Equals(cd)); cco = cd.cdop(cd); test(cco.Equals(cd)); - + iao = cd.cdop(cd); test(iao.Equals(cd)); ib1o = cd.cdop(cd); diff --git a/csharp/test/Ice/inheritance/Client.cs b/csharp/test/Ice/inheritance/Client.cs index 805670012c6..3ffaca65c44 100644 --- a/csharp/test/Ice/inheritance/Client.cs +++ b/csharp/test/Ice/inheritance/Client.cs @@ -17,45 +17,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - InitialPrx initial = AllTests.allTests(communicator); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/inheritance/Collocated.cs b/csharp/test/Ice/inheritance/Collocated.cs index ab0cfc4951f..df775566080 100644 --- a/csharp/test/Ice/inheritance/Collocated.cs +++ b/csharp/test/Ice/inheritance/Collocated.cs @@ -17,47 +17,21 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object obj = new InitialI(adapter); adapter.add(obj, Ice.Util.stringToIdentity("initial")); - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.WriteLine(ex); - status = 1; - } - } - - return status; + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/inheritance/Server.cs b/csharp/test/Ice/inheritance/Server.cs index d4988c372b9..2844a25ff3d 100644 --- a/csharp/test/Ice/inheritance/Server.cs +++ b/csharp/test/Ice/inheritance/Server.cs @@ -16,48 +16,22 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object @object = new InitialI(adapter); adapter.add(@object, Ice.Util.stringToIdentity("initial")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/inheritance/msbuild/server/server.csproj b/csharp/test/Ice/inheritance/msbuild/server/server.csproj index 03cb5b53388..683ce6ed690 100644 --- a/csharp/test/Ice/inheritance/msbuild/server/server.csproj +++ b/csharp/test/Ice/inheritance/msbuild/server/server.csproj @@ -65,6 +65,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\CAI.cs"> <Link>CAI.cs</Link> </Compile> diff --git a/csharp/test/Ice/inheritance/run.py b/csharp/test/Ice/inheritance/run.py deleted file mode 100755 index df7bc2b4ac3..00000000000 --- a/csharp/test/Ice/inheritance/run.py +++ /dev/null @@ -1,25 +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, getopt - -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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/interceptor/Client.cs b/csharp/test/Ice/interceptor/Client.cs index e50b0e34cd8..00ca5d77d1e 100644 --- a/csharp/test/Ice/interceptor/Client.cs +++ b/csharp/test/Ice/interceptor/Client.cs @@ -16,227 +16,215 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public class App : Ice.Application + private int run(Test.MyObjectPrx prx, InterceptorI interceptor) { - private static void test(bool b) - { - if(!b) - { - throw new Exception(); - } - } - - private int run(Test.MyObjectPrx prx, InterceptorI interceptor) - { - Console.Out.Write("testing simple interceptor... "); - Console.Out.Flush(); - test(interceptor.getLastOperation() == null); - test(!interceptor.getLastStatus()); - prx.ice_ping(); - test(interceptor.getLastOperation().Equals("ice_ping")); - test(!interceptor.getLastStatus()); - String typeId = prx.ice_id(); - test(interceptor.getLastOperation().Equals("ice_id")); - test(!interceptor.getLastStatus()); - test(prx.ice_isA(typeId)); - test(interceptor.getLastOperation().Equals("ice_isA")); - test(!interceptor.getLastStatus()); - test(prx.add(33, 12) == 45); - test(interceptor.getLastOperation().Equals("add")); - test(!interceptor.getLastStatus()); - Console.WriteLine("ok"); - Console.Out.Write("testing retry... "); - Console.Out.Flush(); - test(prx.addWithRetry(33, 12) == 45); - test(interceptor.getLastOperation().Equals("addWithRetry")); - test(!interceptor.getLastStatus()); - Console.WriteLine("ok"); - Console.Out.Write("testing user exception... "); - Console.Out.Flush(); - try - { - prx.badAdd(33, 12); - test(false); - } - catch(Test.InvalidInputException) - { - // expected - } - test(interceptor.getLastOperation().Equals("badAdd")); - test(!interceptor.getLastStatus()); - Console.WriteLine("ok"); - Console.Out.Write("testing ONE... "); - Console.Out.Flush(); - interceptor.clear(); - try - { - prx.notExistAdd(33, 12); - test(false); - } - catch(Ice.ObjectNotExistException) - { - // expected - } - test(interceptor.getLastOperation().Equals("notExistAdd")); - test(!interceptor.getLastStatus()); - Console.WriteLine("ok"); - Console.Out.Write("testing system exception... "); - Console.Out.Flush(); - interceptor.clear(); - try - { - prx.badSystemAdd(33, 12); - test(false); - } - catch(Ice.UnknownException) - { - test(!prx.ice_isCollocationOptimized()); - } - catch(MySystemException) - { - test(prx.ice_isCollocationOptimized()); - } - catch(Exception) - { - test(false); - } - test(interceptor.getLastOperation().Equals("badSystemAdd")); - test(!interceptor.getLastStatus()); - Console.WriteLine("ok"); - - return 0; - } - - private int runAmd(Test.MyObjectPrx prx, InterceptorI interceptor) - { - Console.Out.Write("testing simple interceptor... "); - Console.Out.Flush(); - test(interceptor.getLastOperation() == null); - test(!interceptor.getLastStatus()); - test(prx.amdAdd(33, 12) == 45); - test(interceptor.getLastOperation().Equals("amdAdd")); - test(interceptor.getLastStatus()); - Console.WriteLine("ok"); - - Console.Out.Write("testing retry... "); - Console.Out.Flush(); - test(prx.amdAddWithRetry(33, 12) == 45); - test(interceptor.getLastOperation().Equals("amdAddWithRetry")); - test(interceptor.getLastStatus()); - Console.WriteLine("ok"); - - Console.Out.Write("testing user exception... "); - Console.Out.Flush(); - try - { - prx.amdBadAdd(33, 12); - test(false); - } - catch(Test.InvalidInputException) - { - // expected - } - test(interceptor.getLastOperation().Equals("amdBadAdd")); - test(interceptor.getLastStatus()); - Console.WriteLine("ok"); - - Console.Out.Write("testing ONE... "); - Console.Out.Flush(); - interceptor.clear(); - try - { - prx.amdNotExistAdd(33, 12); - test(false); - } - catch(Ice.ObjectNotExistException) - { - // expected - } - test(interceptor.getLastOperation().Equals("amdNotExistAdd")); - test(interceptor.getLastStatus()); - Console.WriteLine("ok"); - - Console.Out.Write("testing system exception... "); - Console.Out.Flush(); - interceptor.clear(); - try - { - prx.amdBadSystemAdd(33, 12); - test(false); - } - catch(Ice.UnknownException) - { - test(!prx.ice_isCollocationOptimized()); - } - catch(MySystemException) - { - test(prx.ice_isCollocationOptimized()); - } - catch(Exception) - { - test(false); - } - test(interceptor.getLastOperation().Equals("amdBadSystemAdd")); - test(interceptor.getLastStatus()); - Console.WriteLine("ok"); - return 0; - } - - public override int run(string[] args) - { - // - // Create OA and servants - // - - communicator().getProperties().setProperty("MyOA.AdapterId", "myOA"); - - Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost"); - - Ice.Object servant = new MyObjectI(); - InterceptorI interceptor = new InterceptorI(servant); - - Test.MyObjectPrx prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor)); - - Console.WriteLine("Collocation optimization on"); - int rs = run(prx, interceptor); - if(rs != 0) - { - return rs; - } - - Console.WriteLine("Now with AMD"); - interceptor.clear(); - rs = runAmd(prx, interceptor); - if(rs != 0) - { - return rs; - } - - oa.activate(); // Only necessary for non-collocation optimized tests - - Console.WriteLine("Collocation optimization off"); - interceptor.clear(); - prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false)); - rs = run(prx, interceptor); - if(rs != 0) - { - return rs; - } - - Console.WriteLine("Now with AMD"); - interceptor.clear(); - rs = runAmd(prx, interceptor); + Console.Out.Write("testing simple interceptor... "); + Console.Out.Flush(); + test(interceptor.getLastOperation() == null); + test(!interceptor.getLastStatus()); + prx.ice_ping(); + test(interceptor.getLastOperation().Equals("ice_ping")); + test(!interceptor.getLastStatus()); + String typeId = prx.ice_id(); + test(interceptor.getLastOperation().Equals("ice_id")); + test(!interceptor.getLastStatus()); + test(prx.ice_isA(typeId)); + test(interceptor.getLastOperation().Equals("ice_isA")); + test(!interceptor.getLastStatus()); + test(prx.add(33, 12) == 45); + test(interceptor.getLastOperation().Equals("add")); + test(!interceptor.getLastStatus()); + Console.WriteLine("ok"); + Console.Out.Write("testing retry... "); + Console.Out.Flush(); + test(prx.addWithRetry(33, 12) == 45); + test(interceptor.getLastOperation().Equals("addWithRetry")); + test(!interceptor.getLastStatus()); + Console.WriteLine("ok"); + Console.Out.Write("testing user exception... "); + Console.Out.Flush(); + try + { + prx.badAdd(33, 12); + test(false); + } + catch(Test.InvalidInputException) + { + // expected + } + test(interceptor.getLastOperation().Equals("badAdd")); + test(!interceptor.getLastStatus()); + Console.WriteLine("ok"); + Console.Out.Write("testing ONE... "); + Console.Out.Flush(); + interceptor.clear(); + try + { + prx.notExistAdd(33, 12); + test(false); + } + catch(Ice.ObjectNotExistException) + { + // expected + } + test(interceptor.getLastOperation().Equals("notExistAdd")); + test(!interceptor.getLastStatus()); + Console.WriteLine("ok"); + Console.Out.Write("testing system exception... "); + Console.Out.Flush(); + interceptor.clear(); + try + { + prx.badSystemAdd(33, 12); + test(false); + } + catch(Ice.UnknownException) + { + test(!prx.ice_isCollocationOptimized()); + } + catch(MySystemException) + { + test(prx.ice_isCollocationOptimized()); + } + catch(Exception) + { + test(false); + } + test(interceptor.getLastOperation().Equals("badSystemAdd")); + test(!interceptor.getLastStatus()); + Console.WriteLine("ok"); + + return 0; + } + private int runAmd(Test.MyObjectPrx prx, InterceptorI interceptor) + { + Console.Out.Write("testing simple interceptor... "); + Console.Out.Flush(); + test(interceptor.getLastOperation() == null); + test(!interceptor.getLastStatus()); + test(prx.amdAdd(33, 12) == 45); + test(interceptor.getLastOperation().Equals("amdAdd")); + test(interceptor.getLastStatus()); + Console.WriteLine("ok"); + + Console.Out.Write("testing retry... "); + Console.Out.Flush(); + test(prx.amdAddWithRetry(33, 12) == 45); + test(interceptor.getLastOperation().Equals("amdAddWithRetry")); + test(interceptor.getLastStatus()); + Console.WriteLine("ok"); + + Console.Out.Write("testing user exception... "); + Console.Out.Flush(); + try + { + prx.amdBadAdd(33, 12); + test(false); + } + catch(Test.InvalidInputException) + { + // expected + } + test(interceptor.getLastOperation().Equals("amdBadAdd")); + test(interceptor.getLastStatus()); + Console.WriteLine("ok"); + + Console.Out.Write("testing ONE... "); + Console.Out.Flush(); + interceptor.clear(); + try + { + prx.amdNotExistAdd(33, 12); + test(false); + } + catch(Ice.ObjectNotExistException) + { + // expected + } + test(interceptor.getLastOperation().Equals("amdNotExistAdd")); + test(interceptor.getLastStatus()); + Console.WriteLine("ok"); + + Console.Out.Write("testing system exception... "); + Console.Out.Flush(); + interceptor.clear(); + try + { + prx.amdBadSystemAdd(33, 12); + test(false); + } + catch(Ice.UnknownException) + { + test(!prx.ice_isCollocationOptimized()); + } + catch(MySystemException) + { + test(prx.ice_isCollocationOptimized()); + } + catch(Exception) + { + test(false); + } + test(interceptor.getLastOperation().Equals("amdBadSystemAdd")); + test(interceptor.getLastStatus()); + Console.WriteLine("ok"); + return 0; + } + + public override int run(string[] args) + { + // + // Create OA and servants + // + + communicator().getProperties().setProperty("MyOA.AdapterId", "myOA"); + + Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost"); + + Ice.Object servant = new MyObjectI(); + InterceptorI interceptor = new InterceptorI(servant); + + Test.MyObjectPrx prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor)); + + Console.WriteLine("Collocation optimization on"); + int rs = run(prx, interceptor); + if(rs != 0) + { return rs; } + + Console.WriteLine("Now with AMD"); + interceptor.clear(); + rs = runAmd(prx, interceptor); + if(rs != 0) + { + return rs; + } + + oa.activate(); // Only necessary for non-collocation optimized tests + + Console.WriteLine("Collocation optimization off"); + interceptor.clear(); + prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false)); + rs = run(prx, interceptor); + if(rs != 0) + { + return rs; + } + + Console.WriteLine("Now with AMD"); + interceptor.clear(); + rs = runAmd(prx, interceptor); + + return rs; } public static int Main(string[] args) { - App app = new App(); - Ice.InitializationData data = new Ice.InitializationData(); - return app.main(args, data); + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/interceptor/msbuild/client/client.csproj b/csharp/test/Ice/interceptor/msbuild/client/client.csproj index b5c54a6f110..e85673c996f 100644 --- a/csharp/test/Ice/interceptor/msbuild/client/client.csproj +++ b/csharp/test/Ice/interceptor/msbuild/client/client.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Client.cs"> <Link>Client.cs</Link> </Compile> diff --git a/csharp/test/Ice/interceptor/run.py b/csharp/test/Ice/interceptor/run.py deleted file mode 100755 index 81357cdeec4..00000000000 --- a/csharp/test/Ice/interceptor/run.py +++ /dev/null @@ -1,31 +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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -sys.stdout.write("starting client...") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0", startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/csharp/test/Ice/invoke/AllTests.cs b/csharp/test/Ice/invoke/AllTests.cs index 23c321d80f3..7ea73c5feb3 100644 --- a/csharp/test/Ice/invoke/AllTests.cs +++ b/csharp/test/Ice/invoke/AllTests.cs @@ -13,7 +13,7 @@ using System.Collections.Generic; using System.Diagnostics; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private static string testString = "This is a test string"; @@ -182,9 +182,10 @@ public class AllTests : TestCommon.TestApp private CallbackBase callback = new CallbackBase(); } - public static Test.MyClassPrx allTests(Ice.Communicator communicator) + public static Test.MyClassPrx allTests(TestCommon.Application app) { - Ice.ObjectPrx baseProxy = communicator.stringToProxy("test:default -p 12010"); + Ice.Communicator communicator = app.communicator(); + Ice.ObjectPrx baseProxy = communicator.stringToProxy("test:" + app.getTestEndpoint(0)); Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy); Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(cl.ice_oneway()); Test.MyClassPrx batchOneway = Test.MyClassPrxHelper.uncheckedCast(cl.ice_batchOneway()); diff --git a/csharp/test/Ice/invoke/Client.cs b/csharp/test/Ice/invoke/Client.cs index 2d8eedad21a..5b0dd91cb2f 100644 --- a/csharp/test/Ice/invoke/Client.cs +++ b/csharp/test/Ice/invoke/Client.cs @@ -16,46 +16,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.MyClassPrx myClass = AllTests.allTests(communicator); + Test.MyClassPrx myClass = AllTests.allTests(this); myClass.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/invoke/Server.cs b/csharp/test/Ice/invoke/Server.cs index 7a86cd8bab7..299d14abc60 100644 --- a/csharp/test/Ice/invoke/Server.cs +++ b/csharp/test/Ice/invoke/Server.cs @@ -50,9 +50,9 @@ public class ServantLocatorI : Ice.ServantLocator private Ice.Object _blobject; } -public class Server +public class Server : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { bool async = false; for(int i = 0; i < args.Length; ++i) @@ -63,47 +63,19 @@ public class Server } } - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.addServantLocator(new ServantLocatorI(async), ""); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/invoke/msbuild/server/server.csproj b/csharp/test/Ice/invoke/msbuild/server/server.csproj index 55a1317b7de..a5863af2c0a 100644 --- a/csharp/test/Ice/invoke/msbuild/server/server.csproj +++ b/csharp/test/Ice/invoke/msbuild/server/server.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\BlobjectI.cs"> <Link>BlobjectI.cs</Link> </Compile> diff --git a/csharp/test/Ice/invoke/run.py b/csharp/test/Ice/invoke/run.py deleted file mode 100755 index 2b09a4e5f86..00000000000 --- a/csharp/test/Ice/invoke/run.py +++ /dev/null @@ -1,26 +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(configName = "blobject", message = "Running test with Blobject server.") -TestUtil.queueClientServerTest(configName = "blobjectAsync", message = "Running test with BlobjectAsync server.", - additionalServerOptions = "--async") -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/location/AllTests.cs b/csharp/test/Ice/location/AllTests.cs index 129737c3073..adf84b5abda 100644 --- a/csharp/test/Ice/location/AllTests.cs +++ b/csharp/test/Ice/location/AllTests.cs @@ -11,18 +11,19 @@ using System; using Test; using System.Collections.Generic; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast( - communicator.stringToProxy("ServerManager :default -p 12010")); + communicator.stringToProxy("ServerManager :" + app.getTestEndpoint(0))); test(manager != null); TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator()); test(locator != null); TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry()); test(registry != null); - + Write("testing stringToProxy... "); Flush(); Ice.ObjectPrx @base = communicator.stringToProxy("test @ TestAdapter"); @@ -32,10 +33,10 @@ public class AllTests : TestCommon.TestApp Ice.ObjectPrx base5 = communicator.stringToProxy("test2"); Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter"); WriteLine("ok"); - + Write("testing ice_locator and ice_getLocator... "); test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); - Ice.LocatorPrx anotherLocator = + Ice.LocatorPrx anotherLocator = Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator")); @base = @base.ice_locator(anotherLocator); test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0); @@ -46,8 +47,8 @@ public class AllTests : TestCommon.TestApp test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0); communicator.setDefaultLocator(locator); @base = communicator.stringToProxy("test @ TestAdapter"); - test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); - + test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); + // // We also test ice_router/ice_getRouter (perhaps we should add a // test/Ice/router test?) @@ -69,7 +70,7 @@ public class AllTests : TestCommon.TestApp Flush(); manager.startServer(); WriteLine("ok"); - + Write("testing checked cast... "); Flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base); @@ -85,7 +86,7 @@ public class AllTests : TestCommon.TestApp TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6); test(obj6 != null); WriteLine("ok"); - + Write("testing id@AdapterId indirect proxy... "); Flush(); obj.shutdown(); @@ -105,7 +106,7 @@ public class AllTests : TestCommon.TestApp obj.shutdown(); manager.startServer(); try - { + { obj6.ice_ping(); } catch(Ice.LocalException) @@ -113,7 +114,7 @@ public class AllTests : TestCommon.TestApp test(false); } WriteLine("ok"); - + Write("testing identity indirect proxy... "); Flush(); obj.shutdown(); @@ -199,7 +200,7 @@ public class AllTests : TestCommon.TestApp test(ex.id.Equals("unknown/unknown")); } WriteLine("ok"); - + Write("testing proxy with unknown adapter... "); Flush(); try @@ -214,10 +215,10 @@ public class AllTests : TestCommon.TestApp test(ex.id.Equals("TestAdapterUnknown")); } WriteLine("ok"); - + Write("testing locator cache timeout... "); Flush(); - + int count = locator.getRequestCount(); communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. test(++count == locator.getRequestCount()); @@ -228,7 +229,7 @@ public class AllTests : TestCommon.TestApp System.Threading.Thread.Sleep(1200); // 1200ms communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. test(++count == locator.getRequestCount()); - + communicator.stringToProxy("test").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. count += 2; test(count == locator.getRequestCount()); @@ -238,12 +239,12 @@ public class AllTests : TestCommon.TestApp communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout count += 2; test(count == locator.getRequestCount()); - - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping(); + + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping(); test(count == locator.getRequestCount()); communicator.stringToProxy("test").ice_locatorCacheTimeout(-1).ice_ping(); test(count == locator.getRequestCount()); - communicator.stringToProxy("test@TestAdapter").ice_ping(); + communicator.stringToProxy("test@TestAdapter").ice_ping(); test(count == locator.getRequestCount()); communicator.stringToProxy("test").ice_ping(); test(count == locator.getRequestCount()); @@ -262,7 +263,7 @@ public class AllTests : TestCommon.TestApp test(hello.ice_getAdapterId().Equals("ReplicatedAdapter")); hello.sayHello(); WriteLine("ok"); - + Write("testing locator request queuing... "); Flush(); hello = (HelloPrx)obj.getReplicatedHello().ice_locatorCacheTimeout(0).ice_connectionCached(false); @@ -347,7 +348,7 @@ public class AllTests : TestCommon.TestApp { test(false); } - + try { communicator.stringToProxy("test@TestAdapter3").ice_locatorCacheTimeout(0).ice_ping(); @@ -362,7 +363,7 @@ public class AllTests : TestCommon.TestApp test(false); } catch(Ice.LocalException) - { + { } registry.setAdapterDirectProxy("TestAdapter3", locator.findAdapterById("TestAdapter")); try @@ -432,7 +433,7 @@ public class AllTests : TestCommon.TestApp test(false); } catch(Ice.LocalException) - { + { } try { @@ -451,7 +452,7 @@ public class AllTests : TestCommon.TestApp { test(false); } - + registry.addObject(communicator.stringToProxy("test4")); try { @@ -462,7 +463,7 @@ public class AllTests : TestCommon.TestApp { } WriteLine("ok"); - + Write("testing locator cache background updates... "); Flush(); { diff --git a/csharp/test/Ice/location/Client.cs b/csharp/test/Ice/location/Client.cs index fc333cef871..781e212f9fa 100644 --- a/csharp/test/Ice/location/Client.cs +++ b/csharp/test/Ice/location/Client.cs @@ -16,46 +16,24 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(initData.properties, 0)); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/location/Server.cs b/csharp/test/Ice/location/Server.cs index 902f536f7f5..ac0be0825bb 100644 --- a/csharp/test/Ice/location/Server.cs +++ b/csharp/test/Ice/location/Server.cs @@ -16,21 +16,20 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator, - Ice.InitializationData initData) + public override int run(string[] args) { // // Register the server manager. The server manager creates a new // 'server' (a server isn't a different process, it's just a new // communicator and object adapter). // - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); properties.setProperty("Ice.ThreadPool.Server.Size", "2"); - properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp"); + properties.setProperty("ServerManagerAdapter.Endpoints", getTestEndpoint(0) + ":udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ServerManagerAdapter"); // // We also register a sample server locator which implements the @@ -38,7 +37,7 @@ public class Server // 'servers' created with the server manager interface. // ServerLocatorRegistry registry = new ServerLocatorRegistry(); - Ice.Object @object = new ServerManagerI(registry, initData); + Ice.Object @object = new ServerManagerI(registry, _initData, this); adapter.add(@object, Ice.Util.stringToIdentity("ServerManager")); registry.addObject(adapter.createProxy(Ice.Util.stringToIdentity("ServerManager"))); Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast( @@ -48,42 +47,22 @@ public class Server adapter.add(locator, Ice.Util.stringToIdentity("locator")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator, initData); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + _initData = base.getInitData(ref args); + return _initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } + + private Ice.InitializationData _initData; } diff --git a/csharp/test/Ice/location/ServerManagerI.cs b/csharp/test/Ice/location/ServerManagerI.cs index 3e5458e43ac..1a6f2bf7197 100644 --- a/csharp/test/Ice/location/ServerManagerI.cs +++ b/csharp/test/Ice/location/ServerManagerI.cs @@ -12,17 +12,17 @@ using Test; public class ServerManagerI : ServerManagerDisp_ { - internal ServerManagerI(ServerLocatorRegistry registry, - Ice.InitializationData initData) + internal ServerManagerI(ServerLocatorRegistry registry, Ice.InitializationData initData, TestCommon.Application app) { _registry = registry; _communicators = new ArrayList(); _initData = initData; + _app = app; _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter"); _initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); _initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2"); } - + public override void startServer(Ice.Current current) { foreach(Ice.Communicator c in _communicators) @@ -47,16 +47,16 @@ public class ServerManagerI : ServerManagerDisp_ // Use fixed port to ensure that OA re-activation doesn't re-use previous port from // another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter). // - serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + _nextPort++); - serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p " + _nextPort++); + serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", _app.getTestEndpoint(_nextPort++)); + serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", _app.getTestEndpoint(_nextPort++)); Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2"); - - Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010"); + + Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:" + _app.getTestEndpoint(0)); adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); - + Ice.Object @object = new TestI(adapter, adapter2, _registry); _registry.addObject(adapter.add(@object, Ice.Util.stringToIdentity("test"))); _registry.addObject(adapter.add(@object, Ice.Util.stringToIdentity("test2"))); @@ -79,5 +79,6 @@ public class ServerManagerI : ServerManagerDisp_ private ServerLocatorRegistry _registry; private ArrayList _communicators; private Ice.InitializationData _initData; - private int _nextPort = 12011; + private TestCommon.Application _app; + private int _nextPort = 1; } diff --git a/csharp/test/Ice/location/msbuild/server/server.csproj b/csharp/test/Ice/location/msbuild/server/server.csproj index e02829fe996..289f58429cb 100644 --- a/csharp/test/Ice/location/msbuild/server/server.csproj +++ b/csharp/test/Ice/location/msbuild/server/server.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\HelloI.cs"> <Link>HelloI.cs</Link> </Compile> diff --git a/csharp/test/Ice/location/run.py b/csharp/test/Ice/location/run.py deleted file mode 100755 index bfec815018d..00000000000 --- a/csharp/test/Ice/location/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, getopt - -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() diff --git a/csharp/test/Ice/metrics/AllTests.cs b/csharp/test/Ice/metrics/AllTests.cs index 7cc9b2979d2..64e04338908 100644 --- a/csharp/test/Ice/metrics/AllTests.cs +++ b/csharp/test/Ice/metrics/AllTests.cs @@ -13,7 +13,7 @@ using System.Threading; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { static IceMX.ConnectionMetrics getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected) @@ -78,6 +78,12 @@ public class AllTests : TestCommon.TestApp private bool _wait; }; + static string + getPort(Ice.PropertiesAdminPrx p) + { + return TestCommon.Application.getTestPort(p.ice_getCommunicator().getProperties(), 0).ToString(); + } + static private Dictionary<string, string> getClientProps(Ice.PropertiesAdminPrx p, Dictionary<string, string> orig, string m) { @@ -96,7 +102,7 @@ public class AllTests : TestCommon.TestApp map += "Map." + m + '.'; } props["IceMX.Metrics.View." + map + "Reject.parent"] = "Ice\\.Admin"; - props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = "12010"; + props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = getPort(p); props["IceMX.Metrics.View." + map + "Reject.identity"] = ".*/admin|controller"; return props; } @@ -119,7 +125,7 @@ public class AllTests : TestCommon.TestApp map += "Map." + m + '.'; } props["IceMX.Metrics.View." + map + "Reject.parent"] = "Ice\\.Admin|Controller"; - props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = "12010"; + props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = getPort(p); return props; } @@ -383,9 +389,17 @@ public class AllTests : TestCommon.TestApp return m; } - public static MetricsPrx allTests(Ice.Communicator communicator, CommunicatorObserverI obsv) + public static MetricsPrx allTests(TestCommon.Application app, CommunicatorObserverI obsv) { - MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:default -p 12010")); + Ice.Communicator communicator = app.communicator(); + + string host = app.getTestHost(); + string port = app.getTestPort(0).ToString(); + string hostAndPort = host + ":" + port; + string protocol = app.getTestProtocol(); + string endpoint = protocol + " -h " + host + " -p " + port; + + MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:" + endpoint)); bool collocated = metrics.ice_getConnection() == null; Write("testing metrics admin facet checkedCast... "); @@ -483,9 +497,6 @@ public class AllTests : TestCommon.TestApp WriteLine("ok"); - - string endpoint = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp") + - " -h 127.0.0.1 -p 12010"; string type = ""; string isSecure = ""; if(!collocated) @@ -571,7 +582,7 @@ public class AllTests : TestCommon.TestApp test(map["active"].current == 1); ControllerPrx controller = ControllerPrxHelper.checkedCast( - communicator.stringToProxy("controller:default -p 12011")); + communicator.stringToProxy("controller:" + app.getTestEndpoint(1))); controller.hold(); map = toMap(clientMetrics.getMetricsView("View", out timestamp)["Connection"]); @@ -637,16 +648,16 @@ public class AllTests : TestCommon.TestApp testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", isSecure); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500"); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "False"); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1"); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010"); + testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", host); + testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", port); testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "False"); testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", ""); testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1"); - testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1"); + testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", host); //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", ""); - testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1"); - testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010"); + testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", host); + testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", port); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", ""); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", ""); @@ -668,13 +679,13 @@ public class AllTests : TestCommon.TestApp test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 1); IceMX.Metrics m1 = clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"][0]; - test(m1.current == 0 && m1.total == 1 && m1.id.Equals("127.0.0.1:12010")); + test(m1.current == 0 && m1.total == 1 && m1.id.Equals(hostAndPort)); metrics.ice_getConnection().close(false); controller.hold(); try { - communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping(); + communicator.stringToProxy("test:tcp -h 127.0.0.1 -p " + port).ice_timeout(10).ice_ping(); test(false); } catch(Ice.ConnectTimeoutException) @@ -687,13 +698,13 @@ public class AllTests : TestCommon.TestApp controller.resume(); test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 1); m1 = clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"][0]; - test(m1.id.Equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2); + test(m1.id.Equals(hostAndPort) && m1.total == 3 && m1.failures == 2); checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "::Ice::ConnectTimeoutException", 2); System.Action c = () => { connect(metrics); }; testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c); + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", hostAndPort, c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint", endpoint + " -t 60000", c); @@ -705,9 +716,8 @@ public class AllTests : TestCommon.TestApp testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "60000", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "False", c); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", - c); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c); + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", host, c); + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", port, c); WriteLine("ok"); @@ -718,19 +728,27 @@ public class AllTests : TestCommon.TestApp updateProps(clientProps, serverProps, update, props, "EndpointLookup"); test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 0); - Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite"); - prx.ice_ping(); + Ice.ObjectPrx prx = + communicator.stringToProxy("metrics:" + protocol + " -p " + port + " -h localhost -t 500"); + try + { + prx.ice_ping(); + prx.ice_getConnection().close(false); + } + catch(Ice.LocalException) + { + } test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 1); m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0]; - test(m1.current <= 1 && m1.total == 1 && m1.id.Equals(prx.ice_getConnection().getEndpoint().ToString())); + test(m1.current <= 1 && m1.total == 1); prx.ice_getConnection().close(false); bool dnsException = false; try { - communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping(); + communicator.stringToProxy("test:tcp -t 500 -h unknownfoo.zeroc.com -p " + port).ice_ping(); test(false); } catch(Ice.DNSException) @@ -743,11 +761,11 @@ public class AllTests : TestCommon.TestApp } test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 2); m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0]; - if(!m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500")) + if(!m1.id.Equals("tcp -h unknownfoo.zeroc.com -p " + port + " -t 500")) { m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][1]; } - test(m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 && + test(m1.id.Equals("tcp -h unknownfoo.zeroc.com -p " + port + " -t 500") && m1.total == 2 && (!dnsException || m1.failures == 2)); if(dnsException) { @@ -765,10 +783,10 @@ public class AllTests : TestCommon.TestApp testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", type, c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "False", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", isSecure, c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "500", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "False", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", port, c); WriteLine("ok"); } @@ -866,16 +884,16 @@ public class AllTests : TestCommon.TestApp testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", isSecure, op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "60000", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "False", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", host, op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", port, op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "True", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op); - //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", host, op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", port, op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", host, op); + //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", port, op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op); } diff --git a/csharp/test/Ice/metrics/Client.cs b/csharp/test/Ice/metrics/Client.cs index eed092ffb08..3b9c3c76c57 100644 --- a/csharp/test/Ice/metrics/Client.cs +++ b/csharp/test/Ice/metrics/Client.cs @@ -17,56 +17,32 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.MetricsPrx metrics = AllTests.allTests(communicator, _observer); + Test.MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - Debug.Listeners.Add(new ConsoleTraceListener()); - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics"); - initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); - initData.properties.setProperty("Ice.Admin.InstanceName", "client"); - initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.MessageSizeMax", "50000"); - initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); - - initData.observer = _observer; - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.observer = _observer; + initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); + initData.properties.setProperty("Ice.Admin.InstanceName", "client"); + initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.MessageSizeMax", "50000"); + initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } static CommunicatorObserverI _observer = new CommunicatorObserverI(); diff --git a/csharp/test/Ice/metrics/Collocated.cs b/csharp/test/Ice/metrics/Collocated.cs index 4d7c5ed6a6e..240727114b8 100644 --- a/csharp/test/Ice/metrics/Collocated.cs +++ b/csharp/test/Ice/metrics/Collocated.cs @@ -17,66 +17,44 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); - Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); + communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); + Ice.ObjectAdapter controllerAdapter = communicator().createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller")); //controllerAdapter.activate(); // Don't activate OA to ensure collocation is used. - Test.MetricsPrx metrics = AllTests.allTests(communicator, _observer); + Test.MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - Debug.Listeners.Add(new ConsoleTraceListener()); - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); - initData.properties.setProperty("Ice.Admin.InstanceName", "client"); - initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.MessageSizeMax", "50000"); - initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); - initData.observer = _observer; - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.observer = _observer; + initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); + initData.properties.setProperty("Ice.Admin.InstanceName", "client"); + initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("Ice.MessageSizeMax", "50000"); + initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); + return initData; + } - return status; + public static int Main(string[] args) + { + Collocated app = new Collocated(); + return app.runmain(args); } static CommunicatorObserverI _observer = new CommunicatorObserverI(); diff --git a/csharp/test/Ice/metrics/Server.cs b/csharp/test/Ice/metrics/Server.cs index d76fbd4c8cf..5bdfbacbe1b 100644 --- a/csharp/test/Ice/metrics/Server.cs +++ b/csharp/test/Ice/metrics/Server.cs @@ -1,3 +1,4 @@ + // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. @@ -17,62 +18,39 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics")); adapter.activate(); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); - Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); + communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); + Ice.ObjectAdapter controllerAdapter = communicator().createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - Debug.Listeners.Add(new ConsoleTraceListener()); - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); - initData.properties.setProperty("Ice.Admin.InstanceName", "server"); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.MessageSizeMax", "50000"); - initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); + initData.properties.setProperty("Ice.Admin.InstanceName", "server"); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("Ice.MessageSizeMax", "50000"); + initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/metrics/msbuild/server/server.csproj b/csharp/test/Ice/metrics/msbuild/server/server.csproj index 97fe12b6255..af0717efd7f 100644 --- a/csharp/test/Ice/metrics/msbuild/server/server.csproj +++ b/csharp/test/Ice/metrics/msbuild/server/server.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MetricsI.cs"> <Link>MetricsI.cs</Link> </Compile> diff --git a/csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj index 26cf755bf03..0f2d6e0211c 100644 --- a/csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MetricsAMDI.cs"> <Link>MetricsAMDI.cs</Link> </Compile> diff --git a/csharp/test/Ice/metrics/run.py b/csharp/test/Ice/metrics/run.py deleted file mode 100755 index 2077e17b3d9..00000000000 --- a/csharp/test/Ice/metrics/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server = "serveramd") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/networkProxy/AllTests.cs b/csharp/test/Ice/networkProxy/AllTests.cs index 455fe310c60..b007535aab2 100644 --- a/csharp/test/Ice/networkProxy/AllTests.cs +++ b/csharp/test/Ice/networkProxy/AllTests.cs @@ -7,7 +7,7 @@ // // ********************************************************************** -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private static Ice.IPConnectionInfo getIPConnectionInfo(Ice.ConnectionInfo info) { @@ -21,12 +21,19 @@ public class AllTests : TestCommon.TestApp return null; } - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { - string sref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); + int proxyPort = communicator.getProperties().getPropertyAsInt("Ice.HTTPProxyPort"); + if(proxyPort == 0) + { + proxyPort = communicator.getProperties().getPropertyAsInt("Ice.SOCKSProxyPort"); + } + Test.TestIntfPrx testPrx = Test.TestIntfPrxHelper.checkedCast(obj); test(testPrx != null); @@ -41,7 +48,7 @@ public class AllTests : TestCommon.TestApp Flush(); { Ice.IPConnectionInfo info = getIPConnectionInfo(testPrx.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. } WriteLine("ok"); diff --git a/csharp/test/Ice/networkProxy/Client.cs b/csharp/test/Ice/networkProxy/Client.cs index b5404ab14b8..fcc80eedcff 100644 --- a/csharp/test/Ice/networkProxy/Client.cs +++ b/csharp/test/Ice/networkProxy/Client.cs @@ -16,45 +16,17 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/networkProxy/Server.cs b/csharp/test/Ice/networkProxy/Server.cs index 59d35c7831a..4cd846a25d9 100644 --- a/csharp/test/Ice/networkProxy/Server.cs +++ b/csharp/test/Ice/networkProxy/Server.cs @@ -16,7 +16,7 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { class TestI : Test.TestIntfDisp_ { @@ -26,48 +26,20 @@ public class Server } } - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new TestI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/networkProxy/msbuild/server/server.csproj b/csharp/test/Ice/networkProxy/msbuild/server/server.csproj index 5335543fe54..cf11357ec61 100644 --- a/csharp/test/Ice/networkProxy/msbuild/server/server.csproj +++ b/csharp/test/Ice/networkProxy/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/networkProxy/run.py b/csharp/test/Ice/networkProxy/run.py deleted file mode 100755 index dcf9ffb84e6..00000000000 --- a/csharp/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") diff --git a/csharp/test/Ice/objects/AllTests.cs b/csharp/test/Ice/objects/AllTests.cs index 2914e1310ee..2b22c6179cc 100644 --- a/csharp/test/Ice/objects/AllTests.cs +++ b/csharp/test/Ice/objects/AllTests.cs @@ -11,7 +11,7 @@ using System; using System.Diagnostics; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { public static Ice.Value MyValueFactory(string type) { @@ -77,8 +77,9 @@ public class AllTests : TestCommon.TestApp private bool _destroyed; } - public static InitialPrx allTests(Ice.Communicator communicator) + public static InitialPrx allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); communicator.getValueFactoryManager().add(MyValueFactory, "::Test::B"); communicator.getValueFactoryManager().add(MyValueFactory, "::Test::C"); communicator.getValueFactoryManager().add(MyValueFactory, "::Test::D"); @@ -96,7 +97,7 @@ public class AllTests : TestCommon.TestApp Write("testing stringToProxy... "); Flush(); - String @ref = "initial:default -p 12010"; + String @ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx @base = communicator.stringToProxy(@ref); test(@base != null); WriteLine("ok"); @@ -296,7 +297,7 @@ public class AllTests : TestCommon.TestApp Write("testing UnexpectedObjectException..."); Flush(); - @ref = "uoet:default -p 12010"; + @ref = "uoet:" + app.getTestEndpoint(0); @base = communicator.stringToProxy(@ref); test(@base != null); UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(@base); diff --git a/csharp/test/Ice/objects/Client.cs b/csharp/test/Ice/objects/Client.cs index 805670012c6..3ffaca65c44 100644 --- a/csharp/test/Ice/objects/Client.cs +++ b/csharp/test/Ice/objects/Client.cs @@ -17,45 +17,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - InitialPrx initial = AllTests.allTests(communicator); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/objects/Collocated.cs b/csharp/test/Ice/objects/Collocated.cs index 69a6a90aaf5..ffd7dacee36 100644 --- a/csharp/test/Ice/objects/Collocated.cs +++ b/csharp/test/Ice/objects/Collocated.cs @@ -17,17 +17,17 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Collocated : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); var initial = new InitialI(adapter); adapter.add(initial, Ice.Util.stringToIdentity("initial")); UnexpectedObjectExceptionTestI uet = new UnexpectedObjectExceptionTestI(); adapter.add(uet, Ice.Util.stringToIdentity("uoet")); - AllTests.allTests(communicator); + AllTests.allTests(this); // We must call shutdown even in the collocated case for cyclic dependency cleanup initial.shutdown(); return 0; @@ -35,34 +35,7 @@ public class Client public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - var data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.WriteLine(ex); - status = 1; - } - } - - return status; + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/objects/Server.cs b/csharp/test/Ice/objects/Server.cs index 1e2a501842a..b5ff2287fdb 100644 --- a/csharp/test/Ice/objects/Server.cs +++ b/csharp/test/Ice/objects/Server.cs @@ -17,7 +17,7 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { public static Ice.Value MyValueFactory(string type) { @@ -37,53 +37,26 @@ public class Server return null; } - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getValueFactoryManager().add(MyValueFactory, "::Test::I"); - communicator.getValueFactoryManager().add(MyValueFactory, "::Test::J"); - communicator.getValueFactoryManager().add(MyValueFactory, "::Test::H"); + communicator().getValueFactoryManager().add(MyValueFactory, "::Test::I"); + communicator().getValueFactoryManager().add(MyValueFactory, "::Test::J"); + communicator().getValueFactoryManager().add(MyValueFactory, "::Test::H"); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object @object = new InitialI(adapter); adapter.add(@object, Ice.Util.stringToIdentity("initial")); @object = new UnexpectedObjectExceptionTestI(); adapter.add(@object, Ice.Util.stringToIdentity("uoet")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/objects/msbuild/server/server.csproj b/csharp/test/Ice/objects/msbuild/server/server.csproj index 93415b77007..c5a3bd27735 100644 --- a/csharp/test/Ice/objects/msbuild/server/server.csproj +++ b/csharp/test/Ice/objects/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\BI.cs"> <Link>BI.cs</Link> </Compile> diff --git a/csharp/test/Ice/objects/run.py b/csharp/test/Ice/objects/run.py deleted file mode 100755 index 716a06db2c4..00000000000 --- a/csharp/test/Ice/objects/run.py +++ /dev/null @@ -1,34 +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, getopt - -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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/operations/AllTests.cs b/csharp/test/Ice/operations/AllTests.cs index 4854f467da5..ea3f0b1dcdc 100644 --- a/csharp/test/Ice/operations/AllTests.cs +++ b/csharp/test/Ice/operations/AllTests.cs @@ -7,37 +7,38 @@ // // ********************************************************************** -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static Test.MyClassPrx allTests(Ice.Communicator communicator) + public static Test.MyClassPrx allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Flush(); - string rf = "test:default -p 12010"; + string rf = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf); Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy); Test.MyDerivedClassPrx derivedProxy = Test.MyDerivedClassPrxHelper.checkedCast(cl); Write("testing twoway operations... "); Flush(); - Twoways.twoways(communicator, cl); - Twoways.twoways(communicator, derivedProxy); + Twoways.twoways(app, cl); + Twoways.twoways(app, derivedProxy); derivedProxy.opDerived(); WriteLine("ok"); Write("testing oneway operations... "); Flush(); - Oneways.oneways(communicator, cl); + Oneways.oneways(app, cl); WriteLine("ok"); Write("testing twoway operations with AMI... "); Flush(); - TwowaysAMI.twowaysAMI(communicator, cl); - TwowaysAMI.twowaysAMI(communicator, derivedProxy); + TwowaysAMI.twowaysAMI(app, cl); + TwowaysAMI.twowaysAMI(app, derivedProxy); WriteLine("ok"); Write("testing oneway operations with AMI... "); Flush(); - OnewaysAMI.onewaysAMI(communicator, cl); + OnewaysAMI.onewaysAMI(app, cl); WriteLine("ok"); Write("testing batch oneway operations... "); diff --git a/csharp/test/Ice/operations/Client.cs b/csharp/test/Ice/operations/Client.cs index 8fd188fbefe..7abae9dbc81 100644 --- a/csharp/test/Ice/operations/Client.cs +++ b/csharp/test/Ice/operations/Client.cs @@ -16,11 +16,11 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.MyClassPrx myClass = AllTests.allTests(communicator); + Test.MyClassPrx myClass = AllTests.allTests(this); Console.Out.Write("testing server shutdown... "); Console.Out.Flush(); @@ -38,45 +38,18 @@ public class Client return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - // - // In this test, we need at least two threads in the - // client side thread pool for nested AMI. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); - initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - initData.properties.setProperty("Ice.BatchAutoFlushSize", "100"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); + initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); + initData.properties.setProperty("Ice.BatchAutoFlushSize", "100"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/operations/Collocated.cs b/csharp/test/Ice/operations/Collocated.cs index 91a9f66514e..7c458798bdf 100644 --- a/csharp/test/Ice/operations/Collocated.cs +++ b/csharp/test/Ice/operations/Collocated.cs @@ -16,13 +16,13 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.AdapterId", "test"); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.AdapterId", "test"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. @@ -31,53 +31,23 @@ public class Collocated throw new Exception(); } - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } - public static int Main(String[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI. - initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - initData.properties.setProperty("Ice.BatchAutoFlushSize", "100"); - - // - // Its possible to have batch oneway requests dispatched - // after the adapter is deactivated due to thread - // scheduling so we supress this warning. - // - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); + initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); + initData.properties.setProperty("Ice.BatchAutoFlushSize", "100"); + return initData; + } - return status; + public static int Main(string[] args) + { + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/operations/Oneways.cs b/csharp/test/Ice/operations/Oneways.cs index e0052738b22..f2be548ecfb 100644 --- a/csharp/test/Ice/operations/Oneways.cs +++ b/csharp/test/Ice/operations/Oneways.cs @@ -17,8 +17,9 @@ class Oneways } } - internal static void oneways(Ice.Communicator communicator, Test.MyClassPrx p) + internal static void oneways(TestCommon.Application app, Test.MyClassPrx p) { + Ice.Communicator communicator = app.communicator(); p = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); { diff --git a/csharp/test/Ice/operations/OnewaysAMI.cs b/csharp/test/Ice/operations/OnewaysAMI.cs index 26488c47dec..5fa7edfd3b9 100644 --- a/csharp/test/Ice/operations/OnewaysAMI.cs +++ b/csharp/test/Ice/operations/OnewaysAMI.cs @@ -71,8 +71,9 @@ public class OnewaysAMI } } - internal static void onewaysAMI(Ice.Communicator communicator, Test.MyClassPrx proxy) + internal static void onewaysAMI(TestCommon.Application app, Test.MyClassPrx proxy) { + Ice.Communicator communicator = app.communicator(); Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(proxy.ice_oneway()); { diff --git a/csharp/test/Ice/operations/Server.cs b/csharp/test/Ice/operations/Server.cs index 75f43e12218..abaff20c6ac 100644 --- a/csharp/test/Ice/operations/Server.cs +++ b/csharp/test/Ice/operations/Server.cs @@ -16,61 +16,39 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { // // We don't want connection warnings because of the timeout test. // - communicator.getProperties().setProperty("Ice.Warn.Connections", "0"); + communicator().getProperties().setProperty("Ice.Warn.Connections", "0"); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - // - // Its possible to have batch oneway requests dispatched - // after the adapter is deactivated due to thread - // scheduling so we supress this warning. - // - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + // + // Its possible to have batch oneway requests dispatched + // after the adapter is deactivated due to thread + // scheduling so we supress this warning. + // + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/operations/Twoways.cs b/csharp/test/Ice/operations/Twoways.cs index d2166a195e2..e4af24c21f0 100644 --- a/csharp/test/Ice/operations/Twoways.cs +++ b/csharp/test/Ice/operations/Twoways.cs @@ -52,8 +52,9 @@ class Twoways private Thread _thread; } - internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p) + internal static void twoways(TestCommon.Application app, Test.MyClassPrx p) { + Ice.Communicator communicator = app.communicator(); string[] literals = p.opStringLiterals(); test(Test.s0.value.Equals("\\") && @@ -1452,7 +1453,7 @@ class Twoways ctx["three"] = "THREE"; Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( - ic.stringToProxy("test:default -p 12010")); + ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(Ice.CollectionComparer.Equals(ic.getImplicitContext().getContext(), ctx)); diff --git a/csharp/test/Ice/operations/TwowaysAMI.cs b/csharp/test/Ice/operations/TwowaysAMI.cs index 0e6ed89ce5b..c93f4257a85 100644 --- a/csharp/test/Ice/operations/TwowaysAMI.cs +++ b/csharp/test/Ice/operations/TwowaysAMI.cs @@ -997,8 +997,10 @@ public class TwowaysAMI private Dictionary<string, string> _d; } - internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) + internal static void twowaysAMI(TestCommon.Application app, Test.MyClassPrx p) { + Ice.Communicator communicator = app.communicator(); + { p.ice_pingAsync().Wait(); } @@ -3249,7 +3251,7 @@ public class TwowaysAMI ctx["three"] = "THREE"; Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( - ic.stringToProxy("test:default -p 12010")); + ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(Ice.CollectionComparer.Equals(ic.getImplicitContext().getContext(), ctx)); @@ -3319,7 +3321,7 @@ public class TwowaysAMI ctx["three"] = "THREE"; Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( - ic.stringToProxy("test:default -p 12010")); + ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(Ice.CollectionComparer.Equals(ic.getImplicitContext().getContext(), ctx)); diff --git a/csharp/test/Ice/operations/msbuild/server/server.csproj b/csharp/test/Ice/operations/msbuild/server/server.csproj index 6b092fb369f..c19e2b12ae2 100644 --- a/csharp/test/Ice/operations/msbuild/server/server.csproj +++ b/csharp/test/Ice/operations/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MyDerivedClassI.cs"> <Link>MyDerivedClassI.cs</Link> </Compile> diff --git a/csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj index 381865ceaf4..d649f4c128e 100644 --- a/csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MyDerivedClassAMDI.cs"> <Link>MyDerivedClassAMDI.cs</Link> </Compile> diff --git a/csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj b/csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj index 76964393e9f..24330bdb085 100644 --- a/csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj +++ b/csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MyDerivedClassAMDTieI.cs"> <Link>MyDerivedClassAMDTieI.cs</Link> </Compile> diff --git a/csharp/test/Ice/operations/msbuild/servertie/servertie.csproj b/csharp/test/Ice/operations/msbuild/servertie/servertie.csproj index 1ab79768722..dac77f48c71 100644 --- a/csharp/test/Ice/operations/msbuild/servertie/servertie.csproj +++ b/csharp/test/Ice/operations/msbuild/servertie/servertie.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MyDerivedClassTieI.cs"> <Link>MyDerivedClassTieI.cs</Link> </Compile> diff --git a/csharp/test/Ice/operations/run.py b/csharp/test/Ice/operations/run.py deleted file mode 100755 index 5af929929e1..00000000000 --- a/csharp/test/Ice/operations/run.py +++ /dev/null @@ -1,31 +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(additionalClientOptions = "--Ice.Warn.AMICallback=0") -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", server="serveramd") -TestUtil.queueClientServerTest(configName = "tie", message = "Running test with tie server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", server="servertie") -TestUtil.queueClientServerTest(configName = "amdTie", localOnly = True, message = "Running test with AMD tie server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", server="serveramdtie") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/optional/AllTests.cs b/csharp/test/Ice/optional/AllTests.cs index ff2ea227be7..22bd54fbf3d 100644 --- a/csharp/test/Ice/optional/AllTests.cs +++ b/csharp/test/Ice/optional/AllTests.cs @@ -10,16 +10,17 @@ using System; using System.Collections.Generic; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static Test.InitialPrx allTests(Ice.Communicator communicator) + public static Test.InitialPrx allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); FactoryI factory = new FactoryI(); communicator.getValueFactoryManager().add(factory.create, ""); Write("testing stringToProxy... "); Flush(); - string @ref = "initial:default -p 12010"; + string @ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx @base = communicator.stringToProxy(@ref); test(@base != null); WriteLine("ok"); diff --git a/csharp/test/Ice/optional/Client.cs b/csharp/test/Ice/optional/Client.cs index dbf94133fb2..48b224dca50 100644 --- a/csharp/test/Ice/optional/Client.cs +++ b/csharp/test/Ice/optional/Client.cs @@ -16,11 +16,11 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.InitialPrx initial = AllTests.allTests(communicator); + Test.InitialPrx initial = AllTests.allTests(this); initial.shutdown(); @@ -29,34 +29,7 @@ public class Client public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(System.Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/optional/Server.cs b/csharp/test/Ice/optional/Server.cs index dee39c8c23c..e02c941371a 100644 --- a/csharp/test/Ice/optional/Server.cs +++ b/csharp/test/Ice/optional/Server.cs @@ -17,49 +17,22 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/optional/ServerAMD.cs b/csharp/test/Ice/optional/ServerAMD.cs index 814404845b2..875347098cd 100644 --- a/csharp/test/Ice/optional/ServerAMD.cs +++ b/csharp/test/Ice/optional/ServerAMD.cs @@ -16,49 +16,22 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/optional/msbuild/server/server.csproj b/csharp/test/Ice/optional/msbuild/server/server.csproj index 43b1ba2126b..8d83443b7b0 100644 --- a/csharp/test/Ice/optional/msbuild/server/server.csproj +++ b/csharp/test/Ice/optional/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj index aed61469c31..610f50e5107 100644 --- a/csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\ServerAMD.cs"> <Link>ServerAMD.cs</Link> </Compile> diff --git a/csharp/test/Ice/optional/run.py b/csharp/test/Ice/optional/run.py deleted file mode 100755 index bf6714640bd..00000000000 --- a/csharp/test/Ice/optional/run.py +++ /dev/null @@ -1,29 +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(configName = "compact", message = "Running test with compact (default) format.") -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="serveramd") -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/plugin/run.py b/csharp/test/Ice/plugin/run.py deleted file mode 100755 index 89c01e6ae16..00000000000 --- a/csharp/test/Ice/plugin/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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -sys.stdout.write("starting client...") -clientProc = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0 2>&1", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() - diff --git a/csharp/test/Ice/properties/Client.cs b/csharp/test/Ice/properties/Client.cs index 1ec20a77e75..1ef773e55d6 100644 --- a/csharp/test/Ice/properties/Client.cs +++ b/csharp/test/Ice/properties/Client.cs @@ -66,7 +66,7 @@ public class Client Console.Error.WriteLine(ex); status = 1; } - + // // Try to load multiple config files. // @@ -116,10 +116,10 @@ public class Client "AServer", "\\\\server\\dir", "BServer", "\\server\\dir", ""}; - + for(int i = 0; props[i].Length > 0; i += 2) { - test(properties.getProperty(props[i]).Equals(props[i + 1])); + test(properties.getProperty(props[i]).Equals(props[i + 1])); } Console.Out.WriteLine("ok"); } diff --git a/csharp/test/Ice/properties/run.py b/csharp/test/Ice/properties/run.py deleted file mode 100755 index 70e96e63e13..00000000000 --- a/csharp/test/Ice/properties/run.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -# -# Write config -# -if sys.version_info[0] == 2: - configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config" - decodedPath = configPath.decode("utf-8") -else: - configPath = "./config/\u4e2d\u56fd_client.config" - decodedPath = configPath # No need to decode with Python3, strings are already Unicode - -TestUtil.createFile(decodedPath, - ["# Automatically generated by Ice test driver.", - "Ice.Trace.Protocol=1", - "Ice.Trace.Network=1", - "Ice.ProgramName=PropertiesClient", - "Config.Path=" + configPath], - "utf-8") - -TestUtil.simpleTest() - -if os.path.exists(decodedPath): - os.remove(decodedPath) diff --git a/csharp/test/Ice/proxy/AllTests.cs b/csharp/test/Ice/proxy/AllTests.cs index 85072f7f9bb..f83712fb994 100644 --- a/csharp/test/Ice/proxy/AllTests.cs +++ b/csharp/test/Ice/proxy/AllTests.cs @@ -10,13 +10,14 @@ using System; using System.Collections.Generic; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static Test.MyClassPrx allTests(Ice.Communicator communicator) + public static Test.MyClassPrx allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); - string rf = "test:default -p 12010"; + string rf = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf); test(baseProxy != null); @@ -337,7 +338,7 @@ public class AllTests : TestCommon.TestApp Flush(); Ice.Properties prop = communicator.getProperties(); String propertyPrefix = "Foo.Proxy"; - prop.setProperty(propertyPrefix, "test:default -p 12010"); + prop.setProperty(propertyPrefix, "test:" + app.getTestEndpoint(0)); b1 = communicator.propertyToProxy(propertyPrefix); test(b1.ice_getIdentity().name.Equals("test") && b1.ice_getIdentity().category.Length == 0 && b1.ice_getAdapterId().Length == 0 && b1.ice_getFacet().Length == 0); @@ -387,7 +388,7 @@ public class AllTests : TestCommon.TestApp //test(b1.ice_getLocatorCacheTimeout() == 60); //prop.setProperty("Ice.Default.LocatorCacheTimeout", ""); - prop.setProperty(propertyPrefix, "test:default -p 12010"); + prop.setProperty(propertyPrefix, "test:" + app.getTestEndpoint(0)); property = propertyPrefix + ".Router"; test(b1.ice_getRouter() == null); @@ -748,7 +749,7 @@ public class AllTests : TestCommon.TestApp Write("testing encoding versioning... "); Flush(); - string ref20 = "test -e 2.0:default -p 12010"; + string ref20 = "test -e 2.0:" + app.getTestEndpoint(0); Test.MyClassPrx cl20 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -760,7 +761,7 @@ public class AllTests : TestCommon.TestApp // Server 2.0 endpoint doesn't support 1.1 version. } - string ref10 = "test -e 1.0:default -p 12010"; + string ref10 = "test -e 1.0:" + app.getTestEndpoint(0); Test.MyClassPrx cl10 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10)); cl10.ice_ping(); cl10.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); @@ -768,7 +769,7 @@ public class AllTests : TestCommon.TestApp // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the // call will use the 1.1 encoding - string ref13 = "test -e 1.3:default -p 12010"; + string ref13 = "test -e 1.3:" + app.getTestEndpoint(0); Test.MyClassPrx cl13 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.end_ice_ping(cl13.begin_ice_ping()); @@ -819,7 +820,7 @@ public class AllTests : TestCommon.TestApp Write("testing protocol versioning... "); Flush(); - ref20 = "test -p 2.0:default -p 12010"; + ref20 = "test -p 2.0:" + app.getTestEndpoint(0); cl20 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -831,13 +832,13 @@ public class AllTests : TestCommon.TestApp // Server 2.0 proxy doesn't support 1.0 version. } - ref10 = "test -p 1.0:default -p 12010"; + ref10 = "test -p 1.0:" + app.getTestEndpoint(0); cl10 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10)); cl10.ice_ping(); // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the // call will use the 1.1 protocol - ref13 = "test -p 1.3:default -p 12010"; + ref13 = "test -p 1.3:" + app.getTestEndpoint(0); cl13 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.end_ice_ping(cl13.begin_ice_ping()); @@ -970,10 +971,6 @@ public class AllTests : TestCommon.TestApp // Working? bool ssl = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("ssl"); bool tcp = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("tcp"); - if(tcp) - { - p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); - } // Two legal TCP endpoints expressed as opaque endpoints p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); diff --git a/csharp/test/Ice/proxy/Client.cs b/csharp/test/Ice/proxy/Client.cs index 187f95e9c4f..5b0dd91cb2f 100644 --- a/csharp/test/Ice/proxy/Client.cs +++ b/csharp/test/Ice/proxy/Client.cs @@ -16,47 +16,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.MyClassPrx myClass = AllTests.allTests(communicator); + Test.MyClassPrx myClass = AllTests.allTests(this); myClass.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/proxy/Collocated.cs b/csharp/test/Ice/proxy/Collocated.cs index b13cb01b8ba..eb811643b80 100644 --- a/csharp/test/Ice/proxy/Collocated.cs +++ b/csharp/test/Ice/proxy/Collocated.cs @@ -16,55 +16,32 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator); + AllTests.allTests(this); return 0; } - public static int Main(String[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI. - initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI. + initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + return initData; + } - return status; + public static int Main(String[] args) + { + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/proxy/Server.cs b/csharp/test/Ice/proxy/Server.cs index 4c30820cbb7..c79dc95d9ac 100644 --- a/csharp/test/Ice/proxy/Server.cs +++ b/csharp/test/Ice/proxy/Server.cs @@ -16,56 +16,28 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { // // We don't want connection warnings because of the timeout test. // - communicator.getProperties().setProperty("Ice.Warn.Connections", "0"); - communicator.getProperties().setProperty("Ice.Warn.Dispatch", "0"); + communicator().getProperties().setProperty("Ice.Warn.Connections", "0"); + communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/proxy/msbuild/server/server.csproj b/csharp/test/Ice/proxy/msbuild/server/server.csproj index a95bb319d8f..9118d44b2a4 100644 --- a/csharp/test/Ice/proxy/msbuild/server/server.csproj +++ b/csharp/test/Ice/proxy/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MyDerivedClassI.cs"> <Link>MyDerivedClassI.cs</Link> </Compile> diff --git a/csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj index ffaddc4eae9..d50dbdc92a2 100644 --- a/csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\MyDerivedClassAMDI.cs"> <Link>MyDerivedClassAMDI.cs</Link> </Compile> diff --git a/csharp/test/Ice/proxy/run.py b/csharp/test/Ice/proxy/run.py deleted file mode 100755 index 88a9c6c01bc..00000000000 --- a/csharp/test/Ice/proxy/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="serveramd") -TestUtil.queueCollocatedTest(additionalOptions = "--Ice.ToStringMode=Compat") -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/retry/AllTests.cs b/csharp/test/Ice/retry/AllTests.cs index bc356c6c843..53be072cbf6 100644 --- a/csharp/test/Ice/retry/AllTests.cs +++ b/csharp/test/Ice/retry/AllTests.cs @@ -11,7 +11,7 @@ using System; using System.Diagnostics; using System.Threading; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Callback { @@ -47,8 +47,9 @@ public class AllTests : TestCommon.TestApp } static public Test.RetryPrx - allTests(Ice.Communicator communicator, Ice.Communicator communicator2, string rf) + allTests(TestCommon.Application app, Ice.Communicator communicator2, string rf) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); Ice.ObjectPrx base1 = communicator.stringToProxy(rf); diff --git a/csharp/test/Ice/retry/Client.cs b/csharp/test/Ice/retry/Client.cs index db792e0c336..1fc01d4a5b1 100644 --- a/csharp/test/Ice/retry/Client.cs +++ b/csharp/test/Ice/retry/Client.cs @@ -16,81 +16,51 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator, Ice.Communicator communicator2) + public override int run(string[] args) { - Test.RetryPrx retry = AllTests.allTests(communicator, communicator2, "retry:default -p 12010"); - retry.shutdown(); - return 0; - } - - public static int Main(string[] args) - { - int status = 0; - Ice.Communicator communicator = null; - Ice.Communicator communicator2 = null; + // + // Configure a second communicator for the invocation timeout + // + retry test, we need to configure a large retry interval + // to avoid time-sensitive failures. + // + Ice.InitializationData initData2 = new Ice.InitializationData(); + initData2.properties = communicator().getProperties().ice_clone_(); + initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000"); + initData2.observer = Instrumentation.getObserver(); + Ice.Communicator communicator2 = Ice.Util.initialize(initData2); try { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.observer = Instrumentation.getObserver(); - - initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1"); - - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - communicator = Ice.Util.initialize(ref args, initData); - - // - // Configure a second communicator for the invocation timeout - // + retry test, we need to configure a large retry interval - // to avoid time-sensitive failures. - // - Ice.InitializationData initData2 = new Ice.InitializationData(); - initData2.properties = initData.properties.ice_clone_(); - initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000"); - initData2.observer = Instrumentation.getObserver(); - communicator2 = Ice.Util.initialize(initData2); - - status = run(args, communicator, communicator2); + Test.RetryPrx retry = AllTests.allTests(this, communicator2, "retry:" + getTestEndpoint(0)); + retry.shutdown(); + return 0; } - catch(Exception ex) + finally { - Console.Error.WriteLine(ex); - status = 1; + communicator2.destroy(); } + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + protected override Ice.InitializationData getInitData(ref string[] args) + { + Ice.InitializationData initData = base.getInitData(ref args); + initData.observer = Instrumentation.getObserver(); - if(communicator2 != null) - { - try - { - communicator2.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1"); - return status; + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + return initData; } + + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); + } + } diff --git a/csharp/test/Ice/retry/Collocated.cs b/csharp/test/Ice/retry/Collocated.cs index 2fd9b6b8e8a..1c9fd1c388f 100644 --- a/csharp/test/Ice/retry/Collocated.cs +++ b/csharp/test/Ice/retry/Collocated.cs @@ -16,91 +16,47 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static void setupObjectAdapter(Ice.Communicator communicator) + public override int run(string[] args) { - Ice.ObjectAdapter adapter = communicator.createObjectAdapter(""); - adapter.add(new RetryI(), Ice.Util.stringToIdentity("retry")); - } - - public static int run(string[] args, Ice.Communicator communicator, Ice.Communicator communicator2) - { - setupObjectAdapter(communicator); - setupObjectAdapter(communicator2); - - Test.RetryPrx retry = AllTests.allTests(communicator, communicator2, "retry"); + // + // Configure a second communicator for the invocation timeout + // + retry test, we need to configure a large retry interval + // to avoid time-sensitive failures. + // + Ice.InitializationData initData2 = new Ice.InitializationData(); + initData2.properties = communicator().getProperties().ice_clone_(); + initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000"); + initData2.observer = Instrumentation.getObserver(); + Ice.Communicator communicator2 = Ice.Util.initialize(initData2); + + communicator().createObjectAdapter("").add(new RetryI(), Ice.Util.stringToIdentity("retry")); + communicator2.createObjectAdapter("").add(new RetryI(), Ice.Util.stringToIdentity("retry")); + + Test.RetryPrx retry = AllTests.allTests(this, communicator2, "retry"); retry.shutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - Ice.Communicator communicator2 = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.observer = Instrumentation.getObserver(); - - initData.properties.setProperty("Ice.RetryIntervals", "0 1 400 1"); + Ice.InitializationData initData = base.getInitData(ref args); + initData.observer = Instrumentation.getObserver(); - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - communicator = Ice.Util.initialize(ref args, initData); - - // - // Configure a second communicator for the invocation timeout - // + retry test, we need to configure a large retry interval - // to avoid time-sensitive failures. - // - Ice.InitializationData initData2 = new Ice.InitializationData(); - initData2.properties = initData.properties.ice_clone_(); - initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000"); - initData2.observer = Instrumentation.getObserver(); - communicator2 = Ice.Util.initialize(initData2); - - status = run(args, communicator, communicator2); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - if(communicator2 != null) - { - try - { - communicator2.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + return initData; + } - return status; + public static int Main(string[] args) + { + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/retry/Server.cs b/csharp/test/Ice/retry/Server.cs index f0796f26ca9..0ac50592238 100644 --- a/csharp/test/Ice/retry/Server.cs +++ b/csharp/test/Ice/retry/Server.cs @@ -16,51 +16,29 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new RetryI(), Ice.Util.stringToIdentity("retry")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/retry/msbuild/server/server.csproj b/csharp/test/Ice/retry/msbuild/server/server.csproj index 1257f83aa31..35e4488a31e 100644 --- a/csharp/test/Ice/retry/msbuild/server/server.csproj +++ b/csharp/test/Ice/retry/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\RetryI.cs"> <Link>RetryI.cs</Link> </Compile> diff --git a/csharp/test/Ice/retry/run.py b/csharp/test/Ice/retry/run.py deleted file mode 100755 index df7bc2b4ac3..00000000000 --- a/csharp/test/Ice/retry/run.py +++ /dev/null @@ -1,25 +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, getopt - -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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/seqMapping/AllTests.cs b/csharp/test/Ice/seqMapping/AllTests.cs index cabf73185b6..4b0f29cc4b3 100644 --- a/csharp/test/Ice/seqMapping/AllTests.cs +++ b/csharp/test/Ice/seqMapping/AllTests.cs @@ -7,12 +7,13 @@ // // ********************************************************************** -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { - public static Test.MyClassPrx allTests(Ice.Communicator communicator, bool collocated) + public static Test.MyClassPrx allTests(TestCommon.Application app, bool collocated) { + Ice.Communicator communicator = app.communicator(); Flush(); - string rf = "test:default -p 12010"; + string rf = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf); Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy); diff --git a/csharp/test/Ice/seqMapping/Client.cs b/csharp/test/Ice/seqMapping/Client.cs index 2b99829d7eb..5227260717b 100644 --- a/csharp/test/Ice/seqMapping/Client.cs +++ b/csharp/test/Ice/seqMapping/Client.cs @@ -17,11 +17,11 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.MyClassPrx myClass = AllTests.allTests(communicator, false); + Test.MyClassPrx myClass = AllTests.allTests(this, false); Console.Out.Write("shutting down server... "); Console.Out.Flush(); @@ -32,33 +32,7 @@ public class Client public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/seqMapping/Collocated.cs b/csharp/test/Ice/seqMapping/Collocated.cs index 4662e271666..32a4f730a4d 100644 --- a/csharp/test/Ice/seqMapping/Collocated.cs +++ b/csharp/test/Ice/seqMapping/Collocated.cs @@ -16,50 +16,23 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator, true); + AllTests.allTests(this, true); return 0; } - public static int Main(String[] args) + public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/seqMapping/Server.cs b/csharp/test/Ice/seqMapping/Server.cs index 8e19d27c13f..edc3cba873b 100644 --- a/csharp/test/Ice/seqMapping/Server.cs +++ b/csharp/test/Ice/seqMapping/Server.cs @@ -16,49 +16,22 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/seqMapping/ServerAMD.cs b/csharp/test/Ice/seqMapping/ServerAMD.cs index 8e19d27c13f..edc3cba873b 100644 --- a/csharp/test/Ice/seqMapping/ServerAMD.cs +++ b/csharp/test/Ice/seqMapping/ServerAMD.cs @@ -16,49 +16,22 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/seqMapping/msbuild/server/server.csproj b/csharp/test/Ice/seqMapping/msbuild/server/server.csproj index 257c5f6d658..9487a91607c 100644 --- a/csharp/test/Ice/seqMapping/msbuild/server/server.csproj +++ b/csharp/test/Ice/seqMapping/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Custom.cs"> <Link>Custom.cs</Link> </Compile> diff --git a/csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj index a7e3ce4f310..6db9184cb89 100644 --- a/csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Custom.cs"> <Link>Custom.cs</Link> </Compile> diff --git a/csharp/test/Ice/seqMapping/run.py b/csharp/test/Ice/seqMapping/run.py deleted file mode 100755 index d0771952158..00000000000 --- a/csharp/test/Ice/seqMapping/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="serveramd") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/serialize/AllTests.cs b/csharp/test/Ice/serialize/AllTests.cs index bd9c24dcb3a..1274715e03e 100644 --- a/csharp/test/Ice/serialize/AllTests.cs +++ b/csharp/test/Ice/serialize/AllTests.cs @@ -15,7 +15,7 @@ using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { // // There does not appear to be any way to compare collections @@ -63,8 +63,10 @@ public class AllTests : TestCommon.TestApp return true; } - static public int run(Ice.Communicator communicator) + static public int run(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); + Write("testing serialization... "); Flush(); @@ -164,7 +166,7 @@ public class AllTests : TestCommon.TestApp private static T inOut<T>(T o, Ice.Communicator communicator) { - BinaryFormatter bin = new BinaryFormatter(null, + BinaryFormatter bin = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.All, communicator)); using (MemoryStream mem = new MemoryStream()) { diff --git a/csharp/test/Ice/serialize/Client.cs b/csharp/test/Ice/serialize/Client.cs index 0fb56692d3e..3aed5564fe6 100644 --- a/csharp/test/Ice/serialize/Client.cs +++ b/csharp/test/Ice/serialize/Client.cs @@ -16,38 +16,16 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public static int Main(string[] args) + public override int run(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = AllTests.run(communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + return AllTests.run(this); + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/serialize/run.py b/csharp/test/Ice/serialize/run.py deleted file mode 100755 index 5238b99164b..00000000000 --- a/csharp/test/Ice/serialize/run.py +++ /dev/null @@ -1,25 +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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -TestUtil.simpleTest(client) diff --git a/csharp/test/Ice/servantLocator/AllTests.cs b/csharp/test/Ice/servantLocator/AllTests.cs index add7e4d99d5..87ab72a0f1e 100644 --- a/csharp/test/Ice/servantLocator/AllTests.cs +++ b/csharp/test/Ice/servantLocator/AllTests.cs @@ -11,7 +11,7 @@ using System; using Test; using Ice; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { public static void testExceptions(TestIntfPrx obj) { @@ -195,15 +195,16 @@ public class AllTests : TestCommon.TestApp } } - public static TestIntfPrx allTests(Ice.Communicator communicator) + public static TestIntfPrx allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); - string @ref = "asm:default -p 12010"; + string @ref = "asm:" + app.getTestEndpoint(0); Ice.ObjectPrx @base = communicator.stringToProxy(@ref); test(@base != null); WriteLine("ok"); - + Write("testing checked cast... "); Flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base); @@ -215,7 +216,7 @@ public class AllTests : TestCommon.TestApp Flush(); try { - Ice.ObjectPrx o = communicator.stringToProxy("category/locate:default -p 12010"); + Ice.ObjectPrx o = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); o.ice_ids(); test(false); } @@ -230,7 +231,7 @@ public class AllTests : TestCommon.TestApp try { - Ice.ObjectPrx o = communicator.stringToProxy("category/finished:default -p 12010"); + Ice.ObjectPrx o = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0)); o.ice_ids(); test(false); } @@ -246,11 +247,11 @@ public class AllTests : TestCommon.TestApp Write("testing servant locator..."); Flush(); - @base = communicator.stringToProxy("category/locate:default -p 12010"); + @base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(@base); try { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010")); + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException) { @@ -259,20 +260,20 @@ public class AllTests : TestCommon.TestApp Write("testing default servant locator..."); Flush(); - @base = communicator.stringToProxy("anothercat/locate:default -p 12010"); + @base = communicator.stringToProxy("anothercat/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(@base); - @base = communicator.stringToProxy("locate:default -p 12010"); + @base = communicator.stringToProxy("locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(@base); try { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010")); + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException) { } try { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010")); + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException) { @@ -281,14 +282,14 @@ public class AllTests : TestCommon.TestApp Write("testing locate exceptions... "); Flush(); - @base = communicator.stringToProxy("category/locate:default -p 12010"); + @base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(@base); testExceptions(obj); WriteLine("ok"); Write("testing finished exceptions... "); Flush(); - @base = communicator.stringToProxy("category/finished:default -p 12010"); + @base = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(@base); testExceptions(obj); @@ -332,7 +333,7 @@ public class AllTests : TestCommon.TestApp Write("testing servant locator removal... "); Flush(); - @base = communicator.stringToProxy("test/activation:default -p 12010"); + @base = communicator.stringToProxy("test/activation:" + app.getTestEndpoint(0)); TestActivationPrx activation = TestActivationPrxHelper.checkedCast(@base); activation.activateServantLocator(false); try diff --git a/csharp/test/Ice/servantLocator/Client.cs b/csharp/test/Ice/servantLocator/Client.cs index b6de8d4f0fc..b7de5b2bb15 100644 --- a/csharp/test/Ice/servantLocator/Client.cs +++ b/csharp/test/Ice/servantLocator/Client.cs @@ -17,22 +17,18 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - internal class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) - { - TestIntfPrx obj = AllTests.allTests(communicator()); - obj.shutdown(); - return 0; - } + TestIntfPrx obj = AllTests.allTests(this); + obj.shutdown(); + return 0; } public static int Main(string[] args) { - Ice.InitializationData data = new Ice.InitializationData(); - App app = new App(); - return app.main(args, data); + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/servantLocator/Collocated.cs b/csharp/test/Ice/servantLocator/Collocated.cs index b3acd7dfb99..4885035d001 100644 --- a/csharp/test/Ice/servantLocator/Collocated.cs +++ b/csharp/test/Ice/servantLocator/Collocated.cs @@ -16,31 +16,27 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - internal class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - adapter.addServantLocator(new ServantLocatorI("category"), "category"); - adapter.addServantLocator(new ServantLocatorI(""), ""); - adapter.add(new TestI(), Ice.Util.stringToIdentity("asm")); - adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation")); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.addServantLocator(new ServantLocatorI("category"), "category"); + adapter.addServantLocator(new ServantLocatorI(""), ""); + adapter.add(new TestI(), Ice.Util.stringToIdentity("asm")); + adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation")); - AllTests.allTests(communicator()); + AllTests.allTests(this); - return 0; - } + return 0; } public static int Main(string[] args) { - Ice.InitializationData data = new Ice.InitializationData(); - App app = new App(); - return app.main(args, data); + Collocated app = new Collocated(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/servantLocator/Server.cs b/csharp/test/Ice/servantLocator/Server.cs index 59d8df36ccd..8529bfabcdc 100644 --- a/csharp/test/Ice/servantLocator/Server.cs +++ b/csharp/test/Ice/servantLocator/Server.cs @@ -16,29 +16,26 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - internal class App : Ice.Application + public override int run(string[] args) { - public override int run(string[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - adapter.addServantLocator(new ServantLocatorI("category"), "category"); - adapter.addServantLocator(new ServantLocatorI(""), ""); - adapter.add(new TestI(), Ice.Util.stringToIdentity("asm")); - adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation")); - adapter.activate(); - adapter.waitForDeactivate(); - return 0; - } + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.addServantLocator(new ServantLocatorI("category"), "category"); + adapter.addServantLocator(new ServantLocatorI(""), ""); + adapter.add(new TestI(), Ice.Util.stringToIdentity("asm")); + adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation")); + adapter.activate(); + adapter.waitForDeactivate(); + return 0; } public static int Main(string[] args) { - App app = new App(); - return app.main(args); + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/servantLocator/msbuild/server/server.csproj b/csharp/test/Ice/servantLocator/msbuild/server/server.csproj index e5878336e00..e836b397563 100644 --- a/csharp/test/Ice/servantLocator/msbuild/server/server.csproj +++ b/csharp/test/Ice/servantLocator/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\CookieI.cs"> <Link>CookieI.cs</Link> </Compile> diff --git a/csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj index 88c0fd99836..58b6734fecf 100644 --- a/csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\CookieI.cs"> <Link>CookieI.cs</Link> </Compile> diff --git a/csharp/test/Ice/servantLocator/run.py b/csharp/test/Ice/servantLocator/run.py deleted file mode 100755 index ad593fdaf7e..00000000000 --- a/csharp/test/Ice/servantLocator/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, getopt - -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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="serveramd") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/slicing/exceptions/AllTests.cs b/csharp/test/Ice/slicing/exceptions/AllTests.cs index eaa88d04e6b..bbd1ee04413 100644 --- a/csharp/test/Ice/slicing/exceptions/AllTests.cs +++ b/csharp/test/Ice/slicing/exceptions/AllTests.cs @@ -12,7 +12,7 @@ using System.Diagnostics; using System.Threading; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Callback { @@ -90,11 +90,12 @@ public class AllTests : TestCommon.TestApp } } - public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated) + public static TestIntfPrx allTests(TestCommon.Application app, bool collocated) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); - String @ref = "Test:default -p 12010 -t 2000"; + String @ref = "Test:" + app.getTestEndpoint(0) + " -t 2000"; Ice.ObjectPrx @base = communicator.stringToProxy(@ref); test(@base != null); WriteLine("ok"); diff --git a/csharp/test/Ice/slicing/exceptions/Client.cs b/csharp/test/Ice/slicing/exceptions/Client.cs index a89ce7c02e1..bbbedc65880 100644 --- a/csharp/test/Ice/slicing/exceptions/Client.cs +++ b/csharp/test/Ice/slicing/exceptions/Client.cs @@ -10,45 +10,18 @@ using Test; using System; -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - TestIntfPrx test = AllTests.allTests(communicator, false); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/slicing/exceptions/Server.cs b/csharp/test/Ice/slicing/exceptions/Server.cs index 56bf9f925fb..6d6ed3e3845 100644 --- a/csharp/test/Ice/slicing/exceptions/Server.cs +++ b/csharp/test/Ice/slicing/exceptions/Server.cs @@ -9,51 +9,24 @@ using System; -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object @object = new TestI(); adapter.add(@object, Ice.Util.stringToIdentity("Test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/slicing/exceptions/ServerAMD.cs b/csharp/test/Ice/slicing/exceptions/ServerAMD.cs index 56bf9f925fb..6d6ed3e3845 100644 --- a/csharp/test/Ice/slicing/exceptions/ServerAMD.cs +++ b/csharp/test/Ice/slicing/exceptions/ServerAMD.cs @@ -9,51 +9,24 @@ using System; -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object @object = new TestI(); adapter.add(@object, Ice.Util.stringToIdentity("Test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj b/csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj index 324fac5a6f3..6993e7fc04d 100644 --- a/csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj +++ b/csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj index 3a457f7ec61..51a973707d4 100644 --- a/csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\ServerAMD.cs"> <Link>ServerAMD.cs</Link> </Compile> diff --git a/csharp/test/Ice/slicing/exceptions/run.py b/csharp/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index 47575b29694..00000000000 --- a/csharp/test/Ice/slicing/exceptions/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, getopt - -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(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", server="serveramd") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", server="serveramd", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/slicing/objects/AllTests.cs b/csharp/test/Ice/slicing/objects/AllTests.cs index edb42e7270a..dc4bfac1b67 100644 --- a/csharp/test/Ice/slicing/objects/AllTests.cs +++ b/csharp/test/Ice/slicing/objects/AllTests.cs @@ -12,7 +12,7 @@ using System.Collections.Generic; using System.Diagnostics; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Callback { @@ -76,11 +76,12 @@ public class AllTests : TestCommon.TestApp return null; } - public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated) + public static TestIntfPrx allTests(TestCommon.Application app, bool collocated) { + Ice.Communicator communicator = app.communicator(); Write("testing stringToProxy... "); Flush(); - Ice.ObjectPrx basePrx = communicator.stringToProxy("Test:default -p 12010 -t 2000"); + Ice.ObjectPrx basePrx = communicator.stringToProxy("Test:" + app.getTestEndpoint(0) + " -t 2000"); test(basePrx != null); WriteLine("ok"); diff --git a/csharp/test/Ice/slicing/objects/Client.cs b/csharp/test/Ice/slicing/objects/Client.cs index a89ce7c02e1..bbbedc65880 100644 --- a/csharp/test/Ice/slicing/objects/Client.cs +++ b/csharp/test/Ice/slicing/objects/Client.cs @@ -10,45 +10,18 @@ using Test; using System; -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - TestIntfPrx test = AllTests.allTests(communicator, false); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/slicing/objects/Server.cs b/csharp/test/Ice/slicing/objects/Server.cs index 89cca96fb72..f43055c1aa2 100644 --- a/csharp/test/Ice/slicing/objects/Server.cs +++ b/csharp/test/Ice/slicing/objects/Server.cs @@ -9,51 +9,24 @@ using System; -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object obj = new TestI(); adapter.add(obj, Ice.Util.stringToIdentity("Test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/slicing/objects/ServerAMD.cs b/csharp/test/Ice/slicing/objects/ServerAMD.cs index 89cca96fb72..f43055c1aa2 100644 --- a/csharp/test/Ice/slicing/objects/ServerAMD.cs +++ b/csharp/test/Ice/slicing/objects/ServerAMD.cs @@ -9,51 +9,24 @@ using System; -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object obj = new TestI(); adapter.add(obj, Ice.Util.stringToIdentity("Test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/slicing/objects/msbuild/server/server.csproj b/csharp/test/Ice/slicing/objects/msbuild/server/server.csproj index 7536fa51b6a..50b4c4450c4 100644 --- a/csharp/test/Ice/slicing/objects/msbuild/server/server.csproj +++ b/csharp/test/Ice/slicing/objects/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj index 347e0ba8644..12cbda4a4d2 100644 --- a/csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj +++ b/csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\ServerAMD.cs"> <Link>ServerAMD.cs</Link> </Compile> diff --git a/csharp/test/Ice/slicing/objects/run.py b/csharp/test/Ice/slicing/objects/run.py deleted file mode 100755 index 47575b29694..00000000000 --- a/csharp/test/Ice/slicing/objects/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, getopt - -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(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", server="serveramd") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", server="serveramd", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") -TestUtil.runQueuedTests() diff --git a/csharp/test/Ice/stream/AllTests.cs b/csharp/test/Ice/stream/AllTests.cs index ddc16de2ae9..80198284ae0 100644 --- a/csharp/test/Ice/stream/AllTests.cs +++ b/csharp/test/Ice/stream/AllTests.cs @@ -12,7 +12,7 @@ using System.Collections.Generic; using System.Diagnostics; using Test; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { // // There does not appear to be any way to compare collections @@ -130,8 +130,9 @@ public class AllTests : TestCommon.TestApp private Ice.ValueFactory _factory; } - static public int run(Ice.Communicator communicator) + static public int allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper(); communicator.getValueFactoryManager().add(factoryWrapper.create, MyClass.ice_staticId()); diff --git a/csharp/test/Ice/stream/Client.cs b/csharp/test/Ice/stream/Client.cs index 0fb56692d3e..0ee62467b26 100644 --- a/csharp/test/Ice/stream/Client.cs +++ b/csharp/test/Ice/stream/Client.cs @@ -16,38 +16,16 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public static int Main(string[] args) + public override int run(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData data = new Ice.InitializationData(); - communicator = Ice.Util.initialize(ref args, data); - status = AllTests.run(communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + return AllTests.allTests(this); + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/stream/run.py b/csharp/test/Ice/stream/run.py deleted file mode 100755 index 43a477cc2e5..00000000000 --- a/csharp/test/Ice/stream/run.py +++ /dev/null @@ -1,29 +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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -print("Running test with default encoding...") -TestUtil.simpleTest(client) - -print("Running test with 1.0 encoding...") -TestUtil.simpleTest(client, "--Ice.Default.EncodingVersion=1.0") diff --git a/csharp/test/Ice/threadPoolPriority/Client.cs b/csharp/test/Ice/threadPoolPriority/Client.cs index eb4f911ac78..f2c37ad7ecb 100644 --- a/csharp/test/Ice/threadPoolPriority/Client.cs +++ b/csharp/test/Ice/threadPoolPriority/Client.cs @@ -16,21 +16,13 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static void test(bool b) - { - if(!b) - { - throw new Exception(); - } - } - - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { Console.Out.Write("testing server priority... "); Console.Out.Flush(); - Ice.ObjectPrx obj = communicator.stringToProxy("test:default -p 12010 -t 10000"); + Ice.ObjectPrx obj = communicator().stringToProxy("test:" + getTestEndpoint(0) + " -t 10000"); Test.PriorityPrx priority = Test.PriorityPrxHelper.checkedCast(obj); try @@ -50,34 +42,8 @@ public class Client public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/threadPoolPriority/Server.cs b/csharp/test/Ice/threadPoolPriority/Server.cs index fd2118c8587..7bc22c199bd 100644 --- a/csharp/test/Ice/threadPoolPriority/Server.cs +++ b/csharp/test/Ice/threadPoolPriority/Server.cs @@ -16,51 +16,29 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new PriorityI(), Ice.Util.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "AboveNormal"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "AboveNormal"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj b/csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj index d3c9a79e44f..2de69ff4de9 100644 --- a/csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj +++ b/csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\PriorityI.cs"> <Link>PriorityI.cs</Link> </Compile> diff --git a/csharp/test/Ice/threadPoolPriority/run.py b/csharp/test/Ice/threadPoolPriority/run.py deleted file mode 100644 index bfec815018d..00000000000 --- a/csharp/test/Ice/threadPoolPriority/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, getopt - -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() diff --git a/csharp/test/Ice/timeout/AllTests.cs b/csharp/test/Ice/timeout/AllTests.cs index 58f0ee07aa5..d82a600b4e9 100644 --- a/csharp/test/Ice/timeout/AllTests.cs +++ b/csharp/test/Ice/timeout/AllTests.cs @@ -10,7 +10,7 @@ using System.Diagnostics; using System.Threading; -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Callback { @@ -45,9 +45,10 @@ public class AllTests : TestCommon.TestApp private bool _called; } - public static Test.TimeoutPrx allTests(Ice.Communicator communicator) + public static Test.TimeoutPrx allTests(TestCommon.Application app) { - string sref = "timeout:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + string sref = "timeout:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/csharp/test/Ice/timeout/Client.cs b/csharp/test/Ice/timeout/Client.cs index 4a2d31b5607..6a61ab30a10 100644 --- a/csharp/test/Ice/timeout/Client.cs +++ b/csharp/test/Ice/timeout/Client.cs @@ -16,69 +16,45 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Test.TimeoutPrx timeout = AllTests.allTests(communicator); + Test.TimeoutPrx timeout = AllTests.allTests(this); timeout.shutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - - // - // We need to send messages large enough to cause the transport - // buffers to fill up. - // - initData.properties.setProperty("Ice.MessageSizeMax", "20000"); - - // - // For this test, we want to disable retries. - // - initData.properties.setProperty("Ice.RetryIntervals", "-1"); - - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - // - // Limit the send buffer size, this test relies on the socket - // send() blocking after sending a given amount of data. - // - initData.properties.setProperty("Ice.TCP.SndSize", "50000"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + // + // We need to send messages large enough to cause the transport + // buffers to fill up. + // + initData.properties.setProperty("Ice.MessageSizeMax", "20000"); + + // + // For this test, we want to disable retries. + // + initData.properties.setProperty("Ice.RetryIntervals", "-1"); + + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + + // + // Limit the send buffer size, this test relies on the socket + // send() blocking after sending a given amount of data. + // + initData.properties.setProperty("Ice.TCP.SndSize", "50000"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/timeout/Server.cs b/csharp/test/Ice/timeout/Server.cs index 1acfd29bd16..a9ecbe38a9d 100644 --- a/csharp/test/Ice/timeout/Server.cs +++ b/csharp/test/Ice/timeout/Server.cs @@ -16,62 +16,38 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - public static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new TimeoutI(), Ice.Util.stringToIdentity("timeout")); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - // - // Limit the recv buffer size, this test relies on the socket - // send() blocking after sending a given amount of data. - // - initData.properties.setProperty("Ice.TCP.RcvSize", "50000"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + + // + // Limit the recv buffer size, this test relies on the socket + // send() blocking after sending a given amount of data. + // + initData.properties.setProperty("Ice.TCP.RcvSize", "50000"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/timeout/msbuild/server/server.csproj b/csharp/test/Ice/timeout/msbuild/server/server.csproj index c085f48929c..1f89df20e40 100644 --- a/csharp/test/Ice/timeout/msbuild/server/server.csproj +++ b/csharp/test/Ice/timeout/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/timeout/run.py b/csharp/test/Ice/timeout/run.py deleted file mode 100755 index bfec815018d..00000000000 --- a/csharp/test/Ice/timeout/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, getopt - -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() diff --git a/csharp/test/Ice/udp/AllTests.cs b/csharp/test/Ice/udp/AllTests.cs index c4cf0b1af7a..266acfc3266 100644 --- a/csharp/test/Ice/udp/AllTests.cs +++ b/csharp/test/Ice/udp/AllTests.cs @@ -64,9 +64,10 @@ public class AllTests private int _replies = 0; } - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { - communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030"); + Ice.Communicator communicator = app.communicator(); + communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter"); PingReplyI replyI = new PingReplyI(); Test.PingReplyPrx reply = @@ -75,7 +76,7 @@ public class AllTests Console.Out.Write("testing udp... "); Console.Out.Flush(); - Ice.ObjectPrx @base = communicator.stringToProxy("test:udp -p 12010").ice_datagram(); + Ice.ObjectPrx @base = communicator.stringToProxy("test:" + app.getTestEndpoint(0, "udp")).ice_datagram(); Test.TestIntfPrx obj = Test.TestIntfPrxHelper.uncheckedCast(@base); int nRetry = 5; @@ -122,7 +123,7 @@ public class AllTests // // The server's Ice.UDP.RcvSize property is set to 16384, which means that DatagramLimitException // will be throw when try to send a packet bigger than that. However, Mono 2.10 bug in setting Socket - // options could cause the RcvSize/SndSize to contain an arbitrary value so the test might fail + // options could cause the RcvSize/SndSize to contain an arbitrary value so the test might fail // with smaller message sizes. // test(seq.Length > 16384 || IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono); @@ -138,8 +139,8 @@ public class AllTests bool b = replyI.waitReply(1, 500); // // The server's Ice.UDP.RcvSize property is set to 16384, which means this packet - // should not be delivered. However, Mono 2.10 bug in setting Socket options could - // cause the RcvSize/SndSize to contain an arbitrary value so the packet might + // should not be delivered. However, Mono 2.10 bug in setting Socket options could + // cause the RcvSize/SndSize to contain an arbitrary value so the packet might // be delivered successfully. // test(!b || IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono); @@ -148,7 +149,7 @@ public class AllTests { // // Mono 2.10 bug in setting Socket options could cause the RcvSize/SndSize to contain - // an arbitrary value so the message send might fail if the effetive SndSize is minor + // an arbitrary value so the message send might fail if the effetive SndSize is minor // than expected. // test(IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono); diff --git a/csharp/test/Ice/udp/Client.cs b/csharp/test/Ice/udp/Client.cs index 00f7b56c55e..b8fecf113cf 100644 --- a/csharp/test/Ice/udp/Client.cs +++ b/csharp/test/Ice/udp/Client.cs @@ -17,11 +17,11 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); int num; try @@ -34,46 +34,23 @@ public class Client } for(int i = 0; i < num; ++i) { - TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("control:tcp -p " + (12010 + i))).shutdown(); + string endpoint = getTestEndpoint(i, "tcp"); + TestIntfPrxHelper.uncheckedCast(communicator().stringToProxy("control:" + endpoint)).shutdown(); } return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.UDP.SndSize", "16384"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.UDP.SndSize", "16384"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/udp/Server.cs b/csharp/test/Ice/udp/Server.cs index e43620fcaee..54537ecb19b 100644 --- a/csharp/test/Ice/udp/Server.cs +++ b/csharp/test/Ice/udp/Server.cs @@ -16,29 +16,29 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); - int port = 12010; + int num = 0; try { - port += args.Length == 1 ? Int32.Parse(args[0]) : 0; + num = args.Length == 1 ? Int32.Parse(args[0]) : 0; } catch(FormatException) { } - properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ControlAdapter"); + properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num, "tcp")); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter"); adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control")); adapter.activate(); - if(port == 12010) + if(num == 0) { - properties.setProperty("TestAdapter.Endpoints", "udp -p 12010"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(num, "udp")); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter"); adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test")); adapter2.activate(); } @@ -60,49 +60,25 @@ public class Server endpoint = "udp -h 239.255.1.1 -p 12020"; } properties.setProperty("McastTestAdapter.Endpoints", endpoint); - Ice.ObjectAdapter mcastAdapter = communicator.createObjectAdapter("McastTestAdapter"); + Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter"); mcastAdapter.add(new TestIntfI(), Ice.Util.stringToIdentity("test")); mcastAdapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); - - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); + return initData; + } - return status; + public static int Main(string[] args) + { + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/Ice/udp/msbuild/server/server.csproj b/csharp/test/Ice/udp/msbuild/server/server.csproj index 53a78d76bee..4bfc1113fa9 100644 --- a/csharp/test/Ice/udp/msbuild/server/server.csproj +++ b/csharp/test/Ice/udp/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/Ice/udp/run.py b/csharp/test/Ice/udp/run.py deleted file mode 100755 index e4d29398a74..00000000000 --- a/csharp/test/Ice/udp/run.py +++ /dev/null @@ -1,43 +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 - -server = os.path.join(os.getcwd(), "server") -client = os.path.join(os.getcwd(), "client") - -num = 5 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, "%d" % i, adapter="McastTestAdapter")) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, "%d" % num, startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/csharp/test/IceBox/admin/AllTests.cs b/csharp/test/IceBox/admin/AllTests.cs index fc0938892ae..1c870fd203f 100644 --- a/csharp/test/IceBox/admin/AllTests.cs +++ b/csharp/test/IceBox/admin/AllTests.cs @@ -23,8 +23,9 @@ public class AllTests } } - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); string @ref = "DemoIceBox/admin:default -p 9996 -t 10000"; Ice.ObjectPrx admin = communicator.stringToProxy(@ref); @@ -98,7 +99,7 @@ public class AllTests Console.Out.Write("testing metrics admin facet... "); Console.Out.Flush(); { - IceMX.MetricsAdminPrx ma = + IceMX.MetricsAdminPrx ma = IceMX.MetricsAdminPrxHelper.checkedCast(admin, "IceBox.Service.TestService.Metrics"); Ice.PropertiesAdminPrx pa = @@ -118,9 +119,9 @@ public class AllTests views = ma.getMetricsViewNames(out disabledViews); test(views.Length == 3); - + // Make sure that the IceBox communicator metrics admin is a separate instance. - test(IceMX.MetricsAdminPrxHelper.checkedCast(admin, + test(IceMX.MetricsAdminPrxHelper.checkedCast(admin, "Metrics").getMetricsViewNames(out disabledViews).Length == 0); } Console.Out.WriteLine("ok"); diff --git a/csharp/test/IceBox/admin/Client.cs b/csharp/test/IceBox/admin/Client.cs index 1d0a221becb..12b1c953f63 100644 --- a/csharp/test/IceBox/admin/Client.cs +++ b/csharp/test/IceBox/admin/Client.cs @@ -17,54 +17,31 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); // // Shutdown the IceBox server. // Ice.ProcessPrxHelper.uncheckedCast( - communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); + communicator().stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - Debug.Listeners.Add(new ConsoleTraceListener()); - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/IceBox/admin/config.admin b/csharp/test/IceBox/admin/config.admin new file mode 100644 index 00000000000..1baad8bea86 --- /dev/null +++ b/csharp/test/IceBox/admin/config.admin @@ -0,0 +1,4 @@ +# +# Proxy to the IceBox ServiceManager: +# +IceBoxAdmin.ServiceManager.Proxy=DemoIceBox/admin -f IceBox.ServiceManager:default -p 9996 diff --git a/csharp/test/IceBox/admin/msbuild/client/client.csproj b/csharp/test/IceBox/admin/msbuild/client/client.csproj index 206bea0d598..f407c8b22cb 100644 --- a/csharp/test/IceBox/admin/msbuild/client/client.csproj +++ b/csharp/test/IceBox/admin/msbuild/client/client.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\AllTests.cs"> <Link>AllTests.cs</Link> </Compile> diff --git a/csharp/test/IceBox/admin/run.py b/csharp/test/IceBox/admin/run.py deleted file mode 100755 index a92ce6141c2..00000000000 --- a/csharp/test/IceBox/admin/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.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"), - server=TestUtil.getIceBox()) diff --git a/csharp/test/IceBox/configuration/AllTests.cs b/csharp/test/IceBox/configuration/AllTests.cs index d8345ced05b..5d791a960ad 100644 --- a/csharp/test/IceBox/configuration/AllTests.cs +++ b/csharp/test/IceBox/configuration/AllTests.cs @@ -10,23 +10,19 @@ using System; using Test; -public class AllTests +public class AllTests : TestCommon.AllTests { - private static void - test(bool b) + public static void allTests(TestCommon.Application app) { - if(!b) - { - throw new Exception(); - } - } - - public static void allTests(Ice.Communicator communicator) - { - TestIntfPrx service1 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010")); - TestIntfPrx service2 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011")); - TestIntfPrx service3 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12012")); - TestIntfPrx service4 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12013")); + Ice.Communicator communicator = app.communicator(); + TestIntfPrx service1 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" + + app.getTestEndpoint(0))); + TestIntfPrx service2 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" + + app.getTestEndpoint(1))); + TestIntfPrx service3 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" + + app.getTestEndpoint(2))); + TestIntfPrx service4 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" + + app.getTestEndpoint(3))); if(service1.getProperty("IceBox.InheritProperties").Equals("")) { diff --git a/csharp/test/IceBox/configuration/Client.cs b/csharp/test/IceBox/configuration/Client.cs index f66be79fed2..46d84a403b2 100644 --- a/csharp/test/IceBox/configuration/Client.cs +++ b/csharp/test/IceBox/configuration/Client.cs @@ -16,52 +16,30 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this); // // Shutdown the IceBox server. // Ice.ProcessPrxHelper.uncheckedCast( - communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); + communicator().stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); return 0; } - public static int Main(string[] args) + protected override Ice.InitializationData getInitData(ref string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); + return initData; + } - return status; + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/IceBox/configuration/config.service1 b/csharp/test/IceBox/configuration/config.service1 index 6028e615ff5..3e38245a5d0 100644 --- a/csharp/test/IceBox/configuration/config.service1 +++ b/csharp/test/IceBox/configuration/config.service1 @@ -1,4 +1,4 @@ -Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1 +Service1OA.Endpoints=default -p 12010 -h 127.0.0.1 #Ice.ProgramName Service=1 diff --git a/csharp/test/IceBox/configuration/config.service1-2 b/csharp/test/IceBox/configuration/config.service1-2 index c173914db2a..835acbadfc9 100644 --- a/csharp/test/IceBox/configuration/config.service1-2 +++ b/csharp/test/IceBox/configuration/config.service1-2 @@ -1,4 +1,4 @@ -Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1 +Service1OA.Endpoints=default -p 12010 -h 127.0.0.1 #Ice.ProgramName Service1.Prop=1 diff --git a/csharp/test/IceBox/configuration/config.service2 b/csharp/test/IceBox/configuration/config.service2 index 78e08aadba6..95d33831a14 100644 --- a/csharp/test/IceBox/configuration/config.service2 +++ b/csharp/test/IceBox/configuration/config.service2 @@ -1,4 +1,4 @@ -Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1 +Service2OA.Endpoints=default -p 12011 -h 127.0.0.1 Ice.ProgramName=Test Service=2 diff --git a/csharp/test/IceBox/configuration/config.service2-2 b/csharp/test/IceBox/configuration/config.service2-2 index 36c8d0812cb..6ed8dc9df49 100644 --- a/csharp/test/IceBox/configuration/config.service2-2 +++ b/csharp/test/IceBox/configuration/config.service2-2 @@ -1,4 +1,4 @@ -Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1 +Service2OA.Endpoints=default -p 12011 -h 127.0.0.1 #Ice.ProgramName Service2.Prop=1 diff --git a/csharp/test/IceBox/configuration/config.service3 b/csharp/test/IceBox/configuration/config.service3 index c93ed144701..6cba4b351b0 100644 --- a/csharp/test/IceBox/configuration/config.service3 +++ b/csharp/test/IceBox/configuration/config.service3 @@ -1,4 +1,4 @@ -Service3OA.Endpoints=tcp -p 12012 -h 127.0.0.1 +Service3OA.Endpoints=default -p 12012 -h 127.0.0.1 #Ice.ProgramName Service=3 diff --git a/csharp/test/IceBox/configuration/config.service4 b/csharp/test/IceBox/configuration/config.service4 index 182fb3a7289..a70120dd192 100644 --- a/csharp/test/IceBox/configuration/config.service4 +++ b/csharp/test/IceBox/configuration/config.service4 @@ -1,4 +1,4 @@ -Service4OA.Endpoints=tcp -p 12013 -h 127.0.0.1 +Service4OA.Endpoints=default -p 12013 -h 127.0.0.1 #Ice.ProgramName Service=4 diff --git a/csharp/test/IceBox/configuration/msbuild/client/client.csproj b/csharp/test/IceBox/configuration/msbuild/client/client.csproj index 821ab47f501..77e552819ee 100644 --- a/csharp/test/IceBox/configuration/msbuild/client/client.csproj +++ b/csharp/test/IceBox/configuration/msbuild/client/client.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\AllTests.cs"> <Link>AllTests.cs</Link> </Compile> diff --git a/csharp/test/IceBox/configuration/run.py b/csharp/test/IceBox/configuration/run.py deleted file mode 100755 index 470c36fd810..00000000000 --- a/csharp/test/IceBox/configuration/run.py +++ /dev/null @@ -1,28 +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 - -icebox = TestUtil.getIceBox() - -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"), - server=icebox) -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox2"), - server=icebox) diff --git a/csharp/test/IceDiscovery/simple/AllTests.cs b/csharp/test/IceDiscovery/simple/AllTests.cs index 64e6836e09e..2038f9a3d47 100644 --- a/csharp/test/IceDiscovery/simple/AllTests.cs +++ b/csharp/test/IceDiscovery/simple/AllTests.cs @@ -11,19 +11,12 @@ using Test; using System; using System.Collections.Generic; -public class AllTests +public class AllTests : TestCommon.AllTests { - private static void test(bool b) - { - if(!b) - { - throw new Exception(); - } - } - public static void - allTests(Ice.Communicator communicator, int num) + allTests(TestCommon.Application app, int num) { + Ice.Communicator communicator = app.communicator(); List<ControllerPrx> proxies = new List<ControllerPrx>(); List<ControllerPrx> indirectProxies = new List<ControllerPrx>(); for(int i = 0; i < num; ++i) @@ -33,28 +26,28 @@ public class AllTests indirectProxies.Add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id + "@control" + i))); } - Console.Out.Write("testing indirect proxies... "); - Console.Out.Flush(); + Write("testing indirect proxies... "); + Flush(); { foreach(ControllerPrx prx in indirectProxies) { prx.ice_ping(); } } - Console.Out.WriteLine("ok"); + WriteLine("ok"); - Console.Out.Write("testing well-known proxies... "); - Console.Out.Flush(); + Write("testing well-known proxies... "); + Flush(); { foreach(ControllerPrx prx in proxies) { prx.ice_ping(); } } - Console.Out.WriteLine("ok"); + WriteLine("ok"); - Console.Out.Write("testing object adapter registration... "); - Console.Out.Flush(); + Write("testing object adapter registration... "); + Flush(); { try { @@ -84,10 +77,10 @@ public class AllTests { } } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing object adapter migration..."); - Console.Out.Flush(); + WriteLine("ok"); + + Write("testing object adapter migration..."); + Flush(); { proxies[0].activateObjectAdapter("oa", "oa1", ""); proxies[0].addObject("oa", "object"); @@ -101,10 +94,10 @@ public class AllTests proxies[1].removeObject("oa", "object"); proxies[1].deactivateObjectAdapter("oa"); } - Console.Out.WriteLine("ok"); + WriteLine("ok"); - Console.Out.Write("testing object migration..."); - Console.Out.Flush(); + Write("testing object migration..."); + Flush(); { proxies[0].activateObjectAdapter("oa", "oa1", ""); proxies[1].activateObjectAdapter("oa", "oa2", ""); @@ -137,10 +130,10 @@ public class AllTests proxies[0].deactivateObjectAdapter("oa"); proxies[1].deactivateObjectAdapter("oa"); } - Console.Out.WriteLine("ok"); + WriteLine("ok"); - Console.Out.Write("testing replica groups..."); - Console.Out.Flush(); + Write("testing replica groups..."); + Flush(); { proxies[0].activateObjectAdapter("oa", "oa1", "rg"); proxies[1].activateObjectAdapter("oa", "oa2", "rg"); @@ -200,14 +193,14 @@ public class AllTests communicator.stringToProxy("object @ rg")).getAdapterId().Equals("oa1")); proxies[0].deactivateObjectAdapter("oa"); } - Console.Out.WriteLine("ok"); + WriteLine("ok"); - Console.Out.Write("shutting down... "); - Console.Out.Flush(); + Write("shutting down... "); + Flush(); foreach(ControllerPrx prx in proxies) { prx.shutdown(); } - Console.Out.WriteLine("ok"); + WriteLine("ok"); } } diff --git a/csharp/test/IceDiscovery/simple/Client.cs b/csharp/test/IceDiscovery/simple/Client.cs index 36e5224e7fc..2606c7ffb65 100644 --- a/csharp/test/IceDiscovery/simple/Client.cs +++ b/csharp/test/IceDiscovery/simple/Client.cs @@ -16,12 +16,12 @@ using System.Reflection; [assembly: AssemblyDescription("IceDiscovery test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { int num; - try + try { num = args.Length == 1 ? Int32.Parse(args[0]) : 0; } @@ -29,39 +29,13 @@ public class Client { num = 0; } - AllTests.allTests(communicator, num); + AllTests.allTests(this, num); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/IceDiscovery/simple/Server.cs b/csharp/test/IceDiscovery/simple/Server.cs index 4f423af28e8..140e70a970b 100644 --- a/csharp/test/IceDiscovery/simple/Server.cs +++ b/csharp/test/IceDiscovery/simple/Server.cs @@ -16,11 +16,11 @@ using System.Reflection; [assembly: AssemblyDescription("IceDiscovery test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); int num = 0; try @@ -31,47 +31,21 @@ public class Server { } - properties.setProperty("ControlAdapter.Endpoints", "default -p " + (12010 + num)); + properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num)); properties.setProperty("ControlAdapter.AdapterId", "control" + num); properties.setProperty("ControlAdapter.ThreadPool.Size", "1"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ControlAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter"); adapter.add(new ControllerI(), Ice.Util.stringToIdentity("controller" + num)); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/IceDiscovery/simple/msbuild/client/client.csproj b/csharp/test/IceDiscovery/simple/msbuild/client/client.csproj index 1448936c5a2..04b38871502 100644 --- a/csharp/test/IceDiscovery/simple/msbuild/client/client.csproj +++ b/csharp/test/IceDiscovery/simple/msbuild/client/client.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\AllTests.cs"> <Link>AllTests.cs</Link> </Compile> diff --git a/csharp/test/IceDiscovery/simple/msbuild/server/server.csproj b/csharp/test/IceDiscovery/simple/msbuild/server/server.csproj index 5f1c3b2e769..12d254b1f75 100644 --- a/csharp/test/IceDiscovery/simple/msbuild/server/server.csproj +++ b/csharp/test/IceDiscovery/simple/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/IceDiscovery/simple/run.py b/csharp/test/IceDiscovery/simple/run.py deleted file mode 100755 index f9f3eb51536..00000000000 --- a/csharp/test/IceDiscovery/simple/run.py +++ /dev/null @@ -1,54 +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 - -server = os.path.join(os.getcwd(), "server") -client = os.path.join(os.getcwd(), "client") - -num = 3 - -args = " --Ice.Plugin.IceDiscovery=IceDiscovery:IceDiscovery.PluginFactory" -args += " --IceDiscovery.Timeout=50" -args += " --IceDiscovery.RetryCount=5" - -if TestUtil.isDarwin() and TestUtil.ipv6: - print("test not supported on OS X with IPv6") - sys.exit(0) - -if not TestUtil.ipv6: - args += " --IceDiscovery.Interface=127.0.0.1" - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, "%d %s" % (i, args), count = 4)) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, "%d %s" % (num, args), startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/csharp/test/IceGrid/simple/AllTests.cs b/csharp/test/IceGrid/simple/AllTests.cs index f1c781d6b7d..ba40dcf9f15 100644 --- a/csharp/test/IceGrid/simple/AllTests.cs +++ b/csharp/test/IceGrid/simple/AllTests.cs @@ -10,19 +10,11 @@ using System; using Test; -public class AllTests +public class AllTests : TestCommon.AllTests { - private static void - test(bool b) - { - if(!b) - { - throw new Exception(); - } - } - - public static void allTests(Ice.Communicator communicator) + public static void allTests(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Console.Out.Write("testing stringToProxy... "); Console.Out.Flush(); String rf = "test @ TestAdapter"; @@ -62,7 +54,7 @@ public class AllTests IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast( communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry")); test(registry != null); - + try { IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar"); @@ -81,16 +73,17 @@ public class AllTests Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties().ice_clone_(); initData.properties.setProperty("Ice.Default.Locator", ""); - initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", + initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory"); - if(IceInternal.AssemblyUtil.osx_ && + if(IceInternal.AssemblyUtil.osx_ && initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0) { initData.properties.setProperty("IceLocatorDiscovery.Interface", "::1"); } + initData.properties.setProperty("IceLocatorDiscovery.Port", app.getTestPort(99).ToString()); initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter"); initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default"); - + Ice.Communicator com = Ice.Util.initialize(initData); test(com.getDefaultLocator() != null); com.stringToProxy("test @ TestAdapter").ice_ping(); @@ -108,7 +101,7 @@ public class AllTests // // Now, ensure that the IceGrid discovery locator correctly // handles failure to find a locator. - // + // initData.properties.setProperty("IceLocatorDiscovery.InstanceName", "unknown"); initData.properties.setProperty("IceLocatorDiscovery.RetryCount", "1"); initData.properties.setProperty("IceLocatorDiscovery.Timeout", "100"); @@ -153,8 +146,9 @@ public class AllTests } public static void - allTestsWithDeploy(Ice.Communicator communicator) + allTestsWithDeploy(TestCommon.Application app) { + Ice.Communicator communicator = app.communicator(); Console.Out.Write("testing stringToProxy... "); Console.Out.Flush(); Ice.ObjectPrx @base = communicator.stringToProxy("test @ TestAdapter"); diff --git a/csharp/test/IceGrid/simple/Client.cs b/csharp/test/IceGrid/simple/Client.cs index 21eca6fe720..2fd1dab9105 100644 --- a/csharp/test/IceGrid/simple/Client.cs +++ b/csharp/test/IceGrid/simple/Client.cs @@ -16,9 +16,9 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { bool withDeploy = false; for(int i = 0; i < args.Length; i++) @@ -32,11 +32,11 @@ public class Client if(!withDeploy) { - AllTests.allTests(communicator); + AllTests.allTests(this); } else { - AllTests.allTestsWithDeploy(communicator); + AllTests.allTestsWithDeploy(this); } return 0; @@ -44,33 +44,7 @@ public class Client public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch (Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if (communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/IceGrid/simple/simple_server.xml b/csharp/test/IceGrid/simple/application.xml index 8029cabe95f..8029cabe95f 100644 --- a/csharp/test/IceGrid/simple/simple_server.xml +++ b/csharp/test/IceGrid/simple/application.xml diff --git a/csharp/test/IceGrid/simple/msbuild/client/client.csproj b/csharp/test/IceGrid/simple/msbuild/client/client.csproj index 74aed1eea64..2488c9ffb96 100644 --- a/csharp/test/IceGrid/simple/msbuild/client/client.csproj +++ b/csharp/test/IceGrid/simple/msbuild/client/client.csproj @@ -44,6 +44,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\AllTests.cs"> <Link>AllTests.cs</Link> </Compile> diff --git a/csharp/test/IceGrid/simple/msbuild/server/server.csproj b/csharp/test/IceGrid/simple/msbuild/server/server.csproj index 3c663d9995e..26f99c778d0 100644 --- a/csharp/test/IceGrid/simple/msbuild/server/server.csproj +++ b/csharp/test/IceGrid/simple/msbuild/server/server.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/IceGrid/simple/run.py b/csharp/test/IceGrid/simple/run.py deleted file mode 100755 index b7c2ffa799f..00000000000 --- a/csharp/test/IceGrid/simple/run.py +++ /dev/null @@ -1,37 +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, getopt - -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 - -# -# Test client/server without on demand activation. -# -IceGridAdmin.iceGridClientServerTest("", "--TestAdapter.Endpoints=default --TestAdapter.AdapterId=TestAdapter") - -# -# Test client/server with on demand activation. -# -if TestUtil.mono: - IceGridAdmin.iceGridTest("simple_mono_server.xml", "--with-deploy") -else: - IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy") diff --git a/csharp/test/IceGrid/simple/simple_mono_server.xml b/csharp/test/IceGrid/simple/simple_mono_server.xml deleted file mode 100644 index 2dbea99b9a1..00000000000 --- a/csharp/test/IceGrid/simple/simple_mono_server.xml +++ /dev/null @@ -1,22 +0,0 @@ -<icegrid> - <application name="Test"> - <node name="localnode"> - <server id="server" exe="mono" pwd="." activation="on-demand"> - <option>--debug</option> - <option>${test.dir}/server.exe</option> - <adapter name="TestAdapter" id="TestAdapter" endpoints="default"> - <object identity="test" type="Test"/> - </adapter> - </server> - - <server id="server10" exe="mono" pwd="." activation="on-demand"> - <option>--debug</option> - <option>${test.dir}/server.exe</option> - <adapter name="TestAdapter" endpoints="default" id="TestAdapter10"> - <object identity="test10" type="Test" property="Identity"/> - </adapter> - <property name="Ice.Default.EncodingVersion" value="1.0"/> - </server> - </node> - </application> -</icegrid> diff --git a/csharp/test/IceSSL/configuration/AllTests.cs b/csharp/test/IceSSL/configuration/AllTests.cs index f9b3522a211..17356526a63 100644 --- a/csharp/test/IceSSL/configuration/AllTests.cs +++ b/csharp/test/IceSSL/configuration/AllTests.cs @@ -103,9 +103,10 @@ public class AllTests return initData; } - public static Test.ServerFactoryPrx allTests(Ice.Communicator communicator, string testDir) + public static Test.ServerFactoryPrx allTests(TestCommon.Application app, string testDir) { - string factoryRef = "factory:tcp -p 12010"; + Ice.Communicator communicator = app.communicator(); + string factoryRef = "factory:" + app.getTestEndpoint(0); Ice.ObjectPrx b = communicator.stringToProxy(factoryRef); test(b != null); Test.ServerFactoryPrx factory = Test.ServerFactoryPrxHelper.checkedCast(b); diff --git a/csharp/test/IceSSL/configuration/Client.cs b/csharp/test/IceSSL/configuration/Client.cs index 6154fd3dc5d..3d64e6c7b1b 100644 --- a/csharp/test/IceSSL/configuration/Client.cs +++ b/csharp/test/IceSSL/configuration/Client.cs @@ -16,9 +16,9 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Client +public class Client : TestCommon.Application { - private static int run(String[] args, Ice.Communicator communicator) + public override int run(string[] args) { if(args.Length < 1) { @@ -27,41 +27,15 @@ public class Client } Test.ServerFactoryPrx factory; - factory = AllTests.allTests(communicator, args[0]); + factory = AllTests.allTests(this, args[0]); factory.shutdown(); - + return 0; } - + public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/IceSSL/configuration/Server.cs b/csharp/test/IceSSL/configuration/Server.cs index 636c41a8188..908a2aa5b12 100644 --- a/csharp/test/IceSSL/configuration/Server.cs +++ b/csharp/test/IceSSL/configuration/Server.cs @@ -16,49 +16,23 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Server +public class Server : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Identity id = Ice.Util.stringToIdentity("factory"); adapter.add(new ServerFactoryI(), id); adapter.activate(); - communicator.waitForShutdown(); + communicator().waitForShutdown(); return 0; } - + public static int Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Exception ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - - return status; + Server app = new Server(); + return app.runmain(args); } } diff --git a/csharp/test/IceSSL/configuration/msbuild/client/client.csproj b/csharp/test/IceSSL/configuration/msbuild/client/client.csproj index bfbf2e8ead2..3c3f882b2d1 100644 --- a/csharp/test/IceSSL/configuration/msbuild/client/client.csproj +++ b/csharp/test/IceSSL/configuration/msbuild/client/client.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\AllTests.cs"> <Link>AllTests.cs</Link> </Compile> diff --git a/csharp/test/IceSSL/configuration/msbuild/server/server.csproj b/csharp/test/IceSSL/configuration/msbuild/server/server.csproj index f7dad3bce7b..626838dac24 100644 --- a/csharp/test/IceSSL/configuration/msbuild/server/server.csproj +++ b/csharp/test/IceSSL/configuration/msbuild/server/server.csproj @@ -39,6 +39,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Server.cs"> <Link>Server.cs</Link> </Compile> diff --git a/csharp/test/IceSSL/configuration/run.py b/csharp/test/IceSSL/configuration/run.py deleted file mode 100755 index ad1e1601ec1..00000000000 --- a/csharp/test/IceSSL/configuration/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, getopt, re - -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 - -# Filter-out the deprecated property warnings -TestUtil.clientTraceFilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.FindCert.*\n", "", x) ] -TestUtil.serverTraceFilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.FindCert.*\n", "", x) ] -# -# The drive letter needs to be removed on Windows or loading the SSL -# plug-in will not work. -# -TestUtil.clientServerTest(additionalClientOptions = '"%s"' % os.path.splitdrive(os.getcwd())[1]) diff --git a/csharp/test/IceUtil/inputUtil/Client.cs b/csharp/test/IceUtil/inputUtil/Client.cs index eda4b88b917..b3439a20736 100644 --- a/csharp/test/IceUtil/inputUtil/Client.cs +++ b/csharp/test/IceUtil/inputUtil/Client.cs @@ -9,17 +9,9 @@ using System; -public class Client +public class Client : TestCommon.Application { - private static void test(bool b) - { - if (!b) - { - throw new Exception(); - } - } - - public static void Main(string[] argvs) + public override int run(string[] argvs) { Console.Out.Write("testing string to command line arguments... "); Console.Out.Flush(); @@ -28,7 +20,7 @@ public class Client try { test(IceUtilInternal.Options.split("").Length == 0); - + args = IceUtilInternal.Options.split("\"\""); test(args.Length == 1 && args[0].Equals("")); args = IceUtilInternal.Options.split("''"); @@ -128,7 +120,7 @@ public class Client test(arr.Length == 2 && arr[0].Equals("a") && arr[1].Equals("b")); arr = IceUtilInternal.StringUtil.splitString(":a:b:", ":"); test(arr.Length == 2 && arr[0].Equals("a") && arr[1].Equals("b")); - + arr = IceUtilInternal.StringUtil.splitString("\"a\"", ":"); test(arr.Length == 1 && arr[0].Equals("a")); arr = IceUtilInternal.StringUtil.splitString("\"a\":b", ":"); @@ -146,7 +138,7 @@ public class Client test(arr.Length == 1 && arr[0].Equals("\"a")); arr = IceUtilInternal.StringUtil.splitString("\"'a\"", ":"); test(arr.Length == 1 && arr[0].Equals("'a")); - + arr = IceUtilInternal.StringUtil.splitString("a\\'b", ":"); test(arr.Length == 1 && arr[0].Equals("a'b")); arr = IceUtilInternal.StringUtil.splitString("'a:b\\'c'", ":"); @@ -163,5 +155,12 @@ public class Client test(IceUtilInternal.StringUtil.splitString("a\"b", ":") == null); } Console.Out.WriteLine("ok"); + return 0; + } + + public static int Main(string[] args) + { + Client app = new Client(); + return app.runmain(args); } } diff --git a/csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj b/csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj index 44707cd68d2..1f17bf97bca 100644 --- a/csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj +++ b/csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj @@ -34,6 +34,9 @@ <Folder Include="Properties\" /> </ItemGroup> <ItemGroup> + <Compile Include="..\..\..\..\TestCommon\TestApp.cs"> + <Link>TestApp.cs</Link> + </Compile> <Compile Include="..\..\Client.cs"> <Link>Client.cs</Link> </Compile> diff --git a/csharp/test/IceUtil/inputUtil/run.py b/csharp/test/IceUtil/inputUtil/run.py deleted file mode 100755 index 7dca8ec8ecc..00000000000 --- a/csharp/test/IceUtil/inputUtil/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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, "", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/csharp/test/Slice/keyword/Client.cs b/csharp/test/Slice/keyword/Client.cs index 79cef005fb7..6c0d00d12c1 100644 --- a/csharp/test/Slice/keyword/Client.cs +++ b/csharp/test/Slice/keyword/Client.cs @@ -144,7 +144,7 @@ public class Client private static int run(string[] args, Ice.Communicator communicator) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new decimalI(), Ice.Util.stringToIdentity("test")); adapter.add(new Test1I(), Ice.Util.stringToIdentity("test1")); diff --git a/csharp/test/Slice/keyword/run.py b/csharp/test/Slice/keyword/run.py deleted file mode 100755 index f1d296052a4..00000000000 --- a/csharp/test/Slice/keyword/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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/csharp/test/Slice/macros/run.py b/csharp/test/Slice/macros/run.py deleted file mode 100755 index f1d296052a4..00000000000 --- a/csharp/test/Slice/macros/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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/csharp/test/Slice/structure/run.py b/csharp/test/Slice/structure/run.py deleted file mode 100755 index f1d296052a4..00000000000 --- a/csharp/test/Slice/structure/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, getopt - -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 - -client = os.path.join(os.getcwd(), "client") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/csharp/test/TestCommon/TestApp.cs b/csharp/test/TestCommon/TestApp.cs index cf4b394db6e..330223ca25d 100644 --- a/csharp/test/TestCommon/TestApp.cs +++ b/csharp/test/TestCommon/TestApp.cs @@ -12,8 +12,185 @@ using System.Diagnostics; namespace TestCommon { - public abstract class TestApp + public abstract class Application { + public + Application() + { + } + + // + // This runmain() must be called by the global main(). runmain() + // initializes the Communicator, calls run(), and destroys + // the Communicator upon return from run(). It thereby handles + // all exceptions properly, i.e., error messages are printed + // if exceptions propagate to main(), and the Communicator is + // always destroyed, regardless of exceptions. + // + public int runmain(string[] args) + { + Ice.InitializationData initData = getInitData(ref args); + return runmain(args, initData); + } + + public int runmain(string[] args, Ice.InitializationData initializationData) + { + _testName = AppDomain.CurrentDomain.FriendlyName; + + if(_communicator != null) + { + Console.Out.WriteLine(_testName + ": only one instance of the Application class can be used"); + return 1; + } + + // + // We parse the properties here to extract Ice.ProgramName. + // + if(initializationData == null) + { + initializationData = getInitData(ref args); + } + + Ice.InitializationData initData; + if(initializationData != null) + { + initData = (Ice.InitializationData)initializationData.Clone(); + } + else + { + initData = new Ice.InitializationData(); + } + initData.properties = Ice.Util.createProperties(ref args, initData.properties); + + // + // If the process logger is the default logger, we replace it with a + // a logger that uses the program name as the prefix. + // + if(Ice.Util.getProcessLogger() is Ice.LoggerI) + { + Ice.Util.setProcessLogger(new Ice.ConsoleLoggerI(initData.properties.getProperty("Ice.ProgramName"))); + } + + int status = 0; + try + { + _communicator = Ice.Util.initialize(ref args, initData); + status = run(args); + } + catch(Exception ex) + { + Console.Out.WriteLine(_testName + ": " + ex); + status = 1; + } + + if(_communicator != null) + { + try + { + _communicator.destroy(); + } + catch(Exception ex) + { + Console.Out.WriteLine(_testName + ": " + ex); + status = 1; + } + _communicator = null; + } + return status; + } + + public void stop() + { + if(_communicator != null) + { + _communicator.shutdown(); + } + } + + public abstract int run(string[] args); + + // + // Hook to override the initialization data. This hook is + // necessary because some properties must be set prior to + // communicator initialization. + // + protected virtual Ice.InitializationData getInitData(ref string[] args) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); + args = initData.properties.parseCommandLineOptions("Test", args); + return initData; + } + + // + // Return the application name, i.e., argv[0]. + // + public string appName() + { + return _testName; + } + + public Ice.Communicator communicator() + { + return _communicator; + } + + public string getTestEndpoint(int num) + { + return getTestEndpoint(num, ""); + } + + public string getTestEndpoint(int num, string prot) + { + return getTestEndpoint(_communicator.getProperties(), num, prot); + } + + static public string getTestEndpoint(Ice.Properties properties, int num) + { + return getTestEndpoint(properties, num, ""); + } + + static public string getTestEndpoint(Ice.Properties properties, int num, string prot) + { + string protocol = prot; + if(protocol == "") + { + protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "default"); + } + int basePort = properties.getPropertyAsIntWithDefault("Test.BasePort", 12010); + return protocol + " -p " + (basePort + num); + } + + public string getTestHost() + { + return getTestHost(_communicator.getProperties()); + } + + static public string getTestHost(Ice.Properties properties) + { + return properties.getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); + } + + public string getTestProtocol() + { + return getTestProtocol(_communicator.getProperties()); + } + + static public string getTestProtocol(Ice.Properties properties) + { + return properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + } + + public int getTestPort(int num) + { + return getTestPort(_communicator.getProperties(), num); + } + + static public int getTestPort(Ice.Properties properties, int num) + { + return properties.getPropertyAsIntWithDefault("Test.BasePort", 12010) + num; + } + protected static void test(bool b) { if(!b) @@ -23,6 +200,20 @@ namespace TestCommon } } + private string _testName; + private Ice.Communicator _communicator; + } + + public abstract class AllTests + { + protected static void test(bool b) + { + if(!b) + { + Debug.Assert(false); + throw new Exception(); + } + } public static void Write(string msg) { @@ -35,7 +226,7 @@ namespace TestCommon } public static void Flush() - { + { Console.Out.Flush(); } } diff --git a/java-compat/allTests.py b/java-compat/allTests.py index 7ca52f7db4c..e4360c465d3 100755 --- a/java-compat/allTests.py +++ b/java-compat/allTests.py @@ -8,79 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("Slice/generation", ["once"]), - ("Slice/keyword", ["once"]), - ("Slice/macros", ["once"]), - ("Slice/structure", ["once"]), - ("IceUtil/inputUtil", ["once"]), - ("Ice/proxy", ["core"]), - ("Ice/operations", ["core"]), - ("Ice/seqMapping", ["core"]), - ("Ice/exceptions", ["core"]), - ("Ice/ami", ["core", "nocompress"]), - ("Ice/info", ["core", "noipv6", "nocompress", "nosocks"]), - ("Ice/inheritance", ["core"]), - ("Ice/facets", ["core"]), - ("Ice/objects", ["core"]), - ("Ice/binding", ["core"]), - ("Ice/faultTolerance", ["core"]), - ("Ice/location", ["core"]), - ("Ice/adapterDeactivation", ["core"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/custom", ["core"]), - ("Ice/checksum", ["core"]), - ("Ice/dispatcher", ["core"]), - ("Ice/interrupt", ["core", "nocompress"]), - ("Ice/packagemd", ["core"]), - ("Ice/stream", ["core"]), - ("Ice/hold", ["core"]), - ("Ice/retry", ["core"]), - ("Ice/timeout", ["core", "nocompress"]), - ("Ice/acm", ["core"]), - ("Ice/background", ["core", "nosocks"]), - ("Ice/servantLocator", ["core"]), - ("Ice/interceptor", ["core"]), - ("Ice/udp", ["core"]), - ("Ice/serialize", ["core"]), - ("Ice/defaultServant", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/threadPoolPriority", ["core"]), - ("Ice/classLoader", ["core"]), - ("Ice/invoke", ["core"]), - ("Ice/properties", ["once"]), - ("Ice/plugin", ["core"]), - ("Ice/hash", ["once"]), - ("Ice/optional", ["once"]), - ("Ice/admin", ["core"]), - ("Ice/metrics", ["core", "nows", "noipv6", "nocompress", "nosocks"]), - ("Ice/enums", ["once"]), - ("Ice/networkProxy", ["core", "noipv6", "nosocks"]), - ("IceBox/admin", ["core", "noipv6", "nomx"]), - ("IceBox/configuration", ["core", "noipv6", "nomx"]), - ("Glacier2/router", ["service"]), - ("Glacier2/sessionHelper", ["core"]), - ("IceDiscovery/simple", ["service"]), - ("IceGrid/simple", ["service"]), - ("IceSSL/configuration", ["once"]) - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java b/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java index 89cc00f4a3a..d3b88ed87a2 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java @@ -31,7 +31,7 @@ class EndpointHostResolver } } - synchronized void resolve(final String host, final int port, final Ice.EndpointSelectionType selType, + synchronized void resolve(final String host, final int port, final Ice.EndpointSelectionType selType, final IPEndpointI endpoint, final EndpointI_connectors callback) { // @@ -45,8 +45,8 @@ class EndpointHostResolver NetworkProxy networkProxy = _instance.networkProxy(); if(networkProxy == null) { - java.util.List<java.net.InetSocketAddress> addrs = Network.getAddresses(host, port, _protocol, selType, - _preferIPv6, false); + java.util.List<java.net.InetSocketAddress> addrs = + Network.getAddresses(host, port, _protocol, selType, _preferIPv6, false); if(addrs != null) { callback.connectors(endpoint.connectors(addrs, networkProxy)); @@ -87,6 +87,7 @@ class EndpointHostResolver Ice.Instrumentation.ThreadState.ThreadStateInUseForOther); } + Ice.Instrumentation.Observer obsv = observer; try { int protocol = _protocol; @@ -100,19 +101,22 @@ class EndpointHostResolver } } - callback.connectors(endpoint.connectors(Network.getAddresses(host, - port, - protocol, - selType, - _preferIPv6, - true), - networkProxy)); + java.util.List<java.net.InetSocketAddress> addresses = + Network.getAddresses(host, port, protocol, selType, _preferIPv6, true); + if(obsv != null) + { + obsv.detach(); + obsv = null; + } + + callback.connectors(endpoint.connectors(addresses, networkProxy)); } catch(Ice.LocalException ex) { - if(observer != null) + if(obsv != null) { - observer.failed(ex.ice_id()); + obsv.failed(ex.ice_id()); + obsv.detach(); } callback.exception(ex); } @@ -123,10 +127,6 @@ class EndpointHostResolver threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, Ice.Instrumentation.ThreadState.ThreadStateIdle); } - if(observer != null) - { - observer.detach(); - } } } }); diff --git a/java-compat/test/src/main/java/test/Glacier2/router/Client.java b/java-compat/test/src/main/java/test/Glacier2/router/Client.java index 5bec46a2cec..8694bb32899 100644 --- a/java-compat/test/src/main/java/test/Glacier2/router/Client.java +++ b/java-compat/test/src/main/java/test/Glacier2/router/Client.java @@ -38,10 +38,10 @@ public class Client extends test.Util.Application { out.print("testing stringToProxy for router... "); out.flush(); - routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347"); + routerBase = communicator().stringToProxy("Glacier2/router:" + getTestEndpoint(10)); out.println("ok"); } - + Glacier2.RouterPrx router; { @@ -56,7 +56,7 @@ public class Client extends test.Util.Application out.print("testing router finder... "); out.flush(); Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast( - communicator().stringToProxy("Ice/RouterFinder:default -p 12347")); + communicator().stringToProxy("Ice/RouterFinder:" + getTestEndpoint(10))); test(finder.getRouter().ice_getIdentity().equals(router.ice_getIdentity())); out.println("ok"); } @@ -81,10 +81,10 @@ public class Client extends test.Util.Application { out.print("testing stringToProxy for server object... "); out.flush(); - base = communicator().stringToProxy("c1/callback:tcp -p 12010"); + base = communicator().stringToProxy("c1/callback:" + getTestEndpoint(0)); out.println("ok"); } - + { out.print("trying to ping server before session creation... "); out.flush(); @@ -224,7 +224,7 @@ public class Client extends test.Util.Application Ice.Object callbackReceiver; CallbackReceiverPrx twowayR; CallbackReceiverPrx fakeTwowayR; - + { out.print("creating and adding callback receiver object... "); out.flush(); @@ -241,7 +241,7 @@ public class Client extends test.Util.Application adapter.add(callbackReceiver, fakeCallbackReceiverIdent)); out.println("ok"); } - + { out.print("testing oneway callback... "); out.flush(); @@ -310,7 +310,7 @@ public class Client extends test.Util.Application callbackReceiverImpl.callbackOK(); out.println("ok"); } - + { out.print("testing whether disallowed category gets rejected... "); out.flush(); @@ -328,7 +328,7 @@ public class Client extends test.Util.Application out.println("ok"); } } - + { out.print("testing whether user-id as category is accepted... "); out.flush(); @@ -340,7 +340,8 @@ public class Client extends test.Util.Application callbackReceiverImpl.callbackOK(); out.println("ok"); } - + + if(args.length >= 1 && args[0].equals("--shutdown")) { out.print("testing server shutdown... "); out.flush(); @@ -362,7 +363,7 @@ public class Client extends test.Util.Application } */ } - + { out.print("destroying session... "); out.flush(); @@ -380,7 +381,7 @@ public class Client extends test.Util.Application } out.println("ok"); } - + { out.print("trying to ping server after session destruction... "); out.flush(); @@ -410,7 +411,7 @@ public class Client extends test.Util.Application } } } - + if(args.length >= 1 && args[0].equals("--shutdown")) { { @@ -419,15 +420,15 @@ public class Client extends test.Util.Application communicator().setDefaultRouter(null); out.println("ok"); } - + Ice.ObjectPrx processBase; - + { out.print("testing stringToProxy for process object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp")); out.println("ok"); } - + /* { out.print("uninstalling router with process object... "); @@ -435,16 +436,16 @@ public class Client extends test.Util.Application out.println("ok"); } */ - + Ice.ProcessPrx process; - + { out.print("testing checked cast for admin object... "); process = Ice.ProcessPrxHelper.checkedCast(processBase); test(process != null); out.println("ok"); } - + out.print("testing Glacier2 shutdown... "); process.shutdown(); try @@ -457,14 +458,13 @@ public class Client extends test.Util.Application out.println("ok"); } } - + return 0; } - + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router"); @@ -477,7 +477,7 @@ public class Client extends test.Util.Application { Client c = new Client(); int status = c.main("Client", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/Glacier2/router/Server.java b/java-compat/test/src/main/java/test/Glacier2/router/Server.java index 562b8647b4e..1297bff6c22 100644 --- a/java-compat/test/src/main/java/test/Glacier2/router/Server.java +++ b/java-compat/test/src/main/java/test/Glacier2/router/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application public int run(String[] args) { - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010"); + communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); adapter.add(new CallbackI(), Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category. @@ -28,12 +28,11 @@ public class Server extends test.Util.Application communicator().waitForShutdown(); return 0; } - - + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router"); return initData; @@ -44,7 +43,7 @@ public class Server extends test.Util.Application { Server c = new Server(); int status = c.main("Server", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/Glacier2/router/run.py b/java-compat/test/src/main/java/test/Glacier2/router/run.py deleted file mode 100755 index dc815f8eed0..00000000000 --- a/java-compat/test/src/main/java/test/Glacier2/router/run.py +++ /dev/null @@ -1,53 +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 - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - ' --Glacier2.Filter.Category.AcceptUser="2"' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest() - -TestUtil.clientServerTest(additionalClientOptions=" --shutdown") - -starterProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java index 94325f9a9c7..91466d7fc21 100644 --- a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java +++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java @@ -34,9 +34,9 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - _initData = createInitializationData(); - _initData.properties = Ice.Util.createProperties(argsH); - _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347"); + _initData = super.getInitData(argsH); + _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:" + + getTestEndpoint(_initData.properties, 10)); _initData.dispatcher = new Ice.Dispatcher() { @Override @@ -53,8 +53,8 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - String protocol = communicator().getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - String host = communicator().getProperties().getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); + String protocol = getTestProtocol(); + String host = getTestHost(); _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback() { @@ -178,7 +178,7 @@ public class Client extends test.Util.Application out.print("testing SessionHelper connect interrupt... "); out.flush(); _factory.setRouterHost(host); - _factory.setPort(12011); + _factory.setPort(getTestPort(1)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); @@ -253,7 +253,7 @@ public class Client extends test.Util.Application out.print("testing SessionHelper connect... "); out.flush(); _factory.setRouterHost(host); - _factory.setPort(12347); + _factory.setPort(getTestPort(10)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); while(true) @@ -296,7 +296,7 @@ public class Client extends test.Util.Application out.print("testing stringToProxy for server object... "); out.flush(); - Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:default -p 12010"); + Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:" + getTestEndpoint(0)); out.println("ok"); out.print("pinging server after session creation... "); @@ -381,7 +381,7 @@ public class Client extends test.Util.Application Ice.ObjectPrx processBase; { out.print("testing stringToProxy for process object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:default -h \"" + host + "\" -p 12348"); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp")); out.println("ok"); } @@ -475,7 +475,7 @@ public class Client extends test.Util.Application out.flush(); _factory.setRouterHost(host); - _factory.setPort(12347); + _factory.setPort(getTestPort(10)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); while(true) diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java index 5e2108c78e0..ceff7b94dbf 100644 --- a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java +++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java @@ -14,10 +14,10 @@ public class Server extends test.Util.Application public int run(String[] args) { - communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", "default -p 12011"); + communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", getTestEndpoint(1)); communicator().createObjectAdapter("DeactivatedAdapter"); - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "default -p 12010"); + communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback")); adapter.activate(); @@ -28,8 +28,7 @@ public class Server extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router"); return initData; diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py deleted file mode 100755 index 6ce3382b360..00000000000 --- a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py +++ /dev/null @@ -1,49 +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 - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="default"' \ - ' --Ice.Admin.Endpoints="default -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest(additionalClientOptions=" --shutdown") - -starterProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/acm/AllTests.java b/java-compat/test/src/main/java/test/Ice/acm/AllTests.java index c68ba2166f5..a4369b684b8 100644 --- a/java-compat/test/src/main/java/test/Ice/acm/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/acm/AllTests.java @@ -612,10 +612,12 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); - String ref = "communicator:default -p 12010"; + PrintWriter out = app.getWriter(); + + String ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref)); java.util.List<TestCase> tests = new java.util.ArrayList<TestCase>(); diff --git a/java-compat/test/src/main/java/test/Ice/acm/Client.java b/java-compat/test/src/main/java/test/Ice/acm/Client.java index 0b77fa4ff82..7c2918d4b2a 100644 --- a/java-compat/test/src/main/java/test/Ice/acm/Client.java +++ b/java-compat/test/src/main/java/test/Ice/acm/Client.java @@ -13,14 +13,13 @@ public class Client extends test.Util.Application { public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm"); initData.properties.setProperty("Ice.Warn.Connections", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/acm/Server.java b/java-compat/test/src/main/java/test/Ice/acm/Server.java index 8df16e0f21a..f427f7cc5e8 100644 --- a/java-compat/test/src/main/java/test/Ice/acm/Server.java +++ b/java-compat/test/src/main/java/test/Ice/acm/Server.java @@ -28,10 +28,9 @@ public class Server extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.ACM.Timeout", "1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/acm/run.py b/java-compat/test/src/main/java/test/Ice/acm/run.py deleted file mode 100755 index 0b375fb252f..00000000000 --- a/java-compat/test/src/main/java/test/Ice/acm/run.py +++ /dev/null @@ -1,25 +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, getopt - -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() diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java index d198d02414e..57d34d6849a 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java @@ -24,12 +24,14 @@ public class AllTests } public static TestIntfPrx - allTests(test.Util.Application app, java.io.PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); + java.io.PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -77,7 +79,7 @@ public class AllTests Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); Ice.Communicator comm = app.initialize(initData); - comm.stringToProxy("test:default -p 12010").begin_ice_ping(); + comm.stringToProxy("test:" + app.getTestEndpoint(0)).begin_ice_ping(); comm.destroy(); } out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java index df01944e4e8..bea2f75c514 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java @@ -14,14 +14,13 @@ public class Client extends test.Util.Application public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java index c5c800aab52..2d896f2f418 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java @@ -18,7 +18,7 @@ public class Collocated extends test.Util.Application Ice.ServantLocator locator = new ServantLocatorI(); adapter.addServantLocator(locator, ""); - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); adapter.waitForDeactivate(); return 0; @@ -26,8 +26,7 @@ public class Collocated extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // 2 threads are necessary to dispatch the collocated transient() call with AMI @@ -35,7 +34,7 @@ public class Collocated extends test.Util.Application initData.properties.setProperty("TestAdapter.ThreadPool.Size", "2"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java index 4edeea0c554..05bb57c2098 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java @@ -26,13 +26,12 @@ public class Server extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); return initData; } - + public static void main(String[] args) { diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java index ad0f396c039..f878fe4de34 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java @@ -19,7 +19,7 @@ public final class TestI extends _TestIntfDisp Ice.Communicator communicator = current.adapter.getCommunicator(); Ice.ObjectAdapter adapter = - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); adapter.activate(); adapter.destroy(); } diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/admin/AllTests.java b/java-compat/test/src/main/java/test/Ice/admin/AllTests.java index b1e622947c8..96835f871c9 100644 --- a/java-compat/test/src/main/java/test/Ice/admin/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/admin/AllTests.java @@ -100,8 +100,10 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); + out.print("testing communicator operations... "); out.flush(); { @@ -180,7 +182,7 @@ public class AllTests } out.println("ok"); - String ref = "factory:default -p 12010 -t 10000"; + String ref = "factory:" + app.getTestEndpoint(0) + " -t 10000"; RemoteCommunicatorFactoryPrx factory = RemoteCommunicatorFactoryPrxHelper.uncheckedCast(app.communicator().stringToProxy(ref)); @@ -272,30 +274,30 @@ public class AllTests props.put("Ice.Admin.InstanceName", "Test"); props.put("NullLogger", "1"); RemoteCommunicatorPrx com = factory.createCommunicator(props); - + com.trace("testCat", "trace"); com.warning("warning"); com.error("error"); com.print("print"); - + Ice.ObjectPrx obj = com.getAdmin(); Ice.LoggerAdminPrx logger = Ice.LoggerAdminPrxHelper.checkedCast(obj, "Logger"); test(logger != null); - Ice.StringHolder prefix = new Ice.StringHolder(); - + Ice.StringHolder prefix = new Ice.StringHolder(); + // // Get all // Ice.LogMessage[] logMessages = logger.getLog(null, null, -1, prefix); - + test(logMessages.length == 4); test(prefix.value.equals("NullLogger")); - test(logMessages[0].traceCategory.equals("testCat") && logMessages[0].message.equals("trace")); + test(logMessages[0].traceCategory.equals("testCat") && logMessages[0].message.equals("trace")); test(logMessages[1].message.equals("warning")); test(logMessages[2].message.equals("error")); test(logMessages[3].message.equals("print")); - + // // Get only errors and warnings // @@ -303,34 +305,34 @@ public class AllTests com.print("print2"); com.trace("testCat", "trace2"); com.warning("warning2"); - + Ice.LogMessageType[] messageTypes = {Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.WarningMessage}; - + logMessages = logger.getLog(messageTypes, null, -1, prefix); test(logMessages.length == 4); test(prefix.value.equals("NullLogger")); - + for(Ice.LogMessage msg : java.util.Arrays.asList(logMessages)) { test(msg.type == Ice.LogMessageType.ErrorMessage || msg.type == Ice.LogMessageType.WarningMessage); } - + // // Get only errors and traces with Cat = "testCat" // com.trace("testCat2", "A"); com.trace("testCat", "trace3"); com.trace("testCat2", "B"); - + messageTypes = new Ice.LogMessageType[]{Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.TraceMessage}; String[] categories = {"testCat"}; logMessages = logger.getLog(messageTypes, categories, -1, prefix); test(logMessages.length == 5); test(prefix.value.equals("NullLogger")); - + for(Ice.LogMessage msg : java.util.Arrays.asList(logMessages)) - { - test(msg.type == Ice.LogMessageType.ErrorMessage || + { + test(msg.type == Ice.LogMessageType.ErrorMessage || (msg.type == Ice.LogMessageType.TraceMessage && msg.traceCategory.equals("testCat"))); } @@ -342,20 +344,20 @@ public class AllTests logMessages = logger.getLog(messageTypes, categories, 2, prefix); test(logMessages.length == 2); test(prefix.value.equals("NullLogger")); - + test(logMessages[0].message.equals("trace3")); test(logMessages[1].message.equals("error3")); - + // // Now, test RemoteLogger // - Ice.ObjectAdapter adapter = + Ice.ObjectAdapter adapter = app.communicator().createObjectAdapterWithEndpoints("RemoteLoggerAdapter", "tcp -h localhost"); - + RemoteLoggerI remoteLogger = new RemoteLoggerI(); - + Ice.RemoteLoggerPrx myProxy = Ice.RemoteLoggerPrxHelper.uncheckedCast(adapter.addWithUUID(remoteLogger)); - + adapter.activate(); // @@ -363,7 +365,7 @@ public class AllTests // logMessages = logger.getLog(null, null, -1, prefix); remoteLogger.checkNextInit(prefix.value, logMessages); - + try { logger.attachRemoteLogger(myProxy, null, null, -1); @@ -374,22 +376,22 @@ public class AllTests } remoteLogger.wait(1); - + remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace", "testCat"); remoteLogger.checkNextLog(Ice.LogMessageType.WarningMessage, "rwarning", ""); remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror", ""); remoteLogger.checkNextLog(Ice.LogMessageType.PrintMessage, "rprint", ""); - + com.trace("testCat", "rtrace"); com.warning("rwarning"); com.error("rerror"); com.print("rprint"); remoteLogger.wait(4); - + test(logger.detachRemoteLogger(myProxy)); test(!logger.detachRemoteLogger(myProxy)); - + // // Use Error + Trace with "traceCat" filter with 4 limit // @@ -407,10 +409,10 @@ public class AllTests } remoteLogger.wait(1); - + remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace2", "testCat"); remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror2", ""); - + com.warning("rwarning2"); com.trace("testCat", "rtrace2"); com.warning("rwarning3"); @@ -418,13 +420,13 @@ public class AllTests com.print("rprint2"); remoteLogger.wait(2); - + // // Attempt reconnection with slightly different proxy // try { - logger.attachRemoteLogger(Ice.RemoteLoggerPrxHelper.uncheckedCast(myProxy.ice_oneway()), + logger.attachRemoteLogger(Ice.RemoteLoggerPrxHelper.uncheckedCast(myProxy.ice_oneway()), messageTypes, categories, 4); test(false); } @@ -432,11 +434,11 @@ public class AllTests { // expected } - + com.destroy(); } out.println("ok"); - + out.print("testing custom facet... "); out.flush(); { diff --git a/java-compat/test/src/main/java/test/Ice/admin/Client.java b/java-compat/test/src/main/java/test/Ice/admin/Client.java index e3d4bbe677b..e769344efbe 100644 --- a/java-compat/test/src/main/java/test/Ice/admin/Client.java +++ b/java-compat/test/src/main/java/test/Ice/admin/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java-compat/test/src/main/java/test/Ice/admin/Server.java b/java-compat/test/src/main/java/test/Ice/admin/Server.java index f9ca817d7c0..bf88c2fa7ce 100644 --- a/java-compat/test/src/main/java/test/Ice/admin/Server.java +++ b/java-compat/test/src/main/java/test/Ice/admin/Server.java @@ -24,10 +24,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.admin"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/admin/run.py b/java-compat/test/src/main/java/test/Ice/admin/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/admin/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/ami/AllTests.java b/java-compat/test/src/main/java/test/Ice/ami/AllTests.java index c7dbc15a539..5faf9640316 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/ami/AllTests.java @@ -34,13 +34,13 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj); - sref = "testController:default -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); @@ -61,9 +61,9 @@ public class AllTests "run", new Class<?>[] { - test.Util.Application.class, - Ice.Communicator.class, - boolean.class, + test.Util.Application.class, + Ice.Communicator.class, + boolean.class, TestIntfPrx.class, TestIntfControllerPrx.class }); diff --git a/java-compat/test/src/main/java/test/Ice/ami/Client.java b/java-compat/test/src/main/java/test/Ice/ami/Client.java index e08515e7d62..097bb922ce6 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/Client.java +++ b/java-compat/test/src/main/java/test/Ice/ami/Client.java @@ -21,8 +21,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); initData.properties.setProperty("Ice.Warn.AMICallback", "0"); diff --git a/java-compat/test/src/main/java/test/Ice/ami/Collocated.java b/java-compat/test/src/main/java/test/Ice/ami/Collocated.java index 429d4ed2dfd..e5c4aaf2dcb 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/ami/Collocated.java @@ -29,11 +29,10 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); initData.properties.setProperty("Ice.Warn.AMICallback", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/ami/Server.java b/java-compat/test/src/main/java/test/Ice/ami/Server.java index 92c745419dd..1b826ef52e9 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/Server.java +++ b/java-compat/test/src/main/java/test/Ice/ami/Server.java @@ -29,11 +29,10 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java-compat/test/src/main/java/test/Ice/ami/run.py b/java-compat/test/src/main/java/test/Ice/ami/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/ami/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/background/AllTests.java b/java-compat/test/src/main/java/test/Ice/background/AllTests.java index 627b2346744..187c7bbf4f2 100644 --- a/java-compat/test/src/main/java/test/Ice/background/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/background/AllTests.java @@ -264,15 +264,18 @@ public class AllTests } public static BackgroundPrx - allTests(Configuration configuration, Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app, Configuration configuration) { - String sref = "background:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String sref = "background:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj); - sref = "backgroundController:tcp -p 12011"; + sref = "backgroundController:" + app.getTestEndpoint(1, "tcp"); obj = communicator.stringToProxy(sref); test(obj != null); @@ -310,7 +313,7 @@ public class AllTests out.flush(); { Ice.LocatorPrx locator; - obj = communicator.stringToProxy("locator:default -p 12010").ice_invocationTimeout(250); + obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)).ice_invocationTimeout(250); locator = Ice.LocatorPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway(); @@ -325,7 +328,7 @@ public class AllTests } backgroundController.resumeCall("findAdapterById"); - obj = communicator.stringToProxy("locator:default -p 12010"); + obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)); locator = Ice.LocatorPrxHelper.uncheckedCast(obj); obj = obj.ice_locator(locator); obj.ice_ping(); @@ -351,7 +354,7 @@ public class AllTests { Ice.RouterPrx router; - obj = communicator.stringToProxy("router:default -p 12010").ice_invocationTimeout(250); + obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)).ice_invocationTimeout(250); router = Ice.RouterPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway(); @@ -366,7 +369,7 @@ public class AllTests } backgroundController.resumeCall("getClientProxy"); - obj = communicator.stringToProxy("router:default -p 12010"); + obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)); router = Ice.RouterPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router); BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); diff --git a/java-compat/test/src/main/java/test/Ice/background/Client.java b/java-compat/test/src/main/java/test/Ice/background/Client.java index 2a4dde11aa5..528df026dba 100644 --- a/java-compat/test/src/main/java/test/Ice/background/Client.java +++ b/java-compat/test/src/main/java/test/Ice/background/Client.java @@ -17,21 +17,16 @@ public class Client extends test.Util.Application public int run(String[] args) { - Configuration configuration = new Configuration(); PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test"); - plugin.setConfiguration(configuration); - communicator().getPluginManager().initializePlugins(); - - BackgroundPrx background = AllTests.allTests(configuration, communicator(), getWriter()); + BackgroundPrx background = AllTests.allTests(this, plugin.getConfiguration()); background.shutdown(); return 0; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // For this test, we want to disable retries. // @@ -53,11 +48,8 @@ public class Client extends test.Util.Application initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory"); String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); - + initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - - // Don't initialize the plugin until I've set the configuration. - initData.properties.setProperty("Ice.InitPlugins", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/background/Collocated.java b/java-compat/test/src/main/java/test/Ice/background/Collocated.java deleted file mode 100644 index 6e4b5774ac9..00000000000 --- a/java-compat/test/src/main/java/test/Ice/background/Collocated.java +++ /dev/null @@ -1,99 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -package test.Ice.background; - -public class Collocated extends test.Util.Application -{ - static Thread _clientThread; - static int result; - - public static void main(String[] args) - { - Collocated app = new Collocated(); - int result = app.main("Collocated", args); - System.gc(); - System.exit(result); - } - - @Override - public int - run(String[] args) - { - final Client client = new Client(); - client.setClassLoader(getClassLoader()); - client.setWriter(getWriter()); - final Server server = new Server(); - server.setClassLoader(getClassLoader()); - server.setWriter(getWriter()); - Thread t = new Thread(new Runnable() - { - @Override - public void run() - { - String[] args = - { - "--Ice.NullHandleAbort=1", - "--Ice.Warn.Connections=1", - "--Ice.ThreadPool.Server.Size=1", - "--Ice.ThreadPool.Server.SizeMax=3", - "--Ice.ThreadPool.Server.SizeWarn=0", - "--Ice.PrintAdapterReady=1", - "--Ice.ServerIdleTime=30", - "--Ice.Default.Host=127.0.0.1" - }; - server.setServerReadyListener(new test.Util.Application.ServerReadyListener() - { - @Override - public void serverReady() - { - _clientThread = new Thread(new Runnable() - { - @Override - public void run() - { - String[] args = - { - "--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1", "--Ice.Default.Host=127.0.0.1" - }; - client.main("Client", args); - } - }); - _clientThread.start(); - } - }); - - result = server.main("Server", args); - if(_clientThread != null) - { - while(_clientThread.isAlive()) - { - try - { - _clientThread.join(); - } - catch(InterruptedException e1) - { - } - } - } - } - }); - t.start(); - try - { - t.join(); - } - catch(InterruptedException ex) - { - } - - return 0; - } -} diff --git a/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java b/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java index 8a6b5022b00..311faa53a01 100644 --- a/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java +++ b/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java @@ -18,12 +18,11 @@ public class PluginFactory implements Ice.PluginFactory { _communicator = communicator; } - + @Override public void initialize() { - assert _configuration != null; IceInternal.ProtocolPluginFacade facade = IceInternal.Util.getProtocolPluginFacade(_communicator); for(short s = 0; s < 100; ++s) { @@ -40,15 +39,15 @@ public class PluginFactory implements Ice.PluginFactory destroy() { } - - public void - setConfiguration(Configuration configuration) + + public Configuration + getConfiguration() { - _configuration = configuration; + return _configuration; } private final Ice.Communicator _communicator; - private Configuration _configuration; + private Configuration _configuration = new Configuration(); } @Override diff --git a/java-compat/test/src/main/java/test/Ice/background/Server.java b/java-compat/test/src/main/java/test/Ice/background/Server.java index d0e0d298506..b8be197084c 100644 --- a/java-compat/test/src/main/java/test/Ice/background/Server.java +++ b/java-compat/test/src/main/java/test/Ice/background/Server.java @@ -32,26 +32,26 @@ public class Server extends test.Util.Application _controller.checkCallPause(current); response.ice_response(current.adapter.createDirectProxy(id)); } - + @Override public Ice.LocatorRegistryPrx getRegistry(Ice.Current current) { return null; } - + LocatorI(BackgroundControllerI controller) { _controller = controller; } - + final private BackgroundControllerI _controller; } static public class RouterI extends Ice._RouterDisp { @Override - public Ice.ObjectPrx + public Ice.ObjectPrx getClientProxy(Ice.Current current) { _controller.checkCallPause(current); @@ -59,7 +59,7 @@ public class Server extends test.Util.Application } @Override - public Ice.ObjectPrx + public Ice.ObjectPrx getServerProxy(Ice.Current current) { _controller.checkCallPause(current); @@ -77,7 +77,7 @@ public class Server extends test.Util.Application { _controller = controller; } - + final private BackgroundControllerI _controller; } @@ -85,11 +85,9 @@ public class Server extends test.Util.Application public int run(String[] args) { - Configuration configuration = new Configuration(); PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test"); - plugin.setConfiguration(configuration); - communicator().getPluginManager().initializePlugins(); - + Configuration configuration = plugin.getConfiguration(); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); @@ -109,9 +107,8 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); - + Ice.InitializationData initData = super.getInitData(argsH); + // // This test kills connections, so we don't want warnings. // @@ -128,16 +125,13 @@ public class Server extends test.Util.Application initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory"); String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); - + initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1, "tcp")); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); - - // Don't initialize the plugin until I've set the configuration. - initData.properties.setProperty("Ice.InitPlugins", "0"); - + return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/background/run.py b/java-compat/test/src/main/java/test/Ice/background/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/background/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/binding/AllTests.java b/java-compat/test/src/main/java/test/Ice/binding/AllTests.java index 8e5f3a1d8ff..4e13ddc9ad8 100644 --- a/java-compat/test/src/main/java/test/Ice/binding/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/binding/AllTests.java @@ -103,7 +103,7 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String ref = "communicator:default -p 12010"; + String ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref)); out.print("testing binding with single endpoint... "); @@ -880,19 +880,21 @@ public class AllTests clientProps.add(bothPreferIPv4); clientProps.add(bothPreferIPv6); + String endpoint = "tcp -p " + app.getTestPort(2); + Ice.Properties 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.Properties 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.Properties anyboth = Ice.Util.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 + " -h \"::1\":" + endpoint + " -h 127.0.0.1"); Ice.Properties localipv4 = ipv4._clone(); localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1"); @@ -973,7 +975,7 @@ public class AllTests } serverCommunicator.destroy(); } - + out.println("ok"); } diff --git a/java-compat/test/src/main/java/test/Ice/binding/Client.java b/java-compat/test/src/main/java/test/Ice/binding/Client.java index 0610017ff98..c8aaf91ed44 100644 --- a/java-compat/test/src/main/java/test/Ice/binding/Client.java +++ b/java-compat/test/src/main/java/test/Ice/binding/Client.java @@ -21,8 +21,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java b/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java index 5286442d092..66c5489f16b 100644 --- a/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java +++ b/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java @@ -13,6 +13,12 @@ import test.Ice.binding.Test._RemoteCommunicatorDisp; public class RemoteCommunicatorI extends _RemoteCommunicatorDisp { + public + RemoteCommunicatorI(test.Util.Application app) + { + _app = app; + } + @Override public RemoteObjectAdapterPrx createObjectAdapter(String name, String endpts, Ice.Current current) @@ -20,11 +26,7 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp String endpoints = endpts; if(endpoints.indexOf("-p") < 0) { - // Use a fixed port if none is specified (bug 2896) - endpoints += " -h \"" + - (current.adapter.getCommunicator().getProperties().getPropertyWithDefault( - "Ice.Default.Host", "127.0.0.1")) + - "\" -p " + _nextPort++; + endpoints = _app.getTestEndpoint(_nextPort++, endpoints); } Ice.Communicator com = current.adapter.getCommunicator(); @@ -48,5 +50,6 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp current.adapter.getCommunicator().shutdown(); } - private int _nextPort = 10001; + private final test.Util.Application _app; + private int _nextPort = 10; } diff --git a/java-compat/test/src/main/java/test/Ice/binding/Server.java b/java-compat/test/src/main/java/test/Ice/binding/Server.java index 104b7e1eb03..88b1a1f26bc 100644 --- a/java-compat/test/src/main/java/test/Ice/binding/Server.java +++ b/java-compat/test/src/main/java/test/Ice/binding/Server.java @@ -18,7 +18,7 @@ public class Server extends test.Util.Application Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Identity id = Ice.Util.stringToIdentity("communicator"); - adapter.add(new RemoteCommunicatorI(), id); + adapter.add(new RemoteCommunicatorI(this), id); adapter.activate(); return WAIT; @@ -27,10 +27,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/binding/run.py b/java-compat/test/src/main/java/test/Ice/binding/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/binding/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java b/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java index 5145912b376..e8a0327d593 100644 --- a/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java @@ -24,9 +24,12 @@ public class AllTests } public static ChecksumPrx - allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); diff --git a/java-compat/test/src/main/java/test/Ice/checksum/Client.java b/java-compat/test/src/main/java/test/Ice/checksum/Client.java index c98eacbdab3..bb3de61e0ec 100644 --- a/java-compat/test/src/main/java/test/Ice/checksum/Client.java +++ b/java-compat/test/src/main/java/test/Ice/checksum/Client.java @@ -18,7 +18,7 @@ public class Client extends test.Util.Application run(String[] args) { Ice.Communicator communicator = communicator(); - ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter()); + ChecksumPrx checksum = AllTests.allTests(this, false); checksum.shutdown(); return 0; } @@ -27,8 +27,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum"); return initData; } @@ -38,7 +37,7 @@ public class Client extends test.Util.Application { Client c = new Client(); int status = c.main("Client", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/Ice/checksum/Server.java b/java-compat/test/src/main/java/test/Ice/checksum/Server.java index dffecaff213..02eaad97f58 100644 --- a/java-compat/test/src/main/java/test/Ice/checksum/Server.java +++ b/java-compat/test/src/main/java/test/Ice/checksum/Server.java @@ -16,19 +16,18 @@ public class Server extends test.Util.Application run(String[] args) { Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new ChecksumI(); adapter.add(object, Ice.Util.stringToIdentity("test")); adapter.activate(); return WAIT; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum.server"); return initData; } @@ -38,7 +37,7 @@ public class Server extends test.Util.Application { Server c = new Server(); int status = c.main("Server", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/Ice/checksum/run.py b/java-compat/test/src/main/java/test/Ice/checksum/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/checksum/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java b/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java index f22fa4b816d..c540a6d5ae5 100644 --- a/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java @@ -140,7 +140,7 @@ public class AllTests initData.classLoader = classLoader; Ice.Communicator ic = app.initialize(initData); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = ic.stringToProxy(ref); test(base != null); diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/Client.java b/java-compat/test/src/main/java/test/Ice/classLoader/Client.java index 6bf2e795ca7..5841767b82f 100644 --- a/java-compat/test/src/main/java/test/Ice/classLoader/Client.java +++ b/java-compat/test/src/main/java/test/Ice/classLoader/Client.java @@ -21,8 +21,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - _initData = createInitializationData(); - _initData.properties = Ice.Util.createProperties(argsH); + _initData = super.getInitData(argsH); _initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader"); return _initData; } diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/Server.java b/java-compat/test/src/main/java/test/Ice/classLoader/Server.java index aef65c14aa3..beb7f1afc00 100644 --- a/java-compat/test/src/main/java/test/Ice/classLoader/Server.java +++ b/java-compat/test/src/main/java/test/Ice/classLoader/Server.java @@ -26,10 +26,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Default.SlicedFormat", "1"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/run.py b/java-compat/test/src/main/java/test/Ice/classLoader/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/classLoader/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/custom/AllTests.java b/java-compat/test/src/main/java/test/Ice/custom/AllTests.java index a025deb4992..4a66d0ed598 100644 --- a/java-compat/test/src/main/java/test/Ice/custom/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/custom/AllTests.java @@ -56,11 +56,13 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/custom/Client.java b/java-compat/test/src/main/java/test/Ice/custom/Client.java index 90ec943086b..d2c043ca266 100644 --- a/java-compat/test/src/main/java/test/Ice/custom/Client.java +++ b/java-compat/test/src/main/java/test/Ice/custom/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + TestIntfPrx test = AllTests.allTests(this); test.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/custom/Collocated.java b/java-compat/test/src/main/java/test/Ice/custom/Collocated.java index 2c1e7b251f1..0710cd8ef81 100644 --- a/java-compat/test/src/main/java/test/Ice/custom/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/custom/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application Ice.Object test = new TestI(communicator); adapter.add(test, Ice.Util.stringToIdentity("test")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -27,10 +27,9 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/custom/Server.java b/java-compat/test/src/main/java/test/Ice/custom/Server.java index 8a4da565414..94f0ea206a7 100644 --- a/java-compat/test/src/main/java/test/Ice/custom/Server.java +++ b/java-compat/test/src/main/java/test/Ice/custom/Server.java @@ -27,10 +27,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/custom/run.py b/java-compat/test/src/main/java/test/Ice/custom/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/custom/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java b/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java index d841881da63..0287f8dfa24 100644 --- a/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java @@ -24,9 +24,10 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost"); oa.activate(); diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java b/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java index f5956bead6b..f0cdcbeece8 100644 --- a/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java +++ b/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/run.py b/java-compat/test/src/main/java/test/Ice/defaultServant/run.py deleted file mode 100755 index 86b25876539..00000000000 --- a/java-compat/test/src/main/java/test/Ice/defaultServant/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.defaultServant.Client", "--Ice.Warn.Dispatch=0",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java b/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java index 3c669e17b5b..8a04766de10 100644 --- a/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java @@ -24,8 +24,9 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); out.print("testing default values... "); out.flush(); diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java b/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java index 7d13b0c7645..ec2c3d21842 100644 --- a/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java +++ b/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/run.py b/java-compat/test/src/main/java/test/Ice/defaultValue/run.py deleted file mode 100755 index 06a587612d9..00000000000 --- a/java-compat/test/src/main/java/test/Ice/defaultValue/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.defaultValue.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java b/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java index 31116ccb013..dc6849215ac 100644 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java @@ -63,10 +63,12 @@ public class AllTests } } - public static void - allTests(Ice.Communicator communicator, PrintWriter out, final Dispatcher dispatcher) + public static void allTests(test.Util.Application app, final Dispatcher dispatcher) { - String sref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); @@ -78,7 +80,7 @@ public class AllTests TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1, "tcp"); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java index 3cfb7a56697..fec7ba74f57 100644 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java +++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(communicator(), getWriter(), _dispatcher); + AllTests.allTests(this, _dispatcher); return 0; } @@ -23,8 +23,7 @@ public class Client extends test.Util.Application { assert(_dispatcher == null); _dispatcher = new Dispatcher(); - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); // diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java index 230321ada51..f8dc464b4df 100644 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java @@ -23,7 +23,7 @@ public class Collocated extends test.Util.Application adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator(), getWriter(), _dispatcher); + AllTests.allTests(this, _dispatcher); return 0; } @@ -32,11 +32,10 @@ public class Collocated extends test.Util.Application { assert(_dispatcher == null); _dispatcher = new Dispatcher(); - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1, "tcp")); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); initData.dispatcher = _dispatcher; return initData; diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java index d962bbe1e28..29025ed9e0b 100644 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java +++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java @@ -32,11 +32,10 @@ public class Server extends test.Util.Application { assert(_dispatcher == null); _dispatcher = new Dispatcher(); - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1, "tcp")); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/run.py b/java-compat/test/src/main/java/test/Ice/dispatcher/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/echo/Server.java b/java-compat/test/src/main/java/test/Ice/echo/Server.java index 07648551d38..f89ea79ffd5 100644 --- a/java-compat/test/src/main/java/test/Ice/echo/Server.java +++ b/java-compat/test/src/main/java/test/Ice/echo/Server.java @@ -17,19 +17,19 @@ public class Server extends test.Util.Application { _blob = blob; } - + @Override public void startBatch(Ice.Current current) { _blob.startBatch(); } - + @Override public void flushBatch(Ice.Current current) { _blob.flushBatch(); } - + @Override public void shutdown(Ice.Current current) { @@ -42,7 +42,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); BlobjectI blob = new BlobjectI(); adapter.addDefaultServant(blob, ""); @@ -54,8 +54,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.echo"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/echo/run.py b/java-compat/test/src/main/java/test/Ice/echo/run.py deleted file mode 100755 index 3f861533410..00000000000 --- a/java-compat/test/src/main/java/test/Ice/echo/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 - -sys.stdout.write("starting server... ") -sys.stdout.flush() -p = TestUtil.startServer("test.Ice.echo.Server") -print("ok") -sys.stdout.flush() - -p.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/enums/AllTests.java b/java-compat/test/src/main/java/test/Ice/enums/AllTests.java index 9f2ad470db6..b47586aa254 100644 --- a/java-compat/test/src/main/java/test/Ice/enums/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/enums/AllTests.java @@ -24,9 +24,11 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); TestIntfPrx proxy = TestIntfPrxHelper.checkedCast(obj); diff --git a/java-compat/test/src/main/java/test/Ice/enums/Client.java b/java-compat/test/src/main/java/test/Ice/enums/Client.java index a27198b8b66..0f7d7d70599 100644 --- a/java-compat/test/src/main/java/test/Ice/enums/Client.java +++ b/java-compat/test/src/main/java/test/Ice/enums/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + TestIntfPrx test = AllTests.allTests(this); test.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/enums/Server.java b/java-compat/test/src/main/java/test/Ice/enums/Server.java index 69c4bf6459e..d48272c54af 100644 --- a/java-compat/test/src/main/java/test/Ice/enums/Server.java +++ b/java-compat/test/src/main/java/test/Ice/enums/Server.java @@ -27,10 +27,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/enums/run.py b/java-compat/test/src/main/java/test/Ice/enums/run.py deleted file mode 100755 index 1b234c88804..00000000000 --- a/java-compat/test/src/main/java/test/Ice/enums/run.py +++ /dev/null @@ -1,29 +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(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "1.1", message = "Running test with 1.1 encoding.") -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java b/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java index 42c57ad2209..82f8035da5f 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java @@ -31,22 +31,20 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - // + Ice.InitializationData initData = super.getInitData(argsH); // For this test, we need a dummy logger, otherwise the // assertion test will print an error message. // initData.logger = new DummyLogger(); - initData.properties = Ice.Util.createProperties(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); + initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); + initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(initData.properties, 2)); initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java b/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java index b417b1a427d..d00bd7bef7c 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java @@ -721,8 +721,10 @@ public class AllTests } public static ThrowerPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); { out.print("testing object adapter registration exceptions... "); Ice.ObjectAdapter first; @@ -842,7 +844,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "thrower:default -p 12010"; + String ref = "thrower:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -1140,7 +1142,7 @@ public class AllTests } ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast( - communicator.stringToProxy("thrower:default -p 12011")); + communicator.stringToProxy("thrower:" + app.getTestEndpoint(1))); try { thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits) @@ -1149,7 +1151,7 @@ public class AllTests { } ThrowerPrx thrower3 = ThrowerPrxHelper.uncheckedCast( - communicator.stringToProxy("thrower:default -p 12012")); + communicator.stringToProxy("thrower:" + app.getTestEndpoint(2))); try { thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Client.java b/java-compat/test/src/main/java/test/Ice/exceptions/Client.java index 741de95a736..38e20cef122 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/Client.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - ThrowerPrx thrower = AllTests.allTests(communicator, getWriter()); + ThrowerPrx thrower = AllTests.allTests(this); thrower.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java b/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java index 87f9e730a2d..17372282644 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java @@ -20,7 +20,7 @@ public class Collocated extends test.Util.Application Ice.Object object = new ThrowerI(); adapter.add(object, Ice.Util.stringToIdentity("thrower")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -28,19 +28,17 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - // + Ice.InitializationData initData = super.getInitData(argsH); // For this test, we need a dummy logger, otherwise the // assertion test will print an error message. // initData.logger = new DummyLogger(); - initData.properties = Ice.Util.createProperties(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Server.java b/java-compat/test/src/main/java/test/Ice/exceptions/Server.java index d510ac1216f..5bb040bfc79 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/Server.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/Server.java @@ -31,22 +31,20 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - // + Ice.InitializationData initData = super.getInitData(argsH); // For this test, we need a dummy logger, otherwise the // assertion test will print an error message. // initData.logger = new DummyLogger(); - initData.properties = Ice.Util.createProperties(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); + initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); + initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(initData.properties, 2)); initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/run.py b/java-compat/test/src/main/java/test/Ice/exceptions/run.py deleted file mode 100755 index 65b4b4d0e93..00000000000 --- a/java-compat/test/src/main/java/test/Ice/exceptions/run.py +++ /dev/null @@ -1,51 +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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "compactAMD", localOnly = True, - message = "Running test with compact (default) format and AMD server.", - server="test.Ice.exceptions.AMDServer") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server="test.Ice.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="test.Ice.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/facets/AllTests.java b/java-compat/test/src/main/java/test/Ice/facets/AllTests.java index 6292a77109f..bd3f25bb6b5 100644 --- a/java-compat/test/src/main/java/test/Ice/facets/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/facets/AllTests.java @@ -32,8 +32,10 @@ public class AllTests } public static GPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing Ice.Admin.Facets property... "); test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").length == 0); communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); @@ -112,7 +114,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "d:default -p 12010"; + String ref = "d:" + app.getTestEndpoint(0); Ice.ObjectPrx db = communicator.stringToProxy(ref); test(db != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/facets/Client.java b/java-compat/test/src/main/java/test/Ice/facets/Client.java index a67a11d734f..4ba98ba65ff 100644 --- a/java-compat/test/src/main/java/test/Ice/facets/Client.java +++ b/java-compat/test/src/main/java/test/Ice/facets/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - GPrx g = AllTests.allTests(communicator, getWriter()); + GPrx g = AllTests.allTests(this); g.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/facets/Collocated.java b/java-compat/test/src/main/java/test/Ice/facets/Collocated.java index 4d72172d030..51d798fc036 100644 --- a/java-compat/test/src/main/java/test/Ice/facets/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/facets/Collocated.java @@ -15,7 +15,7 @@ public class Collocated extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); adapter.add(d, Ice.Util.stringToIdentity("d")); @@ -25,7 +25,7 @@ public class Collocated extends test.Util.Application Ice.Object h = new HI(communicator); adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -33,8 +33,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/facets/Server.java b/java-compat/test/src/main/java/test/Ice/facets/Server.java index 533db9e28e3..a19c23865c5 100644 --- a/java-compat/test/src/main/java/test/Ice/facets/Server.java +++ b/java-compat/test/src/main/java/test/Ice/facets/Server.java @@ -32,10 +32,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/facets/run.py b/java-compat/test/src/main/java/test/Ice/facets/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/facets/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java index 30550745185..4bd0cbd424d 100644 --- a/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java @@ -47,10 +47,10 @@ public class AllTests { } } - + _called = false; } - + public synchronized void called() { @@ -71,20 +71,20 @@ public class AllTests _pid = pid; callback.called(); } - + @Override public void exception(Ice.LocalException ex) { test(false); } - + public int pid() { return _pid; } - + public void check() { @@ -92,10 +92,10 @@ public class AllTests } private int _pid; - + private Callback callback = new Callback(); } - + private static class Callback_TestIntf_shutdownI extends Callback_TestIntf_shutdown { @Override @@ -104,14 +104,14 @@ public class AllTests { callback.called(); } - + @Override public void exception(Ice.LocalException ex) { test(false); } - + public void check() { @@ -120,7 +120,7 @@ public class AllTests private Callback callback = new Callback(); } - + private static class AbortCallback extends Ice.Callback { @Override @@ -155,7 +155,7 @@ public class AllTests } callback.called(); } - + public void check() { @@ -164,16 +164,19 @@ public class AllTests private Callback callback = new Callback(); } - + public static void - allTests(Ice.Communicator communicator, int[] ports, PrintWriter out) + allTests(test.Util.Application app, int[] ports) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); String ref = "test"; for(int port : ports) { - ref += ":default -p " + port; + ref += ":" + app.getTestEndpoint(port); } Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java index 9a350872820..c4af1ebb5dd 100644 --- a/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java +++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java @@ -25,7 +25,7 @@ public class Client extends test.Util.Application run(String[] args) { PrintWriter out = getWriter(); - + Ice.Communicator communicator = communicator(); java.util.List<Integer> ports = new java.util.ArrayList<Integer>(args.length); for(String arg : args) @@ -70,7 +70,7 @@ public class Client extends test.Util.Application try { - AllTests.allTests(communicator, arr, out); + AllTests.allTests(this, arr); } catch(Ice.LocalException ex) { @@ -84,8 +84,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance"); // // This test aborts servers, so we don't want warnings. diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java index 56e4041a168..1fbda32e6f9 100644 --- a/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java +++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java @@ -62,7 +62,7 @@ public class Server extends test.Util.Application } // Don't move this, it needs the port. - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(port)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new TestI(port); adapter.add(object, Ice.Util.stringToIdentity("test")); @@ -73,8 +73,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance"); // Two minutes. initData.properties.setProperty("Ice.ServerIdleTime", "120"); diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/run.py b/java-compat/test/src/main/java/test/Ice/faultTolerance/run.py deleted file mode 100755 index f3e808802b0..00000000000 --- a/java-compat/test/src/main/java/test/Ice/faultTolerance/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 - -num = 12 -base = 12340 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer("test.Ice.faultTolerance.Server", " %d" % (base + i))) - print("ok") - -ports = "" -for i in range(0, num): - ports = "%s %d" % (ports, base + i) -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.faultTolerance.Client", ports, startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/hash/Client.java b/java-compat/test/src/main/java/test/Ice/hash/Client.java index 7859559f9ad..12d711fc51a 100644 --- a/java-compat/test/src/main/java/test/Ice/hash/Client.java +++ b/java-compat/test/src/main/java/test/Ice/hash/Client.java @@ -48,7 +48,7 @@ public class Client extends test.Util.Application int maxCollisions = 10; int maxIterations = 10000; - Ice.InitializationData initData = createInitializationData() ; + Ice.InitializationData initData = createInitializationData(); initData.properties = Ice.Util.createProperties(args); initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory"); Ice.Communicator communicator = Ice.Util.initialize(args, initData); @@ -57,8 +57,8 @@ public class Client extends test.Util.Application out.flush(); { java.util.Random rand = new java.util.Random(); - for(i = 0; proxyCollisions < maxCollisions && - endpointCollisions < maxCollisions && + for(i = 0; proxyCollisions < maxCollisions && + endpointCollisions < maxCollisions && i < maxIterations; ++i) { java.io.StringWriter sw = new java.io.StringWriter(); @@ -86,7 +86,7 @@ public class Client extends test.Util.Application { seenProxy.put(obj.hashCode(), obj); } - + java.util.Iterator<Ice.Endpoint> j = endpoints.iterator(); while(j.hasNext()) { @@ -118,8 +118,8 @@ public class Client extends test.Util.Application proxyCollisions = 0; seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>(); - for(i = 0; proxyCollisions < maxCollisions && - endpointCollisions < maxCollisions && + for(i = 0; proxyCollisions < maxCollisions && + endpointCollisions < maxCollisions && i < maxIterations; ++i) { java.io.StringWriter sw = new java.io.StringWriter(); @@ -151,8 +151,8 @@ public class Client extends test.Util.Application proxyCollisions = 0; seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>(); - for(i = 0; proxyCollisions < maxCollisions && - endpointCollisions < maxCollisions && + for(i = 0; proxyCollisions < maxCollisions && + endpointCollisions < maxCollisions && i < maxIterations; ++i) { java.io.StringWriter sw = new java.io.StringWriter(); @@ -388,7 +388,7 @@ public class Client extends test.Util.Application test(c.hashCode() == c.hashCode()); } test(structCollisions < maxCollisions); - + structCollisions = 0; java.util.Map<Integer, Draw> seenDraw = new java.util.HashMap<Integer, Draw>(); structCollisions = 0; @@ -396,7 +396,7 @@ public class Client extends test.Util.Application { Draw draw = new Draw( new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)), - new Pen(rand.nextInt(10), + new Pen(rand.nextInt(10), new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255))), false); @@ -420,7 +420,7 @@ public class Client extends test.Util.Application test(structCollisions < maxCollisions); } out.println("ok"); - + if(communicator != null) { try diff --git a/java-compat/test/src/main/java/test/Ice/hash/run.py b/java-compat/test/src/main/java/test/Ice/hash/run.py deleted file mode 100755 index 5175a3d1877..00000000000 --- a/java-compat/test/src/main/java/test/Ice/hash/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.simpleTest("test.Ice.hash.Client") - diff --git a/java-compat/test/src/main/java/test/Ice/hold/AllTests.java b/java-compat/test/src/main/java/test/Ice/hold/AllTests.java index 1086e9a5875..b27fbaf331c 100644 --- a/java-compat/test/src/main/java/test/Ice/hold/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/hold/AllTests.java @@ -32,7 +32,7 @@ public class AllTests { _value = value; } - + synchronized public void set(boolean value) { @@ -44,7 +44,7 @@ public class AllTests { return _value; } - + private boolean _value; }; @@ -84,19 +84,21 @@ public class AllTests }; public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "hold:default -p 12010"; + String ref = "hold:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - String refSerialized = "hold:default -p 12011"; + String refSerialized = "hold:" + app.getTestEndpoint(1); Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized); test(baseSerialized != null); out.println("ok"); - + out.print("testing checked cast... "); out.flush(); HoldPrx hold = HoldPrxHelper.checkedCast(base); @@ -108,7 +110,7 @@ public class AllTests test(holdSerialized != null); test(holdSerialized.equals(baseSerialized)); out.println("ok"); - + out.print("changing state between active and hold rapidly... "); out.flush(); for(int i = 0; i < 100; ++i) @@ -128,7 +130,7 @@ public class AllTests holdSerializedOneway.putOnHold(0); } out.println("ok"); - + out.print("testing without serialize mode... "); out.flush(); java.util.Random random = new java.util.Random(); @@ -227,7 +229,7 @@ public class AllTests hold.putOnHold(-1); hold.ice_ping(); hold.putOnHold(-1); - hold.ice_ping(); + hold.ice_ping(); } out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/hold/Client.java b/java-compat/test/src/main/java/test/Ice/hold/Client.java index 28c45f9aa08..d34f2bf89df 100644 --- a/java-compat/test/src/main/java/test/Ice/hold/Client.java +++ b/java-compat/test/src/main/java/test/Ice/hold/Client.java @@ -14,15 +14,14 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/hold/Server.java b/java-compat/test/src/main/java/test/Ice/hold/Server.java index 2d3a1cf9652..d398b6efc15 100644 --- a/java-compat/test/src/main/java/test/Ice/hold/Server.java +++ b/java-compat/test/src/main/java/test/Ice/hold/Server.java @@ -37,16 +37,15 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold"); - initData.properties.setProperty("TestAdapter1.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter1.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("TestAdapter1.ThreadPool.Size", "5"); initData.properties.setProperty("TestAdapter1.ThreadPool.SizeMax", "5"); initData.properties.setProperty("TestAdapter1.ThreadPool.SizeWarn", "0"); initData.properties.setProperty("TestAdapter1.ThreadPool.Serialize", "0"); - initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011:udp"); + initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(initData.properties, 1) + ":udp"); initData.properties.setProperty("TestAdapter2.ThreadPool.Size", "5"); initData.properties.setProperty("TestAdapter2.ThreadPool.SizeMax", "5"); initData.properties.setProperty("TestAdapter2.ThreadPool.SizeWarn", "0"); diff --git a/java-compat/test/src/main/java/test/Ice/hold/run.py b/java-compat/test/src/main/java/test/Ice/hold/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/hold/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/info/AllTests.java b/java-compat/test/src/main/java/test/Ice/info/AllTests.java index c2e3b3022f2..4de2a87c2ff 100644 --- a/java-compat/test/src/main/java/test/Ice/info/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/info/AllTests.java @@ -51,9 +51,10 @@ public class AllTests return null; } - public static void - allTests(Ice.Communicator communicator, PrintWriter out) + public static void allTests(test.Util.Application app) { + Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing proxy endpoint information... "); out.flush(); { @@ -124,8 +125,9 @@ public class AllTests adapter.destroy(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p 12020"); - communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020"); + int port = app.getTestPort(1); + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p " + port); + communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", app.getTestEndpoint(1)); adapter = communicator.createObjectAdapter("TestAdapter"); endpoints = adapter.getEndpoints(); @@ -136,26 +138,29 @@ public class AllTests for(Ice.Endpoint endpoint : endpoints) { tcpEndpoint = getTCPEndpointInfo(endpoint.getInfo()); - test(tcpEndpoint.port == 12020); + test(tcpEndpoint.port == port); } tcpEndpoint = getTCPEndpointInfo(publishedEndpoints[0].getInfo()); test(tcpEndpoint.host.equals("127.0.0.1")); - test(tcpEndpoint.port == 12020); + test(tcpEndpoint.port == port); adapter.destroy(); } out.println("ok"); - Ice.ObjectPrx base = communicator.stringToProxy("test:default -p 12010:udp -p 12010"); + Ice.ObjectPrx base = communicator.stringToProxy("test:" + + app.getTestEndpoint(0) + ":" + + app.getTestEndpoint(0, "udp")); TestIntfPrx testIntf = TestIntfPrxHelper.checkedCast(base); + int endpointPort = app.getTestPort(0); out.print("test connection endpoint information... "); out.flush(); { Ice.EndpointInfo info = base.ice_getConnection().getEndpoint().getInfo(); Ice.TCPEndpointInfo tcpinfo = getTCPEndpointInfo(info); - test(tcpinfo.port == 12010); + test(tcpinfo.port == endpointPort); test(!tcpinfo.compress); test(tcpinfo.host.equals(defaultHost)); @@ -167,7 +172,7 @@ public class AllTests info = base.ice_datagram().ice_getConnection().getEndpoint().getInfo(); Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)info; - test(udp.port == 12010); + test(udp.port == endpointPort); test(udp.host.equals(defaultHost)); } out.println("ok"); @@ -182,7 +187,7 @@ public class AllTests test(!info.incoming); test(info.adapterName.length() == 0); test(info.localPort > 0); - test(info.remotePort == 12010); + test(info.remotePort == endpointPort); if(defaultHost.equals("127.0.0.1")) { test(info.remoteAddress.equals(defaultHost)); @@ -221,7 +226,7 @@ public class AllTests test(!udpinfo.incoming); test(udpinfo.adapterName.length() == 0); test(udpinfo.localPort > 0); - test(udpinfo.remotePort == 12010); + test(udpinfo.remotePort == endpointPort); if(defaultHost.equals("127.0.0.1")) { test(udpinfo.remoteAddress.equals(defaultHost)); diff --git a/java-compat/test/src/main/java/test/Ice/info/Client.java b/java-compat/test/src/main/java/test/Ice/info/Client.java index 600b5008bd4..83cc5bfc748 100644 --- a/java-compat/test/src/main/java/test/Ice/info/Client.java +++ b/java-compat/test/src/main/java/test/Ice/info/Client.java @@ -14,15 +14,14 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(communicator(), getWriter()); + AllTests.allTests(this); return 0; } @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.info"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/info/Server.java b/java-compat/test/src/main/java/test/Ice/info/Server.java index 455e21046d0..e2d887c63d2 100644 --- a/java-compat/test/src/main/java/test/Ice/info/Server.java +++ b/java-compat/test/src/main/java/test/Ice/info/Server.java @@ -24,10 +24,11 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(initData.properties, 0) + ":" + + getTestEndpoint(initData.properties, 1, "udp")); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/info/run.py b/java-compat/test/src/main/java/test/Ice/info/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/info/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java b/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java index 360cc09b725..f07609ff95b 100644 --- a/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java @@ -34,11 +34,13 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -82,7 +84,7 @@ public class AllTests CAPrx cao; CBPrx cbo; CCPrx cco; - + cao = ca.caop(ca); test(cao.equals(ca)); cao = ca.caop(cb); @@ -101,7 +103,7 @@ public class AllTests test(cao.equals(cb)); cao = cc.caop(cc); test(cao.equals(cc)); - + cao = cb.cbop(cb); test(cao.equals(cb)); cbo = cb.cbop(cb); diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Client.java b/java-compat/test/src/main/java/test/Ice/inheritance/Client.java index 704cf503752..95259642bb4 100644 --- a/java-compat/test/src/main/java/test/Ice/inheritance/Client.java +++ b/java-compat/test/src/main/java/test/Ice/inheritance/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - InitialPrx initial = AllTests.allTests(communicator, getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java b/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java index ac600d8f32c..0841800b3ea 100644 --- a/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application Ice.Object object = new InitialI(adapter); adapter.add(object, Ice.Util.stringToIdentity("initial")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -27,10 +27,9 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Server.java b/java-compat/test/src/main/java/test/Ice/inheritance/Server.java index a826ae1ec2f..591a55beabc 100644 --- a/java-compat/test/src/main/java/test/Ice/inheritance/Server.java +++ b/java-compat/test/src/main/java/test/Ice/inheritance/Server.java @@ -25,10 +25,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/run.py b/java-compat/test/src/main/java/test/Ice/inheritance/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/inheritance/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/Client.java b/java-compat/test/src/main/java/test/Ice/interceptor/Client.java index 4440dc5e889..dd719e5fb28 100644 --- a/java-compat/test/src/main/java/test/Ice/interceptor/Client.java +++ b/java-compat/test/src/main/java/test/Ice/interceptor/Client.java @@ -246,8 +246,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.interceptor"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/run.py b/java-compat/test/src/main/java/test/Ice/interceptor/run.py deleted file mode 100755 index 99d35706c32..00000000000 --- a/java-compat/test/src/main/java/test/Ice/interceptor/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.interceptor.Client", "--Ice.Warn.Dispatch=0",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java b/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java index 0644cf92fef..8d954f051ec 100644 --- a/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java @@ -62,7 +62,7 @@ public class AllTests private boolean _called = false; } - + private static void test(boolean b) { @@ -71,7 +71,7 @@ public class AllTests throw new RuntimeException(); } } - + private static void failIfNotInterrupted() { if(Thread.currentThread().isInterrupted()) @@ -90,13 +90,13 @@ public class AllTests { Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); final TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); @@ -144,7 +144,7 @@ public class AllTests { cb.called(); } - + @Override public void exception(Ice.LocalException ex) { @@ -282,7 +282,7 @@ public class AllTests { // Expected } - + // end_ should still work. p.end_op(r); } @@ -305,7 +305,7 @@ public class AllTests { // Expected } - + // end_ should still work. p.end_op(r); } @@ -361,7 +361,7 @@ public class AllTests r.waitForCompleted(); p.end_opWithPayload(r); } - + // // The executor is all done. // @@ -372,16 +372,16 @@ public class AllTests } } out.println("ok"); - + if(p.ice_getCachedConnection() != null) { out.print("testing getConnection interrupt... "); out.flush(); { final Thread mainThread = Thread.currentThread(); - + p.ice_getConnection().close(false); - + AsyncResult r = p.begin_ice_getConnection(); mainThread.interrupt(); try @@ -393,9 +393,9 @@ public class AllTests { // Expected } - + p.ice_getConnection().close(false); - + final CallbackBase cb = new CallbackBase(); mainThread.interrupt(); p.begin_ice_getConnection(new Callback_Object_ice_getConnection() @@ -405,7 +405,7 @@ public class AllTests { test(false); } - + @Override public void response(Connection con) { @@ -427,7 +427,7 @@ public class AllTests p2.op(); p2.op(); p2.op(); - + AsyncResult r = p2.begin_ice_flushBatchRequests(); mainThread.interrupt(); try @@ -439,10 +439,10 @@ public class AllTests { // Expected } - + + p2.op(); p2.op(); p2.op(); - p2.op(); final CallbackBase cb = new CallbackBase(); mainThread.interrupt(); @@ -461,7 +461,7 @@ public class AllTests } }); test(Thread.interrupted()); - cb.check(); + cb.check(); } out.println("ok"); @@ -472,11 +472,11 @@ public class AllTests { final TestIntfPrx p2 = TestIntfPrxHelper.uncheckedCast(p.ice_batchOneway()); final Thread mainThread = Thread.currentThread(); - + p2.op(); p2.op(); p2.op(); - + AsyncResult r = p2.ice_getConnection().begin_flushBatchRequests(); mainThread.interrupt(); try @@ -488,11 +488,11 @@ public class AllTests { // Expected } - + + p2.op(); p2.op(); p2.op(); - p2.op(); - + final CallbackBase cb = new CallbackBase(); Ice.Connection con = p2.ice_getConnection(); mainThread.interrupt(); @@ -503,7 +503,7 @@ public class AllTests { cb.called(); } - + @Override public void exception(LocalException ex) { @@ -515,7 +515,7 @@ public class AllTests } out.println("ok"); } - + out.print("testing batch communicator flush interrupt... "); out.flush(); { @@ -525,7 +525,7 @@ public class AllTests p2.op(); p2.op(); p2.op(); - + AsyncResult r = communicator.begin_flushBatchRequests(); mainThread.interrupt(); try @@ -537,11 +537,11 @@ public class AllTests { // Expected } - + p2.op(); p2.op(); - p2.op(); - + p2.op(); + final CallbackBase cb = new CallbackBase(); mainThread.interrupt(); communicator.begin_flushBatchRequests(new Callback_Communicator_flushBatchRequests() @@ -573,8 +573,8 @@ public class AllTests Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); Ice.Communicator ic = app.initialize(initData); - - Thread.currentThread().interrupt(); + + Thread.currentThread().interrupt(); try { ic.destroy(); @@ -587,17 +587,17 @@ public class AllTests ic.destroy(); ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(2); - + ic = app.initialize(initData); Ice.ObjectPrx o = ic.stringToProxy(p.toString()); - + final Thread[] thread = new Thread[1]; final CallbackBase cb = new CallbackBase(); final TestIntfPrx p2 = TestIntfPrxHelper.checkedCast(o); final CountDownLatch waitSignal = new CountDownLatch(1); p2.begin_op(new Callback_TestIntf_op() - { + { @Override public void response() { @@ -622,12 +622,12 @@ public class AllTests } cb.called(); } - + @Override public void exception(Ice.LocalException ex) { test(false); - + } }); executor.submit(new Runnable() { @@ -645,7 +645,7 @@ public class AllTests thread[0].interrupt(); } }); - + try { waitSignal.await(); @@ -657,7 +657,7 @@ public class AllTests ic.destroy(); cb.check(); - + executor.shutdown(); while(!executor.isTerminated()) { @@ -677,10 +677,10 @@ public class AllTests { test(false); } - + @Override public void exception(Ice.LocalException ex) - { + { test(false); } @@ -718,7 +718,7 @@ public class AllTests ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(1); Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); - initData.properties.setProperty("ClientTestAdapter.Endpoints", "default -p 12030"); + initData.properties.setProperty("ClientTestAdapter.Endpoints", "default"); Ice.Communicator ic = app.initialize(initData); final Ice.ObjectAdapter adapter = ic.createObjectAdapter("ClientTestAdapter"); adapter.activate(); @@ -769,7 +769,7 @@ public class AllTests test(false); } mainThread.interrupt(); - } + } }; executor.execute(interruptMainThread); @@ -806,7 +806,7 @@ public class AllTests } ic.destroy(); - + executor.shutdown(); while(!executor.isTerminated()) { @@ -814,7 +814,7 @@ public class AllTests } } out.println("ok"); - + p.shutdown(); } } diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Client.java b/java-compat/test/src/main/java/test/Ice/interrupt/Client.java index 371286e2b20..9ca60d0a905 100644 --- a/java-compat/test/src/main/java/test/Ice/interrupt/Client.java +++ b/java-compat/test/src/main/java/test/Ice/interrupt/Client.java @@ -29,8 +29,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt"); // // We need to enable the ThreadInterruptSafe property so that Ice is diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java b/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java index 61d24074a80..56ba300f47a 100644 --- a/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java @@ -38,8 +38,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt"); // // We need to enable the ThreadInterruptSafe property so that Ice is @@ -51,11 +50,11 @@ public class Collocated extends test.Util.Application // buffers to fill up. // initData.properties.setProperty("Ice.MessageSizeMax", "20000"); - - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); - + return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Server.java b/java-compat/test/src/main/java/test/Ice/interrupt/Server.java index 0ab16417b99..715004a1307 100644 --- a/java-compat/test/src/main/java/test/Ice/interrupt/Server.java +++ b/java-compat/test/src/main/java/test/Ice/interrupt/Server.java @@ -30,8 +30,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt"); // // We need to enable the ThreadInterruptSafe property so that Ice is @@ -49,8 +48,8 @@ public class Server extends test.Util.Application // initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/run.py b/java-compat/test/src/main/java/test/Ice/interrupt/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/interrupt/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java b/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java index ab7a1a20cf1..d370d7afab3 100644 --- a/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java @@ -233,9 +233,11 @@ public class AllTests } public static MyClassPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrxHelper.checkedCast(base); MyClassPrx oneway = MyClassPrxHelper.uncheckedCast(cl.ice_oneway()); diff --git a/java-compat/test/src/main/java/test/Ice/invoke/Client.java b/java-compat/test/src/main/java/test/Ice/invoke/Client.java index dc376487ffe..7ccfebdbdf0 100644 --- a/java-compat/test/src/main/java/test/Ice/invoke/Client.java +++ b/java-compat/test/src/main/java/test/Ice/invoke/Client.java @@ -16,19 +16,19 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - MyClassPrx myClass = AllTests.allTests(communicator(), getWriter()); - + MyClassPrx myClass = AllTests.allTests(this); + // // Use reflection to load lambda.AllTests as that is only supported with Java >= 1.8 - // + // try { Class<?> cls = IceInternal.Util.findClass("test.Ice.invoke.lambda.AllTests", null); if(cls != null) { - java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests", - new Class<?>[]{Ice.Communicator.class, java.io.PrintWriter.class}); - allTests.invoke(null, communicator(), getWriter()); + java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests", + new Class<?>[]{test.Util.Application.class}); + allTests.invoke(null, this); } } catch(java.lang.NoSuchMethodException ex) @@ -43,7 +43,7 @@ public class Client extends test.Util.Application { throw new RuntimeException(ex); } - + myClass.shutdown(); return 0; @@ -52,8 +52,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/invoke/Server.java b/java-compat/test/src/main/java/test/Ice/invoke/Server.java index 9ce06acc55b..60c8d65791d 100644 --- a/java-compat/test/src/main/java/test/Ice/invoke/Server.java +++ b/java-compat/test/src/main/java/test/Ice/invoke/Server.java @@ -23,7 +23,7 @@ public class Server extends test.Util.Application } } - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.addServantLocator(new ServantLocatorI(async), ""); adapter.activate(); @@ -33,8 +33,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java b/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java index 49af565024c..c1bc1c8bc17 100644 --- a/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java @@ -26,7 +26,7 @@ public class AllTests throw new RuntimeException(); } } - + private static class Callback { Callback() @@ -156,9 +156,11 @@ public class AllTests } public static MyClassPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrxHelper.checkedCast(base); MyClassPrx oneway = MyClassPrxHelper.uncheckedCast(cl.ice_oneway()); @@ -172,7 +174,7 @@ public class AllTests outS.writeString(testString); outS.endEncapsulation(); byte[] inEncaps = outS.finished(); - + // begin_ice_invoke with Callback_Object_ice_invoke Callback_Object_opStringI cb2 = new Callback_Object_opStringI(communicator); cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps, diff --git a/java-compat/test/src/main/java/test/Ice/invoke/run.py b/java-compat/test/src/main/java/test/Ice/invoke/run.py deleted file mode 100755 index cc257835523..00000000000 --- a/java-compat/test/src/main/java/test/Ice/invoke/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 - -TestUtil.queueClientServerTest(configName = "blobject", message = "Running test with Blobject server.") -TestUtil.queueClientServerTest(configName = "blobjectAsync", message = "Running test with BlobjectAsync server.", - additionalServerOptions = "--async") -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/location/AllTests.java b/java-compat/test/src/main/java/test/Ice/location/AllTests.java index 06eae325c60..8b6d3fb74ee 100644 --- a/java-compat/test/src/main/java/test/Ice/location/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/location/AllTests.java @@ -43,7 +43,7 @@ public class AllTests PrintWriter out = app.getWriter(); ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast( - communicator.stringToProxy("ServerManager :default -p 12010")); + communicator.stringToProxy("ServerManager :" + app.getTestEndpoint(0))); test(manager != null); TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator()); diff --git a/java-compat/test/src/main/java/test/Ice/location/Client.java b/java-compat/test/src/main/java/test/Ice/location/Client.java index e792640fb08..9f7d3464afa 100644 --- a/java-compat/test/src/main/java/test/Ice/location/Client.java +++ b/java-compat/test/src/main/java/test/Ice/location/Client.java @@ -40,10 +40,9 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); - initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); + initData.properties.setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/location/Server.java b/java-compat/test/src/main/java/test/Ice/location/Server.java index 1a3a98351be..ac03dd65434 100644 --- a/java-compat/test/src/main/java/test/Ice/location/Server.java +++ b/java-compat/test/src/main/java/test/Ice/location/Server.java @@ -17,7 +17,7 @@ public class Server extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - + // // Register the server manager. The server manager creates a new // 'server' (a server isn't a different process, it's just a new @@ -49,12 +49,11 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2"); initData.properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0"); - initData.properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("ServerManagerAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); _initData = initData; return initData; diff --git a/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java b/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java index 293b9dcfb97..bbd4fbcb1d3 100644 --- a/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java +++ b/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java @@ -19,10 +19,10 @@ public class ServerManagerI extends _ServerManagerDisp { _registry = registry; _communicators = new java.util.ArrayList<Ice.Communicator>(); - + _app = app; _initData = initData; - + _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter"); _initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); _initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2"); @@ -54,13 +54,13 @@ public class ServerManagerI extends _ServerManagerDisp // Use fixed port to ensure that OA re-activation doesn't re-use previous port from // another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter). // - serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + _nextPort++); - serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p " + _nextPort++); + serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", _app.getTestEndpoint(_nextPort++)); + serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", _app.getTestEndpoint(_nextPort++)); Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2"); - Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010"); + Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:" + _app.getTestEndpoint(0)); adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); @@ -68,7 +68,7 @@ public class ServerManagerI extends _ServerManagerDisp _registry.addObject(adapter.add(object, Ice.Util.stringToIdentity("test"))); _registry.addObject(adapter.add(object, Ice.Util.stringToIdentity("test2"))); adapter.add(object, Ice.Util.stringToIdentity("test3")); - + adapter.activate(); adapter2.activate(); } @@ -88,5 +88,5 @@ public class ServerManagerI extends _ServerManagerDisp private java.util.List<Ice.Communicator> _communicators; private Ice.InitializationData _initData; private test.Util.Application _app; - private int _nextPort = 12011; + private int _nextPort = 1; } diff --git a/java-compat/test/src/main/java/test/Ice/location/run.py b/java-compat/test/src/main/java/test/Ice/location/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/location/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java b/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java index c936ca8d989..b6dc5ba4099 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java @@ -18,8 +18,8 @@ public class AMDServer extends test.Util.Application Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new AMDMetricsI(), Ice.Util.stringToIdentity("metrics")); adapter.activate(); - - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); @@ -30,10 +30,9 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); initData.properties.setProperty("Ice.Admin.InstanceName", "server"); initData.properties.setProperty("Ice.Warn.Connections", "0"); diff --git a/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java b/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java index 52f450eca64..654250f6a43 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java @@ -25,8 +25,12 @@ public class AllTests } } - static IceMX.ConnectionMetrics - getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected) + static String getPort(Ice.PropertiesAdminPrx p) + { + return Integer.toString(test.Util.Application.getTestPort(p.ice_getCommunicator().getProperties(), 0)); + } + + static IceMX.ConnectionMetrics getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected) { try { @@ -129,7 +133,7 @@ public class AllTests map += "Map." + m + '.'; } props.put("IceMX.Metrics.View." + map + "Reject.parent", "Ice\\.Admin"); - props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", "12010"); + props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", getPort(p)); props.put("IceMX.Metrics.View." + map + "Reject.identity", ".*/admin|controller"); return props; } @@ -152,7 +156,7 @@ public class AllTests map += "Map." + m + '.'; } props.put("IceMX.Metrics.View." + map + "Reject.parent", "Ice\\.Admin|Controller"); - props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", "12010"); + props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", getPort(p)); return props; } @@ -438,11 +442,19 @@ public class AllTests return m; } - static MetricsPrx - allTests(Ice.Communicator communicator, PrintWriter out, CommunicatorObserverI obsv) + static MetricsPrx allTests(test.Util.Application app, CommunicatorObserverI obsv) throws IceMX.UnknownMetricsView { - MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:default -p 12010")); + PrintWriter out = app.getWriter(); + Ice.Communicator communicator = app.communicator(); + + String host = app.getTestHost(); + String port = Integer.toString(app.getTestPort(0)); + String hostAndPort = host + ":" + port; + String protocol = app.getTestProtocol(); + String endpoint = protocol + " -h " + host + " -p " + port; + + MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:" + app.getTestEndpoint(0))); boolean collocated = metrics.ice_getConnection() == null; int threadCount = 4; @@ -543,8 +555,6 @@ public class AllTests out.println("ok"); - String endpoint = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp") + - " -h 127.0.0.1 -p 12010"; String type = ""; String isSecure = ""; if(!collocated) @@ -631,7 +641,7 @@ public class AllTests test(map.get("active").current == 1); ControllerPrx controller = ControllerPrxHelper.checkedCast( - communicator.stringToProxy("controller:default -p 12011")); + communicator.stringToProxy("controller:" + app.getTestEndpoint(1))); controller.hold(); map = toMap(clientMetrics.getMetricsView("View", timestamp).get("Connection")); @@ -703,16 +713,16 @@ public class AllTests testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", isSecure, out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500", out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010", out); + testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", host, out); + testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", port, out); testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "false", out); testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "", out); testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1", out); + testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", host, out); //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010", out); + testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", host, out); + testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", port, out); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "", out); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "", out); @@ -734,13 +744,13 @@ public class AllTests test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1); IceMX.Metrics m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0]; - test(m1.current == 0 && m1.total == 1 && m1.id.equals("127.0.0.1:12010")); + test(m1.current == 0 && m1.total == 1 && m1.id.equals(hostAndPort)); metrics.ice_getConnection().close(false); controller.hold(); try { - communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping(); + communicator.stringToProxy("test:" + endpoint).ice_timeout(10).ice_ping(); test(false); } catch(Ice.ConnectTimeoutException ex) @@ -753,14 +763,14 @@ public class AllTests controller.resume(); test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1); m1 = clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment")[0]; - test(m1.id.equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2); + test(m1.id.equals(hostAndPort) && m1.total == 3 && m1.failures == 2); checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "::Ice::ConnectTimeoutException", 2, out); Connect c = new Connect(metrics); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c, out); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c, + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", hostAndPort, c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint", endpoint + " -t 60000", c, out); @@ -774,9 +784,9 @@ public class AllTests out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c, out); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c, + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", host, c, out); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c, + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", port, c, out); out.println("ok"); @@ -788,7 +798,8 @@ public class AllTests updateProps(clientProps, serverProps, update, props, "EndpointLookup"); test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 0); - Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite"); + Ice.ObjectPrx prx = + communicator.stringToProxy("metrics:" + protocol + " -p " + port + " -h localhost -t 500"); prx.ice_ping(); test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 1); @@ -800,7 +811,7 @@ public class AllTests boolean dnsException = false; try { - communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping(); + communicator.stringToProxy("test:tcp -t 500 -h unknownfoo.zeroc.com -p " + port).ice_ping(); test(false); } catch(Ice.DNSException ex) @@ -813,11 +824,11 @@ public class AllTests } test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 2); m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[0]; - if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500")) + if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p " + port + " -t 500")) { m1 = clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup")[1]; } - test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 && + test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p " + port + " -t 500") && m1.total == 2 && (!dnsException || m1.failures == 2)); if(dnsException) { @@ -835,10 +846,10 @@ public class AllTests testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", type, c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", isSecure, c, out); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c, out); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "500", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c, out); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c, out); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", port, c, out); out.println("ok"); } @@ -935,16 +946,16 @@ public class AllTests testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", isSecure, op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "60000", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", host, op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", port, op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "true", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op, out); - //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", host, op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", port, op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", host, op, out); + //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", port, op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op, out); } diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Client.java b/java-compat/test/src/main/java/test/Ice/metrics/Client.java index e2cc47bbdfc..fd5b6de6bfd 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/Client.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/Client.java @@ -19,7 +19,7 @@ public class Client extends test.Util.Application Ice.Communicator communicator = communicator(); try { - MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer); + MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); } catch(Ice.UserException ex) @@ -34,8 +34,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics"); initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); initData.properties.setProperty("Ice.Admin.InstanceName", "client"); diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java b/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java index 98320001330..8820832f9b4 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java @@ -22,14 +22,14 @@ public class Collocated extends test.Util.Application adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller")); //controllerAdapter.activate(); // Don't activate OA to ensure collocation is used. try { - MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer); + MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); } catch(Ice.UserException ex) @@ -44,8 +44,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); if(initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0) { // With background IO, collocated invocations are @@ -57,7 +56,7 @@ public class Collocated extends test.Util.Application initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); initData.properties.setProperty("Ice.Admin.InstanceName", "client"); initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.MessageSizeMax", "50000"); diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Server.java b/java-compat/test/src/main/java/test/Ice/metrics/Server.java index b4512bfdc4b..59cc91d0a75 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/Server.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/Server.java @@ -19,7 +19,7 @@ public class Server extends test.Util.Application adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics")); adapter.activate(); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); @@ -30,10 +30,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); initData.properties.setProperty("Ice.Admin.InstanceName", "server"); initData.properties.setProperty("Ice.Warn.Connections", "0"); diff --git a/java-compat/test/src/main/java/test/Ice/metrics/run.py b/java-compat/test/src/main/java/test/Ice/metrics/run.py deleted file mode 100755 index 88b29abdfd1..00000000000 --- a/java-compat/test/src/main/java/test/Ice/metrics/run.py +++ /dev/null @@ -1,28 +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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.metrics.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java b/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java index 4ec21083e4a..a7fcda6f000 100644 --- a/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java @@ -31,10 +31,16 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); + int proxyPort = communicator.getProperties().getPropertyAsInt("Ice.HTTPProxyPort"); + if(proxyPort == 0) + { + proxyPort = communicator.getProperties().getPropertyAsInt("Ice.SOCKSProxyPort"); + } + TestIntfPrx test = TestIntfPrxHelper.checkedCast(obj); test(test != null); @@ -56,7 +62,7 @@ public class AllTests info = (Ice.IPConnectionInfo)p; } } - 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. } out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java b/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java index a3972a06b9b..74a860526f9 100644 --- a/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java +++ b/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java @@ -23,8 +23,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java b/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java index 1c0838f37a3..d877161f9c9 100644 --- a/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java +++ b/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java @@ -34,10 +34,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/run.py b/java-compat/test/src/main/java/test/Ice/networkProxy/run.py deleted file mode 100755 index fa8d2fcbb15..00000000000 --- a/java-compat/test/src/main/java/test/Ice/networkProxy/run.py +++ /dev/null @@ -1,46 +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") diff --git a/java-compat/test/src/main/java/test/Ice/objects/AllTests.java b/java-compat/test/src/main/java/test/Ice/objects/AllTests.java index c9808354927..6b4cd9e8726 100644 --- a/java-compat/test/src/main/java/test/Ice/objects/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/objects/AllTests.java @@ -46,11 +46,13 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -262,7 +264,7 @@ public class AllTests out.print("testing UnexpectedObjectException..."); out.flush(); - ref = "uoet:default -p 12010"; + ref = "uoet:" + app.getTestEndpoint(0); base = communicator.stringToProxy(ref); test(base != null); UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base); diff --git a/java-compat/test/src/main/java/test/Ice/objects/Client.java b/java-compat/test/src/main/java/test/Ice/objects/Client.java index aa1039edb9f..db2b3f2114a 100644 --- a/java-compat/test/src/main/java/test/Ice/objects/Client.java +++ b/java-compat/test/src/main/java/test/Ice/objects/Client.java @@ -88,7 +88,7 @@ public class Client extends test.Util.Application communicator.addObjectFactory(new MyObjectFactory(), "TestOF"); - InitialPrx initial = AllTests.allTests(communicator, getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } @@ -96,8 +96,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/objects/Collocated.java b/java-compat/test/src/main/java/test/Ice/objects/Collocated.java index 3540ad70b0a..9298d7626da 100644 --- a/java-compat/test/src/main/java/test/Ice/objects/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/objects/Collocated.java @@ -87,13 +87,13 @@ public class Collocated extends test.Util.Application communicator.addObjectFactory(new MyObjectFactory(), "TestOF"); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Initial initial = new InitialI(adapter); adapter.add(initial, Ice.Util.stringToIdentity("initial")); UnexpectedObjectExceptionTestI object = new UnexpectedObjectExceptionTestI(); adapter.add(object, Ice.Util.stringToIdentity("uoet")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); // We must call shutdown even in the collocated case for cyclic // dependency cleanup initial.shutdown(); @@ -103,8 +103,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/objects/Server.java b/java-compat/test/src/main/java/test/Ice/objects/Server.java index 49a7c0fa174..04e8c2100ac 100644 --- a/java-compat/test/src/main/java/test/Ice/objects/Server.java +++ b/java-compat/test/src/main/java/test/Ice/objects/Server.java @@ -56,10 +56,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/objects/run.py b/java-compat/test/src/main/java/test/Ice/objects/run.py deleted file mode 100755 index c0e22437de7..00000000000 --- a/java-compat/test/src/main/java/test/Ice/objects/run.py +++ /dev/null @@ -1,35 +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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java b/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java index 25437cbe39b..cdfff703aee 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java @@ -14,7 +14,7 @@ public class AMDServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDMyDerivedClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -24,8 +24,7 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // It's possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java b/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java index 1e18aa3fa0d..82373eba6c8 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java @@ -16,7 +16,7 @@ public class AMDTieServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new _MyDerivedClassTie(new AMDTieMyDerivedClassI()), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -26,8 +26,7 @@ public class AMDTieServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // It's possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread diff --git a/java-compat/test/src/main/java/test/Ice/operations/AllTests.java b/java-compat/test/src/main/java/test/Ice/operations/AllTests.java index 59e6e065ba1..b8eaba844a4 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/operations/AllTests.java @@ -18,10 +18,12 @@ import test.Ice.operations.Test.MyDerivedClassPrxHelper; public class AllTests { public static MyClassPrx - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); - String ref = "test:default -p 12010"; + PrintWriter out = app.getWriter(); + + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrxHelper.checkedCast(base); MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl); diff --git a/java-compat/test/src/main/java/test/Ice/operations/Client.java b/java-compat/test/src/main/java/test/Ice/operations/Client.java index d5f0d7713b5..4aa12f32507 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Client.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { java.io.PrintWriter out = getWriter(); - MyClassPrx myClass = AllTests.allTests(this, out); + MyClassPrx myClass = AllTests.allTests(this); out.print("testing server shutdown... "); out.flush(); @@ -38,8 +38,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations"); diff --git a/java-compat/test/src/main/java/test/Ice/operations/Collocated.java b/java-compat/test/src/main/java/test/Ice/operations/Collocated.java index b10f13a54e0..199b73e789d 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Collocated.java @@ -14,8 +14,7 @@ public class Collocated extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - java.io.PrintWriter out = getWriter(); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. @@ -25,7 +24,7 @@ public class Collocated extends test.Util.Application throw new RuntimeException(); } - AllTests.allTests(this, out); + AllTests.allTests(this); return 0; } @@ -33,8 +32,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); if(initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0 || isAndroid()) { initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2"); diff --git a/java-compat/test/src/main/java/test/Ice/operations/Server.java b/java-compat/test/src/main/java/test/Ice/operations/Server.java index ae7d1de57bd..d1e8ed39e05 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Server.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -24,8 +24,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // It's possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread diff --git a/java-compat/test/src/main/java/test/Ice/operations/TieServer.java b/java-compat/test/src/main/java/test/Ice/operations/TieServer.java index 189fe433be7..6c0047e57e5 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/TieServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/TieServer.java @@ -16,7 +16,7 @@ public class TieServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new _MyDerivedClassTie(new TieMyDerivedClassI()), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -26,8 +26,7 @@ public class TieServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // It's possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread diff --git a/java-compat/test/src/main/java/test/Ice/operations/Twoways.java b/java-compat/test/src/main/java/test/Ice/operations/Twoways.java index 7ca7d7e45c7..189c448d309 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Twoways.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Twoways.java @@ -55,9 +55,9 @@ class Twoways twoways(Application app, MyClassPrx p) { Communicator communicator = app.communicator(); - + String[] literals = p.opStringLiterals(); - + test(s0.value.equals("\\") && s0.value.equals(sw0.value) && s0.value.equals(literals[0]) && @@ -72,8 +72,8 @@ class Twoways s2.value.equals(sw2.value) && s2.value.equals(literals[2]) && s2.value.equals(literals[13])); - - test(s3.value.equals("A21") && + + test(s3.value.equals("A21") && s3.value.equals(sw3.value) && s3.value.equals(literals[3]) && s3.value.equals(literals[14])); @@ -102,7 +102,7 @@ class Twoways s8.value.equals(sw8.value) && s8.value.equals(literals[8]) && s8.value.equals(literals[19])); - + test(s9.value.equals("\uD83C\uDF4C") && s9.value.equals(sw9.value) && s9.value.equals(literals[9]) && @@ -112,14 +112,14 @@ class Twoways s10.value.equals(sw10.value) && s10.value.equals(literals[10]) && s10.value.equals(literals[21])); - + test(ss0.value.equals("\'\"\u003f\\\u0007\b\f\n\r\t\u000b\6") && ss0.value.equals(ss1.value) && ss0.value.equals(ss2.value) && ss0.value.equals(literals[22]) && ss0.value.equals(literals[23]) && ss0.value.equals(literals[24])); - + test(ss3.value.equals("\\\\U\\u\\") && ss3.value.equals(literals[25])); @@ -128,7 +128,7 @@ class Twoways test(ss5.value.equals("\\u0041\\") && ss5.value.equals(literals[27])); - + test(su0.value.equals(su1.value) && su0.value.equals(su2.value) && su0.value.equals(literals[28]) && @@ -1507,7 +1507,7 @@ class Twoways ctx.put("two", "TWO"); ctx.put("three", "THREE"); - MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:default -p 12010")); + MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); @@ -1571,7 +1571,7 @@ class Twoways p.opIdempotent(); p.opNonmutating(); - + test(p.opByte1((byte)0xFF) == (byte)0xFF); test(p.opShort1((short)0x7FFF) == (short)0x7FFF); test(p.opInt1(0x7FFFFFFF) == 0x7FFFFFFF); @@ -1583,8 +1583,8 @@ class Twoways test(p.opByteBoolD1(null).size() == 0); test(p.opStringS2(null).length == 0); test(p.opByteBoolD2(null).size() == 0); - - + + MyDerivedClassPrx d = MyDerivedClassPrxHelper.uncheckedCast(p); MyStruct1 s = new MyStruct1(); s.tesT = "Test.MyStruct1.s"; diff --git a/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java b/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java index bd9701c27c5..7a0a441d27c 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java +++ b/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java @@ -120,38 +120,38 @@ class TwowaysAMI private boolean _called; } - + private static class GenericCallback<T> extends Callback { public GenericCallback(T value) { _value = value; } - + public void response(T value) { _value = value; _succeeded = true; called(); } - + public void exception(Ice.LocalException ex) { _succeeded = false; called(); } - + public boolean succeeded() { check(); return _succeeded; } - + public T value() { return _value; } - + private T _value; private boolean _succeeded = false; } @@ -2692,7 +2692,7 @@ class TwowaysAMI ctx.put("two", "TWO"); ctx.put("three", "THREE"); - MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:default -p 12010")); + MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); @@ -2770,7 +2770,7 @@ class TwowaysAMI derived.begin_opDerived(cb); cb.check(); } - + { final GenericCallback<Byte> cb = new GenericCallback<Byte>((byte)0); p.begin_opByte1((byte)0xFF, @@ -2780,7 +2780,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2788,7 +2788,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == (byte)0xFF); } - + { final GenericCallback<Short> cb = new GenericCallback<Short>((short)0); p.begin_opShort1((short)0x7FFF, @@ -2798,7 +2798,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2806,7 +2806,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 0x7FFF); } - + { final GenericCallback<Integer> cb = new GenericCallback<Integer>(0); p.begin_opInt1(0x7FFFFFFF, @@ -2816,7 +2816,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2824,7 +2824,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 0x7FFFFFFF); } - + { final GenericCallback<Long> cb = new GenericCallback<Long>((long)0); p.begin_opLong1(0x7FFFFFFF, @@ -2834,7 +2834,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2842,7 +2842,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 0x7FFFFFFF); } - + { final GenericCallback<Float> cb = new GenericCallback<Float>(0.0f); p.begin_opFloat1(1.0f, @@ -2852,7 +2852,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2860,7 +2860,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 1.0f); } - + { final GenericCallback<Double> cb = new GenericCallback<Double>(0.0); p.begin_opDouble1(1.0, @@ -2870,7 +2870,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2878,7 +2878,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 1.0); } - + { final GenericCallback<String> cb = new GenericCallback<String>(""); p.begin_opString1("opString1", @@ -2888,7 +2888,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2896,7 +2896,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value().equals("opString1")); } - + { final GenericCallback<String[]> cb = new GenericCallback<String[]>(null); p.begin_opStringS1(null, @@ -2906,7 +2906,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2914,7 +2914,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value().length == 0); } - + { final GenericCallback<Map<Byte, Boolean>> cb = new GenericCallback<Map<Byte, Boolean>>(null); p.begin_opByteBoolD1(null, @@ -2924,7 +2924,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); diff --git a/java-compat/test/src/main/java/test/Ice/operations/run.py b/java-compat/test/src/main/java/test/Ice/operations/run.py deleted file mode 100755 index 2049cd7eeb6..00000000000 --- a/java-compat/test/src/main/java/test/Ice/operations/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 - -TestUtil.queueClientServerTest(additionalClientOptions = "--Ice.Warn.AMICallback=0") - -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", - server="test.Ice.operations.AMDServer") - -TestUtil.queueClientServerTest(configName = "tie", localOnly = True, message = "Running test with tie server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", - server="test.Ice.operations.TieServer") - -TestUtil.queueClientServerTest(configName = "amdTie", localOnly = True, message = "Running test with AMD tie server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", - server="test.Ice.operations.AMDTieServer") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java b/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java index 99cab219be1..c43bc740e7a 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java @@ -14,7 +14,7 @@ public class AMDServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDInitialI(), Ice.Util.stringToIdentity("initial")); adapter.activate(); @@ -24,8 +24,7 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional.AMD"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/optional/AllTests.java b/java-compat/test/src/main/java/test/Ice/optional/AllTests.java index 5680234d11d..0e66fb1c8fb 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/optional/AllTests.java @@ -24,8 +24,9 @@ public class AllTests } public static InitialPrx - allTests(test.Util.Application app, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { + PrintWriter out = app.getWriter(); Ice.Communicator communicator = app.communicator(); FactoryI factory = new FactoryI(); @@ -33,7 +34,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -2349,8 +2350,8 @@ public class AllTests if(cls != null) { java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests", - new Class<?>[]{test.Util.Application.class, java.io.PrintWriter.class}); - allTests.invoke(null, app, out); + new Class<?>[]{test.Util.Application.class}); + allTests.invoke(null, app); } } catch(java.lang.NoSuchMethodException ex) diff --git a/java-compat/test/src/main/java/test/Ice/optional/Client.java b/java-compat/test/src/main/java/test/Ice/optional/Client.java index 8714a642be3..2c82fb72b60 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/Client.java +++ b/java-compat/test/src/main/java/test/Ice/optional/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - java.io.PrintWriter out = getWriter(); - InitialPrx initial = AllTests.allTests(this, false, out); + InitialPrx initial = AllTests.allTests(this, false); initial.shutdown(); return 0; } @@ -25,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/optional/Server.java b/java-compat/test/src/main/java/test/Ice/optional/Server.java index d4429d5a94d..39d8f4798da 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/Server.java +++ b/java-compat/test/src/main/java/test/Ice/optional/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial")); adapter.activate(); @@ -24,8 +24,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java b/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java index 19fa4e7b2a9..f41a1cb3a51 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java @@ -23,7 +23,7 @@ public class AllTests throw new RuntimeException(); } } - + private static class CallbackBase { CallbackBase() @@ -62,11 +62,12 @@ public class AllTests } public static InitialPrx - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); InitialPrx initial = InitialPrxHelper.uncheckedCast(base); @@ -74,7 +75,7 @@ public class AllTests out.print("testing optional parameters with async lambda callbacks... "); out.flush(); final boolean reqParams = initial.supportsRequiredParams(); - + final boolean supportsJavaSerializable = initial.supportsJavaSerializable(); { @@ -82,16 +83,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opByte(p1.get(), - (Ice.ByteOptional ret, Ice.ByteOptional p2) -> + (Ice.ByteOptional ret, Ice.ByteOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opByte(p1, - (Ice.ByteOptional ret, Ice.ByteOptional p2) -> + (Ice.ByteOptional ret, Ice.ByteOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -103,16 +104,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opBool(p1.get(), - (Ice.BooleanOptional ret, Ice.BooleanOptional p2) -> + (Ice.BooleanOptional ret, Ice.BooleanOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opBool(p1, - (Ice.BooleanOptional ret, Ice.BooleanOptional p2) -> + (Ice.BooleanOptional ret, Ice.BooleanOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -124,7 +125,7 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opShort(p1.get(), - (Ice.ShortOptional ret, Ice.ShortOptional p2) -> + (Ice.ShortOptional ret, Ice.ShortOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -132,7 +133,7 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opShort(p1, - (Ice.ShortOptional ret, Ice.ShortOptional p2) -> + (Ice.ShortOptional ret, Ice.ShortOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -144,16 +145,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opInt(p1.get(), - (Ice.IntOptional ret, Ice.IntOptional p2) -> + (Ice.IntOptional ret, Ice.IntOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opInt(p1, - (Ice.IntOptional ret, Ice.IntOptional p2) -> + (Ice.IntOptional ret, Ice.IntOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -165,16 +166,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opLong(p1.get(), - (Ice.LongOptional ret, Ice.LongOptional p2) -> + (Ice.LongOptional ret, Ice.LongOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opLong(p1, - (Ice.LongOptional ret, Ice.LongOptional p2) -> + (Ice.LongOptional ret, Ice.LongOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -186,16 +187,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opFloat(p1.get(), - (Ice.FloatOptional ret, Ice.FloatOptional p2) -> + (Ice.FloatOptional ret, Ice.FloatOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFloat(p1, - (Ice.FloatOptional ret, Ice.FloatOptional p2) -> + (Ice.FloatOptional ret, Ice.FloatOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -207,16 +208,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opDouble(p1.get(), - (Ice.DoubleOptional ret, Ice.DoubleOptional p2) -> + (Ice.DoubleOptional ret, Ice.DoubleOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opDouble(p1, - (Ice.DoubleOptional ret, Ice.DoubleOptional p2) -> + (Ice.DoubleOptional ret, Ice.DoubleOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -228,16 +229,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opString(p1.get(), - (Ice.Optional<String> ret, Ice.Optional<String> p2) -> + (Ice.Optional<String> ret, Ice.Optional<String> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opString(p1, - (Ice.Optional<String> ret, Ice.Optional<String> p2) -> + (Ice.Optional<String> ret, Ice.Optional<String> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -249,16 +250,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opMyEnum(p1.get(), - (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) -> + (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opMyEnum(p1, - (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) -> + (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -270,16 +271,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStruct(p1.get(), - (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) -> + (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStruct(p1, - (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) -> + (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -291,16 +292,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStruct(p1.get(), - (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) -> + (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStruct(p1, - (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) -> + (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -312,16 +313,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opVarStruct(p1.get(), - (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) -> + (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opVarStruct(p1, - (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) -> + (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -333,18 +334,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opOneOptional(p1.get(), - (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) -> - cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() && + (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) -> + cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() && ret.get().getA() == p1.get().getA()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opOneOptional(p1, - (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) -> - cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() && + (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) -> + cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() && ret.get().getA() == p1.get().getA()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -357,16 +358,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opOneOptionalProxy(p1.get(), - (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) -> + (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opOneOptionalProxy(p1, - (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) -> + (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -376,22 +377,22 @@ public class AllTests { Ice.Optional<byte[]> p1 = new Ice.Optional<byte[]>(new byte[100]); java.util.Arrays.fill(p1.get(), (byte)56); - + { final CallbackBase cb = new CallbackBase(); initial.begin_opByteSeq(p1.get(), - (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opByteSeq(p1, - (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -404,18 +405,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opBoolSeq(p1.get(), - (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) -> + (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opBoolSeq(p1, - (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -428,18 +429,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opShortSeq(p1.get(), - (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) -> + (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opShortSeq(p1, - (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -452,18 +453,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opIntSeq(p1.get(), - (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) -> + (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opIntSeq(p1, - (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -476,18 +477,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opLongSeq(p1.get(), - (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) -> + (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opLongSeq(p1, - (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -500,18 +501,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opFloatSeq(p1.get(), - (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) -> + (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { CallbackBase cb = new CallbackBase(); initial.begin_opFloatSeq(p1, - (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -524,18 +525,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opDoubleSeq(p1.get(), - (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) -> + (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { CallbackBase cb = new CallbackBase(); initial.begin_opDoubleSeq(p1, - (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -548,18 +549,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opStringSeq(p1.get(), - (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) -> + (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opStringSeq(p1, - (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -573,28 +574,28 @@ public class AllTests { p1.get()[i] = new SmallStruct(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStructSeq(p1.get(), - (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) -> + (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStructSeq(p1, - (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } } - + { Ice.Optional<java.util.List<SmallStruct>> p1 = new Ice.Optional<java.util.List<SmallStruct>>(); p1.set(new java.util.ArrayList<SmallStruct>()); @@ -602,20 +603,20 @@ public class AllTests { p1.get().add(new SmallStruct()); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStructList(p1.get(), - (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) -> + (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { CallbackBase cb = new CallbackBase(); initial.begin_opSmallStructList(p1, - (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) -> + (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -629,28 +630,28 @@ public class AllTests { p1.get()[i] = new FixedStruct(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStructSeq(p1.get(), - (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) -> + (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStructSeq(p1, - (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } } - + { Ice.Optional<java.util.List<FixedStruct>> p1 = new Ice.Optional<java.util.List<FixedStruct>>(); p1.set(new java.util.ArrayList<FixedStruct>()); @@ -658,20 +659,20 @@ public class AllTests { p1.get().add(new FixedStruct()); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStructList(p1.get(), - (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) -> + (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStructList(p1, - (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) -> + (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -685,22 +686,22 @@ public class AllTests { p1.get()[i] = new VarStruct(""); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opVarStructSeq(p1.get(), - (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) -> + (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opVarStructSeq(p1, - (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -713,16 +714,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opSerializable(p1.get(), - (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) -> + (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSerializable(p1, - (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) -> + (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -734,22 +735,22 @@ public class AllTests p1.set(new java.util.HashMap<Integer, Integer>()); p1.get().put(1, 2); p1.get().put(2, 3); - + { final CallbackBase cb = new CallbackBase(); initial.begin_opIntIntDict(p1.get(), - (Ice.Optional<java.util.Map<Integer, Integer>> ret, - Ice.Optional<java.util.Map<Integer, Integer>> p2) -> + (Ice.Optional<java.util.Map<Integer, Integer>> ret, + Ice.Optional<java.util.Map<Integer, Integer>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opIntIntDict(p1, - (Ice.Optional<java.util.Map<Integer, Integer>> ret, - Ice.Optional<java.util.Map<Integer, Integer>> p2) -> + (Ice.Optional<java.util.Map<Integer, Integer>> ret, + Ice.Optional<java.util.Map<Integer, Integer>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -761,22 +762,22 @@ public class AllTests p1.set(new java.util.HashMap<String, Integer>()); p1.get().put("1", 1); p1.get().put("2", 2); - + { final CallbackBase cb = new CallbackBase(); initial.begin_opStringIntDict(p1.get(), - (Ice.Optional<java.util.Map<String, Integer>> ret, - Ice.Optional<java.util.Map<String, Integer>> p2) -> + (Ice.Optional<java.util.Map<String, Integer>> ret, + Ice.Optional<java.util.Map<String, Integer>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opStringIntDict(p1, - (Ice.Optional<java.util.Map<String, Integer>> ret, - Ice.Optional<java.util.Map<String, Integer>> p2) -> + (Ice.Optional<java.util.Map<String, Integer>> ret, + Ice.Optional<java.util.Map<String, Integer>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); diff --git a/java-compat/test/src/main/java/test/Ice/optional/run.py b/java-compat/test/src/main/java/test/Ice/optional/run.py deleted file mode 100755 index 6c82786dc7f..00000000000 --- a/java-compat/test/src/main/java/test/Ice/optional/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 - -TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.") -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.optional.AMDServer") -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java b/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java index d2a9afed7b0..ecb1de12da8 100644 --- a/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java @@ -31,11 +31,13 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/Client.java b/java-compat/test/src/main/java/test/Ice/packagemd/Client.java index bf5c86e5fb7..5f8fb6d66de 100644 --- a/java-compat/test/src/main/java/test/Ice/packagemd/Client.java +++ b/java-compat/test/src/main/java/test/Ice/packagemd/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - InitialPrx initial = AllTests.allTests(communicator(), getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } @@ -24,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/Server.java b/java-compat/test/src/main/java/test/Ice/packagemd/Server.java index 2f7abf04cf4..2f600913ca4 100644 --- a/java-compat/test/src/main/java/test/Ice/packagemd/Server.java +++ b/java-compat/test/src/main/java/test/Ice/packagemd/Server.java @@ -25,11 +25,10 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/run.py b/java-compat/test/src/main/java/test/Ice/packagemd/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/packagemd/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/plugin/Client.java b/java-compat/test/src/main/java/test/Ice/plugin/Client.java index 1cb30d326a1..a6dbea204cb 100644 --- a/java-compat/test/src/main/java/test/Ice/plugin/Client.java +++ b/java-compat/test/src/main/java/test/Ice/plugin/Client.java @@ -154,14 +154,6 @@ public class Client extends test.Util.Application return 0; } - @Override - protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) - { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); - return initData; - } - private Ice.InitializationData createInitData() { Ice.InitializationData initData = createInitializationData() ; diff --git a/java-compat/test/src/main/java/test/Ice/plugin/run.py b/java-compat/test/src/main/java/test/Ice/plugin/run.py deleted file mode 100755 index 7f28bf562d9..00000000000 --- a/java-compat/test/src/main/java/test/Ice/plugin/run.py +++ /dev/null @@ -1,31 +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 - -sys.stdout.write("starting test... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.plugin.Client",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() - diff --git a/java-compat/test/src/main/java/test/Ice/properties/run.py b/java-compat/test/src/main/java/test/Ice/properties/run.py deleted file mode 100755 index 0a5cf0452e6..00000000000 --- a/java-compat/test/src/main/java/test/Ice/properties/run.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -# -# Write config -# -if sys.version_info[0] == 2: - configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config" - decodedPath = configPath.decode("utf-8") -else: - configPath = "./config/\u4e2d\u56fd_client.config" - decodedPath = configPath # No need to decode with Python3, strings are already Unicode - -TestUtil.createFile(decodedPath, - ["# Automatically generated by Ice test driver.", - "Ice.Trace.Protocol=1", - "Ice.Trace.Network=1", - "Ice.ProgramName=PropertiesClient", - "Config.Path=" + configPath], - "utf-8") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.properties.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() - -if os.path.exists(decodedPath): - os.remove(decodedPath) diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java b/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java index 82defd2909a..0e98e7bb319 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java @@ -25,10 +25,9 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java index 305eb63914d..ed2561faf1b 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java @@ -27,11 +27,14 @@ public class AllTests } public static MyClassPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); @@ -353,7 +356,7 @@ public class AllTests out.flush(); Ice.Properties prop = communicator.getProperties(); String propertyPrefix = "Foo.Proxy"; - prop.setProperty(propertyPrefix, "test:default -p 12010"); + prop.setProperty(propertyPrefix, "test:" + app.getTestEndpoint(0)); b1 = communicator.propertyToProxy(propertyPrefix); test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 && b1.ice_getAdapterId().length() == 0 && b1.ice_getFacet().length() == 0); @@ -397,7 +400,7 @@ public class AllTests //test(b1.ice_getLocatorCacheTimeout() == 60); //prop.setProperty("Ice.Default.LocatorCacheTimeout", ""); - prop.setProperty(propertyPrefix, "test:default -p 12010"); + prop.setProperty(propertyPrefix, "test:" + app.getTestEndpoint(0)); property = propertyPrefix + ".Router"; test(b1.ice_getRouter() == null); @@ -761,7 +764,7 @@ public class AllTests out.print("testing encoding versioning... "); out.flush(); - String ref20 = "test -e 2.0:default -p 12010"; + String ref20 = "test -e 2.0:" + app.getTestEndpoint(0); MyClassPrx cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -773,7 +776,7 @@ public class AllTests // Server 2.0 endpoint doesn't support 1.1 version. } - String ref10 = "test -e 1.0:default -p 12010"; + String ref10 = "test -e 1.0:" + app.getTestEndpoint(0); MyClassPrx cl10 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10)); cl10.ice_ping(); cl10.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); @@ -781,7 +784,7 @@ public class AllTests // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the // call will use the 1.1 encoding - String ref13 = "test -e 1.3:default -p 12010"; + String ref13 = "test -e 1.3:" + app.getTestEndpoint(0); MyClassPrx cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.end_ice_ping(cl13.begin_ice_ping()); @@ -830,7 +833,7 @@ public class AllTests out.print("testing protocol versioning... "); out.flush(); - ref20 = "test -p 2.0:default -p 12010"; + ref20 = "test -p 2.0:" + app.getTestEndpoint(0); cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -842,13 +845,13 @@ public class AllTests // Server 2.0 proxy doesn't support 1.0 version. } - ref10 = "test -p 1.0:default -p 12010"; + ref10 = "test -p 1.0:" + app.getTestEndpoint(0); cl10 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10)); cl10.ice_ping(); // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the // call will use the 1.1 protocol - ref13 = "test -p 1.3:default -p 12010"; + ref13 = "test -p 1.3:" + app.getTestEndpoint(0); cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.end_ice_ping(cl13.begin_ice_ping()); @@ -981,10 +984,6 @@ public class AllTests // Working? boolean ssl = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("ssl"); boolean tcp = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("tcp"); - if(tcp) - { - p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); - } // Two legal TCP endpoints expressed as opaque endpoints p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); @@ -1007,23 +1006,6 @@ public class AllTests } // - // Try to invoke on the SSL endpoint to verify that we get a - // NoEndpointException (or ConnectFailedException when - // running with SSL). - // - if(ssl) - { - try - { - p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); - test(false); - } - catch(Ice.ConnectFailedException ex) - { - } - } - - // // Test that the proxy with an SSL endpoint and a nonsense // endpoint (which the server doesn't understand either) can // be sent over the wire and returned by the server without diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Client.java b/java-compat/test/src/main/java/test/Ice/proxy/Client.java index a3c40117591..ec338175b33 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/Client.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - MyClassPrx myClass = AllTests.allTests(communicator, getWriter()); + MyClassPrx myClass = AllTests.allTests(this); myClass.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java b/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java index 5823e8d25c5..16f2ca75bc4 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java @@ -15,12 +15,12 @@ public class Collocated extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -28,8 +28,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Server.java b/java-compat/test/src/main/java/test/Ice/proxy/Server.java index fd6252a37d1..a957c153be8 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/Server.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/Server.java @@ -24,10 +24,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/proxy/run.py b/java-compat/test/src/main/java/test/Ice/proxy/run.py deleted file mode 100755 index 0d0598cb160..00000000000 --- a/java-compat/test/src/main/java/test/Ice/proxy/run.py +++ /dev/null @@ -1,28 +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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.proxy.AMDServer") -TestUtil.queueCollocatedTest(additionalOptions = "--Ice.ToStringMode=Compat") -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/retry/Client.java b/java-compat/test/src/main/java/test/Ice/retry/Client.java index 37048d507c3..6c68fcd77ca 100644 --- a/java-compat/test/src/main/java/test/Ice/retry/Client.java +++ b/java-compat/test/src/main/java/test/Ice/retry/Client.java @@ -33,8 +33,8 @@ public class Client extends test.Util.Application try { - RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation, - "retry:default -p 12010"); + RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation, + "retry:" + getTestEndpoint(0)); retry.shutdown(); return 0; } @@ -47,8 +47,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.observer = instrumentation.getObserver(); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); diff --git a/java-compat/test/src/main/java/test/Ice/retry/Collocated.java b/java-compat/test/src/main/java/test/Ice/retry/Collocated.java index 1faf02f0889..2fe2dcaa8d3 100644 --- a/java-compat/test/src/main/java/test/Ice/retry/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/retry/Collocated.java @@ -15,7 +15,7 @@ public class Collocated extends test.Util.Application { private Instrumentation instrumentation = new Instrumentation(); - private void + private void setupObjectAdapter(Ice.Communicator communicator) { Ice.ObjectAdapter adapter = communicator.createObjectAdapter(""); @@ -57,8 +57,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.observer = instrumentation.getObserver(); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); diff --git a/java-compat/test/src/main/java/test/Ice/retry/Server.java b/java-compat/test/src/main/java/test/Ice/retry/Server.java index 8d4a4f6209e..bbaa9a40c5d 100644 --- a/java-compat/test/src/main/java/test/Ice/retry/Server.java +++ b/java-compat/test/src/main/java/test/Ice/retry/Server.java @@ -24,10 +24,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/retry/run.py b/java-compat/test/src/main/java/test/Ice/retry/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/retry/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java b/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java index e19857ff333..fa0a2953ba8 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java @@ -25,10 +25,9 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java b/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java index dd47cd787d0..1eae6596303 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java @@ -16,9 +16,12 @@ import test.Ice.seqMapping.Test.*; public class AllTests { public static MyClassPrx - allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrxHelper.checkedCast(baseProxy); diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java index 293f3ea0b9d..02bb1ca1ba2 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java @@ -18,8 +18,7 @@ public class Client extends test.Util.Application run(String[] args) { java.io.PrintWriter out = getWriter(); - - MyClassPrx myClass = AllTests.allTests(communicator(), false, out); + MyClassPrx myClass = AllTests.allTests(this, false); out.print("shutting down server... "); out.flush(); @@ -32,8 +31,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java index 755e0248197..708b51f3145 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java @@ -15,12 +15,11 @@ public class Collocated extends test.Util.Application public int run(String[] args) { - java.io.PrintWriter out = getWriter(); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator(), true, out); + AllTests.allTests(this, true); return 0; } @@ -28,10 +27,9 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java index 21eff24ab1c..a7e4668dcb6 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java @@ -25,10 +25,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/run.py b/java-compat/test/src/main/java/test/Ice/seqMapping/run.py deleted file mode 100755 index 685319f3cae..00000000000 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/run.py +++ /dev/null @@ -1,28 +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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.seqMapping.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java b/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java index 202de5696da..046729624f3 100644 --- a/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java @@ -23,9 +23,12 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { - String ref = "initial:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); InitialPrx initial = InitialPrxHelper.checkedCast(base); diff --git a/java-compat/test/src/main/java/test/Ice/serialize/Client.java b/java-compat/test/src/main/java/test/Ice/serialize/Client.java index ca504c66b15..ca15188d2ba 100644 --- a/java-compat/test/src/main/java/test/Ice/serialize/Client.java +++ b/java-compat/test/src/main/java/test/Ice/serialize/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application public int run(String[] args) { - java.io.PrintWriter out = getWriter(); - InitialPrx initial = AllTests.allTests(communicator(), false, out); + InitialPrx initial = AllTests.allTests(this, false); initial.shutdown(); return 0; } @@ -25,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/serialize/Server.java b/java-compat/test/src/main/java/test/Ice/serialize/Server.java index a0658f19668..86f178851c8 100644 --- a/java-compat/test/src/main/java/test/Ice/serialize/Server.java +++ b/java-compat/test/src/main/java/test/Ice/serialize/Server.java @@ -27,10 +27,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/serialize/run.py b/java-compat/test/src/main/java/test/Ice/serialize/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/serialize/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java index 77f66d39142..ee29901269c 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java @@ -27,10 +27,9 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java index de9b90ee2d9..82311d12880 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java @@ -208,11 +208,13 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "asm:default -p 12010"; + String ref = "asm:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -228,7 +230,7 @@ public class AllTests out.flush(); try { - ObjectPrx o = communicator.stringToProxy("category/locate:default -p 12010"); + ObjectPrx o = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); o.ice_ids(); test(false); } @@ -243,7 +245,7 @@ public class AllTests try { - ObjectPrx o = communicator.stringToProxy("category/finished:default -p 12010"); + ObjectPrx o = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0)); o.ice_ids(); test(false); } @@ -259,11 +261,11 @@ public class AllTests out.print("testing servant locator... "); out.flush(); - base = communicator.stringToProxy("category/locate:default -p 12010"); + base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(base); try { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010")); + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { @@ -272,20 +274,20 @@ public class AllTests out.print("testing default servant locator... "); out.flush(); - base = communicator.stringToProxy("anothercat/locate:default -p 12010"); + base = communicator.stringToProxy("anothercat/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(base); - base = communicator.stringToProxy("locate:default -p 12010"); + base = communicator.stringToProxy("locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(base); try { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010")); + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { } try { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010")); + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { @@ -294,14 +296,14 @@ public class AllTests out.print("testing locate exceptions... "); out.flush(); - base = communicator.stringToProxy("category/locate:default -p 12010"); + base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(base); testExceptions(obj); out.println("ok"); out.print("testing finished exceptions... "); out.flush(); - base = communicator.stringToProxy("category/finished:default -p 12010"); + base = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(base); testExceptions(obj); @@ -345,7 +347,7 @@ public class AllTests out.print("testing servant locator removal... "); out.flush(); - base = communicator.stringToProxy("test/activation:default -p 12010"); + base = communicator.stringToProxy("test/activation:" + app.getTestEndpoint(0)); TestActivationPrx activation = TestActivationPrxHelper.checkedCast(base); activation.activateServantLocator(false); try diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java index fa676eb383c..ab46dee3fd5 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - TestIntfPrx obj = AllTests.allTests(communicator(), getWriter()); + TestIntfPrx obj = AllTests.allTests(this); obj.shutdown(); return 0; } @@ -24,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java index 6e4fbf4e820..79bbb951f35 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application adapter.addServantLocator(new ServantLocatorI(""), ""); adapter.add(new TestI(), Ice.Util.stringToIdentity("asm")); adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation")); - AllTests.allTests(communicator(), getWriter()); + AllTests.allTests(this); return 0; } @@ -27,10 +27,9 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java index 9559c24a7a4..ed0590ca113 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java @@ -26,10 +26,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/run.py b/java-compat/test/src/main/java/test/Ice/servantLocator/run.py deleted file mode 100755 index 205d37b5a05..00000000000 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/run.py +++ /dev/null @@ -1,28 +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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.servantLocator.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java index 220b71f7e03..7db445c67a3 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java @@ -24,11 +24,10 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.serverAMD"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + " -t 2000"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java index 366afbe8f01..3e937c14bd0 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java @@ -714,11 +714,14 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, boolean collocated, java.io.PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { - out.print("testing stringToProxy... "); + Ice.Communicator communicator = app.communicator(); + java.io.PrintWriter out = app.getWriter(); + + out.print("testing stringToProxy... "); out.flush(); - String ref = "Test:default -p 12010 -t 10000"; + String ref = "Test:" + app.getTestEndpoint(0) + " -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java index bf5aa54559a..231b5514711 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.client"); return initData; } @@ -25,7 +24,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - TestIntfPrx test = AllTests.allTests(communicator(), false, getWriter()); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java index 183f1dd91d8..bd79812ef1e 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java @@ -24,11 +24,10 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.server"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + " -t 2000"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index e796b96ceef..00000000000 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,40 +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(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server="test.Ice.slicing.exceptions.AMDServer") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="test.Ice.slicing.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java index 529194081fe..fb293721927 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java @@ -25,11 +25,10 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.serverAMD"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + " -t 2000"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java index d8080a02248..b0bc6ccb3b5 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java @@ -1319,11 +1319,14 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "Test:default -p 12010 -t 10000"; + String ref = "Test:" + app.getTestEndpoint(0) + " -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java index f6eb48a34f0..24b3fc53ec1 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, false, getWriter()); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.client"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java index 629716506f6..e9a326454fa 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java @@ -25,11 +25,10 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.server"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + " -t 2000"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py b/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py deleted file mode 100755 index 89a4d8598ea..00000000000 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,40 +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(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server="test.Ice.slicing.objects.AMDServer") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="test.Ice.slicing.objects.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/stream/Client.java b/java-compat/test/src/main/java/test/Ice/stream/Client.java index 103222e8820..56ab0cb8d57 100644 --- a/java-compat/test/src/main/java/test/Ice/stream/Client.java +++ b/java-compat/test/src/main/java/test/Ice/stream/Client.java @@ -845,8 +845,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.stream"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/stream/run.py b/java-compat/test/src/main/java/test/Ice/stream/run.py deleted file mode 100755 index 66636d7a5c1..00000000000 --- a/java-compat/test/src/main/java/test/Ice/stream/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with default encoding...") -TestUtil.simpleTest("test.Ice.stream.Client") - -print("Running test with 1.0 encoding...") -TestUtil.simpleTest("test.Ice.stream.Client", "--Ice.Default.EncodingVersion=1.0") diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java index d9b17b4e55c..0dfee9822cc 100644 --- a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java +++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java @@ -27,7 +27,7 @@ public class Client extends test.Util.Application public int run(String[] args) { java.io.PrintWriter out = getWriter(); - Ice.ObjectPrx object = communicator().stringToProxy("test:default -p 12010 -t 10000"); + Ice.ObjectPrx object = communicator().stringToProxy("test:" + getTestEndpoint(0) + " -t 10000"); PriorityPrx priority = PriorityPrxHelper.checkedCast(object); out.print("testing thread priority... "); out.flush(); diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java index 68ae4707319..220c455539f 100644 --- a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java +++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 10000:udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new PriorityI(), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -25,8 +25,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "10"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/throughput/Client.java b/java-compat/test/src/main/java/test/Ice/throughput/Client.java index 22bfc5ce894..ea891ac0a0f 100644 --- a/java-compat/test/src/main/java/test/Ice/throughput/Client.java +++ b/java-compat/test/src/main/java/test/Ice/throughput/Client.java @@ -144,14 +144,14 @@ public class Client extends test.Util.Application throughput.recvStringSeq(); throughput.recvStructSeq(); throughput.recvFixedSeq(); - + throughput.echoByteSeq(emptyBytes); throughput.echoStringSeq(emptyStrings); throughput.echoStructSeq(emptyStructs); throughput.echoFixedSeq(emptyFixed); } throughput.endWarmup(); - + out.println(" ok"); } */ @@ -163,7 +163,7 @@ public class Client extends test.Util.Application // Initial ping to setup the connection. throughput.ice_ping(); - + String[] input = { "t", "o", "r", "e", "s", "x", null }; int inputIndex = 0; String line = null; @@ -223,20 +223,20 @@ public class Client extends test.Util.Application out.print("sending"); break; } - + case 'r': { out.print("receiving"); break; } - + case 'e': { out.print("sending and receiving"); break; } } - + out.print(" " + repetitions); switch(currentType) { @@ -264,17 +264,17 @@ public class Client extends test.Util.Application break; } } - + out.print(" sequences of size " + seqSize); - + if(c == 'o') { out.print(" as oneway"); } - + out.println("..."); out.flush(); - + for(int i = 0; i < repetitions; ++i) { switch(currentType) @@ -288,19 +288,19 @@ public class Client extends test.Util.Application throughput.sendByteSeq(byteSeq); break; } - + case 'o': { throughputOneway.sendByteSeq(byteSeq); break; } - + case 'r': { throughput.recvByteSeq(); break; } - + case 'e': { throughput.echoByteSeq(byteSeq); @@ -319,19 +319,19 @@ public class Client extends test.Util.Application throughput.sendStringSeq(stringSeq); break; } - + case 'o': { throughputOneway.sendStringSeq(stringSeq); break; } - + case 'r': { throughput.recvStringSeq(); break; } - + case 'e': { throughput.echoStringSeq(stringSeq); @@ -350,19 +350,19 @@ public class Client extends test.Util.Application throughput.sendStructSeq(structSeq); break; } - + case 'o': { throughputOneway.sendStructSeq(structSeq); break; } - + case 'r': { throughput.recvStructSeq(); break; } - + case 'e': { throughput.echoStructSeq(structSeq); @@ -381,19 +381,19 @@ public class Client extends test.Util.Application throughput.sendFixedSeq(fixedSeq); break; } - + case 'o': { throughputOneway.sendFixedSeq(fixedSeq); break; } - + case 'r': { throughput.recvFixedSeq(); break; } - + case 'e': { throughput.echoFixedSeq(fixedSeq); @@ -472,12 +472,11 @@ public class Client extends test.Util.Application return 0; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput"); initData.properties.setProperty("Throughput.Proxy", "throughput:default -p 10000 -h 127.0.0.1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/throughput/Server.java b/java-compat/test/src/main/java/test/Ice/throughput/Server.java index fb81f2fc963..824c4259cf3 100644 --- a/java-compat/test/src/main/java/test/Ice/throughput/Server.java +++ b/java-compat/test/src/main/java/test/Ice/throughput/Server.java @@ -20,12 +20,11 @@ public class Server extends test.Util.Application adapter.activate(); return WAIT; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput"); initData.properties.setProperty("Throughput.Endpoints", "default -p 10000 -h 127.0.0.1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/throughput/test.py b/java-compat/test/src/main/java/test/Ice/throughput/test.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/java-compat/test/src/main/java/test/Ice/throughput/test.py diff --git a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java index 42b9040a932..09edf2bc28e 100644 --- a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java @@ -138,7 +138,7 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "timeout:default -p 12010"; + String sref = "timeout:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Client.java b/java-compat/test/src/main/java/test/Ice/timeout/Client.java index 1de8964d87b..6f33f6f0f74 100644 --- a/java-compat/test/src/main/java/test/Ice/timeout/Client.java +++ b/java-compat/test/src/main/java/test/Ice/timeout/Client.java @@ -24,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout"); // diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Server.java b/java-compat/test/src/main/java/test/Ice/timeout/Server.java index 3d4982f6305..bd940a0eb9d 100644 --- a/java-compat/test/src/main/java/test/Ice/timeout/Server.java +++ b/java-compat/test/src/main/java/test/Ice/timeout/Server.java @@ -24,10 +24,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); // // Limit the recv buffer size, this test relies on the socket // send() blocking after sending a given amount of data. diff --git a/java-compat/test/src/main/java/test/Ice/timeout/run.py b/java-compat/test/src/main/java/test/Ice/timeout/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/timeout/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java-compat/test/src/main/java/test/Ice/udp/AllTests.java b/java-compat/test/src/main/java/test/Ice/udp/AllTests.java index 1e43756d12e..22e8c47e0ae 100644 --- a/java-compat/test/src/main/java/test/Ice/udp/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/udp/AllTests.java @@ -74,7 +74,7 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030"); + communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter"); PingReplyI replyI = new PingReplyI(); @@ -84,7 +84,7 @@ public class AllTests out.print("testing udp... "); out.flush(); - Ice.ObjectPrx base = communicator.stringToProxy("test -d:udp -p 12010"); + Ice.ObjectPrx base = communicator.stringToProxy("test -d:" + app.getTestEndpoint(0, "udp")); TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(base); int nRetry = 5; diff --git a/java-compat/test/src/main/java/test/Ice/udp/Client.java b/java-compat/test/src/main/java/test/Ice/udp/Client.java index 585531f0253..471917a159f 100644 --- a/java-compat/test/src/main/java/test/Ice/udp/Client.java +++ b/java-compat/test/src/main/java/test/Ice/udp/Client.java @@ -19,7 +19,7 @@ public class Client extends test.Util.Application AllTests.allTests(this); int num; - try + try { num = args.length == 1 ? Integer.parseInt(args[0]) : 1; } @@ -29,7 +29,8 @@ public class Client extends test.Util.Application } for(int i = 0; i < num; ++i) { - TestIntfPrxHelper.uncheckedCast(communicator().stringToProxy("control:tcp -p " + (12010 + i))).shutdown(); + TestIntfPrxHelper.uncheckedCast(communicator().stringToProxy("control:" + + getTestEndpoint(i, "tcp"))).shutdown(); } return 0; } @@ -37,8 +38,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); diff --git a/java-compat/test/src/main/java/test/Ice/udp/Server.java b/java-compat/test/src/main/java/test/Ice/udp/Server.java index 02b6fca4ab1..9c0288ed22c 100644 --- a/java-compat/test/src/main/java/test/Ice/udp/Server.java +++ b/java-compat/test/src/main/java/test/Ice/udp/Server.java @@ -16,7 +16,7 @@ public class Server extends test.Util.Application { Ice.Properties properties = communicator().getProperties(); - int port = 12010; + int port = 0; try { port += args.length == 1 ? Integer.parseInt(args[0]) : 0; @@ -24,14 +24,14 @@ public class Server extends test.Util.Application catch(NumberFormatException ex) { } - properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port); + properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(port, "tcp")); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter"); adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control")); adapter.activate(); - if(port == 12010) + if(port == 0) { - properties.setProperty("TestAdapter.Endpoints", "udp -p 12010"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(port, "udp")); Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter"); adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test")); adapter2.activate(); @@ -50,8 +50,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); diff --git a/java-compat/test/src/main/java/test/Ice/udp/run.py b/java-compat/test/src/main/java/test/Ice/udp/run.py deleted file mode 100755 index 4b3a05010e2..00000000000 --- a/java-compat/test/src/main/java/test/Ice/udp/run.py +++ /dev/null @@ -1,43 +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.addClasspath(os.path.join(os.getcwd(), "classes")) - -num = 5 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer("test.Ice.udp.Server", "%d" % i , adapter="McastTestAdapter")) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.udp.Client", "%d" % num, startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/IceBox/admin/Client.java b/java-compat/test/src/main/java/test/IceBox/admin/Client.java index 474c874e3e9..f14032e10ec 100644 --- a/java-compat/test/src/main/java/test/IceBox/admin/Client.java +++ b/java-compat/test/src/main/java/test/IceBox/admin/Client.java @@ -28,8 +28,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); return initData; } diff --git a/java-compat/test/src/main/java/test/IceBox/admin/run.py b/java-compat/test/src/main/java/test/IceBox/admin/run.py deleted file mode 100755 index 6ebb72ea3f2..00000000000 --- a/java-compat/test/src/main/java/test/IceBox/admin/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 - -icebox = TestUtil.getIceBox() -config = os.path.join(os.getcwd(), "config.icebox") - -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % config, server=icebox) - -sys.stdout.write("testing iceboxadmin... ") -sys.stdout.flush() - -admin = TestUtil.getIceBoxAdmin() -adminconfig = os.path.join(os.getcwd(), "config.admin") - -ib = TestUtil.startServer(icebox, args = '--Ice.Config=\"%s\"' % config) -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" stop TestService' % adminconfig) -iba.waitTestSuccess() -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" start TestService' % adminconfig) -iba.waitTestSuccess() -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" shutdown' % adminconfig) -iba.waitTestSuccess() -ib.waitTestSuccess() - -print("ok") diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java b/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java index 8035fb508d1..1fed8dd4608 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java +++ b/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java @@ -26,12 +26,18 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { - TestIntfPrx service1 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010")); - TestIntfPrx service2 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011")); - TestIntfPrx service3 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12012")); - TestIntfPrx service4 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12013")); + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + TestIntfPrx service1 = + TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(0))); + TestIntfPrx service2 = + TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(1))); + TestIntfPrx service3 = + TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(2))); + TestIntfPrx service4 = + TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(3))); if(service1.getProperty("IceBox.InheritProperties").equals("")) { diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/Client.java b/java-compat/test/src/main/java/test/IceBox/configuration/Client.java index 1417b0b37f8..b12cf385780 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/Client.java +++ b/java-compat/test/src/main/java/test/IceBox/configuration/Client.java @@ -15,7 +15,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); // // Shutdown the IceBox server. @@ -28,8 +28,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.IceBox.configuration"); initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); return initData; diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1 index 6028e615ff5..3e38245a5d0 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1 +++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1 @@ -1,4 +1,4 @@ -Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1 +Service1OA.Endpoints=default -p 12010 -h 127.0.0.1 #Ice.ProgramName Service=1 diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2 index c173914db2a..835acbadfc9 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2 +++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2 @@ -1,4 +1,4 @@ -Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1 +Service1OA.Endpoints=default -p 12010 -h 127.0.0.1 #Ice.ProgramName Service1.Prop=1 diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2 index 78e08aadba6..95d33831a14 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service2 +++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2 @@ -1,4 +1,4 @@ -Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1 +Service2OA.Endpoints=default -p 12011 -h 127.0.0.1 Ice.ProgramName=Test Service=2 diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2 index 36c8d0812cb..6ed8dc9df49 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2 +++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2 @@ -1,4 +1,4 @@ -Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1 +Service2OA.Endpoints=default -p 12011 -h 127.0.0.1 #Ice.ProgramName Service2.Prop=1 diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service3 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service3 index c93ed144701..6cba4b351b0 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service3 +++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service3 @@ -1,4 +1,4 @@ -Service3OA.Endpoints=tcp -p 12012 -h 127.0.0.1 +Service3OA.Endpoints=default -p 12012 -h 127.0.0.1 #Ice.ProgramName Service=3 diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service4 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service4 index 182fb3a7289..a70120dd192 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service4 +++ b/java-compat/test/src/main/java/test/IceBox/configuration/config.service4 @@ -1,4 +1,4 @@ -Service4OA.Endpoints=tcp -p 12013 -h 127.0.0.1 +Service4OA.Endpoints=default -p 12013 -h 127.0.0.1 #Ice.ProgramName Service=4 diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/run.py b/java-compat/test/src/main/java/test/IceBox/configuration/run.py deleted file mode 100755 index 077936ccbe5..00000000000 --- a/java-compat/test/src/main/java/test/IceBox/configuration/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 - -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"), - server=TestUtil.getIceBox()) -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox2"), - server=TestUtil.getIceBox()) diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java b/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java index 28db45ec264..886bcc69293 100644 --- a/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java +++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java @@ -25,7 +25,7 @@ public class Server extends test.Util.Application { } - properties.setProperty("ControlAdapter.Endpoints", "default -p " + (12010 + num)); + properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num)); properties.setProperty("ControlAdapter.AdapterId", "control" + num); properties.setProperty("ControlAdapter.ThreadPool.Size", "1"); diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py b/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py deleted file mode 100755 index 86f25ed9c16..00000000000 --- a/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py +++ /dev/null @@ -1,52 +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 - -server = "test.IceDiscovery.simple.Server" -client = "test.IceDiscovery.simple.Client" - -num = 3 - -args = " --Ice.Plugin.IceDiscovery=IceDiscovery:IceDiscovery.PluginFactory" -args += " --IceDiscovery.Timeout=50" -args += " --IceDiscovery.RetryCount=5" -if not TestUtil.ipv6: - args += " --IceDiscovery.Interface=127.0.0.1" -elif TestUtil.isDarwin(): - args += " --IceDiscovery.Interface=\"::1\"" - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, "%d %s" % (i, args), count = 4)) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, "%d %s" % (num, args), startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java b/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java index c18faeeefdf..27aee3c8f12 100644 --- a/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java +++ b/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java @@ -70,7 +70,7 @@ public class AllTests IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast( communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry")); test(registry != null); - + try { IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar"); @@ -89,16 +89,17 @@ public class AllTests Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); initData.properties.setProperty("Ice.Default.Locator", ""); - initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", + initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory"); - if(System.getProperty("os.name").contains("OS X") && + if(System.getProperty("os.name").contains("OS X") && initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0) { initData.properties.setProperty("IceLocatorDiscovery.Interface", "::1"); } + initData.properties.setProperty("IceLocatorDiscovery.Port", Integer.toString(app.getTestPort(99))); initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter"); initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default"); - + Ice.Communicator com = Ice.Util.initialize(initData); test(com.getDefaultLocator() != null); com.stringToProxy("test @ TestAdapter").ice_ping(); @@ -116,7 +117,7 @@ public class AllTests // // Now, ensure that the IceGrid discovery locator correctly // handles failure to find a locator. - // + // initData.properties.setProperty("IceLocatorDiscovery.InstanceName", "unknown"); initData.properties.setProperty("IceLocatorDiscovery.RetryCount", "1"); initData.properties.setProperty("IceLocatorDiscovery.Timeout", "100"); @@ -161,8 +162,11 @@ public class AllTests } public static void - allTestsWithDeploy(Ice.Communicator communicator, PrintWriter out) + allTestsWithDeploy(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter"); diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/Client.java b/java-compat/test/src/main/java/test/IceGrid/simple/Client.java index c843e477fc5..33678d610c4 100644 --- a/java-compat/test/src/main/java/test/IceGrid/simple/Client.java +++ b/java-compat/test/src/main/java/test/IceGrid/simple/Client.java @@ -31,7 +31,7 @@ public class Client extends test.Util.Application } else { - AllTests.allTestsWithDeploy(communicator, getWriter()); + AllTests.allTestsWithDeploy(this); } return 0; @@ -40,8 +40,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple"); return initData; } diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/Server.java b/java-compat/test/src/main/java/test/IceGrid/simple/Server.java index e1ea3916029..47eb34d8c54 100644 --- a/java-compat/test/src/main/java/test/IceGrid/simple/Server.java +++ b/java-compat/test/src/main/java/test/IceGrid/simple/Server.java @@ -34,12 +34,11 @@ public class Server extends test.Util.Application //defaultInterrupt(); return 0; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // Its possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread @@ -55,7 +54,7 @@ public class Server extends test.Util.Application { Server c = new Server(); int status = c.main("test.IceGrid.simple.Server", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/simple_server.xml b/java-compat/test/src/main/java/test/IceGrid/simple/application.xml index 9ebc5d95a72..9ebc5d95a72 100644 --- a/java-compat/test/src/main/java/test/IceGrid/simple/simple_server.xml +++ b/java-compat/test/src/main/java/test/IceGrid/simple/application.xml diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/run.py b/java-compat/test/src/main/java/test/IceGrid/simple/run.py deleted file mode 100755 index 8831f0a03ec..00000000000 --- a/java-compat/test/src/main/java/test/IceGrid/simple/run.py +++ /dev/null @@ -1,35 +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 - -# -# 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") diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java index d4d89c9f61e..66b78395236 100644 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java +++ b/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java @@ -116,10 +116,12 @@ public class AllTests } public static ServerFactoryPrx - allTests(test.Util.Application app, String testDir, PrintWriter out) + allTests(test.Util.Application app, String testDir) { Ice.Communicator communicator = app.communicator(); - final String factoryRef = "factory:tcp -p 12010"; + PrintWriter out = app.getWriter(); + + final String factoryRef = "factory:" + app.getTestEndpoint(0); Ice.ObjectPrx b = communicator.stringToProxy(factoryRef); test(b != null); ServerFactoryPrx factory = ServerFactoryPrxHelper.checkedCast(b); diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java b/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java index fb92b152d10..44c6a88d96a 100644 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java +++ b/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java @@ -25,7 +25,7 @@ public class Client extends test.Util.Application return 1; } - ServerFactoryPrx factory = AllTests.allTests(this, args[0], out); + ServerFactoryPrx factory = AllTests.allTests(this, args[0]); factory.shutdown(); return 0; @@ -34,8 +34,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration"); return initData; } diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java b/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java index 54aeb9a9f0f..5b579becce6 100644 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java +++ b/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java @@ -16,7 +16,7 @@ public class Server extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Identity id = Ice.Util.stringToIdentity("factory"); adapter.add(new ServerFactoryI(), id); @@ -29,8 +29,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration"); return initData; } diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/run.py b/java-compat/test/src/main/java/test/IceSSL/configuration/run.py deleted file mode 100755 index 2d87a19bc40..00000000000 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/run.py +++ /dev/null @@ -1,26 +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 - -testdir = '"%s"' % os.getcwd() - -TestUtil.clientServerTest(additionalClientOptions=testdir) diff --git a/java-compat/test/src/main/java/test/IceUtil/inputUtil/run.py b/java-compat/test/src/main/java/test/IceUtil/inputUtil/run.py deleted file mode 100755 index 7f349d5cef0..00000000000 --- a/java-compat/test/src/main/java/test/IceUtil/inputUtil/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.IceUtil.inputUtil.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Slice/generation/run.py b/java-compat/test/src/main/java/test/Slice/generation/run.py deleted file mode 100755 index 58c1f07b722..00000000000 --- a/java-compat/test/src/main/java/test/Slice/generation/run.py +++ /dev/null @@ -1,56 +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, re - -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 os.getcwd()!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -sys.stdout.write("testing list-generated... ") -sys.stdout.flush() - -slice2java = TestUtil.getSliceTranslator("java") -if not os.path.exists("classes"): - os.mkdir("classes") - -command = '"' + slice2java + '" --compat --list-generated --output-dir classes File1.ice File2.ice' -if TestUtil.debug: - sys.stdout.write("(%s) " % command) -p = TestUtil.runCommand(command) -lines1 = p.stdout.readlines() -lines2 = open(os.path.join(os.getcwd(), "list-generated.out"), "r").readlines() -if len(lines1) != len(lines2): - print("failed!") - sys.exit(1) - -i = 0 -while i < len(lines1): - if sys.version_info[0] == 2: - line1 = lines1[i].strip() - line2 = lines2[i].strip() - else: - line1 = lines1[i].decode("utf-8").strip() - line2 = lines2[i].strip() - if line1 != line2: - print("failed!") - sys.exit(1) - i = i + 1 -else: - print("ok") - -sys.exit(0) diff --git a/java-compat/test/src/main/java/test/Slice/keyword/Client.java b/java-compat/test/src/main/java/test/Slice/keyword/Client.java index 62f377f3fbe..240286789a0 100644 --- a/java-compat/test/src/main/java/test/Slice/keyword/Client.java +++ b/java-compat/test/src/main/java/test/Slice/keyword/Client.java @@ -37,7 +37,7 @@ public class Client catchI() { } - + @Override public void checkedCast_async(AMD_catch_checkedCast cb, int _clone, Ice.Current current) @@ -192,7 +192,7 @@ public class Client initData.properties.setProperty("Ice.Package._abstract", "test.Slice.keyword"); initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", "default"); // // We must set MessageSizeMax to an explicit values, diff --git a/java-compat/test/src/main/java/test/Slice/keyword/run.py b/java-compat/test/src/main/java/test/Slice/keyword/run.py deleted file mode 100755 index 851ddcd2d36..00000000000 --- a/java-compat/test/src/main/java/test/Slice/keyword/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.keyword.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Slice/macros/run.py b/java-compat/test/src/main/java/test/Slice/macros/run.py deleted file mode 100755 index a8b0dad4496..00000000000 --- a/java-compat/test/src/main/java/test/Slice/macros/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.macros.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Slice/structure/run.py b/java-compat/test/src/main/java/test/Slice/structure/run.py deleted file mode 100755 index ecb3cf4e54e..00000000000 --- a/java-compat/test/src/main/java/test/Slice/structure/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.structure.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Util/Application.java b/java-compat/test/src/main/java/test/Util/Application.java index 5c072418482..7cc08508e3a 100644 --- a/java-compat/test/src/main/java/test/Util/Application.java +++ b/java-compat/test/src/main/java/test/Util/Application.java @@ -15,7 +15,7 @@ public abstract class Application { public final int WAIT = 2; - + public interface ServerReadyListener { @@ -198,7 +198,10 @@ public abstract class Application // protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - return createInitializationData(); + Ice.InitializationData initData = createInitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + argsH.value = initData.properties.parseCommandLineOptions("Test", argsH.value); + return initData; } public java.io.PrintWriter getWriter() @@ -274,6 +277,62 @@ public abstract class Application return _classLoader; } + public String getTestEndpoint(int num) + { + return getTestEndpoint(num, ""); + } + + public String getTestEndpoint(Ice.Properties properties, int num) + { + return getTestEndpoint(properties, num, ""); + } + + public String getTestEndpoint(int num, String prot) + { + return getTestEndpoint(_communicator.getProperties(), num, prot); + } + + static public String getTestEndpoint(Ice.Properties properties, int num, String prot) + { + String protocol = prot; + if(protocol.isEmpty()) + { + protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "default"); + } + int basePort = properties.getPropertyAsIntWithDefault("Test.BasePort", 12010); + return protocol + " -p " + Integer.toString(basePort + num); + } + + public String getTestHost() + { + return getTestHost(_communicator.getProperties()); + } + + static public String getTestHost(Ice.Properties properties) + { + return properties.getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); + } + + public String getTestProtocol() + { + return getTestProtocol(_communicator.getProperties()); + } + + static public String getTestProtocol(Ice.Properties properties) + { + return properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + } + + public int getTestPort(int num) + { + return getTestPort(_communicator.getProperties(), num); + } + + static public int getTestPort(Ice.Properties properties, int num) + { + return properties.getPropertyAsIntWithDefault("Test.BasePort", 12010) + num; + } + private ClassLoader _classLoader; private String _testName; private Communicator _communicator; diff --git a/java/allTests.py b/java/allTests.py index 7ca52f7db4c..e4360c465d3 100755 --- a/java/allTests.py +++ b/java/allTests.py @@ -8,79 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("Slice/generation", ["once"]), - ("Slice/keyword", ["once"]), - ("Slice/macros", ["once"]), - ("Slice/structure", ["once"]), - ("IceUtil/inputUtil", ["once"]), - ("Ice/proxy", ["core"]), - ("Ice/operations", ["core"]), - ("Ice/seqMapping", ["core"]), - ("Ice/exceptions", ["core"]), - ("Ice/ami", ["core", "nocompress"]), - ("Ice/info", ["core", "noipv6", "nocompress", "nosocks"]), - ("Ice/inheritance", ["core"]), - ("Ice/facets", ["core"]), - ("Ice/objects", ["core"]), - ("Ice/binding", ["core"]), - ("Ice/faultTolerance", ["core"]), - ("Ice/location", ["core"]), - ("Ice/adapterDeactivation", ["core"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/custom", ["core"]), - ("Ice/checksum", ["core"]), - ("Ice/dispatcher", ["core"]), - ("Ice/interrupt", ["core", "nocompress"]), - ("Ice/packagemd", ["core"]), - ("Ice/stream", ["core"]), - ("Ice/hold", ["core"]), - ("Ice/retry", ["core"]), - ("Ice/timeout", ["core", "nocompress"]), - ("Ice/acm", ["core"]), - ("Ice/background", ["core", "nosocks"]), - ("Ice/servantLocator", ["core"]), - ("Ice/interceptor", ["core"]), - ("Ice/udp", ["core"]), - ("Ice/serialize", ["core"]), - ("Ice/defaultServant", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/threadPoolPriority", ["core"]), - ("Ice/classLoader", ["core"]), - ("Ice/invoke", ["core"]), - ("Ice/properties", ["once"]), - ("Ice/plugin", ["core"]), - ("Ice/hash", ["once"]), - ("Ice/optional", ["once"]), - ("Ice/admin", ["core"]), - ("Ice/metrics", ["core", "nows", "noipv6", "nocompress", "nosocks"]), - ("Ice/enums", ["once"]), - ("Ice/networkProxy", ["core", "noipv6", "nosocks"]), - ("IceBox/admin", ["core", "noipv6", "nomx"]), - ("IceBox/configuration", ["core", "noipv6", "nomx"]), - ("Glacier2/router", ["service"]), - ("Glacier2/sessionHelper", ["core"]), - ("IceDiscovery/simple", ["service"]), - ("IceGrid/simple", ["service"]), - ("IceSSL/configuration", ["once"]) - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java index bdf3aceed54..437d0f360e8 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java @@ -31,7 +31,7 @@ class EndpointHostResolver } } - synchronized void resolve(final String host, final int port, final com.zeroc.Ice.EndpointSelectionType selType, + synchronized void resolve(final String host, final int port, final com.zeroc.Ice.EndpointSelectionType selType, final IPEndpointI endpoint, final EndpointI_connectors callback) { // @@ -88,6 +88,7 @@ class EndpointHostResolver com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther); } + com.zeroc.Ice.Instrumentation.Observer obsv = observer; try { int protocol = _protocol; @@ -101,19 +102,23 @@ class EndpointHostResolver } } - callback.connectors(endpoint.connectors(Network.getAddresses(host, - port, - protocol, - selType, - _preferIPv6, - true), - networkProxy)); + java.util.List<java.net.InetSocketAddress> addresses = + Network.getAddresses(host, port, _protocol, selType, _preferIPv6, true); + + if(obsv != null) + { + obsv.detach(); + obsv = null; + } + + callback.connectors(endpoint.connectors(addresses, networkProxy)); } catch(com.zeroc.Ice.LocalException ex) { - if(observer != null) + if(obsv != null) { - observer.failed(ex.ice_id()); + obsv.failed(ex.ice_id()); + obsv.detach(); } callback.exception(ex); } @@ -125,10 +130,6 @@ class EndpointHostResolver com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle); } - if(observer != null) - { - observer.detach(); - } } } }); diff --git a/java/test/src/main/java/test/Glacier2/router/Client.java b/java/test/src/main/java/test/Glacier2/router/Client.java index c8fe174ee29..88026b6338e 100644 --- a/java/test/src/main/java/test/Glacier2/router/Client.java +++ b/java/test/src/main/java/test/Glacier2/router/Client.java @@ -33,7 +33,7 @@ public class Client extends test.Util.Application { out.print("testing stringToProxy for router... "); out.flush(); - routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347"); + routerBase = communicator().stringToProxy("Glacier2/router:" + getTestEndpoint(10)); out.println("ok"); } @@ -51,7 +51,7 @@ public class Client extends test.Util.Application out.print("testing router finder... "); out.flush(); com.zeroc.Ice.RouterFinderPrx finder = com.zeroc.Ice.RouterFinderPrx.uncheckedCast( - communicator().stringToProxy("Ice/RouterFinder:default -p 12347")); + communicator().stringToProxy("Ice/RouterFinder:" + getTestEndpoint(10))); test(finder.getRouter().ice_getIdentity().equals(router.ice_getIdentity())); out.println("ok"); } @@ -76,7 +76,7 @@ public class Client extends test.Util.Application { out.print("testing stringToProxy for server object... "); out.flush(); - base = communicator().stringToProxy("c1/callback:tcp -p 12010"); + base = communicator().stringToProxy("c1/callback:" + getTestEndpoint(0)); out.println("ok"); } @@ -335,6 +335,7 @@ public class Client extends test.Util.Application out.println("ok"); } + if(args.length >= 1 && args[0].equals("--shutdown")) { out.print("testing server shutdown... "); out.flush(); @@ -418,7 +419,7 @@ public class Client extends test.Util.Application { out.print("testing stringToProxy for process object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp")); out.println("ok"); } diff --git a/java/test/src/main/java/test/Glacier2/router/Server.java b/java/test/src/main/java/test/Glacier2/router/Server.java index 210ff1e4348..b872c6a87a8 100644 --- a/java/test/src/main/java/test/Glacier2/router/Server.java +++ b/java/test/src/main/java/test/Glacier2/router/Server.java @@ -13,7 +13,7 @@ public class Server extends test.Util.Application { public int run(String[] args) { - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010"); + communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); adapter.add(new CallbackI(), com.zeroc.Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category. diff --git a/java/test/src/main/java/test/Glacier2/router/run.py b/java/test/src/main/java/test/Glacier2/router/run.py deleted file mode 100755 index dc815f8eed0..00000000000 --- a/java/test/src/main/java/test/Glacier2/router/run.py +++ /dev/null @@ -1,53 +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 - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - ' --Glacier2.Filter.Category.AcceptUser="2"' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest() - -TestUtil.clientServerTest(additionalClientOptions=" --shutdown") - -starterProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java b/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java index b7c9010785b..9dd2c5062a0 100644 --- a/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java +++ b/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java @@ -34,7 +34,8 @@ public class Client extends test.Util.Application { GetInitDataResult r = super.getInitData(args); _initData = r.initData; - _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347"); + _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:" + + getTestEndpoint(_initData.properties, 10)); _initData.dispatcher = new com.zeroc.Ice.Dispatcher() { @Override @@ -49,8 +50,8 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - String protocol = communicator().getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - String host = communicator().getProperties().getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); + String protocol = getTestProtocol(); + String host = getTestHost(); _factory = new com.zeroc.Glacier2.SessionFactoryHelper(_initData, new com.zeroc.Glacier2.SessionCallback() { @@ -167,7 +168,7 @@ public class Client extends test.Util.Application out.print("testing SessionHelper connect interrupt... "); out.flush(); _factory.setRouterHost(host); - _factory.setPort(12011); + _factory.setPort(getTestPort(1)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); @@ -238,7 +239,7 @@ public class Client extends test.Util.Application out.print("testing SessionHelper connect... "); out.flush(); _factory.setRouterHost(host); - _factory.setPort(12347); + _factory.setPort(getTestPort(10)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); while(true) @@ -281,7 +282,7 @@ public class Client extends test.Util.Application out.print("testing stringToProxy for server object... "); out.flush(); - com.zeroc.Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:default -p 12010"); + com.zeroc.Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:" + getTestEndpoint(0)); out.println("ok"); out.print("pinging server after session creation... "); @@ -366,8 +367,7 @@ public class Client extends test.Util.Application com.zeroc.Ice.ObjectPrx processBase; { out.print("testing stringToProxy for process object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:default -h \"" + host + - "\" -p 12348"); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp")); out.println("ok"); } @@ -456,7 +456,7 @@ public class Client extends test.Util.Application out.flush(); _factory.setRouterHost(host); - _factory.setPort(12347); + _factory.setPort(getTestPort(10)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); while(true) diff --git a/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java b/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java index e7bb210aaf2..2bca2c09829 100644 --- a/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java +++ b/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java @@ -13,10 +13,10 @@ public class Server extends test.Util.Application { public int run(String[] args) { - communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", "default -p 12011"); + communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", getTestEndpoint(1)); communicator().createObjectAdapter("DeactivatedAdapter"); - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "default -p 12010"); + communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); adapter.add(new CallbackI(), com.zeroc.Ice.Util.stringToIdentity("callback")); adapter.activate(); diff --git a/java/test/src/main/java/test/Glacier2/sessionHelper/run.py b/java/test/src/main/java/test/Glacier2/sessionHelper/run.py deleted file mode 100755 index 6ce3382b360..00000000000 --- a/java/test/src/main/java/test/Glacier2/sessionHelper/run.py +++ /dev/null @@ -1,49 +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 - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="default"' \ - ' --Ice.Admin.Endpoints="default -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest(additionalClientOptions=" --shutdown") - -starterProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Ice/acm/AllTests.java b/java/test/src/main/java/test/Ice/acm/AllTests.java index 9611da859aa..8208748c069 100644 --- a/java/test/src/main/java/test/Ice/acm/AllTests.java +++ b/java/test/src/main/java/test/Ice/acm/AllTests.java @@ -605,10 +605,12 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { com.zeroc.Ice.Communicator communicator = app.communicator(); - String ref = "communicator:default -p 12010"; + PrintWriter out = app.getWriter(); + + String ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx com = RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref)); java.util.List<TestCase> tests = new java.util.ArrayList<>(); diff --git a/java/test/src/main/java/test/Ice/acm/Client.java b/java/test/src/main/java/test/Ice/acm/Client.java index 9378ec7a8c9..6b909a0ae33 100644 --- a/java/test/src/main/java/test/Ice/acm/Client.java +++ b/java/test/src/main/java/test/Ice/acm/Client.java @@ -13,7 +13,7 @@ public class Client extends test.Util.Application { public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/acm/Server.java b/java/test/src/main/java/test/Ice/acm/Server.java index e80a0b6f359..bef22c5b62c 100644 --- a/java/test/src/main/java/test/Ice/acm/Server.java +++ b/java/test/src/main/java/test/Ice/acm/Server.java @@ -29,7 +29,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.ACM.Timeout", "1"); return r; diff --git a/java/test/src/main/java/test/Ice/acm/run.py b/java/test/src/main/java/test/Ice/acm/run.py deleted file mode 100755 index 0b375fb252f..00000000000 --- a/java/test/src/main/java/test/Ice/acm/run.py +++ /dev/null @@ -1,25 +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, getopt - -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() diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java b/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java index a70c46dfb02..73f41165ede 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java @@ -21,12 +21,14 @@ public class AllTests } } - public static TestIntfPrx allTests(test.Util.Application app, java.io.PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app) { com.zeroc.Ice.Communicator communicator = app.communicator(); + java.io.PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -74,7 +76,7 @@ public class AllTests com.zeroc.Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); com.zeroc.Ice.Communicator comm = app.initialize(initData); - comm.stringToProxy("test:default -p 12010").ice_pingAsync(); + comm.stringToProxy("test:" + app.getTestEndpoint(0)).ice_pingAsync(); comm.destroy(); } out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java index 11d93d4fd6e..d88b62068e5 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java @@ -13,7 +13,7 @@ public class Client extends test.Util.Application { public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java index 6fd0e950cf8..1509ba6f36b 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java @@ -17,7 +17,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.ServantLocator locator = new ServantLocatorI(); adapter.addServantLocator(locator, ""); - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); adapter.waitForDeactivate(); return 0; @@ -33,7 +33,7 @@ public class Collocated extends test.Util.Application r.initData.properties.setProperty("TestAdapter.ThreadPool.Size", "2"); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java index 60aab57c2a1..9d4a0710324 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java @@ -27,10 +27,10 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); return r; } - + public static void main(String[] args) { Server app = new Server(); diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java b/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java index 7b630a3f5b1..3eb09cd5ea6 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java @@ -18,7 +18,7 @@ public final class TestI implements TestIntf com.zeroc.Ice.Communicator communicator = current.adapter.getCommunicator(); com.zeroc.Ice.ObjectAdapter adapter = - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); adapter.activate(); adapter.destroy(); } diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/run.py b/java/test/src/main/java/test/Ice/adapterDeactivation/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/admin/AllTests.java b/java/test/src/main/java/test/Ice/admin/AllTests.java index 1d430d7f59e..ee267ed743c 100644 --- a/java/test/src/main/java/test/Ice/admin/AllTests.java +++ b/java/test/src/main/java/test/Ice/admin/AllTests.java @@ -101,8 +101,10 @@ public class AllTests } } - public static void allTests(test.Util.Application app, PrintWriter out) + public static void allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); + out.print("testing communicator operations... "); out.flush(); { @@ -181,7 +183,7 @@ public class AllTests } out.println("ok"); - String ref = "factory:default -p 12010 -t 10000"; + String ref = "factory:" + app.getTestEndpoint(0) + " -t 10000"; RemoteCommunicatorFactoryPrx factory = RemoteCommunicatorFactoryPrx.uncheckedCast(app.communicator().stringToProxy(ref)); diff --git a/java/test/src/main/java/test/Ice/admin/Client.java b/java/test/src/main/java/test/Ice/admin/Client.java index e3d4bbe677b..c39a3d587a2 100644 --- a/java/test/src/main/java/test/Ice/admin/Client.java +++ b/java/test/src/main/java/test/Ice/admin/Client.java @@ -14,8 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); - + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/admin/Server.java b/java/test/src/main/java/test/Ice/admin/Server.java index 3f358ab5624..3c4ed0005d5 100644 --- a/java/test/src/main/java/test/Ice/admin/Server.java +++ b/java/test/src/main/java/test/Ice/admin/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.admin"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/admin/run.py b/java/test/src/main/java/test/Ice/admin/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/admin/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/ami/AllTests.java b/java/test/src/main/java/test/Ice/ami/AllTests.java index 7ba6494dedf..d10e554a9b9 100644 --- a/java/test/src/main/java/test/Ice/ami/AllTests.java +++ b/java/test/src/main/java/test/Ice/ami/AllTests.java @@ -30,13 +30,13 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); TestIntfPrx p = TestIntfPrx.uncheckedCast(obj); - sref = "testController:default -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java/test/src/main/java/test/Ice/ami/Collocated.java b/java/test/src/main/java/test/Ice/ami/Collocated.java index 950ff2e2c08..f224423aa33 100644 --- a/java/test/src/main/java/test/Ice/ami/Collocated.java +++ b/java/test/src/main/java/test/Ice/ami/Collocated.java @@ -31,8 +31,8 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); r.initData.properties.setProperty("Ice.Warn.AMICallback", "0"); return r; diff --git a/java/test/src/main/java/test/Ice/ami/Server.java b/java/test/src/main/java/test/Ice/ami/Server.java index 6c009fb4b0b..90a41a5eaf5 100644 --- a/java/test/src/main/java/test/Ice/ami/Server.java +++ b/java/test/src/main/java/test/Ice/ami/Server.java @@ -30,8 +30,8 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java/test/src/main/java/test/Ice/ami/run.py b/java/test/src/main/java/test/Ice/ami/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/test/src/main/java/test/Ice/ami/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/background/AllTests.java b/java/test/src/main/java/test/Ice/background/AllTests.java index 4eb1ba9fe78..ca465338b01 100644 --- a/java/test/src/main/java/test/Ice/background/AllTests.java +++ b/java/test/src/main/java/test/Ice/background/AllTests.java @@ -161,16 +161,18 @@ public class AllTests private BackgroundPrx _background = null; } - public static BackgroundPrx allTests(Configuration configuration, com.zeroc.Ice.Communicator communicator, - PrintWriter out) + public static BackgroundPrx allTests(Configuration configuration, test.Util.Application app) { - String sref = "background:default -p 12010"; + com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String sref = "background:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); BackgroundPrx background = BackgroundPrx.uncheckedCast(obj); - sref = "backgroundController:tcp -p 12011"; + sref = "backgroundController:" + app.getTestEndpoint(1, "tcp"); obj = communicator.stringToProxy(sref); test(obj != null); @@ -208,7 +210,7 @@ public class AllTests out.flush(); { com.zeroc.Ice.LocatorPrx locator; - obj = communicator.stringToProxy("locator:default -p 12010").ice_invocationTimeout(250); + obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)).ice_invocationTimeout(250); locator = com.zeroc.Ice.LocatorPrx.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway(); @@ -223,7 +225,7 @@ public class AllTests } backgroundController.resumeCall("findAdapterById"); - obj = communicator.stringToProxy("locator:default -p 12010"); + obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)); locator = com.zeroc.Ice.LocatorPrx.uncheckedCast(obj); obj = obj.ice_locator(locator); obj.ice_ping(); @@ -249,7 +251,7 @@ public class AllTests { com.zeroc.Ice.RouterPrx router; - obj = communicator.stringToProxy("router:default -p 12010").ice_invocationTimeout(250); + obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)).ice_invocationTimeout(250); router = com.zeroc.Ice.RouterPrx.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway(); @@ -264,7 +266,7 @@ public class AllTests } backgroundController.resumeCall("getClientProxy"); - obj = communicator.stringToProxy("router:default -p 12010"); + obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)); router = com.zeroc.Ice.RouterPrx.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router); BackgroundPrx bg = BackgroundPrx.uncheckedCast(obj); diff --git a/java/test/src/main/java/test/Ice/background/Client.java b/java/test/src/main/java/test/Ice/background/Client.java index 6f01077c2be..1f806864d29 100644 --- a/java/test/src/main/java/test/Ice/background/Client.java +++ b/java/test/src/main/java/test/Ice/background/Client.java @@ -17,12 +17,8 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - Configuration configuration = new Configuration(); PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test"); - plugin.setConfiguration(configuration); - communicator().getPluginManager().initializePlugins(); - - BackgroundPrx background = AllTests.allTests(configuration, communicator(), getWriter()); + BackgroundPrx background = AllTests.allTests(plugin.getConfiguration(), this); background.shutdown(); return 0; } @@ -55,9 +51,6 @@ public class Client extends test.Util.Application r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - // Don't initialize the plugin until I've set the configuration. - r.initData.properties.setProperty("Ice.InitPlugins", "0"); - return r; } diff --git a/java/test/src/main/java/test/Ice/background/Collocated.java b/java/test/src/main/java/test/Ice/background/Collocated.java deleted file mode 100644 index 53d1312a999..00000000000 --- a/java/test/src/main/java/test/Ice/background/Collocated.java +++ /dev/null @@ -1,100 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -package test.Ice.background; - -public class Collocated extends test.Util.Application -{ - static Thread _clientThread; - static int result; - - public static void main(String[] args) - { - Collocated app = new Collocated(); - int result = app.main("Collocated", args); - System.gc(); - System.exit(result); - } - - @Override - public int run(String[] args) - { - final Client client = new Client(); - client.setClassLoader(getClassLoader()); - client.setWriter(getWriter()); - final Server server = new Server(); - server.setClassLoader(getClassLoader()); - server.setWriter(getWriter()); - Thread t = new Thread(new Runnable() - { - @Override - public void run() - { - String[] args = - { - "--Ice.NullHandleAbort=1", - "--Ice.Warn.Connections=1", - "--Ice.ThreadPool.Server.Size=1", - "--Ice.ThreadPool.Server.SizeMax=3", - "--Ice.ThreadPool.Server.SizeWarn=0", - "--Ice.PrintAdapterReady=1", - "--Ice.ServerIdleTime=30", - "--Ice.Default.Host=127.0.0.1" - }; - server.setServerReadyListener(new test.Util.Application.ServerReadyListener() - { - @Override - public void serverReady() - { - _clientThread = new Thread(new Runnable() - { - @Override - public void run() - { - String[] args = - { - "--Ice.NullHandleAbort=1", - "--Ice.Warn.Connections=1", - "--Ice.Default.Host=127.0.0.1" - }; - client.main("Client", args); - } - }); - _clientThread.start(); - } - }); - - result = server.main("Server", args); - if(_clientThread != null) - { - while(_clientThread.isAlive()) - { - try - { - _clientThread.join(); - } - catch(InterruptedException e1) - { - } - } - } - } - }); - t.start(); - try - { - t.join(); - } - catch(InterruptedException ex) - { - } - - return 0; - } -} diff --git a/java/test/src/main/java/test/Ice/background/PluginFactory.java b/java/test/src/main/java/test/Ice/background/PluginFactory.java index 881b6c877ab..015d9890fbf 100644 --- a/java/test/src/main/java/test/Ice/background/PluginFactory.java +++ b/java/test/src/main/java/test/Ice/background/PluginFactory.java @@ -21,7 +21,6 @@ public class PluginFactory implements com.zeroc.Ice.PluginFactory @Override public void initialize() { - assert _configuration != null; com.zeroc.IceInternal.ProtocolPluginFacade facade = com.zeroc.IceInternal.Util.getProtocolPluginFacade(_communicator); for(short s = 0; s < 100; ++s) @@ -39,13 +38,13 @@ public class PluginFactory implements com.zeroc.Ice.PluginFactory { } - public void setConfiguration(Configuration configuration) + public Configuration getConfiguration() { - _configuration = configuration; + return _configuration; } private final com.zeroc.Ice.Communicator _communicator; - private Configuration _configuration; + private Configuration _configuration = new Configuration(); } @Override diff --git a/java/test/src/main/java/test/Ice/background/Server.java b/java/test/src/main/java/test/Ice/background/Server.java index 5e78f5aa171..24c26410b2f 100644 --- a/java/test/src/main/java/test/Ice/background/Server.java +++ b/java/test/src/main/java/test/Ice/background/Server.java @@ -83,10 +83,8 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - Configuration configuration = new Configuration(); PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test"); - plugin.setConfiguration(configuration); - communicator().getPluginManager().initializePlugins(); + Configuration configuration = plugin.getConfiguration(); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); @@ -128,13 +126,11 @@ public class Server extends test.Util.Application r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 1, "tcp")); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); - // Don't initialize the plugin until I've set the configuration. - r.initData.properties.setProperty("Ice.InitPlugins", "0"); - return r; } diff --git a/java/test/src/main/java/test/Ice/background/run.py b/java/test/src/main/java/test/Ice/background/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/background/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/binding/AllTests.java b/java/test/src/main/java/test/Ice/binding/AllTests.java index d2242539593..77c93127f7d 100644 --- a/java/test/src/main/java/test/Ice/binding/AllTests.java +++ b/java/test/src/main/java/test/Ice/binding/AllTests.java @@ -60,7 +60,7 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String ref = "communicator:default -p 12010"; + String ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx rcom = RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref)); out.print("testing binding with single endpoint... "); @@ -833,19 +833,21 @@ public class AllTests clientProps.add(bothPreferIPv4); clientProps.add(bothPreferIPv6); + String endpoint = "tcp -p " + app.getTestPort(2); + com.zeroc.Ice.Properties 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"); com.zeroc.Ice.Properties 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\""); com.zeroc.Ice.Properties anyboth = com.zeroc.Ice.Util.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 + " -h \"::1\":" + endpoint + " -h 127.0.0.1"); com.zeroc.Ice.Properties localipv4 = ipv4._clone(); localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1"); diff --git a/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java b/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java index 88560cd77c8..a6146a1dc85 100644 --- a/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java +++ b/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java @@ -14,17 +14,19 @@ import test.Ice.binding.Test.RemoteCommunicator; public class RemoteCommunicatorI implements RemoteCommunicator { + public + RemoteCommunicatorI(test.Util.Application app) + { + _app = app; + } + @Override public RemoteObjectAdapterPrx createObjectAdapter(String name, String endpts, com.zeroc.Ice.Current current) { String endpoints = endpts; if(endpoints.indexOf("-p") < 0) { - // Use a fixed port if none is specified (bug 2896) - endpoints += " -h \"" + - (current.adapter.getCommunicator().getProperties().getPropertyWithDefault( - "Ice.Default.Host", "127.0.0.1")) + - "\" -p " + _nextPort++; + endpoints = _app.getTestEndpoint(_nextPort++, endpoints); } com.zeroc.Ice.Communicator com = current.adapter.getCommunicator(); @@ -45,5 +47,6 @@ public class RemoteCommunicatorI implements RemoteCommunicator current.adapter.getCommunicator().shutdown(); } - private int _nextPort = 10001; + private final test.Util.Application _app; + private int _nextPort = 10; } diff --git a/java/test/src/main/java/test/Ice/binding/Server.java b/java/test/src/main/java/test/Ice/binding/Server.java index 1e950456eb9..8a76192e5f0 100644 --- a/java/test/src/main/java/test/Ice/binding/Server.java +++ b/java/test/src/main/java/test/Ice/binding/Server.java @@ -17,7 +17,7 @@ public class Server extends test.Util.Application com.zeroc.Ice.Communicator communicator = communicator(); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("communicator"); - adapter.add(new RemoteCommunicatorI(), id); + adapter.add(new RemoteCommunicatorI(this), id); adapter.activate(); return WAIT; @@ -28,7 +28,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); return r; } diff --git a/java/test/src/main/java/test/Ice/binding/run.py b/java/test/src/main/java/test/Ice/binding/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/binding/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/checksum/AllTests.java b/java/test/src/main/java/test/Ice/checksum/AllTests.java index 67980ce1e85..d861125dfa4 100644 --- a/java/test/src/main/java/test/Ice/checksum/AllTests.java +++ b/java/test/src/main/java/test/Ice/checksum/AllTests.java @@ -22,9 +22,12 @@ public class AllTests } } - public static ChecksumPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out) + public static ChecksumPrx allTests(test.Util.Application app, boolean collocated) { - String ref = "test:default -p 12010"; + com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); diff --git a/java/test/src/main/java/test/Ice/checksum/Client.java b/java/test/src/main/java/test/Ice/checksum/Client.java index 335fc5f2265..3df98772922 100644 --- a/java/test/src/main/java/test/Ice/checksum/Client.java +++ b/java/test/src/main/java/test/Ice/checksum/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter()); + ChecksumPrx checksum = AllTests.allTests(this, false); checksum.shutdown(); return 0; } @@ -34,7 +33,7 @@ public class Client extends test.Util.Application { Client c = new Client(); int status = c.main("Client", args); - + System.gc(); System.exit(status); } diff --git a/java/test/src/main/java/test/Ice/checksum/Server.java b/java/test/src/main/java/test/Ice/checksum/Server.java index bc8b0437b80..b5adcbd032b 100644 --- a/java/test/src/main/java/test/Ice/checksum/Server.java +++ b/java/test/src/main/java/test/Ice/checksum/Server.java @@ -15,14 +15,14 @@ public class Server extends test.Util.Application public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Object object = new ChecksumI(); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test")); adapter.activate(); return WAIT; } - + @Override protected GetInitDataResult getInitData(String[] args) { @@ -35,7 +35,7 @@ public class Server extends test.Util.Application { Server c = new Server(); int status = c.main("Server", args); - + System.gc(); System.exit(status); } diff --git a/java/test/src/main/java/test/Ice/checksum/run.py b/java/test/src/main/java/test/Ice/checksum/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/checksum/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/classLoader/AllTests.java b/java/test/src/main/java/test/Ice/classLoader/AllTests.java index bb40bf214d3..798ca80049c 100644 --- a/java/test/src/main/java/test/Ice/classLoader/AllTests.java +++ b/java/test/src/main/java/test/Ice/classLoader/AllTests.java @@ -138,7 +138,7 @@ public class AllTests initData.classLoader = classLoader; com.zeroc.Ice.Communicator ic = app.initialize(initData); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = ic.stringToProxy(ref); test(base != null); diff --git a/java/test/src/main/java/test/Ice/classLoader/Server.java b/java/test/src/main/java/test/Ice/classLoader/Server.java index ba93de5f20a..ceea2fe9299 100644 --- a/java/test/src/main/java/test/Ice/classLoader/Server.java +++ b/java/test/src/main/java/test/Ice/classLoader/Server.java @@ -28,7 +28,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Default.SlicedFormat", "1"); return r; } diff --git a/java/test/src/main/java/test/Ice/classLoader/run.py b/java/test/src/main/java/test/Ice/classLoader/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/classLoader/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/custom/AllTests.java b/java/test/src/main/java/test/Ice/custom/AllTests.java index 4087569b91d..2364cdc8eb2 100644 --- a/java/test/src/main/java/test/Ice/custom/AllTests.java +++ b/java/test/src/main/java/test/Ice/custom/AllTests.java @@ -39,11 +39,13 @@ public class AllTests } } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/custom/Client.java b/java/test/src/main/java/test/Ice/custom/Client.java index 59a214bd855..578a7bd401c 100644 --- a/java/test/src/main/java/test/Ice/custom/Client.java +++ b/java/test/src/main/java/test/Ice/custom/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + TestIntfPrx test = AllTests.allTests(this); test.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/custom/Collocated.java b/java/test/src/main/java/test/Ice/custom/Collocated.java index 35c9013250d..3c1931ffbf2 100644 --- a/java/test/src/main/java/test/Ice/custom/Collocated.java +++ b/java/test/src/main/java/test/Ice/custom/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.Object test = new TestI(communicator); adapter.add(test, com.zeroc.Ice.Util.stringToIdentity("test")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -29,7 +29,7 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/custom/Server.java b/java/test/src/main/java/test/Ice/custom/Server.java index 2d73b389827..d962f6c3dee 100644 --- a/java/test/src/main/java/test/Ice/custom/Server.java +++ b/java/test/src/main/java/test/Ice/custom/Server.java @@ -29,7 +29,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/custom/run.py b/java/test/src/main/java/test/Ice/custom/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/test/src/main/java/test/Ice/custom/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/defaultServant/AllTests.java b/java/test/src/main/java/test/Ice/defaultServant/AllTests.java index 3e22df248de..54f9a72d551 100644 --- a/java/test/src/main/java/test/Ice/defaultServant/AllTests.java +++ b/java/test/src/main/java/test/Ice/defaultServant/AllTests.java @@ -22,9 +22,11 @@ public class AllTests } } - public static void allTests(test.Util.Application app, PrintWriter out) + public static void allTests(test.Util.Application app) { com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + com.zeroc.Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost"); oa.activate(); diff --git a/java/test/src/main/java/test/Ice/defaultServant/Client.java b/java/test/src/main/java/test/Ice/defaultServant/Client.java index f5956bead6b..f0cdcbeece8 100644 --- a/java/test/src/main/java/test/Ice/defaultServant/Client.java +++ b/java/test/src/main/java/test/Ice/defaultServant/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/defaultServant/run.py b/java/test/src/main/java/test/Ice/defaultServant/run.py deleted file mode 100755 index 86b25876539..00000000000 --- a/java/test/src/main/java/test/Ice/defaultServant/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.defaultServant.Client", "--Ice.Warn.Dispatch=0",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Ice/defaultValue/AllTests.java b/java/test/src/main/java/test/Ice/defaultValue/AllTests.java index 397f8213d5f..30e7ce1dfd8 100644 --- a/java/test/src/main/java/test/Ice/defaultValue/AllTests.java +++ b/java/test/src/main/java/test/Ice/defaultValue/AllTests.java @@ -22,8 +22,10 @@ public class AllTests } } - public static void allTests(test.Util.Application app, PrintWriter out) + public static void allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); + out.print("testing default values... "); out.flush(); diff --git a/java/test/src/main/java/test/Ice/defaultValue/Client.java b/java/test/src/main/java/test/Ice/defaultValue/Client.java index 7d13b0c7645..ec2c3d21842 100644 --- a/java/test/src/main/java/test/Ice/defaultValue/Client.java +++ b/java/test/src/main/java/test/Ice/defaultValue/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/defaultValue/run.py b/java/test/src/main/java/test/Ice/defaultValue/run.py deleted file mode 100755 index 06a587612d9..00000000000 --- a/java/test/src/main/java/test/Ice/defaultValue/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.defaultValue.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Ice/dispatcher/AllTests.java b/java/test/src/main/java/test/Ice/dispatcher/AllTests.java index 52d89c483f4..886ba779dda 100644 --- a/java/test/src/main/java/test/Ice/dispatcher/AllTests.java +++ b/java/test/src/main/java/test/Ice/dispatcher/AllTests.java @@ -60,9 +60,12 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out, final Dispatcher dispatcher) + public static void allTests(test.Util.Application app, final Dispatcher dispatcher) { - String sref = "test:default -p 12010"; + com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String sref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); @@ -74,7 +77,7 @@ public class AllTests TestIntfPrx p = TestIntfPrx.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1, "tcp"); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java/test/src/main/java/test/Ice/dispatcher/Client.java b/java/test/src/main/java/test/Ice/dispatcher/Client.java index f3de9eb86ed..f5b8fcaf772 100644 --- a/java/test/src/main/java/test/Ice/dispatcher/Client.java +++ b/java/test/src/main/java/test/Ice/dispatcher/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(communicator(), getWriter(), _dispatcher); + AllTests.allTests(this, _dispatcher); return 0; } diff --git a/java/test/src/main/java/test/Ice/dispatcher/Collocated.java b/java/test/src/main/java/test/Ice/dispatcher/Collocated.java index 5d9e2eeda34..390e834bcfb 100644 --- a/java/test/src/main/java/test/Ice/dispatcher/Collocated.java +++ b/java/test/src/main/java/test/Ice/dispatcher/Collocated.java @@ -23,7 +23,7 @@ public class Collocated extends test.Util.Application adapter2.add(new TestControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator(), getWriter(), _dispatcher); + AllTests.allTests(this, _dispatcher); return 0; } @@ -34,8 +34,9 @@ public class Collocated extends test.Util.Application assert(_dispatcher == null); _dispatcher = new Dispatcher(); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 1, "tcp")); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); r.initData.dispatcher = _dispatcher; return r; diff --git a/java/test/src/main/java/test/Ice/dispatcher/Server.java b/java/test/src/main/java/test/Ice/dispatcher/Server.java index 79cc2a615e9..f1204fff135 100644 --- a/java/test/src/main/java/test/Ice/dispatcher/Server.java +++ b/java/test/src/main/java/test/Ice/dispatcher/Server.java @@ -33,8 +33,9 @@ public class Server extends test.Util.Application assert(_dispatcher == null); _dispatcher = new Dispatcher(); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 1, "tcp")); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java/test/src/main/java/test/Ice/dispatcher/run.py b/java/test/src/main/java/test/Ice/dispatcher/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/test/src/main/java/test/Ice/dispatcher/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/echo/Server.java b/java/test/src/main/java/test/Ice/echo/Server.java index d53b8092bc8..d27979ffdf6 100644 --- a/java/test/src/main/java/test/Ice/echo/Server.java +++ b/java/test/src/main/java/test/Ice/echo/Server.java @@ -17,19 +17,19 @@ public class Server extends test.Util.Application { _blob = blob; } - + @Override public void startBatch(com.zeroc.Ice.Current current) { _blob.startBatch(); } - + @Override public void flushBatch(com.zeroc.Ice.Current current) { _blob.flushBatch(); } - + @Override public void shutdown(com.zeroc.Ice.Current current) { @@ -42,7 +42,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); BlobjectI blob = new BlobjectI(); adapter.addDefaultServant(blob, ""); diff --git a/java/test/src/main/java/test/Ice/echo/run.py b/java/test/src/main/java/test/Ice/echo/run.py deleted file mode 100755 index 3f861533410..00000000000 --- a/java/test/src/main/java/test/Ice/echo/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 - -sys.stdout.write("starting server... ") -sys.stdout.flush() -p = TestUtil.startServer("test.Ice.echo.Server") -print("ok") -sys.stdout.flush() - -p.waitTestSuccess() diff --git a/java/test/src/main/java/test/Ice/enums/AllTests.java b/java/test/src/main/java/test/Ice/enums/AllTests.java index ede32b99d90..74a4493f107 100644 --- a/java/test/src/main/java/test/Ice/enums/AllTests.java +++ b/java/test/src/main/java/test/Ice/enums/AllTests.java @@ -22,9 +22,11 @@ public class AllTests } } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); TestIntfPrx proxy = TestIntfPrx.checkedCast(obj); diff --git a/java/test/src/main/java/test/Ice/enums/Client.java b/java/test/src/main/java/test/Ice/enums/Client.java index a1bb85c7c7a..90c335f5025 100644 --- a/java/test/src/main/java/test/Ice/enums/Client.java +++ b/java/test/src/main/java/test/Ice/enums/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + TestIntfPrx test = AllTests.allTests(this); test.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/enums/Server.java b/java/test/src/main/java/test/Ice/enums/Server.java index f79e37caf20..126be74279c 100644 --- a/java/test/src/main/java/test/Ice/enums/Server.java +++ b/java/test/src/main/java/test/Ice/enums/Server.java @@ -29,7 +29,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/enums/run.py b/java/test/src/main/java/test/Ice/enums/run.py deleted file mode 100755 index 1b234c88804..00000000000 --- a/java/test/src/main/java/test/Ice/enums/run.py +++ /dev/null @@ -1,29 +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(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "1.1", message = "Running test with 1.1 encoding.") -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/exceptions/AMDServer.java b/java/test/src/main/java/test/Ice/exceptions/AMDServer.java index db7a4589500..59fce2ddc6b 100644 --- a/java/test/src/main/java/test/Ice/exceptions/AMDServer.java +++ b/java/test/src/main/java/test/Ice/exceptions/AMDServer.java @@ -42,11 +42,11 @@ public class AMDServer extends test.Util.Application r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); + r.initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - r.initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); + r.initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(r.initData.properties, 2)); r.initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); return r; diff --git a/java/test/src/main/java/test/Ice/exceptions/AllTests.java b/java/test/src/main/java/test/Ice/exceptions/AllTests.java index 3d4be1c4ed2..1cce083ca40 100644 --- a/java/test/src/main/java/test/Ice/exceptions/AllTests.java +++ b/java/test/src/main/java/test/Ice/exceptions/AllTests.java @@ -28,8 +28,10 @@ public class AllTests } } - public static ThrowerPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static ThrowerPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); { out.print("testing object adapter registration exceptions... "); com.zeroc.Ice.ObjectAdapter first; @@ -149,7 +151,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "thrower:default -p 12010"; + String ref = "thrower:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -446,7 +448,8 @@ public class AllTests test(false); } - ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:default -p 12011")); + ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:" + + app.getTestEndpoint(1))); try { thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits) @@ -454,7 +457,8 @@ public class AllTests catch(com.zeroc.Ice.MemoryLimitException ex) { } - ThrowerPrx thrower3 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:default -p 12012")); + ThrowerPrx thrower3 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:" + + app.getTestEndpoint(2))); try { thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit diff --git a/java/test/src/main/java/test/Ice/exceptions/Client.java b/java/test/src/main/java/test/Ice/exceptions/Client.java index 250f94e580b..0c574a021fa 100644 --- a/java/test/src/main/java/test/Ice/exceptions/Client.java +++ b/java/test/src/main/java/test/Ice/exceptions/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - ThrowerPrx thrower = AllTests.allTests(communicator, getWriter()); + ThrowerPrx thrower = AllTests.allTests(this); thrower.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/exceptions/Collocated.java b/java/test/src/main/java/test/Ice/exceptions/Collocated.java index 79b3920ff97..89311554cf0 100644 --- a/java/test/src/main/java/test/Ice/exceptions/Collocated.java +++ b/java/test/src/main/java/test/Ice/exceptions/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.Object object = new ThrowerI(); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -38,7 +38,7 @@ public class Collocated extends test.Util.Application r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/exceptions/Server.java b/java/test/src/main/java/test/Ice/exceptions/Server.java index 188e3f5c809..5897c150355 100644 --- a/java/test/src/main/java/test/Ice/exceptions/Server.java +++ b/java/test/src/main/java/test/Ice/exceptions/Server.java @@ -41,11 +41,11 @@ public class Server extends test.Util.Application r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); + r.initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - r.initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); + r.initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(r.initData.properties, 2)); r.initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); return r; diff --git a/java/test/src/main/java/test/Ice/exceptions/run.py b/java/test/src/main/java/test/Ice/exceptions/run.py deleted file mode 100755 index 65b4b4d0e93..00000000000 --- a/java/test/src/main/java/test/Ice/exceptions/run.py +++ /dev/null @@ -1,51 +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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "compactAMD", localOnly = True, - message = "Running test with compact (default) format and AMD server.", - server="test.Ice.exceptions.AMDServer") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server="test.Ice.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="test.Ice.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/facets/AllTests.java b/java/test/src/main/java/test/Ice/facets/AllTests.java index f59389cd945..f6495ff5725 100644 --- a/java/test/src/main/java/test/Ice/facets/AllTests.java +++ b/java/test/src/main/java/test/Ice/facets/AllTests.java @@ -28,8 +28,10 @@ public class AllTests } } - public static GPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static GPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing Ice.Admin.Facets property... "); test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").length == 0); communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); @@ -109,7 +111,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "d:default -p 12010"; + String ref = "d:" + app.getTestEndpoint(0); ObjectPrx db = communicator.stringToProxy(ref); test(db != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/facets/Client.java b/java/test/src/main/java/test/Ice/facets/Client.java index 0706f029849..152f01ed5ba 100644 --- a/java/test/src/main/java/test/Ice/facets/Client.java +++ b/java/test/src/main/java/test/Ice/facets/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - GPrx g = AllTests.allTests(communicator, getWriter()); + GPrx g = AllTests.allTests(this); g.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/facets/Collocated.java b/java/test/src/main/java/test/Ice/facets/Collocated.java index bbd89715144..8efbd5253e4 100644 --- a/java/test/src/main/java/test/Ice/facets/Collocated.java +++ b/java/test/src/main/java/test/Ice/facets/Collocated.java @@ -15,7 +15,7 @@ public class Collocated extends test.Util.Application public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Object d = new DI(); adapter.add(d, com.zeroc.Ice.Util.stringToIdentity("d")); @@ -25,7 +25,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.Object h = new HI(communicator); adapter.addFacet(h, com.zeroc.Ice.Util.stringToIdentity("d"), "facetGH"); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/facets/Server.java b/java/test/src/main/java/test/Ice/facets/Server.java index fa7361b69e4..19e44faba90 100644 --- a/java/test/src/main/java/test/Ice/facets/Server.java +++ b/java/test/src/main/java/test/Ice/facets/Server.java @@ -34,7 +34,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/facets/run.py b/java/test/src/main/java/test/Ice/facets/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/test/src/main/java/test/Ice/facets/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java b/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java index a5beb3fffb1..2767f3773ce 100644 --- a/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java +++ b/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java @@ -97,14 +97,17 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator, int[] ports, PrintWriter out) + public static void allTests(test.Util.Application app, int[] ports) { + com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); String ref = "test"; for(int port : ports) { - ref += ":default -p " + port; + ref += ":" + app.getTestEndpoint(port); } com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); diff --git a/java/test/src/main/java/test/Ice/faultTolerance/Client.java b/java/test/src/main/java/test/Ice/faultTolerance/Client.java index 0ddd58774e1..17af85f2598 100644 --- a/java/test/src/main/java/test/Ice/faultTolerance/Client.java +++ b/java/test/src/main/java/test/Ice/faultTolerance/Client.java @@ -68,7 +68,7 @@ public class Client extends test.Util.Application try { - AllTests.allTests(communicator(), arr, out); + AllTests.allTests(this, arr); } catch(com.zeroc.Ice.LocalException ex) { diff --git a/java/test/src/main/java/test/Ice/faultTolerance/Server.java b/java/test/src/main/java/test/Ice/faultTolerance/Server.java index f856e8d6f4a..0a19794900a 100644 --- a/java/test/src/main/java/test/Ice/faultTolerance/Server.java +++ b/java/test/src/main/java/test/Ice/faultTolerance/Server.java @@ -61,7 +61,7 @@ public class Server extends test.Util.Application } // Don't move this, it needs the port. - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(port) + ":udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Object object = new TestI(port); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test")); diff --git a/java/test/src/main/java/test/Ice/faultTolerance/run.py b/java/test/src/main/java/test/Ice/faultTolerance/run.py deleted file mode 100755 index f3e808802b0..00000000000 --- a/java/test/src/main/java/test/Ice/faultTolerance/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 - -num = 12 -base = 12340 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer("test.Ice.faultTolerance.Server", " %d" % (base + i))) - print("ok") - -ports = "" -for i in range(0, num): - ports = "%s %d" % (ports, base + i) -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.faultTolerance.Client", ports, startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/java/test/src/main/java/test/Ice/hash/run.py b/java/test/src/main/java/test/Ice/hash/run.py deleted file mode 100755 index 5175a3d1877..00000000000 --- a/java/test/src/main/java/test/Ice/hash/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.simpleTest("test.Ice.hash.Client") - diff --git a/java/test/src/main/java/test/Ice/hold/AllTests.java b/java/test/src/main/java/test/Ice/hold/AllTests.java index 33e4f97d994..31db0c827da 100644 --- a/java/test/src/main/java/test/Ice/hold/AllTests.java +++ b/java/test/src/main/java/test/Ice/hold/AllTests.java @@ -32,7 +32,7 @@ public class AllTests { _value = value; } - + synchronized public void set(boolean value) { _value = value; @@ -42,7 +42,7 @@ public class AllTests { return _value; } - + private boolean _value; } @@ -66,19 +66,20 @@ public class AllTests private int _expected; } - public static void allTests(test.Util.Application app, PrintWriter out) + public static void allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); com.zeroc.Ice.Communicator communicator = app.communicator(); out.print("testing stringToProxy... "); out.flush(); - String ref = "hold:default -p 12010"; + String ref = "hold:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - String refSerialized = "hold:default -p 12011"; + String refSerialized = "hold:" + app.getTestEndpoint(1); com.zeroc.Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized); test(baseSerialized != null); out.println("ok"); - + out.print("testing checked cast... "); out.flush(); HoldPrx hold = HoldPrx.checkedCast(base); @@ -90,7 +91,7 @@ public class AllTests test(holdSerialized != null); test(holdSerialized.equals(baseSerialized)); out.println("ok"); - + out.print("changing state between active and hold rapidly... "); out.flush(); for(int i = 0; i < 100; ++i) @@ -110,7 +111,7 @@ public class AllTests holdSerializedOneway.putOnHold(0); } out.println("ok"); - + out.print("testing without serialize mode... "); out.flush(); java.util.Random random = new java.util.Random(); @@ -227,7 +228,7 @@ public class AllTests hold.putOnHold(-1); hold.ice_ping(); hold.putOnHold(-1); - hold.ice_ping(); + hold.ice_ping(); } out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/hold/Client.java b/java/test/src/main/java/test/Ice/hold/Client.java index 6ac9c4c10e1..e117003f8f6 100644 --- a/java/test/src/main/java/test/Ice/hold/Client.java +++ b/java/test/src/main/java/test/Ice/hold/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/hold/Server.java b/java/test/src/main/java/test/Ice/hold/Server.java index 0167c743125..750dcf0fdbb 100644 --- a/java/test/src/main/java/test/Ice/hold/Server.java +++ b/java/test/src/main/java/test/Ice/hold/Server.java @@ -39,13 +39,13 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold"); - r.initData.properties.setProperty("TestAdapter1.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter1.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("TestAdapter1.ThreadPool.Size", "5"); r.initData.properties.setProperty("TestAdapter1.ThreadPool.SizeMax", "5"); r.initData.properties.setProperty("TestAdapter1.ThreadPool.SizeWarn", "0"); r.initData.properties.setProperty("TestAdapter1.ThreadPool.Serialize", "0"); - r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011:udp"); + r.initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(r.initData.properties, 1) + ":udp"); r.initData.properties.setProperty("TestAdapter2.ThreadPool.Size", "5"); r.initData.properties.setProperty("TestAdapter2.ThreadPool.SizeMax", "5"); r.initData.properties.setProperty("TestAdapter2.ThreadPool.SizeWarn", "0"); diff --git a/java/test/src/main/java/test/Ice/hold/run.py b/java/test/src/main/java/test/Ice/hold/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/hold/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/info/AllTests.java b/java/test/src/main/java/test/Ice/info/AllTests.java index 23594b9548b..9123be0a685 100644 --- a/java/test/src/main/java/test/Ice/info/AllTests.java +++ b/java/test/src/main/java/test/Ice/info/AllTests.java @@ -64,8 +64,10 @@ public class AllTests return null; } - public static void allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static void allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing proxy endpoint information... "); out.flush(); { @@ -136,8 +138,9 @@ public class AllTests adapter.destroy(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p 12020"); - communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020"); + int port = app.getTestPort(1); + communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p " + port); + communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", app.getTestEndpoint(1)); adapter = communicator.createObjectAdapter("TestAdapter"); endpoints = adapter.getEndpoints(); @@ -148,26 +151,30 @@ public class AllTests for(Endpoint endpoint : endpoints) { tcpEndpoint = getTCPEndpointInfo(endpoint.getInfo()); - test(tcpEndpoint.port == 12020); + test(tcpEndpoint.port == port); } tcpEndpoint = getTCPEndpointInfo(publishedEndpoints[0].getInfo()); test(tcpEndpoint.host.equals("127.0.0.1")); - test(tcpEndpoint.port == 12020); + test(tcpEndpoint.port == port); adapter.destroy(); } out.println("ok"); - com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test:default -p 12010:udp -p 12010"); + com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test:" + + app.getTestEndpoint(0) + ":" + + app.getTestEndpoint(0, "udp")); TestIntfPrx testIntf = TestIntfPrx.checkedCast(base); + int endpointPort = app.getTestPort(0); + out.print("test connection endpoint information... "); out.flush(); { EndpointInfo info = base.ice_getConnection().getEndpoint().getInfo(); TCPEndpointInfo tcpinfo = getTCPEndpointInfo(info); - test(tcpinfo.port == 12010); + test(tcpinfo.port == endpointPort); test(!tcpinfo.compress); test(tcpinfo.host.equals(defaultHost)); @@ -179,7 +186,7 @@ public class AllTests info = base.ice_datagram().ice_getConnection().getEndpoint().getInfo(); UDPEndpointInfo udp = (UDPEndpointInfo)info; - test(udp.port == 12010); + test(udp.port == endpointPort); test(udp.host.equals(defaultHost)); } out.println("ok"); @@ -194,7 +201,7 @@ public class AllTests test(!info.incoming); test(info.adapterName.length() == 0); test(info.localPort > 0); - test(info.remotePort == 12010); + test(info.remotePort == endpointPort); if(defaultHost.equals("127.0.0.1")) { test(info.remoteAddress.equals(defaultHost)); @@ -233,7 +240,7 @@ public class AllTests test(!udpinfo.incoming); test(udpinfo.adapterName.length() == 0); test(udpinfo.localPort > 0); - test(udpinfo.remotePort == 12010); + test(udpinfo.remotePort == endpointPort); if(defaultHost.equals("127.0.0.1")) { test(udpinfo.remoteAddress.equals(defaultHost)); diff --git a/java/test/src/main/java/test/Ice/info/Client.java b/java/test/src/main/java/test/Ice/info/Client.java index 165bb7e8b2d..37aa8a2d368 100644 --- a/java/test/src/main/java/test/Ice/info/Client.java +++ b/java/test/src/main/java/test/Ice/info/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(communicator(), getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/info/Server.java b/java/test/src/main/java/test/Ice/info/Server.java index c262bfab160..b45d1d3e921 100644 --- a/java/test/src/main/java/test/Ice/info/Server.java +++ b/java/test/src/main/java/test/Ice/info/Server.java @@ -26,7 +26,9 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + ":" + + getTestEndpoint(r.initData.properties, 0, "udp")); return r; } diff --git a/java/test/src/main/java/test/Ice/info/run.py b/java/test/src/main/java/test/Ice/info/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/info/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/inheritance/AllTests.java b/java/test/src/main/java/test/Ice/inheritance/AllTests.java index c9b7515c3c0..e2c61c3bbc7 100644 --- a/java/test/src/main/java/test/Ice/inheritance/AllTests.java +++ b/java/test/src/main/java/test/Ice/inheritance/AllTests.java @@ -31,11 +31,13 @@ public class AllTests } } - public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -79,7 +81,7 @@ public class AllTests CAPrx cao; CBPrx cbo; CCPrx cco; - + cao = ca.caop(ca); test(cao.equals(ca)); cao = ca.caop(cb); @@ -98,7 +100,7 @@ public class AllTests test(cao.equals(cb)); cao = cc.caop(cc); test(cao.equals(cc)); - + cao = cb.cbop(cb); test(cao.equals(cb)); cbo = cb.cbop(cb); diff --git a/java/test/src/main/java/test/Ice/inheritance/Client.java b/java/test/src/main/java/test/Ice/inheritance/Client.java index 0094eac4df3..76b917f0649 100644 --- a/java/test/src/main/java/test/Ice/inheritance/Client.java +++ b/java/test/src/main/java/test/Ice/inheritance/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - InitialPrx initial = AllTests.allTests(communicator, getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/inheritance/Collocated.java b/java/test/src/main/java/test/Ice/inheritance/Collocated.java index db86f22a5a0..c2e0c49b503 100644 --- a/java/test/src/main/java/test/Ice/inheritance/Collocated.java +++ b/java/test/src/main/java/test/Ice/inheritance/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.Object object = new InitialI(adapter); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("initial")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -29,7 +29,7 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/inheritance/Server.java b/java/test/src/main/java/test/Ice/inheritance/Server.java index 65ebc89e913..a3a10cd21e1 100644 --- a/java/test/src/main/java/test/Ice/inheritance/Server.java +++ b/java/test/src/main/java/test/Ice/inheritance/Server.java @@ -27,7 +27,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/inheritance/run.py b/java/test/src/main/java/test/Ice/inheritance/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/test/src/main/java/test/Ice/inheritance/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/interceptor/Client.java b/java/test/src/main/java/test/Ice/interceptor/Client.java index f2492fa2757..4e1515ee14c 100644 --- a/java/test/src/main/java/test/Ice/interceptor/Client.java +++ b/java/test/src/main/java/test/Ice/interceptor/Client.java @@ -231,6 +231,7 @@ public class Client extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.interceptor"); + r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/interceptor/run.py b/java/test/src/main/java/test/Ice/interceptor/run.py deleted file mode 100755 index 99d35706c32..00000000000 --- a/java/test/src/main/java/test/Ice/interceptor/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.interceptor.Client", "--Ice.Warn.Dispatch=0",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Ice/interrupt/AllTests.java b/java/test/src/main/java/test/Ice/interrupt/AllTests.java index 44a58339065..ac7efacb3df 100644 --- a/java/test/src/main/java/test/Ice/interrupt/AllTests.java +++ b/java/test/src/main/java/test/Ice/interrupt/AllTests.java @@ -86,13 +86,13 @@ public class AllTests { com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); final TestIntfPrx p = TestIntfPrx.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java/test/src/main/java/test/Ice/interrupt/Collocated.java b/java/test/src/main/java/test/Ice/interrupt/Collocated.java index f770c46515c..0d4baa68925 100644 --- a/java/test/src/main/java/test/Ice/interrupt/Collocated.java +++ b/java/test/src/main/java/test/Ice/interrupt/Collocated.java @@ -56,8 +56,8 @@ public class Collocated extends test.Util.Application // r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); return r; diff --git a/java/test/src/main/java/test/Ice/interrupt/Server.java b/java/test/src/main/java/test/Ice/interrupt/Server.java index 0ed3bbcd2c1..a0723e9bc2c 100644 --- a/java/test/src/main/java/test/Ice/interrupt/Server.java +++ b/java/test/src/main/java/test/Ice/interrupt/Server.java @@ -47,8 +47,8 @@ public class Server extends test.Util.Application // r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java/test/src/main/java/test/Ice/interrupt/run.py b/java/test/src/main/java/test/Ice/interrupt/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/test/src/main/java/test/Ice/interrupt/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/invoke/AllTests.java b/java/test/src/main/java/test/Ice/invoke/AllTests.java index 79e1d88761b..ad641cadc46 100644 --- a/java/test/src/main/java/test/Ice/invoke/AllTests.java +++ b/java/test/src/main/java/test/Ice/invoke/AllTests.java @@ -31,9 +31,11 @@ public class AllTests } } - public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static MyClassPrx allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrx.checkedCast(base); MyClassPrx oneway = cl.ice_oneway(); diff --git a/java/test/src/main/java/test/Ice/invoke/Client.java b/java/test/src/main/java/test/Ice/invoke/Client.java index e123ae57359..c7a95f442cf 100644 --- a/java/test/src/main/java/test/Ice/invoke/Client.java +++ b/java/test/src/main/java/test/Ice/invoke/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - MyClassPrx myClass = AllTests.allTests(communicator(), getWriter()); + MyClassPrx myClass = AllTests.allTests(this); myClass.shutdown(); diff --git a/java/test/src/main/java/test/Ice/invoke/Server.java b/java/test/src/main/java/test/Ice/invoke/Server.java index daf97fe4c25..45ffbab0051 100644 --- a/java/test/src/main/java/test/Ice/invoke/Server.java +++ b/java/test/src/main/java/test/Ice/invoke/Server.java @@ -23,7 +23,7 @@ public class Server extends test.Util.Application } } - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.addServantLocator(new ServantLocatorI(async), ""); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/invoke/run.py b/java/test/src/main/java/test/Ice/invoke/run.py deleted file mode 100755 index cc257835523..00000000000 --- a/java/test/src/main/java/test/Ice/invoke/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 - -TestUtil.queueClientServerTest(configName = "blobject", message = "Running test with Blobject server.") -TestUtil.queueClientServerTest(configName = "blobjectAsync", message = "Running test with BlobjectAsync server.", - additionalServerOptions = "--async") -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/location/AllTests.java b/java/test/src/main/java/test/Ice/location/AllTests.java index e3fee0edb51..60bcd506d8f 100644 --- a/java/test/src/main/java/test/Ice/location/AllTests.java +++ b/java/test/src/main/java/test/Ice/location/AllTests.java @@ -40,7 +40,7 @@ public class AllTests PrintWriter out = app.getWriter(); ServerManagerPrx manager = ServerManagerPrx.checkedCast( - communicator.stringToProxy("ServerManager :default -p 12010")); + communicator.stringToProxy("ServerManager:" + app.getTestEndpoint(0))); test(manager != null); TestLocatorPrx locator = TestLocatorPrx.uncheckedCast(communicator.getDefaultLocator()); diff --git a/java/test/src/main/java/test/Ice/location/Client.java b/java/test/src/main/java/test/Ice/location/Client.java index 696b59f99cd..7bec57529f9 100644 --- a/java/test/src/main/java/test/Ice/location/Client.java +++ b/java/test/src/main/java/test/Ice/location/Client.java @@ -42,7 +42,7 @@ public class Client extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); - r.initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); + r.initData.properties.setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/location/Server.java b/java/test/src/main/java/test/Ice/location/Server.java index 0b702aedae1..3b7e36b72cf 100644 --- a/java/test/src/main/java/test/Ice/location/Server.java +++ b/java/test/src/main/java/test/Ice/location/Server.java @@ -17,7 +17,7 @@ public class Server extends test.Util.Application public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); - + // // Register the server manager. The server manager creates a new // 'server' (a server isn't a different process, it's just a new @@ -54,7 +54,8 @@ public class Server extends test.Util.Application r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); r.initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2"); r.initData.properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0"); - r.initData.properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("ServerManagerAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + ":udp"); _initData = r.initData; return r; diff --git a/java/test/src/main/java/test/Ice/location/ServerManagerI.java b/java/test/src/main/java/test/Ice/location/ServerManagerI.java index b84c2a31df8..060e062aa19 100644 --- a/java/test/src/main/java/test/Ice/location/ServerManagerI.java +++ b/java/test/src/main/java/test/Ice/location/ServerManagerI.java @@ -18,10 +18,10 @@ public class ServerManagerI implements ServerManager { _registry = registry; _communicators = new java.util.ArrayList<com.zeroc.Ice.Communicator>(); - + _app = app; _initData = initData; - + _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter"); _initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); _initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2"); @@ -52,13 +52,13 @@ public class ServerManagerI implements ServerManager // Use fixed port to ensure that OA re-activation doesn't re-use previous port from // another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter). // - serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + _nextPort++); - serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p " + _nextPort++); + serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", _app.getTestEndpoint(_nextPort++)); + serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", _app.getTestEndpoint(_nextPort++)); com.zeroc.Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2"); - com.zeroc.Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010"); + com.zeroc.Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:" + _app.getTestEndpoint(0)); adapter.setLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator)); adapter2.setLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator)); @@ -85,5 +85,5 @@ public class ServerManagerI implements ServerManager private java.util.List<com.zeroc.Ice.Communicator> _communicators; private com.zeroc.Ice.InitializationData _initData; private test.Util.Application _app; - private int _nextPort = 12011; + private int _nextPort = 1; } diff --git a/java/test/src/main/java/test/Ice/location/run.py b/java/test/src/main/java/test/Ice/location/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/location/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/metrics/AMDServer.java b/java/test/src/main/java/test/Ice/metrics/AMDServer.java index ab1dd0d83a0..2b99d9e0e1a 100644 --- a/java/test/src/main/java/test/Ice/metrics/AMDServer.java +++ b/java/test/src/main/java/test/Ice/metrics/AMDServer.java @@ -18,8 +18,8 @@ public class AMDServer extends test.Util.Application com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new AMDMetricsI(), com.zeroc.Ice.Util.stringToIdentity("metrics")); adapter.activate(); - - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); @@ -32,7 +32,7 @@ public class AMDServer extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); r.initData.properties.setProperty("Ice.Admin.InstanceName", "server"); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); diff --git a/java/test/src/main/java/test/Ice/metrics/AllTests.java b/java/test/src/main/java/test/Ice/metrics/AllTests.java index 154de71dfd7..3212f79c07d 100644 --- a/java/test/src/main/java/test/Ice/metrics/AllTests.java +++ b/java/test/src/main/java/test/Ice/metrics/AllTests.java @@ -28,6 +28,11 @@ public class AllTests } } + static String getPort(com.zeroc.Ice.PropertiesAdminPrx p) + { + return Integer.toString(test.Util.Application.getTestPort(p.ice_getCommunicator().getProperties(), 0)); + } + static ConnectionMetrics getServerConnectionMetrics(MetricsAdminPrx metrics, long expected) { try @@ -113,8 +118,8 @@ public class AllTests private boolean _wait; } - static private Map<String, String> getClientProps(com.zeroc.Ice.PropertiesAdminPrx p, Map<String, String> orig, - String m) + static private Map<String, String> getClientProps(com.zeroc.Ice.PropertiesAdminPrx p, + Map<String, String> orig, String m) { Map<String, String> props = p.getPropertiesForPrefix("IceMX.Metrics"); for(Map.Entry<String, String> e : props.entrySet()) @@ -131,13 +136,13 @@ public class AllTests map += "Map." + m + '.'; } props.put("IceMX.Metrics.View." + map + "Reject.parent", "Ice\\.Admin"); - props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", "12010"); + props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", getPort(p)); props.put("IceMX.Metrics.View." + map + "Reject.identity", ".*/admin|controller"); return props; } - static private Map<String, String> getServerProps(com.zeroc.Ice.PropertiesAdminPrx p, Map<String, String> orig, - String m) + static private Map<String, String> getServerProps(com.zeroc.Ice.PropertiesAdminPrx p, + Map<String, String> orig, String m) { Map<String, String> props = p.getPropertiesForPrefix("IceMX.Metrics"); for(Map.Entry<String, String> e : props.entrySet()) @@ -154,7 +159,7 @@ public class AllTests map += "Map." + m + '.'; } props.put("IceMX.Metrics.View." + map + "Reject.parent", "Ice\\.Admin|Controller"); - props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", "12010"); + props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", getPort(p)); return props; } @@ -372,10 +377,19 @@ public class AllTests return m; } - static MetricsPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out, CommunicatorObserverI obsv) + static MetricsPrx allTests(test.Util.Application app, CommunicatorObserverI obsv) throws UnknownMetricsView { - MetricsPrx metrics = MetricsPrx.checkedCast(communicator.stringToProxy("metrics:default -p 12010")); + PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + + String host = app.getTestHost(); + String port = Integer.toString(app.getTestPort(0)); + String hostAndPort = host + ":" + port; + String protocol = app.getTestProtocol(); + String endpoint = protocol + " -h " + host + " -p " + port; + + MetricsPrx metrics = MetricsPrx.checkedCast(communicator.stringToProxy("metrics:" + endpoint)); boolean collocated = metrics.ice_getConnection() == null; int threadCount = 4; @@ -413,7 +427,7 @@ public class AllTests test(r.returnValue.get("Connection").length == 1 && r.returnValue.get("Connection")[0].current == 1 && r.returnValue.get("Connection")[0].total == 1); } - test(r.returnValue.get("Thread").length == 1 && r.returnValue.get("Thread")[0].current == threadCount && + test(r.returnValue.get("Thread").length == 1 && r.returnValue.get("Thread")[0].current == threadCount && r.returnValue.get("Thread")[0].total == threadCount); out.println("ok"); @@ -474,8 +488,6 @@ public class AllTests out.println("ok"); - String endpoint = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp") + - " -h 127.0.0.1 -p 12010"; String type = ""; String isSecure = ""; if(!collocated) @@ -562,7 +574,7 @@ public class AllTests test(map.get("active").current == 1); ControllerPrx controller = ControllerPrx.checkedCast( - communicator.stringToProxy("controller:default -p 12011")); + communicator.stringToProxy("controller:" + app.getTestEndpoint(1))); controller.hold(); map = toMap(clientMetrics.getMetricsView("View").returnValue.get("Connection")); @@ -634,16 +646,16 @@ public class AllTests testAttribute(clientMetrics, clientProps, "Connection", "endpointIsSecure", isSecure, out); testAttribute(clientMetrics, clientProps, "Connection", "endpointTimeout", "500", out); testAttribute(clientMetrics, clientProps, "Connection", "endpointCompress", "false", out); - testAttribute(clientMetrics, clientProps, "Connection", "endpointHost", "127.0.0.1", out); - testAttribute(clientMetrics, clientProps, "Connection", "endpointPort", "12010", out); + testAttribute(clientMetrics, clientProps, "Connection", "endpointHost", host, out); + testAttribute(clientMetrics, clientProps, "Connection", "endpointPort", port, out); testAttribute(clientMetrics, clientProps, "Connection", "incoming", "false", out); testAttribute(clientMetrics, clientProps, "Connection", "adapterName", "", out); testAttribute(clientMetrics, clientProps, "Connection", "connectionId", "Con1", out); - testAttribute(clientMetrics, clientProps, "Connection", "localHost", "127.0.0.1", out); + testAttribute(clientMetrics, clientProps, "Connection", "localHost", host, out); //testAttribute(clientMetrics, clientProps, "Connection", "localPort", "", out); - testAttribute(clientMetrics, clientProps, "Connection", "remoteHost", "127.0.0.1", out); - testAttribute(clientMetrics, clientProps, "Connection", "remotePort", "12010", out); + testAttribute(clientMetrics, clientProps, "Connection", "remoteHost", host, out); + testAttribute(clientMetrics, clientProps, "Connection", "remotePort", port, out); testAttribute(clientMetrics, clientProps, "Connection", "mcastHost", "", out); testAttribute(clientMetrics, clientProps, "Connection", "mcastPort", "", out); @@ -666,13 +678,13 @@ public class AllTests test(clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment").length == 1); com.zeroc.IceMX.Metrics m1 = clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment")[0]; - test(m1.current == 0 && m1.total == 1 && m1.id.equals("127.0.0.1:12010")); + test(m1.current == 0 && m1.total == 1 && m1.id.equals(hostAndPort)); metrics.ice_getConnection().close(false); controller.hold(); try { - communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping(); + communicator.stringToProxy("test:" + endpoint).ice_timeout(10).ice_ping(); test(false); } catch(com.zeroc.Ice.ConnectTimeoutException ex) @@ -685,14 +697,14 @@ public class AllTests controller.resume(); test(clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment").length == 1); m1 = clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment")[0]; - test(m1.id.equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2); + test(m1.id.equals(hostAndPort) && m1.total == 3 && m1.failures == 2); checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "::Ice::ConnectTimeoutException", 2, out); Connect c = new Connect(metrics); testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "parent", "Communicator", c, out); - testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "id", "127.0.0.1:12010", c, + testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "id", hostAndPort, c, out); testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpoint", endpoint + " -t 60000", c, out); @@ -706,9 +718,9 @@ public class AllTests out); testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointCompress", "false", c, out); - testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c, + testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointHost", host, c, out); - testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointPort", "12010", c, + testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointPort", port, c, out); out.println("ok"); @@ -716,24 +728,29 @@ public class AllTests out.print("testing endpoint lookup metrics... "); out.flush(); - props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id"); + props.put("IceMX.Metrics.View.Map.EndpointLookup.GroupBy", "id"); updateProps(clientProps, serverProps, props, "EndpointLookup"); test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 0); com.zeroc.Ice.ObjectPrx prx = - communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite"); - prx.ice_ping(); + communicator.stringToProxy("metrics:" + protocol + " -p " + port + " -h localhost -t 500"); + try + { + prx.ice_ping(); + prx.ice_getConnection().close(false); + } + catch(com.zeroc.Ice.LocalException ex) + { + } test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 1); m1 = clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup")[0]; - test(m1.current <= 1 && m1.total == 1 && m1.id.equals(prx.ice_getConnection().getEndpoint().toString())); - - prx.ice_getConnection().close(false); + test(m1.current <= 1 && m1.total == 1); boolean dnsException = false; try { - communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping(); + communicator.stringToProxy("test:tcp -t 500 -h unknownfoo.zeroc.com -p " + port).ice_ping(); test(false); } catch(com.zeroc.Ice.DNSException ex) @@ -746,11 +763,11 @@ public class AllTests } test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 2); m1 = clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup")[0]; - if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500")) + if(!m1.id.equals("tcp -h unknownfoo.zeroc.com -p " + port + " -t 500")) { m1 = clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup")[1]; } - test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 && + test(m1.id.equals("tcp -h unknownfoo.zeroc.com -p " + port + " -t 500") && m1.total == 2 && (!dnsException || m1.failures == 2)); if(dnsException) { @@ -768,10 +785,10 @@ public class AllTests testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointType", type, c, out); testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointIsDatagram", "false", c, out); testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointIsSecure", isSecure, c, out); - testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointTimeout", "-1", c, out); + testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointTimeout", "500", c, out); testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointCompress", "false", c, out); testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointHost", "localhost", c, out); - testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointPort", "12010", c, out); + testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointPort", port, c, out); out.println("ok"); } @@ -868,16 +885,16 @@ public class AllTests testAttribute(serverMetrics, serverProps, "Dispatch", "endpointIsSecure", isSecure, op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "endpointTimeout", "60000", op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "endpointCompress", "false", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "endpointHost", "127.0.0.1", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "endpointPort", "12010", op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "endpointHost", host, op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "endpointPort", port, op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "incoming", "true", op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "adapterName", "TestAdapter", op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "connectionId", "", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "localHost", "127.0.0.1", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "localPort", "12010", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "remoteHost", "127.0.0.1", op, out); - //testAttribute(serverMetrics, serverProps, "Dispatch", "remotePort", "12010", op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "localHost", host, op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "localPort", port, op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "remoteHost", host, op, out); + //testAttribute(serverMetrics, serverProps, "Dispatch", "remotePort", port, op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "mcastHost", "", op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "mcastPort", "", op, out); } diff --git a/java/test/src/main/java/test/Ice/metrics/Client.java b/java/test/src/main/java/test/Ice/metrics/Client.java index d5bb7488b19..cb5624f219a 100644 --- a/java/test/src/main/java/test/Ice/metrics/Client.java +++ b/java/test/src/main/java/test/Ice/metrics/Client.java @@ -16,10 +16,9 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); try { - MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer); + MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); } catch(com.zeroc.Ice.UserException ex) diff --git a/java/test/src/main/java/test/Ice/metrics/Collocated.java b/java/test/src/main/java/test/Ice/metrics/Collocated.java index 2b6775aa029..8a00546b309 100644 --- a/java/test/src/main/java/test/Ice/metrics/Collocated.java +++ b/java/test/src/main/java/test/Ice/metrics/Collocated.java @@ -22,14 +22,14 @@ public class Collocated extends test.Util.Application adapter.add(new MetricsI(), com.zeroc.Ice.Util.stringToIdentity("metrics")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller")); //controllerAdapter.activate(); // Don't activate OA to ensure collocation is used. try { - MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer); + MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); } catch(com.zeroc.Ice.UserException ex) @@ -56,7 +56,7 @@ public class Collocated extends test.Util.Application r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); r.initData.properties.setProperty("Ice.Admin.InstanceName", "client"); r.initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); r.initData.properties.setProperty("Ice.MessageSizeMax", "50000"); diff --git a/java/test/src/main/java/test/Ice/metrics/Server.java b/java/test/src/main/java/test/Ice/metrics/Server.java index 45e77982a4d..5d4e4a35a0c 100644 --- a/java/test/src/main/java/test/Ice/metrics/Server.java +++ b/java/test/src/main/java/test/Ice/metrics/Server.java @@ -19,7 +19,7 @@ public class Server extends test.Util.Application adapter.add(new MetricsI(), com.zeroc.Ice.Util.stringToIdentity("metrics")); adapter.activate(); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); @@ -32,7 +32,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); r.initData.properties.setProperty("Ice.Admin.InstanceName", "server"); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); diff --git a/java/test/src/main/java/test/Ice/metrics/run.py b/java/test/src/main/java/test/Ice/metrics/run.py deleted file mode 100755 index 88b29abdfd1..00000000000 --- a/java/test/src/main/java/test/Ice/metrics/run.py +++ /dev/null @@ -1,28 +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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.metrics.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/networkProxy/AllTests.java b/java/test/src/main/java/test/Ice/networkProxy/AllTests.java index 021047d3d62..7ac437e2053 100644 --- a/java/test/src/main/java/test/Ice/networkProxy/AllTests.java +++ b/java/test/src/main/java/test/Ice/networkProxy/AllTests.java @@ -28,10 +28,16 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); + int proxyPort = communicator.getProperties().getPropertyAsInt("Ice.HTTPProxyPort"); + if(proxyPort == 0) + { + proxyPort = communicator.getProperties().getPropertyAsInt("Ice.SOCKSProxyPort"); + } + TestIntfPrx test = TestIntfPrx.checkedCast(obj); test(test != null); @@ -53,7 +59,7 @@ public class AllTests info = (com.zeroc.Ice.IPConnectionInfo)p; } } - 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. } out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/networkProxy/Server.java b/java/test/src/main/java/test/Ice/networkProxy/Server.java index 43b77f86a4e..7928810bb32 100644 --- a/java/test/src/main/java/test/Ice/networkProxy/Server.java +++ b/java/test/src/main/java/test/Ice/networkProxy/Server.java @@ -36,7 +36,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/networkProxy/run.py b/java/test/src/main/java/test/Ice/networkProxy/run.py deleted file mode 100755 index fa8d2fcbb15..00000000000 --- a/java/test/src/main/java/test/Ice/networkProxy/run.py +++ /dev/null @@ -1,46 +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") diff --git a/java/test/src/main/java/test/Ice/objects/AllTests.java b/java/test/src/main/java/test/Ice/objects/AllTests.java index 13a5f07a647..a9dbe1745e1 100644 --- a/java/test/src/main/java/test/Ice/objects/AllTests.java +++ b/java/test/src/main/java/test/Ice/objects/AllTests.java @@ -40,11 +40,13 @@ public class AllTests } @SuppressWarnings("deprecation") - public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -260,7 +262,7 @@ public class AllTests out.print("testing UnexpectedObjectException..."); out.flush(); - ref = "uoet:default -p 12010"; + ref = "uoet:" + app.getTestEndpoint(0); base = communicator.stringToProxy(ref); test(base != null); UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrx.uncheckedCast(base); diff --git a/java/test/src/main/java/test/Ice/objects/Client.java b/java/test/src/main/java/test/Ice/objects/Client.java index d428856cb6e..7b19cc1e875 100644 --- a/java/test/src/main/java/test/Ice/objects/Client.java +++ b/java/test/src/main/java/test/Ice/objects/Client.java @@ -89,7 +89,7 @@ public class Client extends test.Util.Application communicator.addObjectFactory(new MyObjectFactory(), "TestOF"); - InitialPrx initial = AllTests.allTests(communicator, getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/objects/Collocated.java b/java/test/src/main/java/test/Ice/objects/Collocated.java index 2f4a639d471..3739290ebff 100644 --- a/java/test/src/main/java/test/Ice/objects/Collocated.java +++ b/java/test/src/main/java/test/Ice/objects/Collocated.java @@ -89,13 +89,13 @@ public class Collocated extends test.Util.Application communicator.addObjectFactory(new MyObjectFactory(), "TestOF"); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); _InitialDisp initial = new InitialI(adapter); adapter.add(initial, com.zeroc.Ice.Util.stringToIdentity("initial")); UnexpectedObjectExceptionTestI object = new UnexpectedObjectExceptionTestI(); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("uoet")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); // // We must call shutdown even in the collocated case for cyclic dependency cleanup. // diff --git a/java/test/src/main/java/test/Ice/objects/Server.java b/java/test/src/main/java/test/Ice/objects/Server.java index cfdd15f1690..a84526ae86b 100644 --- a/java/test/src/main/java/test/Ice/objects/Server.java +++ b/java/test/src/main/java/test/Ice/objects/Server.java @@ -58,7 +58,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/objects/run.py b/java/test/src/main/java/test/Ice/objects/run.py deleted file mode 100755 index c0e22437de7..00000000000 --- a/java/test/src/main/java/test/Ice/objects/run.py +++ /dev/null @@ -1,35 +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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/operations/AMDServer.java b/java/test/src/main/java/test/Ice/operations/AMDServer.java index 6a098dc5aa0..9d808248198 100644 --- a/java/test/src/main/java/test/Ice/operations/AMDServer.java +++ b/java/test/src/main/java/test/Ice/operations/AMDServer.java @@ -14,7 +14,7 @@ public class AMDServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDMyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/operations/AllTests.java b/java/test/src/main/java/test/Ice/operations/AllTests.java index 9a9fbbe6d8c..07fdc236abe 100644 --- a/java/test/src/main/java/test/Ice/operations/AllTests.java +++ b/java/test/src/main/java/test/Ice/operations/AllTests.java @@ -16,10 +16,11 @@ import test.Ice.operations.Test.MyDerivedClassPrx; public class AllTests { - public static MyClassPrx allTests(test.Util.Application app, PrintWriter out) + public static MyClassPrx allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); com.zeroc.Ice.Communicator communicator = app.communicator(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrx.checkedCast(base); MyDerivedClassPrx derived = MyDerivedClassPrx.checkedCast(cl); diff --git a/java/test/src/main/java/test/Ice/operations/Client.java b/java/test/src/main/java/test/Ice/operations/Client.java index 2679071afb6..afad24e1b63 100644 --- a/java/test/src/main/java/test/Ice/operations/Client.java +++ b/java/test/src/main/java/test/Ice/operations/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { java.io.PrintWriter out = getWriter(); - MyClassPrx myClass = AllTests.allTests(this, out); + MyClassPrx myClass = AllTests.allTests(this); out.print("testing server shutdown... "); out.flush(); diff --git a/java/test/src/main/java/test/Ice/operations/Collocated.java b/java/test/src/main/java/test/Ice/operations/Collocated.java index 63b26e2cadd..8061bb73595 100644 --- a/java/test/src/main/java/test/Ice/operations/Collocated.java +++ b/java/test/src/main/java/test/Ice/operations/Collocated.java @@ -14,7 +14,7 @@ public class Collocated extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); java.io.PrintWriter out = getWriter(); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); com.zeroc.Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); @@ -25,7 +25,7 @@ public class Collocated extends test.Util.Application throw new RuntimeException(); } - AllTests.allTests(this, out); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/operations/Server.java b/java/test/src/main/java/test/Ice/operations/Server.java index bad17efba6b..c49cd7c3032 100644 --- a/java/test/src/main/java/test/Ice/operations/Server.java +++ b/java/test/src/main/java/test/Ice/operations/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/operations/Twoways.java b/java/test/src/main/java/test/Ice/operations/Twoways.java index 2847261d507..b575811ba25 100644 --- a/java/test/src/main/java/test/Ice/operations/Twoways.java +++ b/java/test/src/main/java/test/Ice/operations/Twoways.java @@ -1412,7 +1412,7 @@ class Twoways ctx.put("two", "TWO"); ctx.put("three", "THREE"); - MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:default -p 12010")); + MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); diff --git a/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java b/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java index 4d81286b720..f5bcdcd4dd2 100644 --- a/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java +++ b/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java @@ -1575,7 +1575,7 @@ class TwowaysAMI ctx.put("two", "TWO"); ctx.put("three", "THREE"); - MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:default -p 12010")); + MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); diff --git a/java/test/src/main/java/test/Ice/operations/run.py b/java/test/src/main/java/test/Ice/operations/run.py deleted file mode 100755 index 3b3b470f074..00000000000 --- a/java/test/src/main/java/test/Ice/operations/run.py +++ /dev/null @@ -1,31 +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(additionalClientOptions = "--Ice.Warn.AMICallback=0") - -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", - server="test.Ice.operations.AMDServer") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/optional/AMDServer.java b/java/test/src/main/java/test/Ice/optional/AMDServer.java index 98f9e74760c..517a5c69c9f 100644 --- a/java/test/src/main/java/test/Ice/optional/AMDServer.java +++ b/java/test/src/main/java/test/Ice/optional/AMDServer.java @@ -14,7 +14,7 @@ public class AMDServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDInitialI(), com.zeroc.Ice.Util.stringToIdentity("initial")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/optional/AllTests.java b/java/test/src/main/java/test/Ice/optional/AllTests.java index 069f1d113dd..ce80d92f6ad 100644 --- a/java/test/src/main/java/test/Ice/optional/AllTests.java +++ b/java/test/src/main/java/test/Ice/optional/AllTests.java @@ -37,8 +37,9 @@ public class AllTests T value; } - public static InitialPrx allTests(test.Util.Application app, boolean collocated, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app, boolean collocated) { + PrintWriter out = app.getWriter(); com.zeroc.Ice.Communicator communicator = app.communicator(); FactoryI factory = new FactoryI(); @@ -46,7 +47,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/optional/Client.java b/java/test/src/main/java/test/Ice/optional/Client.java index 41e0b2c0f66..6cb2d026894 100644 --- a/java/test/src/main/java/test/Ice/optional/Client.java +++ b/java/test/src/main/java/test/Ice/optional/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - java.io.PrintWriter out = getWriter(); - InitialPrx initial = AllTests.allTests(this, false, out); + InitialPrx initial = AllTests.allTests(this, false); initial.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/optional/Server.java b/java/test/src/main/java/test/Ice/optional/Server.java index f036c674d5e..3a932f327eb 100644 --- a/java/test/src/main/java/test/Ice/optional/Server.java +++ b/java/test/src/main/java/test/Ice/optional/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new InitialI(), com.zeroc.Ice.Util.stringToIdentity("initial")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/optional/run.py b/java/test/src/main/java/test/Ice/optional/run.py deleted file mode 100755 index 6c82786dc7f..00000000000 --- a/java/test/src/main/java/test/Ice/optional/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 - -TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.") -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.optional.AMDServer") -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/packagemd/AllTests.java b/java/test/src/main/java/test/Ice/packagemd/AllTests.java index 026eb8970f9..28a8501c0b7 100644 --- a/java/test/src/main/java/test/Ice/packagemd/AllTests.java +++ b/java/test/src/main/java/test/Ice/packagemd/AllTests.java @@ -28,11 +28,13 @@ public class AllTests } } - public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/packagemd/Client.java b/java/test/src/main/java/test/Ice/packagemd/Client.java index cd11c053f38..d61aee98702 100644 --- a/java/test/src/main/java/test/Ice/packagemd/Client.java +++ b/java/test/src/main/java/test/Ice/packagemd/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - InitialPrx initial = AllTests.allTests(communicator(), getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/packagemd/Server.java b/java/test/src/main/java/test/Ice/packagemd/Server.java index 8b3a2326d24..0708eee15ec 100644 --- a/java/test/src/main/java/test/Ice/packagemd/Server.java +++ b/java/test/src/main/java/test/Ice/packagemd/Server.java @@ -28,7 +28,7 @@ public class Server extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); r.initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/packagemd/run.py b/java/test/src/main/java/test/Ice/packagemd/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/packagemd/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/plugin/run.py b/java/test/src/main/java/test/Ice/plugin/run.py deleted file mode 100755 index 7f28bf562d9..00000000000 --- a/java/test/src/main/java/test/Ice/plugin/run.py +++ /dev/null @@ -1,31 +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 - -sys.stdout.write("starting test... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.plugin.Client",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() - diff --git a/java/test/src/main/java/test/Ice/properties/run.py b/java/test/src/main/java/test/Ice/properties/run.py deleted file mode 100755 index 8779d076462..00000000000 --- a/java/test/src/main/java/test/Ice/properties/run.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -# -# Write config -# -if sys.version_info[0] == 2: - configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config" - decodedPath = configPath.decode("utf-8") -else: - configPath = "./config/\u4e2d\u56fd_client.config" - decodedPath = configPath # No need to decode with Python3, strings are already Unicode - -TestUtil.createFile(decodedPath, - ["# Automatically generated by Ice test driver.", - "Ice.Trace.Protocol=1", - "Ice.Trace.Network=1", - "Ice.ProgramName=PropertiesClient", - "Config.Path=" + configPath], - "utf-8") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.properties.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() - -if os.path.exists(decodedPath): - os.remove(decodedPath) diff --git a/java/test/src/main/java/test/Ice/proxy/AMDServer.java b/java/test/src/main/java/test/Ice/proxy/AMDServer.java index 7b656360223..a8269702cd5 100644 --- a/java/test/src/main/java/test/Ice/proxy/AMDServer.java +++ b/java/test/src/main/java/test/Ice/proxy/AMDServer.java @@ -27,7 +27,7 @@ public class AMDServer extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy.AMD"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/proxy/AllTests.java b/java/test/src/main/java/test/Ice/proxy/AllTests.java index 7ae04ce7b88..be50024641a 100644 --- a/java/test/src/main/java/test/Ice/proxy/AllTests.java +++ b/java/test/src/main/java/test/Ice/proxy/AllTests.java @@ -29,11 +29,13 @@ public class AllTests } } - public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static MyClassPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); ObjectPrx base = communicator.stringToProxy(ref); test(base != null); @@ -356,7 +358,7 @@ public class AllTests out.flush(); com.zeroc.Ice.Properties prop = communicator.getProperties(); String propertyPrefix = "Foo.Proxy"; - prop.setProperty(propertyPrefix, "test:default -p 12010"); + prop.setProperty(propertyPrefix, "test:" + app.getTestEndpoint(0)); b1 = communicator.propertyToProxy(propertyPrefix); test(b1.ice_getIdentity().name.equals("test") && b1.ice_getIdentity().category.length() == 0 && b1.ice_getAdapterId().length() == 0 && b1.ice_getFacet().length() == 0); @@ -400,7 +402,7 @@ public class AllTests //test(b1.ice_getLocatorCacheTimeout() == 60); //prop.setProperty("Ice.Default.LocatorCacheTimeout", ""); - prop.setProperty(propertyPrefix, "test:default -p 12010"); + prop.setProperty(propertyPrefix, "test:" + app.getTestEndpoint(0)); property = propertyPrefix + ".Router"; test(b1.ice_getRouter() == null); @@ -768,7 +770,7 @@ public class AllTests out.print("testing encoding versioning... "); out.flush(); - String ref20 = "test -e 2.0:default -p 12010"; + String ref20 = "test -e 2.0:" + app.getTestEndpoint(0); MyClassPrx cl20 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -780,7 +782,7 @@ public class AllTests // Server 2.0 endpoint doesn't support 1.1 version. } - String ref10 = "test -e 1.0:default -p 12010"; + String ref10 = "test -e 1.0:" + app.getTestEndpoint(0); MyClassPrx cl10 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref10)); cl10.ice_ping(); cl10.ice_encodingVersion(Util.Encoding_1_0).ice_ping(); @@ -788,7 +790,7 @@ public class AllTests // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the // call will use the 1.1 encoding - String ref13 = "test -e 1.3:default -p 12010"; + String ref13 = "test -e 1.3:" + app.getTestEndpoint(0); MyClassPrx cl13 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.ice_pingAsync().join(); @@ -835,7 +837,7 @@ public class AllTests out.print("testing protocol versioning... "); out.flush(); - ref20 = "test -p 2.0:default -p 12010"; + ref20 = "test -p 2.0:" + app.getTestEndpoint(0); cl20 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -847,13 +849,13 @@ public class AllTests // Server 2.0 proxy doesn't support 1.0 version. } - ref10 = "test -p 1.0:default -p 12010"; + ref10 = "test -p 1.0:" + app.getTestEndpoint(0); cl10 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref10)); cl10.ice_ping(); // 1.3 isn't supported but since a 1.3 proxy supports 1.1, the // call will use the 1.1 protocol - ref13 = "test -p 1.3:default -p 12010"; + ref13 = "test -p 1.3:" + app.getTestEndpoint(0); cl13 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.ice_pingAsync().join(); @@ -986,10 +988,6 @@ public class AllTests // Working? boolean ssl = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("ssl"); boolean tcp = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("tcp"); - if(tcp) - { - p1.ice_encodingVersion(Util.Encoding_1_0).ice_ping(); - } // Two legal TCP endpoints expressed as opaque endpoints p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA=="); @@ -1012,23 +1010,6 @@ public class AllTests } // - // Try to invoke on the SSL endpoint to verify that we get a - // NoEndpointException (or ConnectFailedException when - // running with SSL). - // - if(ssl) - { - try - { - p1.ice_encodingVersion(Util.Encoding_1_0).ice_ping(); - test(false); - } - catch(com.zeroc.Ice.ConnectFailedException ex) - { - } - } - - // // Test that the proxy with an SSL endpoint and a nonsense // endpoint (which the server doesn't understand either) can // be sent over the wire and returned by the server without diff --git a/java/test/src/main/java/test/Ice/proxy/Client.java b/java/test/src/main/java/test/Ice/proxy/Client.java index 916231a58fe..7c4605a94d3 100644 --- a/java/test/src/main/java/test/Ice/proxy/Client.java +++ b/java/test/src/main/java/test/Ice/proxy/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - MyClassPrx myClass = AllTests.allTests(communicator(), getWriter()); + MyClassPrx myClass = AllTests.allTests(this); myClass.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/proxy/Collocated.java b/java/test/src/main/java/test/Ice/proxy/Collocated.java index 8d1ce1cfb95..ddb3f371c13 100644 --- a/java/test/src/main/java/test/Ice/proxy/Collocated.java +++ b/java/test/src/main/java/test/Ice/proxy/Collocated.java @@ -15,12 +15,12 @@ public class Collocated extends test.Util.Application public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/proxy/Server.java b/java/test/src/main/java/test/Ice/proxy/Server.java index 3c936989a70..f9af6271905 100644 --- a/java/test/src/main/java/test/Ice/proxy/Server.java +++ b/java/test/src/main/java/test/Ice/proxy/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/proxy/run.py b/java/test/src/main/java/test/Ice/proxy/run.py deleted file mode 100755 index 0d0598cb160..00000000000 --- a/java/test/src/main/java/test/Ice/proxy/run.py +++ /dev/null @@ -1,28 +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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.proxy.AMDServer") -TestUtil.queueCollocatedTest(additionalOptions = "--Ice.ToStringMode=Compat") -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/retry/AllTests.java b/java/test/src/main/java/test/Ice/retry/AllTests.java index 1c878aacf9a..d6f17b58220 100644 --- a/java/test/src/main/java/test/Ice/retry/AllTests.java +++ b/java/test/src/main/java/test/Ice/retry/AllTests.java @@ -56,9 +56,13 @@ public class AllTests private boolean _called; } - public static RetryPrx allTests(com.zeroc.Ice.Communicator communicator, com.zeroc.Ice.Communicator communicator2, - PrintWriter out, Instrumentation instrumentation, String ref) + public static RetryPrx allTests(test.Util.Application app, + com.zeroc.Ice.Communicator communicator, + com.zeroc.Ice.Communicator communicator2, + Instrumentation instrumentation, + String ref) { + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); com.zeroc.Ice.ObjectPrx base1 = communicator.stringToProxy(ref); @@ -102,7 +106,7 @@ public class AllTests instrumentation.testFailureCount(1); instrumentation.testRetryCount(0); out.println("ok"); - + out.print("calling regular operation with first proxy again... "); out.flush(); retry1.op(false); diff --git a/java/test/src/main/java/test/Ice/retry/Client.java b/java/test/src/main/java/test/Ice/retry/Client.java index 93d3b604483..da9d437875e 100644 --- a/java/test/src/main/java/test/Ice/retry/Client.java +++ b/java/test/src/main/java/test/Ice/retry/Client.java @@ -33,8 +33,8 @@ public class Client extends test.Util.Application try { - RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation, - "retry:default -p 12010"); + RetryPrx retry = AllTests.allTests(this, communicator, communicator2, instrumentation, + "retry:" + getTestEndpoint(0)); retry.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/retry/Collocated.java b/java/test/src/main/java/test/Ice/retry/Collocated.java index cf0c420a96e..b98ab9c34f4 100644 --- a/java/test/src/main/java/test/Ice/retry/Collocated.java +++ b/java/test/src/main/java/test/Ice/retry/Collocated.java @@ -43,7 +43,7 @@ public class Collocated extends test.Util.Application try { - RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation, "retry"); + RetryPrx retry = AllTests.allTests(this, communicator, communicator2, instrumentation, "retry"); retry.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/retry/Server.java b/java/test/src/main/java/test/Ice/retry/Server.java index 5321ac7e0e2..63cd123627a 100644 --- a/java/test/src/main/java/test/Ice/retry/Server.java +++ b/java/test/src/main/java/test/Ice/retry/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/retry/run.py b/java/test/src/main/java/test/Ice/retry/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/test/src/main/java/test/Ice/retry/run.py +++ /dev/null @@ -1,26 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java b/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java index bea35e684a6..f3626aab9b7 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java +++ b/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java @@ -26,7 +26,7 @@ public class AMDServer extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping.AMD"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); return r; } diff --git a/java/test/src/main/java/test/Ice/seqMapping/AllTests.java b/java/test/src/main/java/test/Ice/seqMapping/AllTests.java index d6e9b7cb391..ad503005f93 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/AllTests.java +++ b/java/test/src/main/java/test/Ice/seqMapping/AllTests.java @@ -15,9 +15,12 @@ import test.Ice.seqMapping.Test.*; public class AllTests { - public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out) + public static MyClassPrx allTests(test.Util.Application app, boolean collocated) { - String ref = "test:default -p 12010"; + PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrx.checkedCast(baseProxy); diff --git a/java/test/src/main/java/test/Ice/seqMapping/Client.java b/java/test/src/main/java/test/Ice/seqMapping/Client.java index f4b9dfe02ac..ff07596efb6 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/Client.java +++ b/java/test/src/main/java/test/Ice/seqMapping/Client.java @@ -18,7 +18,7 @@ public class Client extends test.Util.Application { java.io.PrintWriter out = getWriter(); - MyClassPrx myClass = AllTests.allTests(communicator(), false, out); + MyClassPrx myClass = AllTests.allTests(this, false); out.print("shutting down server... "); out.flush(); diff --git a/java/test/src/main/java/test/Ice/seqMapping/Collocated.java b/java/test/src/main/java/test/Ice/seqMapping/Collocated.java index 45f82daf413..087bac54f0d 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/Collocated.java +++ b/java/test/src/main/java/test/Ice/seqMapping/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application adapter.add(new MyClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator(), true, out); + AllTests.allTests(this, true); return 0; } @@ -29,7 +29,7 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/seqMapping/Server.java b/java/test/src/main/java/test/Ice/seqMapping/Server.java index a0030daa477..45cbc179e79 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/Server.java +++ b/java/test/src/main/java/test/Ice/seqMapping/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); return r; } diff --git a/java/test/src/main/java/test/Ice/seqMapping/run.py b/java/test/src/main/java/test/Ice/seqMapping/run.py deleted file mode 100755 index 685319f3cae..00000000000 --- a/java/test/src/main/java/test/Ice/seqMapping/run.py +++ /dev/null @@ -1,28 +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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.seqMapping.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/serialize/AllTests.java b/java/test/src/main/java/test/Ice/serialize/AllTests.java index b38ff97e156..bf731367dae 100644 --- a/java/test/src/main/java/test/Ice/serialize/AllTests.java +++ b/java/test/src/main/java/test/Ice/serialize/AllTests.java @@ -23,9 +23,12 @@ public class AllTests } } - public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app, boolean collocated) { - String ref = "initial:default -p 12010"; + PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); InitialPrx initial = InitialPrx.checkedCast(base); diff --git a/java/test/src/main/java/test/Ice/serialize/Client.java b/java/test/src/main/java/test/Ice/serialize/Client.java index 369362e0def..54c0da2f8ba 100644 --- a/java/test/src/main/java/test/Ice/serialize/Client.java +++ b/java/test/src/main/java/test/Ice/serialize/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { java.io.PrintWriter out = getWriter(); - InitialPrx initial = AllTests.allTests(communicator(), false, out); + InitialPrx initial = AllTests.allTests(this, false); initial.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/serialize/Server.java b/java/test/src/main/java/test/Ice/serialize/Server.java index e4c36995150..3a7138a63ab 100644 --- a/java/test/src/main/java/test/Ice/serialize/Server.java +++ b/java/test/src/main/java/test/Ice/serialize/Server.java @@ -28,7 +28,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/serialize/run.py b/java/test/src/main/java/test/Ice/serialize/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/serialize/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java b/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java index 50bdf4d905c..3b2d99565da 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java +++ b/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java @@ -29,7 +29,7 @@ public class AMDServer extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator.AMD"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; diff --git a/java/test/src/main/java/test/Ice/servantLocator/AllTests.java b/java/test/src/main/java/test/Ice/servantLocator/AllTests.java index b0fe10d68ce..961f4c5a8e7 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/AllTests.java +++ b/java/test/src/main/java/test/Ice/servantLocator/AllTests.java @@ -203,11 +203,13 @@ public class AllTests } } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "asm:default -p 12010"; + String ref = "asm:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -223,7 +225,7 @@ public class AllTests out.flush(); try { - ObjectPrx o = communicator.stringToProxy("category/locate:default -p 12010"); + ObjectPrx o = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); o.ice_ids(); test(false); } @@ -238,7 +240,7 @@ public class AllTests try { - ObjectPrx o = communicator.stringToProxy("category/finished:default -p 12010"); + ObjectPrx o = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0)); o.ice_ids(); test(false); } @@ -254,11 +256,11 @@ public class AllTests out.print("testing servant locator... "); out.flush(); - base = communicator.stringToProxy("category/locate:default -p 12010"); + base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrx.checkedCast(base); try { - TestIntfPrx.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010")); + TestIntfPrx.checkedCast(communicator.stringToProxy("category/unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { @@ -267,20 +269,20 @@ public class AllTests out.print("testing default servant locator... "); out.flush(); - base = communicator.stringToProxy("anothercat/locate:default -p 12010"); + base = communicator.stringToProxy("anothercat/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrx.checkedCast(base); - base = communicator.stringToProxy("locate:default -p 12010"); + base = communicator.stringToProxy("locate:" + app.getTestEndpoint(0)); obj = TestIntfPrx.checkedCast(base); try { - TestIntfPrx.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010")); + TestIntfPrx.checkedCast(communicator.stringToProxy("anothercat/unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { } try { - TestIntfPrx.checkedCast(communicator.stringToProxy("unknown:default -p 12010")); + TestIntfPrx.checkedCast(communicator.stringToProxy("unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { @@ -289,14 +291,14 @@ public class AllTests out.print("testing locate exceptions... "); out.flush(); - base = communicator.stringToProxy("category/locate:default -p 12010"); + base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrx.checkedCast(base); testExceptions(obj); out.println("ok"); out.print("testing finished exceptions... "); out.flush(); - base = communicator.stringToProxy("category/finished:default -p 12010"); + base = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0)); obj = TestIntfPrx.checkedCast(base); testExceptions(obj); @@ -340,7 +342,7 @@ public class AllTests out.print("testing servant locator removal... "); out.flush(); - base = communicator.stringToProxy("test/activation:default -p 12010"); + base = communicator.stringToProxy("test/activation:" + app.getTestEndpoint(0)); TestActivationPrx activation = TestActivationPrx.checkedCast(base); activation.activateServantLocator(false); try diff --git a/java/test/src/main/java/test/Ice/servantLocator/Client.java b/java/test/src/main/java/test/Ice/servantLocator/Client.java index 99622d68ed3..61864035ee9 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/Client.java +++ b/java/test/src/main/java/test/Ice/servantLocator/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - TestIntfPrx obj = AllTests.allTests(communicator(), getWriter()); + TestIntfPrx obj = AllTests.allTests(this); obj.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/servantLocator/Collocated.java b/java/test/src/main/java/test/Ice/servantLocator/Collocated.java index d9455de1cf2..b45e1e2c631 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/Collocated.java +++ b/java/test/src/main/java/test/Ice/servantLocator/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application adapter.addServantLocator(new ServantLocatorI(""), ""); adapter.add(new TestI(), com.zeroc.Ice.Util.stringToIdentity("asm")); adapter.add(new TestActivationI(), com.zeroc.Ice.Util.stringToIdentity("test/activation")); - AllTests.allTests(communicator(), getWriter()); + AllTests.allTests(this); return 0; } @@ -29,7 +29,7 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; diff --git a/java/test/src/main/java/test/Ice/servantLocator/Server.java b/java/test/src/main/java/test/Ice/servantLocator/Server.java index 6aa0b684d8d..82c88cb3002 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/Server.java +++ b/java/test/src/main/java/test/Ice/servantLocator/Server.java @@ -28,7 +28,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; diff --git a/java/test/src/main/java/test/Ice/servantLocator/run.py b/java/test/src/main/java/test/Ice/servantLocator/run.py deleted file mode 100755 index 205d37b5a05..00000000000 --- a/java/test/src/main/java/test/Ice/servantLocator/run.py +++ /dev/null @@ -1,28 +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.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.servantLocator.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java index e1aef24a5d0..5179443f130 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java @@ -27,7 +27,8 @@ public class AMDServer extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.serverAMD"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + " -t 2000"); return r; } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java index f7c1807962d..6d35a23797e 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java @@ -105,12 +105,14 @@ public class AllTests } } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, - java.io.PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app, boolean collocated) { + java.io.PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "Test:default -p 12010 -t 10000"; + String ref = "Test:" + app.getTestEndpoint(0) + " -t 10000"; com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java b/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java index 9c0aebde55f..f522b063d1b 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - TestIntfPrx test = AllTests.allTests(communicator(), false, getWriter()); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java b/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java index 2ff1ebd1c0c..39295b2aaea 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java @@ -27,7 +27,8 @@ public class Server extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.server"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + " -t 2000"); return r; } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/run.py b/java/test/src/main/java/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index e796b96ceef..00000000000 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,40 +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(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server="test.Ice.slicing.exceptions.AMDServer") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="test.Ice.slicing.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java b/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java index 13ec1d7438a..204215f8da2 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java +++ b/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java @@ -28,7 +28,8 @@ public class AMDServer extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.serverAMD"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + " -t 2000"); return r; } diff --git a/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java b/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java index 83813c2ecd2..01bb17c7bba 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java +++ b/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java @@ -109,11 +109,14 @@ public class AllTests public T v; } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app, boolean collocated) { + PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "Test:default -p 12010 -t 10000"; + String ref = "Test:" + app.getTestEndpoint(0) + " -t 10000"; com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/slicing/objects/Client.java b/java/test/src/main/java/test/Ice/slicing/objects/Client.java index bad24e2946e..6a53a72c057 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/Client.java +++ b/java/test/src/main/java/test/Ice/slicing/objects/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, false, getWriter()); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/slicing/objects/Server.java b/java/test/src/main/java/test/Ice/slicing/objects/Server.java index b25d118840c..ac9710f38e8 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/Server.java +++ b/java/test/src/main/java/test/Ice/slicing/objects/Server.java @@ -28,7 +28,8 @@ public class Server extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.server"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + " -t 2000"); return r; } diff --git a/java/test/src/main/java/test/Ice/slicing/objects/run.py b/java/test/src/main/java/test/Ice/slicing/objects/run.py deleted file mode 100755 index 89a4d8598ea..00000000000 --- a/java/test/src/main/java/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,40 +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(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server="test.Ice.slicing.objects.AMDServer") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="test.Ice.slicing.objects.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/stream/run.py b/java/test/src/main/java/test/Ice/stream/run.py deleted file mode 100755 index 66636d7a5c1..00000000000 --- a/java/test/src/main/java/test/Ice/stream/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with default encoding...") -TestUtil.simpleTest("test.Ice.stream.Client") - -print("Running test with 1.0 encoding...") -TestUtil.simpleTest("test.Ice.stream.Client", "--Ice.Default.EncodingVersion=1.0") diff --git a/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java b/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java index 4befa3d5967..86ed41dcd58 100644 --- a/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java +++ b/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java @@ -25,7 +25,7 @@ public class Client extends test.Util.Application public int run(String[] args) { java.io.PrintWriter out = getWriter(); - com.zeroc.Ice.ObjectPrx object = communicator().stringToProxy("test:default -p 12010 -t 10000"); + com.zeroc.Ice.ObjectPrx object = communicator().stringToProxy("test:" + getTestEndpoint(0) + " -t 10000"); PriorityPrx priority = PriorityPrx.checkedCast(object); out.print("testing thread priority... "); out.flush(); diff --git a/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java b/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java index 7fc77d818a6..2cc42c1145e 100644 --- a/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java +++ b/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 10000:udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new PriorityI(), com.zeroc.Ice.Util.stringToIdentity("test")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/threadPoolPriority/run.py b/java/test/src/main/java/test/Ice/threadPoolPriority/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/threadPoolPriority/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/throughput/test.py b/java/test/src/main/java/test/Ice/throughput/test.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/java/test/src/main/java/test/Ice/throughput/test.py diff --git a/java/test/src/main/java/test/Ice/timeout/AllTests.java b/java/test/src/main/java/test/Ice/timeout/AllTests.java index 6fd02201197..77370710887 100644 --- a/java/test/src/main/java/test/Ice/timeout/AllTests.java +++ b/java/test/src/main/java/test/Ice/timeout/AllTests.java @@ -62,7 +62,7 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "timeout:default -p 12010"; + String sref = "timeout:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java/test/src/main/java/test/Ice/timeout/Server.java b/java/test/src/main/java/test/Ice/timeout/Server.java index b2df019230f..be958c86bd5 100644 --- a/java/test/src/main/java/test/Ice/timeout/Server.java +++ b/java/test/src/main/java/test/Ice/timeout/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); // // Limit the recv buffer size, this test relies on the socket // send() blocking after sending a given amount of data. diff --git a/java/test/src/main/java/test/Ice/timeout/run.py b/java/test/src/main/java/test/Ice/timeout/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/test/src/main/java/test/Ice/timeout/run.py +++ /dev/null @@ -1,25 +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() diff --git a/java/test/src/main/java/test/Ice/udp/AllTests.java b/java/test/src/main/java/test/Ice/udp/AllTests.java index 012adc25c99..302f9849122 100644 --- a/java/test/src/main/java/test/Ice/udp/AllTests.java +++ b/java/test/src/main/java/test/Ice/udp/AllTests.java @@ -69,7 +69,7 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030"); + communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter"); PingReplyI replyI = new PingReplyI(); @@ -78,7 +78,7 @@ public class AllTests out.print("testing udp... "); out.flush(); - com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test -d:udp -p 12010"); + com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test -d:" + app.getTestEndpoint(0, "udp")); TestIntfPrx obj = TestIntfPrx.uncheckedCast(base); int nRetry = 5; diff --git a/java/test/src/main/java/test/Ice/udp/Client.java b/java/test/src/main/java/test/Ice/udp/Client.java index eb2e364b0eb..e6cfe1c6c3f 100644 --- a/java/test/src/main/java/test/Ice/udp/Client.java +++ b/java/test/src/main/java/test/Ice/udp/Client.java @@ -19,7 +19,7 @@ public class Client extends test.Util.Application AllTests.allTests(this); int num; - try + try { num = args.length == 1 ? Integer.parseInt(args[0]) : 1; } @@ -29,7 +29,7 @@ public class Client extends test.Util.Application } for(int i = 0; i < num; ++i) { - TestIntfPrx.uncheckedCast(communicator().stringToProxy("control:tcp -p " + (12010 + i))).shutdown(); + TestIntfPrx.uncheckedCast(communicator().stringToProxy("control:" + getTestEndpoint(i, "tcp"))).shutdown(); } return 0; } diff --git a/java/test/src/main/java/test/Ice/udp/Server.java b/java/test/src/main/java/test/Ice/udp/Server.java index e2d01cb84fd..1c9dba69857 100644 --- a/java/test/src/main/java/test/Ice/udp/Server.java +++ b/java/test/src/main/java/test/Ice/udp/Server.java @@ -16,22 +16,23 @@ public class Server extends test.Util.Application { com.zeroc.Ice.Properties properties = communicator().getProperties(); - int port = 12010; + int num = 0; try { - port += args.length == 1 ? Integer.parseInt(args[0]) : 0; + num = args.length == 1 ? Integer.parseInt(args[0]) : 0; } catch(NumberFormatException ex) { + assert(false); } - properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port); + properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num, "tcp")); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter"); adapter.add(new TestIntfI(), com.zeroc.Ice.Util.stringToIdentity("control")); adapter.activate(); - if(port == 12010) + if(num == 0) { - properties.setProperty("TestAdapter.Endpoints", "udp -p 12010"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(num, "udp")); com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter"); adapter2.add(new TestIntfI(), com.zeroc.Ice.Util.stringToIdentity("test")); adapter2.activate(); diff --git a/java/test/src/main/java/test/Ice/udp/run.py b/java/test/src/main/java/test/Ice/udp/run.py deleted file mode 100755 index 4b3a05010e2..00000000000 --- a/java/test/src/main/java/test/Ice/udp/run.py +++ /dev/null @@ -1,43 +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.addClasspath(os.path.join(os.getcwd(), "classes")) - -num = 5 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer("test.Ice.udp.Server", "%d" % i , adapter="McastTestAdapter")) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.udp.Client", "%d" % num, startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/java/test/src/main/java/test/IceBox/admin/AllTests.java b/java/test/src/main/java/test/IceBox/admin/AllTests.java index 5d018dee240..46e5f582ff9 100644 --- a/java/test/src/main/java/test/IceBox/admin/AllTests.java +++ b/java/test/src/main/java/test/IceBox/admin/AllTests.java @@ -21,8 +21,10 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator) + public static void allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator = app.communicator(); + String ref = "DemoIceBox/admin:default -p 9996 -t 10000"; com.zeroc.Ice.ObjectPrx admin = communicator.stringToProxy(ref); @@ -96,7 +98,7 @@ public class AllTests System.out.print("testing metrics admin facet... "); System.out.flush(); { - com.zeroc.IceMX.MetricsAdminPrx ma = + com.zeroc.IceMX.MetricsAdminPrx ma = com.zeroc.IceMX.MetricsAdminPrx.checkedCast(admin, "IceBox.Service.TestService.Metrics"); com.zeroc.Ice.PropertiesAdminPrx pa = @@ -114,7 +116,7 @@ public class AllTests r = ma.getMetricsViewNames(); test(r.returnValue.length == 3); - + // Make sure that the IceBox communicator metrics admin is a separate instance. test(com.zeroc.IceMX.MetricsAdminPrx.checkedCast(admin, "Metrics"). getMetricsViewNames().returnValue.length == 0); diff --git a/java/test/src/main/java/test/IceBox/admin/Client.java b/java/test/src/main/java/test/IceBox/admin/Client.java index a3bed564dce..4810cc8abf0 100644 --- a/java/test/src/main/java/test/IceBox/admin/Client.java +++ b/java/test/src/main/java/test/IceBox/admin/Client.java @@ -14,14 +14,13 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - AllTests.allTests(communicator); + AllTests.allTests(this); // // Shutdown the IceBox server. // com.zeroc.Ice.ProcessPrx.uncheckedCast( - communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); + communicator().stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); return 0; } diff --git a/java/test/src/main/java/test/IceBox/admin/run.py b/java/test/src/main/java/test/IceBox/admin/run.py deleted file mode 100755 index 6ebb72ea3f2..00000000000 --- a/java/test/src/main/java/test/IceBox/admin/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 - -icebox = TestUtil.getIceBox() -config = os.path.join(os.getcwd(), "config.icebox") - -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % config, server=icebox) - -sys.stdout.write("testing iceboxadmin... ") -sys.stdout.flush() - -admin = TestUtil.getIceBoxAdmin() -adminconfig = os.path.join(os.getcwd(), "config.admin") - -ib = TestUtil.startServer(icebox, args = '--Ice.Config=\"%s\"' % config) -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" stop TestService' % adminconfig) -iba.waitTestSuccess() -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" start TestService' % adminconfig) -iba.waitTestSuccess() -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" shutdown' % adminconfig) -iba.waitTestSuccess() -ib.waitTestSuccess() - -print("ok") diff --git a/java/test/src/main/java/test/IceBox/configuration/AllTests.java b/java/test/src/main/java/test/IceBox/configuration/AllTests.java index 7d59f13d022..7bf517cc084 100644 --- a/java/test/src/main/java/test/IceBox/configuration/AllTests.java +++ b/java/test/src/main/java/test/IceBox/configuration/AllTests.java @@ -23,12 +23,14 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static void allTests(test.Util.Application app) { - TestIntfPrx service1 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010")); - TestIntfPrx service2 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011")); - TestIntfPrx service3 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12012")); - TestIntfPrx service4 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12013")); + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); + TestIntfPrx service1 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(0))); + TestIntfPrx service2 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(1))); + TestIntfPrx service3 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(2))); + TestIntfPrx service4 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(3))); if(service1.getProperty("IceBox.InheritProperties").equals("")) { diff --git a/java/test/src/main/java/test/IceBox/configuration/Client.java b/java/test/src/main/java/test/IceBox/configuration/Client.java index 66fa9582cab..9e1ef8d89c4 100644 --- a/java/test/src/main/java/test/IceBox/configuration/Client.java +++ b/java/test/src/main/java/test/IceBox/configuration/Client.java @@ -14,14 +14,13 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); // // Shutdown the IceBox server. // com.zeroc.Ice.ProcessPrx.uncheckedCast( - communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); + communicator().stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); return 0; } diff --git a/java/test/src/main/java/test/IceBox/configuration/config.service1 b/java/test/src/main/java/test/IceBox/configuration/config.service1 index 6028e615ff5..3e38245a5d0 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service1 +++ b/java/test/src/main/java/test/IceBox/configuration/config.service1 @@ -1,4 +1,4 @@ -Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1 +Service1OA.Endpoints=default -p 12010 -h 127.0.0.1 #Ice.ProgramName Service=1 diff --git a/java/test/src/main/java/test/IceBox/configuration/config.service1-2 b/java/test/src/main/java/test/IceBox/configuration/config.service1-2 index c173914db2a..835acbadfc9 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service1-2 +++ b/java/test/src/main/java/test/IceBox/configuration/config.service1-2 @@ -1,4 +1,4 @@ -Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1 +Service1OA.Endpoints=default -p 12010 -h 127.0.0.1 #Ice.ProgramName Service1.Prop=1 diff --git a/java/test/src/main/java/test/IceBox/configuration/config.service2 b/java/test/src/main/java/test/IceBox/configuration/config.service2 index 78e08aadba6..95d33831a14 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service2 +++ b/java/test/src/main/java/test/IceBox/configuration/config.service2 @@ -1,4 +1,4 @@ -Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1 +Service2OA.Endpoints=default -p 12011 -h 127.0.0.1 Ice.ProgramName=Test Service=2 diff --git a/java/test/src/main/java/test/IceBox/configuration/config.service2-2 b/java/test/src/main/java/test/IceBox/configuration/config.service2-2 index 36c8d0812cb..6ed8dc9df49 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service2-2 +++ b/java/test/src/main/java/test/IceBox/configuration/config.service2-2 @@ -1,4 +1,4 @@ -Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1 +Service2OA.Endpoints=default -p 12011 -h 127.0.0.1 #Ice.ProgramName Service2.Prop=1 diff --git a/java/test/src/main/java/test/IceBox/configuration/config.service3 b/java/test/src/main/java/test/IceBox/configuration/config.service3 index c93ed144701..6cba4b351b0 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service3 +++ b/java/test/src/main/java/test/IceBox/configuration/config.service3 @@ -1,4 +1,4 @@ -Service3OA.Endpoints=tcp -p 12012 -h 127.0.0.1 +Service3OA.Endpoints=default -p 12012 -h 127.0.0.1 #Ice.ProgramName Service=3 diff --git a/java/test/src/main/java/test/IceBox/configuration/config.service4 b/java/test/src/main/java/test/IceBox/configuration/config.service4 index 182fb3a7289..a70120dd192 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service4 +++ b/java/test/src/main/java/test/IceBox/configuration/config.service4 @@ -1,4 +1,4 @@ -Service4OA.Endpoints=tcp -p 12013 -h 127.0.0.1 +Service4OA.Endpoints=default -p 12013 -h 127.0.0.1 #Ice.ProgramName Service=4 diff --git a/java/test/src/main/java/test/IceBox/configuration/run.py b/java/test/src/main/java/test/IceBox/configuration/run.py deleted file mode 100755 index 077936ccbe5..00000000000 --- a/java/test/src/main/java/test/IceBox/configuration/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 - -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"), - server=TestUtil.getIceBox()) -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox2"), - server=TestUtil.getIceBox()) diff --git a/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java b/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java index 5a653060fb3..d54959fab3b 100644 --- a/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java +++ b/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java @@ -27,8 +27,10 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator, int num) + public static void allTests(test.Util.Application app, int num) { + com.zeroc.Ice.Communicator communicator = app.communicator(); + List<ControllerPrx> proxies = new ArrayList<>(); List<ControllerPrx> indirectProxies = new ArrayList<>(); for(int i = 0; i < num; ++i) @@ -90,7 +92,7 @@ public class AllTests } } System.out.println("ok"); - + System.out.print("testing object adapter migration..."); System.out.flush(); { diff --git a/java/test/src/main/java/test/IceDiscovery/simple/Client.java b/java/test/src/main/java/test/IceDiscovery/simple/Client.java index de48e574ab2..7e823ec6b60 100644 --- a/java/test/src/main/java/test/IceDiscovery/simple/Client.java +++ b/java/test/src/main/java/test/IceDiscovery/simple/Client.java @@ -15,7 +15,7 @@ public class Client extends test.Util.Application public int run(String[] args) { int num; - try + try { num = args.length == 1 ? Integer.parseInt(args[0]) : 0; } @@ -23,7 +23,7 @@ public class Client extends test.Util.Application { num = 0; } - AllTests.allTests(communicator(), num); + AllTests.allTests(this, num); return 0; } diff --git a/java/test/src/main/java/test/IceDiscovery/simple/Server.java b/java/test/src/main/java/test/IceDiscovery/simple/Server.java index 21f5a2da128..4982bab8048 100644 --- a/java/test/src/main/java/test/IceDiscovery/simple/Server.java +++ b/java/test/src/main/java/test/IceDiscovery/simple/Server.java @@ -23,9 +23,10 @@ public class Server extends test.Util.Application } catch(NumberFormatException ex) { + assert(false); } - properties.setProperty("ControlAdapter.Endpoints", "default -p " + (12010 + num)); + properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num)); properties.setProperty("ControlAdapter.AdapterId", "control" + num); properties.setProperty("ControlAdapter.ThreadPool.Size", "1"); diff --git a/java/test/src/main/java/test/IceDiscovery/simple/run.py b/java/test/src/main/java/test/IceDiscovery/simple/run.py deleted file mode 100755 index d9b4f000e9d..00000000000 --- a/java/test/src/main/java/test/IceDiscovery/simple/run.py +++ /dev/null @@ -1,52 +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 - -server = "test.IceDiscovery.simple.Server" -client = "test.IceDiscovery.simple.Client" - -num = 3 - -args = " --Ice.Plugin.IceDiscovery=IceDiscovery:com.zeroc.IceDiscovery.PluginFactory" -args += " --IceDiscovery.Timeout=50" -args += " --IceDiscovery.RetryCount=5" -if not TestUtil.ipv6: - args += " --IceDiscovery.Interface=127.0.0.1" -elif TestUtil.isDarwin(): - args += " --IceDiscovery.Interface=\"::1\"" - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, "%d %s" % (i, args), count = 4)) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, "%d %s" % (num, args), startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/java/test/src/main/java/test/IceGrid/simple/AllTests.java b/java/test/src/main/java/test/IceGrid/simple/AllTests.java index c4897098935..19c549e487f 100644 --- a/java/test/src/main/java/test/IceGrid/simple/AllTests.java +++ b/java/test/src/main/java/test/IceGrid/simple/AllTests.java @@ -67,7 +67,7 @@ public class AllTests com.zeroc.IceGrid.RegistryPrx registry = com.zeroc.IceGrid.RegistryPrx.checkedCast( communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry")); test(registry != null); - + try { com.zeroc.IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar"); @@ -86,16 +86,17 @@ public class AllTests com.zeroc.Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); initData.properties.setProperty("Ice.Default.Locator", ""); - initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", + initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:com.zeroc.IceLocatorDiscovery.PluginFactory"); - if(System.getProperty("os.name").contains("OS X") && + if(System.getProperty("os.name").contains("OS X") && initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0) { initData.properties.setProperty("IceLocatorDiscovery.Interface", "::1"); } + initData.properties.setProperty("IceLocatorDiscovery.Port", Integer.toString(app.getTestPort(99))); initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter"); initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default"); - + com.zeroc.Ice.Communicator comm = com.zeroc.Ice.Util.initialize(initData); test(comm.getDefaultLocator() != null); comm.stringToProxy("test @ TestAdapter").ice_ping(); @@ -113,7 +114,7 @@ public class AllTests // // Now, ensure that the IceGrid discovery locator correctly // handles failure to find a locator. - // + // initData.properties.setProperty("IceLocatorDiscovery.InstanceName", "unknown"); initData.properties.setProperty("IceLocatorDiscovery.RetryCount", "1"); initData.properties.setProperty("IceLocatorDiscovery.Timeout", "100"); diff --git a/java/test/src/main/java/test/IceGrid/simple/simple_server.xml b/java/test/src/main/java/test/IceGrid/simple/application.xml index 9ebc5d95a72..9ebc5d95a72 100644 --- a/java/test/src/main/java/test/IceGrid/simple/simple_server.xml +++ b/java/test/src/main/java/test/IceGrid/simple/application.xml diff --git a/java/test/src/main/java/test/IceGrid/simple/run.py b/java/test/src/main/java/test/IceGrid/simple/run.py deleted file mode 100755 index 7f13799be1e..00000000000 --- a/java/test/src/main/java/test/IceGrid/simple/run.py +++ /dev/null @@ -1,35 +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 - -# -# 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") diff --git a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java index e8f09e2d47a..9a86e3db4ac 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java +++ b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java @@ -118,10 +118,12 @@ public class AllTests return d; } - public static ServerFactoryPrx allTests(test.Util.Application app, String testDir, PrintWriter out) + public static ServerFactoryPrx allTests(test.Util.Application app, String testDir) { com.zeroc.Ice.Communicator communicator = app.communicator(); - final String factoryRef = "factory:tcp -p 12010"; + PrintWriter out = app.getWriter(); + + final String factoryRef = "factory:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx b = communicator.stringToProxy(factoryRef); test(b != null); ServerFactoryPrx factory = ServerFactoryPrx.checkedCast(b); diff --git a/java/test/src/main/java/test/IceSSL/configuration/Client.java b/java/test/src/main/java/test/IceSSL/configuration/Client.java index 52a8c20befb..e03a7f14926 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/Client.java +++ b/java/test/src/main/java/test/IceSSL/configuration/Client.java @@ -24,10 +24,8 @@ public class Client extends test.Util.Application out.println("Usage: client testdir"); return 1; } - - ServerFactoryPrx factory = AllTests.allTests(this, args[0], out); + ServerFactoryPrx factory = AllTests.allTests(this, args[0]); factory.shutdown(); - return 0; } diff --git a/java/test/src/main/java/test/IceSSL/configuration/Server.java b/java/test/src/main/java/test/IceSSL/configuration/Server.java index 86d5ae85f3a..0cae0b6af36 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/Server.java +++ b/java/test/src/main/java/test/IceSSL/configuration/Server.java @@ -15,7 +15,7 @@ public class Server extends test.Util.Application public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("factory"); adapter.add(new ServerFactoryI(), id); diff --git a/java/test/src/main/java/test/IceSSL/configuration/run.py b/java/test/src/main/java/test/IceSSL/configuration/run.py deleted file mode 100755 index 2d87a19bc40..00000000000 --- a/java/test/src/main/java/test/IceSSL/configuration/run.py +++ /dev/null @@ -1,26 +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 - -testdir = '"%s"' % os.getcwd() - -TestUtil.clientServerTest(additionalClientOptions=testdir) diff --git a/java/test/src/main/java/test/IceUtil/inputUtil/run.py b/java/test/src/main/java/test/IceUtil/inputUtil/run.py deleted file mode 100755 index 7f349d5cef0..00000000000 --- a/java/test/src/main/java/test/IceUtil/inputUtil/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.IceUtil.inputUtil.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Slice/generation/run.py b/java/test/src/main/java/test/Slice/generation/run.py deleted file mode 100755 index fa69cc0ddb6..00000000000 --- a/java/test/src/main/java/test/Slice/generation/run.py +++ /dev/null @@ -1,56 +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, re - -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 os.getcwd()!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -sys.stdout.write("testing list-generated... ") -sys.stdout.flush() - -slice2java = TestUtil.getSliceTranslator("java") -if not os.path.exists("classes"): - os.mkdir("classes") - -command = '"' + slice2java + '" --list-generated --output-dir classes File1.ice File2.ice' -if TestUtil.debug: - sys.stdout.write("(%s) " % command) -p = TestUtil.runCommand(command) -lines1 = p.stdout.readlines() -lines2 = open(os.path.join(os.getcwd(), "list-generated.out"), "r").readlines() -if len(lines1) != len(lines2): - print("failed!") - sys.exit(1) - -i = 0 -while i < len(lines1): - if sys.version_info[0] == 2: - line1 = lines1[i].strip() - line2 = lines2[i].strip() - else: - line1 = lines1[i].decode("utf-8").strip() - line2 = lines2[i].strip() - if line1 != line2: - print("failed!") - sys.exit(1) - i = i + 1 -else: - print("ok") - -sys.exit(0) diff --git a/java/test/src/main/java/test/Slice/generation/test.py b/java/test/src/main/java/test/Slice/generation/test.py new file mode 100644 index 00000000000..311626dea72 --- /dev/null +++ b/java/test/src/main/java/test/Slice/generation/test.py @@ -0,0 +1,31 @@ +class SliceGenerationTestCase(ClientTestCase): + + def runClientSide(self, current): + current.write("testing list-generated... ") + + slice2java = SliceTranslator("slice2java") + self.mkdirs("classes") + + slice2java.run(current, + args=["--list-generated", "--output-dir", "classes", "File1.ice", "File2.ice"]) + + lines1 = slice2java.getOutput().strip().split("\n") + lines2 = open(os.path.join(self.getPath(), "list-generated.out"), "r").readlines() + if len(lines1) != len(lines2): + raise RuntimeError("failed!") + + i = 0 + while i < len(lines1): + if sys.version_info[0] == 2: + line1 = lines1[i].strip() + line2 = lines2[i].strip() + else: + line1 = lines1[i].decode("utf-8").strip() + line2 = lines2[i].strip() + if line1 != line2: + raise RuntimeError("failed!") + i = i + 1 + else: + current.writeln("ok") + +TestSuite(__name__, [ SliceGenerationTestCase() ]) diff --git a/java/test/src/main/java/test/Slice/keyword/Client.java b/java/test/src/main/java/test/Slice/keyword/Client.java index 938c4602398..8a48667cb83 100644 --- a/java/test/src/main/java/test/Slice/keyword/Client.java +++ b/java/test/src/main/java/test/Slice/keyword/Client.java @@ -32,7 +32,7 @@ public class Client public catchI() { } - + @Override public java.util.concurrent.CompletionStage<Integer> checkedCastAsync(int _clone, com.zeroc.Ice.Current current) { @@ -178,7 +178,7 @@ public class Client initData.properties.setProperty("Ice.Package._abstract", "test.Slice.keyword"); initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", "default"); // // We must set MessageSizeMax to an explicit values, diff --git a/java/test/src/main/java/test/Slice/keyword/run.py b/java/test/src/main/java/test/Slice/keyword/run.py deleted file mode 100755 index 851ddcd2d36..00000000000 --- a/java/test/src/main/java/test/Slice/keyword/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.keyword.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Slice/macros/run.py b/java/test/src/main/java/test/Slice/macros/run.py deleted file mode 100755 index a8b0dad4496..00000000000 --- a/java/test/src/main/java/test/Slice/macros/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.macros.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Slice/structure/run.py b/java/test/src/main/java/test/Slice/structure/run.py deleted file mode 100755 index ecb3cf4e54e..00000000000 --- a/java/test/src/main/java/test/Slice/structure/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.structure.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java/test/src/main/java/test/Util/Application.java b/java/test/src/main/java/test/Util/Application.java index 3ccff95fb55..d9e7a56b31b 100644 --- a/java/test/src/main/java/test/Util/Application.java +++ b/java/test/src/main/java/test/Util/Application.java @@ -205,7 +205,7 @@ public abstract class Application r.initData = createInitializationData(); com.zeroc.Ice.Util.CreatePropertiesResult cpr = com.zeroc.Ice.Util.createProperties(args); r.initData.properties = cpr.properties; - r.args = cpr.args; + r.args = r.initData.properties.parseCommandLineOptions("Test", cpr.args); return r; } @@ -282,6 +282,62 @@ public abstract class Application return _classLoader; } + public String getTestEndpoint(int num) + { + return getTestEndpoint(num, ""); + } + + public String getTestEndpoint(com.zeroc.Ice.Properties properties, int num) + { + return getTestEndpoint(properties, num, ""); + } + + public String getTestEndpoint(int num, String prot) + { + return getTestEndpoint(_communicator.getProperties(), num, prot); + } + + static public String getTestEndpoint(com.zeroc.Ice.Properties properties, int num, String prot) + { + String protocol = prot; + if(protocol.isEmpty()) + { + protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "default"); + } + int basePort = properties.getPropertyAsIntWithDefault("Test.BasePort", 12010); + return protocol + " -p " + Integer.toString(basePort + num); + } + + public String getTestHost() + { + return getTestHost(_communicator.getProperties()); + } + + static public String getTestHost(com.zeroc.Ice.Properties properties) + { + return properties.getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); + } + + public String getTestProtocol() + { + return getTestProtocol(_communicator.getProperties()); + } + + static public String getTestProtocol(com.zeroc.Ice.Properties properties) + { + return properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + } + + public int getTestPort(int num) + { + return getTestPort(_communicator.getProperties(), num); + } + + static public int getTestPort(com.zeroc.Ice.Properties properties, int num) + { + return properties.getPropertyAsIntWithDefault("Test.BasePort", 12010) + num; + } + private ClassLoader _classLoader; private String _testName; private Communicator _communicator; diff --git a/js/.gitignore b/js/.gitignore index 8c6f8c5ae71..e5f51e30ba6 100644 --- a/js/.gitignore +++ b/js/.gitignore @@ -16,6 +16,4 @@ src/es5/IceGrid src/es5/IceMX src/es5/IceSSL src/es5/IceStorm -test/Glacier2/es5/ -test/Ice/es5/ -test/Common/es5 +test/es5 diff --git a/js/allTests.py b/js/allTests.py index 1af86e8a833..e4360c465d3 100755 --- a/js/allTests.py +++ b/js/allTests.py @@ -8,53 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("Ice/acm", ["core"]), - ("Ice/ami", ["core"]), - ("Ice/binding", ["core"]), - ("Ice/defaultValue", ["once"]), - ("Ice/enums", ["once"]), - ("Ice/exceptions", ["core"]), - ("Ice/exceptionsBidir", ["once"]), - ("Ice/facets", ["core"]), - ("Ice/facetsBidir", ["core"]), - ("Ice/hashmap", ["once"]), - ("Ice/hold", ["core"]), - ("Ice/info", ["core"]), - ("Ice/inheritance", ["once"]), - ("Ice/inheritanceBidir", ["once"]), - ("Ice/location", ["once"]), - ("Ice/objects", ["core"]), - ("Ice/operations", ["core"]), - ("Ice/operationsBidir", ["once"]), - ("Ice/optional", ["core"]), - ("Ice/optionalBidir", ["once"]), - ("Ice/properties", ["once"]), - ("Ice/proxy", ["core"]), - ("Ice/retry", ["core"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/timeout", ["core"]), - ("Ice/number", ["once"]), - ("Ice/import", ["once", "noes5"]), - ("Glacier2/router", ["service"]), - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/js/bin/HttpServer.js b/js/bin/HttpServer.js index 12845731add..0f1cfef2ab5 100644 --- a/js/bin/HttpServer.js +++ b/js/bin/HttpServer.js @@ -27,9 +27,9 @@ function Init() }; var TestData = - { - languages: [{value: "cpp", name: "C++"}, {value: "java", name: "Java"}] - }; + { + languages: [{value: "cpp", name: "C++"}, {value: "java", name: "Java"}] + }; if(process.platform == "win32") { TestData.languages.push({value: "csharp", name: "C#"}); @@ -40,9 +40,9 @@ function Init() "/lib/IceStorm.js", "/lib/IceStorm.min.js", "/lib/IceGrid.js", "/lib/IceGrid.min.js",]; - TestData.TestCases = fs.readFileSync(path.join(__dirname, "..", "test", "Common", "TestCases.json"), "utf8"); - var TestCases = JSON.parse(TestData.TestCases); - TestData.tests = Object.keys(TestCases); + TestData.TestSuites = fs.readFileSync(path.join(__dirname, "..", "test", "Common", "TestSuites.json"), "utf8"); + var TestSuites = JSON.parse(TestData.TestSuites); + TestData.tests = Object.keys(TestSuites); var template = hogan.compile(fs.readFileSync(path.join(__dirname, "..", "test", "Common", "index.html"), "utf8")); var libraryMaps = libraries.map( function(f) @@ -60,12 +60,12 @@ function Init() var match = req.url.pathname.match("^\/test/(.*)/index\.html"); if(match) { - var es5 = match[1].indexOf("/es5/") !== -1; - var m = es5 ? match[1].replace("/es5/", "/") : match[1]; + var es5 = match[1].indexOf("es5/") !== -1; + var m = es5 ? match[1].replace("es5/", "") : match[1]; // That is a test case - var testCase = TestCases[m]; - if(testCase === undefined) + var testSuite = TestSuites[m]; + if(testSuite === undefined) { res.writeHead(404); res.end("404 Page Not Found"); @@ -76,7 +76,7 @@ function Init() TestData.current = m; if(req.url.query.next == "true") { - var testCase = TestData.tests[0]; + var testSuite = TestData.tests[0]; var language = req.url.query.language !== undefined ? req.url.query.language : "cpp"; var protocol = req.url.protocol; var i = TestData.tests.indexOf(TestData.current); @@ -84,7 +84,7 @@ function Init() if(i < TestData.tests.length - 1) { - testCase = TestData.tests[i + 1]; + testSuite = TestData.tests[i + 1]; } else if(!worker) { @@ -105,7 +105,7 @@ function Init() if(es5) { - testCase = testCase.replace("Ice/", "Ice/es5/"); + testSuite = "es5/" + testSuite; } var location = url.format( @@ -113,7 +113,7 @@ function Init() protocol: protocol, hostname: req.headers.host.split(":")[0], port: (protocol == "http" ? 8080 : 9090), - pathname: ("/test/" + testCase + "/index.html"), + pathname: ("/test/" + testSuite + "/index.html"), query:{loop: "true", language: language, worker: worker} }); @@ -126,7 +126,7 @@ function Init() if(req.url.query.worker != "true") { TestData.scripts = []; - + if(es5) { TestData.scripts = @@ -136,8 +136,8 @@ function Init() "/lib/es5/Ice.js", "/test/Common/TestRunner.js", "/test/Common/TestSuite.js", - "/test/Common/es5/Controller.js" - ].concat(testCase.files); + "/test/es5/Common/Controller.js" + ].concat(testSuite.files); } else { @@ -147,7 +147,7 @@ function Init() "/test/Common/TestRunner.js", "/test/Common/TestSuite.js", "/test/Common/Controller.js" - ].concat(testCase.files); + ].concat(testSuite.files); } } else @@ -172,6 +172,10 @@ function Init() path.resolve(path.join(require.resolve("ice"), "..", "..")) : this._basePath; var filePath = path.resolve(path.join(basePath, req.url.pathname)); + if(filePath.indexOf("es5/") !== -1 && path.extname(filePath) != "js") + { + filePath = filePath.replace("es5/", "") + } // // If OPTIMIZE is set resolve Ice libraries to the corresponding minified diff --git a/js/gulpfile.js b/js/gulpfile.js index e4e7fb82560..2beec425e0a 100644 --- a/js/gulpfile.js +++ b/js/gulpfile.js @@ -134,7 +134,7 @@ var common = { gulp.task("common:slice", [], function(){ - return gulp.src(["test/Common/Controller.ice"]) + return gulp.src(["../scripts/Controller.ice"]) .pipe(slice2js({dest: "test/Common"})) .pipe(gulp.dest("test/Common")); }); @@ -143,12 +143,12 @@ gulp.task("common:slice-babel", ["common:slice"], function(){ return gulp.src(["test/Common/Controller.js"]) .pipe(babel({compact: false})) - .pipe(gulp.dest("test/Common/es5")); + .pipe(gulp.dest("test/es5/Common")); }); gulp.task("common:slice:clean", [], function(){ - del(["test/Common/Controller.js", "test/Common/.depend", "test/Common/es5/Controller.js"]); + del(["test/Common/Controller.js", "test/Common/.depend", "test/es5/Common/Controller.js"]); }); gulp.task("common:js", ["bower"], @@ -177,7 +177,7 @@ gulp.task("common:js-babel", [], function(){ return gulp.src("test/Common/Common.js") .pipe(babel({compact: false})) - .pipe(gulp.dest("test/Common/es5/")); + .pipe(gulp.dest("test/es5/Common/")); }); gulp.task("common:clean", [], @@ -242,10 +242,9 @@ tests.forEach( gulp.task(testBabelTask(name), [testTask(name)], function(){ - return gulp.src([path.join(name, "*.js"), "!" + path.join(name, "run.js")]) + return gulp.src([path.join(name, "*.js")]) .pipe(babel({compact: false})) - .pipe(gulp.dest(name.replace("test/Ice/", "test/Ice/es5/") - .replace("test/Glacier2/", "test/Glacier2/es5/"))); + .pipe(gulp.dest(name.replace("test/", "test/es5/"))); }); gulp.task(testCleanDependTask(name), [], @@ -263,11 +262,8 @@ tests.forEach( gulp.task(testBabelCleanTask(name), [testCleanTask(name)], function(){ - var s = name.replace("test/Ice/", "test/Ice/es5/") - .replace("test/Glacier2/", "test/Glacier2/es5/"); - - return gulp.src([path.join(s, "*.js"), "!" + path.join(s, "run.js")]) - .pipe(paths(del)); + var s = name.replace("test/", "test/es5/"); + return gulp.src([path.join(s, "*.js")]).pipe(paths(del)); }); }); @@ -448,7 +444,7 @@ gulp.task("dist:clean", libs.map(libCleanTask)); function runTestsWithBrowser(url) { require("./bin/HttpServer")(); - var cmd = ["../scripts/TestController.py"]; + var cmd = ["../scripts/Controller.py", "--endpoints", "ws -p 15002:wss -p 15003", "-d"]; cmd = cmd.concat(process.argv.slice(3)); var p = require("child_process").spawn("python", cmd, {stdio: "inherit"}); p.on("error", function(err) @@ -482,7 +478,7 @@ gulp.task("test:run-with-browser", useBinDist ? ["test"] : ["build"], gulp.task("test:run-with-browser-es5", useBinDist ? ["test"] : ["build"], function(url){ - return runTestsWithBrowser("http://127.0.0.1:8080/test/Ice/es5/acm/index.html"); + return runTestsWithBrowser("http://127.0.0.1:8080/test/es5/Ice/acm/index.html"); }); gulp.task("test:run-with-node", (useBinDist ? ["test"] : ["build"]), @@ -530,7 +526,7 @@ gulp.task("lint:js", ["build"], "src/**/browser/*.js", "test/**/*.js", "!src/es5/**/*.js", - "!test/**/es5/**/*.js", + "!test/es5/**/**/*.js", "!**/Client.min.js"]) .pipe(jshint()) .pipe(jshint.reporter("default")); @@ -546,7 +542,7 @@ gulp.task("ice-module:package", ["dist"], function() { return gulp.src(['package.json']).pipe( - gulp.dest(path.join("node_modules", "ice"))); + gulp.dest(path.join("node_modules", "ice"))); }); gulp.task("ice-module", ["ice-module:package"], function() diff --git a/js/src/Ice/Ice.js b/js/src/Ice/Ice.js index 05b9e8d3aa5..27499437162 100644 --- a/js/src/Ice/Ice.js +++ b/js/src/Ice/Ice.js @@ -39,7 +39,8 @@ module.exports.Ice = __M.require(module, "../Ice/ArrayUtil", "../Ice/UnknownSlicedValue", "../Ice/Process", - "../Ice/MapUtil" + "../Ice/MapUtil", + "../Ice/ToStringMode" ]).Ice; module.exports.IceMX = require("../Ice/Metrics").IceMX; diff --git a/js/src/Ice/sources.json b/js/src/Ice/sources.json index 9a6c54ec217..4c095701515 100644 --- a/js/src/Ice/sources.json +++ b/js/src/Ice/sources.json @@ -94,6 +94,7 @@ "TcpEndpointFactory.js", "TcpEndpointI.js", "Timer.js", + "ToStringMode.js", "TraceLevels.js", "TraceUtil.js", "UnknownSlicedValue.js", diff --git a/js/test/Common/Common.js b/js/test/Common/Common.js deleted file mode 100644 index 3fb5b860cd8..00000000000 --- a/js/test/Common/Common.js +++ /dev/null @@ -1,41 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -/* globals -Ice*/ -var Ice = require("ice").Ice; - -var write = function(msg) -{ - process.stdout.write(msg); -}; - -var writeLine = function(msg) -{ - this.write(msg + "\n"); -}; - -var run = function(m) -{ - var id = new Ice.InitializationData(); - id.properties = Ice.createProperties(process.argv); - var test = m.require("./Client").__test__; - - test({write: write, writeLine: writeLine}, id).catch( - ex => - { - console.log(ex.toString()); - if(ex.stack) - { - console.log(ex.stack); - } - process.exit(1); - }); -}; - -exports.run = run; diff --git a/js/test/Common/Controller.ice b/js/test/Common/Controller.ice deleted file mode 100644 index edc11307013..00000000000 --- a/js/test/Common/Controller.ice +++ /dev/null @@ -1,38 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -module Test -{ - -module Common -{ - -exception ServerFailedException -{ - string reason; -}; - -interface Server -{ - void waitTestSuccess(); - void waitForServer() throws ServerFailedException; - void terminate(); -}; - -sequence<string> StringSeq; - -interface Controller -{ - Server* runServer(string lang, string name, string protocol, string host, bool winrt, string configName, - StringSeq options); -}; - -}; - -}; diff --git a/js/test/Common/TestRunner.js b/js/test/Common/TestRunner.js index 97732ce62d6..244d97ca6c4 100644 --- a/js/test/Common/TestRunner.js +++ b/js/test/Common/TestRunner.js @@ -9,8 +9,8 @@ /* global - __runEchoServerOptions__ : false, __test__ : false, + __testBidir__ : false, Test : false, */ @@ -38,7 +38,7 @@ function isWindows() return navigator.userAgent.indexOf("Windows") != -1; } -function runTest(name, language, defaultHost, protocol, configurations, out) +function runTest(testsuite, language, host, protocol, testcases, out) { // // This logger is setup to work with Web Workers and normal scripts using @@ -102,12 +102,14 @@ function runTest(name, language, defaultHost, protocol, configurations, out) return d.toLocaleString("en-US", this._dateformat) + "." + d.getMilliseconds(); } }; - - var server, communicator; + + var communicator; var id = new Ice.InitializationData(); + var port = protocol == "ws" ? 15002 : 15003; + var serverTestCase; id.logger = Logger; id.properties = Ice.createProperties(); - id.properties.setProperty("Ice.Default.Host", defaultHost); + id.properties.setProperty("Ice.Default.Host", host); id.properties.setProperty("Ice.Default.Protocol", protocol); //id.properties.setProperty("Ice.Trace.Protocol", "1"); //id.properties.setProperty("Ice.Trace.Network", "3"); @@ -115,100 +117,92 @@ function runTest(name, language, defaultHost, protocol, configurations, out) return Ice.Promise.try( function() { - if(typeof(__runServer__) !== "undefined" || typeof(__runEchoServer__) !== "undefined") + if(typeof(__runServer__) === "undefined" && typeof(__testBidir__) === "undefined") { - communicator = Ice.initialize(); - var str = protocol == "ws" ? "controller:ws -h " + defaultHost + " -p 15002" : - "controller:wss -h " + defaultHost + " -p 15003"; + return __test__(out, id); + } - var controller = Test.Common.ControllerPrx.uncheckedCast(communicator.stringToProxy(str)); + communicator = Ice.initialize(); + var str = "controller:" + protocol + " -h " + host + " -p " + port; + var controller = Test.Common.ControllerPrx.uncheckedCast(communicator.stringToProxy(str)); + if(testcases === undefined) + { + testcases = [ { name: "client/server" } ]; + } - var options = []; - var srv = typeof(__runEchoServer__) !== "undefined" ? "Ice/echo" : name; - if(typeof(__runEchoServerOptions__) !== "undefined") + run = function(testsuite, testcase, client) + { + if(testcase.langs && testcase.langs.indexOf(language) == -1) { - options = options.concat(__runEchoServerOptions__); + return; } - if(configurations === undefined) + if(typeof(__testBidir__) !== "undefined" && client == __testBidir__) { - configurations = [ { configName: "", desc: "default configuration" } ]; + out.writeLine("[ running bidir " + testcase.name + " test]"); } - - var prev = Ice.Promise.resolve(); - configurations.forEach( - function(config) + else + { + out.writeLine("[ running " + testcase.name + " test]"); + } + out.write("starting server side... "); + return controller.runTestCase(language, testsuite, testcase.name).then( + function(proxy) + { + proxy = controller.ice_getCachedConnection().createProxy(proxy.ice_getIdentity()) + serverTestCase = Test.Common.TestCasePrx.uncheckedCast(proxy); + var config = new Test.Common.Config(); + config.protocol = protocol; + return serverTestCase.startServerSide(config); + } + ).then( + function() { - if(config.langs && config.langs.indexOf(language) == -1) + out.writeLine("ok") + var initData = id.clone(); + if(testcase.args !== undefined) { - return prev; + initData.properties = Ice.createProperties(testcase.args, id.properties); } - prev = prev.then( - function() - { - out.write("starting " + srv + " server... "); - return controller.runServer(language, srv, protocol, defaultHost, false, - config.configName, options).then( - function(proxy) - { - var ref = proxy.ice_getIdentity().name + ":" + protocol + " -h " + - defaultHost + " -p " + (protocol == "ws" ? "15002" : "15003"); - out.writeLine("ok"); - server = Test.Common.ServerPrx.uncheckedCast(communicator.stringToProxy(ref)); - out.writeLine("Running test with " + config.desc + "."); - return server.waitForServer().then( - function() - { - var initData = id.clone(); - if(config.args !== undefined) - { - initData.properties = - Ice.createProperties(config.args, id.properties); - } - return __test__(out, initData); - }); - }, - function(ex) - { - out.writeLine("failed! (" + ex + ")"); - throw ex; - } - ).then( - function() - { - if(server) - { - return server.waitTestSuccess(); - } - } - ).catch( - function(ex) - { - if(server) - { - return server.terminate().then( - function() - { - throw ex; - }, - function() - { - throw ex; - }); - } - else - { - throw ex; - } - }); - }); - }); - return prev; + return client(out, initData); + } + ).then( + function() + { + return serverTestCase.stopServerSide(true); + } + ).catch( + function(ex) + { + out.writeLine("failed! (" + ex + ")"); + throw ex + } + ).finally( + function() + { + if(serverTestCase) + { + return serverTestCase.destroy(); + } + } + ); } - else + + var p = Ice.Promise.resolve(); + if(typeof(__runServer__) !== "undefined") { - return __test__(out, id); + testcases.forEach(function(testcase) { + p = p.then(function() { return run(testsuite, testcase, __test__); }) + }); + } + if(typeof(__testBidir__) !== "undefined" && language === "cpp") + { + testcases.forEach(function(testcase) { + options = typeof(__runEchoServerOptions__) !== "undefined" ? __runEchoServerOptions__ : [] + p = p.then(function() { return run("Ice/echo", testcase, __testBidir__); }) + }); } + return p; } ).finally( function() @@ -226,10 +220,10 @@ function runTest(name, language, defaultHost, protocol, configurations, out) function(ex) { out.writeLine(""); - if(ex instanceof Test.Common.ServerFailedException) + if(ex instanceof Test.Common.TestCaseFailedException) { - out.writeLine("Server failed to start:\n"); - out.writeLine(ex.reason); + out.writeLine("Server test case failed to start:\n"); + out.writeLine(ex.output); } else { diff --git a/js/test/Common/TestSuite.js b/js/test/Common/TestSuite.js index d0969154917..ce2a9c18742 100644 --- a/js/test/Common/TestSuite.js +++ b/js/test/Common/TestSuite.js @@ -13,13 +13,13 @@ Test : false, URI : false, current : false, - TestCases : false, + TestSuites : false, runTest: false */ $(document).foundation(); $(document).ready( - function(){ + function() { $("#console").height(120); var out = @@ -58,10 +58,9 @@ $(document).ready( function nextTest() { var path = $("#test").val(); - if(document.location.pathname.indexOf("/es5/") !== -1 && - path.indexOf("/es5/") === -1) + if(document.location.pathname.indexOf("/es5/") !== -1 && path.indexOf("/es5/") === -1) { - path = path.replace("/test/Ice/", "/test/Ice/es5/"); + path = path.replace("/test/", "/test/es5/"); } document.location.assign(new URI() @@ -115,10 +114,9 @@ $(document).ready( function updateLocation() { var path = $("#test").val(); - if(document.location.pathname.indexOf("/es5/") !== -1 && - path.indexOf("/es5/") === -1) + if(document.location.pathname.indexOf("/es5/") !== -1 && path.indexOf("/es5/") === -1) { - path = path.replace("/test/Ice/", "/test/Ice/es5/"); + path = path.replace("/test/", "/test/es5/"); } document.location.assign(new URI() @@ -166,8 +164,8 @@ $(document).ready( language: $("#language").val(), defaultHost: document.location.hostname || "127.0.0.1", protocol: $("#protocol").val(), - configurations: TestCases[current].configurations, - files: TestCases[current].files, + testcases: TestSuites[current].testcases, + files: TestSuites[current].files, es5: document.location.pathname.indexOf("/es5/") !== -1 } }); @@ -179,8 +177,12 @@ $(document).ready( } else { - runTest(current, $("#language").val(), document.location.hostname || "127.0.0.1", - $("#protocol").val(), TestCases[current].configurations, out + runTest(current, + $("#language").val(), + document.location.hostname || "127.0.0.1", + $("#protocol").val(), + TestSuites[current].testcases, + out ).finally( function() { diff --git a/js/test/Common/TestCases.json b/js/test/Common/TestSuites.json index ca8ecd1dfa1..74ccdc399a1 100644 --- a/js/test/Common/TestCases.json +++ b/js/test/Common/TestSuites.json @@ -18,51 +18,38 @@ "Ice/enums": { "files": ["Test.js", "Client.js"], - "configurations": + "testcases": [ { - "configName": "1.0", - "desc": "1.0 encoding", + "name": "client/server with 1.0 encoding", "args": ["--Ice.Default.EncodingVersion=1.0"] }, { - "configName": "1.1", - "desc": "1.1 encoding" + "name": "client/server with default encoding" } ] }, "Ice/exceptions": { - "files": ["Test.js", "Client.js"], - "configurations": + "files": ["Test.js", "Client.js", "ThrowerI.js", "AMDThrowerI.js", "ClientBidir.js"], + "testcases": [ { - "configName": "compact", - "desc": "compact (default) format" + "name": "client/server with compact format" }, { - "configName": "sliced", - "desc": "sliced format", + "name": "client/server with sliced format", "args": ["--Ice.Default.SlicedFormat"] }, { - "configName": "1.0", - "desc": "1.0 encoding", + "name": "client/server with 1.0 encoding", "args": ["--Ice.Default.EncodingVersion=1.0"] } ] }, - "Ice/exceptionsBidir": - { - "files": ["Test.js", "ThrowerI.js", "AMDThrowerI.js", "../exceptions/Client.js", "Client.js"] - }, "Ice/facets": { - "files": ["Test.js", "Client.js"] - }, - "Ice/facetsBidir": - { - "files": ["Test.js", "TestI.js", "../facets/Client.js", "Client.js"] + "files": ["Test.js", "Client.js", "TestI.js", "ClientBidir.js"] }, "Ice/hold": { @@ -74,67 +61,45 @@ }, "Ice/inheritance": { - "files": ["Test.js", "Client.js"] - }, - "Ice/inheritanceBidir": - { - "files": ["Test.js", "InitialI.js", "../inheritance/Client.js", "Client.js"] + "files": ["Test.js", "Client.js", "InitialI.js", "ClientBidir.js"] }, "Ice/operations": { - "files": ["Test.js", "Twoways.js", "Oneways.js", "BatchOneways.js", "Client.js"] - }, - "Ice/operationsBidir": - { - "files": ["Test.js", "../operations/Twoways.js", "../operations/Oneways.js", - "../operations/BatchOneways.js", "MyDerivedClassI.js", "AMDMyDerivedClassI.js", - "../operations/Client.js", "Client.js"] + "files": ["Test.js", "Twoways.js", "Oneways.js", "BatchOneways.js", "Client.js", + "MyDerivedClassI.js", "AMDMyDerivedClassI.js", "ClientBidir.js"] }, "Ice/objects": { "files": ["Test.js", "Client.js"], - "configurations": + "testcases": [ { - "configName": "compact", - "desc": "compact (default) format" + "name": "client/server with compact format" }, { - "configName": "sliced", - "desc": "sliced format", + "name": "client/server with sliced format", "args": ["--Ice.Default.SlicedFormat"] }, { - "configName": "1.0", - "desc": "1.0 encoding", + "name": "client/server with 1.0 encoding", "args": ["--Ice.Default.EncodingVersion=1.0"] } ] }, "Ice/optional": { - "files": ["Test.js", "Client.js", "ClientPrivate.js"], - "configurations": + "files": ["Test.js", "Client.js", "ClientPrivate.js", "InitialI.js", "AMDInitialI.js", "ClientBidir.js"], + "testcases": [ { - "configName": "compact", - "desc": "compact (default) format" + "name": "client/server with compact format" }, { - "configName": "sliced", - "desc": "sliced format", + "name": "client/server with sliced format", "args": ["--Ice.Default.SlicedFormat"] } ] }, - "Ice/optionalBidir": - { - "files": ["Test.js", "InitialI.js", "AMDInitialI.js", "../optional/Client.js", "../optional/ClientPrivate.js", "Client.js"] - }, - "Ice/promise": - { - "files": ["Client.js"] - }, "Ice/properties": { "files": ["Client.js"] @@ -150,15 +115,13 @@ "Ice/slicing/exceptions": { "files": ["Test.js", "Client.js"], - "configurations": + "testcases": [ { - "configName": "sliced", - "desc": "sliced format" + "name": "client/server" }, { - "configName": "1.0", - "desc": "1.0 encoding", + "name": "client/server with 1.0 encoding", "args": ["--Ice.Default.EncodingVersion=1.0"] } ] @@ -166,15 +129,13 @@ "Ice/slicing/objects": { "files": ["Test.js", "Client.js"], - "configurations": + "testcases": [ { - "configName": "sliced", - "desc": "sliced format" + "name": "client/server" }, { - "configName": "1.0", - "desc": "1.0 encoding", + "name": "client/server with 1.0 encoding", "args": ["--Ice.Default.EncodingVersion=1.0"] } ] diff --git a/js/test/Common/Worker.js b/js/test/Common/Worker.js index 25d761c0a1a..952f9e45484 100644 --- a/js/test/Common/Worker.js +++ b/js/test/Common/Worker.js @@ -34,7 +34,7 @@ self.onmessage = function(e) self.importScripts("/node_modules/babel-polyfill/dist/polyfill.js"); self.importScripts("/node_modules/regenerator-runtime/runtime.js"); self.importScripts("/lib/es5/Ice.js"); - self.importScripts("/test/Common/es5/Controller.js"); + self.importScripts("/test/es5/Common/Controller.js"); } else { diff --git a/js/test/Common/index.html b/js/test/Common/index.html index 2ca7e5cecfb..16eee2fba83 100644 --- a/js/test/Common/index.html +++ b/js/test/Common/index.html @@ -13,7 +13,7 @@ {{/scripts}} <script type="text/javascript"> var current = "{{current}}"; - var TestCases = {{{TestCases}}}; + var TestSuites = {{{TestSuites}}}; </script> </head> <body> diff --git a/js/test/Common/run.js b/js/test/Common/run.js new file mode 100755 index 00000000000..40d83aff47a --- /dev/null +++ b/js/test/Common/run.js @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// 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. +// +// ********************************************************************** + + + +var Ice = require(process.argv[2] === "--es5" ? "ice/src/es5" : "ice").Ice; + +var write = function(msg) +{ + process.stdout.write(msg); +}; + +var writeLine = function(msg) +{ + this.write(msg + "\n"); +}; + +var id = new Ice.InitializationData(); +id.properties = Ice.createProperties(process.argv); +exe = process.argv[2] === "--es5" ? process.argv[3] : process.argv[2] +var test = module.require(exe) +test = exe === "ClientBidir" ? test.__testBidir__ : test.__test__; + +test({write: write, writeLine: writeLine}, id).catch( + ex => + { + console.log(ex.toString()); + if(ex.stack) + { + console.log(ex.stack); + } + process.exit(1); + }); diff --git a/js/test/Glacier2/es5/router/run.js b/js/test/Glacier2/es5/router/run.js deleted file mode 100644 index 82c8656d3b0..00000000000 --- a/js/test/Glacier2/es5/router/run.js +++ /dev/null @@ -1,10 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Glacier2/es5/router/run.py b/js/test/Glacier2/es5/router/run.py deleted file mode 100755 index 3e2bfeef34f..00000000000 --- a/js/test/Glacier2/es5/router/run.py +++ /dev/null @@ -1,50 +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 - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - ' --Glacier2.Filter.Category.AcceptUser="2"' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest() - -starterProc.waitTestSuccess() diff --git a/js/test/Glacier2/router/Client.js b/js/test/Glacier2/router/Client.js index c207321d37f..0ca42d37584 100644 --- a/js/test/Glacier2/router/Client.js +++ b/js/test/Glacier2/router/Client.js @@ -69,8 +69,7 @@ var failCB = function () { test(false); }; - var router, base, session, twoway, oneway, category, processBase, process, - adapter,callbackReceiverImpl, + var router, base, session, twoway, oneway, category, processBase, processPrx, adapter,callbackReceiverImpl, callbackReceiver, twowayR, onewayR, fakeTwowayR; @@ -79,7 +78,7 @@ function() { out.write("testing stringToProxy for router... "); - var routerBase = communicator.stringToProxy("Glacier2/router:default -p 12347"); + var routerBase = communicator.stringToProxy("Glacier2/router:default -p 12020"); test(routerBase !== null); out.writeLine("ok"); @@ -317,11 +316,14 @@ ).then( function() { - out.writeLine("ok"); - out.write("testing server shutdown... "); - return twoway.shutdown(); - // No ping, otherwise the router prints a warning message if it's - // started with --Ice.Warn.Connections. + if(process.argv.indexOf("--shutdown") > -1) + { + out.writeLine("ok"); + out.write("testing server shutdown... "); + return twoway.shutdown(); + // No ping, otherwise the router prints a warning message if it's + // started with --Ice.Warn.Connections. + } } ).then( function() @@ -346,38 +348,41 @@ test(ex instanceof Ice.ConnectionLostException); out.writeLine("ok"); - out.write("uninstalling router with communicator... "); - communicator.setDefaultRouter(null); - out.writeLine("ok"); + if(process.argv.indexOf("--shutdown") > -1) + { + out.write("uninstalling router with communicator... "); + communicator.setDefaultRouter(null); + out.writeLine("ok"); - out.write("testing stringToProxy for process object... "); - processBase = communicator.stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); - out.writeLine("ok"); + out.write("testing stringToProxy for process object... "); + processBase = communicator.stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12021"); + out.writeLine("ok"); - out.write("testing checked cast for admin object... "); - return Ice.ProcessPrx.checkedCast(processBase); - } - ).then( - function(o) - { - process = o; - test(process !== null); - out.writeLine("ok"); + out.write("testing checked cast for admin object... "); + return Ice.ProcessPrx.checkedCast(processBase).then( + function(o) + { + processPrx = o; + test(processPrx !== null); + out.writeLine("ok"); - out.write("testing Glacier2 shutdown... "); - return process.shutdown(); - } - ).then( - function() - { - return process.ice_ping(); - } - ).then( - failCB, - function(ex) - { - test(ex instanceof Ice.LocalException); - out.writeLine("ok"); + out.write("testing Glacier2 shutdown... "); + return processPrx.shutdown(); + } + ).then( + function() + { + return processPrx.ice_ping(); + } + ).then( + failCB, + function(ex) + { + test(ex instanceof Ice.LocalException); + out.writeLine("ok"); + } + ); + } } ).catch(e => console.log(e)); }; diff --git a/js/test/Glacier2/router/run.py b/js/test/Glacier2/router/run.py deleted file mode 100755 index dcc00db1012..00000000000 --- a/js/test/Glacier2/router/run.py +++ /dev/null @@ -1,50 +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 - -router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") - -# -# Generate the crypt passwords file -# -TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"}) - -args = ' --Ice.Warn.Dispatch=0' + \ - ' --Ice.Warn.Connections=0' + \ - ' --Glacier2.Filter.Category.Accept="c1 c2"' + \ - ' --Glacier2.Filter.Category.AcceptUser="2"' + \ - ' --Glacier2.SessionTimeout="30"' + \ - ' --Glacier2.Client.Endpoints="default -p 12347"' + \ - ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \ - ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ - ' --Ice.Admin.InstanceName=Glacier2' + \ - ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - -sys.stdout.write("starting router... ") -sys.stdout.flush() -routerConfig = TestUtil.DriverConfig("server") -routerConfig.lang = "cpp" -starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print("ok") - -TestUtil.clientServerTest() - -starterProc.waitTestSuccess() diff --git a/js/test/Ice/acm/run.py b/js/test/Ice/acm/run.py deleted file mode 100755 index 543a6998430..00000000000 --- a/js/test/Ice/acm/run.py +++ /dev/null @@ -1,23 +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, getopt - -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.clientServerTest() diff --git a/js/test/Ice/ami/run.py b/js/test/Ice/ami/run.py deleted file mode 100755 index 7fcd284b757..00000000000 --- a/js/test/Ice/ami/run.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -print("tests with regular server.") -TestUtil.clientServerTest() diff --git a/js/test/Ice/binding/run.py b/js/test/Ice/binding/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/js/test/Ice/binding/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/js/test/Ice/defaultValue/run.py b/js/test/Ice/defaultValue/run.py deleted file mode 100755 index 286e60351b6..00000000000 --- a/js/test/Ice/defaultValue/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.simpleTest() diff --git a/js/test/Ice/enums/run.py b/js/test/Ice/enums/run.py deleted file mode 100755 index 3aac7a1c45a..00000000000 --- a/js/test/Ice/enums/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with 1.1 encoding.") -TestUtil.clientServerTest() diff --git a/js/test/Ice/es5/acm/run.js b/js/test/Ice/es5/acm/run.js deleted file mode 100644 index 222f9f486f7..00000000000 --- a/js/test/Ice/es5/acm/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module);
\ No newline at end of file diff --git a/js/test/Ice/es5/acm/run.py b/js/test/Ice/es5/acm/run.py deleted file mode 100755 index f4209d9cb60..00000000000 --- a/js/test/Ice/es5/acm/run.py +++ /dev/null @@ -1,23 +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, getopt - -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.clientServerTest() diff --git a/js/test/Ice/es5/ami/run.js b/js/test/Ice/es5/ami/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/ami/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/ami/run.py b/js/test/Ice/es5/ami/run.py deleted file mode 100755 index 9d37fa4f702..00000000000 --- a/js/test/Ice/es5/ami/run.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -print("tests with regular server.") -TestUtil.clientServerTest() diff --git a/js/test/Ice/es5/binding/run.js b/js/test/Ice/es5/binding/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/binding/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/binding/run.py b/js/test/Ice/es5/binding/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/js/test/Ice/es5/binding/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/js/test/Ice/es5/defaultValue/run.js b/js/test/Ice/es5/defaultValue/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/defaultValue/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/defaultValue/run.py b/js/test/Ice/es5/defaultValue/run.py deleted file mode 100755 index b2a1b316881..00000000000 --- a/js/test/Ice/es5/defaultValue/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.simpleTest() diff --git a/js/test/Ice/es5/enums/run.js b/js/test/Ice/es5/enums/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/enums/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/enums/run.py b/js/test/Ice/es5/enums/run.py deleted file mode 100755 index 3aac7a1c45a..00000000000 --- a/js/test/Ice/es5/enums/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with 1.1 encoding.") -TestUtil.clientServerTest() diff --git a/js/test/Ice/es5/exceptions/run.js b/js/test/Ice/es5/exceptions/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/exceptions/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/exceptions/run.py b/js/test/Ice/es5/exceptions/run.py deleted file mode 100755 index 067ab2c9639..00000000000 --- a/js/test/Ice/es5/exceptions/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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with compact (default) format and AMD server.") -TestUtil.clientServerTest(server="serveramd") - -print("Running test with sliced format and AMD server.") -TestUtil.clientServerTest(server="serveramd", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding and AMD server.") -TestUtil.clientServerTest(server="serveramd", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/js/test/Ice/es5/exceptionsBidir/run.js b/js/test/Ice/es5/exceptionsBidir/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/exceptionsBidir/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/exceptionsBidir/run.py b/js/test/Ice/es5/exceptionsBidir/run.py deleted file mode 100755 index 6c823b0a75f..00000000000 --- a/js/test/Ice/es5/exceptionsBidir/run.py +++ /dev/null @@ -1,34 +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 - -print("Running test with compact (default) format.") -TestUtil.clientEchoTest(additionalServerOptions="--Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0") - -print("Running test with sliced format.") -TestUtil.clientEchoTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat" + - " --Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0") - -print("Running test with 1.0 encoding.") -TestUtil.clientEchoTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0" + - " --Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0") diff --git a/js/test/Ice/es5/facets/run.js b/js/test/Ice/es5/facets/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/facets/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/facets/run.py b/js/test/Ice/es5/facets/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/js/test/Ice/es5/facets/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/js/test/Ice/es5/facetsBidir/run.js b/js/test/Ice/es5/facetsBidir/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/facetsBidir/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/facetsBidir/run.py b/js/test/Ice/es5/facetsBidir/run.py deleted file mode 100755 index ceff448049a..00000000000 --- a/js/test/Ice/es5/facetsBidir/run.py +++ /dev/null @@ -1,23 +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.clientEchoTest() diff --git a/js/test/Ice/es5/hold/run.js b/js/test/Ice/es5/hold/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/hold/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/hold/run.py b/js/test/Ice/es5/hold/run.py deleted file mode 100755 index 53f97cc4b99..00000000000 --- a/js/test/Ice/es5/hold/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.clientServerTest() diff --git a/js/test/Ice/es5/info/run.js b/js/test/Ice/es5/info/run.js deleted file mode 100644 index 82c8656d3b0..00000000000 --- a/js/test/Ice/es5/info/run.js +++ /dev/null @@ -1,10 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/info/run.py b/js/test/Ice/es5/info/run.py deleted file mode 100755 index 53f97cc4b99..00000000000 --- a/js/test/Ice/es5/info/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.clientServerTest() diff --git a/js/test/Ice/es5/inheritance/run.js b/js/test/Ice/es5/inheritance/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/inheritance/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/inheritance/run.py b/js/test/Ice/es5/inheritance/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/js/test/Ice/es5/inheritance/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/js/test/Ice/es5/inheritanceBidir/run.js b/js/test/Ice/es5/inheritanceBidir/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/inheritanceBidir/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/inheritanceBidir/run.py b/js/test/Ice/es5/inheritanceBidir/run.py deleted file mode 100755 index ceff448049a..00000000000 --- a/js/test/Ice/es5/inheritanceBidir/run.py +++ /dev/null @@ -1,23 +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.clientEchoTest() diff --git a/js/test/Ice/es5/location/run.js b/js/test/Ice/es5/location/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/location/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/location/run.py b/js/test/Ice/es5/location/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/js/test/Ice/es5/location/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/js/test/Ice/es5/number/run.js b/js/test/Ice/es5/number/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/number/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/number/run.py b/js/test/Ice/es5/number/run.py deleted file mode 100755 index b2a1b316881..00000000000 --- a/js/test/Ice/es5/number/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.simpleTest() diff --git a/js/test/Ice/es5/objects/run.js b/js/test/Ice/es5/objects/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/objects/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/objects/run.py b/js/test/Ice/es5/objects/run.py deleted file mode 100755 index 7fc7ba63947..00000000000 --- a/js/test/Ice/es5/objects/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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/js/test/Ice/es5/operations/run.js b/js/test/Ice/es5/operations/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/operations/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/operations/run.py b/js/test/Ice/es5/operations/run.py deleted file mode 100755 index 92ecb40550d..00000000000 --- a/js/test/Ice/es5/operations/run.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") diff --git a/js/test/Ice/es5/operationsBidir/run.js b/js/test/Ice/es5/operationsBidir/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/operationsBidir/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/operationsBidir/run.py b/js/test/Ice/es5/operationsBidir/run.py deleted file mode 100755 index 7dffdec6496..00000000000 --- a/js/test/Ice/es5/operationsBidir/run.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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")) - -operations = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "operations") - -import TestUtil - -TestUtil.addPathToEnv("NODE_PATH", operations) -TestUtil.clientEchoTest() diff --git a/js/test/Ice/es5/optional/run.js b/js/test/Ice/es5/optional/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/optional/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/optional/run.py b/js/test/Ice/es5/optional/run.py deleted file mode 100755 index 95f8e4badb7..00000000000 --- a/js/test/Ice/es5/optional/run.py +++ /dev/null @@ -1,26 +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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") diff --git a/js/test/Ice/es5/optionalBidir/run.js b/js/test/Ice/es5/optionalBidir/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/optionalBidir/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/optionalBidir/run.py b/js/test/Ice/es5/optionalBidir/run.py deleted file mode 100755 index 1c6bcbb23f5..00000000000 --- a/js/test/Ice/es5/optionalBidir/run.py +++ /dev/null @@ -1,26 +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 - -print("Running test with compact (default) format.") -TestUtil.clientEchoTest() -print("Running test with sliced format.") -TestUtil.clientEchoTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") diff --git a/js/test/Ice/es5/properties/run.js b/js/test/Ice/es5/properties/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/properties/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/properties/run.py b/js/test/Ice/es5/properties/run.py deleted file mode 100755 index b2a1b316881..00000000000 --- a/js/test/Ice/es5/properties/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.simpleTest() diff --git a/js/test/Ice/es5/proxy/run.js b/js/test/Ice/es5/proxy/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/proxy/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/proxy/run.py b/js/test/Ice/es5/proxy/run.py deleted file mode 100755 index 92ecb40550d..00000000000 --- a/js/test/Ice/es5/proxy/run.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") diff --git a/js/test/Ice/es5/retry/run.js b/js/test/Ice/es5/retry/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/retry/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/retry/run.py b/js/test/Ice/es5/retry/run.py deleted file mode 100755 index 53f97cc4b99..00000000000 --- a/js/test/Ice/es5/retry/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.clientServerTest() diff --git a/js/test/Ice/es5/slicing/exceptions/run.js b/js/test/Ice/es5/slicing/exceptions/run.js deleted file mode 100644 index e0fef9ed2f2..00000000000 --- a/js/test/Ice/es5/slicing/exceptions/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/slicing/exceptions/run.py b/js/test/Ice/es5/slicing/exceptions/run.py deleted file mode 100755 index 5e44d0f906d..00000000000 --- a/js/test/Ice/es5/slicing/exceptions/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/js/test/Ice/es5/slicing/objects/run.js b/js/test/Ice/es5/slicing/objects/run.js deleted file mode 100644 index e0fef9ed2f2..00000000000 --- a/js/test/Ice/es5/slicing/objects/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/slicing/objects/run.py b/js/test/Ice/es5/slicing/objects/run.py deleted file mode 100755 index 5e44d0f906d..00000000000 --- a/js/test/Ice/es5/slicing/objects/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/js/test/Ice/es5/timeout/run.js b/js/test/Ice/es5/timeout/run.js deleted file mode 100644 index a288c69ca80..00000000000 --- a/js/test/Ice/es5/timeout/run.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; - -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../../Common/es5/Common").run(module); diff --git a/js/test/Ice/es5/timeout/run.py b/js/test/Ice/es5/timeout/run.py deleted file mode 100755 index 53f97cc4b99..00000000000 --- a/js/test/Ice/es5/timeout/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.clientServerTest() diff --git a/js/test/Ice/exceptionsBidir/AMDThrowerI.js b/js/test/Ice/exceptions/AMDThrowerI.js index 0260adaa6b3..0260adaa6b3 100644 --- a/js/test/Ice/exceptionsBidir/AMDThrowerI.js +++ b/js/test/Ice/exceptions/AMDThrowerI.js diff --git a/js/test/Ice/exceptionsBidir/Client.js b/js/test/Ice/exceptions/ClientBidir.js index 8df9ed728dd..601437862a0 100644 --- a/js/test/Ice/exceptionsBidir/Client.js +++ b/js/test/Ice/exceptions/ClientBidir.js @@ -11,14 +11,12 @@ { var Ice = require("ice").Ice; var Test = require("Test").Test; - - var Promise = Ice.Promise; - - var Client = require("../exceptions/Client"); - + var Client = require("Client"); var ThrowerI = require("ThrowerI").ThrowerI; var AMDThrowerI = require("AMDThrowerI").AMDThrowerI; + var Promise = Ice.Promise; + var allTests = function(out, communicator, amd) { return Promise.try( @@ -95,8 +93,7 @@ } ); }; - exports.__test__ = run; - exports.__runEchoServer__ = true; + exports.__testBidir__ = run; exports.__runEchoServerOptions__ = ["Ice.Warn.Dispatch=0", "Ice.Warn.Connections=0"]; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, diff --git a/js/test/Ice/exceptions/Test.ice b/js/test/Ice/exceptions/Test.ice index ba079635bea..4e1fb6a9761 100644 --- a/js/test/Ice/exceptions/Test.ice +++ b/js/test/Ice/exceptions/Test.ice @@ -73,4 +73,11 @@ interface WrongOperation void noSuchOperation(); }; +interface Echo +{ + void startBatch(); + void flushBatch(); + void shutdown(); +}; + }; diff --git a/js/test/Ice/exceptionsBidir/ThrowerI.js b/js/test/Ice/exceptions/ThrowerI.js index 9d1a3492df7..9d1a3492df7 100644 --- a/js/test/Ice/exceptionsBidir/ThrowerI.js +++ b/js/test/Ice/exceptions/ThrowerI.js diff --git a/js/test/Ice/exceptions/run.py b/js/test/Ice/exceptions/run.py deleted file mode 100755 index c1354e11ce2..00000000000 --- a/js/test/Ice/exceptions/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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with compact (default) format and AMD server.") -TestUtil.clientServerTest(server="serveramd") - -print("Running test with sliced format and AMD server.") -TestUtil.clientServerTest(server="serveramd", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding and AMD server.") -TestUtil.clientServerTest(server="serveramd", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/js/test/Ice/exceptionsBidir/.gitignore b/js/test/Ice/exceptionsBidir/.gitignore deleted file mode 100644 index 4b74460eef7..00000000000 --- a/js/test/Ice/exceptionsBidir/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Test.js -TestAMD.js -index.html diff --git a/js/test/Ice/exceptionsBidir/Test.ice b/js/test/Ice/exceptionsBidir/Test.ice deleted file mode 100644 index 4e1fb6a9761..00000000000 --- a/js/test/Ice/exceptionsBidir/Test.ice +++ /dev/null @@ -1,83 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -#pragma once - -#include <Ice/BuiltinSequences.ice> - -module Test -{ - -interface Empty -{ -}; - -interface Thrower; - -exception A -{ - int aMem; -}; - -exception B extends A -{ - int bMem; -}; - -exception C extends B -{ - int cMem; -}; - -exception D -{ - int dMem; -}; - -interface Thrower -{ - void shutdown(); - bool supportsUndeclaredExceptions(); - bool supportsAssertException(); - - void throwAasA(int a) throws A; - void throwAorDasAorD(int a) throws A, D; - void throwBasA(int a, int b) throws A; - void throwCasA(int a, int b, int c) throws A; - void throwBasB(int a, int b) throws B; - void throwCasB(int a, int b, int c) throws B; - void throwCasC(int a, int b, int c) throws C; - - void throwUndeclaredA(int a); - void throwUndeclaredB(int a, int b); - void throwUndeclaredC(int a, int b, int c); - void throwLocalException(); - void throwNonIceException(); - void throwAssertException(); - Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq); - - idempotent void throwLocalExceptionIdempotent(); - - void throwAfterResponse(); - void throwAfterException() throws A; -}; - -interface WrongOperation -{ - void noSuchOperation(); -}; - -interface Echo -{ - void startBatch(); - void flushBatch(); - void shutdown(); -}; - -}; diff --git a/js/test/Ice/exceptionsBidir/run.js b/js/test/Ice/exceptionsBidir/run.js deleted file mode 100644 index fc8c9a16e7c..00000000000 --- a/js/test/Ice/exceptionsBidir/run.js +++ /dev/null @@ -1,10 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../Common/Common").run(module); diff --git a/js/test/Ice/exceptionsBidir/run.py b/js/test/Ice/exceptionsBidir/run.py deleted file mode 100755 index 4a18001ae76..00000000000 --- a/js/test/Ice/exceptionsBidir/run.py +++ /dev/null @@ -1,34 +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 - -print("Running test with compact (default) format.") -TestUtil.clientEchoTest(additionalServerOptions="--Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0") - -print("Running test with sliced format.") -TestUtil.clientEchoTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat" + - " --Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0") - -print("Running test with 1.0 encoding.") -TestUtil.clientEchoTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0" + - " --Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0") diff --git a/js/test/Ice/facetsBidir/Client.js b/js/test/Ice/facets/ClientBidir.js index 296e3eb4590..3741b6f59d5 100644 --- a/js/test/Ice/facetsBidir/Client.js +++ b/js/test/Ice/facets/ClientBidir.js @@ -11,9 +11,7 @@ { var Ice = require("ice").Ice; var Test = require("Test").Test; - - var Client = require("../facets/Client"); - + var Client = require("Client"); var TestI = require("TestI"); var Promise = Ice.Promise; @@ -165,8 +163,7 @@ } ); }; - exports.__test__ = run; - exports.__runEchoServer__ = true; + exports.__testBidir__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, diff --git a/js/test/Ice/facets/Test.ice b/js/test/Ice/facets/Test.ice index 62d52fe2381..1f50f2e4a2a 100644 --- a/js/test/Ice/facets/Test.ice +++ b/js/test/Ice/facets/Test.ice @@ -57,5 +57,12 @@ interface H extends G string callH(); }; +interface Echo +{ + void startBatch(); + void flushBatch(); + void shutdown(); +}; + }; diff --git a/js/test/Ice/facetsBidir/TestI.js b/js/test/Ice/facets/TestI.js index 90cf8a4fc8c..90cf8a4fc8c 100644 --- a/js/test/Ice/facetsBidir/TestI.js +++ b/js/test/Ice/facets/TestI.js diff --git a/js/test/Ice/facets/run.py b/js/test/Ice/facets/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/js/test/Ice/facets/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/js/test/Ice/facetsBidir/.gitignore b/js/test/Ice/facetsBidir/.gitignore deleted file mode 100644 index d158d9308ba..00000000000 --- a/js/test/Ice/facetsBidir/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -Test.js -index.html diff --git a/js/test/Ice/facetsBidir/Test.ice b/js/test/Ice/facetsBidir/Test.ice deleted file mode 100644 index 818c2ba878b..00000000000 --- a/js/test/Ice/facetsBidir/Test.ice +++ /dev/null @@ -1,67 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -#pragma once - -module Test -{ - -interface Empty -{ -}; - -interface A -{ - string callA(); -}; - -interface B extends A -{ - string callB(); -}; - -interface C extends A -{ - string callC(); -}; - -interface D extends B, C -{ - string callD(); -}; - -interface E -{ - string callE(); -}; - -interface F extends E -{ - string callF(); -}; - -interface G -{ - void shutdown(); - string callG(); -}; - -interface H extends G -{ - string callH(); -}; - -interface Echo -{ - void startBatch(); - void flushBatch(); - void shutdown(); -}; - -}; diff --git a/js/test/Ice/facetsBidir/run.js b/js/test/Ice/facetsBidir/run.js deleted file mode 100644 index fc8c9a16e7c..00000000000 --- a/js/test/Ice/facetsBidir/run.js +++ /dev/null @@ -1,10 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../Common/Common").run(module); diff --git a/js/test/Ice/facetsBidir/run.py b/js/test/Ice/facetsBidir/run.py deleted file mode 100755 index 2647019ee91..00000000000 --- a/js/test/Ice/facetsBidir/run.py +++ /dev/null @@ -1,23 +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.clientEchoTest() diff --git a/js/test/Ice/hold/run.py b/js/test/Ice/hold/run.py deleted file mode 100755 index ea7ce7ad721..00000000000 --- a/js/test/Ice/hold/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.clientServerTest() diff --git a/js/test/Ice/import/run.py b/js/test/Ice/import/run.py deleted file mode 100755 index 286e60351b6..00000000000 --- a/js/test/Ice/import/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.simpleTest() diff --git a/js/test/Ice/info/run.py b/js/test/Ice/info/run.py deleted file mode 100755 index ea7ce7ad721..00000000000 --- a/js/test/Ice/info/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.clientServerTest() diff --git a/js/test/Ice/inheritanceBidir/Client.js b/js/test/Ice/inheritance/ClientBidir.js index 1b39fb22b1b..b06209be418 100644 --- a/js/test/Ice/inheritanceBidir/Client.js +++ b/js/test/Ice/inheritance/ClientBidir.js @@ -12,7 +12,7 @@ var Ice = require("ice").Ice; var Test = require("Test").Test; var InitialI = require("InitialI").InitialI; - var Client = require("../inheritance/Client"); + var Client = require("Client"); var Promise = Ice.Promise; @@ -68,8 +68,7 @@ } ); }; - exports.__test__ = run; - exports.__runEchoServer__ = true; + exports.__testBidir__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, diff --git a/js/test/Ice/inheritanceBidir/InitialI.js b/js/test/Ice/inheritance/InitialI.js index d373cec8008..d373cec8008 100644 --- a/js/test/Ice/inheritanceBidir/InitialI.js +++ b/js/test/Ice/inheritance/InitialI.js diff --git a/js/test/Ice/inheritance/Test.ice b/js/test/Ice/inheritance/Test.ice index b563c607a49..7be1091796e 100644 --- a/js/test/Ice/inheritance/Test.ice +++ b/js/test/Ice/inheritance/Test.ice @@ -231,4 +231,11 @@ class D extends C }; +interface Echo +{ + void startBatch(); + void flushBatch(); + void shutdown(); +}; + }; diff --git a/js/test/Ice/inheritance/run.py b/js/test/Ice/inheritance/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/js/test/Ice/inheritance/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/js/test/Ice/inheritanceBidir/.gitignore b/js/test/Ice/inheritanceBidir/.gitignore deleted file mode 100644 index d158d9308ba..00000000000 --- a/js/test/Ice/inheritanceBidir/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -Test.js -index.html diff --git a/js/test/Ice/inheritanceBidir/Test.ice b/js/test/Ice/inheritanceBidir/Test.ice deleted file mode 100644 index 7be1091796e..00000000000 --- a/js/test/Ice/inheritanceBidir/Test.ice +++ /dev/null @@ -1,241 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -#pragma once - -module Test -{ - -module MA -{ - -interface IA -{ - IA* iaop(IA* p); -}; - -class CA -{ - CA* caop(CA* p); -}; - -}; - -module MB -{ - -interface IB1 extends MA::IA -{ - IB1* ib1op(IB1* p); -}; - -interface IB2 extends MA::IA -{ - IB2* ib2op(IB2* p); -}; - -class CB extends MA::CA -{ - CB* cbop(CB* p); -}; - -}; - -module MA -{ - -interface IC extends MB::IB1, MB::IB2 -{ - IC* icop(IC* p); -}; - -class CC extends MB::CB -{ - CC* ccop(CC* p); -}; - -class CD extends CC implements MB::IB1, MB::IB2 -{ - CD* cdop(CD* p); -}; - -}; - -interface Initial -{ - void shutdown(); - MA::CA* caop(); - MB::CB* cbop(); - MA::CC* ccop(); - MA::CD* cdop(); - MA::IA* iaop(); - MB::IB1* ib1op(); - MB::IB2* ib2op(); - MA::IC* icop(); -}; - - -module MC -{ - -class A -{ - int aA; -}; - -class B extends A -{ - int bB; -}; - -class C extends B -{ - int cC; -}; - -class D extends C -{ - int dD; -}; - -}; - -module MD -{ - -class A -{ - int aA; -}; - -class B extends A -{ - int bB; -}; - -class C extends B -{ - int cC; -}; - -class D extends C -{ - int dD; -}; - -}; - -module ME -{ - -class A -{ - int aA; -}; - -class B extends A -{ - int bB; -}; - -class C extends B -{ - int cC; -}; - -class D extends C -{ - int dD; -}; - -}; - -module MF -{ - -class A -{ - int aA; -}; - -class B extends A -{ - int bB; -}; - -class C extends B -{ - int cC; -}; - -class D extends C -{ - int dD; -}; - -}; - -module MG -{ - -class A -{ - int aA; -}; - -class B extends A -{ - int bB; -}; - -class C extends B -{ - int cC; -}; - -class D extends C -{ - int dD; -}; - -}; - -module MH -{ - -class A -{ - int aA; -}; - -class B extends A -{ - int bB; -}; - -class C extends B -{ - int cC; -}; - -class D extends C -{ - int dD; -}; - -}; - -interface Echo -{ - void startBatch(); - void flushBatch(); - void shutdown(); -}; - -}; diff --git a/js/test/Ice/inheritanceBidir/run.js b/js/test/Ice/inheritanceBidir/run.js deleted file mode 100644 index fc8c9a16e7c..00000000000 --- a/js/test/Ice/inheritanceBidir/run.js +++ /dev/null @@ -1,10 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../Common/Common").run(module); diff --git a/js/test/Ice/inheritanceBidir/run.py b/js/test/Ice/inheritanceBidir/run.py deleted file mode 100755 index 2647019ee91..00000000000 --- a/js/test/Ice/inheritanceBidir/run.py +++ /dev/null @@ -1,23 +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.clientEchoTest() diff --git a/js/test/Ice/location/run.py b/js/test/Ice/location/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/js/test/Ice/location/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/js/test/Ice/number/run.py b/js/test/Ice/number/run.py deleted file mode 100755 index 286e60351b6..00000000000 --- a/js/test/Ice/number/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.simpleTest() diff --git a/js/test/Ice/objects/run.py b/js/test/Ice/objects/run.py deleted file mode 100755 index 1361b69d666..00000000000 --- a/js/test/Ice/objects/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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js b/js/test/Ice/operations/AMDMyDerivedClassI.js index dfc905c6d2c..dfc905c6d2c 100644 --- a/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js +++ b/js/test/Ice/operations/AMDMyDerivedClassI.js diff --git a/js/test/Ice/operationsBidir/Client.js b/js/test/Ice/operations/ClientBidir.js index 93cb534711a..0ed0a1c14c8 100644 --- a/js/test/Ice/operationsBidir/Client.js +++ b/js/test/Ice/operations/ClientBidir.js @@ -13,7 +13,7 @@ var Test = require("Test").Test; var MyDerivedClassI = require("MyDerivedClassI").MyDerivedClassI; var AMDMyDerivedClassI = require("AMDMyDerivedClassI").AMDMyDerivedClassI; - var Client = require("../operations/Client.js"); + var Client = require("Client.js"); var Promise = Ice.Promise; @@ -63,8 +63,7 @@ ).then(prx => prx.shutdown() ).finally(() => communicator.destroy()); }; - exports.__test__ = run; - exports.__runEchoServer__ = true; + exports.__testBidir__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, diff --git a/js/test/Ice/operationsBidir/MyDerivedClassI.js b/js/test/Ice/operations/MyDerivedClassI.js index a061a1a1dd2..a061a1a1dd2 100644 --- a/js/test/Ice/operationsBidir/MyDerivedClassI.js +++ b/js/test/Ice/operations/MyDerivedClassI.js diff --git a/js/test/Ice/operations/Test.ice b/js/test/Ice/operations/Test.ice index 290988d09a4..81caced8a0a 100644 --- a/js/test/Ice/operations/Test.ice +++ b/js/test/Ice/operations/Test.ice @@ -280,6 +280,13 @@ class MyDerivedClass extends MyClass MyStruct1 opMyStruct1(MyStruct1 opMyStruct1); }; +interface Echo +{ + void startBatch(); + void flushBatch(); + void shutdown(); +}; + // // String literals // diff --git a/js/test/Ice/operations/run.py b/js/test/Ice/operations/run.py deleted file mode 100755 index 0d7ea279a91..00000000000 --- a/js/test/Ice/operations/run.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") diff --git a/js/test/Ice/operationsBidir/.gitignore b/js/test/Ice/operationsBidir/.gitignore deleted file mode 100644 index 4b74460eef7..00000000000 --- a/js/test/Ice/operationsBidir/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Test.js -TestAMD.js -index.html diff --git a/js/test/Ice/operationsBidir/Test.ice b/js/test/Ice/operationsBidir/Test.ice deleted file mode 100644 index d944e4c962d..00000000000 --- a/js/test/Ice/operationsBidir/Test.ice +++ /dev/null @@ -1,360 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -#pragma once - -#include <Ice/Current.ice> - -module Test -{ - -enum MyEnum -{ - enum1, - enum2, - enum3 -}; - -class MyClass; - -struct AnotherStruct -{ - string s; -}; - -struct Structure -{ - MyClass* p; - MyEnum e; - AnotherStruct s; -}; - -sequence<byte> ByteS; -sequence<bool> BoolS; -sequence<short> ShortS; -sequence<int> IntS; -sequence<long> LongS; -sequence<float> FloatS; -sequence<double> DoubleS; -sequence<string> StringS; -sequence<MyEnum> MyEnumS; -sequence<MyClass*> MyClassS; - -sequence<ByteS> ByteSS; -sequence<BoolS> BoolSS; -sequence<ShortS> ShortSS; -sequence<IntS> IntSS; -sequence<LongS> LongSS; -sequence<FloatS> FloatSS; -sequence<DoubleS> DoubleSS; -sequence<StringS> StringSS; -sequence<MyEnumS> MyEnumSS; -sequence<MyClassS> MyClassSS; - -sequence<StringSS> StringSSS; - -struct MyStruct -{ - int i; - int j; -}; - -dictionary<byte, bool> ByteBoolD; -dictionary<short, int> ShortIntD; -dictionary<long, float> LongFloatD; -dictionary<string, string> StringStringD; -dictionary<string, MyEnum> StringMyEnumD; -dictionary<MyEnum, string> MyEnumStringD; -dictionary<MyStruct, MyEnum> MyStructMyEnumD; - -sequence<ByteBoolD> ByteBoolDS; -sequence<ShortIntD> ShortIntDS; -sequence<LongFloatD> LongFloatDS; -sequence<StringStringD> StringStringDS; -sequence<StringMyEnumD> StringMyEnumDS; -sequence<MyEnumStringD> MyEnumStringDS; -sequence<MyStructMyEnumD> MyStructMyEnumDS; - -dictionary<byte, ByteS> ByteByteSD; -dictionary<bool, BoolS> BoolBoolSD; -dictionary<short, ShortS> ShortShortSD; -dictionary<int, IntS> IntIntSD; -dictionary<long, LongS> LongLongSD; -dictionary<string, FloatS> StringFloatSD; -dictionary<string, DoubleS> StringDoubleSD; -dictionary<string, StringS> StringStringSD; -dictionary<MyEnum, MyEnumS> MyEnumMyEnumSD; - -class MyClass -{ - void shutdown(); - - ["amd"] void delay(int ms); - - void opVoid(); - - byte opByte(byte p1, byte p2, - out byte p3); - - bool opBool(bool p1, bool p2, - out bool p3); - - long opShortIntLong(short p1, int p2, long p3, - out short p4, out int p5, out long p6); - - double opFloatDouble(float p1, double p2, - out float p3, out double p4); - - string opString(string p1, string p2, - out string p3); - - MyEnum opMyEnum(MyEnum p1, out MyEnum p2); - - MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); - - Structure opStruct(Structure p1, Structure p2, - out Structure p3); - - ByteS opByteS(ByteS p1, ByteS p2, - out ByteS p3); - - BoolS opBoolS(BoolS p1, BoolS p2, - out BoolS p3); - - LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, - out ::Test::ShortS p4, out IntS p5, out LongS p6); - - DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, - out FloatS p3, out DoubleS p4); - - StringS opStringS(StringS p1, StringS p2, - out StringS p3); - - ByteSS opByteSS(ByteSS p1, ByteSS p2, - out ByteSS p3); - - BoolSS opBoolSS(BoolSS p1, BoolSS p2, - out BoolSS p3); - - LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, - out ShortSS p4, out IntSS p5, out LongSS p6); - - - DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, - out FloatSS p3, out DoubleSS p4); - - StringSS opStringSS(StringSS p1, StringSS p2, - out StringSS p3); - - StringSSS opStringSSS(StringSSS p1, StringSSS p2, - out StringSSS p3); - - ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, - out ByteBoolD p3); - - ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, - out ShortIntD p3); - - LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, - out LongFloatD p3); - - StringStringD opStringStringD(StringStringD p1, StringStringD p2, - out StringStringD p3); - - StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, - out StringMyEnumD p3); - - MyEnumStringD opMyEnumStringD(MyEnumStringD p1, MyEnumStringD p2, - out MyEnumStringD p3); - - MyStructMyEnumD opMyStructMyEnumD(MyStructMyEnumD p1, MyStructMyEnumD p2, - out MyStructMyEnumD p3); - - ByteBoolDS opByteBoolDS(ByteBoolDS p1, ByteBoolDS p2, - out ByteBoolDS p3); - - ShortIntDS opShortIntDS(ShortIntDS p1, ShortIntDS p2, - out ShortIntDS p3); - - LongFloatDS opLongFloatDS(LongFloatDS p1, LongFloatDS p2, - out LongFloatDS p3); - - StringStringDS opStringStringDS(StringStringDS p1, StringStringDS p2, - out StringStringDS p3); - - StringMyEnumDS opStringMyEnumDS(StringMyEnumDS p1, StringMyEnumDS p2, - out StringMyEnumDS p3); - - MyEnumStringDS opMyEnumStringDS(MyEnumStringDS p1, MyEnumStringDS p2, - out MyEnumStringDS p3); - - MyStructMyEnumDS opMyStructMyEnumDS(MyStructMyEnumDS p1, MyStructMyEnumDS p2, - out MyStructMyEnumDS p3); - - ByteByteSD opByteByteSD(ByteByteSD p1, ByteByteSD p2, - out ByteByteSD p3); - - BoolBoolSD opBoolBoolSD(BoolBoolSD p1, BoolBoolSD p2, - out BoolBoolSD p3); - - ShortShortSD opShortShortSD(ShortShortSD p1, ShortShortSD p2, - out ShortShortSD p3); - - IntIntSD opIntIntSD(IntIntSD p1, IntIntSD p2, - out IntIntSD p3); - - LongLongSD opLongLongSD(LongLongSD p1, LongLongSD p2, - out LongLongSD p3); - - StringFloatSD opStringFloatSD(StringFloatSD p1, StringFloatSD p2, - out StringFloatSD p3); - - StringDoubleSD opStringDoubleSD(StringDoubleSD p1, StringDoubleSD p2, - out StringDoubleSD p3); - - StringStringSD opStringStringSD(StringStringSD p1, StringStringSD p2, - out StringStringSD p3); - - MyEnumMyEnumSD opMyEnumMyEnumSD(MyEnumMyEnumSD p1, MyEnumMyEnumSD p2, - out MyEnumMyEnumSD p3); - - IntS opIntS(IntS s); - - void opByteSOneway(ByteS s); - int opByteSOnewayCallCount(); - - Ice::Context opContext(); - - void opDoubleMarshaling(double p1, DoubleS p2); - - idempotent void opIdempotent(); - - ["nonmutating"] idempotent void opNonmutating(); - - byte opByte1(byte opByte1); - short opShort1(short opShort1); - int opInt1(int opInt1); - long opLong1(long opLong1); - float opFloat1(float opFloat1); - double opDouble1(double opDouble1); - string opString1(string opString1); - StringS opStringS1(StringS opStringS1); - ByteBoolD opByteBoolD1(ByteBoolD opByteBoolD1); - StringS opStringS2(StringS stringS); - ByteBoolD opByteBoolD2(ByteBoolD byteBoolD); - - StringS opStringLiterals(); - - ["marshaled-result"] Structure opMStruct1(); - ["marshaled-result"] Structure opMStruct2(Structure p1, out Structure p2); - - ["marshaled-result"] StringS opMSeq1(); - ["marshaled-result"] StringS opMSeq2(StringS p1, out StringS p2); - - ["marshaled-result"] StringStringD opMDict1(); - ["marshaled-result"] StringStringD opMDict2(StringStringD p1, out StringStringD p2); -}; - -struct MyStruct1 -{ - string tesT; // Same name as the enclosing module - MyClass myClass; // Same name as an already defined class - string myStruct1; // Same name as the enclosing struct -}; - -class MyClass1 -{ - string tesT; // Same name as the enclosing module - MyClass myClass; // Same name as an already defined class - string myClass1; // Same name as the enclosing class -}; - -class MyDerivedClass extends MyClass -{ - void opDerived(); - MyClass1 opMyClass1(MyClass1 opMyClass1); - MyStruct1 opMyStruct1(MyStruct1 opMyStruct1); -}; - -interface Echo -{ - void startBatch(); - void flushBatch(); - void shutdown(); -}; - -// -// String literals -// - -const string s0 = "\u005c"; // backslash -const string s1 = "\u0041"; // A -const string s2 = "\u0049\u0063\u0065"; // Ice -const string s3 = "\u004121"; // A21 -const string s4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041 -const string s5 = "\u00FF"; // ÿ -const string s6 = "\u03FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF) -const string s7 = "\u05F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0) -const string s8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000) -const string s9 = "\U0001F34C"; // BANANA (U+1F34C) -const string s10 = "\u0DA7"; // Sinhala Letter Alpapraana Ttayanna - -const string sw0 = "\U0000005c"; // backslash -const string sw1 = "\U00000041"; // A -const string sw2 = "\U00000049\U00000063\U00000065"; // Ice -const string sw3 = "\U0000004121"; // A21 -const string sw4 = "\\u0041 \\U00000041"; // \\u0041 \\U00000041 -const string sw5 = "\U000000FF"; // ÿ -const string sw6 = "\U000003FF"; // GREEK CAPITAL REVERSED DOTTED LUNATE SIGMA SYMBOL (U+03FF) -const string sw7 = "\U000005F0"; // HEBREW LIGATURE YIDDISH DOUBLE VAV (U+05F0) -const string sw8 = "\U00010000"; // LINEAR B SYLLABLE B008 A (U+10000) -const string sw9 = "\U0001F34C"; // BANANA (U+1F34C) -const string sw10 = "\U00000DA7"; // Sinhala Letter Alpapraana Ttayanna - -/** -\' single quote byte 0x27 in ASCII encoding -\" double quote byte 0x22 in ASCII encoding -\? question mark byte 0x3f in ASCII encoding -\\ backslash byte 0x5c in ASCII encoding -\a audible bell byte 0x07 in ASCII encoding -\b backspace byte 0x08 in ASCII encoding -\f form feed - new page byte 0x0c in ASCII encoding -\n line feed - new line byte 0x0a in ASCII encoding -\r carriage return byte 0x0d in ASCII encoding -\t horizontal tab byte 0x09 in ASCII encoding -\v vertical tab byte 0x0b in ASCII encoding -**/ - -const string ss0 = "\'\"\?\\\a\b\f\n\r\t\v\6"; -const string ss1 = "\u0027\u0022\u003f\u005c\u0007\u0008\u000c\u000a\u000d\u0009\u000b\u0006"; -const string ss2 = "\U00000027\U00000022\U0000003f\U0000005c\U00000007\U00000008\U0000000c\U0000000a\U0000000d\U00000009\U0000000b\U00000006"; - -const string ss3 = "\\\\U\\u\\"; /* \\U\u\ */ -const string ss4 = "\\\u0041\\"; /* \A\ */ -const string ss5 = "\\u0041\\"; /* \u0041\ */ - -// -// Ĩ - Unicode Character 'LATIN CAPITAL LETTER I WITH TILDE' (U+0128) -// Ÿ - Unicode Character 'LATIN CAPITAL LETTER Y WITH DIAERESIS' (U+0178) -// ÿ - Unicode Character 'LATIN SMALL LETTER Y WITH DIAERESIS' (U+00FF) -// Ā - Unicode Character 'LATIN CAPITAL LETTER A WITH MACRON' (U+0100) -// ἀ - Unicode Character 'GREEK SMALL LETTER ALPHA WITH PSILI' (U+1F00) -// 𐆔 - Unicode Character 'ROMAN DIMIDIA SEXTULA SIGN' (U+10194) -// 𐅪 - Unicode Character 'GREEK ACROPHONIC THESPIAN ONE HUNDRED' (U+1016A) -// 𐆘 - Unicode Character 'ROMAN SESTERTIUS SIGN' (U+10198) -// 🍀 - Unicode Character 'FOUR LEAF CLOVER' (U+1F340) -// 🍁 - Unicode Character 'MAPLE LEAF' (U+1F341) -// 🍂 - Unicode Character 'FALLEN LEAF' (U+1F342) -// 🍃 - Unicode Character 'LEAF FLUTTERING IN WIND' (U+1F343) -// -const string su0 = "ĨŸÿĀἀ𐆔𐅪𐆘🍀🍁🍂🍃"; -const string su1 = "\u0128\u0178\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343"; -const string su2 = "\U00000128\U00000178\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343"; - -}; diff --git a/js/test/Ice/operationsBidir/run.js b/js/test/Ice/operationsBidir/run.js deleted file mode 100644 index fc8c9a16e7c..00000000000 --- a/js/test/Ice/operationsBidir/run.js +++ /dev/null @@ -1,10 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../Common/Common").run(module); diff --git a/js/test/Ice/operationsBidir/run.py b/js/test/Ice/operationsBidir/run.py deleted file mode 100755 index 5b8edd102aa..00000000000 --- a/js/test/Ice/operationsBidir/run.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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")) - -operations = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "operations") - -import TestUtil - -TestUtil.addPathToEnv("NODE_PATH", operations) -TestUtil.clientEchoTest() diff --git a/js/test/Ice/optionalBidir/AMDInitialI.js b/js/test/Ice/optional/AMDInitialI.js index c86014914e2..c86014914e2 100644 --- a/js/test/Ice/optionalBidir/AMDInitialI.js +++ b/js/test/Ice/optional/AMDInitialI.js diff --git a/js/test/Ice/optionalBidir/Client.js b/js/test/Ice/optional/ClientBidir.js index ae9c478c503..92ad845369d 100644 --- a/js/test/Ice/optionalBidir/Client.js +++ b/js/test/Ice/optional/ClientBidir.js @@ -13,7 +13,7 @@ var Test = require("Test").Test; var InitialI = require("InitialI").InitialI; var AMDInitialI = require("AMDInitialI").AMDInitialI; - var Client = require("../optional/Client"); + var Client = require("Client"); var Promise = Ice.Promise; var ArrayUtil = Ice.ArrayUtil; @@ -76,8 +76,7 @@ } }); }; - exports.__test__ = run; - exports.__runEchoServer__ = true; + exports.__testBidir__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, diff --git a/js/test/Ice/optionalBidir/InitialI.js b/js/test/Ice/optional/InitialI.js index 99b326a45bd..99b326a45bd 100644 --- a/js/test/Ice/optionalBidir/InitialI.js +++ b/js/test/Ice/optional/InitialI.js diff --git a/js/test/Ice/optional/Test.ice b/js/test/Ice/optional/Test.ice index c527ba9e0f9..1822644faad 100644 --- a/js/test/Ice/optional/Test.ice +++ b/js/test/Ice/optional/Test.ice @@ -301,4 +301,11 @@ class Initial bool supportsNullOptional(); }; +interface Echo +{ + void startBatch(); + void flushBatch(); + void shutdown(); +}; + }; diff --git a/js/test/Ice/optional/run.py b/js/test/Ice/optional/run.py deleted file mode 100755 index 95f8e4badb7..00000000000 --- a/js/test/Ice/optional/run.py +++ /dev/null @@ -1,26 +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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") diff --git a/js/test/Ice/optionalBidir/.gitignore b/js/test/Ice/optionalBidir/.gitignore deleted file mode 100644 index 4b74460eef7..00000000000 --- a/js/test/Ice/optionalBidir/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Test.js -TestAMD.js -index.html diff --git a/js/test/Ice/optionalBidir/Test.ice b/js/test/Ice/optionalBidir/Test.ice deleted file mode 100644 index 02d39135380..00000000000 --- a/js/test/Ice/optionalBidir/Test.ice +++ /dev/null @@ -1,309 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -#pragma once - -module Test -{ - -class OneOptional -{ - optional(1) int a; -}; - -enum MyEnum -{ - MyEnumMember -}; - -struct SmallStruct -{ - byte m; -}; - -struct FixedStruct -{ - int m; -}; - -struct VarStruct -{ - string m; -}; - -struct ClassVarStruct -{ - int a; -}; - -sequence<byte> ByteSeq; -sequence<bool> BoolSeq; -sequence<short> ShortSeq; -sequence<int> IntSeq; -sequence<long> LongSeq; -sequence<float> FloatSeq; -sequence<double> DoubleSeq; -sequence<string> StringSeq; -sequence<MyEnum> MyEnumSeq; -sequence<SmallStruct> SmallStructSeq; -sequence<SmallStruct> SmallStructList; -sequence<FixedStruct> FixedStructSeq; -sequence<FixedStruct> FixedStructList; -sequence<VarStruct> VarStructSeq; -sequence<OneOptional> OneOptionalSeq; -sequence<OneOptional*> OneOptionalPrxSeq; - -sequence<byte> Serializable; - -dictionary<int, int> IntIntDict; -dictionary<string, int> StringIntDict; -dictionary<int, MyEnum> IntEnumDict; -dictionary<int, FixedStruct> IntFixedStructDict; -dictionary<int, VarStruct> IntVarStructDict; -dictionary<int, OneOptional> IntOneOptionalDict; -dictionary<int, OneOptional*> IntOneOptionalPrxDict; - -class MultiOptional -{ - optional(1) byte a; - optional(2) bool b; - optional(3) short c; - optional(4) int d; - optional(5) long e; - optional(6) float f; - optional(7) double g; - optional(8) string h; - optional(9) MyEnum i; - optional(10) MultiOptional* j; - optional(11) MultiOptional k; - optional(12) ByteSeq bs; - optional(13) StringSeq ss; - optional(14) IntIntDict iid; - optional(15) StringIntDict sid; - optional(16) FixedStruct fs; - optional(17) VarStruct vs; - - optional(18) ShortSeq shs; - optional(19) MyEnumSeq es; - optional(20) FixedStructSeq fss; - optional(21) VarStructSeq vss; - optional(22) OneOptionalSeq oos; - optional(23) OneOptionalPrxSeq oops; - - optional(24) IntEnumDict ied; - optional(25) IntFixedStructDict ifsd; - optional(26) IntVarStructDict ivsd; - optional(27) IntOneOptionalDict iood; - optional(28) IntOneOptionalPrxDict ioopd; - - optional(29) BoolSeq bos; - - optional(30) Serializable ser; -}; - -class A -{ - int requiredA; - optional(1) int ma; - optional(50) int mb; - optional(500) int mc; -}; - -["preserve-slice"] -class B extends A -{ - int requiredB; - optional(10) int md; -}; - -class C extends B -{ - string ss; - optional(890) string ms; -}; - -class WD -{ - optional(1) int a = 5; - optional(2) string s = "test"; -}; - -exception OptionalException -{ - bool req = false; - optional(1) int a = 5; - optional(2) string b; - optional(50) OneOptional o; -}; - -exception DerivedException extends OptionalException -{ - optional(600) string ss = "test"; - optional(601) OneOptional o2; -}; - -exception RequiredException extends OptionalException -{ - string ss = "test"; - OneOptional o2; -}; - -class OptionalWithCustom -{ - optional(1) SmallStructList l; - ["protected"] optional(2) SmallStructList lp; - optional(3) ClassVarStruct s; -}; - -class E -{ - A ae; -}; - -class F extends E -{ - optional(1) A af; -}; - -class G1 -{ - string a; -}; - -class G2 -{ - long a; -}; - -class G -{ - optional(1) G1 gg1Opt; - G2 gg2; - optional(0) G2 gg2Opt; - G1 gg1; -}; - -class Initial -{ - void shutdown(); - - Object pingPong(Object o); - - void opOptionalException(optional(1) int a, optional(2) string b, optional(3) OneOptional o) - throws OptionalException; - - void opDerivedException(optional(1) int a, optional(2) string b, optional(3) OneOptional o) - throws OptionalException; - - void opRequiredException(optional(1) int a, optional(2) string b, optional(3) OneOptional o) - throws OptionalException; - - optional(1) byte opByte(optional(2) byte p1, out optional(3) byte p3); - - optional(1) bool opBool(optional(2) bool p1, out optional(3) bool p3); - - optional(1) short opShort(optional(2) short p1, out optional(3) short p3); - - optional(1) int opInt(optional(2) int p1, out optional(3) int p3); - - optional(3) long opLong(optional(1) long p1, out optional(2) long p3); - - optional(1) float opFloat(optional(2) float p1, out optional(3) float p3); - - optional(1) double opDouble(optional(2) double p1, out optional(3) double p3); - - optional(1) string opString(optional(2) string p1, out optional(3) string p3); - - optional(1) MyEnum opMyEnum(optional(2) MyEnum p1, out optional(3) MyEnum p3); - - optional(1) SmallStruct opSmallStruct(optional(2) SmallStruct p1, out optional(3) SmallStruct p3); - - optional(1) FixedStruct opFixedStruct(optional(2) FixedStruct p1, out optional(3) FixedStruct p3); - - optional(1) VarStruct opVarStruct(optional(2) VarStruct p1, out optional(3) VarStruct p3); - - optional(1) OneOptional opOneOptional(optional(2) OneOptional p1, out optional(3) OneOptional p3); - - optional(1) OneOptional* opOneOptionalProxy(optional(2) OneOptional* p1, out optional(3) OneOptional* p3); - - optional(1) ByteSeq opByteSeq(optional(2) ByteSeq p1, out optional(3) ByteSeq p3); - - optional(1) BoolSeq opBoolSeq(optional(2) BoolSeq p1, out optional(3) BoolSeq p3); - - optional(1) ShortSeq opShortSeq(optional(2) ShortSeq p1, out optional(3) ShortSeq p3); - - optional(1) IntSeq opIntSeq(optional(2) IntSeq p1, out optional(3) IntSeq p3); - - optional(1) LongSeq opLongSeq(optional(2) LongSeq p1, out optional(3) LongSeq p3); - - optional(1) FloatSeq opFloatSeq(optional(2) FloatSeq p1, out optional(3) FloatSeq p3); - - optional(1) DoubleSeq opDoubleSeq(optional(2) DoubleSeq p1, out optional(3) DoubleSeq p3); - - optional(1) StringSeq opStringSeq(optional(2) StringSeq p1, out optional(3) StringSeq p3); - - optional(1) SmallStructSeq opSmallStructSeq(optional(2) SmallStructSeq p1, out optional(3) SmallStructSeq p3); - - optional(1) SmallStructList opSmallStructList(optional(2) SmallStructList p1, out optional(3) SmallStructList p3); - - optional(1) FixedStructSeq opFixedStructSeq(optional(2) FixedStructSeq p1, out optional(3) FixedStructSeq p3); - - optional(1) FixedStructList opFixedStructList(optional(2) FixedStructList p1, out optional(3) FixedStructList p3); - - optional(1) VarStructSeq opVarStructSeq(optional(2) VarStructSeq p1, out optional(3) VarStructSeq p3); - - optional(1) Serializable opSerializable(optional(2) Serializable p1, out optional(3) Serializable p3); - - optional(1) IntIntDict opIntIntDict(optional(2) IntIntDict p1, out optional(3) IntIntDict p3); - - optional(1) StringIntDict opStringIntDict(optional(2) StringIntDict p1, out optional(3) StringIntDict p3); - - optional(1) IntOneOptionalDict opIntOneOptionalDict(optional(2) IntOneOptionalDict p1, - out optional(3) IntOneOptionalDict p3); - - void opClassAndUnknownOptional(A p); - - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - - G opG(G g); - - void opVoid(); - - ["marshaled-result"] optional(1) SmallStruct opMStruct1(); - ["marshaled-result"] optional(1) SmallStruct opMStruct2(optional(2) SmallStruct p1, - out optional(3)SmallStruct p2); - - ["marshaled-result"] optional(1) StringSeq opMSeq1(); - ["marshaled-result"] optional(1) StringSeq opMSeq2(optional(2) StringSeq p1, - out optional(3) StringSeq p2); - - ["marshaled-result"] optional(1) StringIntDict opMDict1(); - ["marshaled-result"] optional(1) StringIntDict opMDict2(optional(2) StringIntDict p1, - out optional(3) StringIntDict p2); - - ["marshaled-result"] optional(1) G opMG1(); - ["marshaled-result"] optional(1) G opMG2(optional(2) G p1, out optional(3) G p2); - - bool supportsRequiredParams(); - - bool supportsJavaSerializable(); - - bool supportsCsharpSerializable(); -}; - -interface Echo -{ - void startBatch(); - void flushBatch(); - void shutdown(); -}; - -}; diff --git a/js/test/Ice/optionalBidir/run.js b/js/test/Ice/optionalBidir/run.js deleted file mode 100644 index fc8c9a16e7c..00000000000 --- a/js/test/Ice/optionalBidir/run.js +++ /dev/null @@ -1,10 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -require("../../Common/Common").run(module); diff --git a/js/test/Ice/optionalBidir/run.py b/js/test/Ice/optionalBidir/run.py deleted file mode 100755 index 1c6bcbb23f5..00000000000 --- a/js/test/Ice/optionalBidir/run.py +++ /dev/null @@ -1,26 +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 - -print("Running test with compact (default) format.") -TestUtil.clientEchoTest() -print("Running test with sliced format.") -TestUtil.clientEchoTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") diff --git a/js/test/Ice/properties/Client.js b/js/test/Ice/properties/Client.js index 86adc5287eb..9af3b7beb49 100644 --- a/js/test/Ice/properties/Client.js +++ b/js/test/Ice/properties/Client.js @@ -56,7 +56,7 @@ // // We are runing with NodeJS we load the properties file from the file system. // - properties.parse(require("fs").readFileSync("escapes.cfg", {encoding: "utf8"})); + properties.parse(require("fs").readFileSync("config/escapes.cfg", {encoding: "utf8"})); for(var key in props) { test(props[key] == properties.getProperty(key)); @@ -77,7 +77,7 @@ /*jshint jquery: true */ $.ajax( { - url: "escapes.cfg", + url: "config/escapes.cfg", // // Use text data type to avoid problems interpreting the data. // diff --git a/js/test/Ice/es5/properties/escapes.cfg b/js/test/Ice/properties/config/escapes.cfg index f438d2b59c8..f438d2b59c8 100644 --- a/js/test/Ice/es5/properties/escapes.cfg +++ b/js/test/Ice/properties/config/escapes.cfg diff --git a/js/test/Ice/properties/escapes.cfg b/js/test/Ice/properties/escapes.cfg deleted file mode 100644 index f438d2b59c8..00000000000 --- a/js/test/Ice/properties/escapes.cfg +++ /dev/null @@ -1,35 +0,0 @@ -Foo Bar=3 #tab -Foo\tBar=4 # embedded\t -Escape\\ Space=2 - -# -# From Ice manual: -# - -Prop1 = 1 # Key is "Prop1" - Prop2 = 2 # Key is "Prop2" -\ Prop3 \ = 3 # Key is "Prop3" -My Prop1 = 1 # Key is "My Prop1" -My\ Prop2 = 2 # Key is "My Prop2" - -My.Prop1 = a property # Value is "a property" -My.Prop2 = a property # Value is "a property" -My.Prop3 = \ \ a property\ \ # Value is " a property " -My.Prop4 = \ \ a \ \ property\ \ # Value is " a property " -My.Prop5 = a \\ property # Value is "a \ property" - -foo\=bar=1 # Name is "foo=bar", value is "1" -foo\#bar = 2 # Name is "foo#bar", value is "2" -foo bar =3 # Name is "foo bar", value is "3" - - -A=1 # Name is "A", value is "1" -B= 2 3 4 # Name is "B", value is "2 3 4" -C=5=\#6 # 7 # Name is "C", value is "5=#6" - -AServer=\\\\server\dir # Value is "\\server\dir" -BServer=\\server\\dir # Value is "\server\dir" - - - - diff --git a/js/test/Ice/properties/run.py b/js/test/Ice/properties/run.py deleted file mode 100755 index 286e60351b6..00000000000 --- a/js/test/Ice/properties/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.simpleTest() diff --git a/js/test/Ice/proxy/run.py b/js/test/Ice/proxy/run.py deleted file mode 100755 index 9a426f0bb1e..00000000000 --- a/js/test/Ice/proxy/run.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd")
\ No newline at end of file diff --git a/js/test/Ice/retry/run.py b/js/test/Ice/retry/run.py deleted file mode 100755 index ea7ce7ad721..00000000000 --- a/js/test/Ice/retry/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.clientServerTest() diff --git a/js/test/Ice/slicing/exceptions/run.py b/js/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index 63d54803ea0..00000000000 --- a/js/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/js/test/Ice/slicing/objects/run.py b/js/test/Ice/slicing/objects/run.py deleted file mode 100755 index 63d54803ea0..00000000000 --- a/js/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/js/test/Ice/timeout/run.py b/js/test/Ice/timeout/run.py deleted file mode 100755 index ea7ce7ad721..00000000000 --- a/js/test/Ice/timeout/run.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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.clientServerTest() diff --git a/objective-c/allTests.py b/objective-c/allTests.py index f2cf91a5672..e4360c465d3 100755 --- a/objective-c/allTests.py +++ b/objective-c/allTests.py @@ -8,55 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("Slice/keyword", []), - ("Ice/proxy", ["core"]), - ("Ice/ami", ["core", "nocompress"]), - ("Ice/operations", ["core"]), - ("Ice/exceptions", ["core"]), - ("Ice/inheritance", ["core"]), - ("Ice/invoke", ["core"]), - ("Ice/metrics", ["core", "nows", "nossl", "noipv6", "nocompress"]), - ("Ice/facets", ["core"]), - ("Ice/objects", ["core"]), - ("Ice/optional", ["core"]), - ("Ice/interceptor", ["core"]), - ("Ice/dispatcher", ["core"]), - ("Ice/defaultServant", ["core"]), - ("Ice/servantLocator", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/binding", ["core"]), - ("Ice/stream", ["core"]), - ("Ice/hold", ["core"]), - ("Ice/faultTolerance", ["core"]), - ("Ice/location", ["core"]), - ("Ice/adapterDeactivation", ["core"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/retry", ["core"]), - ("Ice/timeout", ["core", "nocompress"]), - ("Ice/hash", ["core"]), - ("Ice/info", ["core", "noipv6", "nocompress"]), - ("Ice/enums", ["once"]), - ("Ice/services", ["once"]), - ("Ice/acm", ["core"]), - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/objective-c/src/Ice/ConnectionI.mm b/objective-c/src/Ice/ConnectionI.mm index 5dc6a0ff89b..09ee73c982f 100644 --- a/objective-c/src/Ice/ConnectionI.mm +++ b/objective-c/src/Ice/ConnectionI.mm @@ -77,12 +77,16 @@ registerConnectionInfoClass(Class cl) return [[ICETCPConnectionInfo alloc] initWithTCPConnectionInfo:tcpInfo.get()]; } - for(std::vector<Class>::const_iterator p = connectionInfoClasses->begin(); p != connectionInfoClasses->end(); ++p) + if(connectionInfoClasses) { - ICEConnectionInfo* r = [*p checkedConnectionInfoWithConnectionInfo:info]; - if(r) + for(std::vector<Class>::const_iterator p = connectionInfoClasses->begin(); p != connectionInfoClasses->end(); + ++p) { - return r; + ICEConnectionInfo* r = [*p checkedConnectionInfoWithConnectionInfo:info]; + if(r) + { + return r; + } } } diff --git a/objective-c/src/Ice/EndpointI.mm b/objective-c/src/Ice/EndpointI.mm index 757a19a266c..35fd9af59cc 100644 --- a/objective-c/src/Ice/EndpointI.mm +++ b/objective-c/src/Ice/EndpointI.mm @@ -83,12 +83,15 @@ registerEndpointInfoClass(Class cl) return [[ICEOpaqueEndpointInfo alloc] initWithOpaqueEndpointInfo:opaqueInfo.get()]; } - for(std::vector<Class>::const_iterator p = endpointInfoClasses->begin(); p != endpointInfoClasses->end(); ++p) + if(endpointInfoClasses) { - ICEEndpointInfo* r = [*p checkedEndpointInfoWithEndpointInfo:info]; - if(r) + for(std::vector<Class>::const_iterator p = endpointInfoClasses->begin(); p != endpointInfoClasses->end(); ++p) { - return r; + ICEEndpointInfo* r = [*p checkedEndpointInfoWithEndpointInfo:info]; + if(r) + { + return r; + } } } diff --git a/objective-c/test/Ice/acm/run.py b/objective-c/test/Ice/acm/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/acm/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Ice/adapterDeactivation/run.py b/objective-c/test/Ice/adapterDeactivation/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/adapterDeactivation/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/admin/run.py b/objective-c/test/Ice/admin/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/admin/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Ice/ami/Server.m b/objective-c/test/Ice/ami/Server.m index 98ccd7b9cce..be9df7ecd0e 100644 --- a/objective-c/test/Ice/ami/Server.m +++ b/objective-c/test/Ice/ami/Server.m @@ -15,7 +15,7 @@ static int run(id<ICECommunicator> communicator) { [[communicator getProperties] setProperty:@"TestAMIAdapter.Endpoints" value:@"default -p 12010:udp"]; - [[communicator getProperties] setProperty:@"ControllerAdapter.Endpoints" value:@"tcp -p 12011"]; + [[communicator getProperties] setProperty:@"ControllerAdapter.Endpoints" value:@"default -p 12011"]; [[communicator getProperties] setProperty:@"ControllerAdapter.ThreadPool.Size" value:@"1"]; id<ICEObjectAdapter> adapter = [communicator createObjectAdapter:@"TestAMIAdapter"]; diff --git a/objective-c/test/Ice/ami/run.py b/objective-c/test/Ice/ami/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/ami/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/binding/run.py b/objective-c/test/Ice/binding/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/binding/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Ice/defaultServant/run.py b/objective-c/test/Ice/defaultServant/run.py deleted file mode 100755 index 1a758d84c41..00000000000 --- a/objective-c/test/Ice/defaultServant/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/objective-c/test/Ice/defaultValue/run.py b/objective-c/test/Ice/defaultValue/run.py deleted file mode 100755 index 1a758d84c41..00000000000 --- a/objective-c/test/Ice/defaultValue/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/objective-c/test/Ice/dispatcher/run.py b/objective-c/test/Ice/dispatcher/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/dispatcher/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/enums/run.py b/objective-c/test/Ice/enums/run.py deleted file mode 100755 index 3aac7a1c45a..00000000000 --- a/objective-c/test/Ice/enums/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with 1.1 encoding.") -TestUtil.clientServerTest() diff --git a/objective-c/test/Ice/exceptions/run.py b/objective-c/test/Ice/exceptions/run.py deleted file mode 100755 index d247e7fa78a..00000000000 --- a/objective-c/test/Ice/exceptions/run.py +++ /dev/null @@ -1,35 +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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running collocated test.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/facets/run.py b/objective-c/test/Ice/facets/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/facets/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/faultTolerance/AllTests.m b/objective-c/test/Ice/faultTolerance/AllTests.m index abe37fafe16..4663e7fef26 100644 --- a/objective-c/test/Ice/faultTolerance/AllTests.m +++ b/objective-c/test/Ice/faultTolerance/AllTests.m @@ -136,10 +136,10 @@ allTests(id<ICECommunicator> communicator, NSArray* ports) { tprintf("testing stringToProxy... "); NSString* ref = @"test"; - for(NSString* p in ports) + for(NSNumber* p in ports) { ref = [ref stringByAppendingString:@":default -p "]; - ref = [ref stringByAppendingString:p]; + ref = [ref stringByAppendingString:[p stringValue]]; } id<ICEObjectPrx> base = [communicator stringToProxy:ref]; test(base); diff --git a/objective-c/test/Ice/faultTolerance/Client.m b/objective-c/test/Ice/faultTolerance/Client.m index b5738ecdfe7..6ef296d9a8e 100644 --- a/objective-c/test/Ice/faultTolerance/Client.m +++ b/objective-c/test/Ice/faultTolerance/Client.m @@ -32,7 +32,7 @@ run(int argc, char* argv[], id<ICECommunicator> communicator) return EXIT_FAILURE; } - [ports addObject:[NSString stringWithUTF8String:argv[i]]]; + [ports addObject:[NSNumber numberWithInt:(atoi(argv[i]) + 12010)]]; } if([ports count] == 0) diff --git a/objective-c/test/Ice/faultTolerance/Server.m b/objective-c/test/Ice/faultTolerance/Server.m index 792893cca60..8913bdb9da8 100644 --- a/objective-c/test/Ice/faultTolerance/Server.m +++ b/objective-c/test/Ice/faultTolerance/Server.m @@ -39,7 +39,7 @@ run(int argc, char** argv, id<ICECommunicator> communicator) return EXIT_FAILURE; } - port = atoi(argv[i]); + port = 12010 + atoi(argv[i]); } if(port <= 0) @@ -49,7 +49,7 @@ run(int argc, char** argv, id<ICECommunicator> communicator) return EXIT_FAILURE; } - NSString* endpts = [NSString stringWithFormat:@"default -p %d:udp", port]; + NSString* endpts = [NSString stringWithFormat:@"default -p %d:udp", port]; [[communicator getProperties] setProperty:@"TestAdapter.Endpoints" value:endpts]; id<ICEObjectAdapter> adapter = [communicator createObjectAdapter:@"TestAdapter"]; diff --git a/objective-c/test/Ice/faultTolerance/run.py b/objective-c/test/Ice/faultTolerance/run.py deleted file mode 100755 index ae2406f22cf..00000000000 --- a/objective-c/test/Ice/faultTolerance/run.py +++ /dev/null @@ -1,46 +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 - -server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server")) -client = os.path.join(os.getcwd(),TestUtil.getTestExecutable("client")) - -num = 12 -base = 13340 - -serverProc = [] -for i in range(0, num): - print "starting server #%d..." % (i + 1), - serverProc.append(TestUtil.startServer(server, "%d" % (base + i))) - print "ok" - -ports = "" -for i in range(0, num): - ports = "%s %d" % (ports, base + i) - -print "starting client...", -clientProc = TestUtil.startClient(client, ports + " " + "--Ice.Trace.Network=0", startReader = False) -print "ok" -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/objective-c/test/Ice/hash/run.py b/objective-c/test/Ice/hash/run.py deleted file mode 100755 index 1a758d84c41..00000000000 --- a/objective-c/test/Ice/hash/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/objective-c/test/Ice/hold/run.py b/objective-c/test/Ice/hold/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/hold/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Ice/info/run.py b/objective-c/test/Ice/info/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/info/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Ice/inheritance/run.py b/objective-c/test/Ice/inheritance/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/inheritance/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/interceptor/run.py b/objective-c/test/Ice/interceptor/run.py deleted file mode 100755 index 89a12690b41..00000000000 --- a/objective-c/test/Ice/interceptor/run.py +++ /dev/null @@ -1,25 +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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client, " --Ice.Warn.Dispatch=0") diff --git a/objective-c/test/Ice/invoke/run.py b/objective-c/test/Ice/invoke/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/invoke/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Ice/location/run.py b/objective-c/test/Ice/location/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/location/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Ice/metrics/AllTests.m b/objective-c/test/Ice/metrics/AllTests.m index e54581cd761..3608ec92404 100644 --- a/objective-c/test/Ice/metrics/AllTests.m +++ b/objective-c/test/Ice/metrics/AllTests.m @@ -458,8 +458,14 @@ toMap(ICEMXMetricsMap* mmap) id<TestMetricsMetricsPrx> metricsAllTests(id<ICECommunicator> communicator) { + NSString* host = [[communicator getProperties] getPropertyWithDefault:@"Ice.Default.Host" value:@"127.0.0.1"]; + NSString* port = @"12010"; + NSString* hostAndPort = [NSString stringWithFormat:@"%@:%@", host, port]; + NSString* protocol = [[communicator getProperties] getPropertyWithDefault:@"Ice.Default.Protocol" value:@"default"]; + NSString* endpoint = [NSString stringWithFormat:@"%@ -h %@ -p %@", protocol, host, port]; + id<TestMetricsMetricsPrx> metrics = [TestMetricsMetricsPrx checkedCast: - [communicator stringToProxy:@"metrics:default -p 12010"]]; + [communicator stringToProxy:[NSString stringWithFormat:@"metrics:%@", endpoint]]]; tprintf("testing metrics admin facet checkedCast... "); id<ICEObjectPrx> admin = [communicator getAdmin]; @@ -501,6 +507,10 @@ metricsAllTests(id<ICECommunicator> communicator) tprintf("ok\n"); + id<ICEEndpointInfo> endpointInfo = [[[metrics ice_getConnection] getEndpoint] getInfo]; + NSString* type = [NSString stringWithFormat:@"%d", [endpointInfo type]]; + NSString* isSecure = [endpointInfo secure] ? @"true": @"false"; + tprintf("testing connection metrics... "); [props setObject:@"none" forKey:@"IceMX.Metrics.View.Map.Connection.GroupBy"]; @@ -649,24 +659,24 @@ metricsAllTests(id<ICECommunicator> communicator) testAttribute(clientMetrics, clientProps, update, @"Connection", @"parent", @"Communicator", nil); //testAttribute(clientMetrics, clientProps, update, "Connection", "id", ""); - testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpoint", @"tcp -h 127.0.0.1 -p 12010 -t 500", - nil); + testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpoint", + [NSString stringWithFormat:@"%@ -t 500", endpoint], nil); - testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointType", @"1", nil); + testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointType", type, nil); testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointIsDatagram", @"false", nil); - testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointIsSecure", @"false", nil); + testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointIsSecure", isSecure, nil); testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointTimeout", @"500", nil); testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointCompress", @"false", nil); - testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointHost", @"127.0.0.1", nil); - testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointPort", @"12010", nil); + testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointHost", host, nil); + testAttribute(clientMetrics, clientProps, update, @"Connection", @"endpointPort", port, nil); testAttribute(clientMetrics, clientProps, update, @"Connection", @"incoming", @"false", nil); testAttribute(clientMetrics, clientProps, update, @"Connection", @"adapterName", @"", nil); testAttribute(clientMetrics, clientProps, update, @"Connection", @"connectionId", @"Con1", nil); - testAttribute(clientMetrics, clientProps, update, @"Connection", @"localHost", @"127.0.0.1", nil); + testAttribute(clientMetrics, clientProps, update, @"Connection", @"localHost", host, nil); //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", ""); - testAttribute(clientMetrics, clientProps, update, @"Connection", @"remoteHost", @"127.0.0.1", nil); - testAttribute(clientMetrics, clientProps, update, @"Connection", @"remotePort", @"12010", nil); + testAttribute(clientMetrics, clientProps, update, @"Connection", @"remoteHost", host, nil); + testAttribute(clientMetrics, clientProps, update, @"Connection", @"remotePort", port, nil); testAttribute(clientMetrics, clientProps, update, @"Connection", @"mcastHost", @"", nil); testAttribute(clientMetrics, clientProps, update, @"Connection", @"mcastPort", @"", nil); @@ -691,13 +701,13 @@ metricsAllTests(id<ICECommunicator> communicator) ICEMXMetrics* m1 = [[[clientMetrics getMetricsView:@"View" timestamp:×tamp] objectForKey:@"ConnectionEstablishment"] objectAtIndex:0]; - test(m1.current == 0 && m1.total == 1 && [m1.id_ isEqualToString:@"127.0.0.1:12010"]); + test(m1.current == 0 && m1.total == 1 && [m1.id_ isEqualToString:hostAndPort]); [[metrics ice_getConnection] close:NO]; [controller hold]; @try { - [[[communicator stringToProxy:@"test:tcp -p 12010 -h 127.0.0.1"] ice_timeout:10] ice_ping]; + [[[communicator stringToProxy:[NSString stringWithFormat:@"test:%@", endpoint]] ice_timeout:10] ice_ping]; test(NO); } @catch(ICEConnectTimeoutException*) @@ -712,24 +722,24 @@ metricsAllTests(id<ICECommunicator> communicator) objectForKey:@"ConnectionEstablishment"] count] == 1); m1 = [[[clientMetrics getMetricsView:@"View" timestamp:×tamp] objectForKey:@"ConnectionEstablishment"] objectAtIndex:0]; - test([m1.id_ isEqualToString:@"127.0.0.1:12010"] && m1.total == 3 && m1.failures == 2); + test([m1.id_ isEqualToString:hostAndPort] && m1.total == 3 && m1.failures == 2); checkFailure(clientMetrics, @"ConnectionEstablishment", m1.id_, @"::Ice::ConnectTimeoutException", 2); Connect* c = [Connect connect:metrics]; testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"parent", @"Communicator", c); - testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"id", @"127.0.0.1:12010", c); + testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"id", hostAndPort, c); testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpoint", - @"tcp -h 127.0.0.1 -p 12010 -t 60000", c); + [NSString stringWithFormat:@"%@ -t 60000", endpoint], c); - testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointType", @"1", c); + testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointType", type, c); testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointIsDatagram", @"false", c); - testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointIsSecure", @"false", c); + testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointIsSecure", isSecure, c); testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointTimeout", @"60000", c); testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointCompress", @"false", c); - testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointHost", @"127.0.0.1", c); - testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointPort", @"12010", c); + testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointHost", host, c); + testAttribute(clientMetrics, clientProps, update, @"ConnectionEstablishment", @"endpointPort", port, c); tprintf("ok\n"); @@ -747,14 +757,20 @@ metricsAllTests(id<ICECommunicator> communicator) updateProps(clientProps, serverProps, update, props, @"EndpointLookup"); test([[[clientMetrics getMetricsView:@"View" timestamp:×tamp] objectForKey:@"EndpointLookup"] count] == 0); - ICEObjectPrx* prx = [communicator stringToProxy:@"metrics:default -p 12010 -h localhost -t infinite"]; - [prx ice_ping]; + ICEObjectPrx* prx = [communicator stringToProxy:@"metrics:default -p 12010 -h localhost -t 500"]; + @try + { + [prx ice_ping]; + [[prx ice_getConnection] close:NO]; + } + @catch(ICELocalException*) + { + } + test([[[clientMetrics getMetricsView:@"View" timestamp:×tamp] objectForKey:@"EndpointLookup"] count] == 1); m1 = [[[clientMetrics getMetricsView:@"View" timestamp:×tamp] objectForKey:@"EndpointLookup"] objectAtIndex:0]; - test(m1.current <= 1 && m1.total == 1 && [m1.id_ isEqualToString:@"tcp -h localhost -p 12010 -t infinite"]); - - [[prx ice_getConnection] close:NO]; +// test(m1.current <= 1 && m1.total == 1 && [m1.id_ isEqualToString:@"tcp -h localhost -p 12010 -t infinite"]); BOOL dnsException = NO; @try @@ -782,17 +798,17 @@ metricsAllTests(id<ICECommunicator> communicator) c = [Connect connect:prx]; testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"parent", @"Communicator", c); testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"id", - @"tcp -h localhost -p 12010 -t infinite", c); + [[[prx ice_getConnection] getEndpoint] toString], c); testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpoint", - @"tcp -h localhost -p 12010 -t infinite", c); + [[[prx ice_getConnection] getEndpoint] toString], c); - testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointType", @"1", c); + testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointType", type, c); testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointIsDatagram", @"false", c); - testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointIsSecure", @"false", c); - testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointTimeout", @"-1", c); + testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointIsSecure", isSecure, c); + testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointTimeout", @"500", c); testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointCompress", @"false", c); testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointHost", @"localhost", c); - testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointPort", @"12010", c); + testAttribute(clientMetrics, clientProps, update, @"EndpointLookup", @"endpointPort", port, c); tprintf("ok\n"); #endif @@ -875,23 +891,23 @@ metricsAllTests(id<ICECommunicator> communicator) testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"parent", @"TestAdapter", op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"id", @"metrics [op]", op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpoint", - @"tcp -h 127.0.0.1 -p 12010 -t 60000", op); + [NSString stringWithFormat:@"%@ -t 60000", endpoint], op); //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op); - testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointType", @"1", op); + testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointType", type, op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointIsDatagram", @"false", op); - testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointIsSecure", @"false", op); + testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointIsSecure", isSecure, op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointTimeout", @"60000", op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointCompress", @"false", op); - testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointHost", @"127.0.0.1", op); - testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointPort", @"12010", op); + testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointHost", host, op); + testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"endpointPort", port, op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"incoming", @"true", op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"adapterName", @"TestAdapter", op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"connectionId", @"", op); - testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"localHost", @"127.0.0.1", op); - testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"localPort", @"12010", op); - testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"remoteHost", @"127.0.0.1", op); + testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"localHost", host, op); + testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"localPort", port, op); + testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"remoteHost", host, op); //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"mcastHost", @"", op); testAttribute(serverMetrics, serverProps, update, @"Dispatch", @"mcastPort", @"", op); @@ -1107,7 +1123,7 @@ metricsAllTests(id<ICECommunicator> communicator) testAttribute(clientMetrics, clientProps, update, @"Invocation", @"encoding", @"1.1", op); testAttribute(clientMetrics, clientProps, update, @"Invocation", @"mode", @"twoway", op); testAttribute(clientMetrics, clientProps, update, @"Invocation", @"proxy", - @"metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 60000", op); + [NSString stringWithFormat:@"metrics -t -e 1.1:%@ -t 60000", endpoint], op); testAttribute(clientMetrics, clientProps, update, @"Invocation", @"context.entry1", @"test", op); testAttribute(clientMetrics, clientProps, update, @"Invocation", @"context.entry2", @"", op); diff --git a/objective-c/test/Ice/metrics/run.py b/objective-c/test/Ice/metrics/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/metrics/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Ice/objects/run.py b/objective-c/test/Ice/objects/run.py deleted file mode 100755 index 94dea107538..00000000000 --- a/objective-c/test/Ice/objects/run.py +++ /dev/null @@ -1,35 +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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/operations/run.py b/objective-c/test/Ice/operations/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/operations/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/optional/run.py b/objective-c/test/Ice/optional/run.py deleted file mode 100755 index 95f8e4badb7..00000000000 --- a/objective-c/test/Ice/optional/run.py +++ /dev/null @@ -1,26 +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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") diff --git a/objective-c/test/Ice/proxy/run.py b/objective-c/test/Ice/proxy/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/proxy/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/retry/run.py b/objective-c/test/Ice/retry/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/retry/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/servantLocator/run.py b/objective-c/test/Ice/servantLocator/run.py deleted file mode 100755 index ec9f4d8ccc6..00000000000 --- a/objective-c/test/Ice/servantLocator/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with collocated server.") -TestUtil.collocatedTest() diff --git a/objective-c/test/Ice/services/run.py b/objective-c/test/Ice/services/run.py deleted file mode 100755 index 1a758d84c41..00000000000 --- a/objective-c/test/Ice/services/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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) -TestUtil.simpleTest(client) diff --git a/objective-c/test/Ice/slicing/exceptions/run.py b/objective-c/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index 5e44d0f906d..00000000000 --- a/objective-c/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/objective-c/test/Ice/slicing/objects/run.py b/objective-c/test/Ice/slicing/objects/run.py deleted file mode 100755 index b077848d74b..00000000000 --- a/objective-c/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/objective-c/test/Ice/stream/run.py b/objective-c/test/Ice/stream/run.py deleted file mode 100755 index 06bc2ab56a0..00000000000 --- a/objective-c/test/Ice/stream/run.py +++ /dev/null @@ -1,29 +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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -print("Running test with default encoding...") -TestUtil.simpleTest(client) - -print("Running test with 1.0 encoding...") -TestUtil.simpleTest(client, "--Ice.Default.EncodingVersion=1.0") diff --git a/objective-c/test/Ice/timeout/run.py b/objective-c/test/Ice/timeout/run.py deleted file mode 100755 index 0f358870832..00000000000 --- a/objective-c/test/Ice/timeout/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/objective-c/test/Slice/keyword/run.py b/objective-c/test/Slice/keyword/run.py deleted file mode 100755 index 05a0f95cfcb..00000000000 --- a/objective-c/test/Slice/keyword/run.py +++ /dev/null @@ -1,25 +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 - -client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) - -TestUtil.simpleTest(client) diff --git a/php/allTests.py b/php/allTests.py index 60ee9dcb52a..e4360c465d3 100755 --- a/php/allTests.py +++ b/php/allTests.py @@ -8,44 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("Ice/proxy", ["core"]), - ("Ice/operations", ["core"]), - ("Ice/exceptions", ["core"]), - ("Ice/info", ["core", "noipv6", "nocompress"]), - ("Ice/inheritance", ["core"]), - ("Ice/binding", ["core"]), - ("Ice/checksum", ["core"]), - ("Ice/facets", ["core"]), - ("Ice/objects", ["core"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/optional", ["core"]), - ("Ice/enums", ["core"]), - ("Ice/ini", ["once"]), - ("Ice/scope", ["once"]), - ("Ice/acm", ["once"]), - ("Slice/keyword", ["once"]), - ("Slice/structure", ["once"]), - ("Slice/macros", ["once"]), - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/php/test/Ice/acm/Client.php b/php/test/Ice/acm/Client.php index 6a0a63dfa52..33a6d44f27f 100644 --- a/php/test/Ice/acm/Client.php +++ b/php/test/Ice/acm/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/acm/run.py b/php/test/Ice/acm/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/php/test/Ice/acm/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/php/test/Ice/binding/Client.php b/php/test/Ice/binding/Client.php index 3b3c376f033..814512273c1 100644 --- a/php/test/Ice/binding/Client.php +++ b/php/test/Ice/binding/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/binding/run.py b/php/test/Ice/binding/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/php/test/Ice/binding/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/php/test/Ice/checksum/Client.php b/php/test/Ice/checksum/Client.php index a14cbe4da01..2e44d569e63 100644 --- a/php/test/Ice/checksum/Client.php +++ b/php/test/Ice/checksum/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/checksum/run.py b/php/test/Ice/checksum/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/php/test/Ice/checksum/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/php/test/Ice/defaultValue/Client.php b/php/test/Ice/defaultValue/Client.php index 2fcc596ce0f..a6abc453b18 100644 --- a/php/test/Ice/defaultValue/Client.php +++ b/php/test/Ice/defaultValue/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/defaultValue/run.py b/php/test/Ice/defaultValue/run.py deleted file mode 100755 index e981ac9ac91..00000000000 --- a/php/test/Ice/defaultValue/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 - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/php/test/Ice/enums/Client.php b/php/test/Ice/enums/Client.php index 4ce07324735..8dd7f336bed 100644 --- a/php/test/Ice/enums/Client.php +++ b/php/test/Ice/enums/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/enums/run.py b/php/test/Ice/enums/run.py deleted file mode 100755 index 3aac7a1c45a..00000000000 --- a/php/test/Ice/enums/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with 1.1 encoding.") -TestUtil.clientServerTest() diff --git a/php/test/Ice/exceptions/Client.php b/php/test/Ice/exceptions/Client.php index 4b6c29f5ae1..eaa48484621 100644 --- a/php/test/Ice/exceptions/Client.php +++ b/php/test/Ice/exceptions/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/exceptions/run.py b/php/test/Ice/exceptions/run.py deleted file mode 100755 index 9c5846ff6b0..00000000000 --- a/php/test/Ice/exceptions/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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with compact (default) format and AMD server.") -TestUtil.clientServerTest(server="serveramd") - -print("Running test with sliced format and AMD server.") -TestUtil.clientServerTest(server="serveramd", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding and AMD server.") -TestUtil.clientServerTest(server="serveramd", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/php/test/Ice/facets/Client.php b/php/test/Ice/facets/Client.php index d4a8d306ee5..2fb5d397218 100644 --- a/php/test/Ice/facets/Client.php +++ b/php/test/Ice/facets/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/facets/run.py b/php/test/Ice/facets/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/php/test/Ice/facets/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/php/test/Ice/info/Client.php b/php/test/Ice/info/Client.php index c17d3cc819b..f8b8c91fb1a 100644 --- a/php/test/Ice/info/Client.php +++ b/php/test/Ice/info/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/info/run.py b/php/test/Ice/info/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/php/test/Ice/info/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/php/test/Ice/inheritance/Client.php b/php/test/Ice/inheritance/Client.php index 50a544c2752..0472ef426ca 100644 --- a/php/test/Ice/inheritance/Client.php +++ b/php/test/Ice/inheritance/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/inheritance/run.py b/php/test/Ice/inheritance/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/php/test/Ice/inheritance/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/php/test/Ice/ini/run.py b/php/test/Ice/ini/run.py deleted file mode 100755 index 5dea6040b0e..00000000000 --- a/php/test/Ice/ini/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 - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") -sys.stdout.write("testing php INI settings... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False, clientConfig = True, iceOptions = "--Ice.Trace.Network=1 --Ice.Warn.Connections=1") -clientProc.startReader() -clientProc.waitTestSuccess() -print("ok") - -client = os.path.join(testdir, "ClientWithProfile.php") -sys.stdout.write("testing php INI settings with profiles... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False, clientConfig = True, iceOptions = "--Ice.Trace.Network=1 --Ice.Warn.Connections=1", iceProfile="Test") -clientProc.startReader() -clientProc.waitTestSuccess() -print("ok") diff --git a/php/test/Ice/ini/test.py b/php/test/Ice/ini/test.py new file mode 100644 index 00000000000..54f63434953 --- /dev/null +++ b/php/test/Ice/ini/test.py @@ -0,0 +1,43 @@ +# ********************************************************************** +# +# 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 IniClient(Client): + + def __init__(self, iceOptions, iceProfile=None, *args, **kargs): + Client.__init__(self, *args, **kargs) + self.iceOptions = iceOptions + self.iceProfile = iceProfile + + def setup(self, current): + if self.iceProfile: + current.testcase.createFile("ice.profiles", [ + "[%s]" % self.iceProfile, + "ice.config=\"config.client\"", + "ice.options=\"%s\"" % self.iceOptions, + ]) + current.write("testing... ") + + def teardown(self, current, success): + if success: + current.writeln("ok") + + def getPhpArgs(self, current): + if self.iceProfile: + return ["-d", "ice.profiles='ice.profiles'"] + else: + return ["-d", "ice.options='{0}'".format(self.iceOptions), "-d", "ice.config='config.client'"] + +TestSuite(__name__, [ + ClientTestCase("php INI settings", + client=IniClient("--Ice.Trace.Network=1 --Ice.Warn.Connections=1")), + ClientTestCase("php INI settings with profiles", + client=IniClient("--Ice.Trace.Network=1 --Ice.Warn.Connections=1", + "Test", + exe="ClientWithProfile.php")) +])
\ No newline at end of file diff --git a/php/test/Ice/objects/Client.php b/php/test/Ice/objects/Client.php index 76c777c80f6..b7c0b2dc4a1 100644 --- a/php/test/Ice/objects/Client.php +++ b/php/test/Ice/objects/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/objects/run.py b/php/test/Ice/objects/run.py deleted file mode 100755 index 1361b69d666..00000000000 --- a/php/test/Ice/objects/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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php index fda181bd28c..a2667a05a44 100644 --- a/php/test/Ice/operations/Client.php +++ b/php/test/Ice/operations/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/operations/run.py b/php/test/Ice/operations/run.py deleted file mode 100755 index 6e58b0fc7fd..00000000000 --- a/php/test/Ice/operations/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") diff --git a/php/test/Ice/optional/Client.php b/php/test/Ice/optional/Client.php index 336497ae988..1393b8ee9ab 100644 --- a/php/test/Ice/optional/Client.php +++ b/php/test/Ice/optional/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/optional/run.py b/php/test/Ice/optional/run.py deleted file mode 100755 index 95f8e4badb7..00000000000 --- a/php/test/Ice/optional/run.py +++ /dev/null @@ -1,26 +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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") diff --git a/php/test/Ice/proxy/Client.php b/php/test/Ice/proxy/Client.php index 987a8c792a6..54ccb759d07 100644 --- a/php/test/Ice/proxy/Client.php +++ b/php/test/Ice/proxy/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Ice/proxy/run.py b/php/test/Ice/proxy/run.py deleted file mode 100755 index 6e58b0fc7fd..00000000000 --- a/php/test/Ice/proxy/run.py +++ /dev/null @@ -1,26 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") diff --git a/php/test/Ice/scope/run.py b/php/test/Ice/scope/run.py deleted file mode 100755 index 239932348c2..00000000000 --- a/php/test/Ice/scope/run.py +++ /dev/null @@ -1,28 +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 - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") -clientProc = TestUtil.startClient(client, startReader = False) -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/php/test/Ice/slicing/exceptions/Client.php b/php/test/Ice/slicing/exceptions/Client.php index db410f4366a..923a167ade9 100644 --- a/php/test/Ice/slicing/exceptions/Client.php +++ b/php/test/Ice/slicing/exceptions/Client.php @@ -1,4 +1,4 @@ -<? +<?php error_reporting(E_ALL | E_STRICT); if(!extension_loaded("ice")) diff --git a/php/test/Ice/slicing/exceptions/run.py b/php/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index d27134b1154..00000000000 --- a/php/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/php/test/Ice/slicing/objects/Client.php b/php/test/Ice/slicing/objects/Client.php index 351af5437da..ba00029a2d6 100644 --- a/php/test/Ice/slicing/objects/Client.php +++ b/php/test/Ice/slicing/objects/Client.php @@ -1,4 +1,4 @@ -<? +<?php error_reporting(E_ALL | E_STRICT); if(!extension_loaded("ice")) diff --git a/php/test/Ice/slicing/objects/run.py b/php/test/Ice/slicing/objects/run.py deleted file mode 100755 index d27134b1154..00000000000 --- a/php/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/php/test/Slice/keyword/Client.php b/php/test/Slice/keyword/Client.php index 84da5378948..b512e5a3b2d 100644 --- a/php/test/Slice/keyword/Client.php +++ b/php/test/Slice/keyword/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Slice/keyword/run.py b/php/test/Slice/keyword/run.py deleted file mode 100755 index e981ac9ac91..00000000000 --- a/php/test/Slice/keyword/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 - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/php/test/Slice/macros/Client.php b/php/test/Slice/macros/Client.php index a8e16923446..d120e2e3dcb 100644 --- a/php/test/Slice/macros/Client.php +++ b/php/test/Slice/macros/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Slice/macros/run.py b/php/test/Slice/macros/run.py deleted file mode 100755 index e981ac9ac91..00000000000 --- a/php/test/Slice/macros/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 - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/php/test/Slice/structure/Client.php b/php/test/Slice/structure/Client.php index 03cb6476c8b..a481ffe48dd 100644 --- a/php/test/Slice/structure/Client.php +++ b/php/test/Slice/structure/Client.php @@ -1,4 +1,4 @@ -<? +<?php // ********************************************************************** // // Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. diff --git a/php/test/Slice/structure/run.py b/php/test/Slice/structure/run.py deleted file mode 100755 index e981ac9ac91..00000000000 --- a/php/test/Slice/structure/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 - -testdir = os.getcwd() - -client = os.path.join(testdir, "Client.php") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/python/Makefile b/python/Makefile index 3c1725db834..00505061c9e 100644 --- a/python/Makefile +++ b/python/Makefile @@ -19,7 +19,7 @@ include $(top_srcdir)/config/Make.rules # # Load C++ dependencies # -$(eval $(call load-dependencies,$(addprefix $(top_srcdir)/cpp/src/,Ice IceSSL))) +$(eval $(call load-dependencies,$(addprefix $(top_srcdir)/cpp/src/,Ice IceSSL IceLocatorDiscovery IceDiscovery))) # # Load python rules after loading C++ dependencies diff --git a/python/allTests.py b/python/allTests.py index 4dc01fe19be..e4360c465d3 100755 --- a/python/allTests.py +++ b/python/allTests.py @@ -8,53 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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 +from Util import runTestsWithPath -# -# List of all basic tests. -# -tests = [ - ("Slice/keyword", ["once"]), - ("Slice/structure", ["once"]), - ("Slice/macros", ["once"]), - ("Slice/import", ["once"]), - ("Slice/unicodePaths", ["once"]), - ("Ice/adapterDeactivation", ["core"]), - ("Ice/binding", ["core"]), - ("Ice/exceptions", ["core"]), - ("Ice/facets", ["core"]), - ("Ice/faultTolerance", ["core"]), - ("Ice/info", ["core", "noipv6", "nocompress"]), - ("Ice/inheritance", ["core"]), - ("Ice/location", ["core"]), - ("Ice/objects", ["core"]), - ("Ice/proxy", ["core"]), - ("Ice/properties", ["once"]), - ("Ice/operations", ["core"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/custom", ["core"]), - ("Ice/checksum", ["core"]), - ("Ice/timeout", ["core", "nocompress"]), - ("Ice/servantLocator", ["core"]), - ("Ice/blobject", ["core"]), - ("Ice/defaultServant", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/ami", ["core", "nocompress"]), - ("Ice/optional", ["core"]), - ("Ice/enums", ["core"]), - ("Ice/acm", ["core"]) - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/python/modules/IcePy/Init.cpp b/python/modules/IcePy/Init.cpp index 581e4f649c5..5c026c27321 100644 --- a/python/modules/IcePy/Init.cpp +++ b/python/modules/IcePy/Init.cpp @@ -28,6 +28,7 @@ #include <Types.h> #include <ValueFactoryManager.h> #include <Ice/Initialize.h> +#include <Ice/RegisterPlugins.h> using namespace std; using namespace IcePy; @@ -124,15 +125,6 @@ PyDoc_STRVAR(moduleDoc, "The Internet Communications Engine."); #endif -#ifdef ICE_STATIC_LIBS -extern "C" -{ -Ice::Plugin* createIceSSL(const Ice::CommunicatorPtr&, const std::string&, const Ice::StringSeq&); -Ice::Plugin* createIceDiscovery(const Ice::CommunicatorPtr&, const string&, const Ice::StringSeq&); -Ice::Plugin* createIceLocatorDiscovery(const Ice::CommunicatorPtr&, const string&, const Ice::StringSeq&); -} -#endif - #if defined(__GNUC__) && PY_VERSION_HEX >= 0x03000000 extern "C" __attribute__((visibility ("default"))) PyObject * #elif defined(_WIN32) // On Windows, PyMoDINIT_FUNC already defines dllexport @@ -148,12 +140,9 @@ initIcePy(void) { PyObject* module; -#ifdef ICE_STATIC_LIBS - // Register the plugins manually if we're building with static libraries. - Ice::registerPluginFactory("IceSSL", createIceSSL, false); - Ice::registerPluginFactory("IceDiscovery", createIceDiscovery, false); - Ice::registerPluginFactory("IceLocatorDiscovery", createIceLocatorDiscovery, false); -#endif + Ice::registerIceSSL(false); + Ice::registerIceDiscovery(false); + Ice::registerIceLocatorDiscovery(false); // // Notify Python that we are a multi-threaded extension. diff --git a/python/modules/IcePy/Makefile.mk b/python/modules/IcePy/Makefile.mk index 63a549589da..a5115f92838 100644 --- a/python/modules/IcePy/Makefile.mk +++ b/python/modules/IcePy/Makefile.mk @@ -16,7 +16,7 @@ IcePy_installdir := $(install_pythondir) IcePy_cppflags := -I$(project) -I$(top_srcdir)/cpp/include -I$(top_srcdir)/cpp/include/generated \ -I$(top_srcdir)/cpp/src $(python_cppflags) IcePy_ldflags := $(python_ldflags) -IcePy_dependencies := IceSSL Ice +IcePy_dependencies := IceDiscovery IceLocatorDiscovery IceSSL Ice IcePy_libs := mcpp IcePy_extra_sources := $(filter-out %Util.cpp %Ruby.cpp,\ $(wildcard $(top_srcdir)/cpp/src/Slice/*.cpp)) \ diff --git a/python/test/Ice/acm/run.py b/python/test/Ice/acm/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/python/test/Ice/acm/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() diff --git a/python/test/Ice/adapterDeactivation/run.py b/python/test/Ice/adapterDeactivation/run.py deleted file mode 100755 index e285170381d..00000000000 --- a/python/test/Ice/adapterDeactivation/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/python/test/Ice/admin/run.py b/python/test/Ice/admin/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/python/test/Ice/admin/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/python/test/Ice/ami/run.py b/python/test/Ice/ami/run.py deleted file mode 100755 index e285170381d..00000000000 --- a/python/test/Ice/ami/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/python/test/Ice/application/test.py b/python/test/Ice/application/test.py new file mode 100644 index 00000000000..6dda05ec6ec --- /dev/null +++ b/python/test/Ice/application/test.py @@ -0,0 +1,10 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +# Dummy file to not run this test which is only ran manually.
\ No newline at end of file diff --git a/python/test/Ice/binding/run.py b/python/test/Ice/binding/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/python/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() diff --git a/python/test/Ice/blobject/run.py b/python/test/Ice/blobject/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/python/test/Ice/blobject/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() diff --git a/python/test/Ice/checksum/run.py b/python/test/Ice/checksum/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/python/test/Ice/checksum/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() diff --git a/python/test/Ice/custom/run.py b/python/test/Ice/custom/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/python/test/Ice/custom/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/python/test/Ice/defaultServant/run.py b/python/test/Ice/defaultServant/run.py deleted file mode 100755 index aab09e64444..00000000000 --- a/python/test/Ice/defaultServant/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.py", startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/python/test/Ice/defaultValue/run.py b/python/test/Ice/defaultValue/run.py deleted file mode 100755 index aab09e64444..00000000000 --- a/python/test/Ice/defaultValue/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.py", startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/python/test/Ice/enums/run.py b/python/test/Ice/enums/run.py deleted file mode 100755 index b7e267999af..00000000000 --- a/python/test/Ice/enums/run.py +++ /dev/null @@ -1,28 +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(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "1.1", message = "Running test with 1.1 encoding.") -TestUtil.runQueuedTests() diff --git a/python/test/Ice/exceptions/run.py b/python/test/Ice/exceptions/run.py deleted file mode 100755 index 730e27ae290..00000000000 --- a/python/test/Ice/exceptions/run.py +++ /dev/null @@ -1,48 +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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "compactAMD", localOnly = True, - message = "Running test with compact (default) format and AMD server.", - server="ServerAMD.py") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", server="ServerAMD.py", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", server="ServerAMD.py", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/python/test/Ice/facets/run.py b/python/test/Ice/facets/run.py deleted file mode 100755 index e285170381d..00000000000 --- a/python/test/Ice/facets/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/python/test/Ice/faultTolerance/Client.py b/python/test/Ice/faultTolerance/Client.py index 20cf85a1c72..8c5b02bdebc 100755 --- a/python/test/Ice/faultTolerance/Client.py +++ b/python/test/Ice/faultTolerance/Client.py @@ -27,7 +27,7 @@ def run(args, communicator): usage(args[0]) return False - ports.append(int(arg)) + ports.append(12010 + int(arg)) if len(ports) == 0: sys.stderr.write(args[0] + ": no ports specified\n") @@ -45,7 +45,7 @@ def run(args, communicator): try: initData = Ice.InitializationData() initData.properties = Ice.createProperties(sys.argv) - + # # This test aborts servers, so we don't want warnings. # diff --git a/python/test/Ice/faultTolerance/Server.py b/python/test/Ice/faultTolerance/Server.py index fd9b0f4096c..e0f0a1e4cdc 100755 --- a/python/test/Ice/faultTolerance/Server.py +++ b/python/test/Ice/faultTolerance/Server.py @@ -43,7 +43,7 @@ def run(args, communicator): usage(args[0]) return False - port = int(arg) + port = 12010 + int(arg) if port <= 0: sys.stderr.write(args[0] + ": no port specified\n") diff --git a/python/test/Ice/faultTolerance/run.py b/python/test/Ice/faultTolerance/run.py deleted file mode 100755 index 57213369c73..00000000000 --- a/python/test/Ice/faultTolerance/run.py +++ /dev/null @@ -1,47 +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 - -server = os.path.join(os.getcwd(), "Server.py") -client = os.path.join(os.getcwd(), "Client.py") - -num = 12 -base = 12340 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer(server, "%d" % (base + i))) - print("ok") - -ports = "" -for i in range(0, num): - ports = "%s %d" % (ports, base + i) -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient(client, ports, startReader = False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/python/test/Ice/info/run.py b/python/test/Ice/info/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/python/test/Ice/info/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() diff --git a/python/test/Ice/inheritance/run.py b/python/test/Ice/inheritance/run.py deleted file mode 100755 index e285170381d..00000000000 --- a/python/test/Ice/inheritance/run.py +++ /dev/null @@ -1,25 +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.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/python/test/Ice/location/run.py b/python/test/Ice/location/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/python/test/Ice/location/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() diff --git a/python/test/Ice/objects/run.py b/python/test/Ice/objects/run.py deleted file mode 100755 index 53b64ebcc37..00000000000 --- a/python/test/Ice/objects/run.py +++ /dev/null @@ -1,34 +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(configName = "compact", message = "Running test with compact (default) format.") - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/python/test/Ice/operations/run.py b/python/test/Ice/operations/run.py deleted file mode 100755 index 83b76a7726f..00000000000 --- a/python/test/Ice/operations/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="ServerAMD.py") -TestUtil.queueCollocatedTest(additionalOptions = " --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") -TestUtil.runQueuedTests() diff --git a/python/test/Ice/optional/run.py b/python/test/Ice/optional/run.py deleted file mode 100755 index 44156a1671c..00000000000 --- a/python/test/Ice/optional/run.py +++ /dev/null @@ -1,29 +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(configName = "compact", message = "Running test with compact (default) format.") -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="ServerAMD.py") -TestUtil.runQueuedTests() diff --git a/python/test/Ice/properties/run.py b/python/test/Ice/properties/run.py deleted file mode 100755 index 70e96e63e13..00000000000 --- a/python/test/Ice/properties/run.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -# -# Write config -# -if sys.version_info[0] == 2: - configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config" - decodedPath = configPath.decode("utf-8") -else: - configPath = "./config/\u4e2d\u56fd_client.config" - decodedPath = configPath # No need to decode with Python3, strings are already Unicode - -TestUtil.createFile(decodedPath, - ["# Automatically generated by Ice test driver.", - "Ice.Trace.Protocol=1", - "Ice.Trace.Network=1", - "Ice.ProgramName=PropertiesClient", - "Config.Path=" + configPath], - "utf-8") - -TestUtil.simpleTest() - -if os.path.exists(decodedPath): - os.remove(decodedPath) diff --git a/python/test/Ice/proxy/run.py b/python/test/Ice/proxy/run.py deleted file mode 100755 index 83b76a7726f..00000000000 --- a/python/test/Ice/proxy/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="ServerAMD.py") -TestUtil.queueCollocatedTest(additionalOptions = " --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") -TestUtil.runQueuedTests() diff --git a/python/test/Ice/servantLocator/run.py b/python/test/Ice/servantLocator/run.py deleted file mode 100755 index 83b76a7726f..00000000000 --- a/python/test/Ice/servantLocator/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 - -TestUtil.queueClientServerTest() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="ServerAMD.py") -TestUtil.queueCollocatedTest(additionalOptions = " --Ice.ThreadPool.Client.SizeMax=2 --Ice.ThreadPool.Client.SizeWarn=0") -TestUtil.runQueuedTests() diff --git a/python/test/Ice/slicing/exceptions/run.py b/python/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index 6cf3085058b..00000000000 --- a/python/test/Ice/slicing/exceptions/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 - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", server="ServerAMD.py") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", server="ServerAMD.py", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") -TestUtil.runQueuedTests() diff --git a/python/test/Ice/slicing/objects/run.py b/python/test/Ice/slicing/objects/run.py deleted file mode 100755 index dffc505da7e..00000000000 --- a/python/test/Ice/slicing/objects/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 - -TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.") - -TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", server="ServerAMD.py") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", server="ServerAMD.py", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") -TestUtil.runQueuedTests() diff --git a/python/test/Ice/timeout/run.py b/python/test/Ice/timeout/run.py deleted file mode 100755 index 8d9a8c0837c..00000000000 --- a/python/test/Ice/timeout/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() diff --git a/python/test/Slice/import/run.py b/python/test/Slice/import/run.py deleted file mode 100755 index f57a343fc7d..00000000000 --- a/python/test/Slice/import/run.py +++ /dev/null @@ -1,59 +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, shutil, subprocess - -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 - -testdir = os.path.dirname(os.path.abspath(__file__)) - -if os.path.exists(os.path.join(testdir, "Test1_ice.py")): - os.remove(os.path.join(testdir, "Test1_ice.py")) -if os.path.exists(os.path.join(testdir, "Test2_ice.py")): - os.remove(os.path.join(testdir, "Test2_ice.py")) -if os.path.exists(os.path.join(testdir, "Test")): - shutil.rmtree(os.path.join(testdir, "Test")) - -if os.environ.get("USE_BIN_DIST", "no") == "yes": - if TestUtil.isDarwin(): - slice2py = sys.executable + " /usr/local/bin/slice2py" - elif TestUtil.isWin32(): - pythonHome = os.path.dirname(sys.executable) - slice2py = os.path.join(pythonHome, "Scripts", "slice2py.exe") - elif os.path.isfile(os.path.join(TestUtil.getCppBinDir(), "slice2py")): - slice2py = os.path.join(TestUtil.getCppBinDir(), "slice2py") - else: - import slice2py - slice2py = sys.executable + " " + os.path.normpath(os.path.join(slice2py.__file__, "..", "..", "..", "..", "bin", "slice2py")) -else: - if TestUtil.isYocto(): - slice2py = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "..", "cpp", "bin", "slice2py") - else: - slice2py = sys.executable + " " + os.path.join(path[0], "python", "config", "s2py.py") - -s2p = TestUtil.spawn(slice2py + " Test1.ice") -s2p.waitTestSuccess() -s2p = TestUtil.spawn(slice2py + " Test2.ice") -s2p.waitTestSuccess() - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.py", "--Ice.Default.Host=127.0.0.1", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/python/test/Slice/import/test.py b/python/test/Slice/import/test.py new file mode 100644 index 00000000000..6a0343d1e4e --- /dev/null +++ b/python/test/Slice/import/test.py @@ -0,0 +1,26 @@ +# ********************************************************************** +# +# 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 SliceImportTestCase(ClientTestCase): + + def setupClientSide(self, current): + + testdir = current.testcase.getPath() + if os.path.exists(os.path.join(testdir, "Test1_ice.py")): + os.remove(os.path.join(testdir, "Test1_ice.py")) + if os.path.exists(os.path.join(testdir, "Test2_ice.py")): + os.remove(os.path.join(testdir, "Test2_ice.py")) + if os.path.exists(os.path.join(testdir, "Test")): + shutil.rmtree(os.path.join(testdir, "Test")) + + slice2py = SliceTranslator("slice2py") + slice2py.run(current, args=["Test1.ice"]) + slice2py.run(current, args=["Test2.ice"]) + +TestSuite(__name__, [ SliceImportTestCase() ])
\ No newline at end of file diff --git a/python/test/Slice/keyword/run.py b/python/test/Slice/keyword/run.py deleted file mode 100755 index 3fdd4ddab0c..00000000000 --- a/python/test/Slice/keyword/run.py +++ /dev/null @@ -1,28 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.py", "--Ice.Default.Host=127.0.0.1", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/python/test/Slice/macros/run.py b/python/test/Slice/macros/run.py deleted file mode 100755 index 3fdd4ddab0c..00000000000 --- a/python/test/Slice/macros/run.py +++ /dev/null @@ -1,28 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.py", "--Ice.Default.Host=127.0.0.1", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/python/test/Slice/structure/run.py b/python/test/Slice/structure/run.py deleted file mode 100755 index 3fdd4ddab0c..00000000000 --- a/python/test/Slice/structure/run.py +++ /dev/null @@ -1,28 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.py", "--Ice.Default.Host=127.0.0.1", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/python/test/Slice/unicodePaths/run.py b/python/test/Slice/unicodePaths/run.py deleted file mode 100644 index 566a3818b81..00000000000 --- a/python/test/Slice/unicodePaths/run.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -import os, sys, locale, shutil - -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 - -def test(b): - if not b: - print("failed!") - sys.exit(1) - -if TestUtil.isAIX() or TestUtil.isLinux(): - encoding = locale.getdefaultlocale()[1] - if encoding != "UTF-8": - print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8") - print("Skipping test") - sys.exit(0) - -if sys.version_info[0] == 2 and TestUtil.isWin32(): - print("To run this test on Windows you need to be using Python 3.x") - print("Python 2.x subprocess module doesn't support unicode on Windows") - print("Skipping test") - sys.exit(0) - -if os.environ.get("USE_BIN_DIST", "no") == "yes": - if TestUtil.isDarwin(): - slice2py = sys.executable + " /usr/local/bin/slice2py" - elif TestUtil.isWin32(): - pythonHome = os.path.dirname(sys.executable) - slice2py = os.path.join(pythonHome, "Scripts", "slice2py.exe") - elif os.path.isfile(os.path.join(TestUtil.getCppBinDir(), "slice2py")): - slice2py = os.path.join(TestUtil.getCppBinDir(), "slice2py") - else: - import slice2py - slice2py = sys.executable + " " + os.path.normpath(os.path.join(slice2py.__file__, "..", "..", "..", "..", "bin", "slice2py")) -else: - if TestUtil.isYocto(): - slice2py = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "..", "cpp", "bin", "slice2py") - else: - slice2py = sys.executable + " " + os.path.join(path[0], "python", "config", "s2py.py") - -sys.stdout.write("testing Slice compiler and unicode file paths... ") -sys.stdout.flush() - -# -# Write config -# -if sys.version_info[0] == 2: - srcPath = "./\xe4\xb8\xad\xe5\x9b\xbd".decode("utf-8") -else: - srcPath = "./\u4e2d\u56fd" -if os.path.exists(srcPath): - shutil.rmtree(srcPath) -os.mkdir(srcPath) -TestUtil.createFile("%s/Test.ice" % srcPath, ["module Test { ", - "class Point{int x; int y; };", - "interface Canvas{ void draw(Point p); };", - "};"], "utf-8") -p = TestUtil.runCommand('%s %s/Test.ice --output-dir %s' % (slice2py, srcPath, srcPath)) -test(p.wait() == 0) -test(os.path.isfile("%s/Test_ice.py" % srcPath)) - -if os.path.exists(srcPath): - shutil.rmtree(srcPath) -print("ok") diff --git a/ruby/Makefile b/ruby/Makefile index 9d9f9b10657..33007d4d602 100644 --- a/ruby/Makefile +++ b/ruby/Makefile @@ -15,7 +15,7 @@ include $(top_srcdir)/config/Make.rules # # Load C++ dependencies # -$(eval $(call load-dependencies,$(addprefix $(top_srcdir)/cpp/src/,Ice IceSSL))) +$(eval $(call load-dependencies,$(addprefix $(top_srcdir)/cpp/src/,Ice IceSSL IceLocatorDiscovery IceDiscovery))) $(eval $(call load-translator-dependencies,$(top_srcdir)/cpp/src/slice2rb)) # diff --git a/ruby/allTests.py b/ruby/allTests.py index 54e3f8ae08f..e4360c465d3 100755 --- a/ruby/allTests.py +++ b/ruby/allTests.py @@ -8,46 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("Slice/keyword", ["once"]), - ("Slice/structure", ["once"]), - ("Slice/macros", ["once"]), - ("Slice/unicodePaths", ["once"]), - ("Ice/binding", ["core"]), - ("Ice/checksum", ["core"]), - ("Ice/exceptions", ["core"]), - ("Ice/facets", ["core"]), - ("Ice/info", ["core", "noipv6", "nocompress"]), - ("Ice/inheritance", ["core"]), - ("Ice/location", ["core"]), - ("Ice/objects", ["core"]), - ("Ice/proxy", ["core"]), - ("Ice/properties", ["once", "nowin32"]), - ("Ice/operations", ["core"]), - ("Ice/timeout", ["core", "nocompress"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/optional", ["core"]), - ("Ice/enums", ["core"]), - ("Ice/acm", ["core"]) - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/ruby/config/Make.rules b/ruby/config/Make.rules index eec3423d6c0..409e0254863 100644 --- a/ruby/config/Make.rules +++ b/ruby/config/Make.rules @@ -29,6 +29,16 @@ ifneq ($(wildcard $(ruby_config_dir)/ruby/config.h),) ruby_cppflags += -I$(ruby_config_dir) endif +# OS X & macOS with LLVM-Clang > 7.3 and the system version of Ruby require '-Wno-shift-negative-value'. This issue +# has been patched in more recent 2.x Ruby versions. +ifeq ($(shell uname),Darwin) + ifeq ($(shell which $(RUBY)),/usr/bin/ruby) + ifeq ($(shell expr $$($(CXX) -v 2>&1 | head -1 | sed -E 's/.*clang-([0-9][0-9][0-9]).*/\1/') \>= 703),1) + ruby_cppflags += -Wno-shift-negative-value $(RUBY_FLAGS) + endif + endif +endif + # Ruby linker flags ruby_ldflags := $(call ruby-call,$$(LIBRUBYARG)) ruby_libdir := $(call ruby-call,$(if $(findstring MINGW,$(shell uname)),$$(bindir),$$(libdir))) diff --git a/ruby/src/IceRuby/Communicator.cpp b/ruby/src/IceRuby/Communicator.cpp index 73fd483f8be..232092dd9bd 100644 --- a/ruby/src/IceRuby/Communicator.cpp +++ b/ruby/src/IceRuby/Communicator.cpp @@ -173,6 +173,17 @@ IceRuby_initialize(int argc, VALUE* argv, VALUE self) communicator = Ice::initialize(data); } } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + for(i = 0; i < ac + 1; ++i) + { + free(av[i]); + } + delete[] av; + + throw; + } catch(...) { for(i = 0; i < ac + 1; ++i) diff --git a/ruby/src/IceRuby/Init.cpp b/ruby/src/IceRuby/Init.cpp index 5520de7d9fe..a0c2663f4ed 100644 --- a/ruby/src/IceRuby/Init.cpp +++ b/ruby/src/IceRuby/Init.cpp @@ -19,6 +19,8 @@ #include <Endpoint.h> #include <ValueFactoryManager.h> +#include <Ice/RegisterPlugins.h> + using namespace std; using namespace IceRuby; @@ -27,21 +29,12 @@ static VALUE iceModule; extern "C" { -#ifdef ICE_STATIC_LIBS -Ice::Plugin* createIceSSL(const Ice::CommunicatorPtr&, const std::string&, const Ice::StringSeq&); -Ice::Plugin* createIceDiscovery(const Ice::CommunicatorPtr&, const string&, const Ice::StringSeq&); -Ice::Plugin* createIceLocatorDiscovery(const Ice::CommunicatorPtr&, const string&, const Ice::StringSeq&); -#endif - void ICE_DECLSPEC_EXPORT Init_IceRuby() { -#ifdef ICE_STATIC_LIBS - // Register the plugins manually if we're building with static libraries. - Ice::registerPluginFactory("IceSSL", createIceSSL, false); - Ice::registerPluginFactory("IceDiscovery", createIceDiscovery, false); - Ice::registerPluginFactory("IceLocatorDiscovery", createIceLocatorDiscovery, false); -#endif + Ice::registerIceSSL(false); + Ice::registerIceDiscovery(false); + Ice::registerIceLocatorDiscovery(false); iceModule = rb_define_module("Ice"); initCommunicator(iceModule); diff --git a/ruby/src/IceRuby/Makefile.mk b/ruby/src/IceRuby/Makefile.mk index 991308fc482..b4468e12b9c 100644 --- a/ruby/src/IceRuby/Makefile.mk +++ b/ruby/src/IceRuby/Makefile.mk @@ -16,7 +16,7 @@ IceRuby_installdir := $(install_rubylibdir) IceRuby_cppflags := -I$(project) -I$(top_srcdir)/cpp/include -I$(top_srcdir)/cpp/include/generated \ -I$(top_srcdir)/cpp/src $(ruby_cppflags) IceRuby_ldflags := $(ruby_ldflags) -IceRuby_dependencies := IceSSL Ice +IceRuby_dependencies := IceDiscovery IceLocatorDiscovery IceSSL Ice IceRuby_libs := mcpp IceRuby_extra_sources := $(filter-out %Util.cpp %Python.cpp,\ $(wildcard $(top_srcdir)/cpp/src/Slice/*.cpp)) \ diff --git a/ruby/test/Ice/acm/run.py b/ruby/test/Ice/acm/run.py deleted file mode 100755 index 9bd838957b6..00000000000 --- a/ruby/test/Ice/acm/run.py +++ /dev/null @@ -1,25 +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.clientServerTest() - -sys.exit(0) diff --git a/ruby/test/Ice/application/test.py b/ruby/test/Ice/application/test.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/ruby/test/Ice/application/test.py diff --git a/ruby/test/Ice/binding/run.py b/ruby/test/Ice/binding/run.py deleted file mode 100755 index 4e108ef8705..00000000000 --- a/ruby/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.clientServerTest() - diff --git a/ruby/test/Ice/checksum/run.py b/ruby/test/Ice/checksum/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/ruby/test/Ice/checksum/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/ruby/test/Ice/defaultValue/run.py b/ruby/test/Ice/defaultValue/run.py deleted file mode 100755 index aefa272c10e..00000000000 --- a/ruby/test/Ice/defaultValue/run.py +++ /dev/null @@ -1,28 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.rb", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/ruby/test/Ice/enums/run.py b/ruby/test/Ice/enums/run.py deleted file mode 100755 index 6870d8dcd2a..00000000000 --- a/ruby/test/Ice/enums/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with 1.1 encoding.") -TestUtil.clientServerTest() diff --git a/ruby/test/Ice/exceptions/run.py b/ruby/test/Ice/exceptions/run.py deleted file mode 100755 index 99baacc7c1c..00000000000 --- a/ruby/test/Ice/exceptions/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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with compact (default) format and AMD server.") -TestUtil.clientServerTest(server="serveramd") - -print("Running test with sliced format and AMD server.") -TestUtil.clientServerTest(server="serveramd", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding and AMD server.") -TestUtil.clientServerTest(server="serveramd", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/ruby/test/Ice/facets/run.py b/ruby/test/Ice/facets/run.py deleted file mode 100755 index 4e108ef8705..00000000000 --- a/ruby/test/Ice/facets/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.clientServerTest() - diff --git a/ruby/test/Ice/info/run.py b/ruby/test/Ice/info/run.py deleted file mode 100755 index 3fc6200cd00..00000000000 --- a/ruby/test/Ice/info/run.py +++ /dev/null @@ -1,23 +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.clientServerTest() diff --git a/ruby/test/Ice/inheritance/run.py b/ruby/test/Ice/inheritance/run.py deleted file mode 100755 index 4e108ef8705..00000000000 --- a/ruby/test/Ice/inheritance/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.clientServerTest() - diff --git a/ruby/test/Ice/location/run.py b/ruby/test/Ice/location/run.py deleted file mode 100755 index 4e108ef8705..00000000000 --- a/ruby/test/Ice/location/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.clientServerTest() - diff --git a/ruby/test/Ice/objects/run.py b/ruby/test/Ice/objects/run.py deleted file mode 100755 index 10fcc7c02db..00000000000 --- a/ruby/test/Ice/objects/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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/ruby/test/Ice/operations/run.py b/ruby/test/Ice/operations/run.py deleted file mode 100755 index 6e7a3af7229..00000000000 --- a/ruby/test/Ice/operations/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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") - diff --git a/ruby/test/Ice/optional/run.py b/ruby/test/Ice/optional/run.py deleted file mode 100755 index 9e0a062c612..00000000000 --- a/ruby/test/Ice/optional/run.py +++ /dev/null @@ -1,26 +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 - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", additionalServerOptions="--Ice.Default.SlicedFormat") diff --git a/ruby/test/Ice/properties/run.py b/ruby/test/Ice/properties/run.py deleted file mode 100755 index 70e96e63e13..00000000000 --- a/ruby/test/Ice/properties/run.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -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 - -# -# Write config -# -if sys.version_info[0] == 2: - configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config" - decodedPath = configPath.decode("utf-8") -else: - configPath = "./config/\u4e2d\u56fd_client.config" - decodedPath = configPath # No need to decode with Python3, strings are already Unicode - -TestUtil.createFile(decodedPath, - ["# Automatically generated by Ice test driver.", - "Ice.Trace.Protocol=1", - "Ice.Trace.Network=1", - "Ice.ProgramName=PropertiesClient", - "Config.Path=" + configPath], - "utf-8") - -TestUtil.simpleTest() - -if os.path.exists(decodedPath): - os.remove(decodedPath) diff --git a/ruby/test/Ice/proxy/run.py b/ruby/test/Ice/proxy/run.py deleted file mode 100755 index b1cbdc1940c..00000000000 --- a/ruby/test/Ice/proxy/run.py +++ /dev/null @@ -1,28 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() -print("tests with AMD server.") -TestUtil.clientServerTest(server="serveramd") - -sys.exit(0) diff --git a/ruby/test/Ice/slicing/exceptions/run.py b/ruby/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index d27134b1154..00000000000 --- a/ruby/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/ruby/test/Ice/slicing/objects/run.py b/ruby/test/Ice/slicing/objects/run.py deleted file mode 100755 index d27134b1154..00000000000 --- a/ruby/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,28 +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 - -print("Running test with sliced format.") -TestUtil.clientServerTest() - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") diff --git a/ruby/test/Ice/timeout/run.py b/ruby/test/Ice/timeout/run.py deleted file mode 100755 index 94778d2a1f3..00000000000 --- a/ruby/test/Ice/timeout/run.py +++ /dev/null @@ -1,25 +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 - -print("tests with regular server.") -TestUtil.clientServerTest() - diff --git a/ruby/test/Slice/keyword/run.py b/ruby/test/Slice/keyword/run.py deleted file mode 100755 index 27257ffbfad..00000000000 --- a/ruby/test/Slice/keyword/run.py +++ /dev/null @@ -1,28 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.rb", "--Ice.Default.Host=127.0.0.1", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/ruby/test/Slice/macros/run.py b/ruby/test/Slice/macros/run.py deleted file mode 100755 index 4ada9c9860f..00000000000 --- a/ruby/test/Slice/macros/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.rb", "--Ice.Default.Host=127.0.0.1", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() - diff --git a/ruby/test/Slice/structure/run.py b/ruby/test/Slice/structure/run.py deleted file mode 100755 index 4ada9c9860f..00000000000 --- a/ruby/test/Slice/structure/run.py +++ /dev/null @@ -1,29 +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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("Client.rb", "--Ice.Default.Host=127.0.0.1", startReader = False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() - diff --git a/ruby/test/Slice/unicodePaths/run.py b/ruby/test/Slice/unicodePaths/run.py deleted file mode 100644 index 3ff0e2838c5..00000000000 --- a/ruby/test/Slice/unicodePaths/run.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python -# -*- 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. -# -# ********************************************************************** - -import os, sys, locale, shutil - -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 - -def test(b): - if not b: - print("failed!") - sys.exit(1) - -if TestUtil.isAIX() or TestUtil.isLinux(): - encoding = locale.getdefaultlocale()[1] - if encoding != "UTF-8": - print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8") - print("Skipping test") - sys.exit(0) - -if TestUtil.isWin32(): - print("Ruby on Windows is build with MINGW and it doesn't support Windows UNICODE APIs") - print("Skipping test") - sys.exit(0) - -if sys.version_info[0] == 2 and TestUtil.isWin32(): - print("To run this test on Windows you need to be using Python 3.x") - print("Python 2.x subprocess module doesn't support unicode on Windows") - print("Skipping test") - sys.exit(0) - -if os.environ.get("USE_BIN_DIST", "no") == "yes": - if TestUtil.isYocto(): - slice2rb = os.path.join(TestUtil.getCppBinDir(), "slice2rb") - if os.path.isfile("/usr/bin/slice2rb.ruby2.1"): - slice2rb = "slice2rb.ruby2.1" - else: - slice2rb = "slice2rb" -else: - if TestUtil.isYocto(): - slice2rb = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "..", "cpp", "bin", "slice2rb") - else: - slice2rb = "ruby " + os.path.join(path[0], "ruby", "config", "s2rb.rb") - -sys.stdout.write("testing Slice compiler and unicode file paths... ") -sys.stdout.flush() - -# -# Write Slice file -# -if sys.version_info[0] == 2: - srcPath = "./\xe4\xb8\xad\xe5\x9b\xbd".decode("utf-8") -else: - srcPath = "./\u4e2d\u56fd" -if os.path.exists(srcPath): - shutil.rmtree(srcPath) -os.mkdir(srcPath) - -TestUtil.createFile("%s/Test.ice" % srcPath, ["module Test { ", - "class Point{int x; int y; };", - "interface Canvas{ void draw(Point p); };", - "};"], "utf-8") -p = TestUtil.runCommand('%s %s/Test.ice --output-dir %s' % (slice2rb, srcPath, srcPath)) -test(p.wait() == 0) -test(os.path.isfile("%s/Test.rb" % srcPath)) - -if os.path.exists(srcPath): - shutil.rmtree(srcPath) -print("ok") diff --git a/scripts/Controller.ice b/scripts/Controller.ice new file mode 100644 index 00000000000..24ee0b97e29 --- /dev/null +++ b/scripts/Controller.ice @@ -0,0 +1,86 @@ +// ********************************************************************** +// +// 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. +// +// ********************************************************************** + +module Test +{ + +module Common +{ + +exception ServerFailedException +{ + string reason; +}; + +interface Server +{ + void waitTestSuccess(); + void waitForServer() throws ServerFailedException; + void terminate(); +}; + +class Config +{ + optional(1) string protocol; + optional(2) bool mx; + optional(3) bool serialize; + optional(4) bool compress; + optional(5) bool ipv6; +}; + +sequence<bool> BoolSeq; +sequence<string> StringSeq; + +class OptionOverrides +{ + optional(1) StringSeq protocol; + optional(2) BoolSeq mx; + optional(3) BoolSeq serialize; + optional(4) BoolSeq compress; + optional(5) BoolSeq ipv6; +}; + +exception TestCaseNotExistException +{ + string reason; +}; + +exception TestCaseFailedException +{ + string output; +}; + +interface TestCase +{ + string startServerSide(Config config) + throws TestCaseFailedException; + + string stopServerSide(bool success) + throws TestCaseFailedException; + + string runClientSide(string host, Config config) + throws TestCaseFailedException; + + void destroy(); +}; + +interface Controller +{ + Server* runServer(string lang, string testsuite, string protocol, string host, bool winrt, string testcase, + StringSeq options); + + TestCase* runTestCase(string lang, string testsuite, string testcase) + throws TestCaseNotExistException; + + OptionOverrides getOptionOverrides(); +}; + +}; + +}; diff --git a/scripts/Controller.py b/scripts/Controller.py new file mode 100755 index 00000000000..d89175eb244 --- /dev/null +++ b/scripts/Controller.py @@ -0,0 +1,263 @@ +#!/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 +from Util import * + +class ControllerDriver(Driver): + + class Current(Driver.Current): + + def __init__(self, driver, testsuite, testcase, protocol, host, args): + Driver.Current.__init__(self, driver, testsuite, Result(testsuite, driver.debug)) + self.testcase = testcase + self.host = host + self.args = args + self.config.protocol = protocol + + @classmethod + def getOptions(self): + return ("", ["clean", "id=", "endpoints=", "interface="]) + + @classmethod + def usage(self): + print("") + print("Controller driver options:") + print("--id=<identity> The identify of the controller object.") + print("--endpoints=<endpts> The endpoints to listen on.") + print("--interface=<IP> The interface to use to discover the controller.") + print("--clean Remove trust settings (OS X).") + + def __init__(self, options, *args, **kargs): + Driver.__init__(self, options, *args, **kargs) + self.id = "controller" + self.endpoints = "tcp" + self.interface = "" + self.clean = False + parseOptions(self, options, { "clean" : "clean" }) + + def run(self, mappings): + + if isinstance(platform, Darwin): + # + # On OS X, we set the trust settings on the certificate to prevent + # the Web browsers from prompting the user about the unstrusted + # certificate. Some browsers such as Chrome don't provide the + # option to set this trust settings. + # + serverCert = os.path.join(toplevel, "certs", "server.pem") + if self.clean: + if os.system("security verify-cert -c " + serverCert + " >& /dev/null") == 0: + sys.stdout.write("removing trust settings for the HTTP server certificate... ") + sys.stdout.flush() + if os.system("security remove-trusted-cert " + serverCert) != 0: + print("\nerror: couldn't remove trust settings for the HTTP server certificate") + else: + print("ok") + else: + print("trust settings already removed") + return + else: + if os.system("security verify-cert -c " + serverCert + " >& /dev/null") != 0: + sys.stdout.write("adding trust settings for the HTTP server certificate... ") + sys.stdout.flush() + if os.system("security add-trusted-cert -r trustAsRoot " + serverCert) != 0: + print("error: couldn't add trust settings for the HTTP server certificate") + print("ok") + print("run " + sys.argv[0] + " --clean to remove the trust setting") + + import Ice + Ice.loadSlice(os.path.join(toplevel, "scripts", "Controller.ice")) + import Test + + class ServerI(Test.Common.Server): + def __init__(self, driver, current): + self.driver = driver + self.current = current + + def waitForServer(self, c): + if not self.current: + raise Test.Common.ServerFailedException("couldn't find test suite") + + try: + self.current.testcase.getServerTestCase()._startServerSide(self.current) + except Exception as ex: + raise Test.Common.ServerFailedException(str(ex)) + + def waitTestSuccess(self, c): + c.adapter.remove(c.id) + if self.current: + self.current.testcase.getServerTestCase()._stopServerSide(self.current, True) + + def terminate(self, c): + c.adapter.remove(c.id) + if self.current: + self.current.testcase.getServerTestCase()._stopServerSide(self.current, False) + + class TestCaseI(Test.Common.TestCase): + def __init__(self, driver, current): + self.driver = driver + self.current = current + self.serverSideRunning = False + + def startServerSide(self, config, c): + self.updateCurrent(config) + + # Depending on the configuration, either use an IPv4, IPv6 or BT address for Ice.Default.Host + if self.current.config.ipv6: + if not self.driver.hostIPv6: + raise Test.Common.TestCaseFailedException("no IPv6 address set with --host-ipv6") + self.current.host = self.driver.hostIPv6 + elif self.current.config.protocol == "bt": + if not self.driver.hostBT: + raise Test.Common.TestCaseFailedException("no Bluetooth address set with --host-bt") + self.current.host = self.driver.hostBT + else: + self.current.host = self.driver.host if self.driver.host else self.driver.interface + + try: + self.current.testcase.getServerTestCase()._startServerSide(self.current) + self.serverSideRunning = True + return self.current.host + except Exception as ex: + raise Test.Common.TestCaseFailedException(self.current.result.getOutput() + "\n" + str(ex)) + + def stopServerSide(self, success, c): + if self.serverSideRunning: + try: + self.current.testcase.getServerTestCase()._stopServerSide(self.current, success) + return self.current.result.getOutput() + except Exception as ex: + raise Test.Common.TestCaseFailedException(self.current.result.getOutput() + "\n" + str(ex)) + + def runClientSide(self, host, config, c): + self.updateCurrent(config) + if host: + current.host = host + try: + self.current.testcase.getClientTestCase()._runClientSide(self.current) + return self.current.result.getOutput() + except Exception as ex: + raise Test.Common.TestCaseFailedException(self.current.result.getOutput() + "\n" + str(ex)) + + def destroy(self, c): + if self.serverSideRunning: + try: + self.current.testcase.getServerTestCase()._stopServerSide(self.current, False) + except: + pass + c.adapter.remove(c.id) + + def updateCurrent(self, config): + attrs = ["protocol", "mx", "serialize", "compress", "ipv6"] + for a in attrs: + v = getattr(config, a) + if v is not Ice.Unset: + setattr(self.current.config, a, v) + + class ControllerI(Test.Common.Controller): + def __init__(self, driver): + self.driver = driver + self.server = None + self.testcase = None + + def runServer(self, mapping, testsuite, protocol, host, winrt, testcase, args, c): + self.terminate() + try: + current = self.driver.getCurrent(mapping, testsuite, testcase, protocol, host, args) + except Test.Common.TestCaseNotExistException: + current = None + self.server = Test.Common.ServerPrx.uncheckedCast(c.adapter.addWithUUID(ServerI(self.driver, current))) + return self.server + + def runTestCase(self, mapping, testsuite, testcase, c): + self.terminate() + current = self.driver.getCurrent(mapping, testsuite, testcase) + self.testcase = Test.Common.TestCasePrx.uncheckedCast(c.adapter.addWithUUID(TestCaseI(self.driver, current))) + return self.testcase + + def getOptionOverrides(self, c): + return Test.Common.OptionOverrides(ipv6=([False] if not self.driver.hostIPv6 else [False, True])) + + def terminate(self): + if self.server: + try: + self.server.terminate() + except: + pass + self.server = None + + if self.testcase: + try: + self.testcase.destroy() + except: + pass + self.testcase = None + + initData = Ice.InitializationData() + initData.properties = Ice.createProperties(); + initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL:createIceSSL") + initData.properties.setProperty("IceSSL.DefaultDir", os.path.join(toplevel, "certs")) + initData.properties.setProperty("IceSSL.CertFile", "server.p12") + initData.properties.setProperty("IceSSL.Password", "password") + initData.properties.setProperty("IceSSL.Keychain", "test.keychain") + initData.properties.setProperty("IceSSL.KeychainPassword", "password") + initData.properties.setProperty("IceSSL.VerifyPeer", "0"); + initData.properties.setProperty("Ice.ThreadPool.Server.SizeMax", "10") + initData.properties.setProperty("Ice.Plugin.IceDiscovery", "IceDiscovery:createIceDiscovery") + initData.properties.setProperty("IceDiscovery.DomainId", "TestController") + if self.interface: + initData.properties.setProperty("IceDiscovery.Interface", self.interface) + initData.properties.setProperty("Ice.Default.Host", self.interface) + #initData.properties.setProperty("Ice.Trace.Network", "3") + #initData.properties.setProperty("Ice.Trace.Protocol", "1") + initData.properties.setProperty("ControllerAdapter.Endpoints", self.endpoints) + initData.properties.setProperty("ControllerAdapter.AdapterId", Ice.generateUUID()) + + communicator = Ice.initialize(initData) + try: + adapter = communicator.createObjectAdapter("ControllerAdapter") + adapter.add(ControllerI(self), communicator.stringToIdentity(self.id)) + adapter.activate() + communicator.waitForShutdown() + finally: + communicator.destroy() + + def getCurrent(self, mapping, testsuite, testcase, protocol=None, host=None, args=[]): + import Test + mapping = Mapping.getByName(mapping) + if not mapping: + raise Test.Common.TestCaseNotExistException("unknown mapping {0}".format(mapping)) + + ts = mapping.findTestSuite(testsuite) + if not ts: + raise Test.Common.TestCaseNotExistException("unknown testsuite {0}".format(testsuite)) + + tc = ts.findTestCase("server" if ts.getId() == "Ice/echo" else (testcase or "client/server")) + if not tc or not tc.getServerTestCase(): + raise Test.Common.TestCaseNotExistException("unknown testcase {0}".format(testcase)) + + return ControllerDriver.Current(self, ts, tc, protocol, host, args) + + def getProps(self, process, current): + props = Driver.getProps(self, process, current) + if isinstance(process, IceProcess) and current.host: + props["Ice.Default.Host"] = current.host + return props + + def getArgs(self, process, current): + return current.args + + def isWorkerThread(self): + return True + +Driver.add("controller", ControllerDriver, default=True) + +runTests()
\ No newline at end of file diff --git a/scripts/Expect.py b/scripts/Expect.py index 1e63e99978d..0140a881d28 100755 --- a/scripts/Expect.py +++ b/scripts/Expect.py @@ -479,7 +479,7 @@ class Expect (object): raises a TIMEOUT exception. If timeout is None, the wait is indefinite. - The exit status is returned. A negative exit status means + The exit tus is returned. A negative exit status means the application was killed by a signal. """ if self.p is None: @@ -493,6 +493,10 @@ class Expect (object): time.sleep(0.1) if self.p and self.p.poll() is None: raise TIMEOUT ('timedwait exceeded timeout') + elif win32: + # We poll on Windows or othewise KeyboardInterrupt isn't delivered + while self.p.poll() is None: + time.sleep(0.5) if self.p is None: return self.exitstatus @@ -503,7 +507,8 @@ class Expect (object): if win32 and self.exitstatus != 0 and self.killed is not None: self.exitstatus = -self.killed global processes - del processes[self.p.pid] + if self.p.pid in processes: + del processes[self.p.pid] self.p = None self.r.join() # Simulate a match on EOF @@ -519,6 +524,10 @@ class Expect (object): # First try to break the app. Don't bother if this is win32 # and we're using java. It won't break (BREAK causes a stack # trace). + + if self.p is None: + return + if self.hasInterruptSupport(): try: if win32: @@ -633,6 +642,32 @@ class Expect (object): def trace(self, suppress = None): self.r.enabletrace(suppress) + def waitSuccess(self, exitstatus = 0, timeout = None): + """Wait for the process to terminate for up to timeout seconds, and + validate the exit status is as expected.""" + + def test(result, expected): + if expected != result: + raise RuntimeError("unexpected exit status: expected: %d, got %d\n" % (expected, result)) + + self.wait(timeout) + if self.mapping == "java": + if self.killed is not None: + if win32: + test(self.exitstatus, -self.killed) + else: + if self.killed == signal.SIGINT: + test(130, self.exitstatus) + else: + test(self.exitstatus, exitstatus) + else: + test(self.exitstatus, exitstatus) + else: + test(self.exitstatus, exitstatus) + + def getOutput(self): + return self.buf + def hasInterruptSupport(self): """Return True if the application gracefully terminated, False otherwise.""" if win32 and self.mapping == "java": diff --git a/scripts/Glacier2Util.py b/scripts/Glacier2Util.py new file mode 100644 index 00000000000..81bdc050f67 --- /dev/null +++ b/scripts/Glacier2Util.py @@ -0,0 +1,76 @@ +# ********************************************************************** +# +# 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 +from Util import * + +class Glacier2Router(ProcessFromBinDir, Server): + + def __init__(self, portnum=10, passwords={"userid": "abc123"}, *args, **kargs): + Server.__init__(self, "glacier2router", mapping=Mapping.getByName("cpp"), desc="Glacier2 router", + readyCount=2, *args, **kargs) + self.portnum = portnum + self.passwords = passwords + + def setup(self, current): + if self.passwords: + path = os.path.join(current.testcase.getPath(), "passwords") + with open(path, "w") as file: + command = "%s %s" % (sys.executable, + os.path.abspath(os.path.join(toplevel, "scripts", "icehashpassword.py"))) + + # + # For Linux ARM default rounds makes test slower (Usually runs on embbeded boards) + # + if current.config.buildPlatform.find("arm") >= 0: + command += " --rounds 100000" + + for user, password in self.passwords.items(): + p = subprocess.Popen(command, + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + stdin=subprocess.PIPE) + p.stdin.write(password.encode('UTF-8')) + p.stdin.write('\r\n'.encode('UTF-8')) + p.stdin.flush() + if(p.wait() != 0): + raise RuntimeError("icehashpassword.py failed:\n" + p.stdout.read().decode('UTF-8').strip()) + file.write("%s %s\n" % (user, p.stdout.readline().decode('UTF-8').strip())) + current.testcase.files.append(path) + + def getProps(self, current): + props = Server.getProps(self, current) + props.update({ + "Glacier2.Client.Endpoints" : current.getTestEndpoint(self.portnum), + "Glacier2.Server.Endpoints" : "tcp", + "Ice.Admin.Endpoints" : current.getTestEndpoint(self.portnum + 1, "tcp"), + "Ice.Admin.InstanceName" : "Glacier2", + }) + if self.passwords: + props["Glacier2.CryptPasswords"] = os.path.join("{testdir}", "passwords") + if isinstance(current.testcase.getTestSuite(), Glacier2TestSuite): + # Add the properties provided by the Glacier2TestSuite routerProps parameter. + props.update(current.testcase.getTestSuite().getRouterProps(self, current)) + return props + + def getClientProxy(self, current): + return "Glacier2/router:{0}".format(current.getTestEndpoint(self.portnum)) + +class Glacier2TestSuite(TestSuite): + + def __init__(self, path, routerProps={}, testcases=None, *args, **kargs): + if testcases is None: + testcases = [ClientServerTestCase(servers=[Glacier2Router(), Server()])] + TestSuite.__init__(self, path, testcases, *args, **kargs) + self.routerProps = routerProps + + def getRouterProps(self, process, current): + return self.routerProps(process, current) if callable(self.routerProps) else self.routerProps.copy() + diff --git a/scripts/IceBoxUtil.py b/scripts/IceBoxUtil.py new file mode 100644 index 00000000000..e7a9b71d021 --- /dev/null +++ b/scripts/IceBoxUtil.py @@ -0,0 +1,27 @@ +# ********************************************************************** +# +# 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 +from Util import * + +class IceBox(ProcessFromBinDir, Server): + + processType = "icebox" + +class IceBoxAdmin(ProcessFromBinDir, Client): + + processType = "iceboxadmin" + + def getMapping(self, current): + # IceBox admin is only provided with the C++/Java, not C# + mapping = self.mapping or current.testcase.getMapping() + if isinstance(mapping, CppMapping) or isinstance(mapping, JavaMapping): + return mapping + else: + return Mapping.getByName("cpp") diff --git a/scripts/IceGridAdmin.py b/scripts/IceGridAdmin.py deleted file mode 100644 index f020d088865..00000000000 --- a/scripts/IceGridAdmin.py +++ /dev/null @@ -1,329 +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, TestUtil, shlex -from threading import Thread - -# -# Set nreplicas to a number N to test replication with N replicas. -# -nreplicas=0 -#nreplicas=1 - -iceGridPort = 12010; - -nodeOptions = r' --Ice.Warn.Connections=0' + \ - r' --IceGrid.InstanceName=TestIceGrid' + \ - r' --IceGrid.Node.Endpoints=default' + \ - r' --IceGrid.Node.WaitTime=240' + \ - r' --Ice.ProgramName=icegridnode' + \ - r' --IceGrid.Node.Trace.Replica=0' + \ - r' --IceGrid.Node.Trace.Activator=0' + \ - r' --IceGrid.Node.Trace.Adapter=0' + \ - r' --IceGrid.Node.Trace.Server=0' + \ - r' --IceGrid.Node.ThreadPool.SizeWarn=0' + \ - r' --IceGrid.Node.PrintServersReady=node1' + \ - r' --Ice.NullHandleAbort' + \ - r' --Ice.ThreadPool.Server.Size=1' + \ - r' --Ice.ServerIdleTime=0' - -registryOptions = r' --Ice.Warn.Connections=0' + \ - r' --IceGrid.InstanceName=TestIceGrid' + \ - r' --IceGrid.Registry.PermissionsVerifier=TestIceGrid/NullPermissionsVerifier' + \ - r' --IceGrid.Registry.AdminPermissionsVerifier=TestIceGrid/NullPermissionsVerifier' + \ - r' --IceGrid.Registry.SSLPermissionsVerifier=TestIceGrid/NullSSLPermissionsVerifier' + \ - r' --IceGrid.Registry.AdminSSLPermissionsVerifier=TestIceGrid/NullSSLPermissionsVerifier' + \ - r' --IceGrid.Registry.Server.Endpoints=default' + \ - r' --IceGrid.Registry.Internal.Endpoints=default' + \ - r' --IceGrid.Registry.SessionManager.Endpoints=default' + \ - r' --IceGrid.Registry.AdminSessionManager.Endpoints=default' + \ - r' --IceGrid.Registry.Trace.Session=0' + \ - r' --IceGrid.Registry.Trace.Application=0' + \ - r' --IceGrid.Registry.Trace.Node=0' + \ - r' --IceGrid.Registry.Trace.Replica=0' + \ - r' --IceGrid.Registry.Trace.Adapter=0' + \ - r' --IceGrid.Registry.Trace.Object=0' + \ - r' --IceGrid.Registry.Trace.Server=0' + \ - r' --IceGrid.Registry.Trace.Locator=0' + \ - r' --IceGrid.Registry.SessionTimeout=60' + \ - r' --Ice.ThreadPool.Server.Size=1 ' + \ - r' --Ice.ThreadPool.Client.SizeWarn=0' + \ - r' --IceGrid.Registry.Client.ThreadPool.SizeWarn=0' + \ - r' --Ice.ServerIdleTime=0' + \ - r' --IceGrid.Registry.DefaultTemplates="' + \ - os.path.abspath(os.path.join(TestUtil.toplevel, "cpp", "config", "templates.xml") + '"') - -if TestUtil.ipv6 and TestUtil.isDarwin(): - registryOptions += r' --IceGrid.Registry.Discovery.Interface="::1"' - -def getDefaultLocatorProperty(): - - i = 0 - property = '--Ice.Default.Locator="TestIceGrid/Locator'; - objrefs = "" - while i < nreplicas + 1: - objrefs = objrefs + ':default -p ' + str(iceGridPort + i) - i = i + 1 - - return ' %s%s"' % (property, objrefs) - -def startIceGridRegistry(testdir, dynamicRegistration = False): - - iceGrid = TestUtil.getIceGridRegistry() - - command = ' --nowarn ' + registryOptions - if dynamicRegistration: - command += r' --IceGrid.Registry.DynamicRegistration' - - procs = [] - i = 0 - while i < (nreplicas + 1): - - if i == 0: - name = "registry" - else: - name = "replica-" + str(i) - - dataDir = os.path.join(testdir, "db", name) - if not os.path.exists(dataDir): - os.mkdir(dataDir) - else: - cleanDbDir(dataDir) - - sys.stdout.write("starting icegrid " + name + "... ") - sys.stdout.flush() - cmd = command + ' ' + \ - r' --Ice.ProgramName=' + name + \ - r' --IceGrid.Registry.Client.Endpoints="default -p ' + str(iceGridPort + i) + '" ' + \ - r' --IceGrid.Registry.LMDB.MapSize=1 --IceGrid.Registry.LMDB.Path="' + dataDir + '" ' - - if i > 0: - cmd += r' --IceGrid.Registry.ReplicaName=' + name + ' ' + getDefaultLocatorProperty() - - driverConfig = TestUtil.DriverConfig("server") - driverConfig.lang = "cpp" - proc = TestUtil.startServer(iceGrid, cmd, driverConfig, count = 5) - procs.append(proc) - print("ok") - - i = i + 1 - return procs - -def shutdownIceGridRegistry(procs): - - i = nreplicas - while i > 0: - sys.stdout.write("shutting down icegrid replica-" + str(i) + "... ") - sys.stdout.flush() - iceGridAdmin("registry shutdown replica-" + str(i)) - print("ok") - i = i - 1 - - sys.stdout.write("shutting down icegrid registry... ") - sys.stdout.flush() - iceGridAdmin("registry shutdown") - print("ok") - - for p in procs: - p.waitTestSuccess() - -def iceGridNodePropertiesOverride(): - - # - # Create property overrides from command line options. - # - overrideOptions = '' - for opt in shlex.split(TestUtil.getCommandLineProperties("", TestUtil.DriverConfig("server"), "")): - opt = opt.strip().replace("--", "") - index = opt.find("=") - if index == -1: - overrideOptions += ("%s=1 ") % opt - else: - key = opt[0:index] - value = opt[index + 1:] - if(value.find(' ') == -1): - overrideOptions += ("%s=%s ") % (key, value) - else: - # - # NOTE: We need 2 backslash before the quote to run the - # C# test/IceGrid/simple test with SSL. - # - overrideOptions += ("%s=\\\"%s\\\" ") % (key, value.replace('"', '\\\\\\"')) - - return overrideOptions - -def startIceGridNode(testdir): - - iceGrid = TestUtil.getIceGridNode() - dataDir = os.path.join(testdir, "db", "node") - if not os.path.exists(dataDir): - os.mkdir(dataDir) - else: - cleanDbDir(dataDir) - - overrideOptions = '" ' + iceGridNodePropertiesOverride() - overrideOptions += ' Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"' - - sys.stdout.write("starting icegrid node... ") - sys.stdout.flush() - command = r' --nowarn ' + nodeOptions + getDefaultLocatorProperty() + \ - r' --IceGrid.Node.Data="' + dataDir + '"' \ - r' --IceGrid.Node.Name=localnode' + \ - r' --IceGrid.Node.PropertiesOverride=' + overrideOptions - - driverConfig = TestUtil.DriverConfig("server") - driverConfig.lang = "cpp" - proc = TestUtil.startServer(iceGrid, command, driverConfig, adapter='node1') - - print("ok") - - return proc - -def iceGridAdmin(cmd, ignoreFailure = False): - - iceGridAdmin = TestUtil.getIceGridAdmin() - - user = r"admin1" - if cmd == "registry shutdown": - user = r"shutdown" - command = getDefaultLocatorProperty() + r" --IceGridAdmin.Username=" + user + " --IceGridAdmin.Password=test1 " + \ - r' -e "' + cmd + '"' - - if TestUtil.appverifier: - TestUtil.setAppVerifierSettings([TestUtil.getIceGridAdmin()]) - - driverConfig = TestUtil.DriverConfig("client") - driverConfig.lang = "cpp" - proc = TestUtil.startClient(iceGridAdmin, command, driverConfig) - status = proc.wait() - - if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd([TestUtil.getIceGridAdmin()]) - - if not ignoreFailure and status: - print(proc.buf) - sys.exit(1) - return proc.buf - -def killNodeServers(): - - for server in iceGridAdmin("server list"): - server = server.strip() - iceGridAdmin("server disable " + server, True) - iceGridAdmin("server signal " + server + " SIGKILL", True) - -def iceGridTest(application, additionalOptions = "", applicationOptions = ""): - - testdir = os.getcwd() - if not TestUtil.isWin32() and os.getuid() == 0: - print - print("*** can't run test as root ***") - print - return - - client = TestUtil.getDefaultClientFile() - if TestUtil.getDefaultMapping() != "java" and TestUtil.getDefaultMapping() != "java-compat": - client = os.path.join(testdir, client) - - clientOptions = ' ' + getDefaultLocatorProperty() + ' ' + additionalOptions - - targets = [] - if TestUtil.appverifier: - targets = [client, TestUtil.getIceGridNode(), TestUtil.getIceGridRegistry()] - TestUtil.setAppVerifierSettings(targets) - - registryProcs = startIceGridRegistry(testdir) - iceGridNodeProc = startIceGridNode(testdir) - - javaHome = os.environ.get("JAVA_HOME", None) - javaExe = os.path.join(javaHome, "bin", "java") if javaHome else "java" - - if application != "": - sys.stdout.write("adding application... ") - sys.stdout.flush() - iceGridAdmin("application add -n '" + os.path.join(testdir, application) + "' " + - "test.dir='" + testdir + "' " + - "ice.bindir='" + TestUtil.getCppBinDir() + "' " + - "java.exe='" + javaExe + "' " + - applicationOptions) - print("ok") - - sys.stdout.write("starting client... ") - sys.stdout.flush() - clientProc = TestUtil.startClient(client, clientOptions, TestUtil.DriverConfig("client"), startReader = False) - print("ok") - clientProc.startReader() - clientProc.waitTestSuccess() - - if application != "": - sys.stdout.write("remove application... ") - sys.stdout.flush() - iceGridAdmin("application remove Test") - print("ok") - - sys.stdout.write("shutting down icegrid node... ") - sys.stdout.flush() - iceGridAdmin("node shutdown localnode") - print("ok") - shutdownIceGridRegistry(registryProcs) - iceGridNodeProc.waitTestSuccess() - - if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets) - -def iceGridClientServerTest(additionalClientOptions, additionalServerOptions): - - testdir = os.getcwd() - server = TestUtil.getDefaultServerFile() - client = TestUtil.getDefaultClientFile() - if TestUtil.getDefaultMapping() != "java" and TestUtil.getDefaultMapping() != "java-compat": - server = os.path.join(testdir, server) - client = os.path.join(testdir, client) - - targets = [] - if TestUtil.appverifier: - targets = [client, server, TestUtil.getIceGridRegistry()] - TestUtil.setAppVerifierSettings(targets) - - clientOptions = getDefaultLocatorProperty() + ' ' + additionalClientOptions - serverOptions = getDefaultLocatorProperty() + ' ' + additionalServerOptions - - registryProcs = startIceGridRegistry(testdir, True) - - sys.stdout.write("starting server... ") - sys.stdout.flush() - serverProc= TestUtil.startServer(server, serverOptions, TestUtil.DriverConfig("server")) - print("ok") - - sys.stdout.write("starting client... ") - sys.stdout.flush() - clientProc = TestUtil.startClient(client, clientOptions, TestUtil.DriverConfig("client")) - print("ok") - - clientProc.waitTestSuccess() - serverProc.waitTestSuccess() - - shutdownIceGridRegistry(registryProcs) - - if TestUtil.appverifier: - TestUtil.appVerifierAfterTestEnd(targets) - -def cleanDbDir(path): - for filename in [ os.path.join(path, f) for f in os.listdir(path) if f != ".gitignore"]: - if os.path.isdir(filename): - cleanDbDir(filename) - try: - os.rmdir(filename) - except OSError: - # This might fail if the directory is empty (because - # it itself contains a .gitignore file. - pass - else: - os.remove(filename) diff --git a/scripts/IceGridUtil.py b/scripts/IceGridUtil.py new file mode 100644 index 00000000000..9eb6157cb9a --- /dev/null +++ b/scripts/IceGridUtil.py @@ -0,0 +1,265 @@ +# ********************************************************************** +# +# 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 +from Util import * + +class IceGridProcess: + + def __init__(self, replica): + self.replica = replica + + def getProps(self, current): + props = self.getParentProps(current) + testcase = current.testcase + while testcase and not isinstance(testcase, IceGridTestCase): testcase = testcase.parent + if self.replica is None: + props["Ice.Default.Locator"] = testcase.getMasterLocator(current) + else: + for r in testcase.icegridregistry: + # Match either the IceGridRegistrySlave object or the slave replica number + if self.replica in [r, r.name]: + props["Ice.Default.Locator"] = r.getLocator(current) + break + return props + +class IceGridServer(IceGridProcess, Server): + + def __init__(self, replica=None, *args, **kargs): + Server.__init__(self, *args, **kargs) + IceGridProcess.__init__(self, replica) + + getParentProps = Server.getProps # Used by IceGridProcess to get the server properties + +class IceGridClient(IceGridProcess, Client): + + def __init__(self, replica=None, *args, **kargs): + Client.__init__(self, *args, **kargs) + IceGridProcess.__init__(self, replica) + + getParentProps = Client.getProps # Used by IceGridProcess to get the client properties + +class IceGridAdmin(ProcessFromBinDir, IceGridClient): + + def __init__(self, replica=None, username="admin1", password="test1", *args, **kargs): + IceGridClient.__init__(self, replica=replica, exe="icegridadmin", mapping=Mapping.getByName("cpp"), + *args, **kargs) + self.username = username + self.password = password + + def getProps(self, current): + props = IceGridClient.getProps(self, current) + props["IceGridAdmin.Username"] = self.username + props["IceGridAdmin.Password"] = self.password + return props + +class IceGridNode(ProcessFromBinDir, Server): + + def __init__(self, name="localnode", *args, **kargs): + + Server.__init__(self, "icegridnode", mapping=Mapping.getByName("cpp"), desc="IceGrid node " + name, + ready="node", *args, **kargs) + self.name = name + + def setup(self, current): + # Create the database directory + os.mkdir(os.path.join(current.testcase.getPath(), "node-{0}".format(self.name))) + + def teardown(self, current, success): + # Remove the database directory tree + try: + shutil.rmtree(os.path.join(current.testcase.getPath(), "node-{0}".format(self.name))) + except: + pass + + def getProps(self, current): + props = { + 'IceGrid.InstanceName' : 'TestIceGrid', + 'IceGrid.Node.Endpoints' : 'default', + 'IceGrid.Node.WaitTime' : 240, + 'Ice.ProgramName' : 'icegridnode', + 'IceGrid.Node.Trace.Replica' : 0, + 'IceGrid.Node.Trace.Activator' : 0, + 'IceGrid.Node.Trace.Adapter' : 0, + 'IceGrid.Node.Trace.Server' : 0, + 'IceGrid.Node.ThreadPool.SizeWarn' : 0, + 'IceGrid.Node.PrintServersReady' : 'node', + 'IceGrid.Node.Name' : self.name, + 'IceGrid.Node.Data' : '{testdir}/node-{process.name}', + 'IceGrid.Node.PropertiesOverride' : self.getPropertiesOverride(current), + 'Ice.Default.Locator' : current.testcase.getLocator(current), + 'Ice.NullHandleAbort' : 1, + } + return props + + def getEnv(self, current): + # Add environment variable for servers based on the test case mapping. + return Server().getEffectiveEnv(current) + + def getPropertiesOverride(self, current): + # Add properties for servers based on the test case mapping. + props = Server().getEffectiveProps(current, {}) + return ' '.join(["{0}={1}".format(k, val(v, escapeQuotes=True)) for k, v in props.items()]) + + def shutdown(self, current): + current.testcase.runadmin(current, "node shutdown {0}".format(self.name)) + +class IceGridRegistry(ProcessFromBinDir, Server): + + def __init__(self, name, portnum=20, readyCount=5, *args, **kargs): + Server.__init__(self, "icegridregistry", mapping=Mapping.getByName("cpp"), desc="IceGrid registry " + name, + readyCount=readyCount, *args, **kargs) + self.portnum = portnum + self.name = name + + def setup(self, current): + # Create the database directory + os.mkdir(os.path.join(current.testcase.getPath(), "registry-{0}".format(self.name))) + + def teardown(self, current, success): + # Remove the database directory tree + try: + shutil.rmtree(os.path.join(current.testcase.getPath(), "registry-{0}".format(self.name))) + except: + pass + + def getProps(self, current): + props = { + 'IceGrid.InstanceName' : 'TestIceGrid', + 'IceGrid.Registry.PermissionsVerifier' : 'TestIceGrid/NullPermissionsVerifier', + 'IceGrid.Registry.AdminPermissionsVerifier' : 'TestIceGrid/NullPermissionsVerifier', + 'IceGrid.Registry.SSLPermissionsVerifier' : 'TestIceGrid/NullSSLPermissionsVerifier', + 'IceGrid.Registry.AdminSSLPermissionsVerifier' : 'TestIceGrid/NullSSLPermissionsVerifier', + 'IceGrid.Registry.Server.Endpoints' : 'default', + 'IceGrid.Registry.Internal.Endpoints' : 'default', + 'IceGrid.Registry.Client.Endpoints' : self.getEndpoints(current), + 'IceGrid.Registry.Discovery.Interface' : '"::1"' if current.config.ipv6 and isinstance(platform, Darwin) else '', + 'IceGrid.Registry.Discovery.Port' : current.driver.getTestPort(99), + 'IceGrid.Registry.SessionManager.Endpoints' : 'default', + 'IceGrid.Registry.AdminSessionManager.Endpoints' : 'default', + 'IceGrid.Registry.SessionTimeout' : 60, + 'IceGrid.Registry.ReplicaName' : self.name, + 'Ice.ProgramName' : self.name, + 'Ice.PrintAdapterReady' : 1, + 'Ice.Warn.Connections' : 0, + 'Ice.ThreadPool.Client.SizeWarn' : 0, + 'IceGrid.Registry.LMDB.MapSize' : 1, + 'IceGrid.Registry.LMDB.Path' : '{testdir}/registry-{process.name}', + 'IceGrid.Registry.Client.ThreadPool.SizeWarn' : 0, + 'IceGrid.Registry.DefaultTemplates' : + '"' + os.path.abspath(os.path.join(toplevel, "cpp", "config", "templates.xml")) + '"' + } + return props + + def getEndpoints(self, current): + return current.getTestEndpoint(self.portnum) + + def getLocator(self, current): + return "TestIceGrid/Locator:{0}".format(self.getEndpoints(current)) + + def shutdown(self, current): + current.testcase.runadmin(current, "registry shutdown {0}".format(self.name), replica=self.name) + +class IceGridRegistryMaster(IceGridRegistry): + + def __init__(self, portnum=20, *args, **kargs): + IceGridRegistry.__init__(self, "Master", portnum, *args, **kargs) + +class IceGridRegistrySlave(IceGridRegistry): + + def __init__(self, replica=1, portnum=None, *args, **kargs): + IceGridRegistry.__init__(self, "Slave{0}".format(replica), (20 + replica) if portnum is None else portnum, + *args, **kargs) + + def getProps(self, current): + props = IceGridRegistry.getProps(self, current) + props["Ice.Default.Locator"] = current.testcase.getMasterLocator(current) + return props + +class IceGridTestCase(TestCase): + + def __init__(self, name="IceGrid", icegridregistry=None, icegridnode=None, application="application.xml", + variables={}, targets=[], exevars={}, *args, **kargs): + TestCase.__init__(self, name, *args, **kargs) + if icegridnode: + self.icegridnode = icegridnode if isinstance(icegridnode, list) else [icegridnode] + else: + self.icegridnode = [IceGridNode()] + + if icegridregistry: + self.icegridregistry = icegridregistry if isinstance(icegridregistry, list) else [icegridregistry] + else: + self.icegridregistry = [IceGridRegistryMaster(), IceGridRegistrySlave(1)] + + self.application = application + self.variables = variables + self.targets = targets + + # Variables for built executables + self.exevars = { "server.dir" : "server" } + self.exevars.update(exevars) + + def init(self, mapping, testsuite): + TestCase.init(self, mapping, testsuite) + + # + # Add IceGrid servers at the begining of the server list, IceGrid needs to be + # started first! + # + self.servers = self.icegridregistry + self.icegridnode + self.servers + + def setupClientSide(self, current): + if self.application: + javaHome = os.environ.get("JAVA_HOME", None) + serverProps = Server().getProps(current) + variables = { + "test.dir" : self.getPath(), + "ice.bindir" : self.mapping.getBinDir(current), + "java.exe" : os.path.join(javaHome, "bin", "java") if javaHome else "java", + "icebox.exe" : IceBox().getCommandLine(current), + "icegridnode.exe" : IceGridNode().getCommandLine(current), + "icegridregistry.exe" : IceGridRegistryMaster().getCommandLine(current), + "properties-override" : self.icegridnode[0].getPropertiesOverride(current) + } + + # Add variables that point to the directories containing the built executables + for (k, v) in self.exevars.items(): + variables[k] = current.getBuildDir(v) + + variables.update(self.variables) + varStr = " ".join(["{0}={1}".format(k, val(v, True)) for k,v in variables.items()]) + targets = " ".join(self.targets) + self.runadmin(current, "application add -n {0} {1} {2}".format(self.application, varStr, targets)) + + def teardownClientSide(self, current, success): + if self.application: + self.runadmin(current, "application remove Test") + + for p in self.icegridnode + self.icegridregistry: + p.shutdown(current) + + def getLocator(self, current): + endpoints = ":".join([s.getEndpoints(current) for s in self.servers if isinstance(s, IceGridRegistry)]) + return "TestIceGrid/Locator:{0}".format(endpoints) + + def getMasterLocator(self, current): + for s in self.servers: + if isinstance(s, IceGridRegistryMaster): + return "TestIceGrid/Locator:{0}".format(s.getEndpoints(current)) + + def runadmin(self, current, cmd, replica="Master", exitstatus=0, quiet=False): + admin = IceGridAdmin(args=["-r", replica, "-e", cmd], replica=replica, quiet=quiet) + admin.run(current, exitstatus=exitstatus) + return admin.getOutput() + + def runWithDriver(self, current): + current.driver.runClientServerTestCase(current) + + def getClientType(self): + return "client" diff --git a/scripts/IcePatch2Util.py b/scripts/IcePatch2Util.py new file mode 100644 index 00000000000..1a7fda7ca83 --- /dev/null +++ b/scripts/IcePatch2Util.py @@ -0,0 +1,15 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +from Util import * + +class IcePatch2Calc(ProcessFromBinDir, Process): + + def __init__(self, *args, **kargs): + Process.__init__(self, exe="icepatch2calc", mapping=Mapping.getByName("cpp"), *args, **kargs) diff --git a/scripts/IceStormUtil.py b/scripts/IceStormUtil.py index a619fe5809c..7aeb5ddd775 100644 --- a/scripts/IceStormUtil.py +++ b/scripts/IceStormUtil.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - # ********************************************************************** # # Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. @@ -9,254 +7,223 @@ # # ********************************************************************** -import os, sys -import TestUtil +import sys, os +from Util import * -global testdir -global toplevel +class IceStorm(ProcessFromBinDir, Server): -origIceBoxService = ' --Ice.Admin.Endpoints="default -p {0}"' + \ - ' --Ice.Admin.InstanceName=IceBox{0}' + \ - ' --Ice.Default.Locator=' + def __init__(self, instanceName="IceStorm", replica=0, nreplicas=0, transient=False, portnum=0, *args, **kargs): + Server.__init__(self, exe="icebox", ready="IceStorm", mapping=Mapping.getByName("cpp"), *args, **kargs) + self.portnum = portnum + self.replica = replica + self.nreplicas = nreplicas + self.transient = transient + self.instanceName = instanceName + self.desc = self.instanceName if self.nreplicas == 0 else "{0} replica #{1}".format(self.instanceName, + self.replica) + + def setup(self, current): + # Create the database directory + os.mkdir(os.path.join(current.testcase.getPath(), "{0}-{1}.db".format(self.instanceName, self.replica))) + + def teardown(self, current, success): + # Remove the database directory tree + try: + shutil.rmtree(os.path.join(current.testcase.getPath(), "{0}-{1}.db".format(self.instanceName, self.replica))) + except: + pass + + def getProps(self, current): + props = Server.getProps(self, current) + + # Default properties + props.update({ + 'IceBox.Service.IceStorm' : 'IceStormService,' + getIceSoVersion() + ':createIceStorm', + 'IceBox.PrintServicesReady' : 'IceStorm', + 'IceBox.InheritProperties' : 1, + 'IceStorm.InstanceName' : self.instanceName, + 'Ice.Admin.InstanceName' : 'IceBox', + 'Ice.Warn.Dispatch' : 0, + 'Ice.Warn.Connections' : 0, + 'IceStorm.LMDB.MapSize' : 1, + 'IceStorm.LMDB.Path' : '{testdir}/{process.instanceName}-{process.replica}.db', + }) + + if self.nreplicas > 0: + props['IceStorm.NodeId'] = self.replica -origIceBoxEndpoints = ' --IceBoxAdmin.ServiceManager.Proxy="IceBox{0}/admin -f IceBox.ServiceManager: default -p {0}"' + if self.transient: + props["IceStorm.Transient"] = 1 + + # + # Add endpoint properties here as these properties depend on the worker thread running the + # the test case for the port number. The port number is computed by the driver based on a + # fixed portnum index for each IceStorm endpoint (portnum = 0 for the topic manager endpoint, + # portnum=1 for the publish endpoint, portnum=2 for the node endpoint and portnum=3 for the + # icebox admin endpoint). + # + + # Manager, publish, node and admin ndpoints for given replica number + manager = lambda replica: current.getTestEndpoint(self.portnum + replica * 4 + 0) + publish = lambda replica: "{0}:{1}".format(current.getTestEndpoint(self.portnum + replica * 4 + 1), + current.getTestEndpoint(self.portnum + replica * 4 + 1, "udp")) + node = lambda replica: current.getTestEndpoint(self.portnum + replica * 4 + 2) + admin = lambda replica: current.getTestEndpoint(self.portnum + replica * 4 + 3) + + # The endpoints for the given replica + props.update({ + "IceStorm.TopicManager.Endpoints" : manager(self.replica), + "IceStorm.Publish.Endpoints" : publish(self.replica), + "Ice.Admin.Endpoints" : admin(self.replica), + }) + + # Compute the node and replicated endpoints to be configured for each replica + if self.nreplicas > 0: + props['IceStorm.Node.Endpoints'] = node(self.replica) + for i in range(0, self.nreplicas): + props["IceStorm.Nodes.{0}".format(i)] = "{2}/node{0}:{1}".format(i, node(i), self.instanceName) + props['IceStorm.ReplicatedTopicManagerEndpoints'] = ":".join([manager(i) for i in range(0, self.nreplicas)]) + props['IceStorm.ReplicatedPublishEndpoints'] = ":".join([publish(i) for i in range(0, self.nreplicas)]) + + return props + + def getInstanceName(self): + return self.instanceName + + def getTopicManager(self, current): + # Return the endpoint for this IceStorm replica + return "{1}/TopicManager:{0}".format(current.getTestEndpoint(self.portnum + self.replica * 4), self.instanceName) + + def getReplicatedTopicManager(self, current): + # Return the replicated endpoints for IceStorm + if self.nreplicas == 0: + return self.getTopicManager(current) + manager = lambda replica: current.getTestEndpoint(self.portnum + replica * 4) + return "{1}/TopicManager:{0}".format(":".join([manager(i) for i in range(0, self.nreplicas)]), self.instanceName) + + def shutdown(self, current): + # Shutdown this replica by connecting to the IceBox service manager with iceboxadmin + endpoint = current.getTestEndpoint(self.portnum + self.replica * 4 + 3) + props = { "IceBoxAdmin.ServiceManager.Proxy" : "IceBox/admin -f IceBox.ServiceManager:" + endpoint } + IceBoxAdmin().run(current, props=props, args=['shutdown']) + +class IceStormProcess: + + def __init__(self, instanceName=None, instance=None): + self.instanceName = instanceName + self.instance = instance + + def getProps(self, current): + + # + # An IceStorm client is provided with the IceStormAdmin.TopicManager.Default property set + # to the "instance" topic manager proxy if "instance" is set. Otherwise, if a single it's + # set to the replicated topic manager if a specific "instance name" is provided or there's + # only one IceStorm instance name deployed. If IceStorm multiple instance names are set, + # the client is given an IceStormAdmin.<instance name> property for each instance containing + # the replicated topic manager proxy. + # + + props = self.getParentProps(current) + testcase = current.testcase + while testcase and not isinstance(testcase, IceStormTestCase): testcase = testcase.parent + if self.instance: + props["IceStormAdmin.TopicManager.Default"] = self.instance.getTopicManager(current) + else: + instanceNames = [self.instanceName] if self.instanceName else testcase.getInstanceNames() + if len(instanceNames) == 1: + props["IceStormAdmin.TopicManager.Default"] = testcase.getTopicManager(current, instanceNames[0]) + else: + for name in instanceNames: + props["IceStormAdmin.TopicManager.{0}".format(name)] = testcase.getTopicManager(current, name) + return props -# Turn off the dispatch and connection warnings -- they are expected -# when using a replicated IceStorm. -origIceStormService = ' --IceBox.Service.IceStorm=IceStormService,' + TestUtil.getIceSoVersion() + ':createIceStorm' + \ - ' --IceStorm.TopicManager.Endpoints="default -p %d"' + \ - ' --IceBox.PrintServicesReady=IceStorm' + \ - ' --IceBox.InheritProperties=1' + \ - ' --Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0' + \ - ' --Ice.ServerIdleTime=0' +class IceStormAdmin(ProcessFromBinDir, IceStormProcess, Client): -origIceStormProxy = '%s/TopicManager:default -p %d' + def __init__(self, instanceName=None, instance=None, *args, **kargs): + Client.__init__(self, exe="icestormadmin", mapping=Mapping.getByName("cpp"), *args, **kargs) + IceStormProcess.__init__(self, instanceName, instance) -origIceStormReference = ' --IceStormAdmin.TopicManager.Default="%s"' + getParentProps = Client.getProps # Used by IceStormProcess to get the client properties -class IceStormUtil(object): - def __init__(self, toplevel, testdir): - self.toplevel = toplevel - self.testdir = testdir - self.iceBox = TestUtil.getIceBox() - self.iceBoxAdmin = os.path.join(TestUtil.getCppBinDir(), "iceboxadmin") - self.iceStormAdmin = os.path.join(TestUtil.getCppBinDir(), "icestormadmin") +class Subscriber(IceStormProcess, Server): - def runIceBoxAdmin(self, endpts, command): - proc = TestUtil.startClient(self.iceBoxAdmin, endpts + " " + command, echo = False) - proc.waitTestSuccess() - return proc.buf + processType = "subscriber" - def admin(self, cmd, **args): - self.adminWithRef(self.iceStormReference, cmd, **args) + def __init__(self, instanceName=None, instance=None, *args, **kargs): + Server.__init__(self, *args, **kargs) + IceStormProcess.__init__(self, instanceName, instance) - def adminWithRef(self, ref, cmd, expect = None): - proc = TestUtil.startClient(self.iceStormAdmin, ref + r' -e "%s"' % cmd, echo = False) - if expect: - proc.expect(expect) - proc.wait() - else: - proc.waitTestSuccess() - - def reference(self): - return self.iceStormReference - def proxy(self): - return self.iceStormProxy - -class Replicated(IceStormUtil): - def __init__(self, toplevel, testdir, - additional = None, - replicatedPublisher = True, - dbDir = "db", - instanceName="IceStorm", port = 12010): - IceStormUtil.__init__(self, toplevel, testdir) - self.procs = [] - self.nendpoints = [] # Node endpoints - self.instanceName = instanceName - self.ibendpoints = [] # IceBox endpoints - self.isendpoints = [] # TopicManager endpoints - self.ipendpoints = [] # Publisher endpoints - for replica in range(0, 3): - self.nendpoints.append(port + 100 + replica * 10) - self.ibendpoints.append(port + replica * 10) - self.isendpoints.append(port + (replica * 10)+1) - self.ipendpoints.append(port + (replica * 10)+2) - replicaProperties = "" - sep ='' - replicaTopicManagerEndpoints = '' - replicaPublishEndpoints = '' - for replica in range(0, 3): - replicaProperties = replicaProperties + \ - ' --IceStorm.Nodes.%d="%s/node%d:default -t 10000 -p %d"' % ( - replica, instanceName, replica, self.nendpoints[replica]) - replicaTopicManagerEndpoints = replicaTopicManagerEndpoints + "%sdefault -p %d" % ( - sep, self.isendpoints[replica]) - replicaPublishEndpoints = replicaPublishEndpoints + "%sdefault -p %d" % (sep, self.ipendpoints[replica]) - sep = ':' - replicaProperties = replicaProperties + \ - ' --IceStorm.NodeId=%d --IceStorm.Node.Endpoints="default -p %d"' + \ - ' --IceStorm.ReplicatedTopicManagerEndpoints="' +\ - replicaTopicManagerEndpoints + '"' - if replicatedPublisher: - replicaProperties = replicaProperties + \ - ' --IceStorm.ReplicatedPublishEndpoints="' + replicaPublishEndpoints + '"' - self.iceBoxEndpoints = [] - self.iceBoxAdminEndpoints = [] - self.iceStormEndpoints = [] - self.replicaProperties = [] - self.dbHome= [] - self.iceStormDBEnv= [] - self.procs = [] - for replica in range(0, 3): - self.iceBoxEndpoints.append(origIceBoxService.format(self.ibendpoints[replica])) - self.iceBoxAdminEndpoints.append(origIceBoxEndpoints.format(self.ibendpoints[replica])) - service = origIceStormService % self.isendpoints[replica] - service = service + ' --IceStorm.Publish.Endpoints="default -p %d:udp -p %d"' % ( - self.ipendpoints[replica], self.ipendpoints[replica]) - if instanceName: - service = service + ' --IceStorm.InstanceName=%s ' % instanceName - #service = service + ' --IceStorm.Trace.Election=1' - #service = service + ' --IceStorm.Trace.Replication=1' - #service = service + ' --IceStorm.Trace.Subscriber=1' - #service = service + ' --IceStorm.Trace.Topic=1' - #service = service + ' --Ice.Trace.Network=3' - #service = service + ' --Ice.Trace.Protocol=1' - if additional: - service = service + " " + additional - self.iceStormEndpoints.append(service) - self.replicaProperties.append(replicaProperties % (replica, self.nendpoints[replica])) - dbHome = os.path.join(self.testdir, "%d.%s" % (replica, dbDir)) - self.dbHome.append(dbHome) - TestUtil.cleanDbDir(dbHome) - - self.iceStormDBEnv.append(' --IceStorm.LMDB.MapSize=1 --IceStorm.LMDB.Path="%s"' % dbHome) - self.procs.append(None) - - topicReplicaProxy = '%s/TopicManager:%s' % (instanceName, replicaTopicManagerEndpoints) - self.iceStormProxy = topicReplicaProxy - self.iceStormReference = ' --IceStormAdmin.TopicManager.Default="%s"' % topicReplicaProxy - - def adminForReplica(self, replica, cmd, expect = None, **args): - ep = self.isendpoints[replica] - proxy = origIceStormProxy % (self.instanceName, self.isendpoints[replica]) - ref = origIceStormReference % proxy - self.adminWithRef(ref, cmd, expect, **args) - - def clean(self): - for replica in range(0, 3): - TestUtil.cleanDbDir(self.dbHome[replica]) - - def start(self, echo = True, **args): - if echo: - sys.stdout.write("starting icestorm replicas... ") - sys.stdout.flush() - # Start replicas. - for replica in range(0, 3): - if echo: - sys.stdout.write(str(replica) + " ") - sys.stdout.flush() - self.startReplica(replica, echo=False, **args) - if echo: - print("ok") - - def startReplica(self, replica, echo = True, additionalOptions = ""): - if echo: - sys.stdout.write("starting icestorm replica %d..." % replica + " ") - sys.stdout.flush() - - proc = TestUtil.startServer(self.iceBox, - self.iceBoxEndpoints[replica] + - self.iceStormEndpoints[replica] + - self.replicaProperties[replica] + - self.iceStormDBEnv[replica] + - additionalOptions, - adapter = "IceStorm", - echo = False) - self.procs[replica] = proc - if echo: - print("ok") - - def stop(self): - for replica in range(0, 3): - self.stopReplica(replica) - - def stopReplica(self, replica): - if self.procs[replica]: - self.runIceBoxAdmin(self.iceBoxAdminEndpoints[replica], "shutdown") - self.procs[replica].waitTestSuccess() - self.procs[replica] = None - - def reference(self, replica=-1): - if replica == -1: - return self.iceStormReference - ep = self.isendpoints[replica] - proxy = origIceStormProxy % (self.instanceName, self.isendpoints[replica]) - return origIceStormReference % proxy - -class NonReplicated(IceStormUtil): - def __init__(self, toplevel, testdir, transient, \ - additional = None, dbDir = "db", instanceName=None, port = 12010): - IceStormUtil.__init__(self, toplevel, testdir) - iceBoxPort = port - iceStormPort = port + 1 - publisherPort = port + 2 - self.iceBoxService = origIceBoxService.format(iceBoxPort) - self.iceBoxEndpoints = origIceBoxEndpoints.format(iceBoxPort) - self.iceStormService = origIceStormService % (iceStormPort) - self.dbDir = dbDir - - if instanceName: - self.iceStormService = self.iceStormService + ' --IceStorm.InstanceName=%s ' % instanceName - else: - instanceName = "IceStorm" + getParentProps = Server.getProps # Used by IceStormProcess to get the server properties - if publisherPort: - self.iceStormService = self.iceStormService + ' --IceStorm.Publish.Endpoints="default -p %d:udp -p %d"' % ( - publisherPort, publisherPort) - else: - self.iceStormService = self.iceStormService + ' --IceStorm.Publish.Endpoints="default:udp"' - self.transient = transient - if self.transient: - self.iceStormService = self.iceStormService + " --IceStorm.Transient=1" - if additional: - self.iceStormService = self.iceStormService + " " + additional - self.iceStormProxy = origIceStormProxy % (instanceName, iceStormPort) - self.iceStormReference = origIceStormReference % self.iceStormProxy +class Publisher(IceStormProcess, Client): - self.dbHome = os.path.join(self.testdir, self.dbDir) - TestUtil.cleanDbDir(self.dbHome) + processType = "publisher" - self.iceStormDBEnv = ' --IceStorm.LMDB.MapSize=1 --IceStorm.LMDB.Path="%s"' % self.dbHome + def __init__(self, instanceName=None, instance=None, *args, **kargs): + Client.__init__(self, *args, **kargs) + IceStormProcess.__init__(self, instanceName, instance) - def clean(self): - TestUtil.cleanDbDir(self.dbHome) + getParentProps = Client.getProps # Used by IceStormProcess to get the client properties - def start(self, echo = True, additionalOptions = ""): - if echo: - if self.transient: - sys.stdout.write("starting transient icestorm service... ") - else: - sys.stdout.write("starting icestorm service... ") - sys.stdout.flush() - - self.proc = TestUtil.startServer(self.iceBox, - self.iceBoxService + - self.iceStormService + - self.iceStormDBEnv + - additionalOptions, adapter = "IceStorm", - echo = False) - if echo: - print("ok") - return self.proc - - def stop(self): - self.runIceBoxAdmin(self.iceBoxEndpoints, "shutdown") - self.proc.waitTestSuccess() - -def init(toplevel, testdir, type, **args): - if type == "replicated": - return Replicated(toplevel, testdir, **args) - if type == "transient": - return NonReplicated(toplevel, testdir, True, **args) - return NonReplicated(toplevel, testdir, False, **args) +class IceStormTestCase(TestCase): + + def __init__(self, name, icestorm, *args, **kargs): + TestCase.__init__(self, name, *args, **kargs) + self.icestorm = icestorm if isinstance(icestorm, list) else [icestorm] + + def init(self, mapping, testsuite): + TestCase.init(self, mapping, testsuite) + + # + # Add icestorm servers at the begining of the server list, IceStorm needs to be + # started first! + # + self.servers = self.icestorm + self.servers + + def runWithDriver(self, current): + current.driver.runClientServerTestCase(current) + + def startIceStorm(self, current): + for icestorm in self.icestorm: + icestorm.start(current) + + def stopIceStorm(self, current): + self.shutdown(current) + for icestorm in self.icestorm: + icestorm.stop(current, True) + + def restartIceStorm(self, current): + self.stopIceStorm(current) + self.startIceStorm(current) + + def shutdown(self, current): + for icestorm in self.icestorm: + icestorm.shutdown(current) + + def runadmin(self, current, cmd, instanceName=None, instance=None, exitstatus=0, quiet=False): + admin = IceStormAdmin(instanceName, instance, args=["-e", cmd], quiet=quiet) + admin.run(current, exitstatus=exitstatus) + return admin.getOutput() + + def getTopicManager(self, current, instanceName=None): + if not instanceName: + # Return the topic manager proxy from the first IceStorm server + return self.icestorm[0].getReplicatedTopicManager(current) + + # + # Otherwise, search for an IceStorm server with the given instance + # name and return its replicated topic manager proxy + # + for s in self.icestorm: + if s.getInstanceName() == instanceName: + return s.getReplicatedTopicManager(current) + + def getInstanceNames(self): + # Return the different IceStorm instance names deployed with this + # test case + names = set() + for s in self.icestorm: + names.add(s.getInstanceName()) + return list(names) diff --git a/scripts/LocalDriver.py b/scripts/LocalDriver.py new file mode 100644 index 00000000000..c723444683e --- /dev/null +++ b/scripts/LocalDriver.py @@ -0,0 +1,521 @@ +# ********************************************************************** +# +# 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 +from Util import * + +# +# The Executor class runs testsuites on multiple worker threads. +# +class Executor: + + def __init__(self, threadlocal, workers, continueOnFailure): + self.threadlocal = threadlocal + self.workers = workers - 1 + self.queue = [] + self.mainThreadQueue = [] + self.queueLength = 0 + self.failure = False + self.continueOnFailure = continueOnFailure + self.lock = threading.Lock() + + def submit(self, testsuite): + if testsuite.isMainThreadOnly() or self.workers == 0: + self.mainThreadQueue.append(testsuite) + else: + self.queue.append(testsuite) + self.queueLength += 1 + + def get(self, total, mainThread=False): + with self.lock: + if self.failure: + return None + queue = self.mainThreadQueue if mainThread else self.queue + if len(queue) == 0: + return None + self.queueLength -= 1 + return (queue.pop(0), total - self.queueLength) + + def runTestSuites(self, driver, total, results, mainThread=False): + while True: + item = self.get(total, mainThread) + if not item: + results.put(None) # Notify the main thread that there are not more tests to run + break + + (testsuite, index) = item + result = Result(testsuite, not driver.isWorkerThread()) + current = LocalDriver.Current(driver, testsuite, result, index, total) + try: + testsuite.run(current) + except KeyboardInterrupt: + raise + except: + print(traceback.format_exc()) + pass + results.put((result, mainThread)) + if not result.isSuccess() and not self.continueOnFailure: + with self.lock: self.failure = True + + def runUntilCompleted(self, driver, start): + if self.queueLength == 0: + return [] + + total = self.queueLength + if self.workers == 0 and start > 0: + for i in range(1, start): + if len(self.mainThreadQueue) == 0: + break + self.mainThreadQueue.pop(0) + self.queueLength -= 1 + + # + # Worker threads dequeue and run testsuites. They push resuts to the results + # queue. The thread stops when there are no more testsuite to dequeue. + # + resultList = [] + results = queue.Queue() + def worker(num): + self.threadlocal.num = num + try: + self.runTestSuites(driver, total, results) + except Exception as ex: + print("unexpected exception raised from worker thread:\n" + str(ex)) + results.put(None) # Notify the main thread that we're done + + # + # Start the worker threads + # + threads=[] + for i in range(min(self.workers, total)): + t = threading.Thread(target=worker, args=[i]) + t.start() + threads.append(t) + + try: + # + # Run the main thread testsuites. + # + self.runTestSuites(driver, total, results, True) + + # + # Dequeue results and print out the testuite output for each test. + # + count = len(threads) + 1 + while count > 0: + try: + r = results.get(timeout=1) + if not r: + count -= 1 + continue + except queue.Empty: + continue + + (result, mainThread) = r + resultList.append(result) + if not mainThread: + sys.stdout.write(result.getOutput()) + except KeyboardInterrupt: + with self.lock: + self.failure = True + if threads: + print("Terminating (waiting for worker threads to terminate)...") + raise + finally: + # + # Wait for worker threads to be done. + # + for t in threads: + t.join() + + # + # Print out remaining testsuites. + # + try: + while True: + r = results.get_nowait() + if r: + (result, mainThread) = r + resultList.append(result) + if not mainThread: + sys.stdout.write(result.getOutput()) + except queue.Empty: + pass + + return resultList + +# +# Runner to run the test cases locally. +# +class TestCaseRunner: + + def filterOptions(self, options): + return options + + def startServerSide(self, testcase, current): + testcase._startServerSide(current) + + def stopServerSide(self, testcase, current, success): + testcase._stopServerSide(current, success) + + def runClientSide(self, testcase, current): + testcase._runClientSide(current) + + def destroy(self): + pass + +# +# Runner to run the test cases remotely with the controller (requires IcePy) +# +class RemoteTestCaseRunner(TestCaseRunner): + + def __init__(self, clientPrx, serverPrx, interface): + import Ice + Ice.loadSlice(os.path.join(toplevel, "scripts", "Controller.ice")) + import Test + + initData = Ice.InitializationData() + initData.properties = Ice.createProperties() + initData.properties.setProperty("Ice.Plugin.IceDiscovery", "IceDiscovery:createIceDiscovery") + initData.properties.setProperty("IceDiscovery.DomainId", "TestController") + if interface: + initData.properties.setProperty("IceDiscovery.Interface", interface) + initData.properties.setProperty("Ice.Default.Host", interface) + self.communicator = Ice.initialize(initData) + try: + if clientPrx: + self.clientController = self.communicator.stringToProxy(clientPrx) + self.clientController = Test.Common.ControllerPrx.checkedCast(self.clientController) + self.clientOptions = self.clientController.getOptionOverrides() + else: + self.clientController = None + self.clientOptions = {} + + if serverPrx: + self.serverController = self.communicator.stringToProxy(serverPrx) + self.serverController = Test.Common.ControllerPrx.checkedCast(self.serverController) + self.serverOptions = self.serverController.getOptionOverrides() + else: + self.serverController = None + self.serverOptions = {} + except: + self.communicator.destroy() + raise + + def filterOptions(self, options): + import Ice + options = options.copy() + for (key, values) in options.items(): + for opts in [self.serverOptions, self.clientOptions]: + if hasattr(opts, key) and getattr(opts, key) is not Ice.Unset: + options[key] = [v for v in values if v in getattr(opts, key)] + return options + + def startServerSide(self, testcase, current): + if not self.serverController: + TestCaseRunner.startServerSide(self, testcase, current) + return + + import Test + current.serverTestCase = self.serverController.runTestCase(str(testcase.getMapping()), + testcase.getTestSuite().getId(), + testcase.getName()) + try: + try: + current.host = current.serverTestCase.startServerSide(self.getConfig(current)) + except Test.Common.TestCaseFailedException as ex: + current.result.writeln(ex.output) + raise RuntimeError("test failed") + except: + current.serverTestCase.destroy() + current.serverTestCase = None + raise + + def stopServerSide(self, testcase, current, success): + if not self.serverController: + TestCaseRunner.stopServerSide(self, testcase, current, success) + return + + import Test + try: + current.result.write(current.serverTestCase.stopServerSide(success)) + current.host = None + except Test.Common.TestCaseFailedException as ex: + current.result.writeln(ex.output) + raise RuntimeError("test failed") + finally: + current.serverTestCase = None + + def runClientSide(self, testcase, current): + import Test + if not self.clientController: + TestCaseRunner.runClientSide(self, testcase, current) + return + + clientTestCase = self.clientController.runTestCase(str(testcase.getMapping()), + testcase.getTestSuite().getId(), + testcase.getName()) + try: + current.result.write(clientTestCase.runClientSide(self.getConfig(current))) + except Test.Common.TestCaseFailedException as ex: + current.result.writeln(ex.output) + raise RuntimeError("test failed") + finally: + clientTestCase.destroy() + + def destroy(self): + self.communicator.destroy() + + def getConfig(self, current): + import Test + return Test.Common.Config(current.config.protocol, + current.config.mx, + current.config.serialize, + current.config.compress, + current.config.ipv6) + +class LocalDriver(Driver): + + class Current(Driver.Current): + + def __init__(self, driver, testsuite, result, index, total): + Driver.Current.__init__(self, driver, testsuite, result) + self.index = index + self.total = total + + @classmethod + def getOptions(self): + return ("", ["cross=", "workers=", "continue", "loop", "start=", "all", "all-cross", "host=", + "client=", "server=", "interface="]) + + @classmethod + def usage(self): + print("") + print("Local driver options:") + print("--cross=<mapping> Run with servers from given mapping.") + print("--workers=<count> The number of worker threads to run the tests.") + print("--start=<index> Start running the tests at the given index.") + print("--loop Run the tests in a loop.") + print("--continue Don't stop on failures.") + print("--all Run all sensible permutations of the tests.") + print("--all-cross Run all sensible permutations of cross language tests.") + print("--client=<proxy> The endpoint of the controller to run the client side.") + print("--server=<proxy> The endpoint of the controller to run the server side.") + print("--interface=<IP> The multicast interface to use to discover client/server controllers.") + + def __init__(self, options, *args, **kargs): + Driver.__init__(self, options, *args, **kargs) + + self.cross = "" + self.allCross = False + self.workers = 1 + self.continueOnFailure = False + self.loop = False + self.start = 0 + self.all = False + + self.clientCtlPrx = "" + self.serverCtlPrx = "" + self.interface = "" + + parseOptions(self, options, { "continue" : "continueOnFailure", + "l" : "loop", + "all-cross" : "allCross", + "client" : "clientCtlPrx", + "server" : "serverCtlPrx" }) + + if self.cross: + self.cross = Mapping.getByName(self.cross) + if not self.cross: + raise RuntimeError("unknown mapping `{0}' for --cross option".format(self.cross)) + + self.results = [] + self.threadlocal = threading.local() + + if self.clientCtlPrx or self.serverCtlPrx: + self.runner = RemoteTestCaseRunner(self.clientCtlPrx, self.serverCtlPrx, self.interface) + else: + self.runner = TestCaseRunner() + + def run(self, mappings): + while True: + executor = Executor(self.threadlocal, self.workers, self.continueOnFailure) + for mapping in mappings: + testsuites = mapping.getTestSuites() + + # + # Sort the test suites to run tests in the following order. + # + runOrder = mapping.getRunOrder() + def testsuiteKey(testsuite): + for k in runOrder: + if testsuite.getId().startswith(k + os.sep): + return testsuite.getId().replace(k, str(runOrder.index(k))) + return testsuite.getId() + testsuites = sorted(testsuites, key=testsuiteKey) + + # + # Create the executor to run the test suites on multiple workers thread is requested. + # + for testsuite in testsuites: + if mapping.filterTestSuite(testsuite.getId(), self.filters, self.rfilters): + continue + if testsuite.getId() == "Ice/echo": + continue + elif (self.cross or self.allCross) and not testsuite.isCross(): + continue + elif self.allCross and not testsuite.isAllCross(): + continue + elif isinstance(self.runner, RemoteTestCaseRunner) and not testsuite.isMultiHost(): + continue + executor.submit(testsuite) + + # + # Run all the tests and wait for the executor to complete. + # + now = time.time() + + results = executor.runUntilCompleted(self, self.start) + + failures = [r for r in results if not r.isSuccess()] + m, s = divmod(time.time() - now, 60) + print("") + if m > 0: + print("Ran {0} tests in {1} minutes {2:02.2f} seconds".format(len(results), m, s)) + else: + print("Ran {0} tests in {1:02.2f} seconds".format(len(results), s)) + if(len(failures) > 0): + print("{0} suceeded and {1} failed:".format(len(results) - len(failures), len(failures))) + for r in failures: + print("- {0}".format(r.testsuite)) + for (c, ex) in r.getFailed().items(): + lines = r.getOutput(c).strip().split('\n') + for i in range(0, min(4, len(lines))): + print(" " + lines[i]) + if len(lines) > 4: + print(" [...]") + for i in range(max(4, len(lines) - 8), len(lines)): + print(" " + lines[i]) + + else: + print("{0} suceeded".format(len(results))) + + if not self.loop: + break + + def destroy(self): + self.runner.destroy() + self.runner = None + + def runTestSuite(self, current): + current.result.writeln("*** [{0}/{1}] Running {2}/{3} tests ***".format(current.index, + current.total, + current.testsuite.getMapping(), + current.testsuite)) + success = False + try: + current.testsuite.setup(current) + for testcase in current.testsuite.getTestCases(): + config = current.config + try: + for conf in current.config.getAll(current, testcase) if self.all else [current.config]: + current.config = conf + testcase.run(current) + finally: + current.config = config + success = True + finally: + current.testsuite.teardown(current, success) + + def runClientServerTestCase(self, current): + + if current.testcase.getParent(): + success = False + current.testcase._startServerSide(current) + try: + current.testcase._runClientSide(current) + success = True + finally: + current.testcase._stopServerSide(current, success) + return + + client = current.testcase.getClientTestCase() + for cross in (Mapping.getAll() if self.allCross else [self.cross]): + + # Only run cross tests with allCross + if self.allCross and cross == current.testcase.getMapping(): + continue + + # If the given mapping doesn't support server-side, skip this mapping. + if cross and cross != cross.getServerMapping(): + continue + + # Skip if the mapping doesn't provide the test case. + server = current.testcase.getServerTestCase(cross) + if not server: + continue + + current.writeln("[ running {0} test ]".format(current.testcase)) + confStr = str(current.config) + if confStr: + current.writeln("- Config: {0}".format(confStr)) + if cross: + current.writeln("- Mappings: {0}/{1}".format(client.getMapping(), server.getMapping())) + + if not current.config.canRun(current): + current.writeln("skipped, not supported with this configuration") + return + + success = False + self.runner.startServerSide(server, current) + try: + self.runner.runClientSide(client, current) + success = True + finally: + self.runner.stopServerSide(server, current, success) + + def runTestCase(self, current): + if not self.cross and not self.allCross: + if not current.testcase.getParent(): + current.writeln("[ running {0} test ]".format(current.testcase)) + confStr = str(current.config) + if confStr: + current.writeln("- Config: {0}".format(confStr)) + if not current.config.canRun(current): + current.writeln("skipped, not supported with this configuration") + return + current.testcase._runClientSide(current) + + def isWorkerThread(self): + return hasattr(self.threadlocal, "num") + + def getTestPort(self, portnum): + # Return a port number in the range 14100-14199 for the first thread, 14200-14299 for the + # second thread, etc. + assert(portnum < 100) + baseport = 14000 + self.threadlocal.num * 100 if hasattr(self.threadlocal, "num") else 12010 + return baseport + portnum + + def getProps(self, process, current): + props = Driver.getProps(self, process, current) + if isinstance(process, IceProcess): + if current.host: + props["Ice.Default.Host"] = current.host + # Ice process from the bin directory don't support Test.BasePort + if not process.isFromBinDir() and hasattr(self.threadlocal, "num"): + props["Test.BasePort"] = 14000 + self.threadlocal.num * 100 + return props + + def getMappings(self): + return Mapping.getAll() if self.allCross else [self.cross] if self.cross else [] + + def filterOptions(self, testcase, options): + return self.runner.filterOptions(options) + +Driver.add("local", LocalDriver) diff --git a/scripts/NetworkProxy.py b/scripts/NetworkProxy.py index 93cc0a7328a..d161f775f9e 100644 --- a/scripts/NetworkProxy.py +++ b/scripts/NetworkProxy.py @@ -77,19 +77,29 @@ class BaseProxy(threading.Thread): threading.Thread.__init__(self) self.port = port self.closed = False - self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + self.cond = threading.Condition() + self.socket = None self.connections = [] atexit.register(self.terminate) self.setDaemon(True) self.start() + with self.cond: + while not self.socket: + self.cond.wait() def createConnection(self): return None def run(self): - self.socket.bind(("127.0.0.1", self.port)) - self.socket.listen(1) + with self.cond: + self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + if hasattr(socket, "SO_REUSEPORT"): + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) + self.socket.bind(("127.0.0.1", self.port)) + self.socket.listen(1) + self.cond.notify() + try: while not self.closed: incoming, peer = self.socket.accept() @@ -110,6 +120,7 @@ class BaseProxy(threading.Thread): c.close() except Exception as ex: print(ex) + connectToSelf = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: connectToSelf.connect(("127.0.0.1", self.port)) @@ -152,7 +163,7 @@ class SocksConnection(BaseConnection): return packet if sys.version_info[0] == 2 else bytes(packet,"ascii") class SocksProxy(BaseProxy): - + def createConnection(self, socket, peer): return SocksConnection(socket, peer) @@ -172,12 +183,12 @@ class HttpConnection(BaseConnection): sep = data.find(":") if sep < len("CONNECT ") + 1: raise InvalidRequest - + host = data[len("CONNECT "):sep] space = data.find(" ", sep) if space < sep + 1: raise InvalidRequest - + port = int(data[sep + 1:space]) return (host, port) @@ -189,6 +200,6 @@ class HttpConnection(BaseConnection): return s if sys.version_info[0] == 2 else bytes(s,"ascii") class HttpProxy(BaseProxy): - + def createConnection(self, socket, peer): return HttpConnection(socket, peer) diff --git a/scripts/TestController.py b/scripts/TestController.py deleted file mode 100644 index 718a117caa6..00000000000 --- a/scripts/TestController.py +++ /dev/null @@ -1,97 +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, threading, subprocess, getopt, signal, re - -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 - -def removeTrustSettings(): - serverCert = os.path.join(path[0], "certs", "server.pem") - if os.system("security verify-cert -c " + serverCert + " >& /dev/null") == 0: - sys.stdout.write("removing trust settings for the HTTP server certificate... ") - sys.stdout.flush() - if os.system("security remove-trusted-cert " + serverCert) != 0: - print("\nerror: couldn't remove trust settings for the HTTP server certificate") - else: - print("ok") - else: - print("trust settings already removed") - -# -# On OS X, provide an option to allow removing the trust settings -# -if TestUtil.isDarwin(): - try: - opts, args = getopt.getopt(sys.argv[1:], "", ["clean"]) - if ("--clean", "") in opts: - removeTrustSettings() - sys.exit(0) - except getopt.GetoptError: - pass - -props = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "java", "gradle.properties"), "r") -iceVersion = re.search("iceVersion *= *([-.0-9a-z]*)", props.read()).group(1) - -jar = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", - "java/test/controller/build/libs/testController-%(iceVersion)s.jar" % {"iceVersion": iceVersion}) - -javaHome = os.environ.get("JAVA_HOME", "") -javaCmd = '%s' % os.path.join(javaHome, "bin", "java") if javaHome else "java" -command = [javaCmd, "-jar", jar] -if len(sys.argv) > 1: - command += sys.argv[1:] - -p = subprocess.Popen(command, shell = False, stdin = subprocess.PIPE, stdout = subprocess.PIPE, - stderr = subprocess.STDOUT, bufsize = 0) - -def signal_handler(signal, frame): - if p: - p.terminate() - sys.exit(0) -signal.signal(signal.SIGINT, signal_handler) -signal.signal(signal.SIGTERM, signal_handler) - -if TestUtil.isDarwin(): - # - # On OS X, we set the trust settings on the certificate to prevent - # the Web browsers from prompting the user about the unstrusted - # certificate. Some browsers such as Chrome don't provide the - # option to set this trust settings. - # - serverCert = os.path.join(TestUtil.toplevel, "certs", "server.pem") - if os.system("security verify-cert -c " + serverCert + " >& /dev/null") != 0: - sys.stdout.write("adding trust settings for the HTTP server certificate... ") - sys.stdout.flush() - if os.system("security add-trusted-cert -r trustAsRoot " + serverCert) != 0: - print("error: couldn't add trust settings for the HTTP server certificate") - print("ok") - print("run " + sys.argv[0] + " --clean to remove the trust setting") - -while(True): - - c = p.stdout.read(1) - if not c: break - if c == '\r': continue - - # Depending on Python version and platform, the value c could be a - # string or a bytes object. - if type(c) != str: - c = c.decode() - sys.stdout.write(c) - sys.stdout.flush() diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py deleted file mode 100755 index 846d9975ce6..00000000000 --- a/scripts/TestUtil.py +++ /dev/null @@ -1,2669 +0,0 @@ -# ********************************************************************** -# -# 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, re, getopt, time, string, threading, atexit, platform, traceback, subprocess - -# Global flags and their default values. -protocol = "" # If unset, default to TCP. Valid values are "tcp", "ssl", "ws", "wss", "bt" or "bts". -compress = False # Set to True to enable bzip2 compression. -serialize = False # Set to True to have tests use connection serialization -host = None # Will default to loopback. -debug = False # Set to True to enable test suite debugging. -mono = False # Set to True when not on Windows -keepGoing = False # Set to True to have the tests continue on failure. -ipv6 = False # Default to use IPv4 only -socksProxy = False # Use SOCKS proxy running on localhost -global x64 -x64 = False # Binary distribution is 64-bit -global x86 -x86 = False # Binary distribution is 32-bit -global armv7l -armv7l = False # Binary distribution is armv7l -cpp11 = False # Binary distribution is c++11 -es5 = False # Use JavaScript ES5 (Babel compiled code) -static = False # Static build -global buildMode -buildMode = None - -extraArgs = [] -clientTraceFilters = [] -serverTraceFilters = [] - -# Default java loader - -javaHome = os.environ.get("JAVA_HOME", "") -javaCmd = '"%s"' % os.path.join(javaHome, "bin", "java") if javaHome else "java" -javaLibraryPath = None # Used for Freeze - -valgrind = False # Set to True to use valgrind for C++ executables. -appverifier = False # Set to True to use appverifier for C++ executables, This is windows only feature -tracefile = None -printenv = False -cross = [] -watchDog = None -clientHome = None -serviceDir = None -compact = False -global winrt -winrt = False -global serverOnly -serverOnly = False -mx = False -controller = None -configName = None - -queuedTests = [] - -global additionalBinDirectories -additionalBinDirectories = [] - -def addAdditionalBinDirectories(directories): - global additionalBinDirectories - additionalBinDirectories += directories - -def resetAdditionalBinDirectories(): - global additionalBinDirectories - additionalBinDirectories = [] - -# -# Linux distribution -# -linuxDistribution = None -for path in ["/etc/redhat-release", "/etc/issue"]: - if not os.path.isfile(path): - continue - - f = open(path, "r") - issue = f.read() - f.close() - - if issue.find("Red Hat") != -1: - linuxDistribution = "RedHat" - elif issue.find("Amazon Linux") != -1: - linuxDistribution = "Amazon" - elif issue.find("CentOS") != -1: - linuxDistribution = "CentOS" - elif issue.find("Ubuntu") != -1: - linuxDistribution = "Ubuntu" - elif issue.find("Debian") != -1: - linuxDistribution = "Debian" - elif issue.find("SUSE Linux") != -1: - linuxDistribution = "SUSE LINUX" - elif issue.find("Yocto") != -1: - linuxDistribution = "Yocto" - -def isCygwin(): - # The substring on sys.platform is required because some cygwin - # versions return variations like "cygwin_nt-4.01". - return sys.platform[:6] == "cygwin" - -def isWin32(): - return sys.platform == "win32" or isCygwin() - -def isVista(): - return isWin32() and sys.getwindowsversion()[0] == 6 and sys.getwindowsversion()[1] == 0 - -def isWin9x(): - if isWin32(): - return not ("OS" in os.environ and os.environ["OS"] == "Windows_NT") - else: - return 0 - -def isSolaris(): - return sys.platform == "sunos5" - -def isSparc(): - p = subprocess.Popen("uname -p", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) - if not p or not p.stdout: - print("unable to get system information!") - sys.exit(1) - l = p.stdout.readline().decode("utf-8").strip() - if l == "sparc": - return True - else: - return False - -def dpkgHostMultiArch(): - p = subprocess.Popen("dpkg-architecture -qDEB_HOST_MULTIARCH", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) - if not p or not p.stdout: - print("unable to get system information!") - sys.exit(1) - return p.stdout.readline().decode("utf-8").strip() - -def isI686(): - return x86 or any(platform.machine() == p for p in ["i386", "i686"]) - -def isAIX(): - return sys.platform.startswith("aix") - -def isDarwin(): - return sys.platform == "darwin" - -def isLinux(): - return sys.platform.startswith("linux") or sys.platform.startswith("gnukfreebsd") - -def isUbuntu(): - return isLinux() and linuxDistribution and linuxDistribution == "Ubuntu" - -def isRhel(): - return isLinux() and linuxDistribution in ["RedHat", "Amazon", "CentOS"] - -def isYocto(): - return isLinux() and linuxDistribution and linuxDistribution == "Yocto" - -def isDebian(): - return isLinux() and linuxDistribution and linuxDistribution == "Debian" - -def isSles(): - return isLinux() and linuxDistribution and linuxDistribution == "SUSE LINUX" - -def iceUseOpenSSL(): - return any(sys.platform.startswith(p) for p in ["linux", "freebsd"]) - -def getCppCompiler(): - compiler = "" - if os.environ.get("CPP_COMPILER", "") != "": - compiler = os.environ["CPP_COMPILER"] - elif isMINGW(): - compiler = "MINGW" - else: - p = subprocess.Popen("cl", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) - if not p or not p.stdout: - print("Cannot detect C++ compiler") - compiler = VC120 - else: - l = p.stdout.readline().decode("utf-8").strip() - if l.find("Version 16.") != -1: - compiler = "VC100" - elif l.find("Version 17.") != -1: - compiler = "VC110" - elif l.find("Version 18.") != -1: - compiler = "VC120" - elif l.find("Version 19.") != -1: - compiler = "VC140" - else: - # - # Cannot detect C++ compiler use default - # - compiler = "VC140" - return compiler - -def isMINGW(): - if not isWin32(): - return False - # Ruby Installer DEVKIT sets the RI_DEVKIT environment variable, - # we check for this variable to detect the Ruby MINGW environment. - return "RI_DEVKIT" in os.environ - -def isVC100(): - if not isWin32(): - return False - return getCppCompiler() == "VC100" - -def isVC110(): - if not isWin32(): - return False - return getCppCompiler() == "VC110" - -def isVC120(): - if not isWin32(): - return False - return getCppCompiler() == "VC120" - -def isVC140(): - if not isWin32(): - return False - return getCppCompiler() == "VC140" - -def getIceSoVersion(): - config = open(os.path.join(toplevel, "cpp", "include", "IceUtil", "Config.h"), "r") - intVersion = int(re.search("ICE_INT_VERSION ([0-9]*)", config.read()).group(1)) - majorVersion = int(intVersion / 10000) - minorVersion = int(intVersion / 100) - 100 * majorVersion - patchVersion = intVersion % 100 - if patchVersion < 50: - return '%d' % (majorVersion * 10 + minorVersion) - elif patchVersion < 60: - return '%da%d' % (majorVersion * 10 + minorVersion, patchVersion - 50) - else: - return '%db%d' % (majorVersion * 10 + minorVersion, patchVersion - 60) - -def getIceJsonVersion(): - r = re.search(r"([0-9]+)\.([0-9]+)(\.[0-9]+|[ab][0-9]+)", iceVersion) - major = int(r.group(1)) - minor = int(r.group(2)) - v = ("%d.%d" % (major, minor)).strip() - if r.group(3).startswith("a"): - return v + ".0-" + r.group(3).replace("a", "alpha").strip() - elif r.group(3).startswith("b"): - return v + ".0-" + r.group(3).replace("b", "beta").strip() - else: - return ("%s%s" % (v, r.group(3))).strip() - -def getJdkVersion(): - process = subprocess.Popen("java -version", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) - if not process or not process.stdout: - print("unable to get Java version!") - sys.exit(1) - global jdkVersion - jdkVersion = process.stdout.readline() - if not jdkVersion: - print("unable to get Java version!") - sys.exit(1) - return jdkVersion.decode("utf-8") - -def getWinRegistryKeyValue(key, subKey): - import winreg - try: - key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key, 0, winreg.KEY_READ | winreg.KEY_WOW64_64KEY) - try: - return winreg.QueryValueEx(key, subKey) - finally: - winreg.CloseKey(key) - except: - pass - -def sanitize(cp): - np = "" - for p in cp.split(os.pathsep): - if len(np) > 0: - np = np + os.pathsep - np = np + p - return np - -def quoteArgument(arg): - if arg is None: - return None - return '"%s"' % arg - -def dumpenv(env, lang): - if env is None: - env = os.environ - vars = ["PATH", "LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH", "SHLIB_PATH", "LIBPATH", "LD_LIBRARY_PATH_64"] - if lang is None: - vars.extend(["CLASSPATH", "MONO_PATH", "DEVPATH", "PYTHONPATH", "RUBYLIB"]) - elif lang == "cpp": - pass - elif lang == "java" or lang == "java-compat": - vars.append("CLASSPATH") - elif lang == "csharp": - vars.extend(["MONO_PATH", "DEVPATH"]) - elif lang == "python": - vars.append("PYTHONPATH") - elif lang == "ruby": - vars.append("RUBYLIB") - elif lang == "js": - vars.append("NODE_PATH") - for i in vars: - if i in env: - print("%s=%s" % (i, env[i])) - -def addLdPath(libpath, env = None): - if env is None: - env = os.environ - if isWin32(): - addPathToEnv("PATH", libpath, env) - elif isDarwin(): - addPathToEnv("DYLD_LIBRARY_PATH", libpath, env) - elif isAIX(): - addPathToEnv("LIBPATH", libpath, env) - else: - addPathToEnv("LD_LIBRARY_PATH", libpath, env) - addPathToEnv("LD_LIBRARY_PATH_64", libpath, env) - return env - -def addClasspath(path, env = None): - return addPathToEnv("CLASSPATH", path, env) - -def addPathToEnv(variable, path, env = None): - if env is None: - env = os.environ - if variable not in env: - env[variable] = path - else: - env[variable] = path + os.pathsep + env.get(variable) - return env - -# -# This is set by the choice of init method. If not set, before it is -# used, it indicates a bug and things should terminate. -# -defaultMapping = None -testErrors = [] -toplevel = None -testToplevel = None - -path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..", - "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) == 0: - head = "." -# Try to find scripts/TestUtil.py or ice/scripts/TestUtil.py in parent directories -path = [os.path.join(head, p) for p in path] + [os.path.join(head, p, "ice") 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!") -toplevel = path[0] -testToplevel = toplevel - -# -# Set the default arch to x64 on x64 machines, this could be overriden -# with the --x86 command line argument. -# -if isWin32(): - if os.environ.get("PLATFORM", "").upper() == "X64": - x64 = True -elif isAIX(): - if os.environ.get("OBJECT_MODE", "") == "64": - x64 = True -else: - p = subprocess.Popen("uname -m", shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) - if(p.wait() != 0): - print("uname failed:\n" + p.stdout.read().strip()) - sys.exit(1) - line = p.stdout.readline().decode('UTF-8').strip() - if line == "x86_64" and os.environ.get("LP64", "") != "no": - x64 = True - elif line == "armv7l": - armv7l = True - -# -# The PHP interpreter is called "php5" on some platforms (e.g., SLES). -# -phpCmd = "php" -for path in os.environ["PATH"].split(os.pathsep): - # - # Stop if we find "php" in the PATH first. - # - if os.path.exists(os.path.join(path, "php")): - break - elif os.path.exists(os.path.join(path, "php5")): - phpCmd = "php5" - break - -# -# The NodeJS interpreter is called "nodejs" on some platforms -# (e.g., Ubuntu) -# -nodeCmd = "node" -if "NODE" in os.environ: - nodeCmd = os.environ["NODE"] -else: - for path in os.environ["PATH"].split(os.pathsep): - # - # Stop if we find "node" in the PATH first. - # - if os.path.exists(os.path.join(path, "node")): - break - elif os.path.exists(os.path.join(path, "nodejs")): - nodeCmd = "nodejs" - break - -# -# Figure out the Ice version -# -iceVersion = None -try: - if isWin32(): - config = open(os.path.join(toplevel, "config", "icebuilder.props"), "r") - iceVersion = re.search("<IceVersion>[\t\s]*([0-9]+\.[0-9]+(\.[0-9]+|[ab][0-9]*))</IceVersion>", config.read()).group(1) - else: - config = open(os.path.join(toplevel, "config", "Make.rules"), "r") - iceVersion = re.search("version[\t\s]*= ([0-9]+\.[0-9]+(\.[0-9]+|[ab][0-9]*))", config.read()).group(1) - config.close() -except: - print("error: couldn't figure Ice version") - sys.exit(1) - -# -# Figure out Ice installation directory -# -iceHome = None # Binary distribution to use (or None to use binaries from source distribution) -if os.environ.get("USE_BIN_DIST", "no") == "yes": - # Only use binary distribution from ICE_HOME environment variable if USE_BIN_DIST=yes - if os.environ.get("ICE_HOME", "") != "": - iceHome = os.environ["ICE_HOME"] - elif isLinux(): - iceHome = "/usr" - elif isDarwin(): - iceHome = "/usr/local" - elif isWin32(): - path = getWinRegistryKeyValue("SOFTWARE\\ZeroC\\Ice %s" % iceVersion, "InstallDir") - if path and len(path) > 0 and os.path.exists(path[0]): - iceHome = path[0] - -# List of supported cross-language tests. -crossTests = [ #"Ice/adapterDeactivation", - #"Ice/background", - #"Ice/binding", - #"Ice/checksum", - #"Ice/custom", - "Ice/ami", - "Ice/info", - "Ice/exceptions", - "Ice/enums", - "Ice/facets", - #"Ice/hold", - "Ice/inheritance", - "Ice/invoke", - #"Ice/location", - "Ice/objects", - "Ice/operations", - "Ice/proxy", - #"Ice/retry", - "Ice/servantLocator", - #"Ice/timeout", - "Ice/slicing/exceptions", - "Ice/slicing/objects", - "Ice/optional", - ] - -def run(tests, root = False): - def usage(): - print("usage: " + sys.argv[0] + """ - --all Run all sensible permutations of the tests. - --all-cross Run all sensible permutations of cross language tests. - --start=index Start running the tests at the given index. - --loop Run the tests in a loop. - --filter=<regex> Run all the tests that match the given regex. - --rfilter=<regex> Run all the tests that do not match the given regex. - --debug Display debugging information on each test. - --protocol=<prot> Run with the given protocol (tcp|ssl|ws|wss|bt). - --compress Run the tests with protocol compression. - --host=host Set --Ice.Default.Host=<host>. - --valgrind Run the test with valgrind. - --appverifier Run the test with appverifier under Windows. - --serialize Run with connection serialization. - --continue Keep running when a test fails. - --ipv6 Use IPv6 addresses. - --socks Use SOCKS proxy running on localhost. - --no-ipv6 Don't use IPv6 addresses. - --ice-home=<path> Use the binary distribution from the given path. - --mode=debug|release Run the tests with debug or release mode builds (win32 only)." - --x86 Binary distribution is 32-bit. - --x64 Binary distribution is 64-bit. - --c++11 Binary distribution is c++11. - --es5 Use JavaScript ES5 (Babel compiled code) - --static Binary distribution is static. - --cross=lang Run cross language test. - --client-home=<dir> Run cross test clients from the given Ice source distribution. - --script Generate a script to run the tests. - --env Print important environment variables. - --service-dir=<dir> Where to locate services for builds without service support. - --compact Ice for .NET uses the Compact Framework. - --winrt Run server with configuration suited for WinRT client. - --server Run only the server. - --mx Enable IceMX when running the tests. - --controller=<host> Use the test controller on the specified host. - --arg=<property> Append the given argument. - """) - sys.exit(2) - - try: - opts, args = getopt.getopt(sys.argv[1:], "lr:R:", - ["start=", "start-after=", "filter=", "rfilter=", "all", "all-cross", "loop", - "debug", "protocol=", "compress", "valgrind", "host=", "serialize", "continue", - "ipv6", "no-ipv6", "socks", "ice-home=", "mode=", "cross=", "client-home=", "x64", "x86", - "script", "env", "arg=", "service-dir=", "appverifier", "compact", - "winrt", "server", "mx", "c++11", "es5", "static", "controller=", "configName="]) - except getopt.GetoptError: - usage() - - if args: - usage() - - start = 0 - loop = False - all = False - allCross = False - arg = "" - script = False - noipv6 = False - compact = "--compact" in opts - winrt = "--winrt" in opts - serverOnly = "--server" in opts - mx = "--mx" in opts - controller = "--controller" in opts - configName = "--configName" in opts - - filters = [] - for o, a in opts: - if o == "--continue": - global keepGoing - keepGoing = True - elif o in ("-l", "--loop"): - loop = True - elif o in ("-r", "-R", "--filter", '--rfilter'): - testFilter = re.compile(re.escape(os.path.normpath(a))) - if o in ("--rfilter", "-R"): - filters.append((testFilter, True)) - else: - filters.append((testFilter, False)) - elif o == "--cross": - global cross - crossLang = ["cpp", "csharp", "java", "java-compat", "js", "php", "python", "ruby", "objective-c"] - if a not in crossLang: - print("cross must be one of %s" % ', '.join(crossLang)) - sys.exit(1) - cross.append(a) - elif o == "--all" : - all = True - elif o == "--no-ipv6" : - noipv6 = True - elif o == "--all-cross" : - allCross = True - elif o in '--start': - start = int(a) - elif o == "--script": - script = True - elif o == '--arg': - arg += " --arg=" - arg += '"' - arg += a - arg += '"' - elif o == "--protocol": - if a not in ("bt", "bts", "ws", "wss", "ssl", "tcp"): - usage() - if not root and getDefaultMapping() == "csharp" and (a == "ssl" or a == "wss"): - if mono: - print("SSL is not supported with mono") - sys.exit(1) - if compact: - print("SSL is not supported with the Compact Framework") - sys.exit(1) - if a in ["bt", "bts"] and not isLinux(): - print("Bluetooth is only supported on Linux") - sys.exit(1) - elif o == "--c++11": - global cpp11 - cpp11 = True - elif o == "--es5": - global es5 - es5 = True - elif o == "--static": - global static - static = True - elif o == "--x86": - global x86 - x86 = True - elif o == "--x64": - global x64 - x64 = True - if o in ( "--cross", "--protocol", "--host", "--debug", "--compress", "--valgrind", "--serialize", "--ipv6", \ - "--socks", "--ice-home", "--mode", "--x86", "--x64", "--c++11", "--es5", "--static", "--env", \ - "--service-dir", "--appverifier", "--compact", "--winrt", \ - "--server", "--mx", "--client-home", "--controller", "--configName"): - arg += " " + o - if len(a) > 0: - arg += " " + a - - if not root: - tests = [ (os.path.join(getDefaultMapping(), "test", os.path.normpath(x)), y) for x, y in tests ] - - # Expand all the test and argument combinations. - expanded = [] - if all: - expanded.append([(test, arg, config) for test,config in tests if "once" in config ]) - - a = '--protocol=tcp %s' % arg - expanded.append([ (test, a, config) for test,config in tests if "core" in config]) - - a = '--protocol=ssl %s' % arg - expanded.append([ (test, a, config) for test,config in tests if "core" in config]) - - a = '--protocol=ws %s' % arg - expanded.append([ (test, a, config) for test,config in tests if "core" in config]) - - if not noipv6: - a = "--ipv6 --protocol=wss --compress --mx --serialize %s" % arg - expanded.append([ (test, a, config) for test,config in tests if "core" in config]) - - a = "--protocol=tcp %s" % arg - expanded.append([ (test, a, config) for test,config in tests if "service" in config]) - - if not noipv6: - a = "--ipv6 --protocol=ssl --compress --mx --serialize %s" % arg - expanded.append([ (test, a, config) for test,config in tests if "service" in config]) - - elif not allCross: - expanded.append([ (test, arg, config) for test,config in tests]) - - if allCross: - if len(cross) == 0: - cross = ["cpp", "java", "java-compat", "js", "php", "python", "ruby"] - if isWin32(): - cross.append("csharp") - - # PHP/Python only build with VC140 - if getCppCompiler() != "VC140": - cross.remove('php') - cross.remove('python') - - # TODO: We're currently not building Ruby on Windows - cross.remove('ruby') - if isDarwin(): - cross.append("objective-c") - if root: - allLang = ["cpp", "java", "java-compat", "js", "python"] - if isWin32(): - allLang.append("csharp") - if isDarwin(): - allLang.append("objective-c") - else: - allLang = [ getDefaultMapping() ] - for lang in allLang: - # js test user server for other language so we can ignore this - if lang == "js": - continue - - # Run each crossLang through the remove filters. Does not support filter. - # We do this so that we can filter out cross language tests if necessary. - def langFiltered(lang): - for testFilter, removeFilter in filters: - if removeFilter and testFilter.search(lang): - return True - return False - - # This is all other languages than the current mapping. - crossLang = [ l for l in cross if lang != l and langFiltered(l) == False] - - # This is all eligible cross tests for the current mapping. - # Now expand out the tests. We run only tcp for most cross tests. - for c in crossLang: - a = "--cross=%s --protocol=tcp %s" % (c, arg) - for test in crossTests: - name = os.path.join(lang, "test", test) - expanded.append([(name, a, testConfig(name, tests))]) - - # Add ssl & compress for the operations test. - if ((compact or mono) and c == "csharp") or (c == "js"): # Don't add the ssl tests. - continue - a = "--cross=%s --protocol=ssl --compress %s" % (c, arg) - expanded.append([(os.path.join(lang, "test", "Ice", "operations"), a, [])]) - - # Apply filters after expanding. - if len(filters) > 0: - for testFilter, removeFilter in filters: - nexpanded = [] - for tests in expanded: - if removeFilter: - nexpanded.append([ (x, a, y) for x,a,y in tests if not testFilter.search(x) ]) - else: - nexpanded.append([ (x, a, y) for x,a,y in tests if testFilter.search(x) ]) - expanded = nexpanded - - if loop: - num = 1 - while 1: - runTests(start, expanded, num, script = script) - num += 1 - else: - runTests(start, expanded, script = script) - - global testErrors - if len(testErrors) > 0: - print("The following errors occurred:") - for x in testErrors: - print(x) - -if not isWin32(): - mono = True - -def testConfig(name, tests): - for i in tests: - if i[0] == name: - return i[1] - return [] - -def getIceDir(subdir = None, testdir = None): - # - # If client-home is set and if the given test directory is from a - # sub-directory of the client home directory, run the test against - # the client-home source distribution. - # - global clientHome - if testdir and clientHome and os.path.commonprefix([testdir, clientHome]) == clientHome: - return os.path.join(clientHome, subdir) - - # - # If ICE_HOME is set we're running the test against a binary distribution. Otherwise, - # we're running the test against a source distribution. - # - global iceHome - if iceHome: - return iceHome - elif subdir: - return os.path.join(toplevel, subdir) - else: - return toplevel - -def getSliceDir(): - # - # If ICE_HOME is set we're running the test against a binary distribution. Otherwise, - # we're running the test against a source distribution. - # - global iceHome - if iceHome: - if iceHome == "/usr/local" or iceHome == "/usr": - return os.path.join(iceHome, "ice", "slice") - else: - return os.path.join(iceHome, "slice") - else: - return os.path.join(toplevel, "slice") - -def phpCleanup(): - if os.path.exists("ice.profiles"): - os.remove("ice.profiles") - -def phpProfileSetup(clientConfig = False, iceOptions = None, iceProfile = None): - interpreterOptions = [] - - if iceProfile != None: - atexit.register(phpCleanup) - interpreterOptions.append("-d ice.profiles='ice.profiles'") - tmpProfiles = open("ice.profiles", "w") - tmpProfiles.write("[%s]\n" % iceProfile) - if clientConfig: - tmpProfiles.write("ice.config=\"config.client\"\n") - if iceOptions != None: - tmpProfiles.write("ice.options=\"%s\"\n" % iceOptions) - tmpProfiles.close() - else: - if clientConfig: - interpreterOptions.append("-d ice.config='config.client'") - if iceOptions != None: - interpreterOptions.append("-d ice.options='%s'" % iceOptions) - - return ' '.join(interpreterOptions) - -def phpFlags(): - flags = [] - extDir = None - ext = None - incDir = None - - if isWin32(): - ext = "php_ice.dll" - if not iceHome: - extDir = os.path.abspath(os.path.join(getIceDir("php"), "lib", "x64" if x64 else "Win32", - "Debug" if buildMode == "debug" else "Release")) - incDir = os.path.abspath(os.path.join(getIceDir("php"), "lib")) - else: - extDir = os.path.join(iceHome, "php") - incDir = extDir - else: - ext = "IcePHP.so" - if not iceHome: - extDir = os.path.abspath(os.path.join(toplevel, "php", "lib")) - incDir = extDir - else: - # - # If ICE_HOME points to the installation directory of a source build, the - # PHP extension will be located in $ICE_HOME/php. For an RPM installation, - # the extension should already be in PHP's default extension directory so - # we don't need to set extension_dir. - # - # We start PHP with "php -n". The -n option causes PHP to ignore its - # default configuration file(s). We do this to suppress any warnings - # that PHP might generate when it can't find its default extensions after - # we modify extension_dir. Even if we don't define extension_dir, we still - # need to add "extension = IcePHP.<ext>". - # - extDir = os.path.join(iceHome, "php") - incDir = extDir - - if not os.path.exists(os.path.join(extDir, ext)): - if iceHome == "/usr": - extDir = None # Assume the extension is already in PHP's extension_dir. - # - # On SLES11, the PHP run time files are installed in /usr/share/php5, but - # this directory is not in the default include path when you specify an - # alternate configuration file, so we have to configure it explicitly. - # - if os.path.exists("/usr/share/php5/Ice.php"): - incDir = "/usr/share/php5" - else: - incDir = None - elif iceHome == "/usr/local" and isDarwin(): - extDir = "/usr/local/lib/php/extensions" - incDir = "/usr/local/share/php" - else: - print("unable to find IcePHP extension!") - sys.exit(1) - - if extDir: - flags.append("-d extension_dir='%s'" % extDir) - flags.append("-d extension='%s'" % ext) - if incDir: - flags.append("-d include_path='%s'" % incDir) - - return ' '.join(flags) - -def getIceBox(): - global cpp11 - - # - # Get and return the path of the IceBox executable - # - lang = getDefaultMapping() - if lang == "cpp": - iceBox = "icebox" - if isWin32(): - if cpp11: - iceBox += "++11" - iceBox += ".exe" - elif isLinux(): - if isI686(): - iceBox += "32" - if cpp11: - iceBox += "++11" - elif isDarwin and cpp11: - iceBox += "++11" - iceBox = os.path.join(getCppBinDir(lang), iceBox) - elif lang == "java": - iceBox = "com.zeroc.IceBox.Server" - elif lang == "java-compat": - iceBox = "IceBox.Server" - elif lang == "csharp": - iceBox = os.path.join(getIceDir("csharp"), "bin", "iceboxnet") - - return iceBox - -def getIceBoxAdmin(): - if getDefaultMapping() == "java": - return "com.zeroc.IceBox.Admin" - elif getDefaultMapping() == "java-compat": - return "IceBox.Admin" - else: - return getIceExe("iceboxadmin") - -def getIceGridAdmin(): - return getIceExe("icegridadmin") - -def getIceStormAdmin(): - return getIceExe("icestormadmin") - -def getIceGridNode(): - return getIceExe("icegridnode") - -def getIceGridRegistry(): - return getIceExe("icegridregistry") - -def getGlacier2Router(): - return getIceExe("glacier2router") - -def getIceExe(name): - if isMINGW(): - return os.path.join(getServiceDir(), name) - else: - return os.path.join(getCppBinDir(), name) - -def getNodeCommand(): - return nodeCmd - -# -# Create a passwords file that contains the given users/passwords using icehashpassword.py -# -def hashPasswords(filePath, entries): - if os.path.exists(filePath): - os.remove(filePath) - passwords = open(filePath, "a") - - command = "%s %s" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "icehashpassword.py"))) - - # - # For Linux ARM default rounds makes test slower (Usually runs on embbeded boards) - # - if isLinux() and armv7l: - command += " --rounds 100000" - - for user, password in entries.items(): - p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) - p.stdin.write(password.encode('UTF-8')) - p.stdin.write('\r\n'.encode('UTF-8')) - p.stdin.flush() - if(p.wait() != 0): - print("icehashpassword.py failed:\n" + p.stdout.read().decode('UTF-8').strip()) - passwords.close() - sys.exit(1) - passwords.write("%s %s\n" % (user, p.stdout.readline().decode('UTF-8').strip())) - passwords.close() - -class InvalidSelectorString(Exception): - def __init__(self, value): - self.value = value - def __str__(self): - return repr(self.value) - -sslConfigTree = { - "cpp" : { - "plugin" : " --Ice.Plugin.IceSSL=IceSSL:createIceSSL --IceSSL.Password=password " + - "--IceSSL.DefaultDir=%(certsdir)s --IceSSL.CAs=cacert.pem --IceSSL.VerifyPeer=%(verifyPeer)s", - "client" : " --IceSSL.CertFile=client.p12", - "server" : " --IceSSL.CertFile=server.p12", - "colloc" : " --IceSSL.CertFile=client.p12" - }, - "java" : { - "plugin" : " --Ice.Plugin.IceSSL=com.zeroc.IceSSL.PluginFactory " + - "--IceSSL.DefaultDir=%(certsdir)s --IceSSL.Password=password --IceSSL.VerifyPeer=%(verifyPeer)s", - "client" : " --IceSSL.Keystore=client.jks", - "server" : " --IceSSL.Keystore=server.jks", - "colloc" : " --IceSSL.Keystore=client.jks" - }, - "java-compat" : { - "plugin" : " --Ice.Plugin.IceSSL=IceSSL.PluginFactory " + - "--IceSSL.DefaultDir=%(certsdir)s --IceSSL.Password=password --IceSSL.VerifyPeer=%(verifyPeer)s", - "client" : " --IceSSL.Keystore=client.jks", - "server" : " --IceSSL.Keystore=server.jks", - "colloc" : " --IceSSL.Keystore=client.jks" - }, - "csharp" : { - "plugin" : " --Ice.Plugin.IceSSL=%(icesslcs)s:IceSSL.PluginFactory --IceSSL.CAs=cacert.pem " + - "--IceSSL.Password=password --IceSSL.DefaultDir=%(certsdir)s --IceSSL.VerifyPeer=%(verifyPeer)s", - "client" : " --IceSSL.CertFile=client.p12 --IceSSL.CheckCertName=0", - "server" : " --IceSSL.CertFile=server.p12", - "colloc" : " --IceSSL.CertFile=client.p12 --IceSSL.CheckCertName=0" - }, - } - -if isDarwin(): - sslConfigTree["cpp"]["client"] += " --IceSSL.Keychain=client.keychain --IceSSL.KeychainPassword=password" - sslConfigTree["cpp"]["server"] += " --IceSSL.Keychain=server.keychain --IceSSL.KeychainPassword=password" - sslConfigTree["cpp"]["colloc"] += " --IceSSL.Keychain=colloc.keychain --IceSSL.KeychainPassword=password" - -if isWin32(): - # - # This cipher suites doesn't work well between Java and SChannel TLS1.2 implementations. - # - for lang in ["java", "java-compat"]: - sslConfigTree[lang]["client"] += " --IceSSL.Ciphers=!TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" - sslConfigTree[lang]["server"] += " --IceSSL.Ciphers=!TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" - -sslConfigTree["python"] = sslConfigTree["cpp"] -sslConfigTree["ruby"] = sslConfigTree["cpp"] -sslConfigTree["php"] = sslConfigTree["cpp"].copy() -sslConfigTree["objective-c"] = sslConfigTree["cpp"] - -def getDefaultMapping(): - """Try to guess the language mapping from the current path""" - # here = os.getcwd().split(os.sep) - # here.reverse() - here = os.path.relpath(os.getcwd(), start=toplevel).split(os.sep) - for i in range(0, len(here)): - if here[i] in ["cpp", "csharp", "java", "java-compat", "js", "php", "python", "ruby", "objective-c", "tmp"]: - return here[i] - raise RuntimeError("cannot determine mapping") - -def getStringIO(): - if sys.version_info[0] == 2: - import StringIO - return StringIO.StringIO() - else: - import io - return io.StringIO() - -class DriverConfig: - lang = None - protocol = None - compress = 0 - serialize = 0 - host = None - mono = False - valgrind = False - appverifier = False - type = None - overrides = None - ipv6 = False - socksProxy = False - x64 = False - x86 = False - cpp11 = False - es5 = False - static = False - serviceDir = None - mx = False - controller = None - extraArgs = [] - - def __init__(self, type = None): - global protocol - global compress - global serialize - global host - global mono - global valgrind - global appverifier - global ipv6 - global socksProxy - global x64 - global x86 - global cpp11 - global es5 - global static - global serviceDir - global compact - global mx - global controller - global extraArgs - self.lang = getDefaultMapping() - self.protocol = protocol - self.compress = compress - self.serialize = serialize - self.host = host - self.mono = mono - self.valgrind = valgrind - self.appverifier = appverifier - self.type = type - self.ipv6 = ipv6 - self.socksProxy = socksProxy - self.x64 = x64 - self.x86 = x86 - self.cpp11 = cpp11 - self.es5 = es5 - self.static = static - self.serviceDir = serviceDir - self.compact = compact - self.mx = mx - self.controller = controller - self.extraArgs = extraArgs - -def argsToDict(argumentString, results): - """Converts an argument string to dictionary""" - args = argumentString.strip() - while len(args) > 0: - end = args.find(" --") - if end == -1: - current = args.strip() - args = "" - else: - current = args[:end].strip() - args = args[end:].strip() - - value = current.find("=") - if value != -1: - results[current[:value]] = current[value+1:] - else: - results[current] = None - return results - -def getCommandLineProperties(exe, config, cfgName): - - # - # Command lines are built up from the items in the components - # sequence, which is initialized with command line options common to - # all test drivers. - # - components = ["--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1"] - - if config.lang == "cpp": - components.append("--Ice.CollectObjects=1") - - # - # Turn on network tracing. - # - #components.append("--Ice.Trace.Network=3") - #components.append("--Ice.Trace.Protocol=1") - - # - # Now we add additional components depending on the desired configuration. - # - if config.protocol in ["ssl", "wss", "bts"]: - sslenv = {} - sslenv["icesslcs"] = quoteArgument("\\\"" + os.path.join(getIceDir("csharp"), "Assemblies", "IceSSL.dll") + "\\\"") - sslenv["certsdir"] = quoteArgument(os.path.abspath(os.path.join(toplevel, "certs"))) - if winrt or config.protocol == "wss": - sslenv["verifyPeer"] = "0" - else: - sslenv["verifyPeer"] = "2" - components.append(sslConfigTree[config.lang]["plugin"] % sslenv) - components.append(sslConfigTree[config.lang][config.type] % sslenv) - - if config.protocol in ["bt", "bts"]: - components.append("--Ice.Plugin.IceBT=IceBT:createIceBT") - - components.append("--Ice.Default.Protocol=" + config.protocol) - - if config.compress: - components.append("--Ice.Override.Compress=1") - - if config.serialize: - components.append("--Ice.ThreadPool.Server.Serialize=1") - - # - # TODO - # config.lang == "cpp" required with C++11 mapping, we should be able to ged rid - # of this once AsyncResult is optimized to not required a thread pool thread with - # collocated calls and C++11 mapping. We must also check if it still required for - # python. - # - if (config.type == "server" or config.type == "colloc" and - (config.lang == "python" or config.lang == "cpp")): - components.append("--Ice.ThreadPool.Server.Size=1") - components.append("--Ice.ThreadPool.Server.SizeMax=3") - components.append("--Ice.ThreadPool.Server.SizeWarn=0") - - if config.type == "server": - components.append("--Ice.PrintAdapterReady=1") - - if config.mx: - if config.type == "server": - components.append("--Ice.Admin.Endpoints=tcp") - components.append("--Ice.Admin.InstanceName=Server") - else: - components.append("--Ice.Admin.Endpoints=tcp") - components.append("--Ice.Admin.InstanceName=Client") - - components.append("--IceMX.Metrics.Debug.GroupBy=id") - components.append("--IceMX.Metrics.Parent.GroupBy=parent") - components.append("--IceMX.Metrics.All.GroupBy=none") - - if config.controller: - components.append("--ControllerHost=" + config.controller) - - if cfgName: - components.append("--ConfigName=" + cfgName) - - if config.socksProxy: - components.append("--Ice.SOCKSProxyHost=127.0.0.1") - - if config.ipv6: - components.append("--Ice.IPv4=1 --Ice.IPv6=1 --Ice.PreferIPv6Address=1") - if config.host == None: - components.append("--Ice.Default.Host=0:0:0:0:0:0:0:1") - else: - if not config.protocol in ["bt", "bts"]: - components.append("--Ice.IPv4=1 --Ice.IPv6=0") - if config.host == None and not config.protocol in ["bt", "bts"]: - components.append("--Ice.Default.Host=127.0.0.1") - - if config.host != None and len(config.host) != 0: - components.append("--Ice.Default.Host=%s" % config.host) - - for arg in config.extraArgs: - components.append('--' + arg) - - # - # Not very many tests actually require an option override, so not too worried - # about optimal here. - # - if config.overrides != None and len(config.overrides) > 0: - propTable = {} - for c in components: - argsToDict(c, propTable) - - argsToDict(config.overrides, propTable) - components = [] - for k, v in propTable.items(): - if v != None: - components.append("%s=%s" % (k, v)) - else: - components.append("%s" % k) - - output = getStringIO() - for c in components: - output.write(c + " ") - properties = output.getvalue() - output.close() - return properties - -def getCommandLine(exe, config, options = "", interpreterOptions = "", cfgName = None): - output = getStringIO() - - if config.mono and config.lang == "csharp": - output.write("mono --debug '%s.exe' " % exe) - elif config.lang == "ruby" and config.type == "client": - # - # If running with a binary distribution ensure rubygems - # are enabled - # - if iceHome: - output.write("ruby -rubygems") - else: - output.write("ruby") - if interpreterOptions: - output.write(" " + interpreterOptions) - output.write(' "%s" ' % exe) - elif config.lang == "java" or config.lang == "java-compat": - output.write("%s -ea " % javaCmd) - if isSolaris() and config.x64: - output.write("-d64 ") - if not config.ipv6: - output.write("-Djava.net.preferIPv4Stack=true ") - if javaLibraryPath: - output.write("-Djava.library.path=" + javaLibraryPath) - if interpreterOptions: - output.write(" " + interpreterOptions) - output.write(" " + exe + " ") - elif config.lang == "python": - output.write(sys.executable) - if interpreterOptions: - output.write(" " + interpreterOptions) - output.write(' "%s" ' % exe) - elif config.lang == "php" and config.type == "client": - output.write(phpCmd + " -n %s" % phpFlags()) - if interpreterOptions: - output.write(" " + interpreterOptions) - output.write(" -f \""+ exe +"\" -- ") - elif config.lang == "js": - output.write(nodeCmd) - if interpreterOptions: - output.write(" " + interpreterOptions) - output.write(' "%s" ' % exe) - elif config.lang == "cpp" and config.valgrind: - # --child-silent-after-fork=yes is required for the IceGrid/activator test where the node - # forks a process with execv failing (invalid exe name). - output.write("valgrind -q --child-silent-after-fork=yes --leak-check=full ") - output.write('--suppressions="' + os.path.join(toplevel, "config", "valgrind.sup") + '" "' + exe + '" ') - else: - if exe.find(" ") != -1: - output.write('"' + exe + '" ') - else: - output.write(exe + " ") - - if exe.find("IceUtil\\") != -1 or exe.find("IceUtil/") != -1: - output.write(' ' + options) - else: - output.write(getCommandLineProperties(exe, config, cfgName) + ' ' + options) - - commandline = output.getvalue() - output.close() - - return commandline - -def directoryToPackage(): - """Determine the package name from the directory.""" - base = os.getcwd() - after = [] - lang = getDefaultMapping() - - if "java" in lang: - # Remove Java's extra directory structure from the path while we search it - base = base.replace(os.path.join("src", "main", "java", "test"), '') - - before = base - - while len(before) > 0: - current = os.path.basename(before) - before = os.path.dirname(before) - if current == lang: - break - after.insert(0, current) - else: - raise RuntimeError("cannot find language dir") - return ".".join(after) - -def getDefaultServerFile(baseDir = os.getcwd()): - lang = getDefaultMapping() - if lang in ["cpp", "objective-c", "js", "ruby", "php"]: - return getTestExecutable("server", baseDir) - if lang in ["csharp"]: - return "server" - if lang == "python": - return "Server.py" - if lang == "java" or lang == "java-compat": - pkg = directoryToPackage() - if len(pkg) > 0: - pkg = pkg + "." - return pkg + "Server" - raise RuntimeError("unknown language") - -def getDefaultClientFile(lang = None, baseDir = ""): - if lang is None: - lang = getDefaultMapping() - if lang in ["cpp", "objective-c"]: - return getTestExecutable("client", baseDir) - if lang == "ruby": - return "Client.rb" - if lang == "php": - return "Client.php" - if lang in ["csharp"]: - return "client" - if lang == "python": - return "Client.py" - if lang == "java" or lang == "java-compat": - pkg = directoryToPackage() - if len(pkg) > 0: - pkg = pkg + "." - return pkg + "Client" - if lang == "js": - return "run.js" - raise RuntimeError("unknown language") - -def getDefaultCollocatedFile(): - lang = getDefaultMapping() - if lang in ["cpp", "objective-c"]: - return getTestExecutable("collocated") - if lang == "ruby": - return "Collocated.rb" - if lang == "php": - return "Collocated.php" - if lang in ["csharp"]: - return "collocated" - if lang == "python": - return "Collocated.py" - if lang == "java" or lang == "java-compat": - return directoryToPackage() + ".Collocated" - -import Expect - -def _spawn(cmd, env=None, cwd=None, startReader=True, lang=None): - # Start/Reset the watch dog thread - global watchDog - if watchDog is None: - watchDog = WatchDog() - else: - watchDog.reset() - - if debug: - sys.stdout.write("(%s) " % cmd) - sys.stdout.flush() - if printenv: - dumpenv(env, lang) - - try: - process = Expect.Expect(cmd, startReader=startReader, env=env, logfile=tracefile, cwd=cwd) - except: - print("Command failed:\n" + cmd) - traceback.print_exc(file=sys.stderr) - sys.exit(1) - - return process - -def spawn(cmd, cwd=None): - # Spawn given command with test environment. - return _spawn(cmd, getTestEnv(getDefaultMapping(), os.getcwd())) - -def spawnClient(cmd, env=None, cwd=None, echo=True, startReader=True, lang=None): - client = _spawn(cmd, env, cwd, startReader=startReader, lang=lang) - if echo: - client.trace(clientTraceFilters) - return client - -def spawnServer(cmd, env=None, cwd=None, count=1, adapter=None, echo=True, lang=None, mx=False, timeout=60): - server = _spawn(cmd, env, cwd, lang=lang) - - # Count + 1 if IceMX enabled - if mx: - count = count + 1 - - if adapter: - server.expect("%s ready\n" % adapter, timeout = timeout) - else: - while count > 0: - server.expect("[^\n]+ ready\n", timeout = timeout) - count = count - 1 - if echo: - server.trace([re.compile("[^\n]+ ready")] + serverTraceFilters) - return server - -import subprocess -def runCommand(command): - env = getTestEnv(getDefaultMapping(), os.getcwd()) - - # - # popen3 has problems dealing with white spaces in command line. - # - if isWin32(): - CREATE_NEW_PROCESS_GROUP = 512 - # - # We set shell=True to make sure executables are correctly searched - # in directories specified by the PATH environment variable. - # - p = subprocess.Popen(command, shell=True, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, creationflags = 512, env = env) - else: - p = subprocess.Popen(command, shell=True, bufsize=1024, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, close_fds=True, env = env) - - return p; - -def matchAppVerifierSuccess(): - return re.escape("\nApplication Verifier ") + ".*\n" + \ - re.escape("Copyright (c) Microsoft Corporation. All rights reserved.") + \ - ".*\n\n$" #After all match to newlines at end. - -def setAppVerifierSettings(targets, cwd=os.getcwd()): - for exe in targets: - if exe.endswith(".exe") == False: - exe += ".exe" - - #First enable all appverifier tests - cmd = "appverif -enable * -for " + exe - verifier = _spawn(cmd, cwd=cwd) - verifier.expect(matchAppVerifierSuccess(), -1) - - #Now disable all tests we are not intested in - cmd = "appverif -disable LuaPriv PrintDriver PrintApi Networking HighVersionLie -for " + exe - verifier = _spawn(cmd, cwd=cwd) - verifier.expectall(["Application Verifier","",""], -1) - -def appVerifierAfterTestEnd(targets, cwd=os.getcwd()): - for exe in targets: - if exe.endswith(".exe") == False: - exe += ".exe" - - # Export appverifier logs to a xml file in cwd - logName = cwd - if logName is None: - logName = os.path.dirname(exe) - logName += "/" + os.path.basename(exe) + "_appverifier_log.xml" - cmd = "appverif -export log -for " + exe + " -with To=" + logName - verifier = _spawn(cmd, cwd=cwd) - verifier.expect(matchAppVerifierSuccess(), -1) - - # Delete appverifier logs from registry - cmd = "appverif -delete logs -for " + exe - verifier = _spawn(cmd, cwd=cwd) - verifier.expect(matchAppVerifierSuccess(), -1) - - # Delete appverifier settings - cmd = "appverif -delete settings -for " + exe - verifier = _spawn(cmd, cwd=cwd) - verifier.expect(matchAppVerifierSuccess(), -1) - -def getMirrorDir(base, mapping): - """Get the mirror directory for the current test in the given mapping.""" - lang = getDefaultMapping() - after = [] - - if lang == "js": - if isWin32(): - base = base.replace("\\es5", "") - else: - base = base.replace("/es5", "") - elif "java" in lang: - # Remove Java's extra directory structure from the path while we search it - base = base.replace(os.path.join("src", "main", "java", "test"), '') - - before = base - while len(before) > 0: - current = os.path.basename(before) - before = os.path.dirname(before) - if current == lang: - break - after.insert(0, current) - else: - raise RuntimeError("cannot find language dir") - - dir = os.path.join(before, mapping) - # Deal with Java's different directory structure - if "java" in mapping: - dir = os.path.join(dir, "test", "src", "main", "java") - return os.path.join(dir, *after) - -def getMappingDir(base, mapping, dirnames): - """Get the directory for the given mapping.""" - lang = getDefaultMapping() - after = [] - before = base - while len(before) > 0: - current = os.path.basename(before) - before = os.path.dirname(before) - if current == lang: - break - after.insert(0, current) - else: - raise RuntimeError("cannot find language dir") - return os.path.join(before, mapping, *dirnames) - -def getClientCrossTestDir(base): - """Get the client directory from client-home for the given test.""" - global clientHome - if not clientHome: - return base - - lang = getDefaultMapping() - after = [] - before = base - while len(before) > 0: - current = os.path.basename(before) - before = os.path.dirname(before) - if current == lang: - break - after.insert(0, current) - else: - raise RuntimeError("cannot find language dir") - return os.path.join(clientHome, lang, *after) - - -def clientServerTest(cfgName = None, additionalServerOptions = "", additionalClientOptions = "", - server = None, client = None, serverenv = None, clientenv = None, - interpreterOptions = ""): - lang = getDefaultMapping() - testdir = os.getcwd() - - # Setup the server. - if lang in ["ruby", "php", "js"]: - serverdir = getMirrorDir(testdir, "cpp") - else: - serverdir = testdir - - if server is None: - server = getDefaultServerFile(serverdir) - elif lang in ["ruby", "php", "js"]: - server = getTestExecutable(server, serverdir) - - if client is None: - client = getDefaultClientFile() - - serverDesc = os.path.basename(server) - clientDesc = os.path.basename(client) - - if lang != "java" and lang != "java-compat": - server = os.path.join(serverdir, server) - - if serverenv is None: - if lang in ["ruby", "php", "js"]: - serverenv = getTestEnv("cpp", serverdir) - else: - serverenv = getTestEnv(lang, serverdir) - - global cross - if len(cross) > 0: - if lang == "js" and cross[0] != lang: - print("** skipping js cross test ") - return - elif len(cross) == 0: - cross.append(lang) - - global controller - global clientHome - for clientLang in cross: - clientCfg = DriverConfig("client") - if clientLang != lang: - if clientDesc != os.path.basename(getDefaultClientFile()): - print("** skipping cross test") - return - - if clientHome: - clientdir = getMirrorDir(getClientCrossTestDir(testdir), clientLang) - else: - clientdir = getMirrorDir(testdir, clientLang) - - client = getDefaultClientFile(clientLang, clientdir) - clientDesc = os.path.basename(client) - clientCfg.lang = clientLang - - if not os.path.exists(clientdir): - print("** no matching test for %s" % clientLang) - return - else: - if clientHome: - clientdir = getClientCrossTestDir(testdir) - else: - clientdir = testdir - if not os.path.exists(clientdir): - print("** no matching test for %s" % clientLang) - return - - if clientLang != "java" and clientLang != "java-compat": - client = os.path.join(clientdir, client) - - if clientenv is None: - clientenv = getTestEnv(clientLang, clientdir) - - clientExe = client - serverExe = server - - if appverifier: - setAppVerifierSettings([clientExe, serverExe]) - if not controller: - sys.stdout.write("starting " + serverDesc + "... ") - sys.stdout.flush() - serverCfg = DriverConfig("server") - if lang in ["ruby", "php", "js"]: - serverCfg.lang = "cpp" - - server = getCommandLine(server, serverCfg, additionalServerOptions, interpreterOptions) - serverProc = spawnServer(server, env = serverenv, lang=serverCfg.lang, mx=serverCfg.mx) - print("ok") - sys.stdout.flush() - - if not serverOnly: - if clientLang == lang: - sys.stdout.write("starting %s... " % clientDesc) - else: - sys.stdout.write("starting %s %s ... " % (clientLang, clientDesc)) - sys.stdout.flush() - if not controller: - cfgName = None - if clientLang == "js" and es5 and client.find("/es5/") == -1: - client = client.replace("test/Ice/", "test/Ice/es5/") - client = client.replace("test/Glacier2/", "test/Glacier2/es5/") - - client = getCommandLine(client, clientCfg, additionalClientOptions, interpreterOptions, cfgName) - clientProc = spawnClient(client, env = clientenv, cwd = clientdir, startReader = False, lang=clientCfg.lang) - print("ok") - - global watchDog - clientProc.startReader(watchDog) - clientProc.waitTestSuccess() - - if not controller: - serverProc.waitTestSuccess() - - if appverifier: - appVerifierAfterTestEnd([clientExe, serverExe]) - -def collocatedTest(additionalOptions = ""): - if controller or serverOnly: - print("** skipping collocated test") - return - lang = getDefaultMapping() - if len(cross) > 0 and cross[0] != lang: - print("** skipping cross test") - return - testdir = os.getcwd() - - collocated = getDefaultCollocatedFile() - if lang != "java" and lang != "java-compat": - collocated = os.path.join(testdir, collocated) - - exe = collocated - if appverifier: - setAppVerifierSettings([exe]) - - env = getTestEnv(lang, testdir) - - sys.stdout.write("starting collocated... ") - sys.stdout.flush() - collocated = getCommandLine(collocated, DriverConfig("colloc"), additionalOptions) - collocatedProc = spawnClient(collocated, env = env, startReader = False, lang=lang) - print("ok") - - global watchDog - collocatedProc.startReader(watchDog) - collocatedProc.waitTestSuccess() - if appverifier: - appVerifierAfterTestEnd([exe]) - -def clientEchoTest(additionalServerOptions = "", additionalClientOptions = "", - server = None, client = None, serverenv = None, clientenv = None): - - lang = getDefaultMapping() - testdir = os.getcwd() - - # Setup the server. - if lang in ["ruby", "php", "js"]: - serverdir = getMappingDir(testdir, "cpp", ["test", "Ice", "echo"]) - else: - serverdir = testdir - - if server is None: - server = getDefaultServerFile(serverdir) - if client is None: - client = getDefaultClientFile() - serverDesc = server - clientDesc = client - - if lang != "java" and lang != "java-compat": - server = os.path.join(serverdir, server) - - if serverenv is None: - if lang in ["ruby", "php", "js"]: - serverenv = getTestEnv("cpp", serverdir) - else: - serverenv = getTestEnv(lang, serverdir) - - global cross - if len(cross) == 0: - cross.append(lang) - - global clientHome - for clientLang in cross: - clientCfg = DriverConfig("client") - if clientLang != lang: - if clientDesc != getDefaultClientFile(): - print("** skipping cross test") - return - - clientCfg.lang = clientLang - client = getDefaultClientFile(clientLang) - if clientHome: - clientdir = getMirrorDir(getClientCrossTestDir(testdir), clientLang) - else: - clientdir = getMirrorDir(testdir, clientLang) - if not os.path.exists(clientdir): - print("** no matching test for %s" % clientLang) - return - else: - if clientHome: - clientdir = getClientCrossTestDir(testdir) - else: - clientdir = testdir - if not os.path.exists(clientdir): - print("** no matching test for %s" % clientLang) - return - - if clientLang != "java" and clientLang != "java-compat": - client = os.path.join(clientdir, client) - - if clientenv is None: - clientenv = getTestEnv(clientLang, clientdir) - - clientExe = client - serverExe = server - - if appverifier: - setAppVerifierSettings([clientExe, serverExe]) - - sys.stdout.write("starting " + serverDesc + "... ") - sys.stdout.flush() - serverCfg = DriverConfig("server") - if lang in ["ruby", "php", "js"]: - serverCfg.lang = "cpp" - server = getCommandLine(server, serverCfg, additionalServerOptions) - serverProc = spawnServer(server, env = serverenv, lang=serverCfg.lang, mx=serverCfg.mx) - print("ok") - sys.stdout.flush() - - if not serverOnly: - if clientLang == lang: - sys.stdout.write("starting %s... " % clientDesc) - else: - sys.stdout.write("starting %s %s ... " % (clientLang, clientDesc)) - sys.stdout.flush() - - if clientLang == "js" and es5 and client.find("/es5/") == -1: - client = client.replace("test/Ice/", "test/Ice/es5/") - - client = getCommandLine(client, clientCfg, additionalClientOptions) - clientProc = spawnClient(client, env = clientenv, startReader = False, lang=clientCfg.lang) - print("ok") - clientProc.startReader() - clientProc.waitTestSuccess() - - serverProc.waitTestSuccess() - - if appverifier: - appVerifierAfterTestEnd([clientExe, serverExe]) - -def cleanDbDir(path): - if os.path.exists(os.path.join(path, "__Freeze", "lock")): - os.remove(os.path.join(path, "__Freeze", "lock")) - if os.path.exists(os.path.join(path, "__Freeze")): - os.rmdir(os.path.join(path, "__Freeze")) - # - # We include __Freeze in this list even though we just removed it - see ICE-5108. - # - ignore = [".gitignore", "DB_CONFIG", "__Freeze"] - for filename in [ os.path.join(path, f) for f in os.listdir(path) if f not in ignore ]: - os.remove(filename) - -def startClient(exe, args = "", config=None, env=None, echo = True, startReader = True, clientConfig = False, iceOptions = None, iceProfile = None): - if config is None: - config = DriverConfig("client") - if env is None: - env = getTestEnv(getDefaultMapping(), os.getcwd()) - interpreterOptions = "" - if config.lang == "php": - interpreterOptions = phpProfileSetup(clientConfig, iceOptions, iceProfile) - - cmd = getCommandLine(exe, config, args, interpreterOptions) - - return spawnClient(cmd, env = env, echo = echo, startReader = startReader, lang=config.lang) - -def startServer(exe, args = "", config = None, env = None, adapter = None, count = 1, echo = True, timeout = 60, - interpreterOptions = ""): - if config is None: - config = DriverConfig("server") - if env is None: - env = getTestEnv(getDefaultMapping(), os.getcwd()) - cmd = getCommandLine(exe, config, args, interpreterOptions) - return spawnServer(cmd, env = env, adapter = adapter, count = count, echo = echo, lang = config.lang, - mx = config.mx, timeout = timeout) - -def startColloc(exe, args, config=None, env=None, interpreterOptions = ""): - exe = quoteArgument(exe) - if config is None: - config = DriverConfig("colloc") - if env is None: - env = getTestEnv(config.lang, testdir) - cmd = getCommandLine(exe, config, args, interpreterOptions) - return spawnClient(cmd, env = env, lang=config.lang) - -def simpleTest(exe = None, options = "", interpreterOptions = ""): - if exe is None: - exe = getDefaultClientFile() - if appverifier: - setAppVerifierSettings([quoteArgument(exe)]) - - testdir = os.getcwd() - - config = DriverConfig("client") - env = getTestEnv(config.lang, testdir) - - sys.stdout.write("starting client... ") - sys.stdout.flush() - command = getCommandLine(exe, config, options, interpreterOptions) - client = spawnClient(command, startReader = False, env = env, lang = config.lang) - print("ok") - client.startReader() - client.waitTestSuccess() - - if appverifier: - appVerifierAfterTestEnd([exe]) - -def createFile(path, lines, enc=None): - if sys.version_info[0] > 2 and enc: - config = open(path, "w", encoding=enc) - else: - config = open(path, "wb") - for l in lines: - config.write("%s\n" % l) - config.close() - -def getCppBinDir(lang = None): - binDir = os.path.join(getIceDir("cpp"), "bin") - - if isWin32(): - binDir = os.path.join(binDir, "x64" if x64 else "Win32", "Debug" if buildMode == "debug" else "Release") - - if isMINGW() and x64: - binDir = os.path.join(binDir, "x64") - if iceHome: - if lang == None: - lang = getDefaultMapping() - if isVC110() and lang != "python": - binDir = os.path.join(binDir, "vc110") - elif isVC140(): - binDir = os.path.join(binDir, "vc140") - if x64: - if isSolaris(): - if isSparc(): - binDir = os.path.join(binDir, "sparcv9") - else: - binDir = os.path.join(binDir, "amd64") - elif isWin32() and lang != "php": - binDir = os.path.join(binDir, "x64") - - return binDir - -def getSliceTranslator(lang = "cpp"): - compiler = "" - if iceHome: - compiler = os.path.join(iceHome, "bin", "slice2%s" % lang) - else: - compiler = os.path.join(getCppBinDir(), ("slice2%s" % lang)) - if isWin32(): - compiler += ".exe" - return compiler - -def getCppLibDir(lang = None): - if isWin32(): - return getCppBinDir(lang) - else: - libDir = os.path.join(getIceDir("cpp"), "lib") - if isUbuntu() or isDebian(): - libDir = os.path.join(libDir, dpkgHostMultiArch()) - elif x64: - if isSolaris(): - if isSparc(): - libDir = os.path.join(libDir, "64") - else: - libDir = os.path.join(libDir, "amd64") - if isLinux(): - libDir = libDir + "64" - return libDir - return None - -def getServiceDir(): - global serviceDir - if serviceDir is None: - if iceHome: - serviceDir = os.path.join(iceHome, "bin") - else: - serviceDir = "C:\\Program Files\ZeroC\Ice-" + iceVersion + "\\bin" - return serviceDir - -def getTestEnv(lang, testdir): - global compact - env = os.environ.copy() - - # - # Jar files from the source of binary distribution - # - iceJARs = ["ice", "glacier2", "freeze", "icebox", "icestorm", "icegrid", "icepatch2", "icediscovery", - "icelocatordiscovery"] - jarSuffix = "-" + ("compat-") if lang == "java-compat" else "" + getIceJsonVersion() + ".jar" - - # First sanitize the environment. - env["CLASSPATH"] = sanitize(os.getenv("CLASSPATH", "")) - - for d in additionalBinDirectories: - addLdPath(d, env) - - # - # Add cpp/test/Common output directory to the env - # - if lang == "cpp": - baseDir = os.path.join(toplevel, "cpp", "test", "Common") - addLdPath(os.path.join(baseDir, getTestDirectory("testcommon", baseDir)), env) - - # Make sure bzip2 can be found by x86 C# builds on x64 platforms - if lang == "csharp" and not x64: - addPathToEnv("PATH", os.path.join(getCppBinDir("csharp"), "x64"), env) - - # Add test directory to env - if lang == "cpp": - addLdPath(os.path.join(testdir), env) - elif lang == "java" or lang == "java-compat": - addClasspath(os.path.join(testToplevel, lang, "lib", "test.jar"), env) - elif lang == "js": - if es5 and testdir.find("/es5/") == -1: - testdir = testdir.replace("test/Ice/", "test/Ice/es5/") - testdir = testdir.replace("test/Glacier2/", "test/Glacier2/es5/") - addPathToEnv("NODE_PATH", os.path.join(testdir), env) - - # NodeJS is always installed locally even when testing against a binary installation - if os.environ.get("USE_BIN_DIST", "no") != "yes": - addPathToEnv("NODE_PATH", os.path.join(getIceDir("js", testdir), "src"), env) - - if isWin32(): - if lang == "java" and javaLibraryPath: - addPathToEnv("PATH", javaLibraryPath, env) - - if lang == "csharp" and not iceHome: - pkgdir = os.path.join(getIceDir("cpp"), "msbuild", "packages") - pkgsubdir = os.path.join("build", "native", "bin", "x64", "Release") - if isVC120(): - addPathToEnv("PATH", os.path.join(pkgdir, "bzip2.v120.1.0.6.4", pkgsubdir), env) - else: - addPathToEnv("PATH", os.path.join(pkgdir, "bzip2.v140.1.0.6.4", pkgsubdir), env) - - # - # If Ice is installed on the system, set the CLASSPATH for Java and - # NODE_PATH for JavaScript - # - if iceHome in ["/usr", "/usr/local"]: - if lang == "java": - javaDir = os.path.join(iceHome, "share", "java") - for jar in iceJARs: - addClasspath(os.path.join(javaDir, jar + jarSuffix), env) - return env # That's it, we're done! - - # - # For Win32 we always need to add the bin dir to the PATH. For - # others we just need to add it for scripting languages that use - # C++ extensions (py, ruby, php) - # - if isWin32(): - if lang == "java": - addLdPath(os.path.join(getIceDir("cpp"), "bin", "x64" if x64 else ""), env) # Add bin for db53_vc100.dll - addLdPath(getCppLibDir(lang), env) - elif isAIX(): - addLdPath(getCppLibDir(lang), env) - elif lang in ["python", "ruby", "php", "js", "objective-c"]: - # C++ binaries use rpath $ORIGIN or similar to find the Ice libraries - addLdPath(getCppLibDir(lang), env) - - if lang == "java": - # The Ice.jar and Freeze.jar comes from the installation - # directory or the toplevel dir. - javaDir = os.path.join(getIceDir("java", testdir), "lib") - for jar in iceJARs: - addClasspath(os.path.join(javaDir, jar + jarSuffix), env) - - # - # On Windows, C# assemblies are found thanks to the .exe.config files. - # - if lang == "csharp": - if compact: - addPathToEnv("DEVPATH", os.path.join(getIceDir("csharp", testdir), "Assemblies", "cf"), env) - elif isWin32(): - addPathToEnv("DEVPATH", os.path.join(getIceDir("csharp", testdir), "Assemblies"), env) - else: - addPathToEnv("MONO_PATH", os.path.join(getIceDir("csharp", testdir), "Assemblies"), env) - - if os.environ.get("USE_BIN_DIST", "no") != "yes": - # - # On Windows x64, set PYTHONPATH to python/x64. - # - if lang == "python": - pythonDir = os.path.join(getIceDir("python", testdir), "python") - if isWin32(): - addPathToEnv("PYTHONPATH", pythonDir, env) - pythonDir = os.path.join(pythonDir, "Win32" if x86 else "x64", "Debug" if buildMode == "debug" else "Release") - addPathToEnv("PYTHONPATH", pythonDir, env) - - # - # If testing with source dist we need to set RUBYLIB - # - if lang == "ruby": - addPathToEnv("RUBYLIB", os.path.join(getIceDir("ruby", testdir), "ruby"), env) - - return env; - -def getTestName(): - lang = getDefaultMapping() - base = os.getcwd() - - if "java" in lang: - # Remove Java's extra directory structure from the path while we search it - base = base.replace(os.path.join("src", "main", "java", "test"), '') - - here = base.split(os.sep) - here.reverse() - for i in range(0, len(here)): - if here[i] == lang: - break - else: - raise RuntimeError("cannot find language dir") - here = here[:i-1] - here.reverse() - # The crossTests list is in UNIX format. - return os.path.join(*here).replace(os.sep, '/') - -def stopWatchDog(): - global watchDog - watchDog.stop() - watchDog.join() - watchDog = None - -def joindog(dog): - dog.stop() - dog.join() - -class WatchDog(threading.Thread): - def __init__(self): - self._resetFlag = False - self._stopFlag = False - self._cv = threading.Condition() - threading.Thread.__init__(self) - - # The thread is marked as a daemon thread. The atexit handler - # joins with the thread on exit. If the thread is not daemon, - # the atexit handler will not be called. - self.setDaemon(True) - self.start() - atexit.register(joindog, self) - - def run(self): - try: - self._cv.acquire() - while True: - self._cv.wait(240) - if self._stopFlag: - break - if self._resetFlag: - self._resetFlag = False - else: - print("\a*** %s Warning: Test has been inactive for 4 minutes and may be hung" % - time.strftime("%x %X")) - self._cv.release() - except: - # - # Exceptions can be raised if the thread is still alive when the interpreter is - # in the process of shutting down. For example, Python resets module objects to None, - # so code such as "time.strftime()" can fail with AttributeError. - # - pass - - def reset(self): - self._cv.acquire() - self._resetFlag = True - self._cv.notify() - self._cv.release() - - def stop(self): - self._cv.acquire() - self._stopFlag = True - self._cv.notify() - self._cv.release() - -def processCmdLine(): - def usage(): - print("usage: " + sys.argv[0] + """ - --debug Display debugging information on each test. - --trace=<file> Display tracing. - --protocol=<prot> Run with the given protocol (tcp|ssl|ws|wss|bt). - --compress Run the tests with protocol compression. - --valgrind Run the tests with valgrind. - --appverifier Run the tests with appverifier. - --host=host Set --Ice.Default.Host=<host>. - --serialize Run with connection serialization. - --ipv6 Use IPv6 addresses. - --socks Use SOCKS proxy running on localhost. - --ice-home=<path> Use the binary distribution from the given path. - --mode=debug|release Run the tests with debug or release mode builds (win32 only)." - --x86 Binary distribution is 32-bit. - --x64 Binary distribution is 64-bit. - --c++11 Binary distribution is c++11. - --es5 Use JavaScript ES5 (Babel compiled code) - --static Binary distribution is static. - --env Print important environment variables. - --cross=lang Run cross language test. - --client-home=<dir> Run cross test clients from the given Ice source distribution. - --service-dir=<dir> Where to locate services for builds without service support. - --compact Ice for .NET uses the Compact Framework. - --winrt Run server with configuration suited for WinRT client. - --server Run only the server. - --mx Enable IceMX when running the tests. - --controller=<host> Use the test controller on the specified host. - --arg=<property> Append the given argument. - """) - sys.exit(2) - - try: - opts, args = getopt.getopt( - sys.argv[1:], "", ["debug", "trace=", "protocol=", "compress", "valgrind", "host=", "serialize", "ipv6", \ - "socks", "ice-home=", "mode=", "x86", "x64", "cross=", "client-home=", "env", \ - "service-dir=", "appverifier", "arg=", \ - "compact", "winrt", "server", "mx", "c++11", "es5", "static", "controller=", "configName="]) - except getopt.GetoptError: - usage() - - if args: - usage() - - global serverOnly - global winrt - global buildMode - for o, a in opts: - if o == "--ice-home": - global iceHome - iceHome = a - elif o == "--mode": - if a not in ( "debug", "release"): - usage() - buildMode = a - elif o == "--cross": - global cross - cross.append(a) - crossLang = ["cpp", "csharp", "java", "java-compat", "js", "php", "python", "ruby", "objective-c"] - if not a in crossLang: - print("cross must be one of %s" % ', '.join(crossLang)) - sys.exit(1) - if getTestName() not in crossTests: - print("*** This test does not support cross language testing") - sys.exit(0) - elif o == "--client-home": - global clientHome - clientHome = a - elif o == "--x64": - global x64 - x64 = True - elif o == "--x86": - global x86 - x86 = True - x64 = False - elif o == "--c++11": - global cpp11 - cpp11 = True - elif o == "--es5": - global es5 - es5 = True - elif o == "--static": - global static - static = True - elif o == "--compress": - global compress - compress = True - elif o == "--serialize": - global serialize - serialize = True - elif o == "--host": - global host - host = a - elif o == "--valgrind": - global valgrind - valgrind = True - elif o == "--appverifier": - if not isWin32() or getDefaultMapping() != "cpp": - print("--appverifier option is only supported for Win32 c++ tests.") - sys.exit(1) - global appverifier - appverifier = True - elif o == "--ipv6": - global ipv6 - ipv6 = True - elif o == "--socks": - global socksProxy - socksProxy = True - if o == "--trace": - global tracefile - if a == "stdout": - tracefile = sys.stdout - else: - tracefile = open(a, "w") - elif o == "--debug": - global debug - debug = True - elif o == "--env": - global printenv - printenv = True - elif o == "--protocol": - if a not in ("bt", "bts", "ws", "wss", "ssl", "tcp"): - usage() - # ssl protocol isn't directly supported with mono. - if mono and getDefaultMapping() == "csharp" and (a == "ssl" or a == "wss"): - print("SSL is not supported with mono") - sys.exit(1) - if a in ["bt", "bts"] and not isLinux(): - print("Bluetooth is only supported on Linux") - sys.exit(1) - global protocol - protocol = a - elif o == "--service-dir": - global serviceDir - serviceDir = a - elif o == "--compact": - global compact - compact = True - elif o == "--winrt": - winrt = True - serverOnly = True - elif o == "--server": - serverOnly = True - elif o == '--arg': - extraArgs.append(a) - elif o == "--mx": - global mx - mx = True - elif o == "--controller": - global controller - controller = a - elif o == "--configName": - global configName - configName = a - if protocol in ["ssl", "wss"] and not serverOnly and getDefaultMapping() == "js": - print("SSL is not supported with Node.js") - sys.exit(1) - - if len(args) > 0: - usage() - - if isWin32() and not buildMode: - print("Error: please define --mode=debug or --mode=release") - sys.exit(1) - - if not os.environ.get("TESTCONTROLLER"): - if iceHome: - sys.stdout.write("*** using Ice installation from " + iceHome + " ") - else: - sys.stdout.write("*** using Ice source dist ") - if armv7l: - sys.stdout.write("(ARMv7)") - elif x64: - sys.stdout.write("(64bit) ") - else: - sys.stdout.write("(32bit) ") - sys.stdout.write("\n") - -def runTests(start, expanded, num = 0, script = False): - total = 0 - for tests in expanded: - for i, args, config in tests: - total = total + 1 - # - # The configs argument is a list containing one or more test configurations. - # - index = 0 - for tests in expanded: - for i, args, config in tests: - index = index + 1 - if index < start: - continue - i = os.path.normpath(i) - - # Deal with Java's different directory structure - if i.find(os.path.join("java","test")) != -1: - dir = os.path.join(testToplevel, "java", "test", "src", "main", i) - elif i.find(os.path.join("java-compat","test")) != -1: - dir = os.path.join(testToplevel, "java-compat", "test", "src", "main", i.replace('-compat','')) - elif es5 and i.find(os.path.join("js","test")) != -1: - dir = os.path.join(testToplevel, i.replace("test/Ice/", "test/Ice/es5/") - .replace("test/Glacier2/", "test/Glacier2/es5/")) - else: - dir = os.path.join(testToplevel, i) - dir = os.path.normpath(dir) - - sys.stdout.write("\n") - if num > 0: - sys.stdout.write("[" + str(num) + "] ") - if script: - prefix = "echo \"" - suffix = "\"" - else: - prefix = "" - suffix = "" - - print("%s*** running tests %d/%d in %s%s" % (prefix, index, total, dir, suffix)) - sys.stdout.write("%s*** configuration: " % prefix) - if len(args.strip()) == 0: - sys.stdout.write("Default ") - else: - sys.stdout.write(args.strip() + " ") - print(suffix) - - if args.find("cross") != -1: - test = os.path.join(*i.split(os.sep)[2:]) - # The crossTests list is in UNIX format. - test = test.replace(os.sep, '/') - if not test in crossTests: - print("%s*** test does not support cross testing%s" % (prefix, suffix)) - continue - - if args.find("es5") != -1 and "noes5" in config: - print("%s*** test not supported with es5%s" % (prefix, suffix)) - continue - - # - # Skip tests not supported with IPv6 if necessary - # - if args.find("ipv6") != -1 and "noipv6" in config: - print("%s*** test not supported with IPv6%s" % (prefix, suffix)) - continue - - if args.find("compress") != -1 and "nocompress" in config: - print("%s*** test not supported with compression%s" % (prefix, suffix)) - continue - - if args.find("socks") != -1 and "nosocks" in config: - print("%s*** test not supported with SOCKS%s" % (prefix, suffix)) - continue - - if args.find("compact") != -1 and \ - ("nocompact" in config or \ - args.find("ssl") != -1 or \ - args.find("compress") != -1): - print("%s*** test not supported with Compact Framework%s" % (prefix, suffix)) - continue - - if args.find("mx") != -1 and "nomx" in config: - print("%s*** test not supported with IceMX enabled%s" % (prefix, suffix)) - continue - - if args.find("compact") == -1 and "compact" in config: - print("%s*** test requires Compact Framework%s" % (prefix, suffix)) - continue - - if isVista() and "novista" in config: - print("%s*** test not supported under Vista%s" % (prefix, suffix)) - continue - - if isDarwin() and "nodarwin" in config: - print("%s*** test not supported under Darwin%s" % (prefix, suffix)) - continue - - if isYocto() and "noyocto" in config: - print("%s*** test not supported under Yocto%s" % (prefix, suffix)) - continue - - if not isWin32() and "win32only" in config: - print("%s*** test only supported under Win32%s" % (prefix, suffix)) - continue - - if isVC100() and "novc100" in config: - print("%s*** test not supported with VC++ 10.0%s" % (prefix, suffix)) - continue - - if cpp11 and "noc++11" in config: - print("%s*** test not supported with C++11%s" % (prefix, suffix)) - continue - - if static and "nostatic" in config: - print("%s*** test not supported with static%s" % (prefix, suffix)) - continue - - if x86 and iceHome and "nomultiarch" in config: - print("%s*** test not supported with x86 in multiarch%s" % (prefix, suffix)) - continue - - if isMINGW() and "nomingw" in config: - print("%s*** test not supported with MINGW%s" % (prefix, suffix)) - continue - - if isWin32() and "nowin32" in config: - print("%s*** test not supported with Win32%s" % (prefix, suffix)) - continue - - # If this is mono and we're running ssl protocol tests - # then skip. This occurs when using --all. - if mono and ("nomono" in config or (i.find(os.path.join("csharp", "test")) != -1 and - (args.find("ssl") != -1 or args.find("wss") != -1))): - print("%s*** test not supported with mono%s" % (prefix, suffix)) - continue - - # - # Skip configurations not supported by node - # - if (i.find(os.path.join("js","test")) != -1 and - ((not serverOnly and (args.find("ssl") != -1 or - args.find("wss") != -1 or - args.find("ws") != -1)) or - args.find("compress") != -1 or - args.find("mx") != -1)): - print("%s*** test not supported with Node.js%s" % (prefix, suffix)) - continue - - if (args.find("ssl") != -1 or args.find("wss") != -1) and ("nossl" in config): - print("%s*** test not supported with IceSSL%s" % (prefix, suffix)) - continue - - if (args.find("bt") != -1 or args.find("bts") != -1) and ("bt" not in config): - print("%s*** test not supported with Bluetooth%s" % (prefix, suffix)) - continue - - if (args.find("ws") != -1 or args.find("wss") != -1) and ("nows" in config): - print("%s*** test not supported with IceWS%s" % (prefix, suffix)) - continue - - # If this is java and we're running ipv6 under windows then skip. - if isWin32() and i.find(os.path.join("java","test")) != -1 and args.find("ipv6") != -1 and \ - getJdkVersion().find("java version \"1.6") != -1: - print("%s*** test not supported under windows%s" % (prefix, suffix)) - continue - - # Skip tests not supported by valgrind - if args.find("valgrind") != -1 and ("novalgrind" in config or args.find("ssl") != -1 or - args.find("wss") != -1): - print("%s*** test not supported with valgrind%s" % (prefix, suffix)) - continue - - # Skip tests not supported by appverifier - if args.find("appverifier") != -1 and ("noappverifier" in config): - print("%s*** test not supported with appverifier%s" % (prefix, suffix)) - continue - - # Skip tests that no not exist for this language mapping - if not os.path.exists(dir): - print("%s*** test does not exist for this language mapping%s" % (prefix, suffix)) - continue - - if script: - print("echo \"*** test started: `date`\"") - print("cd %s" % dir) - else: - print("*** test started: " + time.strftime("%x %X")) - sys.stdout.flush() - os.chdir(dir) - - global keepGoing - if script: - print("if ! %s %s %s; then" % (sys.executable, os.path.join(dir, "run.py"), args)) - print(" echo 'test in %s failed'" % os.path.abspath(dir)) - if not keepGoing: - print(" exit 1") - print("fi") - else: - if isWin32(): - if dir.find(os.path.join("js", "test")) != -1 and es5 and dir.find("\\es5\\") == -1: - dir = dir.replace("test\\Ice\\", "test\\Ice\\es5\\").replace("test\\Glacier2\\", "test\\Glacier2\\es5\\") - else: - if dir.find(os.path.join("js", "test")) != -1 and es5 and dir.find("/es5/") == -1: - dir = dir.replace("test/Ice/", "test/Ice/es5/").replace("test/Glacier2/", "test/Glacier2/es5/") - status = os.system(sys.executable + " " + quoteArgument(os.path.join(dir, "run.py")) + " " + args) - if status: - status = status if isWin32() else (status >> 8) - if(num > 0): - sys.stdout.write("[" + str(num) + "] ") - message = "test in " + os.path.abspath(dir) + " failed with exit status", status, - print(message) - if not keepGoing: - sys.exit(status) - else: - print(" ** Error logged and will be displayed again when suite is completed **") - global testErrors - testErrors.append(message) - -class ClientServerTest: - def __init__(self, cfgName, message, additionalServerOptions, additionalClientOptions, - server, client, serverenv, clientenv, interpreterOptions, localOnly): - if cfgName is None: - cfgName = "default" - self.cfgName = cfgName - self.message = message - self.additionalServerOptions = additionalServerOptions - self.additionalClientOptions = additionalClientOptions - self.server = server - self.client = client - self.serverenv = serverenv - self.clientenv = clientenv - self.interpreterOptions = interpreterOptions - self.localOnly = localOnly - - def getConfigName(self): - return self.cfgName - - def getMessage(self): - return self.message - - def isLocalOnly(self): - return self.localOnly - - def getDefaultMessage(self): - return "Running test with regular server." - - def run(self): - clientServerTest(self.cfgName, self.additionalServerOptions, self.additionalClientOptions, self.server, - self.client, self.serverenv, self.clientenv, self.interpreterOptions) - -def queueClientServerTest(configName = None, message = None, additionalServerOptions = "", - additionalClientOptions = "", server = None, client = None, serverenv = None, - clientenv = None, interpreterOptions = "", localOnly = False): - global queuedTests - queuedTests.append(ClientServerTest(configName, message, additionalServerOptions, additionalClientOptions, server, - client, serverenv, clientenv, interpreterOptions, localOnly)) - -class CollocatedTest: - def __init__(self, message = None, additionalOptions = ""): - self.message = message - self.additionalOptions = additionalOptions - - def getMessage(self): - return self.message - - def isLocalOnly(self): - return True - - def getDefaultMessage(self): - return "Running test with collocated server." - - def run(self): - collocatedTest(self.additionalOptions) - -def queueCollocatedTest(message = None, additionalOptions = ""): - global queuedTests - queuedTests.append(CollocatedTest(message, additionalOptions)) - -def runQueuedTests(): - global queuedTests - global serverOnly - global controller - global configName - - if serverOnly: - name = configName - if not name: - name = "default" - - for t in queuedTests: - if isinstance(t, ClientServerTest) and t.getConfigName() == name: - t.run() - return - - print("no queued test found matching configuration name `" + name + "'") - sys.exit(1) - - tests = [] - for t in queuedTests: - if controller and t.isLocalOnly(): - continue - tests.append(t) - - for t in tests: - msg = t.getMessage() - if msg: - print(msg) - elif len(tests) > 1: - print(t.getDefaultMessage()) - t.run() - -if "ICE_CONFIG" in os.environ: - os.unsetenv("ICE_CONFIG") - -import inspect -frame = inspect.currentframe() -# Move to the top-most frame in the callback. -while frame.f_back is not None: - frame = frame.f_back -if os.path.split(frame.f_code.co_filename)[1] == "run.py": - # If we're not in the test directory, chdir to the correct - # location. - if not os.path.isabs(sys.argv[0]): - d = os.path.join(os.getcwd(), sys.argv[0]) - else: - d = sys.argv[0] - d = os.path.split(d)[0] - if os.path.normpath(d) != os.getcwd(): - os.chdir(d) - processCmdLine() - -def getTestDirectory(name, baseDir = os.getcwd()): - if isWin32(): - buildDir = "msbuild" - platform = "x64" if x64 else "Win32" - if cpp11: - configuration = "Cpp11-Debug" if buildMode == "debug" else "Cpp11-Release" - else: - configuration = "Debug" if buildMode == "debug" else "Release" - else: - buildDir = "build" - if isDarwin(): - platform = "macosx" - elif isUbuntu() or isDebian(): - platform = "x86_64-linux-gnu" if x64 else "i386-linux-gnu" - elif isAIX(): - platform = "ppc64" if x64 else "ppc" - else: - platform = "x64" if x64 else "x86" - configuration = ("cpp11-" if cpp11 else "") + ("static" if static else "shared") - - if os.path.isdir(os.path.join(baseDir, buildDir, name)): - return os.path.join(buildDir, name, platform, configuration) - else: - return os.path.join(buildDir, platform, configuration) - -def getTestExecutable(name, baseDir = os.getcwd()): - return os.path.join(getTestDirectory(name, baseDir), name) - -# -# Used for tests which have Ice as a submodule -# -def setTestToplevel(path): - global testToplevel - testToplevel = path - -# -# Used for Freeze -# -def setJavaLibraryPath(path): - global javaLibraryPath - javaLibraryPath = path diff --git a/scripts/Util.py b/scripts/Util.py new file mode 100644 index 00000000000..17f88cd3771 --- /dev/null +++ b/scripts/Util.py @@ -0,0 +1,2114 @@ +# ********************************************************************** +# +# 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, runpy, getopt, traceback, types, threading, time, datetime, re, itertools, random, subprocess, shutil + +isPython2 = sys.version_info[0] == 2 +if isPython2: + import Queue as queue + from StringIO import StringIO +else: + import queue + from io import StringIO + +from collections import OrderedDict +import Expect + +toplevel = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) + +def run(cmd, cwd=None): + p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd) + if(p.wait() != 0): + raise RuntimeError(cmd + " failed:\n" + p.stdout.read().strip()) + return p.stdout.read().decode('UTF-8').strip() + +def val(v, escapeQuotes=False, quoteValue=True): + if type(v) == bool: + return "1" if v else "0" + elif type(v) == str: + if not quoteValue or v.find(" ") < 0: + return v + elif escapeQuotes: + return "\\\"{0}\\\"".format(v.replace("\\\"", "\\\\\\\"")) + else: + return "\"{0}\"".format(v) + else: + return str(v) + +def getIceSoVersion(): + config = open(os.path.join(toplevel, "cpp", "include", "IceUtil", "Config.h"), "r") + intVersion = int(re.search("ICE_INT_VERSION ([0-9]*)", config.read()).group(1)) + majorVersion = int(intVersion / 10000) + minorVersion = int(intVersion / 100) - 100 * majorVersion + patchVersion = intVersion % 100 + if patchVersion < 50: + return '%d' % (majorVersion * 10 + minorVersion) + elif patchVersion < 60: + return '%da%d' % (majorVersion * 10 + minorVersion, patchVersion - 50) + else: + return '%db%d' % (majorVersion * 10 + minorVersion, patchVersion - 60) + +class Platform: + + def __init__(self): + self.parseBuildVariables({ + "supported-platforms" : ("supportedPlatforms", lambda s : s.split(" ")), + "supported-configs" : ("supportedConfigs", lambda s : s.split(" ")) + }) + + def parseBuildVariables(self, variables): + # Run make to get the values of the given variables + output = run('make print V="{0}"'.format(" ".join(variables.keys())), cwd = toplevel) + for l in output.split("\n"): + match = re.match(r'^.*:.*: (.*) = (.*)', l) + if match and match.group(1): + if match.group(1) in variables: + (varname, valuefn) = variables[match.group(1).strip()] + value = match.group(2).strip() or "" + setattr(self, varname, valuefn(value) if valuefn else value) + + def getDefaultBuildPlatform(self): + return os.environ.get("PLATFORMS", "").split(" ")[0] or self.supportedPlatforms[0] + + def getDefaultBuildConfig(self): + return os.environ.get("CONFIGS", "").split(" ")[0] or self.supportedConfigs[0] + + def getBinSubDir(self, mapping, current): + # Return the bin sub-directory for the given mapping,platform,config, + # to be overriden by specializations + return "bin" + + def getLibSubDir(self, mapping, current): + # Return the bin sub-directory for the given mapping,platform,config, + # to be overriden by specializations + return "lib" + + def getBuildSubDir(self, name, current): + # Return the build sub-directory, to be overriden by specializations + return os.path.join("build", current.config.buildPlatform, current.config.buildConfig) + + def getLdPathEnvName(self): + return "LD_LIBRARY_PATH" + + def getIceDir(self): + return "/usr" + + def getSliceDir(self, iceDir): + if iceDir.startswith("/usr"): + return os.path.join(iceDir, "share", "ice", "slice") + else: + return os.path.join(iceDir, "slice") + + def getDefaultExe(self, name, config): + if name == "icebox" and config.cpp11: + name += "++11" + return name + + def hasOpenSSL(self): + # This is used by the IceSSL test suite to figure out how to setup certificates + return False + + def canRun(self, current): + return True + +class Darwin(Platform): + + def getDefaultBuildPlatform(self): + return "macosx" + + def getLdPathEnvName(self): + return "DYLD_LIBRARY_PATH" + + def getIceDir(self): + return "/usr/local" + +class AIX(Platform): + + def hasOpenSSL(self): + return True + +class Linux(Platform): + + def __init__(self): + Platform.__init__(self) + self.parseBuildVariables({ + "linux_id" : ("linuxId", None), + "build-platform" : ("buildPlatform", None), + "foreign-platforms" : ("foreignPlatforms", lambda s : s.split(" ") if s else []), + }) + self.multiArch = {} + if self.linuxId in ["ubuntu", "debian"]: + for p in [self.buildPlatform] + self.foreignPlatforms: + self.multiArch[p] = run("dpkg-architecture -f -a{0} -qDEB_HOST_MULTIARCH 2> /dev/null".format(p)) + + def hasOpenSSL(self): + return True + + def getBinSubDir(self, mapping, current): + if self.linuxId in ["ubuntu", "debian"] and current.config.buildPlatform in self.foreignPlatforms: + return os.path.join("bin", self.multiArch[current.config.buildPlatform]) + return "bin" + + def getLibSubDir(self, mapping, current): + if self.linuxId in ["centos", "rhel", "fedora"]: + return "lib64" if current.config.buildPlatform == "x64" else "lib" + elif self.linuxId in ["ubuntu", "debian"]: + return os.path.join("lib", self.multiArch[current.config.buildPlatform]) + return "lib" + + def getBuildSubDir(self, name, current): + if self.linuxId in ["ubuntu", "debian"]: + return os.path.join("build", self.multiArch[current.config.buildPlatform], current.config.buildConfig) + else: + return os.path.join("build", current.config.buildPlatform, current.config.buildConfig) + + def getDefaultExe(self, name, config): + if name == "icebox": + if self.linuxId in ["centos", "rhel", "fedora"] and config.buildPlatform == "x86": + name += "32" # Multilib platform + if config.cpp11: + name += "++11" + return name + + def canRun(self, current): + if self.linuxId in ["centos", "rhel", "fedora"] and current.config.buildPlatform == "x86": + # + # Don't test Glacier2/IceStorm/IceGrid services with multilib platforms. We only + # build services for the native platform. + # + parent = re.match(r'^([\w]*).*', current.testcase.getTestSuite().getId()).group(1) + if parent in ["Glacier2", "IceStorm", "IceGrid"]: + return False + return True + +class Windows(Platform): + + def parseBuildVariables(self, variables): + pass # Nothing to do, we don't support the make build system on Windows + + def getDefaultBuildPlatform(self): + return "Win32" + + def getDefaultBuildConfig(self): + return "Debug" + + def getCompiler(self): + out = run("cl") + if out.find("Version 16.") != -1: + return "v100" + elif out.find("Version 17.") != -1: + return "v110" + elif out.find("Version 18.") != -1: + return "v120" + elif out.find("Version 19.") != -1: + return "v140" + + def getBinSubDir(self, mapping, current): + c = current.config + if isinstance(mapping, CppMapping) or isinstance(mapping, PhpMapping): + return os.path.join("bin", c.buildPlatform, "Debug" if c.buildConfig.find("Debug") >= 0 else "Release") + return "bin" + + def getLibSubDir(self, mapping, current): + c = current.config + if isinstance(mapping, CppMapping): + return os.path.join("bin", c.buildPlatform, "Debug" if c.buildConfig.find("Debug") >= 0 else "Release") + elif isinstance(mapping, PhpMapping): + return os.path.join("lib", c.buildPlatform, "Debug" if c.buildConfig.find("Debug") >= 0 else "Release") + return "lib" + + def getBuildSubDir(self, name, current): + return os.path.join("msbuild", name, current.config.buildPlatform, current.config.buildConfig) + + def getLdPathEnvName(self): + return "PATH" + + def getIceDir(self): + return None + + def canRun(self, current): + # + # On Windows, if testing with a binary distribution, don't test Glacier2/IceStorm services + # with the Debug configurations since we don't provide binaries for them. + # + if current.driver.useBinDist(): + parent = re.match(r'^([\w]*).*', current.testcase.getTestSuite().getId()).group(1) + if parent in ["Glacier2", "IceStorm"] and current.config.buildConfiguration.find("Debug") >= 0: + return False + return True + +platform = None +if sys.platform == "darwin": + platform = Darwin() +elif sys.platform.startswith("aix"): + platform = AIX() +elif sys.platform.startswith("linux") or sys.platform.startswith("gnukfreebsd"): + platform = Linux() +elif sys.platform == "win32" or sys.platform[:6] == "cygwin": + platform = Windows() + +if not platform: + print("can't run on unknown platform `{0}'".format(sys.platform)) + sys.exit(1) + +def parseOptions(obj, options, mapped={}): + # Transform configuration options provided on the command line to + # object data members. The data members must be already set on the + # object and with the correct type. + obj.parsedOptions=[] + remaining = [] + for (o, a) in options: + if o.startswith("--"): o = o[2:] + if o.startswith("-"): o = o[1:] + if o in mapped: + o = mapped[o] + + if hasattr(obj, o): + if isinstance(getattr(obj, o), bool): + setattr(obj, o, a.lower() in ("yes", "true", "1") if a else True) + elif isinstance(getattr(obj, o), list): + l = getattr(obj, o) + l.append(a) + else: + if not a and not isinstance(a, str): + a = "0" + setattr(obj, o, type(getattr(obj, o))(a)) + obj.parsedOptions.append(o) + else: + remaining.append((o, a)) + options[:] = remaining + + +class Mapping: + + mappings = OrderedDict() + + class Config: + + supportedOptions = ["protocol", "compress", "ipv6", "serialize", "mx"] + + # All option values for Ice/IceBox tests. + coreOptions = { + "protocol" : ["tcp", "ssl", "wss", "ws"], + "compress" : [False, True], + "ipv6" : [False, True], + "serialize" : [False, True], + "mx" : [False, True], + } + + # All option values for IceGrid/IceStorm/Glacier2/IceDiscovery tests. + serviceOptions = { + "protocol" : ["tcp", "wss"], + "compress" : [False, True], + "ipv6" : [False, True], + "serialize" : [False, True], + "mx" : [False, True], + } + + @classmethod + def getOptions(self): + return ("", ["config=", "platform=", "protocol=", "compress", "ipv6", "serialize", "mx", "cprops=", "sprops="]) + + @classmethod + def usage(self): + pass + + @classmethod + def commonUsage(self): + print("") + print("Mapping options:") + print("--protocol=<prot> Run with the given protocol.") + print("--compress Run the tests with protocol compression.") + print("--ipv6 Use IPv6 addresses.") + print("--serialize Run with connection serialization.") + print("--mx Run with metrics enabled.") + print("--cprops=<properties> Specifies a list of additional client properties.") + print("--sprops=<properties> Specifies a list of additional server properties.") + print("--config=<config> Build configuration for native executables.") + print("--platform=<platform> Build plaform for native executables.") + + def __init__(self, options=[]): + self.buildConfig = platform.getDefaultBuildConfig() + self.buildPlatform = platform.getDefaultBuildPlatform() + self.protocol = "tcp" + self.compress = False + self.serialize = False + self.ipv6 = False + self.mx = False + self.cprops = [] + self.sprops = [] + parseOptions(self, options, { "config" : "buildConfig", "platform" : "buildPlatform" }) + + def __str__(self): + s = [] + for o in self.parsedOptions: + v = getattr(self, o) + if v: s.append(o if type(v) == bool else str(v)) + return ",".join(s) + + def getAll(self, current, testcase, rand=False): + + # + # A generator to generate combinations of options (e.g.: tcp/compress/mx, ssl/ipv6/serialize, etc) + # + def gen(supportedOptions): + + if not supportedOptions: + yield self + return + + supportedOptions = supportedOptions.copy() + supportedOptions.update(testcase.getMapping().getOptions()) + supportedOptions.update(testcase.getTestSuite().getOptions()) + supportedOptions.update(testcase.getOptions()) + + for o in self.parsedOptions: + # Remove options which were explicitly set + if o in supportedOptions: + del supportedOptions[o] + + if len(supportedOptions) == 0: + yield self + return + + # Find the option with the longest list of values + length = max([len(v) for v in supportedOptions.values()]) + + # Replace the values with a cycle iterator on the values + for (k, v) in supportedOptions.items(): + supportedOptions[k] = itertools.cycle(random.sample(v, len(v)) if rand else v) + + # Now, for the length of the longuest array of values, we return + # an array with the supported option combinations + for i in range(0, length): + options = [] + for k, v in supportedOptions.items(): + v = next(v) + if v: + if type(v) == bool: + options.append(("--{0}".format(k), None)) + else: + options.append(("--{0}".format(k), v)) + + # Add parsed options + for o in self.parsedOptions: + v = getattr(self, o) + if type(v) == bool: + options.append(("--{0}".format(o), None)) + elif type(v) == list: + options += [("--{0}".format(o), e) for e in v] + else: + options.append(("--{0}".format(o), v)) + + yield self.__class__(options) + + options = None + parent = re.match(r'^([\w]*).*', testcase.getTestSuite().getId()).group(1) + if isinstance(testcase, ClientServerTestCase) and parent in ["Ice", "IceBox"]: + options = current.driver.filterOptions(testcase, self.coreOptions) + elif parent in ["IceGrid", "Glacier2", "IceStorm", "IceDiscovery"]: + options = current.driver.filterOptions(testcase, self.serviceOptions) + + return [c for c in gen(options)] + + def canRun(self, current): + if not platform.canRun(current): + return False + + options = {} + options.update(current.testcase.getTestSuite().getOptions()) + options.update(current.testcase.getOptions()) + for (k, v) in options.items(): + if not hasattr(self, k): + print("warning: unknown option `{0}' specified in `{1}'".format(k, current.testcase)) + continue + if not getattr(self, k) in v: + return False + else: + return True + + def getArgs(self, process, current): + return [] + + def getProps(self, process, current): + props = {} + if isinstance(process, IceProcess): + props["Ice.Warn.Connections"] = True + if self.protocol: + props["Ice.Default.Protocol"] = self.protocol + if self.compress: + props["Ice.Override.Compress"] = "1" + if self.serialize: + props["Ice.ThreadPool.Server.Serialize"] = "1" + if self.ipv6: + props.update({"Ice.IPv6": True, "Ice.PreferIPv6Address": True}) + if self.mx: + props["Ice.Admin.Endpoints"] = "default -h localhost" + props["Ice.Admin.InstanceName"] = "Server" if isinstance(process, Server) else "Client" + props["IceMX.Metrics.Debug.GroupBy"] ="id" + props["IceMX.Metrics.Parent.GroupBy"] = "parent" + props["IceMX.Metrics.All.GroupBy"] = "none" + + # Additional properties specified on the command line with --cprops or --sprops + additionalProps = [] + if self.cprops and isinstance(process, Client): + additionalProps = self.cprops + elif self.sprops and isinstance(process, Server): + additionalProps = self.sprops + for pps in additionalProps: + for p in pps.split(" "): + if p.find("=") > 0: + (k , v) = p.split("=") + props[k] = v + else: + props[p] = True + + return props + + @classmethod + def getByName(self, name): + if not name in self.mappings: + raise RuntimeError("unknown mapping `{0}'".format(name)) + return self.mappings.get(name) + + @classmethod + def getByPath(self, path): + path = os.path.abspath(path) + for m in self.mappings.values(): + if path.startswith(m.getPath()): + return m + + @classmethod + def add(self, name, mapping): + self.mappings[name] = mapping.init(name) + + @classmethod + def getAll(self): + languages = os.environ.get("LANGUAGES", None) + return [self.getByName(l) for l in languages.split(" ")] if languages else self.mappings.values() + + def __init__(self, path=None): + self.platform = None + self.name = None + self.path = os.path.abspath(path) if path else None + self.testsuites = {} + + def init(self, name): + self.name = name + if not self.path: + self.path = os.path.join(toplevel, name) + return self + + def __str__(self): + return self.name + + def createConfig(self, options): + return Mapping.Config(options) + + def filterTestSuite(self, testId, filters, rfilters): + for f in filters: + if not f.search(self.name + "/" + testId): + return True + else: + for f in rfilters: + if f.search(self.name + "/" + testId): + return True + return False + + def loadTestSuites(self, tests, filters=[], rfilters=[]): + for test in tests or [""]: + for root, dirs, files in os.walk(os.path.join(self.getTestsPath(), test)): + + testId = root[len(self.getTestsPath()) + 1:] + if os.sep != "/": + testId = testId.replace(os.sep, "/") + + if self.filterTestSuite(testId, filters, rfilters): + continue + + # + # First check if there's a test.py file in the directory, if there's one use it. + # + if "test.py" in files: + # + # WORKAROUND for Python issue 15230 (fixed in 3.2) where run_path doesn't work correctly. + # + #runpy.run_path(os.path.join(root, "test.py")) + origsyspath = sys.path + sys.path = [root] + sys.path + runpy.run_module("test", init_globals=globals(), run_name=root) + origsyspath = sys.path + continue + + # + # If there's no test.py file in the test directory, we check if there's a common + # script for the test in scripts/tests. If there's on we use it. + # + script = os.path.join(self.getCommonTestsPath(), testId + ".py") + if os.path.isfile(script): + runpy.run_module("tests." + testId.replace("/", "."), init_globals=globals(), run_name=root) + continue + + # + # Finally, we try to "discover/compute" the test by looking up for well-known + # files. + # + testcases = self.computeTestCases(testId, files) + if testcases: + TestSuite(root, testcases) + + def getTestSuites(self): + return self.testsuites.values() + + def addTestSuite(self, testsuite): + assert len(testsuite.path) > len(self.getTestsPath()) + 1 + testSuiteId = testsuite.path[len(self.getTestsPath()) + 1:] + self.testsuites[testSuiteId] = testsuite + return testSuiteId + + def findTestSuite(self, testsuite): + return self.testsuites.get(testsuite if isinstance(testsuite, str) else testsuite.id) + + def computeTestCases(self, testId, files): + + # Instantiate a new test suite if the directory contains well-known source files. + + def checkFile(f, m): + try: + # If given mapping is same as local mapping, just check the files set, otherwise check + # with the mapping + return (self.getDefaultSource(f) in files) if m == self else m.hasSource(testId, f) + except KeyError: + # Expected if the mapping doesn't support the process type (such as clientBidir) + return False + + checkClient = lambda f: checkFile(f, self.getClientMapping()) + checkServer = lambda f: checkFile(f, self.getServerMapping()) + + testcases = [] + if checkClient("client") and checkServer("server"): + testcases.append(ClientServerTestCase()) + if checkClient("client") and checkServer("serveramd") and self.getServerMapping() == self: + testcases.append(ClientAMDServerTestCase()) + if checkClient("client") and len(testcases) == 0: + testcases.append(ClientTestCase()) + if checkClient("collocated"): + testcases.append(CollocatedTestCase()) + if checkClient("clientBidir") and self.getServerMapping().hasSource("Ice/echo", "server"): + testcases.append(ClientEchoServerTestCase()) + if len(testcases) > 0: + return testcases + + def hasSource(self, testId, processType): + try: + return os.path.exists(os.path.join(self.getTestsPath(), testId, self.getDefaultSource(processType))) + except KeyError: + return False + + def getPath(self): + return self.path + + def getTestsPath(self): + return os.path.join(self.path, "test") + + def getCommonTestsPath(self): + return os.path.join(self.path, "..", "scripts", "tests") + + def getTestCwd(self, current): + return current.testcase.getPath() + + def getDefaultSource(self, processType): + return processType + + def getDefaultProcess(self, processType, testsuite): + # + # If no server or client is explictily set with a testcase, getDefaultProcess is called + # to figure out which process class to instantiate. Based on the processType and the testsuite + # we instantiate the right default process class. + # + if processType is None: + return None + elif testsuite.getId().startswith("IceUtil") or testsuite.getId().startswith("Slice"): + return SimpleClient() + elif testsuite.getId().startswith("IceGrid"): + if processType in ["client", "collocated"]: + return IceGridClient() + if processType in ["server", "serveramd"]: + return IceGridServer() + else: + return Server() if processType in ["server", "serveramd"] else Client() + + def getDefaultExe(self, processType, config): + return processType + + def getClientMapping(self): + # The client mapping is always the same as this mapping. + return self + + def getServerMapping(self): + # Can be overriden for client-only mapping that relies on another mapping for servers + return self + + def getBinDir(self, current): + return os.path.join(current.driver.getIceDir(self), platform.getBinSubDir(self, current)) + + def getLibDir(self, current): + return os.path.join(current.driver.getIceDir(self), platform.getLibSubDir(self, current)) + + def getBuildDir(self, name, current): + return platform.getBuildSubDir(name, current) + + def getCommandLine(self, current, process, exe): + name = exe + if isinstance(platform, Windows) and not exe.endswith(".exe"): + exe += ".exe" + if process.isFromBinDir(): + # If it's a process from the bin directory, the location is platform specific + # so we check with the platform. + return os.path.join(self.getBinDir(current), exe) + elif current.testcase: + # If it's a process from a testcase, the binary is in the test build directory. + return os.path.join(current.testcase.getPath(), current.getBuildDir(name), exe) + else: + return exe + + def getProps(self, process, current): + props = {} + if isinstance(process, IceProcess): + if current.config.protocol in ["bt", "bts"]: + props["Ice.Plugin.IceBT"] = self.getPluginEntryPoint("IceBT") + if current.config.protocol in ["ssl", "wss", "bts", "iaps"]: + props.update(self.getSSLProps(process, current.config.protocol)) + return props + + def getSSLProps(self, process, protocol="ssl"): + return { "Ice.Plugin.IceSSL" : self.getPluginEntryPoint("IceSSL") } + + def getArgs(self, process, current): + return [] + + def getEnv(self, process, current): + return {} + + def getOptions(self): + return {} + + def getRunOrder(self): + return ["Slice", "IceUtil", "Ice", "IceSSL", "IceBox", "Glacier2", "IceGrid", "IceStorm"] + + def getCrossTestSuites(self): + return [ + "Ice/ami", + "Ice/info", + "Ice/exceptions", + "Ice/enums", + "Ice/facets", + "Ice/inheritance", + "Ice/invoke", + "Ice/objects", + "Ice/operations", + "Ice/proxy", + "Ice/servantLocator", + "Ice/slicing/exceptions", + "Ice/slicing/objects", + "Ice/optional" + ] + +# +# A Runnable can be used as a "client" for in test cases, it provides +# implements run, setup and teardown methods. +# +class Runnable: + + def __init__(self, desc=None): + self.desc = desc + + def setup(self, current): + ### Only called when ran from testcase + pass + + def teardown(self, current, success): + ### Only called when ran from testcase + pass + + def run(self, current): + pass + +# +# A Process describes how to run an executable process. +# +class Process(Runnable): + + processType = None + + def __init__(self, exe=None, outfilters=[], quiet=False, args=[], props={}, envs={}, desc=None, mapping=None): + Runnable.__init__(self, desc) + self.exe = exe + self.outfilters = outfilters + self.quiet = quiet + self.args = args + self.props = props + self.envs = envs + self.process = None + self.mapping = mapping + + def __str__(self): + if not self.exe: + return str(self.__class__) + return self.exe + (" ({0})".format(self.desc) if self.desc else "") + + def getOutput(self): + assert(self.process) + + def d(s): + return s if isPython2 else s.decode("utf-8") if isinstance(s, bytes) else s + + output = d(self.process.getOutput()) + try: + # Apply outfilters to the output + if len(self.outfilters) > 0: + lines = output.split('\n') + newLines = [] + previous = "" + for line in [line + '\n' for line in lines]: + for f in self.outfilters: + if isinstance(f, types.LambdaType) or isinstance(f, types.FunctionType): + line = f(line) + elif f.search(line): + break + else: + if line.endswith('\n'): + if previous: + newLines.append(previous + line) + previous = "" + else: + newLines.append(line) + else: + previous += line + output = "".join(newLines) + output = output.strip() + return output + '\n' if output else "" + except Exception as ex: + print("unexpected exception while filtering process output:\n" + str(ex)) + raise + + def run(self, current, args=[], props={}, exitstatus=0, timeout=120): + class WatchDog: + + def __init__(self): + self.lastProgressTime = time.time() + self.lock = threading.Lock() + + def reset(self): + with self.lock: self.lastProgressTime = time.time() + + def lastProgress(self): + with self.lock: return self.lastProgressTime + + watchDog = WatchDog() + self.start(current, args, props, watchDog=watchDog) + if not self.quiet and not current.driver.isWorkerThread(): + # Print out the process output to stdout if we're running the client form the main thread. + self.process.trace(self.outfilters) + + try: + while True: + try: + self.process.waitSuccess(exitstatus=exitstatus, timeout=30) + break + except Expect.TIMEOUT: + if time.time() - watchDog.lastProgress() >= timeout: # If no progress, raise + raise + finally: + self.process.terminate() + # Write the output to the test case (but not on stdout) + if not self.quiet: + current.write(self.getOutput(), stdout=False) + + def getEffectiveArgs(self, current, args): + allArgs = [] + allArgs += current.driver.getArgs(self, current) + allArgs += current.config.getArgs(self, current) + allArgs += self.getMapping(current).getArgs(self, current) + allArgs += current.testcase.getArgs(self, current) + allArgs += self.getArgs(current) + allArgs += self.args(self, current) if callable(self.args) else self.args + allArgs += args + allArgs = [a.encode("utf-8") if type(a) == "unicode" else str(a) for a in allArgs] + return allArgs + + def getEffectiveProps(self, current, props): + allProps = {} + allProps.update(current.driver.getProps(self, current)) + allProps.update(current.config.getProps(self, current)) + allProps.update(self.getMapping(current).getProps(self, current)) + allProps.update(current.testcase.getProps(self, current)) + allProps.update(self.getProps(current)) + allProps.update(self.props(self, current) if callable(self.props) else self.props) + allProps.update(props) + return allProps + + def getEffectiveEnv(self, current): + allEnvs = {} + allEnvs.update(self.getMapping(current).getEnv(self, current)) + allEnvs.update(current.testcase.getEnv(self, current)) + allEnvs.update(self.getEnv(current)) + allEnvs.update(self.envs(self, current) if callable(self.envs) else self.envs) + return allEnvs + + def start(self, current, args=[], props={}, watchDog=None): + allArgs = self.getEffectiveArgs(current, args) + allProps = self.getEffectiveProps(current, props) + allEnvs = self.getEffectiveEnv(current) + + # Evaluate and transform properties into command line arguments + allArgs = ["--{0}={1}".format(k, val(v)) for k,v in allProps.items()] + [val(a) for a in allArgs] + + # Evaluate environment values + for k, v in allEnvs.items(): + allEnvs[k] = val(v, quoteValue=False) + + # Get command line from the mapping + cmd = self.getCommandLine(current) + if len(allArgs) > 0: + cmd += " " + " ".join(allArgs) + + # + # Props and arguments can use the format parameters set below in the kargs + # dictionary. It's time to convert them to their values. + # + kargs = { + "process": self, + "testcase": current.testcase, + "testdir": current.testcase.getPath(), + "icedir" : current.driver.getIceDir(current.testcase.getMapping()), + } + cmd = cmd.format(**kargs) + + if current.driver.debug: + if len(allEnvs) > 0: + current.writeln("({0} env={1})".format(cmd, allEnvs)) + else: + current.writeln("({0})".format(cmd)) + + env = os.environ.copy() + env.update(allEnvs) + + cwd = self.getMapping(current).getTestCwd(current) + + self.process = Expect.Expect(cmd, startReader=False, env=env, cwd=cwd, desc=self.desc) + self.process.startReader(watchDog) + try: + self.waitForStart(current) + except: + self.stop(current) + raise + + def waitForStart(self, current): + # To be overriden in specialization to wait for a token indiciating the process readyness. + pass + + def stop(self, current, waitSuccess=False): + if self.process: + try: + if waitSuccess: # Wait for the process to exit successfully by itself. + self.process.waitSuccess(timeout=60) + finally: + self.process.terminate() + if not self.quiet: # Write the output to the test case (but not on stdout) + current.write(self.getOutput(), stdout=False) + self.process = None + + def expect(self, pattern, timeout=60): + assert(self.process) + return self.process.expect(pattern, timeout) + + def sendline(self, data): + assert(self.process) + return self.process.sendline(data) + + def isStarted(self): + return self.process is not None + + def isFromBinDir(self): + return False + + def getArgs(self, current): + return [] + + def getProps(self, current): + return {} + + def getEnv(self, current): + return {} + + def getMapping(self, current): + return self.mapping or current.testcase.getMapping() + + def getExe(self, current): + processType = self.processType or current.testcase.getProcessType(self) + return self.exe or self.getMapping(current).getDefaultExe(processType, current.config) + + def getCommandLine(self, current): + return self.getMapping(current).getCommandLine(current, self, self.getExe(current)) + +# +# A simple client (used to run Slice/IceUtil clients for example) +# +class SimpleClient(Process): + pass + +# +# An IceProcess specialization class. This is used by drivers to figure out if +# the process accepts Ice configuration properties. +# +class IceProcess(Process): + pass + +# +# An Ice server process. It's possible to configure when the server is considered +# ready by setting readyCount or ready. The start method will only return once +# the server is considered "ready". It can also be configure to wait (the default) +# or not wait for shutdown when the stop method is invoked. +# +class Server(IceProcess): + + def __init__(self, exe=None, waitForShutdown=True, readyCount=1, ready=None, startTimeout=60, *args, **kargs): + IceProcess.__init__(self, exe, *args, **kargs) + self.waitForShutdown = waitForShutdown + self.readyCount = readyCount + self.ready = ready + self.startTimeout = startTimeout + + def getProps(self, current): + props = IceProcess.getProps(self, current) + props.update({ + "Ice.ThreadPool.Server.Size": 1, + "Ice.ThreadPool.Server.SizeMax": 3, + "Ice.ThreadPool.Server.SizeWarn": 0, + }) + if self.ready or (self.readyCount + (1 if current.config.mx else 0)) > 0: + props["Ice.PrintAdapterReady"] = 1 + return props + + def waitForStart(self, current): + if self.ready: + self.process.expect("%s ready\n" % self.ready, timeout = self.startTimeout) + else: + count = self.readyCount + (1 if current.config.mx else 0) + while count > 0: + self.process.expect("[^\n]+ ready\n", timeout = self.startTimeout) + count -= 1 + + # Filter out remaining ready messages + self.outfilters.append(re.compile("[^\n]+ ready")) + + # If we are not asked to be quiet and running from the main thread, print the server output + if not self.quiet and not current.driver.isWorkerThread(): + self.process.trace(self.outfilters) + + def stop(self, current, waitSuccess=False): + IceProcess.stop(self, current, waitSuccess and self.waitForShutdown) + +# +# An Ice client process. +# +class Client(IceProcess): + pass + +# +# Executables for processes inheriting this marker class are looked up in the +# Ice distribution bin directory. +# +class ProcessFromBinDir: + + def isFromBinDir(self): + return True + +class SliceTranslator(ProcessFromBinDir, SimpleClient): + + def __init__(self, translator): + SimpleClient.__init__(self, exe=translator, quiet=True, mapping=Mapping.getByName("cpp")) + + def getCommandLine(self, current): + translator = self.getMapping(current).getCommandLine(current, self, self.getExe(current)) + + # + # Look for slice2py installed by Pip if not found in the bin directory + # + if self.exe == "slice2py" and not os.path.exists(translator): + if isinstance(platform, Windows): + return os.path.join(os.path.dirname(sys.executable), "Scripts", "slice2py.exe") + elif os.path.exists("/usr/local/bin/slice2py"): + return "/usr/local/bin/slice2py" + else: + import slice2py + return sys.executable + " " + os.path.normpath( + os.path.join(slice2py.__file__, "..", "..", "..", "..", "bin", "slice2py")) + + return translator + +# +# A test case is composed of servers and clients. When run, all servers are started +# sequentially. When the servers are ready, the clients are also ran sequentially. +# Once all the clients are terminated, the servers are stopped (which waits for the +# successful completion of the server). +# +# A TestCase is also a "Runnable", like the Process class. In other words, it can be +# used a client to allow nested test cases. +# +class TestCase(Runnable): + + def __init__(self, name, client=None, clients=None, server=None, servers=None, args=[], props={}, envs={}, + options={}, desc=None): + Runnable.__init__(self, desc) + + self.name = name + self.parent = None + self.mapping = None + self.testsuite = None + self.options = options + self.dirs = [] + self.files = [] + self.args = args + self.props = props + self.envs = envs + + # + # Setup client list, "client" can be a string in which case it's assumed to + # to the client executable name. + # + self.clients = clients + if client: + client = Client(exe=client) if isinstance(client, str) else client + self.clients = [client] if not self.clients else self.clients + [client] + + # + # Setup server list, "server" can be a string in which case it's assumed to + # to the server executable name. + # + self.servers = servers + if server: + server = Server(exe=server) if isinstance(server, str) else server + self.servers = [server] if not self.servers else self.servers + [server] + + def __str__(self): + return self.name + + def init(self, mapping, testsuite): + # init is called when the testcase is added to the given testsuite + self.mapping = mapping + self.testsuite = testsuite + + # + # If no clients are explicitly specified, we instantiate one if getClientType() + # returns the type of client to instantiate (client, collocated, etc) + # + if not self.clients: + client = self.mapping.getDefaultProcess(self.getClientType(), testsuite) + self.clients = [client] if client else [] + + # + # If no servers are explicitly specified, we instantiate one if getServerType() + # returns the type of server to instantiate (server, serveramd, etc) + # + if not self.servers: + server = self.mapping.getDefaultProcess(self.getServerType(), testsuite) + self.servers = [server] if server else [] + + def getOptions(self): + return self.options + + def setupServerSide(self, current): + # Can be overriden to perform setup activities before the server side is started + pass + + def teardownServerSide(self, current, success): + # Can be overriden to perform terddown after the server side is stopped + pass + + def setupClientSide(self, current): + # Can be overriden to perform setup activities before the client side is started + pass + + def teardownClientSide(self, current, success): + # Can be overriden to perform terddown after the client side is stopped + pass + + def startServerSide(self, current): + for server in self.servers: + self._startServer(current, server) + + def stopServerSide(self, current, success): + for server in reversed(self.servers): + self._stopServer(current, server, success) + + def runClientSide(self, current): + for client in self.clients: + self._runClient(current, client) + + def getTestSuite(self): + return self.testsuite + + def getParent(self): + return self.parent + + def getName(self): + return self.name + + def getPath(self): + return self.testsuite.getPath() + + def getMapping(self): + return self.mapping + + def getArgs(self, process, current): + return self.args + + def getProps(self, process, current): + return self.props + + def getEnv(self, process, current): + return self.envs + + def getProcessType(self, process): + if process in self.clients: + return self.getClientType() + elif process in self.servers: + return self.getServerType() + elif isinstance(process, Server): + return self.getServerType() + else: + return self.getClientType() + + def getClientType(self): + # Overriden by test case specialization to specify the type of client to instantiate + # if no client is explictly provided + return None + + def getServerType(self): + # Overriden by test case specialization to specify the type of client to instantiate + # if no server is explictly provided + return None + + def getServerTestCase(self, cross=None): + testsuite = (cross or self.mapping.getServerMapping()).findTestSuite(self.testsuite) + return testsuite.findTestCase(self) if testsuite else None + + def getClientTestCase(self): + testsuite = self.mapping.getClientMapping().findTestSuite(self.testsuite) + return testsuite.findTestCase(self) if testsuite else None + + def _startServerSide(self, current): + current.push(self) + self.setupServerSide(current) + try: + self.startServerSide(current) + except: + self._stopServerSide(current, False) + raise + finally: + current.pop() + + def _stopServerSide(self, current, success): + current.push(self) + try: + self.stopServerSide(current, success) + finally: + for server in reversed(self.servers): + if server.isStarted(): + self._stopServer(current, server, False) + self.teardownServerSide(current, success) + current.pop() + + def _startServer(self, current, server): + if server.desc: + current.write("starting {0}... ".format(server.desc)) + server.setup(current) + server.start(current) + if server.desc: + current.writeln("ok") + + def _stopServer(self, current, server, success): + try: + server.stop(current, success) + except: + success = False + raise + finally: + server.teardown(current, success) + + def _runClientSide(self, current): + current.push(self) + self.setupClientSide(current) + success = False + try: + self.runClientSide(current) + success = True + finally: + self.teardownClientSide(current, success) + current.pop() + + def _runClient(self, current, client): + success = False + if client.desc: + current.writeln("running {0}...".format(client.desc)) + client.setup(current) + try: + client.run(current) + success = True + finally: + client.teardown(current, success) + + def run(self, current): + try: + current.push(self) + current.result.started(self) + self.runWithDriver(current) + current.result.succeeded(self) + except Exception as ex: + current.result.failed(self, traceback.format_exc() if current.driver.debug else str(ex)) + raise + finally: + current.pop() + for d in self.dirs: + if os.path.exists(d): shutil.rmtree(d) + for f in self.files: + if os.path.exists(f): os.unlink(f) + + def createFile(self, path, lines, encoding=None): + path = os.path.join(self.getPath(), path.decode("utf-8") if isPython2 else path) + with open(path, "w", encoding=encoding) if not isPython2 and encoding else open(path, "wb") as file: + for l in lines: + file.write("%s\n" % l) + self.files.append(path) + + def mkdirs(self, dirs): + for d in dirs if isinstance(dirs, list) else [dirs]: + d = os.path.join(self.getPath(), d) + self.dirs.append(d) + if not os.path.exists(d): + os.makedirs(d) + +class ClientTestCase(TestCase): + + def __init__(self, name="client", *args, **kargs): + TestCase.__init__(self, name, *args, **kargs) + + def runWithDriver(self, current): + current.driver.runTestCase(current) + + def getClientType(self): + return "client" + +class ClientServerTestCase(ClientTestCase): + + def __init__(self, name="client/server", *args, **kargs): + TestCase.__init__(self, name, *args, **kargs) + + def runWithDriver(self, current): + current.driver.runClientServerTestCase(current) + + def getServerType(self): + return "server" + +class ClientEchoServerTestCase(ClientServerTestCase): + + def __init__(self, name="client/echo server", *args, **kargs): + ClientServerTestCase.__init__(self, name, *args, **kargs) + + def getServerTestCase(self, cross=None): + return Mapping.getByName("cpp").findTestSuite("Ice/echo").findTestCase("server") + + def getClientType(self): + return "clientBidir" + +class CollocatedTestCase(ClientTestCase): + + def __init__(self, name="collocated", *args, **kargs): + TestCase.__init__(self, name, *args, **kargs) + + def getClientType(self): + return "collocated" + +class ClientAMDServerTestCase(ClientServerTestCase): + + def __init__(self, name="client/amd server", *args, **kargs): + ClientServerTestCase.__init__(self, name, *args, **kargs) + + def getServerType(self): + return "serveramd" + +class Result: + + def __init__(self, testsuite, writeToStdout): + self.testsuite = testsuite + self._skipped = [] + self._failed = {} + self._succeeded = [] + self._stdout = StringIO() + self._writeToStdout = writeToStdout + self._testcases = {} + + def started(self, testcase): + self._start = self._stdout.tell() + + def failed(self, testcase, exception): + self.writeln("test in {0} failed:\n{1}".format(self.testsuite, exception)) + self._testcases[testcase] = (self._start, self._stdout.tell()) + self._failed[testcase] = exception + + def succeeded(self, testcase): + self._testcases[testcase] = (self._start, self._stdout.tell()) + self._succeeded.append(testcase) + + def isSuccess(self): + return len(self._failed) == 0 + + def getFailed(self): + return self._failed + + def getOutput(self, testcase=None): + if testcase: + if testcase in self._testcases: + (start, end) = self._testcases[testcase] + self._stdout.seek(start) + try: + return self._stdout.read(end - start) + finally: + self._stdout.seek(os.SEEK_END) + + return self._stdout.getvalue() + + def write(self, msg, stdout=True): + if self._writeToStdout and stdout: + sys.stdout.write(msg) + sys.stdout.flush() + self._stdout.write(msg) + + def writeln(self, msg, stdout=True): + if self._writeToStdout and stdout: + print(msg) + self._stdout.write(msg + "\n") + +class TestSuite: + + def __init__(self, path, testcases=None, options={}, libDirs=[], runOnMainThread=False, chdir=False, multihost=True): + self.path = os.path.dirname(path) if os.path.basename(path) == "test.py" else path + self.mapping = Mapping.getByPath(self.path) + self.id = self.mapping.addTestSuite(self) + self.options = options + self.libDirs = libDirs + self.runOnMainThread = runOnMainThread + self.chdir = chdir + self.multihost = multihost + if self.chdir: + # Only tests running on main thread can change the current working directory + self.runOnMainThread = True + self.files = [] + if testcases is None: + files = [f for f in os.listdir(self.path) if os.path.isfile(os.path.join(self.path, f))] + testcases = self.mapping.computeTestCases(self.id, files) + self.testcases = OrderedDict() + for testcase in testcases if testcases else []: + testcase.init(self.mapping, self) + if testcase.name in self.testcases: + raise RuntimeError("duplicate testcase {0} in testsuite {1}".format(testcase, self)) + self.testcases[testcase.name] = testcase + + def __str__(self): + return self.id + + def getId(self): + return self.id + + def getOptions(self): + return self.options + + def getPath(self): + return self.path + + def getMapping(self): + return self.mapping + + def getLibDirs(self): + return self.libDirs + + def isMainThreadOnly(self): + for m in [CppMapping, JavaMapping, CSharpMapping]: + if isinstance(self.mapping, m): + return self.runOnMainThread + else: + return True + + def addTestCase(self, testcase): + if testcase.name in self.testcases: + raise RuntimeError("duplicate testcase {0} in testsuite {1}".format(testcase, self)) + testcase.init(self.mapping, self) + self.testcases[testcase.name] = testcase + + def findTestCase(self, testcase): + return self.testcases.get(testcase if isinstance(testcase, str) else testcase.name) + + def getTestCases(self): + return self.testcases.values() + + def setup(self, current): + pass + + def run(self, current): + try: + cwd=None + if self.chdir: + cwd = os.getcwd() + os.chdir(self.path) + current.driver.runTestSuite(current) + finally: + if cwd: os.chdir(cwd) + for f in self.files: + if os.path.exists(f): os.remove(f) + + def teardown(self, current, success): + pass + + def createFile(self, path, lines, encoding=None): + path = os.path.join(self.path, path.decode("utf-8") if isPython2 else path) + with open(path, "w", encoding=encoding) if not isPython2 and encoding else open(path, "wb") as file: + for l in lines: + file.write("%s\n" % l) + self.files.append(path) + + def isMultiHost(self): + return self.multihost + + def isCross(self): + # Only run the tests that support cross testing --all-cross or --cross + return self.id in self.mapping.getCrossTestSuites() + + def isAllCross(self): + # Only run the Ice/operations test suite with --all-cross + return self.id == "Ice/operations" + +class Driver: + + class Current: + + def __init__(self, driver, testsuite, result): + self.driver = driver + self.testsuite = testsuite + self.config = driver.configs[testsuite.getMapping()] + self.result = result + self.host = None + self.testcase = None + self.testcases = [] + + def getTestEndpoint(self, *args, **kargs): + return self.driver.getTestEndpoint(*args, **kargs) + + def getBuildDir(self, name): + return self.testcase.getMapping().getBuildDir(name, self) + + def getPluginEntryPoint(self, plugin): + return self.testcase.getMapping().getPluginEntryPoint(plugin) + + def write(self, *args, **kargs): + self.result.write(*args, **kargs) + + def writeln(self, *args, **kargs): + self.result.writeln(*args, **kargs) + + def push(self, testcase): + if not testcase.mapping: + assert(not testcase.parent and not testcase.testsuite) + testcase.mapping = self.testcase.getMapping() + testcase.testsuite = self.testcase.getTestSuite() + testcase.parent = self.testcase + self.testcases.append(self.testcase) + self.testcase = testcase + + def pop(self): + assert(self.testcase) + testcase = self.testcase + self.testcase = self.testcases.pop() + if testcase.parent and self.testcase != testcase: + testcase.mapping = None + testcase.testsuite = None + testcase.parent = None + + drivers = {} + driver = "local" + + @classmethod + def add(self, name, driver, default=False): + if default: + Driver.driver = name + self.driver = name + self.drivers[name] = driver + + @classmethod + def getAll(self): + return self.drivers.values() + + @classmethod + def create(self, options): + parseOptions(self, options) + driver = self.drivers.get(self.driver) + if not driver: + raise RuntimeError("unknown driver `{0}'".format(self.driver)) + return driver(options) + + @classmethod + def getOptions(self): + return ("dlrR", ["debug", "driver=", "filter=", "rfilter=", "host=", "host-ipv6=", "host-bt="]) + + @classmethod + def usage(self): + pass + + @classmethod + def commonUsage(self): + print("") + print("Driver options:") + print("-d | --debug Verbose information.") + print("--driver=<driver> Use the given driver (local, client, server or remote).") + print("--filter=<regex> Run all the tests that match the given regex.") + print("--rfilter=<regex> Run all the tests that do not match the given regex.") + print("--host=<addr> The IPv4 address to use for Ice.Default.Host.") + print("--host-ipv6=<addr> The IPv6 address to use for Ice.Default.Host.") + print("--host-bt=<addr> The Bluetooth address to use for Ice.Default.Host.") + + def __init__(self, options): + self.debug = False + self.filters = [] + self.rfilters = [] + self.host = "" + self.hostIPv6 = "" + self.hostBT = "" + self.failures = [] + parseOptions(self, options, { "d": "debug", + "r" : "filters", + "R" : "rfilters", + "filter" : "filters", + "rfilter" : "rfilters", + "host-ipv6" : "hostIPv6", + "host-bt" : "hostBT" }) + + self.filters = [re.compile(re.escape(a)) for a in self.filters] + self.rfilters = [re.compile(re.escape(a)) for a in self.rfilters] + + def setConfigs(self, configs): + self.configs = configs + + def useBinDist(self): + return os.environ.get("USE_BIN_DIST", "no") == "yes" + + def getIceDir(self, mapping=None): + if self.useBinDist(): + iceHome = os.environ.get("ICE_HOME", "") + return iceHome if iceHome else platform.getIceDir() + elif mapping: + return mapping.getPath() + else: + return toplevel + + def getSliceDir(self): + return platform.getSliceDir(self.getIceDir()) + + def isWorkerThread(self): + return False + + def getTestEndpoint(self, portnum, protocol="default"): + return "{0} -p {1}".format(protocol, self.getTestPort(portnum)) + + def getTestPort(self, portnum): + return 12010 + portnum + + def getArgs(self, process, current): + ### Return driver specific arguments + return [] + + def getProps(self, process, current): + props = {} + if isinstance(process, IceProcess): + if not self.host: + props["Ice.Default.Host"] = "0:0:0:0:0:0:0:1" if current.config.ipv6 else "127.0.0.1" + else: + props["Ice.Default.Host"] = self.host + return props + + def getMappings(self): + ### Return additional mappings to load required by the driver + return [] + + def destroy(self): + pass + + +class CppMapping(Mapping): + + class Config(Mapping.Config): + + def __init__(self, options): + Mapping.Config.__init__(self, options) + + # Derive from the build config the cpp11 option. This is used by canRun to allow filtering + # tests on the cpp11 value in the testcase options specification + self.cpp11 = self.buildConfig.lower().find("cpp11") >= 0 + + def canRun(self, current): + if not Mapping.Config.canRun(self, current): + return False + + # No C++11 tests for IceStorm, IceGrid, etc + parent = re.match(r'^([\w]*).*', current.testcase.getTestSuite().getId()).group(1) + if self.cpp11 and not parent in ["IceUtil", "Slice", "Ice", "IceSSL", "IceDiscovery", "IceBox"]: + return False + + return True + + def createConfig(self, options): + return CppMapping.Config(options) + + def getDefaultExe(self, processType, config): + return platform.getDefaultExe(processType, config) + + def getProps(self, process, current): + props = Mapping.getProps(self, process, current) + if isinstance(process, IceProcess): + props["Ice.NullHandleAbort"] = True + return props + + def getSSLProps(self, process, protocol="ssl"): + props = Mapping.getSSLProps(self, process, protocol) + props.update({ + "IceSSL.Password": "password", + "IceSSL.DefaultDir": os.path.join(toplevel, "certs"), + "IceSSL.CAs": "cacert.pem", + "IceSSL.VerifyPeer": "0" if protocol == "wss" else "2", + "IceSSL.CertFile": "server.p12" if isinstance(process, Server) else "client.p12", + }) + if isinstance(platform, Darwin): + props.update({ + "IceSSL.KeychainPassword" : "password", + "IceSSL.Keychain": "server.keychain" if isinstance(process, Server) else "client.keychain" + }) + return props + + def getPluginEntryPoint(self, plugin): + return { + "IceSSL" : "IceSSL:createIceSSL", + "IceBT" : "IceBT:createIceBT", + "IceDiscovery" : "IceDiscovery:createIceDiscovery" + }[plugin] + + def getEnv(self, process, current): + + # + # On Windows, add the testcommon directories to the PATH + # + libPaths = [] + if isinstance(platform, Windows): + libPaths.append(self.getLibDir(current)) + testcommon = os.path.join(self.path, "test", "Common") + libPaths.append(os.path.join(testcommon, self.getBuildDir("testcommon", current))) + + # + # Add the test suite library directories to the platform library path environment variable. + # + if current.testcase: + for d in set([current.getBuildDir(d) for d in current.testcase.getTestSuite().getLibDirs()]): + libPaths.append(current.getBuildDir(d)) + + env = {} + if len(libPaths) > 0: + env[platform.getLdPathEnvName()] = os.pathsep.join(libPaths) + return env + + def getDefaultSource(self, processType): + return { + "client" : "Client.cpp", + "server" : "Server.cpp", + "serveramd" : "ServerAMD.cpp", + "collocated" : "Collocated.cpp", + }[processType] + +class JavaMapping(Mapping): + + def getCommandLine(self, current, process, exe): + if process.isFromBinDir(): + return "java {0}".format(exe) + + assert(current.testcase.getPath().startswith(self.getTestsPath())) + package = "test." + current.testcase.getPath()[len(self.getTestsPath()) + 1:].replace(os.sep, ".") + return "java {0}.{1}".format(package, exe) + + def getSSLProps(self, process, protocol="ssl"): + props = Mapping.getSSLProps(self, process, protocol) + props.update({ + "IceSSL.Password": "password", + "IceSSL.DefaultDir": os.path.join(toplevel, "certs"), + "IceSSL.VerifyPeer": "0" if protocol == "wss" else "2", + "IceSSL.Keystore": "server.jks" if isinstance(process, Server) else "client.jks", + }) + return props + + def getPluginEntryPoint(self, plugin): + return { + "IceSSL" : "com.zeroc.IceSSL.PluginFactory", + "IceBT" : "com.zeroc.IceBT.PluginFactory", + "IceDiscovery" : "com.zeroc.IceDiscovery.PluginFactory" + }[plugin] + + def getEnv(self, process, current): + return { "CLASSPATH" : os.path.join(self.path, "lib", "test.jar") } + + def getTestsPath(self): + return os.path.join(self.path, "test/src/main/java/test") + + def getDefaultSource(self, processType): + return self.getDefaultExe(processType) + ".java" + + def getDefaultExe(self, processType, config=None): + return { + "client" : "Client", + "server" : "Server", + "serveramd" : "AMDServer", + "collocated" : "Collocated", + "icebox": "com.zeroc.IceBox.Server", + "iceboxadmin" : "com.zeroc.IceBox.Admin", + }[processType] + +class JavaCompatMapping(JavaMapping): + + def getPluginEntryPoint(self, plugin): + return { + "IceSSL" : "IceSSL.PluginFactory", + "IceBT" : "IceBT.PluginFactory", + "IceDiscovery" : "IceDiscovery.PluginFactory" + }[plugin] + + def getDefaultExe(self, processType, config=None): + return { + "client" : "Client", + "server" : "Server", + "serveramd" : "AMDServer", + "collocated" : "Collocated", + "icebox": "IceBox.Server", + "iceboxadmin" : "IceBox.Admin", + }[processType] + +class CSharpMapping(Mapping): + + def getBuildDir(self, name, current): + # Executables are not produced in build sub-directory with the C# mapping. + return "" + + def getSSLProps(self, process, protocol="ssl"): + props = Mapping.getSSLProps(self, process, protocol) + props.update({ + "IceSSL.Password": "password", + "IceSSL.DefaultDir": os.path.join(toplevel, "certs"), + "IceSSL.CAs": "cacert.pem", + "IceSSL.VerifyPeer": "0" if protocol == "wss" else "2", + "IceSSL.CertFile": "server.p12" if isinstance(process, Server) else "client.p12", + }) + return props + + def getPluginEntryPoint(self, plugin): + return { + "IceSSL" : "{icedir}/Assemblies/IceSSL.dll:IceSSL.PluginFactory", + "IceDiscovery" : "{icedir}/Assemblies/IceDiscovery.dll:IceDiscovery.PluginFactory" + }[plugin] + + def getEnv(self, process, current): + if current.driver.useBinDist(): + bzip2 = Mapping.getByName("cpp").getLibDir(current) + else: + bzip2 = os.path.join(toplevel, "cpp", "msbuild", "packages", + "bzip2.{0}.1.0.6.4".format(platform.getCompiler()), + "build", "native", "bin", "x64", "Release") + + return { "DEVPATH" : os.path.join(current.driver.getIceDir(self), "Assemblies"), "PATH" : bzip2 }; + + def getDefaultSource(self, processType): + return { + "client" : "Client.cs", + "server" : "Server.cs", + "serveramd" : "ServerAMD.cs", + "collocated" : "Collocated.cs", + }[processType] + + def getDefaultExe(self, processType, config): + return "iceboxnet" if processType == "icebox" else processType + +class CppBasedMapping(Mapping): + + def getSSLProps(self, process, protocol="ssl"): + return Mapping.getByName("cpp").getSSLProps(process, protocol) + + def getPluginEntryPoint(self, plugin): + return Mapping.getByName("cpp").getPluginEntryPoint(plugin) + + def getEnv(self, process, current): + env = Mapping.getEnv(self, process, current) + if current.driver.getIceDir() != platform.getIceDir(): + # If not installed in the default platform installation directory, add + # the Ice C++ library directory to the library path + env[platform.getLdPathEnvName()] = Mapping.getByName("cpp").getLibDir(current) + return env + +class ObjCMapping(CppBasedMapping): + + def getDefaultSource(self, processType): + return { + "client" : "Client.m", + "server" : "Server.m", + "collocated" : "Collocated.m", + }[processType] + +class PythonMapping(CppBasedMapping): + + def getCommandLine(self, current, process, exe): + return sys.executable + " " + exe + + def getEnv(self, process, current): + env = CppBasedMapping.getEnv(self, process, current) + if current.driver.getIceDir() != platform.getIceDir(): + # If not installed in the default platform installation directory, add + # the Ice python directory to PYTHONPATH + env["PYTHONPATH"] = os.path.join(current.driver.getIceDir(self), "python") + return env + + def getDefaultExe(self, processType, config): + return self.getDefaultSource(processType) + + def getDefaultSource(self, processType): + return { + "client" : "Client.py", + "server" : "Server.py", + "serveramd" : "ServerAMD.py", + "collocated" : "Collocated.py", + }[processType] + +class CppBasedClientMapping(CppBasedMapping): + + def loadTestSuites(self, tests, filters, rfilters): + Mapping.loadTestSuites(self, tests, filters, rfilters) + self.getServerMapping().loadTestSuites(self.testsuites.keys()) + + def getServerMapping(self): + return Mapping.getByName("cpp") # By default, run clients against C++ mapping executables + + def getDefaultExe(self, processType, config): + return self.getDefaultSource(processType) + +class RubyMapping(CppBasedClientMapping): + + def getCommandLine(self, current, process, exe): + return "ruby " + exe + + def getEnv(self, process, current): + env = CppBasedMapping.getEnv(self, process, current) + if current.driver.getIceDir() != platform.getIceDir(): + # If not installed in the default platform installation directory, add + # the Ice ruby directory to RUBYLIB + env["RUBYLIB"] = os.path.join(self.path, "ruby") + return env + + def getDefaultSource(self, processType): + return { "client" : "Client.rb" }[processType] + +class PhpMapping(CppBasedClientMapping): + + def getCommandLine(self, current, process, exe): + args = [] + if current.driver.getIceDir() == platform.getIceDir(): + # + # If installed in the platform system directory and on Linux, we rely + # on ice.ini to find the extension. On OS X, we still need to setup + # the properties. + # + if(isinstance(platform, Darwin)): + args += ["-d", "extension_dir=/usr/local/lib/php/extensions"] + args += ["-d", "include_path=/usr/local/share/php"] + args += ["-d", "extension=IcePHP.so"] + else: + args += ["-d", "extension_dir='{0}'".format(self.getLibDir(current))] + args += ["-d", "extension='{0}'".format("php_ice.dll" if isinstance(platform, Windows) else "IcePHP.so")] + args += ["-d", "include_path='{0}'".format(self.getLibDir(current))] + if hasattr(process, "getPhpArgs"): + args += process.getPhpArgs(current) + return "php {0} -f {1} -- ".format(" ".join(args), exe) + + def getDefaultSource(self, processType): + return { "client" : "Client.php" }[processType] + +class JavaScriptMapping(Mapping): + + class Config(Mapping.Config): + + @classmethod + def getOptions(self): + return ("", ["es5"]) + + @classmethod + def usage(self): + print("") + print("JavaScript mapping options:") + print("--es5 Use JavaScript ES5 (Babel compiled code).") + + def __init__(self, options=[]): + Mapping.Config.__init__(self, options) + self.es5 = False + parseOptions(self, options) + + def createConfig(self, options): + return JavaScriptMapping.Config(options) + + def loadTestSuites(self, tests, filters, rfilters): + Mapping.loadTestSuites(self, tests, filters, rfilters) + self.getServerMapping().loadTestSuites(self.testsuites.keys() + ["Ice/echo"]) + + def getServerMapping(self): + return Mapping.getByName("cpp") # By default, run clients against C++ mapping executables + + def getCommandLine(self, current, process, exe): + if current.config.es5: + return "node {0}/test/Common/run.js --es5 {1}".format(self.path, exe) + else: + return "node {0}/test/Common/run.js {1}".format(self.path, exe) + + def getDefaultSource(self, processType): + return { "client" : "Client.js", "clientBidir" : "ClientBidir.js" }[processType] + + def getDefaultExe(self, processType, config=None): + return self.getDefaultSource(processType).replace(".js", "") + + def getEnv(self, process, current): + env = Mapping.getEnv(self, process, current) + env["NODE_PATH"] = self.getTestCwd(current) + return env + + def getTestCwd(self, current): + if current.config.es5: + # Change to the ES5 test directory if testing ES5 + return os.path.join(self.path, "test", "es5", current.testcase.getTestSuite().getId()) + else: + return os.path.join(self.path, "test", current.testcase.getTestSuite().getId()) + + def computeTestCases(self, testId, files): + if testId.find("es5") > -1: + return # Ignore es5 directories + return Mapping.computeTestCases(self, testId, files) + + def getOptions(self): + # JavaScript with NodeJS only supports tcp and no other options + return { "protocol" : ["tcp"], "compress" : [False], "ipv6" : [False], "serialize" : [False], "mx" : [False] } + +from Glacier2Util import * +from IceBoxUtil import * +from IceGridUtil import * +from IceStormUtil import * +from IcePatch2Util import * +from LocalDriver import * + +# +# Supported mappings +# +Mapping.add("cpp", CppMapping()) +Mapping.add("java", JavaMapping()) +Mapping.add("java-compat", JavaCompatMapping()) +Mapping.add("python", PythonMapping()) +Mapping.add("ruby", RubyMapping()) +Mapping.add("php", PhpMapping()) +Mapping.add("js", JavaScriptMapping()) +if isinstance(platform, Windows): + Mapping.add("csharp", CSharpMapping()) +if isinstance(platform, Darwin): + Mapping.add("objective-c", ObjCMapping()) + +def runTestsWithPath(path): + runTests([Mapping.getByPath(path)]) + +def runTests(mappings=None, drivers=None): + if not mappings: + mappings = Mapping.getAll() + if not drivers: + drivers = Driver.getAll() + + def usage(): + print("Usage: " + sys.argv[0] + " [options] [tests]") + print("") + print("Options:") + print("-h | --help Show this message") + + Driver.commonUsage() + for driver in drivers: + driver.usage() + + Mapping.Config.commonUsage() + for mapping in mappings: + mapping.Config.usage() + + print("") + + driver = None + try: + options = [Driver.getOptions(), Mapping.Config.getOptions()] + options += [driver.getOptions() for driver in drivers] + options += [mapping.Config.getOptions() for mapping in mappings] + shortOptions = "h" + longOptions = ["help"] + for so, lo in options: + shortOptions += so + longOptions += lo + opts, args = getopt.gnu_getopt(sys.argv[1:], shortOptions, longOptions) + + for (o, a) in opts: + if o in ["-h", "--help"]: + usage() + sys.exit(0) + + # + # Create the driver + # + driver = Driver.create(opts) + + # + # Create the configurations for each mapping + # + configs = {} + for mapping in mappings: + configs[mapping] = mapping.createConfig(opts) + + if len(opts) > 0: + print(sys.argv[0] + ": unknown options {0}".format(opts)) + usage() + sys.exit(1) + + # + # Provide the configurations to the driver and load the test suites for each mapping. + # + driver.setConfigs(configs) + for mapping in mappings + driver.getMappings(): + mapping.loadTestSuites(args, driver.filters, driver.rfilters) + + # + # Finally, run the test suites with the driver. + # + try: + driver.run(mappings) + except KeyboardInterrupt: + pass + finally: + driver.destroy() + + except Exception as e: + print(sys.argv[0] + ": unexpected exception raised:\n" + traceback.format_exc()) + sys.exit(1) diff --git a/scripts/__init__.py b/scripts/__init__.py index d6227364c08..90d182d1c05 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -6,5 +6,3 @@ # ICE_LICENSE file included in this distribution. # # ********************************************************************** - -__all__ = [ "Expect", "IceGridAdmin", "IceStormUtil", "TestUtil"] diff --git a/scripts/tests/Glacier2/__init__.py b/scripts/tests/Glacier2/__init__.py new file mode 100644 index 00000000000..90d182d1c05 --- /dev/null +++ b/scripts/tests/Glacier2/__init__.py @@ -0,0 +1,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. +# +# ********************************************************************** diff --git a/scripts/tests/Glacier2/router.py b/scripts/tests/Glacier2/router.py new file mode 100644 index 00000000000..f3f1a5b4aa0 --- /dev/null +++ b/scripts/tests/Glacier2/router.py @@ -0,0 +1,38 @@ +# -*- 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. +# +# ********************************************************************** + +passwords = { + "userid": "abc123", + "userid-0": "abc123", + "userid-1": "abc123", + "userid-2": "abc123", + "userid-3": "abc123", + "userid-4": "abc123" +} + +routerProps = { + "Ice.Warn.Dispatch" : "0", + "Ice.Warn.Connections" : "0", + "Glacier2.Filter.Category.Accept" : "c1 c2", + "Glacier2.Filter.Category.AcceptUser" : "2", + "Glacier2.SessionTimeout" : "30", +} + +def buffered(enabled): + return { "Glacier2.Client.Buffered": enabled, "Glacier2.Server.Buffered": enabled } + +Glacier2TestSuite(__name__, routerProps, [ + ClientServerTestCase(name="client/server with router in unbuffered mode", + servers=[Glacier2Router(passwords=passwords, props=buffered(False)), Server()], + client=Client(args=["--shutdown"])), + ClientServerTestCase(name="client/server with router in buffered mode", + servers=[Glacier2Router(passwords=passwords, props=buffered(True)), Server()], + clients=[Client(), Client(args=["--shutdown"])])]) + diff --git a/scripts/tests/Glacier2/sessionHelper.py b/scripts/tests/Glacier2/sessionHelper.py new file mode 100644 index 00000000000..f9d802901c8 --- /dev/null +++ b/scripts/tests/Glacier2/sessionHelper.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. +# +# ********************************************************************** + +Glacier2TestSuite(__name__, routerProps = { "Glacier2.SessionTimeout" : 30 }) diff --git a/scripts/tests/Ice/__init__.py b/scripts/tests/Ice/__init__.py new file mode 100644 index 00000000000..90d182d1c05 --- /dev/null +++ b/scripts/tests/Ice/__init__.py @@ -0,0 +1,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. +# +# ********************************************************************** diff --git a/scripts/tests/Ice/adapterDeactivation.py b/scripts/tests/Ice/adapterDeactivation.py new file mode 100644 index 00000000000..deb29ba6b5f --- /dev/null +++ b/scripts/tests/Ice/adapterDeactivation.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(__name__, multihost=False)
\ No newline at end of file diff --git a/scripts/tests/Ice/admin.py b/scripts/tests/Ice/admin.py new file mode 100644 index 00000000000..a87c0754c69 --- /dev/null +++ b/scripts/tests/Ice/admin.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(__name__, options = { "ipv6" : [False] }, multihost=False)
\ No newline at end of file diff --git a/scripts/tests/Ice/ami.py b/scripts/tests/Ice/ami.py new file mode 100644 index 00000000000..6e5abe02f7f --- /dev/null +++ b/scripts/tests/Ice/ami.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(__name__, options = { "compress" : [False] })
\ No newline at end of file diff --git a/scripts/tests/Ice/background.py b/scripts/tests/Ice/background.py new file mode 100644 index 00000000000..4db72200a79 --- /dev/null +++ b/scripts/tests/Ice/background.py @@ -0,0 +1,10 @@ +# ********************************************************************** +# +# 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(__name__, libDirs=["testtransport"], options={ "mx": [False] }) diff --git a/scripts/tests/Ice/enums.py b/scripts/tests/Ice/enums.py new file mode 100644 index 00000000000..1780057f1a5 --- /dev/null +++ b/scripts/tests/Ice/enums.py @@ -0,0 +1,13 @@ +# ********************************************************************** +# +# 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(__name__, [ + ClientServerTestCase("client/server with default encoding"), + ClientServerTestCase("client/server with 1.0 encoding", props={ "Ice.Default.EncodingVersion" : "1.0" }), +])
\ No newline at end of file diff --git a/scripts/tests/Ice/exceptions.py b/scripts/tests/Ice/exceptions.py new file mode 100644 index 00000000000..0e2ac209032 --- /dev/null +++ b/scripts/tests/Ice/exceptions.py @@ -0,0 +1,24 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +testcases = [ + ClientServerTestCase("client/server with compact format"), + ClientServerTestCase("client/server with sliced format", props={ "Ice.Default.SlicedFormat" : True }), + ClientServerTestCase("client/server with 1.0 encoding", props={ "Ice.Default.EncodingVersion" : "1.0" }), +] + +# If the mapping has AMD servers, also run with the AMD servers +if Mapping.getByPath(__name__).hasSource("Ice/exceptions", "serveramd"): + testcases += [ + ClientAMDServerTestCase("client/amd server with compact format"), + ClientAMDServerTestCase("client/amd server with sliced format", props={ "Ice.Default.SlicedFormat" : True }), + ClientAMDServerTestCase("client/amd server with 1.0 encoding", props={ "Ice.Default.EncodingVersion" : "1.0" }), + ] + +TestSuite(__name__, testcases)
\ No newline at end of file diff --git a/scripts/tests/Ice/faultTolerance.py b/scripts/tests/Ice/faultTolerance.py new file mode 100755 index 00000000000..6cc55446826 --- /dev/null +++ b/scripts/tests/Ice/faultTolerance.py @@ -0,0 +1,20 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +from Util import * + +# +# Start 12 servers +# +servers=range(1, 13) + +TestSuite(__name__, [ + ClientServerTestCase(client=Client(args=[i for i in servers]), + servers=[Server(args=[i], waitForShutdown=False) for i in servers]) +]) diff --git a/scripts/tests/Ice/hold.py b/scripts/tests/Ice/hold.py new file mode 100644 index 00000000000..a3889c461b7 --- /dev/null +++ b/scripts/tests/Ice/hold.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(__name__, [ClientServerTestCase(server=Server(readyCount=2))]) diff --git a/scripts/tests/Ice/info.py b/scripts/tests/Ice/info.py new file mode 100644 index 00000000000..e42ee312f56 --- /dev/null +++ b/scripts/tests/Ice/info.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(__name__, options = { "ipv6" : [False], "compress" : [False] }, multihost=False)
\ No newline at end of file diff --git a/scripts/tests/Ice/interceptor.py b/scripts/tests/Ice/interceptor.py new file mode 100644 index 00000000000..1db4578f24b --- /dev/null +++ b/scripts/tests/Ice/interceptor.py @@ -0,0 +1,10 @@ +# ********************************************************************** +# +# 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(__name__, [ClientTestCase(client=Client(props={"Ice.Warn.Dispatch" : 0}))], libDirs=["interceptortest"]) diff --git a/scripts/tests/Ice/interrupt.py b/scripts/tests/Ice/interrupt.py new file mode 100644 index 00000000000..6e5abe02f7f --- /dev/null +++ b/scripts/tests/Ice/interrupt.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(__name__, options = { "compress" : [False] })
\ No newline at end of file diff --git a/scripts/tests/Ice/metrics.py b/scripts/tests/Ice/metrics.py new file mode 100644 index 00000000000..e81bc4b22af --- /dev/null +++ b/scripts/tests/Ice/metrics.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(__name__, options = { "ipv6" : [False], "compress": [False], "protocol" : ["tcp", "ssl"] }, multihost=False) diff --git a/scripts/tests/Ice/networkProxy.py b/scripts/tests/Ice/networkProxy.py new file mode 100644 index 00000000000..948b24b2e7c --- /dev/null +++ b/scripts/tests/Ice/networkProxy.py @@ -0,0 +1,38 @@ +# ********************************************************************** +# +# 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 NetworkProxy + +class NetworkProxyTestCase(ClientServerTestCase): + + def __init__(self, proxyName, proxyType, proxyPortNum): + ClientServerTestCase.__init__(self, proxyName + " client/server", client = Client(props = lambda p, c: { + "Ice.{0}ProxyHost".format(proxyName): "localhost", + "Ice.{0}ProxyPort".format(proxyName): "{0}".format(c.driver.getTestPort(proxyPortNum)) + })) + self.proxyName = proxyName + self.proxyType = proxyType + self.proxyPortNum = proxyPortNum + self.proxy = None + + def setupClientSide(self, current): + current.write("starting {0} proxy... ".format(self.proxyName)) + self.proxy = self.proxyType(current.driver.getTestPort(self.proxyPortNum)) + current.writeln("ok") + + def teardownClientSide(self, current, success): + current.write("terminating {0} proxy... ".format(self.proxyName)) + self.proxy.terminate() + self.proxy = None + current.writeln("ok") + +TestSuite(__name__, [ + NetworkProxyTestCase("SOCKS", NetworkProxy.SocksProxy, 30), + NetworkProxyTestCase("HTTP", NetworkProxy.HttpProxy, 31), +], options = { "ipv6" : [False] }) diff --git a/scripts/tests/Ice/objects.py b/scripts/tests/Ice/objects.py new file mode 100644 index 00000000000..fef2b3fb6cb --- /dev/null +++ b/scripts/tests/Ice/objects.py @@ -0,0 +1,14 @@ +# ********************************************************************** +# +# 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(__name__, [ + ClientServerTestCase("client/server with compact format"), + ClientServerTestCase("client/server with sliced format", props={ "Ice.Default.SlicedFormat" : True }), + ClientServerTestCase("client/server with 1.0 encoding", props={ "Ice.Default.EncodingVersion" : "1.0" }), +])
\ No newline at end of file diff --git a/scripts/tests/Ice/optional.py b/scripts/tests/Ice/optional.py new file mode 100644 index 00000000000..b706d197749 --- /dev/null +++ b/scripts/tests/Ice/optional.py @@ -0,0 +1,23 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + + +testcases = [ + ClientServerTestCase("client/server with compact format"), + ClientServerTestCase("client/server with sliced format", props={ "Ice.Default.SlicedFormat" : True }), +] + +# If the mapping has AMD servers, also run with the AMD servers +if Mapping.getByPath(__name__).hasSource("Ice/exceptions", "serveramd"): + testcases += [ + ClientAMDServerTestCase("client/amd server with compact format"), + ClientAMDServerTestCase("client/amd server with sliced format", props={ "Ice.Default.SlicedFormat" : True }), + ] + +TestSuite(__name__, testcases)
\ No newline at end of file diff --git a/scripts/tests/Ice/properties.py b/scripts/tests/Ice/properties.py new file mode 100644 index 00000000000..92a9832aa61 --- /dev/null +++ b/scripts/tests/Ice/properties.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 PropertiesTestSuite(TestSuite): + + def setup(self, current): + name = "\xe4\xb8\xad\xe5\x9b\xbd_client.config" if isPython2 else "\u4e2d\u56fd_client.config" + self.createFile("./config/" + name, + ["# Automatically generated by Ice test driver.", + "Ice.Trace.Protocol=1", + "Ice.Trace.Network=1", + "Ice.ProgramName=PropertiesClient", + "Config.Path=./config/" + name], + "utf-8") + +PropertiesTestSuite(__name__) diff --git a/scripts/tests/Ice/slicing/__init__.py b/scripts/tests/Ice/slicing/__init__.py new file mode 100644 index 00000000000..90d182d1c05 --- /dev/null +++ b/scripts/tests/Ice/slicing/__init__.py @@ -0,0 +1,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. +# +# ********************************************************************** diff --git a/scripts/tests/Ice/slicing/exceptions.py b/scripts/tests/Ice/slicing/exceptions.py new file mode 100644 index 00000000000..beb5f64484a --- /dev/null +++ b/scripts/tests/Ice/slicing/exceptions.py @@ -0,0 +1,22 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +testcases = [ + ClientServerTestCase(), + ClientServerTestCase("client/server with 1.0 encoding", props={ "Ice.Default.EncodingVersion" : "1.0" }), +] + +# If the mapping has AMD servers, also run with the AMD servers +if Mapping.getByPath(__name__).hasSource("Ice/exceptions", "serveramd"): + testcases += [ + ClientAMDServerTestCase(), + ClientAMDServerTestCase("client/amd server with 1.0 encoding", props={ "Ice.Default.EncodingVersion" : "1.0" }), + ] + +TestSuite(__name__, testcases)
\ No newline at end of file diff --git a/scripts/tests/Ice/slicing/objects.py b/scripts/tests/Ice/slicing/objects.py new file mode 100644 index 00000000000..c1d57969e85 --- /dev/null +++ b/scripts/tests/Ice/slicing/objects.py @@ -0,0 +1,13 @@ +# ********************************************************************** +# +# 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(__name__, [ + ClientServerTestCase(), + ClientServerTestCase("client/server with 1.0 encoding", props={ "Ice.Default.EncodingVersion" : "1.0" }), +])
\ No newline at end of file diff --git a/scripts/tests/Ice/stream.py b/scripts/tests/Ice/stream.py new file mode 100644 index 00000000000..30fecbf5b9e --- /dev/null +++ b/scripts/tests/Ice/stream.py @@ -0,0 +1,14 @@ +# ********************************************************************** +# +# 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(__name__, [ + ClientTestCase("client with default encoding"), + ClientTestCase("client with 1.0 encoding", props={ "Ice.Default.EncodingVersion" : "1.0" }) +])
\ No newline at end of file diff --git a/scripts/tests/Ice/timeout.py b/scripts/tests/Ice/timeout.py new file mode 100644 index 00000000000..6e5abe02f7f --- /dev/null +++ b/scripts/tests/Ice/timeout.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(__name__, options = { "compress" : [False] })
\ No newline at end of file diff --git a/scripts/tests/Ice/udp.py b/scripts/tests/Ice/udp.py new file mode 100644 index 00000000000..214d9aaf8f3 --- /dev/null +++ b/scripts/tests/Ice/udp.py @@ -0,0 +1,19 @@ +# ********************************************************************** +# +# 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. +# +# ********************************************************************** + +from Util import * + +# +# Start 5 servers +# +servers=range(0, 5) + +TestSuite(__name__, [ + ClientServerTestCase(client=Client(args=[5]), servers=[Server(args=[i], ready="McastTestAdapter") for i in servers]) +], multihost=False) diff --git a/scripts/tests/IceBox/__init__.py b/scripts/tests/IceBox/__init__.py new file mode 100644 index 00000000000..90d182d1c05 --- /dev/null +++ b/scripts/tests/IceBox/__init__.py @@ -0,0 +1,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. +# +# ********************************************************************** diff --git a/scripts/tests/IceBox/admin.py b/scripts/tests/IceBox/admin.py new file mode 100644 index 00000000000..cd36e7475f7 --- /dev/null +++ b/scripts/tests/IceBox/admin.py @@ -0,0 +1,29 @@ +# -*- 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 IceBoxAdminTestCase(ClientServerTestCase): + + def runClientSide(self, current): + + admin = IceBoxAdmin(args = ['--Ice.Config="{testdir}/config.admin"']) + current.write("testing service stop...") + admin.run(current, args=['stop', 'TestService']) + current.writeln("ok") + current.write("testing service start...") + admin.run(current, args=['start', 'TestService']) + current.writeln("ok") + current.write("testing shutdown...") + admin.run(current, args=['shutdown']) + current.writeln("ok") + +TestSuite(__name__, [ + ClientServerTestCase(server=IceBox(args=['--Ice.Config="{testdir}/config.icebox"'])), + IceBoxAdminTestCase("iceboxadmin", server=IceBox(args=['--Ice.Config="{testdir}/config.icebox"'])), +], libDirs=["testservice"], runOnMainThread=True, options={ "ipv6" : [False], "mx" : [False] }, multihost=False) diff --git a/scripts/tests/IceBox/configuration.py b/scripts/tests/IceBox/configuration.py new file mode 100644 index 00000000000..d8add442cba --- /dev/null +++ b/scripts/tests/IceBox/configuration.py @@ -0,0 +1,14 @@ +# -*- 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(__name__, [ + ClientServerTestCase("client/server #1", server=IceBox(args=['--Ice.Config="{testdir}/config.icebox"'])), + ClientServerTestCase("client/server #2", server=IceBox(args=['--Ice.Config="{testdir}/config.icebox2"'])) +], libDirs=["testservice"], runOnMainThread=True, options={ "protocol" : ["tcp"], "ipv6" : [False], "mx" : [False] }, multihost=False) diff --git a/scripts/tests/IceDiscovery/__init__.py b/scripts/tests/IceDiscovery/__init__.py new file mode 100644 index 00000000000..90d182d1c05 --- /dev/null +++ b/scripts/tests/IceDiscovery/__init__.py @@ -0,0 +1,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. +# +# ********************************************************************** diff --git a/scripts/tests/IceDiscovery/simple.py b/scripts/tests/IceDiscovery/simple.py new file mode 100644 index 00000000000..36b4f86a39e --- /dev/null +++ b/scripts/tests/IceDiscovery/simple.py @@ -0,0 +1,27 @@ +# -*- 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. +# +# ********************************************************************** + +# Client properties (plugin is loaded with Ice::registerPluginFactory) +props = lambda process, current: { + "IceDiscovery.Timeout": 50, + "IceDiscovery.RetryCount": 5, + "IceDiscovery.Interface": "127.0.0.1" if not current.config.ipv6 else "\"::1\"" if isinstance(platform, Darwin) else "", + "Ice.Plugin.IceDiscovery": current.getPluginEntryPoint("IceDiscovery") +} + +# Server properties (client properties + plugin configuration) +serverProps = lambda process, current: dict(itertools.chain({ + "Ice.Plugin.IceDiscovery": current.getPluginEntryPoint("IceDiscovery") +}.items(), props(process, current).items())) + +TestSuite(__name__, [ + ClientServerTestCase(client=Client(args=[3], props=props), + servers=[Server(args=[i], readyCount=4, props=serverProps) for i in range(0, 3)]) +], multihost=False) diff --git a/scripts/tests/IceGrid/__init__.py b/scripts/tests/IceGrid/__init__.py new file mode 100644 index 00000000000..90d182d1c05 --- /dev/null +++ b/scripts/tests/IceGrid/__init__.py @@ -0,0 +1,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. +# +# ********************************************************************** diff --git a/scripts/tests/IceGrid/simple.py b/scripts/tests/IceGrid/simple.py new file mode 100644 index 00000000000..379ebe790d9 --- /dev/null +++ b/scripts/tests/IceGrid/simple.py @@ -0,0 +1,27 @@ +# -*- 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. +# +# ********************************************************************** + +serverProps = { + "TestAdapter.Endpoints" : "default", + "TestAdapter.AdapterId" : "TestAdapter" +} + +registryProps = { + "IceGrid.Registry.DynamicRegistration" : 1 +} + +TestSuite(__name__, [ + IceGridTestCase("without deployment", application=None, + icegridregistry=[IceGridRegistryMaster(props=registryProps), + IceGridRegistrySlave(1, props=registryProps), + IceGridRegistrySlave(2, props=registryProps)], + client=ClientServerTestCase(client=IceGridClient(), server=IceGridServer(props=serverProps))), + IceGridTestCase("with deployment", client=IceGridClient(args=["--with-deploy"])) +], multihost=False) diff --git a/scripts/tests/IceSSL/__init__.py b/scripts/tests/IceSSL/__init__.py new file mode 100644 index 00000000000..90d182d1c05 --- /dev/null +++ b/scripts/tests/IceSSL/__init__.py @@ -0,0 +1,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. +# +# ********************************************************************** diff --git a/scripts/tests/IceSSL/configuration.py b/scripts/tests/IceSSL/configuration.py new file mode 100644 index 00000000000..1d4f832b49f --- /dev/null +++ b/scripts/tests/IceSSL/configuration.py @@ -0,0 +1,54 @@ +# -*- 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 ConfigurationTestCase(ClientServerTestCase): + + def setupServerSide(self, current): + # Nothing to do if we're not running this test with the C++ mapping + if not isinstance(self.getMapping(), CppMapping): + return + + certsPath = os.path.abspath(os.path.join(self.getPath(), "..", "certs")) + if isinstance(platform, Darwin): + keychainPath = os.path.join(certsPath, "Find.keychain") + os.system("mkdir -p {0}".format(os.path.join(certsPath, "keychain"))) + os.system("security create-keychain -p password %s" % keychainPath) + for cert in ["s_rsa_ca1.p12", "c_rsa_ca1.p12"]: + os.system("security import %s -f pkcs12 -A -P password -k %s" % (os.path.join(certsPath, cert), keychainPath)) + elif platform.hasOpenSSL(): + # + # Create copies of the CA certificates named after the subject + # hash. This is used by the tests to find the CA certificates in + # the IceSSL.DefaultDir + # + for c in ["cacert1.pem", "cacert2.pem"]: + pem = os.path.join(certsPath, c) + os.system("cp {pem} {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath)) + + def teardownServerSide(self, current, success): + # Nothing to do if we're not running this test with the C++ mapping + if not isinstance(self.getMapping(), CppMapping): + return + + certsPath = os.path.abspath(os.path.join(self.getPath(), "..", "certs")) + if isinstance(platform, Darwin): + os.system("rm -rf {0} {1}".format(os.path.join(certsPath, "keychain"), os.path.join(certsPath, "Find.keychain"))) + elif platform.hasOpenSSL(): + for c in ["cacert1.pem", "cacert2.pem"]: + pem = os.path.join(certsPath, c) + os.system("rm -f {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath)) + +# Filter-out the deprecated property warnings +outfilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.KeyFile\n", "", x) ] + +TestSuite(__name__, [ + ConfigurationTestCase(client=Client(outfilters=outfilters, args=['"{testdir}"']), + server=Server(outfilters=outfilters)) +], multihost=False) diff --git a/scripts/tests/__init__.py b/scripts/tests/__init__.py new file mode 100644 index 00000000000..90d182d1c05 --- /dev/null +++ b/scripts/tests/__init__.py @@ -0,0 +1,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. +# +# ********************************************************************** |