diff options
Diffstat (limited to 'cpp/test/Ice/operations/TwowaysAMI.cpp')
-rw-r--r-- | cpp/test/Ice/operations/TwowaysAMI.cpp | 1474 |
1 files changed, 737 insertions, 737 deletions
diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index 55cfdaf9841..37bdf2895b4 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -29,7 +29,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex> public: CallbackBase() : - _called(false) + _called(false) { } @@ -39,26 +39,26 @@ public: bool check() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - while(!_called) - { - if(!timedWait(IceUtil::Time::seconds(5))) - { - return false; - } - } - _called = false; - return true; + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + while(!_called) + { + if(!timedWait(IceUtil::Time::seconds(5))) + { + return false; + } + } + _called = false; + return true; } protected: void called() { - IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - assert(!_called); - _called = true; - notify(); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + assert(!_called); + _called = true; + notify(); } private: @@ -72,12 +72,12 @@ public: virtual void ice_response() { - called(); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -89,12 +89,12 @@ public: virtual void ice_response() { - test(false); + test(false); } virtual void ice_exception(const ::Ice::Exception& ex) { - test(dynamic_cast<const ::Ice::TwowayOnlyException*>(&ex)); + test(dynamic_cast<const ::Ice::TwowayOnlyException*>(&ex)); called(); } }; @@ -107,14 +107,14 @@ public: virtual void ice_response(::Ice::Byte r, ::Ice::Byte b) { - test(b == Ice::Byte(0xf0)); - test(r == Ice::Byte(0xff)); - called(); + test(b == Ice::Byte(0xf0)); + test(r == Ice::Byte(0xff)); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -126,12 +126,12 @@ public: virtual void ice_response(::Ice::Byte r, ::Ice::Byte b) { - test(false); + test(false); } virtual void ice_exception(const ::Ice::Exception& ex) { - test(dynamic_cast<const ::Ice::TwowayOnlyException*>(&ex)); + test(dynamic_cast<const ::Ice::TwowayOnlyException*>(&ex)); called(); } }; @@ -145,14 +145,14 @@ public: virtual void ice_response(bool r, bool b) { - test(b); - test(!r); - called(); + test(b); + test(!r); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -164,16 +164,16 @@ public: virtual void ice_response(::Ice::Long r, ::Ice::Short s, ::Ice::Int i, ::Ice::Long l) { - test(s == 10); - test(i == 11); - test(l == 12); - test(r == 12); - called(); + test(s == 10); + test(i == 11); + test(l == 12); + test(r == 12); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -185,15 +185,15 @@ public: virtual void ice_response(::Ice::Double r, ::Ice::Float f, ::Ice::Double d) { - test(f == Ice::Float(3.14)); - test(d == Ice::Double(1.1E10)); - test(r == Ice::Double(1.1E10)); - called(); + test(f == Ice::Float(3.14)); + test(d == Ice::Double(1.1E10)); + test(r == Ice::Double(1.1E10)); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -205,14 +205,14 @@ public: virtual void ice_response(const ::std::string& r, const ::std::string& s) { - test(s == "world hello"); - test(r == "hello world"); - called(); + test(s == "world hello"); + test(r == "hello world"); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -224,14 +224,14 @@ public: virtual void ice_response(::Test::MyEnum r, ::Test::MyEnum e) { - test(e == Test::enum2); - test(r == Test::enum3); - called(); + test(e == Test::enum2); + test(r == Test::enum3); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -248,29 +248,29 @@ public: virtual void ice_response(const ::Test::MyClassPrx& r, const ::Test::MyClassPrx& c1, const ::Test::MyClassPrx& c2) { - test(c1->ice_getIdentity() == _communicator->stringToIdentity("test")); - test(c2->ice_getIdentity() == _communicator->stringToIdentity("noSuchIdentity")); - test(r->ice_getIdentity() == _communicator->stringToIdentity("test")); - // We can't do the callbacks below in thread per connection mode. - if(!_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPerConnection")) - { - r->opVoid(); - c1->opVoid(); - try - { - c2->opVoid(); - test(false); - } - catch(const Ice::ObjectNotExistException&) - { - } - } - called(); + test(c1->ice_getIdentity() == _communicator->stringToIdentity("test")); + test(c2->ice_getIdentity() == _communicator->stringToIdentity("noSuchIdentity")); + test(r->ice_getIdentity() == _communicator->stringToIdentity("test")); + // We can't do the callbacks below in thread per connection mode. + if(!_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPerConnection")) + { + r->opVoid(); + c1->opVoid(); + try + { + c2->opVoid(); + test(false); + } + catch(const Ice::ObjectNotExistException&) + { + } + } + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } private: @@ -291,22 +291,22 @@ public: virtual void ice_response(const ::Test::Structure& rso, const ::Test::Structure& so) { - test(rso.p == 0); - test(rso.e == Test::enum2); - test(rso.s.s == "def"); - test(so.e == Test::enum3); - test(so.s.s == "a new string"); - // We can't do the callbacks below in thread per connection mode. - if(!_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPerConnection")) - { - so.p->opVoid(); - } - called(); + test(rso.p == 0); + test(rso.e == Test::enum2); + test(rso.s.s == "def"); + test(so.e == Test::enum3); + test(so.s.s == "a new string"); + // We can't do the callbacks below in thread per connection mode. + if(!_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPerConnection")) + { + so.p->opVoid(); + } + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } private: @@ -322,26 +322,26 @@ public: virtual void ice_response(const ::Test::ByteS& rso, const ::Test::ByteS& bso) { - test(bso.size() == 4); - test(bso[0] == Ice::Byte(0x22)); - test(bso[1] == Ice::Byte(0x12)); - test(bso[2] == Ice::Byte(0x11)); - test(bso[3] == Ice::Byte(0x01)); - test(rso.size() == 8); - test(rso[0] == Ice::Byte(0x01)); - test(rso[1] == Ice::Byte(0x11)); - test(rso[2] == Ice::Byte(0x12)); - test(rso[3] == Ice::Byte(0x22)); - test(rso[4] == Ice::Byte(0xf1)); - test(rso[5] == Ice::Byte(0xf2)); - test(rso[6] == Ice::Byte(0xf3)); - test(rso[7] == Ice::Byte(0xf4)); - called(); + test(bso.size() == 4); + test(bso[0] == Ice::Byte(0x22)); + test(bso[1] == Ice::Byte(0x12)); + test(bso[2] == Ice::Byte(0x11)); + test(bso[3] == Ice::Byte(0x01)); + test(rso.size() == 8); + test(rso[0] == Ice::Byte(0x01)); + test(rso[1] == Ice::Byte(0x11)); + test(rso[2] == Ice::Byte(0x12)); + test(rso[3] == Ice::Byte(0x22)); + test(rso[4] == Ice::Byte(0xf1)); + test(rso[5] == Ice::Byte(0xf2)); + test(rso[6] == Ice::Byte(0xf3)); + test(rso[7] == Ice::Byte(0xf4)); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -353,21 +353,21 @@ public: virtual void ice_response(const ::Test::BoolS& rso, const ::Test::BoolS& bso) { - test(bso.size() == 4); - test(bso[0]); - test(bso[1]); - test(!bso[2]); - test(!bso[3]); - test(rso.size() == 3); - test(!rso[0]); - test(rso[1]); - test(rso[2]); - called(); + test(bso.size() == 4); + test(bso[0]); + test(bso[1]); + test(!bso[2]); + test(!bso[3]); + test(rso.size() == 3); + test(!rso[0]); + test(rso[1]); + test(rso[2]); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -378,34 +378,34 @@ class AMI_MyClass_opShortIntLongSI : public Test::AMI_MyClass_opShortIntLongS, p public: virtual void ice_response(const ::Test::LongS& rso, const ::Test::ShortS& sso, const ::Test::IntS& iso, - const ::Test::LongS& lso) - { - test(sso.size() == 3); - test(sso[0] == 1); - test(sso[1] == 2); - test(sso[2] == 3); - test(iso.size() == 4); - test(iso[0] == 8); - test(iso[1] == 7); - test(iso[2] == 6); - test(iso[3] == 5); - test(lso.size() == 6); - test(lso[0] == 10); - test(lso[1] == 30); - test(lso[2] == 20); - test(lso[3] == 10); - test(lso[4] == 30); - test(lso[5] == 20); - test(rso.size() == 3); - test(rso[0] == 10); - test(rso[1] == 30); - test(rso[2] == 20); - called(); + const ::Test::LongS& lso) + { + test(sso.size() == 3); + test(sso[0] == 1); + test(sso[1] == 2); + test(sso[2] == 3); + test(iso.size() == 4); + test(iso[0] == 8); + test(iso[1] == 7); + test(iso[2] == 6); + test(iso[3] == 5); + test(lso.size() == 6); + test(lso[0] == 10); + test(lso[1] == 30); + test(lso[2] == 20); + test(lso[3] == 10); + test(lso[4] == 30); + test(lso[5] == 20); + test(rso.size() == 3); + test(rso[0] == 10); + test(rso[1] == 30); + test(rso[2] == 20); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -417,25 +417,25 @@ public: virtual void ice_response(const ::Test::DoubleS& rso, const ::Test::FloatS& fso, const ::Test::DoubleS& dso) { - test(fso.size() == 2); - test(fso[0] == ::Ice::Float(3.14)); - test(fso[1] == ::Ice::Float(1.11)); - test(dso.size() == 3); - test(dso[0] == ::Ice::Double(1.3E10)); - test(dso[1] == ::Ice::Double(1.2E10)); - test(dso[2] == ::Ice::Double(1.1E10)); - test(rso.size() == 5); - test(rso[0] == ::Ice::Double(1.1E10)); - test(rso[1] == ::Ice::Double(1.2E10)); - test(rso[2] == ::Ice::Double(1.3E10)); - test(::Ice::Float(rso[3]) == ::Ice::Float(3.14)); - test(::Ice::Float(rso[4]) == ::Ice::Float(1.11)); - called(); + test(fso.size() == 2); + test(fso[0] == ::Ice::Float(3.14)); + test(fso[1] == ::Ice::Float(1.11)); + test(dso.size() == 3); + test(dso[0] == ::Ice::Double(1.3E10)); + test(dso[1] == ::Ice::Double(1.2E10)); + test(dso[2] == ::Ice::Double(1.1E10)); + test(rso.size() == 5); + test(rso[0] == ::Ice::Double(1.1E10)); + test(rso[1] == ::Ice::Double(1.2E10)); + test(rso[2] == ::Ice::Double(1.3E10)); + test(::Ice::Float(rso[3]) == ::Ice::Float(3.14)); + test(::Ice::Float(rso[4]) == ::Ice::Float(1.11)); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -447,21 +447,21 @@ public: virtual void ice_response(const ::Test::StringS& rso, const ::Test::StringS& sso) { - test(sso.size() == 4); - test(sso[0] == "abc"); - test(sso[1] == "de"); - test(sso[2] == "fghi"); - test(sso[3] == "xyz"); - test(rso.size() == 3); - test(rso[0] == "fghi"); - test(rso[1] == "de"); - test(rso[2] == "abc"); - called(); + test(sso.size() == 4); + test(sso[0] == "abc"); + test(sso[1] == "de"); + test(sso[2] == "fghi"); + test(sso[3] == "xyz"); + test(rso.size() == 3); + test(rso[0] == "fghi"); + test(rso[1] == "de"); + test(rso[2] == "abc"); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -473,31 +473,31 @@ public: virtual void ice_response(const ::Test::ByteSS& rso, const ::Test::ByteSS& bso) { - test(bso.size() == 2); - test(bso[0].size() == 1); - test(bso[0][0] == Ice::Byte(0xff)); - test(bso[1].size() == 3); - test(bso[1][0] == Ice::Byte(0x01)); - test(bso[1][1] == Ice::Byte(0x11)); - test(bso[1][2] == Ice::Byte(0x12)); - test(rso.size() == 4); - test(rso[0].size() == 3); - test(rso[0][0] == Ice::Byte(0x01)); - test(rso[0][1] == Ice::Byte(0x11)); - test(rso[0][2] == Ice::Byte(0x12)); - test(rso[1].size() == 1); - test(rso[1][0] == Ice::Byte(0xff)); - test(rso[2].size() == 1); - test(rso[2][0] == Ice::Byte(0x0e)); - test(rso[3].size() == 2); - test(rso[3][0] == Ice::Byte(0xf2)); - test(rso[3][1] == Ice::Byte(0xf1)); - called(); + test(bso.size() == 2); + test(bso[0].size() == 1); + test(bso[0][0] == Ice::Byte(0xff)); + test(bso[1].size() == 3); + test(bso[1][0] == Ice::Byte(0x01)); + test(bso[1][1] == Ice::Byte(0x11)); + test(bso[1][2] == Ice::Byte(0x12)); + test(rso.size() == 4); + test(rso[0].size() == 3); + test(rso[0][0] == Ice::Byte(0x01)); + test(rso[0][1] == Ice::Byte(0x11)); + test(rso[0][2] == Ice::Byte(0x12)); + test(rso[1].size() == 1); + test(rso[1][0] == Ice::Byte(0xff)); + test(rso[2].size() == 1); + test(rso[2][0] == Ice::Byte(0x0e)); + test(rso[3].size() == 2); + test(rso[3][0] == Ice::Byte(0xf2)); + test(rso[3][1] == Ice::Byte(0xf1)); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -509,12 +509,12 @@ public: virtual void ice_response(const ::Test::BoolSS&, const ::Test::BoolSS& bso) { - called(); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -525,14 +525,14 @@ class AMI_MyClass_opShortIntLongSSI : public Test::AMI_MyClass_opShortIntLongSS, public: virtual void ice_response(const ::Test::LongSS&, const ::Test::ShortSS&, const ::Test::IntSS&, - const ::Test::LongSS&) + const ::Test::LongSS&) { - called(); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -544,32 +544,32 @@ public: virtual void ice_response(const ::Test::DoubleSS& rso, const ::Test::FloatSS& fso, const ::Test::DoubleSS& dso) { - test(fso.size() == 3); - test(fso[0].size() == 1); - test(fso[0][0] == ::Ice::Float(3.14)); - test(fso[1].size() == 1); - test(fso[1][0] == ::Ice::Float(1.11)); - test(fso[2].size() == 0); - test(dso.size() == 1); - test(dso[0].size() == 3); - test(dso[0][0] == ::Ice::Double(1.1E10)); - test(dso[0][1] == ::Ice::Double(1.2E10)); - test(dso[0][2] == ::Ice::Double(1.3E10)); - test(rso.size() == 2); - test(rso[0].size() == 3); - test(rso[0][0] == ::Ice::Double(1.1E10)); - test(rso[0][1] == ::Ice::Double(1.2E10)); - test(rso[0][2] == ::Ice::Double(1.3E10)); - test(rso[1].size() == 3); - test(rso[1][0] == ::Ice::Double(1.1E10)); - test(rso[1][1] == ::Ice::Double(1.2E10)); - test(rso[1][2] == ::Ice::Double(1.3E10)); - called(); + test(fso.size() == 3); + test(fso[0].size() == 1); + test(fso[0][0] == ::Ice::Float(3.14)); + test(fso[1].size() == 1); + test(fso[1][0] == ::Ice::Float(1.11)); + test(fso[2].size() == 0); + test(dso.size() == 1); + test(dso[0].size() == 3); + test(dso[0][0] == ::Ice::Double(1.1E10)); + test(dso[0][1] == ::Ice::Double(1.2E10)); + test(dso[0][2] == ::Ice::Double(1.3E10)); + test(rso.size() == 2); + test(rso[0].size() == 3); + test(rso[0][0] == ::Ice::Double(1.1E10)); + test(rso[0][1] == ::Ice::Double(1.2E10)); + test(rso[0][2] == ::Ice::Double(1.3E10)); + test(rso[1].size() == 3); + test(rso[1][0] == ::Ice::Double(1.1E10)); + test(rso[1][1] == ::Ice::Double(1.2E10)); + test(rso[1][2] == ::Ice::Double(1.3E10)); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -581,27 +581,27 @@ public: virtual void ice_response(const ::Test::StringSS& rso, const ::Test::StringSS& sso) { - test(sso.size() == 5); - test(sso[0].size() == 1); - test(sso[0][0] == "abc"); - test(sso[1].size() == 2); - test(sso[1][0] == "de"); - test(sso[1][1] == "fghi"); - test(sso[2].size() == 0); - test(sso[3].size() == 0); - test(sso[4].size() == 1); - test(sso[4][0] == "xyz"); - test(rso.size() == 3); - test(rso[0].size() == 1); - test(rso[0][0] == "xyz"); - test(rso[1].size() == 0); - test(rso[2].size() == 0); - called(); + test(sso.size() == 5); + test(sso[0].size() == 1); + test(sso[0][0] == "abc"); + test(sso[1].size() == 2); + test(sso[1][0] == "de"); + test(sso[1][1] == "fghi"); + test(sso[2].size() == 0); + test(sso[3].size() == 0); + test(sso[4].size() == 1); + test(sso[4][0] == "xyz"); + test(rso.size() == 3); + test(rso[0].size() == 1); + test(rso[0][0] == "xyz"); + test(rso[1].size() == 0); + test(rso[2].size() == 0); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -613,25 +613,25 @@ public: virtual void ice_response(const ::Test::ByteBoolD& ro, const ::Test::ByteBoolD& _do) { - Test::ByteBoolD di1; - di1[10] = true; - di1[100] = false; - test(_do == di1); - test(ro.size() == 4); - test(ro.find(10) != ro.end()); - test(ro.find(10)->second == true); - test(ro.find(11) != ro.end()); - test(ro.find(11)->second == false); - test(ro.find(100) != ro.end()); - test(ro.find(100)->second == false); - test(ro.find(101) != ro.end()); - test(ro.find(101)->second == true); - called(); + Test::ByteBoolD di1; + di1[10] = true; + di1[100] = false; + test(_do == di1); + test(ro.size() == 4); + test(ro.find(10) != ro.end()); + test(ro.find(10)->second == true); + test(ro.find(11) != ro.end()); + test(ro.find(11)->second == false); + test(ro.find(100) != ro.end()); + test(ro.find(100)->second == false); + test(ro.find(101) != ro.end()); + test(ro.find(101)->second == true); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -643,25 +643,25 @@ public: virtual void ice_response(const ::Test::ShortIntD& ro, const ::Test::ShortIntD& _do) { - Test::ShortIntD di1; - di1[110] = -1; - di1[1100] = 123123; - test(_do == di1); - test(ro.size() == 4); - test(ro.find(110) != ro.end()); - test(ro.find(110)->second == -1); - test(ro.find(111) != ro.end()); - test(ro.find(111)->second == -100); - test(ro.find(1100) != ro.end()); - test(ro.find(1100)->second == 123123); - test(ro.find(1101) != ro.end()); - test(ro.find(1101)->second == 0); - called(); + Test::ShortIntD di1; + di1[110] = -1; + di1[1100] = 123123; + test(_do == di1); + test(ro.size() == 4); + test(ro.find(110) != ro.end()); + test(ro.find(110)->second == -1); + test(ro.find(111) != ro.end()); + test(ro.find(111)->second == -100); + test(ro.find(1100) != ro.end()); + test(ro.find(1100)->second == 123123); + test(ro.find(1101) != ro.end()); + test(ro.find(1101)->second == 0); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -673,25 +673,25 @@ public: virtual void ice_response(const ::Test::LongFloatD& ro, const ::Test::LongFloatD& _do) { - Test::LongFloatD di1; - di1[999999110] = Ice::Float(-1.1); - di1[999999111] = Ice::Float(123123.2); - test(_do == di1); - test(ro.size() == 4); - test(ro.find(999999110) != ro.end()); - test(ro.find(999999110)->second == Ice::Float(-1.1)); - test(ro.find(999999120) != ro.end()); - test(ro.find(999999120)->second == Ice::Float(-100.4)); - test(ro.find(999999111) != ro.end()); - test(ro.find(999999111)->second == Ice::Float(123123.2)); - test(ro.find(999999130) != ro.end()); - test(ro.find(999999130)->second == Ice::Float(0.5)); - called(); + Test::LongFloatD di1; + di1[999999110] = Ice::Float(-1.1); + di1[999999111] = Ice::Float(123123.2); + test(_do == di1); + test(ro.size() == 4); + test(ro.find(999999110) != ro.end()); + test(ro.find(999999110)->second == Ice::Float(-1.1)); + test(ro.find(999999120) != ro.end()); + test(ro.find(999999120)->second == Ice::Float(-100.4)); + test(ro.find(999999111) != ro.end()); + test(ro.find(999999111)->second == Ice::Float(123123.2)); + test(ro.find(999999130) != ro.end()); + test(ro.find(999999130)->second == Ice::Float(0.5)); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -703,25 +703,25 @@ public: virtual void ice_response(const ::Test::StringStringD& ro, const ::Test::StringStringD& _do) { - Test::StringStringD di1; - di1["foo"] = "abc -1.1"; - di1["bar"] = "abc 123123.2"; - test(_do == di1); - test(ro.size() == 4); - test(ro.find("foo") != ro.end()); - test(ro.find("foo")->second == "abc -1.1"); - test(ro.find("FOO") != ro.end()); - test(ro.find("FOO")->second == "abc -100.4"); - test(ro.find("bar") != ro.end()); - test(ro.find("bar")->second == "abc 123123.2"); - test(ro.find("BAR") != ro.end()); - test(ro.find("BAR")->second == "abc 0.5"); - called(); + Test::StringStringD di1; + di1["foo"] = "abc -1.1"; + di1["bar"] = "abc 123123.2"; + test(_do == di1); + test(ro.size() == 4); + test(ro.find("foo") != ro.end()); + test(ro.find("foo")->second == "abc -1.1"); + test(ro.find("FOO") != ro.end()); + test(ro.find("FOO")->second == "abc -100.4"); + test(ro.find("bar") != ro.end()); + test(ro.find("bar")->second == "abc 123123.2"); + test(ro.find("BAR") != ro.end()); + test(ro.find("BAR")->second == "abc 0.5"); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -733,25 +733,25 @@ public: virtual void ice_response(const ::Test::StringMyEnumD& ro, const ::Test::StringMyEnumD& _do) { - Test::StringMyEnumD di1; - di1["abc"] = Test::enum1; - di1[""] = Test::enum2; - test(_do == di1); - test(ro.size() == 4); - test(ro.find("abc") != ro.end()); - test(ro.find("abc")->second == Test::enum1); - test(ro.find("qwerty") != ro.end()); - test(ro.find("qwerty")->second == Test::enum3); - test(ro.find("") != ro.end()); - test(ro.find("")->second == Test::enum2); - test(ro.find("Hello!!") != ro.end()); - test(ro.find("Hello!!")->second == Test::enum2); - called(); + Test::StringMyEnumD di1; + di1["abc"] = Test::enum1; + di1[""] = Test::enum2; + test(_do == di1); + test(ro.size() == 4); + test(ro.find("abc") != ro.end()); + test(ro.find("abc")->second == Test::enum1); + test(ro.find("qwerty") != ro.end()); + test(ro.find("qwerty")->second == Test::enum3); + test(ro.find("") != ro.end()); + test(ro.find("")->second == Test::enum2); + test(ro.find("Hello!!") != ro.end()); + test(ro.find("Hello!!")->second == Test::enum2); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -765,17 +765,17 @@ public: virtual void ice_response(const Test::IntS& r) { - test(r.size() == static_cast<size_t>(_l)); - for(int j = 0; j < _l; ++j) - { - test(r[j] == -j); - } - called(); + test(r.size() == static_cast<size_t>(_l)); + for(int j = 0; j < _l; ++j) + { + test(r[j] == -j); + } + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } private: @@ -795,13 +795,13 @@ public: virtual void ice_response(const Test::StringStringD& r) { - test(r == _d); - called(); + test(r == _d); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } private: @@ -821,13 +821,13 @@ public: virtual void ice_response(const Test::StringStringD& r) { - test(r != _d); - called(); + test(r != _d); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } private: @@ -843,12 +843,12 @@ public: virtual void ice_response() { - called(); + called(); } virtual void ice_exception(const ::Ice::Exception&) { - test(false); + test(false); } }; @@ -860,12 +860,12 @@ public: virtual void ice_response() { - called(); + called(); } virtual void ice_exception(const ::Ice::Exception& ex) { - test(false); + test(false); } }; @@ -876,541 +876,541 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) { { // Check that a call to a void operation raises TwowayOnlyException - // in the ice_exception() callback instead of at the point of call. - Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway()); - AMI_MyClass_opVoidExIPtr cb = new AMI_MyClass_opVoidExI; - try { - oneway->opVoid_async(cb); - } - catch(const Ice::Exception&) - { - test(false); - } - test(cb->check()); + // in the ice_exception() callback instead of at the point of call. + Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway()); + AMI_MyClass_opVoidExIPtr cb = new AMI_MyClass_opVoidExI; + try { + oneway->opVoid_async(cb); + } + catch(const Ice::Exception&) + { + test(false); + } + test(cb->check()); } { // Check that a call to a twoway operation raises TwowayOnlyException - // in the ice_exception() callback instead of at the point of call. - Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway()); - AMI_MyClass_opByteExIPtr cb = new AMI_MyClass_opByteExI; - try - { - oneway->opByte_async(cb, 0, 0); - } - catch(const Ice::Exception&) - { - test(false); - } - test(cb->check()); + // in the ice_exception() callback instead of at the point of call. + Test::MyClassPrx oneway = Test::MyClassPrx::uncheckedCast(p->ice_oneway()); + AMI_MyClass_opByteExIPtr cb = new AMI_MyClass_opByteExI; + try + { + oneway->opByte_async(cb, 0, 0); + } + catch(const Ice::Exception&) + { + test(false); + } + test(cb->check()); } { - AMI_MyClass_opVoidIPtr cb = new AMI_MyClass_opVoidI; - p->opVoid_async(cb); - test(cb->check()); - // Let's check if we can reuse the same callback object for another call. - p->opVoid_async(cb); - test(cb->check()); + AMI_MyClass_opVoidIPtr cb = new AMI_MyClass_opVoidI; + p->opVoid_async(cb); + test(cb->check()); + // Let's check if we can reuse the same callback object for another call. + p->opVoid_async(cb); + test(cb->check()); } { - AMI_MyClass_opByteIPtr cb = new AMI_MyClass_opByteI; - p->opByte_async(cb, Ice::Byte(0xff), Ice::Byte(0x0f)); - test(cb->check()); + AMI_MyClass_opByteIPtr cb = new AMI_MyClass_opByteI; + p->opByte_async(cb, Ice::Byte(0xff), Ice::Byte(0x0f)); + test(cb->check()); } { - AMI_MyClass_opBoolIPtr cb = new AMI_MyClass_opBoolI; - p->opBool_async(cb, true, false); - test(cb->check()); + AMI_MyClass_opBoolIPtr cb = new AMI_MyClass_opBoolI; + p->opBool_async(cb, true, false); + test(cb->check()); } { - AMI_MyClass_opShortIntLongIPtr cb = new AMI_MyClass_opShortIntLongI; - p->opShortIntLong_async(cb, 10, 11, 12); - test(cb->check()); + AMI_MyClass_opShortIntLongIPtr cb = new AMI_MyClass_opShortIntLongI; + p->opShortIntLong_async(cb, 10, 11, 12); + test(cb->check()); } { - AMI_MyClass_opFloatDoubleIPtr cb = new AMI_MyClass_opFloatDoubleI; - p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10)); - test(cb->check()); - // Let's check if we can reuse the same callback object for another call. - p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10)); - test(cb->check()); + AMI_MyClass_opFloatDoubleIPtr cb = new AMI_MyClass_opFloatDoubleI; + p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10)); + test(cb->check()); + // Let's check if we can reuse the same callback object for another call. + p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10)); + test(cb->check()); } { - AMI_MyClass_opStringIPtr cb = new AMI_MyClass_opStringI; - p->opString_async(cb, "hello", "world"); - test(cb->check()); + AMI_MyClass_opStringIPtr cb = new AMI_MyClass_opStringI; + p->opString_async(cb, "hello", "world"); + test(cb->check()); } { - AMI_MyClass_opMyEnumIPtr cb = new AMI_MyClass_opMyEnumI; - p->opMyEnum_async(cb, Test::enum2); - test(cb->check()); + AMI_MyClass_opMyEnumIPtr cb = new AMI_MyClass_opMyEnumI; + p->opMyEnum_async(cb, Test::enum2); + test(cb->check()); } { - AMI_MyClass_opMyClassIPtr cb = new AMI_MyClass_opMyClassI(communicator); - p->opMyClass_async(cb, p); - test(cb->check()); + AMI_MyClass_opMyClassIPtr cb = new AMI_MyClass_opMyClassI(communicator); + p->opMyClass_async(cb, p); + test(cb->check()); } { - Test::Structure si1; - si1.p = p; - si1.e = Test::enum3; - si1.s.s = "abc"; - Test::Structure si2; - si2.p = 0; - si2.e = Test::enum2; - si2.s.s = "def"; - - AMI_MyClass_opStructIPtr cb = new AMI_MyClass_opStructI(communicator); - p->opStruct_async(cb, si1, si2); - test(cb->check()); + Test::Structure si1; + si1.p = p; + si1.e = Test::enum3; + si1.s.s = "abc"; + Test::Structure si2; + si2.p = 0; + si2.e = Test::enum2; + si2.s.s = "def"; + + AMI_MyClass_opStructIPtr cb = new AMI_MyClass_opStructI(communicator); + p->opStruct_async(cb, si1, si2); + test(cb->check()); } { - Test::ByteS bsi1; - Test::ByteS bsi2; + Test::ByteS bsi1; + Test::ByteS bsi2; - bsi1.push_back(Ice::Byte(0x01)); - bsi1.push_back(Ice::Byte(0x11)); - bsi1.push_back(Ice::Byte(0x12)); - bsi1.push_back(Ice::Byte(0x22)); + bsi1.push_back(Ice::Byte(0x01)); + bsi1.push_back(Ice::Byte(0x11)); + bsi1.push_back(Ice::Byte(0x12)); + bsi1.push_back(Ice::Byte(0x22)); - bsi2.push_back(Ice::Byte(0xf1)); - bsi2.push_back(Ice::Byte(0xf2)); - bsi2.push_back(Ice::Byte(0xf3)); - bsi2.push_back(Ice::Byte(0xf4)); + bsi2.push_back(Ice::Byte(0xf1)); + bsi2.push_back(Ice::Byte(0xf2)); + bsi2.push_back(Ice::Byte(0xf3)); + bsi2.push_back(Ice::Byte(0xf4)); - AMI_MyClass_opByteSIPtr cb = new AMI_MyClass_opByteSI; - p->opByteS_async(cb, bsi1, bsi2); - test(cb->check()); + AMI_MyClass_opByteSIPtr cb = new AMI_MyClass_opByteSI; + p->opByteS_async(cb, bsi1, bsi2); + test(cb->check()); } { - Test::BoolS bsi1; - Test::BoolS bsi2; + Test::BoolS bsi1; + Test::BoolS bsi2; - bsi1.push_back(true); - bsi1.push_back(true); - bsi1.push_back(false); + bsi1.push_back(true); + bsi1.push_back(true); + bsi1.push_back(false); - bsi2.push_back(false); + bsi2.push_back(false); - AMI_MyClass_opBoolSIPtr cb = new AMI_MyClass_opBoolSI; - p->opBoolS_async(cb, bsi1, bsi2); - test(cb->check()); + AMI_MyClass_opBoolSIPtr cb = new AMI_MyClass_opBoolSI; + p->opBoolS_async(cb, bsi1, bsi2); + test(cb->check()); } { - Test::ShortS ssi; - Test::IntS isi; - Test::LongS lsi; + Test::ShortS ssi; + Test::IntS isi; + Test::LongS lsi; - ssi.push_back(1); - ssi.push_back(2); - ssi.push_back(3); + ssi.push_back(1); + ssi.push_back(2); + ssi.push_back(3); - isi.push_back(5); - isi.push_back(6); - isi.push_back(7); - isi.push_back(8); + isi.push_back(5); + isi.push_back(6); + isi.push_back(7); + isi.push_back(8); - lsi.push_back(10); - lsi.push_back(30); - lsi.push_back(20); + lsi.push_back(10); + lsi.push_back(30); + lsi.push_back(20); - AMI_MyClass_opShortIntLongSIPtr cb = new AMI_MyClass_opShortIntLongSI; - p->opShortIntLongS_async(cb, ssi, isi, lsi); - test(cb->check()); + AMI_MyClass_opShortIntLongSIPtr cb = new AMI_MyClass_opShortIntLongSI; + p->opShortIntLongS_async(cb, ssi, isi, lsi); + test(cb->check()); } { - Test::FloatS fsi; - Test::DoubleS dsi; + Test::FloatS fsi; + Test::DoubleS dsi; - fsi.push_back(Ice::Float(3.14)); - fsi.push_back(Ice::Float(1.11)); + fsi.push_back(Ice::Float(3.14)); + fsi.push_back(Ice::Float(1.11)); - dsi.push_back(Ice::Double(1.1E10)); - dsi.push_back(Ice::Double(1.2E10)); - dsi.push_back(Ice::Double(1.3E10)); + dsi.push_back(Ice::Double(1.1E10)); + dsi.push_back(Ice::Double(1.2E10)); + dsi.push_back(Ice::Double(1.3E10)); - AMI_MyClass_opFloatDoubleSIPtr cb = new AMI_MyClass_opFloatDoubleSI; - p->opFloatDoubleS_async(cb, fsi, dsi); - test(cb->check()); + AMI_MyClass_opFloatDoubleSIPtr cb = new AMI_MyClass_opFloatDoubleSI; + p->opFloatDoubleS_async(cb, fsi, dsi); + test(cb->check()); } { - Test::StringS ssi1; - Test::StringS ssi2; + Test::StringS ssi1; + Test::StringS ssi2; - ssi1.push_back("abc"); - ssi1.push_back("de"); - ssi1.push_back("fghi"); + ssi1.push_back("abc"); + ssi1.push_back("de"); + ssi1.push_back("fghi"); - ssi2.push_back("xyz"); + ssi2.push_back("xyz"); - AMI_MyClass_opStringSIPtr cb = new AMI_MyClass_opStringSI; - p->opStringS_async(cb, ssi1, ssi2); - test(cb->check()); + AMI_MyClass_opStringSIPtr cb = new AMI_MyClass_opStringSI; + p->opStringS_async(cb, ssi1, ssi2); + test(cb->check()); } { - Test::ByteSS bsi1; - bsi1.resize(2); - Test::ByteSS bsi2; - bsi2.resize(2); + Test::ByteSS bsi1; + bsi1.resize(2); + Test::ByteSS bsi2; + bsi2.resize(2); - bsi1[0].push_back(Ice::Byte(0x01)); - bsi1[0].push_back(Ice::Byte(0x11)); - bsi1[0].push_back(Ice::Byte(0x12)); - bsi1[1].push_back(Ice::Byte(0xff)); + bsi1[0].push_back(Ice::Byte(0x01)); + bsi1[0].push_back(Ice::Byte(0x11)); + bsi1[0].push_back(Ice::Byte(0x12)); + bsi1[1].push_back(Ice::Byte(0xff)); - bsi2[0].push_back(Ice::Byte(0x0e)); - bsi2[1].push_back(Ice::Byte(0xf2)); - bsi2[1].push_back(Ice::Byte(0xf1)); + bsi2[0].push_back(Ice::Byte(0x0e)); + bsi2[1].push_back(Ice::Byte(0xf2)); + bsi2[1].push_back(Ice::Byte(0xf1)); - AMI_MyClass_opByteSSIPtr cb = new AMI_MyClass_opByteSSI; - p->opByteSS_async(cb, bsi1, bsi2); - test(cb->check()); + AMI_MyClass_opByteSSIPtr cb = new AMI_MyClass_opByteSSI; + p->opByteSS_async(cb, bsi1, bsi2); + test(cb->check()); } { - Test::FloatSS fsi; - fsi.resize(3); - Test::DoubleSS dsi; - dsi.resize(1); + Test::FloatSS fsi; + fsi.resize(3); + Test::DoubleSS dsi; + dsi.resize(1); - fsi[0].push_back(Ice::Float(3.14)); - fsi[1].push_back(Ice::Float(1.11)); + fsi[0].push_back(Ice::Float(3.14)); + fsi[1].push_back(Ice::Float(1.11)); - dsi[0].push_back(Ice::Double(1.1E10)); - dsi[0].push_back(Ice::Double(1.2E10)); - dsi[0].push_back(Ice::Double(1.3E10)); + dsi[0].push_back(Ice::Double(1.1E10)); + dsi[0].push_back(Ice::Double(1.2E10)); + dsi[0].push_back(Ice::Double(1.3E10)); - AMI_MyClass_opFloatDoubleSSIPtr cb = new AMI_MyClass_opFloatDoubleSSI; - p->opFloatDoubleSS_async(cb, fsi, dsi); - test(cb->check()); + AMI_MyClass_opFloatDoubleSSIPtr cb = new AMI_MyClass_opFloatDoubleSSI; + p->opFloatDoubleSS_async(cb, fsi, dsi); + test(cb->check()); } { - Test::StringSS ssi1; - ssi1.resize(2); - Test::StringSS ssi2; - ssi2.resize(3); + Test::StringSS ssi1; + ssi1.resize(2); + Test::StringSS ssi2; + ssi2.resize(3); - ssi1[0].push_back("abc"); - ssi1[1].push_back("de"); - ssi1[1].push_back("fghi"); + ssi1[0].push_back("abc"); + ssi1[1].push_back("de"); + ssi1[1].push_back("fghi"); - ssi2[2].push_back("xyz"); + ssi2[2].push_back("xyz"); - AMI_MyClass_opStringSSIPtr cb = new AMI_MyClass_opStringSSI; - p->opStringSS_async(cb, ssi1, ssi2); - test(cb->check()); + AMI_MyClass_opStringSSIPtr cb = new AMI_MyClass_opStringSSI; + p->opStringSS_async(cb, ssi1, ssi2); + test(cb->check()); } { - Test::ByteBoolD di1; - di1[10] = true; - di1[100] = false; - Test::ByteBoolD di2; - di2[10] = true; - di2[11] = false; - di2[101] = true; + Test::ByteBoolD di1; + di1[10] = true; + di1[100] = false; + Test::ByteBoolD di2; + di2[10] = true; + di2[11] = false; + di2[101] = true; - AMI_MyClass_opByteBoolDIPtr cb = new AMI_MyClass_opByteBoolDI; - p->opByteBoolD_async(cb, di1, di2); - test(cb->check()); + AMI_MyClass_opByteBoolDIPtr cb = new AMI_MyClass_opByteBoolDI; + p->opByteBoolD_async(cb, di1, di2); + test(cb->check()); } { - Test::ShortIntD di1; - di1[110] = -1; - di1[1100] = 123123; - Test::ShortIntD di2; - di2[110] = -1; - di2[111] = -100; - di2[1101] = 0; + Test::ShortIntD di1; + di1[110] = -1; + di1[1100] = 123123; + Test::ShortIntD di2; + di2[110] = -1; + di2[111] = -100; + di2[1101] = 0; - AMI_MyClass_opShortIntDIPtr cb = new AMI_MyClass_opShortIntDI; - p->opShortIntD_async(cb, di1, di2); - test(cb->check()); + AMI_MyClass_opShortIntDIPtr cb = new AMI_MyClass_opShortIntDI; + p->opShortIntD_async(cb, di1, di2); + test(cb->check()); } { - Test::LongFloatD di1; - di1[999999110] = Ice::Float(-1.1); - di1[999999111] = Ice::Float(123123.2); - Test::LongFloatD di2; - di2[999999110] = Ice::Float(-1.1); - di2[999999120] = Ice::Float(-100.4); - di2[999999130] = Ice::Float(0.5); + Test::LongFloatD di1; + di1[999999110] = Ice::Float(-1.1); + di1[999999111] = Ice::Float(123123.2); + Test::LongFloatD di2; + di2[999999110] = Ice::Float(-1.1); + di2[999999120] = Ice::Float(-100.4); + di2[999999130] = Ice::Float(0.5); - AMI_MyClass_opLongFloatDIPtr cb = new AMI_MyClass_opLongFloatDI; - p->opLongFloatD_async(cb, di1, di2); - test(cb->check()); + AMI_MyClass_opLongFloatDIPtr cb = new AMI_MyClass_opLongFloatDI; + p->opLongFloatD_async(cb, di1, di2); + test(cb->check()); } { - Test::StringStringD di1; - di1["foo"] = "abc -1.1"; - di1["bar"] = "abc 123123.2"; - Test::StringStringD di2; - di2["foo"] = "abc -1.1"; - di2["FOO"] = "abc -100.4"; - di2["BAR"] = "abc 0.5"; + Test::StringStringD di1; + di1["foo"] = "abc -1.1"; + di1["bar"] = "abc 123123.2"; + Test::StringStringD di2; + di2["foo"] = "abc -1.1"; + di2["FOO"] = "abc -100.4"; + di2["BAR"] = "abc 0.5"; - AMI_MyClass_opStringStringDIPtr cb = new AMI_MyClass_opStringStringDI; - p->opStringStringD_async(cb, di1, di2); - test(cb->check()); + AMI_MyClass_opStringStringDIPtr cb = new AMI_MyClass_opStringStringDI; + p->opStringStringD_async(cb, di1, di2); + test(cb->check()); } { - Test::StringMyEnumD di1; - di1["abc"] = Test::enum1; - di1[""] = Test::enum2; - Test::StringMyEnumD di2; - di2["abc"] = Test::enum1; - di2["qwerty"] = Test::enum3; - di2["Hello!!"] = Test::enum2; - - AMI_MyClass_opStringMyEnumDIPtr cb = new AMI_MyClass_opStringMyEnumDI; - p->opStringMyEnumD_async(cb, di1, di2); - test(cb->check()); - } + Test::StringMyEnumD di1; + di1["abc"] = Test::enum1; + di1[""] = Test::enum2; + Test::StringMyEnumD di2; + di2["abc"] = Test::enum1; + di2["qwerty"] = Test::enum3; + di2["Hello!!"] = Test::enum2; + + AMI_MyClass_opStringMyEnumDIPtr cb = new AMI_MyClass_opStringMyEnumDI; + p->opStringMyEnumD_async(cb, di1, di2); + test(cb->check()); + } { - const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - - for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) - { - Test::IntS s; - for(int i = 0; i < lengths[l]; ++i) - { - s.push_back(i); - } - AMI_MyClass_opIntSIPtr cb = new AMI_MyClass_opIntSI(lengths[l]); - p->opIntS_async(cb, s); - test(cb->check()); - } - } - - { - Test::StringStringD ctx; - ctx["one"] = "ONE"; - ctx["two"] = "TWO"; - ctx["three"] = "THREE"; - { - test(p->ice_getContext().empty()); - AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(ctx); - p->opContext_async(cb); - test(cb->check()); - } - { - test(p->ice_getContext().empty()); - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); - p->opContext_async(cb, ctx); - test(cb->check()); - } - Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); - test(p2->ice_getContext() == ctx); - { - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); - p2->opContext_async(cb); - test(cb->check()); - } - { - Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); - p2->opContext_async(cb, ctx); - test(cb->check()); - } - - { - // - // Test that default context is obtained correctly from communicator. - // + const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; + + for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) + { + Test::IntS s; + for(int i = 0; i < lengths[l]; ++i) + { + s.push_back(i); + } + AMI_MyClass_opIntSIPtr cb = new AMI_MyClass_opIntSI(lengths[l]); + p->opIntS_async(cb, s); + test(cb->check()); + } + } + + { + Test::StringStringD ctx; + ctx["one"] = "ONE"; + ctx["two"] = "TWO"; + ctx["three"] = "THREE"; + { + test(p->ice_getContext().empty()); + AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(ctx); + p->opContext_async(cb); + test(cb->check()); + } + { + test(p->ice_getContext().empty()); + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); + p->opContext_async(cb, ctx); + test(cb->check()); + } + Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); + test(p2->ice_getContext() == ctx); + { + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); + p2->opContext_async(cb); + test(cb->check()); + } + { + Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); + p2->opContext_async(cb, ctx); + test(cb->check()); + } + + { + // + // Test that default context is obtained correctly from communicator. + // /* DEPRECATED - Ice::Context dflt; - dflt["a"] = "b"; - communicator->setDefaultContext(dflt); - { - AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(dflt); - p->opContext_async(cb); - test(cb->check()); - } - - Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context())); - { - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(Ice::Context()); - p2->opContext_async(cb); - test(cb->check()); - } - - p2 = Test::MyClassPrx::uncheckedCast(p->ice_defaultContext()); - { - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(dflt); - p2->opContext_async(cb); - test(cb->check()); - } - - communicator->setDefaultContext(Ice::Context()); - { - AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(Ice::Context()); - p2->opContext_async(cb); - test(cb->check()); - } - - communicator->setDefaultContext(dflt); - Test::MyClassPrx c = Test::MyClassPrx::checkedCast( - communicator->stringToProxy("test:default -p 12010 -t 10000")); - { - Ice::Context tmp; - tmp["a"] = "b"; - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); - c->opContext_async(cb); - test(cb->check()); - } - - dflt["a"] = "c"; - Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt)); - { - Ice::Context tmp; - tmp["a"] = "c"; - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); - c2->opContext_async(cb); - test(cb->check()); - } - - dflt.clear(); - Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt)); - { - Ice::Context tmp; - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); - c3->opContext_async(cb); - test(cb->check()); - } - - Test::MyClassPrx c4 = Test::MyClassPrx::uncheckedCast(c2->ice_defaultContext()); - { - Ice::Context tmp; - tmp["a"] = "b"; - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); - c4->opContext_async(cb); - test(cb->check()); - } - - dflt["a"] = "d"; - communicator->setDefaultContext(dflt); - - Test::MyClassPrx c5 = Test::MyClassPrx::uncheckedCast(c->ice_defaultContext()); - { - Ice::Context tmp; - tmp["a"] = "d"; - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); - c5->opContext_async(cb); - test(cb->check()); - } - - communicator->setDefaultContext(Ice::Context()); + Ice::Context dflt; + dflt["a"] = "b"; + communicator->setDefaultContext(dflt); + { + AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(dflt); + p->opContext_async(cb); + test(cb->check()); + } + + Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context())); + { + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(Ice::Context()); + p2->opContext_async(cb); + test(cb->check()); + } + + p2 = Test::MyClassPrx::uncheckedCast(p->ice_defaultContext()); + { + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(dflt); + p2->opContext_async(cb); + test(cb->check()); + } + + communicator->setDefaultContext(Ice::Context()); + { + AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(Ice::Context()); + p2->opContext_async(cb); + test(cb->check()); + } + + communicator->setDefaultContext(dflt); + Test::MyClassPrx c = Test::MyClassPrx::checkedCast( + communicator->stringToProxy("test:default -p 12010 -t 10000")); + { + Ice::Context tmp; + tmp["a"] = "b"; + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); + c->opContext_async(cb); + test(cb->check()); + } + + dflt["a"] = "c"; + Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt)); + { + Ice::Context tmp; + tmp["a"] = "c"; + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); + c2->opContext_async(cb); + test(cb->check()); + } + + dflt.clear(); + Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt)); + { + Ice::Context tmp; + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); + c3->opContext_async(cb); + test(cb->check()); + } + + Test::MyClassPrx c4 = Test::MyClassPrx::uncheckedCast(c2->ice_defaultContext()); + { + Ice::Context tmp; + tmp["a"] = "b"; + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); + c4->opContext_async(cb); + test(cb->check()); + } + + dflt["a"] = "d"; + communicator->setDefaultContext(dflt); + + Test::MyClassPrx c5 = Test::MyClassPrx::uncheckedCast(c->ice_defaultContext()); + { + Ice::Context tmp; + tmp["a"] = "d"; + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); + c5->opContext_async(cb); + test(cb->check()); + } + + communicator->setDefaultContext(Ice::Context()); */ - } - - { - // - // Test implicit context propagation - // - - string impls[] = {"Shared", "SharedWithoutLocking", "PerThread"}; - for(int i = 0; i < 3; i++) - { - Ice::InitializationData initData; - initData.properties = communicator->getProperties()->clone(); - initData.properties->setProperty("Ice.ImplicitContext", impls[i]); - - Ice::CommunicatorPtr ic = Ice::initialize(initData); - - Ice::Context ctx; - ctx["one"] = "ONE"; - ctx["two"] = "TWO"; - ctx["three"] = "THREE"; - - - Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast( - ic->stringToProxy("test:default -p 12010 -t 10000")); - - - ic->getImplicitContext()->setContext(ctx); - test(ic->getImplicitContext()->getContext() == ctx); - { - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); - p->opContext_async(cb); - test(cb->check()); - } - - ic->getImplicitContext()->set("zero", "ZERO"); - test(ic->getImplicitContext()->get("zero") == "ZERO"); - test(ic->getImplicitContext()->getWithDefault("foobar", "foo") == "foo"); - - ctx = ic->getImplicitContext()->getContext(); - { - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); - p->opContext_async(cb); - test(cb->check()); - } - - Ice::Context prxContext; - prxContext["one"] = "UN"; - prxContext["four"] = "QUATRE"; - - Ice::Context combined = prxContext; - combined.insert(ctx.begin(), ctx.end()); - test(combined["one"] == "UN"); - - p = Test::MyClassPrx::uncheckedCast(p->ice_context(prxContext)); - - ic->getImplicitContext()->setContext(Ice::Context()); - { - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(prxContext); - p->opContext_async(cb); - test(cb->check()); - } - - ic->getImplicitContext()->setContext(ctx); - { - AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(combined); - p->opContext_async(cb); - test(cb->check()); - } - - ic->destroy(); - } - } + } + + { + // + // Test implicit context propagation + // + + string impls[] = {"Shared", "SharedWithoutLocking", "PerThread"}; + for(int i = 0; i < 3; i++) + { + Ice::InitializationData initData; + initData.properties = communicator->getProperties()->clone(); + initData.properties->setProperty("Ice.ImplicitContext", impls[i]); + + Ice::CommunicatorPtr ic = Ice::initialize(initData); + + Ice::Context ctx; + ctx["one"] = "ONE"; + ctx["two"] = "TWO"; + ctx["three"] = "THREE"; + + + Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast( + ic->stringToProxy("test:default -p 12010 -t 10000")); + + + ic->getImplicitContext()->setContext(ctx); + test(ic->getImplicitContext()->getContext() == ctx); + { + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); + p->opContext_async(cb); + test(cb->check()); + } + + ic->getImplicitContext()->set("zero", "ZERO"); + test(ic->getImplicitContext()->get("zero") == "ZERO"); + test(ic->getImplicitContext()->getWithDefault("foobar", "foo") == "foo"); + + ctx = ic->getImplicitContext()->getContext(); + { + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); + p->opContext_async(cb); + test(cb->check()); + } + + Ice::Context prxContext; + prxContext["one"] = "UN"; + prxContext["four"] = "QUATRE"; + + Ice::Context combined = prxContext; + combined.insert(ctx.begin(), ctx.end()); + test(combined["one"] == "UN"); + + p = Test::MyClassPrx::uncheckedCast(p->ice_context(prxContext)); + + ic->getImplicitContext()->setContext(Ice::Context()); + { + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(prxContext); + p->opContext_async(cb); + test(cb->check()); + } + + ic->getImplicitContext()->setContext(ctx); + { + AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(combined); + p->opContext_async(cb); + test(cb->check()); + } + + ic->destroy(); + } + } } { Ice::Double d = 1278312346.0 / 13.0; - Test::DoubleS ds(5, d); - AMI_MyClass_opDoubleMarshalingIPtr cb = new AMI_MyClass_opDoubleMarshalingI; - p->opDoubleMarshaling_async(cb, d, ds); - test(cb->check()); + Test::DoubleS ds(5, d); + AMI_MyClass_opDoubleMarshalingIPtr cb = new AMI_MyClass_opDoubleMarshalingI; + p->opDoubleMarshaling_async(cb, d, ds); + test(cb->check()); } { - Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(p); - test(derived); - AMI_MyDerivedClass_opDerivedIPtr cb = new AMI_MyDerivedClass_opDerivedI; - derived->opDerived_async(cb); - test(cb->check()); + Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(p); + test(derived); + AMI_MyDerivedClass_opDerivedIPtr cb = new AMI_MyDerivedClass_opDerivedI; + derived->opDerived_async(cb); + test(cb->check()); } } |