diff options
Diffstat (limited to 'cpp/test')
-rwxr-xr-x | cpp/test/Glacier2/staticFiltering/run.py | 4 | ||||
-rw-r--r-- | cpp/test/Ice/metrics/AllTests.cpp | 74 | ||||
-rw-r--r-- | cpp/test/Ice/proxy/AllTests.cpp | 24 |
3 files changed, 52 insertions, 50 deletions
diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py index d77870462aa..f1b459a7863 100755 --- a/cpp/test/Glacier2/staticFiltering/run.py +++ b/cpp/test/Glacier2/staticFiltering/run.py @@ -218,8 +218,8 @@ if not limitedTests: [(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', - ('', '', '41', '', '', ''), - [(True, 'hello:tcp -h 127.0.0.1 -p 12010'), + ('', '', '53', '', '', ''), + [(True, 'hello:tcp -h 127.0.0.1 -p 12010 -t infinite'), (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []), ]) diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index cf9904e8dc8..7fb13af91e1 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -56,7 +56,7 @@ private: typedef IceUtil::Handle<Callback> CallbackPtr; Ice::PropertyDict -getClientProps(const Ice::PropertiesAdminPrx& p, const Ice::PropertyDict& orig, const string& m = string()) +getClientProps(const Ice::PropertiesAdminPrx& p, const Ice::PropertyDict& orig, const string& m = string()) { Ice::PropertyDict props = p->getPropertiesForPrefix("IceMX.Metrics"); for(Ice::PropertyDict::iterator p = props.begin(); p != props.end(); ++p) @@ -137,7 +137,7 @@ public: } if(_serverProps->ice_getConnection()) { - // Ensure that the previous updates were committed, the setProperties call returns before + // Ensure that the previous updates were committed, the setProperties call returns before // notifying the callbacks so to ensure all the update callbacks have be notified we call // a second time, this will block until all the notifications from the first update have // completed. @@ -186,10 +186,10 @@ waitForCurrent(const IceMX::MetricsAdminPrx& metrics, const string& viewName, co } template<typename T> void -testAttribute(const IceMX::MetricsAdminPrx& metrics, - const Ice::PropertiesAdminPrx& props, +testAttribute(const IceMX::MetricsAdminPrx& metrics, + const Ice::PropertiesAdminPrx& props, UpdateCallbackI* update, - const string& map, + const string& map, const string& attr, const string& value, const T& func) @@ -239,7 +239,7 @@ testAttribute(const IceMX::MetricsAdminPrx& metrics, struct Void { - void + void operator()() const { } @@ -293,10 +293,10 @@ struct InvokeOp }; void -testAttribute(const IceMX::MetricsAdminPrx& metrics, - const Ice::PropertiesAdminPrx& props, +testAttribute(const IceMX::MetricsAdminPrx& metrics, + const Ice::PropertiesAdminPrx& props, UpdateCallbackI* update, - const string& map, + const string& map, const string& attr, const string& value) { @@ -304,9 +304,9 @@ testAttribute(const IceMX::MetricsAdminPrx& metrics, } void -updateProps(const Ice::PropertiesAdminPrx& cprops, - const Ice::PropertiesAdminPrx& sprops, - UpdateCallbackI* callback, +updateProps(const Ice::PropertiesAdminPrx& cprops, + const Ice::PropertiesAdminPrx& sprops, + UpdateCallbackI* callback, const Ice::PropertyDict& props, const string& map = string()) { @@ -410,7 +410,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt props["IceMX.Metrics.View.GroupBy"] = "none"; updateProps(clientProps, serverProps, update, props); - + #ifndef ICE_OS_WINRT int threadCount = 3; #else @@ -421,10 +421,10 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt IceMX::MetricsView view = clientMetrics->getMetricsView("View", timestamp); if(!collocated) { - test(view["Connection"].size() == 1 && view["Connection"][0]->current == 1 && + test(view["Connection"].size() == 1 && view["Connection"][0]->current == 1 && view["Connection"][0]->total == 1); } - test(view["Thread"].size() == 1 && view["Thread"][0]->current == threadCount && + test(view["Thread"].size() == 1 && view["Thread"][0]->current == threadCount && view["Thread"][0]->total == threadCount); cout << "ok" << endl; @@ -476,13 +476,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt { metrics->ice_getConnection()->close(false); metrics->ice_connectionId("Con1")->ice_getConnection()->close(false); - + waitForCurrent(clientMetrics, "View", "Connection", 0); waitForCurrent(serverMetrics, "View", "Connection", 0); } clearView(clientProps, serverProps, update); - + cout << "ok" << endl; map<string, IceMX::MetricsPtr> map; @@ -555,7 +555,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt test(cm2->receivedBytes - cm1->receivedBytes == replySz); test(sm2->receivedBytes - sm1->receivedBytes == requestSz + static_cast<int>(bs.size()) + 4); test(sm2->sentBytes - sm1->sentBytes == replySz); - + props["IceMX.Metrics.View.Map.Connection.GroupBy"] = "state"; updateProps(clientProps, serverProps, update, props, "Connection"); @@ -643,7 +643,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010"); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", ""); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", ""); - + m->ice_getConnection()->close(false); waitForCurrent(clientMetrics, "View", "Connection", 0); @@ -658,7 +658,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].empty()); metrics->ice_ping(); - + 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"); @@ -687,13 +687,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt Connect c(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", "endpoint", - "tcp -h 127.0.0.1 -p 12010", c); + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint", + "tcp -h 127.0.0.1 -p 12010 -t 60000", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointType", "1", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsDatagram", "false", c); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointIsSecure", "false", c); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "-1", 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); @@ -711,13 +711,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt updateProps(clientProps, serverProps, update, props, "EndpointLookup"); test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].empty()); - Ice::ObjectPrx prx = communicator->stringToProxy("metrics:default -p 12010 -h localhost"); + Ice::ObjectPrx prx = communicator->stringToProxy("metrics:default -p 12010 -h localhost -t infinite"); prx->ice_ping(); - + test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 1); m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][0]; - test(m1->current <= 1 && m1->total == 1 && m1->id == "tcp -h localhost -p 12010"); + test(m1->current <= 1 && m1->total == 1 && m1->id == "tcp -h localhost -p 12010 -t infinite"); prx->ice_getConnection()->close(false); @@ -737,7 +737,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 12010 -t 500" && m1->total == 2 && (!dnsException || m1->failures == 2)); if(dnsException) { @@ -747,9 +747,10 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt c = Connect(prx); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "parent", "Communicator", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", "tcp -h localhost -p 12010", c); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint", - "tcp -h localhost -p 12010", c); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "id", + "tcp -h localhost -p 12010 -t infinite", c); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpoint", + "tcp -h localhost -p 12010 -t infinite", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", "1", c); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c); @@ -853,13 +854,14 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(serverMetrics, serverProps, update, "Dispatch", "id", "metrics [op]", op); if(!collocated) { - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", "tcp -h 127.0.0.1 -p 12010", op); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpoint", "tcp -h 127.0.0.1 -p 12010 -t 60000", + op); //testAttribute(serverMetrics, serverProps, update, "Dispatch", "connection", "", op); - + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointType", "1", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsDatagram", "false", op); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", "false", op); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "-1", 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); @@ -1017,7 +1019,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt rim1 = IceMX::ChildInvocationMetricsPtr::dynamicCast(!collocated ? im1->remotes[0] : im1->collocated[0]); test(rim1->current == 0 && rim1->total == 3 && rim1->failures == 0); test(rim1->size == 63 && rim1->replySize == 21); - + im1 = IceMX::InvocationMetricsPtr::dynamicCast(map["opWithUserException"]); test(im1->current <= 1 && im1->total == 3 && im1->failures == 0 && im1->retry == 0); test(!collocated ? (im1->remotes.size() == 1) : (im1->collocated.size() == 1)); @@ -1071,8 +1073,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt testAttribute(clientMetrics, clientProps, update, "Invocation", "facet", "", op); 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", op); + testAttribute(clientMetrics, clientProps, update, "Invocation", "proxy", + "metrics -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 60000", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry1", "test", op); testAttribute(clientMetrics, clientProps, update, "Invocation", "context.entry2", "", op); diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index ccf635bb3c6..34754f816b7 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -531,7 +531,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(!(compObj->ice_locator(loc1) < compObj->ice_locator(0))); test(compObj->ice_locator(loc1) < compObj->ice_locator(loc2)); test(!(compObj->ice_locator(loc2) < compObj->ice_locator(loc1))); - + Ice::RouterPrx rtr1 = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("rtr1:default -p 10000")); Ice::RouterPrx rtr2 = Ice::RouterPrx::uncheckedCast(communicator->stringToProxy("rtr2:default -p 10000")); test(compObj->ice_router(0) == compObj->ice_router(0)); @@ -543,7 +543,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(!(compObj->ice_router(rtr1) < compObj->ice_router(0))); test(compObj->ice_router(rtr1) < compObj->ice_router(rtr2)); test(!(compObj->ice_router(rtr2) < compObj->ice_router(rtr1))); - + Ice::Context ctx1; ctx1["ctx1"] = "v1"; Ice::Context ctx2; @@ -555,12 +555,12 @@ allTests(const Ice::CommunicatorPtr& communicator) test(compObj->ice_context(ctx1) != compObj->ice_context(ctx2)); test(compObj->ice_context(ctx1) < compObj->ice_context(ctx2)); test(!(compObj->ice_context(ctx2) < compObj->ice_context(ctx1))); - + test(compObj->ice_preferSecure(true) == compObj->ice_preferSecure(true)); test(compObj->ice_preferSecure(true) != compObj->ice_preferSecure(false)); test(compObj->ice_preferSecure(false) < compObj->ice_preferSecure(true)); test(!(compObj->ice_preferSecure(true) < compObj->ice_preferSecure(false))); - + Ice::ObjectPrx compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); Ice::ObjectPrx compObj2 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); test(compObj1 != compObj2); @@ -610,13 +610,13 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing checked cast... " << flush; Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); test(cl); - + Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(cl); test(derived); test(cl == base); test(derived == base); test(cl == derived); - + Ice::LocatorPrx loc = Ice::LocatorPrx::checkedCast(base); test(loc == 0); @@ -640,7 +640,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(cl == base); test(derived == base); test(cl == derived); - + loc = checkedCast<Ice::LocatorPrx>(base); test(loc == 0); @@ -679,7 +679,7 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing encoding versioning... " << flush; string ref20 = "test -e 2.0:default -p 12010"; Test::MyClassPrx cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); - try + try { cl20->ice_collocationOptimized(false)->ice_ping(); test(false); @@ -701,7 +701,7 @@ allTests(const Ice::CommunicatorPtr& communicator) Test::MyClassPrx cl13 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref13)); cl13->ice_ping(); cl13->end_ice_ping(cl13->begin_ice_ping()); - + try { // Send request with bogus 1.2 encoding. @@ -750,7 +750,7 @@ allTests(const Ice::CommunicatorPtr& communicator) ref20 = "test -p 2.0:default -p 12010"; cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); - try + try { cl20->ice_collocationOptimized(false)->ice_ping(); test(false); @@ -922,7 +922,7 @@ allTests(const Ice::CommunicatorPtr& communicator) pstr = communicator->proxyToString(p1); if(ssl) { - test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch"); + test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"); } else if(tcp) { @@ -957,7 +957,7 @@ allTests(const Ice::CommunicatorPtr& communicator) pstr = communicator->proxyToString(p2); if(ssl) { - test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch"); + test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch"); } else if(tcp) { |