diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 8 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 2 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Oneways.cpp | 8 | ||||
-rw-r--r-- | cpp/test/Ice/operations/OnewaysAMI.cpp | 44 | ||||
-rw-r--r-- | cpp/test/Ice/operations/OnewaysNewAMI.cpp | 28 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Test.ice | 4 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMD.ice | 4 | ||||
-rwxr-xr-x | cpp/test/Ice/operations/TestAMDI.cpp | 42 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMDI.h | 48 | ||||
-rwxr-xr-x | cpp/test/Ice/operations/TestI.cpp | 40 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.h | 12 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Twoways.cpp | 4 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TwowaysAMI.cpp | 46 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TwowaysNewAMI.cpp | 330 |
14 files changed, 439 insertions, 181 deletions
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 28bcac92a3d..29a0fdda59b 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -154,7 +154,7 @@ IceProxy::Ice::Object::begin_ice_isA(const string& typeId, __checkAsyncTwowayOnly(ice_isA_name); try { - __result->__prepare(ice_isA_name, Normal, ctx); + __result->__prepare(ice_isA_name, Nonmutating, ctx); IceInternal::BasicStream* __os = __result->__getOs(); __os->write(typeId); __os->endWriteEncaps(); @@ -222,7 +222,7 @@ IceProxy::Ice::Object::begin_ice_ping(const Context* ctx, OutgoingAsyncPtr __result = new OutgoingAsync(this, ice_ping_name, del, cookie); try { - __result->__prepare(ice_ping_name, Normal, ctx); + __result->__prepare(ice_ping_name, Nonmutating, ctx); IceInternal::BasicStream* __os = __result->__getOs(); __os->endWriteEncaps(); __result->__send(true); @@ -297,7 +297,7 @@ IceProxy::Ice::Object::begin_ice_ids(const Context* ctx, __checkAsyncTwowayOnly(ice_ids_name); try { - __result->__prepare(ice_ids_name, Normal, ctx); + __result->__prepare(ice_ids_name, Nonmutating, ctx); IceInternal::BasicStream* __os = __result->__getOs(); __os->endWriteEncaps(); __result->__send(true); @@ -341,7 +341,7 @@ IceProxy::Ice::Object::begin_ice_id(const Context* ctx, __checkAsyncTwowayOnly(ice_id_name); try { - __result->__prepare(ice_id_name, Normal, ctx); + __result->__prepare(ice_id_name, Nonmutating, ctx); IceInternal::BasicStream* __os = __result->__getOs(); __os->endWriteEncaps(); __result->__send(true); diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 5c0bf6b3cbf..719c7424610 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -4017,7 +4017,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) << "_name, __cb);"; out << nl << "try"; out << sb; - out << nl << "__result.__prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->mode()) + out << nl << "__result.__prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->sendMode()) << ", __ctx, __explicitCtx);"; out << nl << "IceInternal.BasicStream __os = __result.__os();"; iter = 0; diff --git a/cpp/test/Ice/operations/Oneways.cpp b/cpp/test/Ice/operations/Oneways.cpp index 492889188ed..70916e8d9de 100644 --- a/cpp/test/Ice/operations/Oneways.cpp +++ b/cpp/test/Ice/operations/Oneways.cpp @@ -60,6 +60,14 @@ oneways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& proxy) } { + p->opIdempotent(); + } + + { + p->opNonmutating(); + } + + { Ice::Byte b; try diff --git a/cpp/test/Ice/operations/OnewaysAMI.cpp b/cpp/test/Ice/operations/OnewaysAMI.cpp index e2d4ab4e486..fa8b660544e 100644 --- a/cpp/test/Ice/operations/OnewaysAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysAMI.cpp @@ -72,6 +72,40 @@ public: typedef IceUtil::Handle<AMI_MyClass_onewayOpVoidI> AMI_MyClass_onewayOpVoidIPtr; +class AMI_MyClass_onewayOpIdempotentI : public Test::AMI_MyClass_opIdempotent, public CallbackBase +{ +public: + + virtual void ice_response() + { + called(); + } + + virtual void ice_exception(const ::Ice::Exception&) + { + test(false); + } +}; + +typedef IceUtil::Handle<AMI_MyClass_onewayOpIdempotentI> AMI_MyClass_onewayOpIdempotentIPtr; + +class AMI_MyClass_onewayOpNonmutatingI : public Test::AMI_MyClass_opNonmutating, public CallbackBase +{ +public: + + virtual void ice_response() + { + called(); + } + + virtual void ice_exception(const ::Ice::Exception&) + { + test(false); + } +}; + +typedef IceUtil::Handle<AMI_MyClass_onewayOpNonmutatingI> AMI_MyClass_onewayOpNonmutatingIPtr; + class AMI_MyClass_onewayOpVoidExI : public Test::AMI_MyClass_opVoid, public CallbackBase { public: @@ -123,6 +157,16 @@ onewaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& pro } { + AMI_MyClass_onewayOpIdempotentIPtr cb = new AMI_MyClass_onewayOpIdempotentI(); + p->opIdempotent_async(cb); + } + + { + AMI_MyClass_onewayOpNonmutatingIPtr cb = new AMI_MyClass_onewayOpNonmutatingI(); + p->opNonmutating_async(cb); + } + + { // Check that a call to a void operation raises NoEndpointException // in the ice_exception() callback instead of at the point of call. Test::MyClassPrx indirect = Test::MyClassPrx::uncheckedCast(p->ice_adapterId("dummy")); diff --git a/cpp/test/Ice/operations/OnewaysNewAMI.cpp b/cpp/test/Ice/operations/OnewaysNewAMI.cpp index 0bf91ef746c..85ea44d76b6 100644 --- a/cpp/test/Ice/operations/OnewaysNewAMI.cpp +++ b/cpp/test/Ice/operations/OnewaysNewAMI.cpp @@ -126,13 +126,27 @@ onewaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& } { - { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opVoidPtr callback = - Test::newCallback_MyClass_opVoid(cb, &Callback::noException, &Callback::sent); - p->begin_opVoid(callback); - cb->check(); - } + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opVoidPtr callback = + Test::newCallback_MyClass_opVoid(cb, &Callback::noException, &Callback::sent); + p->begin_opVoid(callback); + cb->check(); + } + + { + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opIdempotentPtr callback = + Test::newCallback_MyClass_opIdempotent(cb, &Callback::noException, &Callback::sent); + p->begin_opIdempotent(callback); + cb->check(); + } + + { + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opNonmutatingPtr callback = + Test::newCallback_MyClass_opNonmutating(cb, &Callback::noException, &Callback::sent); + p->begin_opNonmutating(callback); + cb->check(); } { diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice index 8e9c8615b36..8981414684f 100644 --- a/cpp/test/Ice/operations/Test.ice +++ b/cpp/test/Ice/operations/Test.ice @@ -168,6 +168,10 @@ exception SomeException {}; Ice::Context opContext(); void opDoubleMarshaling(double p1, DoubleS p2); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); }; ["ami"] class MyDerivedClass extends MyClass diff --git a/cpp/test/Ice/operations/TestAMD.ice b/cpp/test/Ice/operations/TestAMD.ice index ade4709e100..3003aa947b9 100644 --- a/cpp/test/Ice/operations/TestAMD.ice +++ b/cpp/test/Ice/operations/TestAMD.ice @@ -166,6 +166,10 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD; Ice::Context opContext(); void opDoubleMarshaling(double p1, DoubleS p2); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); }; ["ami", "amd"] class MyDerivedClass extends MyClass diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp index c80eb21c2ad..ae0ee6ab716 100755 --- a/cpp/test/Ice/operations/TestAMDI.cpp +++ b/cpp/test/Ice/operations/TestAMDI.cpp @@ -32,6 +32,34 @@ private: const Test::AMD_MyClass_opVoidPtr _cb; }; +bool +MyDerivedClassI::ice_isA(const std::string& id, const Ice::Current& current) const +{ + test(current.mode == Ice::Nonmutating); + return MyDerivedClass::ice_isA(id, current); +} + +void +MyDerivedClassI::ice_ping(const Ice::Current& current) const +{ + test(current.mode == Ice::Nonmutating); + MyDerivedClass::ice_ping(current); +} + +std::vector<std::string> +MyDerivedClassI::ice_ids(const Ice::Current& current) const +{ + test(current.mode == Ice::Nonmutating); + return MyDerivedClass::ice_ids(current); +} + +const std::string& +MyDerivedClassI::ice_id(const Ice::Current& current) const +{ + test(current.mode == Ice::Nonmutating); + return MyDerivedClass::ice_id(current); +} + void MyDerivedClassI::shutdown_async(const Test::AMD_MyClass_shutdownPtr& cb, const Ice::Current& current) { @@ -425,6 +453,20 @@ MyDerivedClassI::opDoubleMarshaling_async(const Test::AMD_MyClass_opDoubleMarsha } void +MyDerivedClassI::opIdempotent_async(const Test::AMD_MyClass_opIdempotentPtr& cb, const Ice::Current& current) +{ + test(current.mode == Ice::Idempotent); + cb->ice_response(); +} + +void +MyDerivedClassI::opNonmutating_async(const Test::AMD_MyClass_opNonmutatingPtr& cb, const Ice::Current& current) +{ + test(current.mode == Ice::Nonmutating); + cb->ice_response(); +} + +void MyDerivedClassI::opDerived_async(const Test::AMD_MyDerivedClass_opDerivedPtr& cb, const Ice::Current&) { cb->ice_response(); diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h index c47656ae9a5..7fdc7527085 100644 --- a/cpp/test/Ice/operations/TestAMDI.h +++ b/cpp/test/Ice/operations/TestAMDI.h @@ -17,6 +17,14 @@ class MyDerivedClassI : public Test::MyDerivedClass { public: + // + // Override the Object "pseudo" operations to verify the operation mode. + // + virtual bool ice_isA(const std::string&, const Ice::Current&) const; + virtual void ice_ping(const Ice::Current&) const; + virtual std::vector<std::string> ice_ids(const Ice::Current&) const; + virtual const std::string& ice_id(const Ice::Current&) const; + virtual void shutdown_async(const Test::AMD_MyClass_shutdownPtr&, const Ice::Current&); @@ -29,27 +37,27 @@ public: virtual void opByte_async(const Test::AMD_MyClass_opBytePtr&, Ice::Byte, Ice::Byte, const Ice::Current&); - + virtual void opBool_async(const Test::AMD_MyClass_opBoolPtr&, bool, bool, const Ice::Current&); - + virtual void opShortIntLong_async(const Test::AMD_MyClass_opShortIntLongPtr&, Ice::Short, Ice::Int, Ice::Long, const Ice::Current&); - + virtual void opFloatDouble_async(const Test::AMD_MyClass_opFloatDoublePtr&, Ice::Float, Ice::Double, const Ice::Current&); - + virtual void opString_async(const Test::AMD_MyClass_opStringPtr&, const std::string&, const std::string&, const Ice::Current&); - + virtual void opMyEnum_async(const Test::AMD_MyClass_opMyEnumPtr&, Test::MyEnum, const Ice::Current&); - + virtual void opMyClass_async(const Test::AMD_MyClass_opMyClassPtr&, const Test::MyClassPrx&, const Ice::Current&); @@ -61,39 +69,39 @@ public: virtual void opByteS_async(const Test::AMD_MyClass_opByteSPtr&, const Test::ByteS&, const Test::ByteS&, const Ice::Current&); - + virtual void opBoolS_async(const Test::AMD_MyClass_opBoolSPtr&, const Test::BoolS&, const Test::BoolS&, const Ice::Current&); - + virtual void opShortIntLongS_async(const Test::AMD_MyClass_opShortIntLongSPtr&, const Test::ShortS&, const Test::IntS&, const Test::LongS&, const Ice::Current&); - + virtual void opFloatDoubleS_async(const Test::AMD_MyClass_opFloatDoubleSPtr&, const Test::FloatS&, const Test::DoubleS&, const Ice::Current&); - + virtual void opStringS_async(const Test::AMD_MyClass_opStringSPtr&, const Test::StringS&, const Test::StringS&, const Ice::Current&); - + virtual void opByteSS_async(const Test::AMD_MyClass_opByteSSPtr&, const Test::ByteSS&, const Test::ByteSS&, const Ice::Current&); - + virtual void opBoolSS_async(const Test::AMD_MyClass_opBoolSSPtr&, const Test::BoolSS&, const Test::BoolSS&, const Ice::Current&); - + virtual void opShortIntLongSS_async(const Test::AMD_MyClass_opShortIntLongSSPtr&, const Test::ShortSS&, const Test::IntSS&, const Test::LongSS&, const Ice::Current&); - + virtual void opFloatDoubleSS_async(const Test::AMD_MyClass_opFloatDoubleSSPtr&, const Test::FloatSS&, const Test::DoubleSS&, const Ice::Current&); - + virtual void opStringSS_async(const Test::AMD_MyClass_opStringSSPtr&, const Test::StringSS&, const Test::StringSS&, const Ice::Current&); @@ -103,7 +111,7 @@ public: const Ice::Current&); virtual void opByteBoolD_async(const Test::AMD_MyClass_opByteBoolDPtr&, - const Test::ByteBoolD&, const Test::ByteBoolD&, + const Test::ByteBoolD&, const Test::ByteBoolD&, const Ice::Current&); virtual void opShortIntD_async(const Test::AMD_MyClass_opShortIntDPtr&, @@ -140,9 +148,15 @@ public: virtual void opDoubleMarshaling_async(const Test::AMD_MyClass_opDoubleMarshalingPtr&, Ice::Double, const Test::DoubleS&, const Ice::Current&); + virtual void opIdempotent_async(const Test::AMD_MyClass_opIdempotentPtr&, + const Ice::Current&); + + virtual void opNonmutating_async(const Test::AMD_MyClass_opNonmutatingPtr&, + const Ice::Current&); + virtual void opDerived_async(const Test::AMD_MyDerivedClass_opDerivedPtr&, const Ice::Current&); - + private: IceUtil::ThreadPtr _opVoidThread; diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index a1ac44a2b1b..84c8f3695d0 100755 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp @@ -14,6 +14,34 @@ #include <functional> #include <iterator> +bool +MyDerivedClassI::ice_isA(const std::string& id, const Ice::Current& current) const +{ + test(current.mode == Ice::Nonmutating); + return MyDerivedClass::ice_isA(id, current); +} + +void +MyDerivedClassI::ice_ping(const Ice::Current& current) const +{ + test(current.mode == Ice::Nonmutating); + MyDerivedClass::ice_ping(current); +} + +std::vector<std::string> +MyDerivedClassI::ice_ids(const Ice::Current& current) const +{ + test(current.mode == Ice::Nonmutating); + return MyDerivedClass::ice_ids(current); +} + +const std::string& +MyDerivedClassI::ice_id(const Ice::Current& current) const +{ + test(current.mode == Ice::Nonmutating); + return MyDerivedClass::ice_id(current); +} + void MyDerivedClassI::shutdown(const Ice::Current& current) { @@ -395,6 +423,18 @@ MyDerivedClassI::opDoubleMarshaling(Ice::Double p1, const Test::DoubleS& p2, con } void +MyDerivedClassI::opIdempotent(const Ice::Current& current) +{ + test(current.mode == Ice::Idempotent); +} + +void +MyDerivedClassI::opNonmutating(const Ice::Current& current) +{ + test(current.mode == Ice::Nonmutating); +} + +void MyDerivedClassI::opDerived(const Ice::Current&) { } diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h index 6561004e240..d23ab4c3975 100644 --- a/cpp/test/Ice/operations/TestI.h +++ b/cpp/test/Ice/operations/TestI.h @@ -16,6 +16,14 @@ class MyDerivedClassI : public Test::MyDerivedClass { public: + // + // Override the Object "pseudo" operations to verify the operation mode. + // + virtual bool ice_isA(const std::string&, const Ice::Current&) const; + virtual void ice_ping(const Ice::Current&) const; + virtual std::vector<std::string> ice_ids(const Ice::Current&) const; + virtual const std::string& ice_id(const Ice::Current&) const; + virtual void shutdown(const Ice::Current&); virtual void delay(Ice::Int, const Ice::Current&); @@ -162,6 +170,10 @@ public: virtual void opDoubleMarshaling(Ice::Double, const Test::DoubleS&, const Ice::Current&); + virtual void opIdempotent(const Ice::Current&); + + virtual void opNonmutating(const Ice::Current&); + virtual void opDerived(const Ice::Current&); }; diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 80b1b7b1469..1b1014afa4b 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -802,4 +802,8 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) Test::DoubleS ds(5, d); p->opDoubleMarshaling(d, ds); } + + p->opIdempotent(); + + p->opNonmutating(); } diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index da6c80c8049..b402553f36e 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -921,6 +921,40 @@ public: typedef IceUtil::Handle<AMI_MyClass_opDoubleMarshalingI> AMI_MyClass_opDoubleMarshalingIPtr; +class AMI_MyClass_opIdempotentI : public Test::AMI_MyClass_opIdempotent, public CallbackBase +{ +public: + + virtual void ice_response() + { + called(); + } + + virtual void ice_exception(const ::Ice::Exception&) + { + test(false); + } +}; + +typedef IceUtil::Handle<AMI_MyClass_opIdempotentI> AMI_MyClass_opIdempotentIPtr; + +class AMI_MyClass_opNonmutatingI : public Test::AMI_MyClass_opNonmutating, public CallbackBase +{ +public: + + virtual void ice_response() + { + called(); + } + + virtual void ice_exception(const ::Ice::Exception&) + { + test(false); + } +}; + +typedef IceUtil::Handle<AMI_MyClass_opNonmutatingI> AMI_MyClass_opNonmutatingIPtr; + } void @@ -1424,6 +1458,18 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) } { + AMI_MyClass_opIdempotentIPtr cb = new AMI_MyClass_opIdempotentI; + p->opIdempotent_async(cb); + cb->check(); + } + + { + AMI_MyClass_opNonmutatingIPtr cb = new AMI_MyClass_opNonmutatingI; + p->opNonmutating_async(cb); + cb->check(); + } + + { Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(p); test(derived); AMI_MyDerivedClass_opDerivedIPtr cb = new AMI_MyDerivedClass_opDerivedI; diff --git a/cpp/test/Ice/operations/TwowaysNewAMI.cpp b/cpp/test/Ice/operations/TwowaysNewAMI.cpp index 73c1edeba75..101a945fa1c 100644 --- a/cpp/test/Ice/operations/TwowaysNewAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysNewAMI.cpp @@ -38,7 +38,7 @@ public: } _called = false; } - + protected: void called() @@ -95,7 +95,7 @@ public: test(ids[2] == "::Test::MyDerivedClass"); called(); } - + void opVoid() { called(); @@ -157,9 +157,9 @@ public: test(c2->ice_getIdentity() == _communicator->stringToIdentity("noSuchIdentity")); test(r->ice_getIdentity() == _communicator->stringToIdentity("test")); - // + // // We can't do the callbacks below in connection serialization mode. - // + // if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize")) { r->opVoid(); @@ -184,9 +184,9 @@ public: test(so.e == Test::enum3); test(so.s.s == "a new string"); - // + // // We can't do the callbacks below in connection serialization mode. - // + // if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize")) { so.p->opVoid(); @@ -479,6 +479,16 @@ public: called(); } + void opIdempotent() + { + called(); + } + + void opNonmutating() + { + called(); + } + void opDerived() { called(); @@ -486,7 +496,7 @@ public: void exCB(const Ice::Exception& ex) { - test(false); + test(false); } private: @@ -501,7 +511,7 @@ void twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) { { - CallbackPtr cb = new Callback; + CallbackPtr cb = new Callback; Ice::Callback_Object_ice_pingPtr callback = Ice::newCallback_Object_ice_ping(cb, &Callback::ping, &Callback::exCB); @@ -510,25 +520,25 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& } { - CallbackPtr cb = new Callback; + CallbackPtr cb = new Callback; Ice::Callback_Object_ice_isAPtr callback = Ice::newCallback_Object_ice_isA(cb, &Callback::isA, &Callback::exCB); p->begin_ice_isA(Test::MyClass::ice_staticId(), callback); cb->check(); } - + { - CallbackPtr cb = new Callback; + CallbackPtr cb = new Callback; Ice::Callback_Object_ice_idPtr callback = Ice::newCallback_Object_ice_id(cb, &Callback::id, &Callback::exCB); p->begin_ice_id(callback); cb->check(); } - + { - CallbackPtr cb = new Callback; + CallbackPtr cb = new Callback; Ice::Callback_Object_ice_idsPtr callback = Ice::newCallback_Object_ice_ids(cb, &Callback::ids, &Callback::exCB); @@ -537,85 +547,85 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& } { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, &Callback::opVoid, &Callback::exCB); - p->begin_opVoid(callback); - cb->check(); + p->begin_opVoid(callback); + cb->check(); } - + { Ice::Double d = 1278312346.0 / 13.0; Test::DoubleS ds(5, d); CallbackPtr cb = new Callback; - Test::Callback_MyClass_opBytePtr callback = Test::newCallback_MyClass_opByte(cb, + Test::Callback_MyClass_opBytePtr callback = Test::newCallback_MyClass_opByte(cb, &Callback::opByte, &Callback::exCB); - p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback); - cb->check(); + p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f), callback); + cb->check(); } - + { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb, &Callback::opVoid, &Callback::exCB); - p->begin_opVoid(callback); - cb->check(); + p->begin_opVoid(callback); + cb->check(); } { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opBoolPtr callback = Test::newCallback_MyClass_opBool(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opBoolPtr callback = Test::newCallback_MyClass_opBool(cb, &Callback::opBool, &Callback::exCB); - p->begin_opBool(true, false, callback); - cb->check(); + p->begin_opBool(true, false, callback); + cb->check(); } { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opShortIntLongPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opShortIntLongPtr callback = Test::newCallback_MyClass_opShortIntLong(cb, &Callback::opShortIntLong, &Callback::exCB); - p->begin_opShortIntLong(10, 11, 12, callback); - cb->check(); + p->begin_opShortIntLong(10, 11, 12, callback); + cb->check(); } { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opFloatDoublePtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opFloatDoublePtr callback = Test::newCallback_MyClass_opFloatDouble(cb, &Callback::opFloatDouble, &Callback::exCB); - p->begin_opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), callback); - cb->check(); + p->begin_opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), callback); + cb->check(); } { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opStringPtr callback = Test::newCallback_MyClass_opString(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opStringPtr callback = Test::newCallback_MyClass_opString(cb, &Callback::opString, &Callback::exCB); - p->begin_opString("hello", "world", callback); - cb->check(); + p->begin_opString("hello", "world", callback); + cb->check(); } { - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opMyEnumPtr callback = Test::newCallback_MyClass_opMyEnum(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opMyEnumPtr callback = Test::newCallback_MyClass_opMyEnum(cb, &Callback::opMyEnum, &Callback::exCB); - p->begin_opMyEnum(Test::enum2, callback); - cb->check(); + p->begin_opMyEnum(Test::enum2, callback); + cb->check(); } { - CallbackPtr cb = new Callback(communicator); - Test::Callback_MyClass_opMyClassPtr callback = Test::newCallback_MyClass_opMyClass(cb, + CallbackPtr cb = new Callback(communicator); + Test::Callback_MyClass_opMyClassPtr callback = Test::newCallback_MyClass_opMyClass(cb, &Callback::opMyClass, &Callback::exCB); - p->begin_opMyClass(p, callback); - cb->check(); + p->begin_opMyClass(p, callback); + cb->check(); } { @@ -627,13 +637,13 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& si2.p = 0; si2.e = Test::enum2; si2.s.s = "def"; - - CallbackPtr cb = new Callback(communicator); - Test::Callback_MyClass_opStructPtr callback = Test::newCallback_MyClass_opStruct(cb, + + CallbackPtr cb = new Callback(communicator); + Test::Callback_MyClass_opStructPtr callback = Test::newCallback_MyClass_opStruct(cb, &Callback::opStruct, &Callback::exCB); - p->begin_opStruct(si1, si2, callback); - cb->check(); + p->begin_opStruct(si1, si2, callback); + cb->check(); } { @@ -650,12 +660,12 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& bsi2.push_back(Ice::Byte(0xf3)); bsi2.push_back(Ice::Byte(0xf4)); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opByteSPtr callback = Test::newCallback_MyClass_opByteS(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opByteSPtr callback = Test::newCallback_MyClass_opByteS(cb, &Callback::opByteS, &Callback::exCB); - p->begin_opByteS(bsi1, bsi2, callback); - cb->check(); + p->begin_opByteS(bsi1, bsi2, callback); + cb->check(); } { @@ -668,12 +678,12 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& bsi2.push_back(false); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opBoolSPtr callback = Test::newCallback_MyClass_opBoolS(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opBoolSPtr callback = Test::newCallback_MyClass_opBoolS(cb, &Callback::opBoolS, &Callback::exCB); - p->begin_opBoolS(bsi1, bsi2, callback); - cb->check(); + p->begin_opBoolS(bsi1, bsi2, callback); + cb->check(); } { @@ -694,11 +704,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& lsi.push_back(30); lsi.push_back(20); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opShortIntLongSPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opShortIntLongSPtr callback = Test::newCallback_MyClass_opShortIntLongS(cb, &Callback::opShortIntLongS, &Callback::exCB); - p->begin_opShortIntLongS(ssi, isi, lsi, callback); - cb->check(); + p->begin_opShortIntLongS(ssi, isi, lsi, callback); + cb->check(); } { @@ -712,11 +722,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& dsi.push_back(Ice::Double(1.2E10)); dsi.push_back(Ice::Double(1.3E10)); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opFloatDoubleSPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opFloatDoubleSPtr callback = Test::newCallback_MyClass_opFloatDoubleS(cb, &Callback::opFloatDoubleS, &Callback::exCB); - p->begin_opFloatDoubleS(fsi, dsi, callback); - cb->check(); + p->begin_opFloatDoubleS(fsi, dsi, callback); + cb->check(); } { @@ -729,12 +739,12 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& ssi2.push_back("xyz"); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opStringSPtr callback = Test::newCallback_MyClass_opStringS(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opStringSPtr callback = Test::newCallback_MyClass_opStringS(cb, &Callback::opStringS, &Callback::exCB); - p->begin_opStringS(ssi1, ssi2, callback); - cb->check(); + p->begin_opStringS(ssi1, ssi2, callback); + cb->check(); } { @@ -752,12 +762,12 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& bsi2[1].push_back(Ice::Byte(0xf2)); bsi2[1].push_back(Ice::Byte(0xf1)); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opByteSSPtr callback = Test::newCallback_MyClass_opByteSS(cb, + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opByteSSPtr callback = Test::newCallback_MyClass_opByteSS(cb, &Callback::opByteSS, &Callback::exCB); - p->begin_opByteSS(bsi1, bsi2, callback); - cb->check(); + p->begin_opByteSS(bsi1, bsi2, callback); + cb->check(); } { @@ -773,11 +783,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& dsi[0].push_back(Ice::Double(1.2E10)); dsi[0].push_back(Ice::Double(1.3E10)); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opFloatDoubleSSPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opFloatDoubleSSPtr callback = Test::newCallback_MyClass_opFloatDoubleSS(cb, &Callback::opFloatDoubleSS, &Callback::exCB); - p->begin_opFloatDoubleSS(fsi, dsi, callback); - cb->check(); + p->begin_opFloatDoubleSS(fsi, dsi, callback); + cb->check(); } { @@ -792,11 +802,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& ssi2[2].push_back("xyz"); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opStringSSPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opStringSSPtr callback = Test::newCallback_MyClass_opStringSS(cb, &Callback::opStringSS, &Callback::exCB); - p->begin_opStringSS(ssi1, ssi2, callback); - cb->check(); + p->begin_opStringSS(ssi1, ssi2, callback); + cb->check(); } { @@ -808,11 +818,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& di2[11] = false; di2[101] = true; - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opByteBoolDPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opByteBoolDPtr callback = Test::newCallback_MyClass_opByteBoolD(cb, &Callback::opByteBoolD, &Callback::exCB); - p->begin_opByteBoolD(di1, di2, callback); - cb->check(); + p->begin_opByteBoolD(di1, di2, callback); + cb->check(); } { @@ -824,11 +834,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& di2[111] = -100; di2[1101] = 0; - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opShortIntDPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opShortIntDPtr callback = Test::newCallback_MyClass_opShortIntD(cb, &Callback::opShortIntD, &Callback::exCB); - p->begin_opShortIntD(di1, di2, callback); - cb->check(); + p->begin_opShortIntD(di1, di2, callback); + cb->check(); } { @@ -840,11 +850,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& di2[999999120] = Ice::Float(-100.4); di2[999999130] = Ice::Float(0.5); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opLongFloatDPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opLongFloatDPtr callback = Test::newCallback_MyClass_opLongFloatD(cb, &Callback::opLongFloatD, &Callback::exCB); - p->begin_opLongFloatD(di1, di2, callback); - cb->check(); + p->begin_opLongFloatD(di1, di2, callback); + cb->check(); } { @@ -856,11 +866,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& di2["FOO"] = "abc -100.4"; di2["BAR"] = "abc 0.5"; - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opStringStringDPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opStringStringDPtr callback = Test::newCallback_MyClass_opStringStringD(cb, &Callback::opStringStringD, &Callback::exCB); - p->begin_opStringStringD(di1, di2, callback); - cb->check(); + p->begin_opStringStringD(di1, di2, callback); + cb->check(); } { @@ -872,11 +882,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& di2["qwerty"] = Test::enum3; di2["Hello!!"] = Test::enum2; - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opStringMyEnumDPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opStringMyEnumDPtr callback = Test::newCallback_MyClass_opStringMyEnumD(cb, &Callback::opStringMyEnumD, &Callback::exCB); - p->begin_opStringMyEnumD(di1, di2, callback); - cb->check(); + p->begin_opStringMyEnumD(di1, di2, callback); + cb->check(); } { @@ -893,11 +903,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& di2[s22] = Test::enum3; di2[s23] = Test::enum2; - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opMyStructMyEnumDPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opMyStructMyEnumDPtr callback = Test::newCallback_MyClass_opMyStructMyEnumD(cb, &Callback::opMyStructMyEnumD, &Callback::exCB); - p->begin_opMyStructMyEnumD(di1, di2, callback); - cb->check(); + p->begin_opMyStructMyEnumD(di1, di2, callback); + cb->check(); } { @@ -910,11 +920,11 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& { s.push_back(i); } - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opIntSPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opIntSPtr callback = Test::newCallback_MyClass_opIntS(cb, &Callback::opIntS, &Callback::exCB); - p->begin_opIntS(s, callback); - cb->check(); + p->begin_opIntS(s, callback); + cb->check(); } } @@ -925,42 +935,42 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& ctx["three"] = "THREE"; { test(p->ice_getContext().empty()); - Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); - test(c != ctx); + Ice::AsyncResultPtr r = p->begin_opContext(); + Ice::Context c = p->end_opContext(r); + test(c != ctx); } { test(p->ice_getContext().empty()); - Ice::AsyncResultPtr r = p->begin_opContext(ctx); - Ice::Context c = p->end_opContext(r); - test(c == ctx); + Ice::AsyncResultPtr r = p->begin_opContext(ctx); + Ice::Context c = p->end_opContext(r); + test(c == ctx); } Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); test(p2->ice_getContext() == ctx); { - Ice::AsyncResultPtr r = p2->begin_opContext(); - Ice::Context c = p2->end_opContext(r); - test(c == ctx); + Ice::AsyncResultPtr r = p2->begin_opContext(); + Ice::Context c = p2->end_opContext(r); + test(c == ctx); } { Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); - Ice::AsyncResultPtr r = p2->begin_opContext(ctx); - Ice::Context c = p2->end_opContext(r); - test(c == ctx); + Ice::AsyncResultPtr r = p2->begin_opContext(ctx); + Ice::Context c = p2->end_opContext(r); + test(c == ctx); } { // // Test implicit context propagation // - + string impls[] = {"Shared", "PerThread"}; for(int i = 0; i < 2; 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; @@ -971,47 +981,47 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast( ic->stringToProxy("test:default -p 12010")); - - + + ic->getImplicitContext()->setContext(ctx); test(ic->getImplicitContext()->getContext() == ctx); { Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); - test(c == ctx); + Ice::Context c = p->end_opContext(r); + test(c == ctx); } ic->getImplicitContext()->put("zero", "ZERO"); - + ctx = ic->getImplicitContext()->getContext(); { Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); - test(c == ctx); + Ice::Context c = p->end_opContext(r); + test(c == ctx); } - + 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()); { Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); - test(c == prxContext); + Ice::Context c = p->end_opContext(r); + test(c == prxContext); } ic->getImplicitContext()->setContext(ctx); { Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); - test(c == combined); + Ice::Context c = p->end_opContext(r); + test(c == combined); } ic->getImplicitContext()->setContext(Ice::Context()); @@ -1023,20 +1033,36 @@ twowaysNewAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& { Ice::Double d = 1278312346.0 / 13.0; Test::DoubleS ds(5, d); - CallbackPtr cb = new Callback; - Test::Callback_MyClass_opDoubleMarshalingPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opDoubleMarshalingPtr callback = Test::newCallback_MyClass_opDoubleMarshaling(cb, &Callback::opDoubleMarshaling, &Callback::exCB); - p->begin_opDoubleMarshaling(d, ds, callback); - cb->check(); + p->begin_opDoubleMarshaling(d, ds, callback); + cb->check(); + } + + { + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opIdempotentPtr callback = + Test::newCallback_MyClass_opIdempotent(cb, &Callback::opIdempotent, &Callback::exCB); + p->begin_opIdempotent(callback); + cb->check(); + } + + { + CallbackPtr cb = new Callback; + Test::Callback_MyClass_opNonmutatingPtr callback = + Test::newCallback_MyClass_opNonmutating(cb, &Callback::opNonmutating, &Callback::exCB); + p->begin_opNonmutating(callback); + cb->check(); } { Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(p); test(derived); - CallbackPtr cb = new Callback; - Test::Callback_MyDerivedClass_opDerivedPtr callback = + CallbackPtr cb = new Callback; + Test::Callback_MyDerivedClass_opDerivedPtr callback = Test::newCallback_MyDerivedClass_opDerived(cb, &Callback::opDerived, &Callback::exCB); - derived->begin_opDerived(callback); - cb->check(); + derived->begin_opDerived(callback); + cb->check(); } } |