diff options
author | Jose <jose@zeroc.com> | 2015-12-01 17:36:19 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2015-12-01 17:36:19 +0100 |
commit | 2029ff368e49fae489b8ec8fc12f7d126b182dfb (patch) | |
tree | 6075d652b7851831c39e6f22004d8720864f1a60 /cpp/test/Ice/proxy/AllTests.cpp | |
parent | The default LMDB map size for IceGrid and IceStorm is now 10MB (Windows) (diff) | |
download | ice-2029ff368e49fae489b8ec8fc12f7d126b182dfb.tar.bz2 ice-2029ff368e49fae489b8ec8fc12f7d126b182dfb.tar.xz ice-2029ff368e49fae489b8ec8fc12f7d126b182dfb.zip |
C++11 mapping initial commit
Diffstat (limited to 'cpp/test/Ice/proxy/AllTests.cpp')
-rw-r--r-- | cpp/test/Ice/proxy/AllTests.cpp | 285 |
1 files changed, 243 insertions, 42 deletions
diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index 545dc04037d..d324135ac83 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -10,20 +10,21 @@ #include <Ice/Ice.h> #include <Ice/Locator.h> #include <Ice/Router.h> +#include <Ice/EndpointI.h> #include <TestCommon.h> #include <Test.h> using namespace std; -Test::MyClassPrx +Test::MyClassPrxPtr allTests(const Ice::CommunicatorPtr& communicator) { cout << "testing stringToProxy... " << flush; string ref = "test:default -p 12010"; - Ice::ObjectPrx base = communicator->stringToProxy(ref); + Ice::ObjectPrxPtr base = communicator->stringToProxy(ref); test(base); - Ice::ObjectPrx b1 = communicator->stringToProxy("test"); + Ice::ObjectPrxPtr b1 = communicator->stringToProxy("test"); test(b1->ice_getIdentity().name == "test" && b1->ice_getIdentity().category.empty() && b1->ice_getAdapterId().empty() && b1->ice_getFacet().empty()); b1 = communicator->stringToProxy("test "); @@ -389,7 +390,7 @@ allTests(const Ice::CommunicatorPtr& communicator) b1 = b1->ice_invocationTimeout(1234); Ice::EncodingVersion v = { 1, 0 }; b1 = b1->ice_encodingVersion(v); - Ice::ObjectPrx router = communicator->stringToProxy("router"); + Ice::ObjectPrxPtr router = communicator->stringToProxy("router"); router = router->ice_collocationOptimized(false); router = router->ice_connectionCached(true); router = router->ice_preferSecure(true); @@ -397,7 +398,7 @@ allTests(const Ice::CommunicatorPtr& communicator) router = router->ice_locatorCacheTimeout(200); router = router->ice_invocationTimeout(1500); - Ice::ObjectPrx locator = communicator->stringToProxy("locator"); + Ice::ObjectPrxPtr locator = communicator->stringToProxy("locator"); locator = locator->ice_collocationOptimized(true); locator = locator->ice_connectionCached(false); locator = locator->ice_preferSecure(true); @@ -405,8 +406,8 @@ allTests(const Ice::CommunicatorPtr& communicator) locator = locator->ice_locatorCacheTimeout(300); locator = locator->ice_invocationTimeout(1500); - locator = locator->ice_router(Ice::RouterPrx::uncheckedCast(router)); - b1 = b1->ice_locator(Ice::LocatorPrx::uncheckedCast(locator)); + locator = locator->ice_router(ICE_UNCHECKED_CAST(Ice::RouterPrx, router)); + b1 = b1->ice_locator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator)); Ice::PropertyDict proxyProps = communicator->proxyToProperty(b1, "Test"); test(proxyProps.size() == 21); @@ -548,12 +549,195 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "testing proxy comparison... " << flush; +#ifdef ICE_CPP11_MAPPING + test(Ice::targetEquals(communicator->stringToProxy("foo"), communicator->stringToProxy("foo"))); + test(!Ice::targetEquals(communicator->stringToProxy("foo"), communicator->stringToProxy("foo2"))); + test(Ice::targetLess(communicator->stringToProxy("foo"), communicator->stringToProxy("foo2"))); + test(!Ice::targetLess(communicator->stringToProxy("foo2"), communicator->stringToProxy("foo"))); + + Ice::ObjectPrxPtr compObj = communicator->stringToProxy("foo"); + + test(Ice::targetEquals(compObj->ice_facet("facet"), compObj->ice_facet("facet"))); + test(!Ice::targetEquals(compObj->ice_facet("facet"), compObj->ice_facet("facet1"))); + test(Ice::targetLess(compObj->ice_facet("facet"), compObj->ice_facet("facet1"))); + test(!Ice::targetLess(compObj->ice_facet("facet"), compObj->ice_facet("facet"))); + + test(Ice::targetEquals(compObj->ice_oneway(), compObj->ice_oneway())); + test(!Ice::targetEquals(compObj->ice_oneway(), compObj->ice_twoway())); + test(Ice::targetLess(compObj->ice_twoway(), compObj->ice_oneway())); + test(!Ice::targetLess(compObj->ice_oneway(), compObj->ice_twoway())); + + test(Ice::targetEquals(compObj->ice_secure(true), compObj->ice_secure(true))); + test(!Ice::targetEquals(compObj->ice_secure(false), compObj->ice_secure(true))); + test(Ice::targetLess(compObj->ice_secure(false), compObj->ice_secure(true))); + test(!Ice::targetLess(compObj->ice_secure(true), compObj->ice_secure(false))); + + test(Ice::targetEquals(compObj->ice_collocationOptimized(true), compObj->ice_collocationOptimized(true))); + test(!Ice::targetEquals(compObj->ice_collocationOptimized(false), compObj->ice_collocationOptimized(true))); + test(Ice::targetLess(compObj->ice_collocationOptimized(false), compObj->ice_collocationOptimized(true))); + test(!Ice::targetLess(compObj->ice_collocationOptimized(true), compObj->ice_collocationOptimized(false))); + + test(Ice::targetEquals(compObj->ice_connectionCached(true), compObj->ice_connectionCached(true))); + test(!Ice::targetEquals(compObj->ice_connectionCached(false), compObj->ice_connectionCached(true))); + test(Ice::targetLess(compObj->ice_connectionCached(false), compObj->ice_connectionCached(true))); + test(!Ice::targetLess(compObj->ice_connectionCached(true), compObj->ice_connectionCached(false))); + + test(Ice::targetEquals(compObj->ice_endpointSelection(Ice::Random), compObj->ice_endpointSelection(Ice::Random))); + test(!Ice::targetEquals(compObj->ice_endpointSelection(Ice::Random), compObj->ice_endpointSelection(Ice::Ordered))); + test(Ice::targetLess(compObj->ice_endpointSelection(Ice::Random), compObj->ice_endpointSelection(Ice::Ordered))); + test(!Ice::targetLess(compObj->ice_endpointSelection(Ice::Ordered), compObj->ice_endpointSelection(Ice::Random))); + + test(Ice::targetEquals(compObj->ice_connectionId("id2"), compObj->ice_connectionId("id2"))); + test(!Ice::targetEquals(compObj->ice_connectionId("id1"), compObj->ice_connectionId("id2"))); + test(Ice::targetLess(compObj->ice_connectionId("id1"), compObj->ice_connectionId("id2"))); + test(!Ice::targetLess(compObj->ice_connectionId("id2"), compObj->ice_connectionId("id1"))); + + test(compObj->ice_connectionId("id1")->ice_getConnectionId() == "id1"); + test(compObj->ice_connectionId("id2")->ice_getConnectionId() == "id2"); + + test(Ice::targetEquals(compObj->ice_compress(true), compObj->ice_compress(true))); + test(!Ice::targetEquals(compObj->ice_compress(false), compObj->ice_compress(true))); + test(Ice::targetLess(compObj->ice_compress(false), compObj->ice_compress(true))); + test(!Ice::targetLess(compObj->ice_compress(true), compObj->ice_compress(false))); + + test(Ice::targetEquals(compObj->ice_timeout(20), compObj->ice_timeout(20))); + test(!Ice::targetEquals(compObj->ice_timeout(10), compObj->ice_timeout(20))); + test(Ice::targetLess(compObj->ice_timeout(10), compObj->ice_timeout(20))); + test(!Ice::targetLess(compObj->ice_timeout(20), compObj->ice_timeout(10))); + + auto loc1 = Ice::uncheckedCast<Ice::LocatorPrx>(communicator->stringToProxy("loc1:default -p 10000")); + auto loc2 = Ice::uncheckedCast<Ice::LocatorPrx>(communicator->stringToProxy("loc2:default -p 10000")); + + test(Ice::targetEquals(compObj->ice_locator(0), compObj->ice_locator(0))); + test(Ice::targetEquals(compObj->ice_locator(loc1), compObj->ice_locator(loc1))); + test(!Ice::targetEquals(compObj->ice_locator(loc1), compObj->ice_locator(0))); + test(!Ice::targetEquals(compObj->ice_locator(0), compObj->ice_locator(loc2))); + test(!Ice::targetEquals(compObj->ice_locator(loc1), compObj->ice_locator(loc2))); + test(Ice::targetLess(compObj->ice_locator(0), compObj->ice_locator(loc1))); + test(!Ice::targetLess(compObj->ice_locator(loc1), compObj->ice_locator(0))); + test(Ice::targetLess(compObj->ice_locator(loc1), compObj->ice_locator(loc2))); + test(!Ice::targetLess(compObj->ice_locator(loc2), compObj->ice_locator(loc1))); + + auto rtr1 = Ice::uncheckedCast<Ice::RouterPrx>(communicator->stringToProxy("rtr1:default -p 10000")); + auto rtr2 = Ice::uncheckedCast<Ice::RouterPrx>(communicator->stringToProxy("rtr2:default -p 10000")); + + test(Ice::targetEquals(compObj->ice_router(0), compObj->ice_router(0))); + test(Ice::targetEquals(compObj->ice_router(rtr1), compObj->ice_router(rtr1))); + test(!Ice::targetEquals(compObj->ice_router(rtr1), compObj->ice_router(0))); + test(!Ice::targetEquals(compObj->ice_router(0), compObj->ice_router(rtr2))); + test(!Ice::targetEquals(compObj->ice_router(rtr1), compObj->ice_router(rtr2))); + test(Ice::targetLess(compObj->ice_router(0), compObj->ice_router(rtr1))); + test(!Ice::targetLess(compObj->ice_router(rtr1), compObj->ice_router(0))); + test(Ice::targetLess(compObj->ice_router(rtr1), compObj->ice_router(rtr2))); + test(!Ice::targetLess(compObj->ice_router(rtr2), compObj->ice_router(rtr1))); + + Ice::Context ctx1; + ctx1["ctx1"] = "v1"; + Ice::Context ctx2; + ctx2["ctx2"] = "v2"; + test(Ice::targetEquals(compObj->ice_context(Ice::Context()), compObj->ice_context(Ice::Context()))); + test(Ice::targetEquals(compObj->ice_context(ctx1), compObj->ice_context(ctx1))); + test(!Ice::targetEquals(compObj->ice_context(ctx1), compObj->ice_context(Ice::Context()))); + test(!Ice::targetEquals(compObj->ice_context(Ice::Context()), compObj->ice_context(ctx2))); + test(!Ice::targetEquals(compObj->ice_context(ctx1), compObj->ice_context(ctx2))); + test(Ice::targetLess(compObj->ice_context(ctx1), compObj->ice_context(ctx2))); + test(!Ice::targetLess(compObj->ice_context(ctx2), compObj->ice_context(ctx1))); + + test(Ice::targetEquals(compObj->ice_preferSecure(true), compObj->ice_preferSecure(true))); + test(!Ice::targetEquals(compObj->ice_preferSecure(true), compObj->ice_preferSecure(false))); + test(Ice::targetLess(compObj->ice_preferSecure(false), compObj->ice_preferSecure(true))); + test(!Ice::targetLess(compObj->ice_preferSecure(true), compObj->ice_preferSecure(false))); + + auto compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); + auto compObj2 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); + test(!Ice::targetEquals(compObj1, compObj2)); + test(Ice::targetLess(compObj1, compObj2)); + test(!Ice::targetLess(compObj2, compObj1)); + + compObj1 = communicator->stringToProxy("foo@MyAdapter1"); + compObj2 = communicator->stringToProxy("foo@MyAdapter2"); + test(!Ice::targetEquals(compObj1, compObj2)); + test(Ice::targetLess(compObj1, compObj2)); + test(!Ice::targetLess(compObj2, compObj1)); + + test(Ice::targetEquals(compObj1->ice_locatorCacheTimeout(20), compObj1->ice_locatorCacheTimeout(20))); + test(!Ice::targetEquals(compObj1->ice_locatorCacheTimeout(10), compObj1->ice_locatorCacheTimeout(20))); + test(Ice::targetLess(compObj1->ice_locatorCacheTimeout(10), compObj1->ice_locatorCacheTimeout(20))); + test(!Ice::targetLess(compObj1->ice_locatorCacheTimeout(20), compObj1->ice_locatorCacheTimeout(10))); + + test(Ice::targetEquals(compObj1->ice_invocationTimeout(20), compObj1->ice_invocationTimeout(20))); + test(!Ice::targetEquals(compObj1->ice_invocationTimeout(10), compObj1->ice_invocationTimeout(20))); + test(Ice::targetLess(compObj1->ice_invocationTimeout(10), compObj1->ice_invocationTimeout(20))); + test(!Ice::targetLess(compObj1->ice_invocationTimeout(20), compObj1->ice_invocationTimeout(10))); + + compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 1000"); + compObj2 = communicator->stringToProxy("foo@MyAdapter1"); + test(!Ice::targetEquals(compObj1, compObj2)); + test(Ice::targetLess(compObj1, compObj2)); + test(!Ice::targetLess(compObj2, compObj1)); + + Ice::EndpointSeq endpts1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000")->ice_getEndpoints(); + Ice::EndpointSeq endpts2 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10001")->ice_getEndpoints(); + + auto eq = [](const shared_ptr<Ice::Endpoint>& lhs, const shared_ptr<Ice::Endpoint>& rhs) + { + return Ice::targetEquals(dynamic_pointer_cast<IceInternal::EndpointI>(lhs), + dynamic_pointer_cast<IceInternal::EndpointI>(rhs)); + }; + + auto less = [](const shared_ptr<Ice::Endpoint>& lhs, const shared_ptr<Ice::Endpoint>& rhs) + { + return Ice::targetLess(dynamic_pointer_cast<IceInternal::EndpointI>(lhs), + dynamic_pointer_cast<IceInternal::EndpointI>(rhs)); + }; + + test(!equal(endpts1.begin(), endpts1.end(), endpts2.begin(), endpts2.end(), eq)); + test(lexicographical_compare(endpts1.begin(), endpts1.end(), endpts2.begin(), endpts2.end(), less)); + test(!lexicographical_compare(endpts2.begin(), endpts2.end(), endpts1.begin(), endpts1.end(), less)); + + Ice::EndpointSeq endpts3 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000")->ice_getEndpoints(); + test(equal(endpts1.begin(), endpts1.end(), endpts3.begin(), endpts3.end(), eq)); + + test(Ice::targetEquals(compObj1->ice_encodingVersion(Ice::Encoding_1_0), compObj1->ice_encodingVersion(Ice::Encoding_1_0))); + test(!Ice::targetEquals(compObj1->ice_encodingVersion(Ice::Encoding_1_0), compObj1->ice_encodingVersion(Ice::Encoding_1_1))); + test(Ice::targetLess(compObj->ice_encodingVersion(Ice::Encoding_1_0), compObj->ice_encodingVersion(Ice::Encoding_1_1))); + test(!Ice::targetLess(compObj->ice_encodingVersion(Ice::Encoding_1_1), compObj->ice_encodingVersion(Ice::Encoding_1_0))); + + // + // TODO: Ideally we should also test comparison of fixed proxies. + // + + cout << "ok" << endl; + + cout << "testing checked cast... " << flush; + auto cl = Ice::checkedCast<Test::MyClassPrx>(base); + test(cl); + + auto derived = Ice::checkedCast<Test::MyDerivedClassPrx>(cl); + test(derived); + test(Ice::targetEquals(cl, base)); + test(Ice::targetEquals(derived, base)); + test(Ice::targetEquals(cl, derived)); + + auto loc = Ice::checkedCast<Ice::LocatorPrx>(base); + test(loc == nullptr); + + // + // Upcasting + // + auto cl2 = Ice::checkedCast<Test::MyClassPrx>(derived); + auto obj = Ice::checkedCast<Ice::ObjectPrx>(derived); + test(cl2); + test(obj); + test(Ice::targetEquals(cl2, obj)); + test(Ice::targetEquals(cl2, derived)); +#else test(communicator->stringToProxy("foo") == communicator->stringToProxy("foo")); test(communicator->stringToProxy("foo") != communicator->stringToProxy("foo2")); test(communicator->stringToProxy("foo") < communicator->stringToProxy("foo2")); test(!(communicator->stringToProxy("foo2") < communicator->stringToProxy("foo"))); - Ice::ObjectPrx compObj = communicator->stringToProxy("foo"); + Ice::ObjectPrxPtr compObj = communicator->stringToProxy("foo"); test(compObj->ice_facet("facet") == compObj->ice_facet("facet")); test(compObj->ice_facet("facet") != compObj->ice_facet("facet1")); @@ -603,8 +787,8 @@ allTests(const Ice::CommunicatorPtr& communicator) test(compObj->ice_timeout(10) < compObj->ice_timeout(20)); test(!(compObj->ice_timeout(20) < compObj->ice_timeout(10))); - Ice::LocatorPrx loc1 = Ice::LocatorPrx::uncheckedCast(communicator->stringToProxy("loc1:default -p 10000")); - Ice::LocatorPrx loc2 = Ice::LocatorPrx::uncheckedCast(communicator->stringToProxy("loc2:default -p 10000")); + Ice::LocatorPrxPtr loc1 = ICE_UNCHECKED_CAST(Ice::LocatorPrx, communicator->stringToProxy("loc1:default -p 10000")); + Ice::LocatorPrxPtr loc2 = ICE_UNCHECKED_CAST(Ice::LocatorPrx, communicator->stringToProxy("loc2:default -p 10000")); test(compObj->ice_locator(0) == compObj->ice_locator(0)); test(compObj->ice_locator(loc1) == compObj->ice_locator(loc1)); test(compObj->ice_locator(loc1) != compObj->ice_locator(0)); @@ -615,8 +799,8 @@ allTests(const Ice::CommunicatorPtr& communicator) 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")); + Ice::RouterPrxPtr rtr1 = ICE_UNCHECKED_CAST(Ice::RouterPrx, communicator->stringToProxy("rtr1:default -p 10000")); + Ice::RouterPrxPtr rtr2 = ICE_UNCHECKED_CAST(Ice::RouterPrx, communicator->stringToProxy("rtr2:default -p 10000")); test(compObj->ice_router(0) == compObj->ice_router(0)); test(compObj->ice_router(rtr1) == compObj->ice_router(rtr1)); test(compObj->ice_router(rtr1) != compObj->ice_router(0)); @@ -644,8 +828,8 @@ allTests(const Ice::CommunicatorPtr& communicator) 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"); + Ice::ObjectPrxPtr compObj1 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); + Ice::ObjectPrxPtr compObj2 = communicator->stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); test(compObj1 != compObj2); test(compObj1 < compObj2); test(!(compObj2 < compObj1)); @@ -691,23 +875,23 @@ allTests(const Ice::CommunicatorPtr& communicator) cout << "ok" << endl; cout << "testing checked cast... " << flush; - Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base); + Test::MyClassPrxPtr cl = ICE_CHECKED_CAST(Test::MyClassPrx, base); test(cl); - Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(cl); + Test::MyDerivedClassPrxPtr derived = ICE_CHECKED_CAST(Test::MyDerivedClassPrx, cl); test(derived); test(cl == base); test(derived == base); test(cl == derived); - Ice::LocatorPrx loc = Ice::LocatorPrx::checkedCast(base); + Ice::LocatorPrxPtr loc = ICE_CHECKED_CAST(Ice::LocatorPrx, base); test(loc == 0); // // Upcasting // - Test::MyClassPrx cl2 = Test::MyClassPrx::checkedCast(derived); - Ice::ObjectPrx obj = Ice::ObjectPrx::checkedCast(derived); + Test::MyClassPrxPtr cl2 = ICE_CHECKED_CAST(Test::MyClassPrx, derived); + Ice::ObjectPrxPtr obj = ICE_CHECKED_CAST(Ice::ObjectPrx, derived); test(cl2); test(obj); test(cl2 == obj); @@ -733,7 +917,7 @@ allTests(const Ice::CommunicatorPtr& communicator) test(obj); test(cl2 == obj); test(cl2 == derived); - +#endif cout << "ok" << endl; cout << "testing checked cast with context... " << flush; @@ -742,13 +926,18 @@ allTests(const Ice::CommunicatorPtr& communicator) c["one"] = "hello"; c["two"] = "world"; +#ifdef ICE_CPP11_MAPPING + cl = Ice::checkedCast<Test::MyClassPrx>(base, c); +#else cl = Test::MyClassPrx::checkedCast(base, c); +#endif Ice::Context c2 = cl->getContext(); test(c == c2); // // Now with alternate API // +#ifndef ICE_CPP11_MAPPING cl = checkedCast<Test::MyClassPrx>(base); c = cl->getContext(); test(c.size() == 0); @@ -756,12 +945,12 @@ allTests(const Ice::CommunicatorPtr& communicator) cl = checkedCast<Test::MyClassPrx>(base, c); c2 = cl->getContext(); test(c == c2); - +#endif cout << "ok" << endl; cout << "testing encoding versioning... " << flush; string ref20 = "test -e 2.0:default -p 12010"; - Test::MyClassPrx cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); + Test::MyClassPrxPtr cl20 = ICE_UNCHECKED_CAST(Test::MyClassPrx, communicator->stringToProxy(ref20)); try { cl20->ice_ping(); @@ -773,7 +962,7 @@ allTests(const Ice::CommunicatorPtr& communicator) } string ref10 = "test -e 1.0:default -p 12010"; - Test::MyClassPrx cl10 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref10)); + Test::MyClassPrxPtr cl10 = ICE_UNCHECKED_CAST(Test::MyClassPrx, communicator->stringToProxy(ref10)); cl10->ice_ping(); cl10->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); cl->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping(); @@ -781,10 +970,18 @@ allTests(const Ice::CommunicatorPtr& communicator) // 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"; - Test::MyClassPrx cl13 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref13)); + Test::MyClassPrxPtr cl13 = ICE_UNCHECKED_CAST(Test::MyClassPrx, communicator->stringToProxy(ref13)); cl13->ice_ping(); +#ifdef ICE_CPP11_MAPPING + cl13->ice_ping_async().get(); +#else cl13->end_ice_ping(cl13->begin_ice_ping()); +#endif +#ifndef ICE_CPP11_MAPPING + // + // TODO port this once the C++11 streaming API is done + // try { // Send request with bogus 1.2 encoding. @@ -826,13 +1023,14 @@ allTests(const Ice::CommunicatorPtr& communicator) // The server thrown an UnsupportedEncodingException test(ex.unknown.find("UnsupportedEncodingException") != string::npos); } +#endif cout << "ok" << endl; cout << "testing protocol versioning... " << flush; ref20 = "test -p 2.0:default -p 12010"; - cl20 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref20)); + cl20 = ICE_UNCHECKED_CAST(Test::MyClassPrx, communicator->stringToProxy(ref20)); try { cl20->ice_ping(); @@ -844,16 +1042,19 @@ allTests(const Ice::CommunicatorPtr& communicator) } ref10 = "test -p 1.0:default -p 12010"; - cl10 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref10)); + cl10 = ICE_UNCHECKED_CAST(Test::MyClassPrx, communicator->stringToProxy(ref10)); cl10->ice_ping(); // 1.3 isn't supported but since a 1.3 proxy supports 1.0, the // call will use the 1.0 encoding ref13 = "test -p 1.3:default -p 12010"; - cl13 = Test::MyClassPrx::uncheckedCast(communicator->stringToProxy(ref13)); + cl13 = ICE_UNCHECKED_CAST(Test::MyClassPrx, communicator->stringToProxy(ref13)); cl13->ice_ping(); +#ifdef ICE_CPP11_MAPPING + cl13->ice_ping_async().get(); +#else cl13->end_ice_ping(cl13->begin_ice_ping()); - +#endif cout << "ok" <<endl; cout << "testing opaque endpoints... " << flush; @@ -861,7 +1062,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Invalid -x option - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 99 -v abc -x abc"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t 99 -v abc -x abc"); test(false); } catch(const Ice::EndpointParseException&) @@ -871,7 +1072,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Missing -t and -v - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque"); test(false); } catch(const Ice::EndpointParseException&) @@ -881,7 +1082,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Repeated -t - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1 -t 1 -v abc"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t 1 -t 1 -v abc"); test(false); } catch(const Ice::EndpointParseException&) @@ -891,7 +1092,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Repeated -v - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1 -v abc -v abc"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t 1 -v abc -v abc"); test(false); } catch(const Ice::EndpointParseException&) @@ -901,7 +1102,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Missing -t - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -v abc"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -v abc"); test(false); } catch(const Ice::EndpointParseException&) @@ -911,7 +1112,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Missing -v - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t 1"); test(false); } catch(const Ice::EndpointParseException&) @@ -921,7 +1122,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Missing arg for -t - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t -v abc"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t -v abc"); test(false); } catch(const Ice::EndpointParseException&) @@ -931,7 +1132,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Missing arg for -v - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 1 -v"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t 1 -v"); test(false); } catch(const Ice::EndpointParseException&) @@ -941,7 +1142,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Not a number for -t - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t x -v abc"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t x -v abc"); test(false); } catch(const Ice::EndpointParseException&) @@ -951,7 +1152,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // < 0 for -t - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t -1 -v abc"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t -1 -v abc"); test(false); } catch(const Ice::EndpointParseException&) @@ -961,7 +1162,7 @@ allTests(const Ice::CommunicatorPtr& communicator) try { // Invalid char for -v - Ice::ObjectPrx p = communicator->stringToProxy("id:opaque -t 99 -v x?c"); + Ice::ObjectPrxPtr p = communicator->stringToProxy("id:opaque -t 99 -v x?c"); test(false); } catch(const Ice::EndpointParseException&) @@ -969,12 +1170,12 @@ allTests(const Ice::CommunicatorPtr& communicator) } // Legal TCP endpoint expressed as opaque endpoint - Ice::ObjectPrx p1 = communicator->stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + Ice::ObjectPrxPtr p1 = communicator->stringToProxy("test -e 1.1:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); string pstr = communicator->proxyToString(p1); test(pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); // Opaque endpoint encoded with 1.1 encoding. - Ice::ObjectPrx p2 = communicator->stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + Ice::ObjectPrxPtr p2 = communicator->stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); test(communicator->proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); if(communicator->getProperties()->getPropertyAsInt("Ice.IPv6") == 0 && @@ -1043,7 +1244,7 @@ allTests(const Ice::CommunicatorPtr& communicator) // sent over the wire and returned by the server without losing // the opaque endpoints. // - Ice::ObjectPrx p2 = derived->echo(p1); + Ice::ObjectPrxPtr p2 = derived->echo(p1); pstr = communicator->proxyToString(p2); if(ssl) { |