diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-06-21 18:34:37 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-06-21 18:34:37 +0200 |
commit | ec78a48c45fece921fb3219a27a3e2b1ab87819d (patch) | |
tree | d0c1cc9d379fa5cb102277fb99a2dadc88ccfff6 /cpp/test/Ice/slicing/exceptions | |
parent | Windows UWP build instructions updates (diff) | |
download | ice-ec78a48c45fece921fb3219a27a3e2b1ab87819d.tar.bz2 ice-ec78a48c45fece921fb3219a27a3e2b1ab87819d.tar.xz ice-ec78a48c45fece921fb3219a27a3e2b1ab87819d.zip |
Fixed ICE-8132 - Ice/slicing/exceptions failure with UWP/SSL
Diffstat (limited to 'cpp/test/Ice/slicing/exceptions')
-rw-r--r-- | cpp/test/Ice/slicing/exceptions/AllTests.cpp | 225 | ||||
-rw-r--r-- | cpp/test/Ice/slicing/exceptions/TestAMDI.cpp | 40 | ||||
-rw-r--r-- | cpp/test/Ice/slicing/exceptions/TestI.cpp | 20 |
3 files changed, 149 insertions, 136 deletions
diff --git a/cpp/test/Ice/slicing/exceptions/AllTests.cpp b/cpp/test/Ice/slicing/exceptions/AllTests.cpp index bb799e9148b..abc1692e45c 100644 --- a/cpp/test/Ice/slicing/exceptions/AllTests.cpp +++ b/cpp/test/Ice/slicing/exceptions/AllTests.cpp @@ -1039,123 +1039,124 @@ allTests(const Ice::CommunicatorPtr& communicator) } cout << "ok" << endl; - string defaultHost = communicator->getProperties()->getProperty("Ice.Default.Host"); - if(defaultHost == "127.0.0.1" || defaultHost == "::1") + cout << "preserved exceptions... " << flush; + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(""); + RelayPrxPtr relay = ICE_UNCHECKED_CAST(RelayPrx, adapter->addWithUUID(ICE_MAKE_SHARED(RelayI))); + adapter->activate(); + test->ice_getConnection()->setAdapter(adapter); + try { - cout << "preserved exceptions... " << flush; - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("Relay", "default"); - RelayPrxPtr relay = ICE_UNCHECKED_CAST(RelayPrx, adapter->addWithUUID(ICE_MAKE_SHARED(RelayI))); - adapter->activate(); - - try - { - test->relayKnownPreservedAsBase(relay); - test(false); - } - catch(const KnownPreservedDerived& ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(...) - { - test(false); - } - - try - { - test->relayKnownPreservedAsKnownPreserved(relay); - test(false); - } - catch(const KnownPreservedDerived& ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(...) - { - test(false); - } + test->relayKnownPreservedAsBase(relay); + test(false); + } + catch(const KnownPreservedDerived& ex) + { + test(ex.b == "base"); + test(ex.kp == "preserved"); + test(ex.kpd == "derived"); + } + catch(const Ice::OperationNotExistException&) + { + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + test(false); + } + catch(...) + { + test(false); + } - try - { - test->relayUnknownPreservedAsBase(relay); - test(false); - } - catch(const Preserved2& ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - test(ex.p1->ice_id() == PreservedClass::ice_staticId()); - PreservedClassPtr pc = ICE_DYNAMIC_CAST(PreservedClass, ex.p1); - test(pc->bc == "bc"); - test(pc->pc == "pc"); - test(ex.p2 == ex.p1); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(const KnownPreservedDerived& ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - test(test->ice_getEncodingVersion() == Ice::Encoding_1_0); - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(...) - { - test(false); - } + try + { + test->relayKnownPreservedAsKnownPreserved(relay); + test(false); + } + catch(const KnownPreservedDerived& ex) + { + test(ex.b == "base"); + test(ex.kp == "preserved"); + test(ex.kpd == "derived"); + } + catch(const Ice::OperationNotExistException&) + { + } + catch(...) + { + test(false); + } - try - { - test->relayUnknownPreservedAsKnownPreserved(relay); - test(false); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(const Preserved2& ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - test(ex.p1->ice_id() == PreservedClass::ice_staticId()); - PreservedClassPtr pc = ICE_DYNAMIC_CAST(PreservedClass, ex.p1); - test(pc->bc == "bc"); - test(pc->pc == "pc"); - test(ex.p2 == ex.p1); - } - catch(const KnownPreservedDerived& ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - test(test->ice_getEncodingVersion() == Ice::Encoding_1_0); - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(...) - { - test(false); - } + try + { + test->relayUnknownPreservedAsBase(relay); + test(false); + } + catch(const Preserved2& ex) + { + test(ex.b == "base"); + test(ex.kp == "preserved"); + test(ex.kpd == "derived"); + test(ex.p1->ice_id() == PreservedClass::ice_staticId()); + PreservedClassPtr pc = ICE_DYNAMIC_CAST(PreservedClass, ex.p1); + test(pc->bc == "bc"); + test(pc->pc == "pc"); + test(ex.p2 == ex.p1); + } + catch(const Ice::OperationNotExistException&) + { + } + catch(const KnownPreservedDerived& ex) + { + // + // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. + // + test(test->ice_getEncodingVersion() == Ice::Encoding_1_0); + test(ex.b == "base"); + test(ex.kp == "preserved"); + test(ex.kpd == "derived"); + } + catch(...) + { + test(false); + } - adapter->destroy(); - cout << "ok" << endl; + try + { + test->relayUnknownPreservedAsKnownPreserved(relay); + test(false); + } + catch(const Ice::OperationNotExistException&) + { } + catch(const Preserved2& ex) + { + test(ex.b == "base"); + test(ex.kp == "preserved"); + test(ex.kpd == "derived"); + test(ex.p1->ice_id() == PreservedClass::ice_staticId()); + PreservedClassPtr pc = ICE_DYNAMIC_CAST(PreservedClass, ex.p1); + test(pc->bc == "bc"); + test(pc->pc == "pc"); + test(ex.p2 == ex.p1); + } + catch(const KnownPreservedDerived& ex) + { + // + // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. + // + test(test->ice_getEncodingVersion() == Ice::Encoding_1_0); + test(ex.b == "base"); + test(ex.kp == "preserved"); + test(ex.kpd == "derived"); + } + catch(...) + { + test(false); + } + + adapter->destroy(); + cout << "ok" << endl; return test; } diff --git a/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp b/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp index d00a1bbf83c..c2297d2a60d 100644 --- a/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp +++ b/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp @@ -292,11 +292,12 @@ TestI::knownPreservedAsKnownPreservedAsync(function<void()>, function<void(excep void TestI::relayKnownPreservedAsBaseAsync(shared_ptr<RelayPrx> r, function<void()>, function<void(exception_ptr)> error, - const ::Ice::Current&) + const ::Ice::Current& c) { try { - r->knownPreservedAsBase(); + RelayPrxPtr p = Ice::uncheckedCast<RelayPrx>(c.con->createProxy(r->ice_getIdentity())); + p->knownPreservedAsBase(); test(false); } catch(...) @@ -308,11 +309,12 @@ TestI::relayKnownPreservedAsBaseAsync(shared_ptr<RelayPrx> r, void TestI::relayKnownPreservedAsKnownPreservedAsync(shared_ptr<RelayPrx> r, function<void()>, function<void(exception_ptr)> error, - const ::Ice::Current&) + const ::Ice::Current& c) { try { - r->knownPreservedAsKnownPreserved(); + RelayPrxPtr p = Ice::uncheckedCast<RelayPrx>(c.con->createProxy(r->ice_getIdentity())); + p->knownPreservedAsKnownPreserved(); test(false); } catch(...) @@ -363,11 +365,12 @@ TestI::unknownPreservedAsKnownPreservedAsync(function<void()>, function<void(exc void TestI::relayUnknownPreservedAsBaseAsync(shared_ptr<RelayPrx> r, function<void()>, function<void(exception_ptr)> error, - const ::Ice::Current&) + const ::Ice::Current& c) { try { - r->unknownPreservedAsBase(); + RelayPrxPtr p = Ice::uncheckedCast<RelayPrx>(c.con->createProxy(r->ice_getIdentity())); + p->unknownPreservedAsBase(); test(false); } catch(...) @@ -379,11 +382,12 @@ TestI::relayUnknownPreservedAsBaseAsync(shared_ptr<RelayPrx> r, void TestI::relayUnknownPreservedAsKnownPreservedAsync(shared_ptr<RelayPrx> r, function<void()>, function<void(exception_ptr)> error, - const ::Ice::Current&) + const ::Ice::Current& c) { try { - r->unknownPreservedAsKnownPreserved(); + RelayPrxPtr p = Ice::uncheckedCast<RelayPrx>(c.con->createProxy(r->ice_getIdentity())); + p->unknownPreservedAsKnownPreserved(); test(false); } catch(...) @@ -560,11 +564,12 @@ TestI::knownPreservedAsKnownPreserved_async(const AMD_TestIntf_knownPreservedAsK void TestI::relayKnownPreservedAsBase_async(const AMD_TestIntf_relayKnownPreservedAsBasePtr& cb, const RelayPrx& r, - const ::Ice::Current&) + const ::Ice::Current& c) { try { - r->knownPreservedAsBase(); + RelayPrxPtr p = RelayPrx::uncheckedCast(c.con->createProxy(r->ice_getIdentity())); + p->knownPreservedAsBase(); test(false); } catch(const Ice::Exception& ex) @@ -575,11 +580,12 @@ TestI::relayKnownPreservedAsBase_async(const AMD_TestIntf_relayKnownPreservedAsB void TestI::relayKnownPreservedAsKnownPreserved_async(const AMD_TestIntf_relayKnownPreservedAsKnownPreservedPtr& cb, - const RelayPrx& r, const ::Ice::Current&) + const RelayPrx& r, const ::Ice::Current& c) { try { - r->knownPreservedAsKnownPreserved(); + RelayPrxPtr p = RelayPrx::uncheckedCast(c.con->createProxy(r->ice_getIdentity())); + p->knownPreservedAsKnownPreserved(); test(false); } catch(const Ice::Exception& ex) @@ -615,11 +621,12 @@ TestI::unknownPreservedAsKnownPreserved_async(const AMD_TestIntf_unknownPreserve void TestI::relayUnknownPreservedAsBase_async(const AMD_TestIntf_relayUnknownPreservedAsBasePtr& cb, const RelayPrx& r, - const ::Ice::Current&) + const ::Ice::Current& c) { try { - r->unknownPreservedAsBase(); + RelayPrxPtr p = RelayPrx::uncheckedCast(c.con->createProxy(r->ice_getIdentity())); + p->unknownPreservedAsBase(); test(false); } catch(const Ice::Exception& ex) @@ -630,11 +637,12 @@ TestI::relayUnknownPreservedAsBase_async(const AMD_TestIntf_relayUnknownPreserve void TestI::relayUnknownPreservedAsKnownPreserved_async(const AMD_TestIntf_relayUnknownPreservedAsKnownPreservedPtr& cb, - const RelayPrx& r, const ::Ice::Current&) + const RelayPrx& r, const ::Ice::Current& c) { try { - r->unknownPreservedAsKnownPreserved(); + RelayPrxPtr p = RelayPrx::uncheckedCast(c.con->createProxy(r->ice_getIdentity())); + p->unknownPreservedAsKnownPreserved(); test(false); } catch(const Ice::Exception& ex) diff --git a/cpp/test/Ice/slicing/exceptions/TestI.cpp b/cpp/test/Ice/slicing/exceptions/TestI.cpp index 5004b7eb9f4..64773cf1d9d 100644 --- a/cpp/test/Ice/slicing/exceptions/TestI.cpp +++ b/cpp/test/Ice/slicing/exceptions/TestI.cpp @@ -171,16 +171,18 @@ TestI::knownPreservedAsKnownPreserved(const ::Ice::Current&) } void -TestI::relayKnownPreservedAsBase(ICE_IN(RelayPrxPtr) r, const ::Ice::Current&) +TestI::relayKnownPreservedAsBase(ICE_IN(RelayPrxPtr) r, const ::Ice::Current& c) { - r->knownPreservedAsBase(); + RelayPrxPtr p = ICE_UNCHECKED_CAST(RelayPrx, c.con->createProxy(r->ice_getIdentity())); + p->knownPreservedAsBase(); test(false); } void -TestI::relayKnownPreservedAsKnownPreserved(ICE_IN(RelayPrxPtr) r, const ::Ice::Current&) +TestI::relayKnownPreservedAsKnownPreserved(ICE_IN(RelayPrxPtr) r, const ::Ice::Current& c) { - r->knownPreservedAsKnownPreserved(); + RelayPrxPtr p = ICE_UNCHECKED_CAST(RelayPrx, c.con->createProxy(r->ice_getIdentity())); + p->knownPreservedAsKnownPreserved(); test(false); } @@ -209,16 +211,18 @@ TestI::unknownPreservedAsKnownPreserved(const ::Ice::Current&) } void -TestI::relayUnknownPreservedAsBase(ICE_IN(RelayPrxPtr) r, const ::Ice::Current&) +TestI::relayUnknownPreservedAsBase(ICE_IN(RelayPrxPtr) r, const ::Ice::Current& c) { - r->unknownPreservedAsBase(); + RelayPrxPtr p = ICE_UNCHECKED_CAST(RelayPrx, c.con->createProxy(r->ice_getIdentity())); + p->unknownPreservedAsBase(); test(false); } void -TestI::relayUnknownPreservedAsKnownPreserved(ICE_IN(RelayPrxPtr) r, const ::Ice::Current&) +TestI::relayUnknownPreservedAsKnownPreserved(ICE_IN(RelayPrxPtr) r, const ::Ice::Current& c) { - r->unknownPreservedAsKnownPreserved(); + RelayPrxPtr p = ICE_UNCHECKED_CAST(RelayPrx, c.con->createProxy(r->ice_getIdentity())); + p->unknownPreservedAsKnownPreserved(); test(false); } |