diff options
Diffstat (limited to 'cpp/test/Ice/facets/AllTests.cpp')
-rw-r--r-- | cpp/test/Ice/facets/AllTests.cpp | 115 |
1 files changed, 62 insertions, 53 deletions
diff --git a/cpp/test/Ice/facets/AllTests.cpp b/cpp/test/Ice/facets/AllTests.cpp index 668a2753280..1e4c07e0d41 100644 --- a/cpp/test/Ice/facets/AllTests.cpp +++ b/cpp/test/Ice/facets/AllTests.cpp @@ -22,6 +22,11 @@ class EmptyI : virtual public Empty GPrx allTests(const Ice::CommunicatorPtr& communicator) { +#ifdef ICE_OS_WINRT + bool winrt = true; +#else + bool winrt = false +#endif cout << "testing Ice.Admin.Facets property... " << flush; test(communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets").empty()); communicator->getProperties()->setProperty("Ice.Admin.Facets", "foobar"); @@ -32,7 +37,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(facetFilter.size() == 1 && facetFilter[0] == "foo'bar"); communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'"); facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets"); - test(facetFilter.size() == 3 && facetFilter[0] == "foo bar" && facetFilter[1] == "toto" && + test(facetFilter.size() == 3 && facetFilter[0] == "foo bar" && facetFilter[1] == "toto" && facetFilter[2] == "titi"); communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar\\' toto' 'titi'"); facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets"); @@ -43,62 +48,66 @@ allTests(const Ice::CommunicatorPtr& communicator) communicator->getProperties()->setProperty("Ice.Admin.Facets", ""); cout << "ok" << endl; - cout << "testing facet registration exceptions... " << flush; - string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? - "127.0.0.1" : "\"0:0:0:0:0:0:0:1\""; - communicator->getProperties()->setProperty("FacetExceptionTestAdapter.Endpoints", "default -h " + host); - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("FacetExceptionTestAdapter"); - Ice::ObjectPtr obj = new EmptyI; - adapter->add(obj, communicator->stringToIdentity("d")); - adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD"); - try + if(!winrt || (communicator->getProperties()->getProperty("Ice.Default.Protocol") != "ssl" && + communicator->getProperties()->getProperty("Ice.Default.Protocol") != "wss")) { + cout << "testing facet registration exceptions... " << flush; + string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? + "127.0.0.1" : "\"0:0:0:0:0:0:0:1\""; + communicator->getProperties()->setProperty("FacetExceptionTestAdapter.Endpoints", "default -h " + host); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("FacetExceptionTestAdapter"); + Ice::ObjectPtr obj = new EmptyI; + adapter->add(obj, communicator->stringToIdentity("d")); adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD"); - test(false); - } - catch(const Ice::AlreadyRegisteredException&) - { - } - adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD"); - try - { + try + { + adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD"); + test(false); + } + catch(const Ice::AlreadyRegisteredException&) + { + } adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD"); - test(false); - } - catch(const Ice::NotRegisteredException&) - { + try + { + adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD"); + test(false); + } + catch(const Ice::NotRegisteredException&) + { + } + cout << "ok" << endl; + + cout << "testing removeAllFacets... " << flush; + Ice::ObjectPtr obj1 = new EmptyI; + Ice::ObjectPtr obj2 = new EmptyI; + adapter->addFacet(obj1, communicator->stringToIdentity("id1"), "f1"); + adapter->addFacet(obj2, communicator->stringToIdentity("id1"), "f2"); + Ice::ObjectPtr obj3 = new EmptyI; + adapter->addFacet(obj1, communicator->stringToIdentity("id2"), "f1"); + adapter->addFacet(obj2, communicator->stringToIdentity("id2"), "f2"); + adapter->addFacet(obj3, communicator->stringToIdentity("id2"), ""); + Ice::FacetMap fm = adapter->removeAllFacets(communicator->stringToIdentity("id1")); + test(fm.size() == 2); + test(fm["f1"] == obj1); + test(fm["f2"] == obj2); + try + { + adapter->removeAllFacets(communicator->stringToIdentity("id1")); + test(false); + } + catch(const Ice::NotRegisteredException&) + { + } + fm = adapter->removeAllFacets(communicator->stringToIdentity("id2")); + test(fm.size() == 3); + test(fm["f1"] == obj1); + test(fm["f2"] == obj2); + test(fm[""] == obj3); + cout << "ok" << endl; + + adapter->deactivate(); } - cout << "ok" << endl; - - cout << "testing removeAllFacets... " << flush; - Ice::ObjectPtr obj1 = new EmptyI; - Ice::ObjectPtr obj2 = new EmptyI; - adapter->addFacet(obj1, communicator->stringToIdentity("id1"), "f1"); - adapter->addFacet(obj2, communicator->stringToIdentity("id1"), "f2"); - Ice::ObjectPtr obj3 = new EmptyI; - adapter->addFacet(obj1, communicator->stringToIdentity("id2"), "f1"); - adapter->addFacet(obj2, communicator->stringToIdentity("id2"), "f2"); - adapter->addFacet(obj3, communicator->stringToIdentity("id2"), ""); - Ice::FacetMap fm = adapter->removeAllFacets(communicator->stringToIdentity("id1")); - test(fm.size() == 2); - test(fm["f1"] == obj1); - test(fm["f2"] == obj2); - try - { - adapter->removeAllFacets(communicator->stringToIdentity("id1")); - test(false); - } - catch(const Ice::NotRegisteredException&) - { - } - fm = adapter->removeAllFacets(communicator->stringToIdentity("id2")); - test(fm.size() == 3); - test(fm["f1"] == obj1); - test(fm["f2"] == obj2); - test(fm[""] == obj3); - cout << "ok" << endl; - - adapter->deactivate(); cout << "testing stringToProxy... " << flush; string ref = "d:default -p 12010"; |