diff options
author | Mark Spruiell <mes@zeroc.com> | 2011-05-04 17:51:35 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2011-05-04 17:51:35 -0700 |
commit | 9afd50c19bceeb2be64bf0c7c6d7a0c2c126dde8 (patch) | |
tree | 44786ffd2f2bf17f6872f97ea109cb09243d9cf9 | |
parent | minor doc fixes for RHEL (diff) | |
download | ice-9afd50c19bceeb2be64bf0c7c6d7a0c2c126dde8.tar.bz2 ice-9afd50c19bceeb2be64bf0c7c6d7a0c2c126dde8.tar.xz ice-9afd50c19bceeb2be64bf0c7c6d7a0c2c126dde8.zip |
bug 4976 - inconsistent operation mode for pseudo ops
58 files changed, 1464 insertions, 220 deletions
@@ -27,7 +27,12 @@ Changes since version 3.4.1 General Changes =============== -- Fixed a bug where Ice would under certain circumstnances +- The operation mode sent over the wire for the Object operations + ice_ping, ice_isA, ice_ids, and ice_id should be Nonmutating, but + the language mappings were inconsistent in this respect. All + language mappings now send the correct mode. + +- Fixed a bug where under certain circumstances, Ice would indefinitely re-try to add a proxy to the Glacier2 routing table. - Improved queuing of Glacier2 requests to the client to not invoke 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(); } } diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs index e001cdd71b9..22b7f1fc6e4 100644 --- a/cs/src/Ice/Proxy.cs +++ b/cs/src/Ice/Proxy.cs @@ -892,7 +892,7 @@ namespace Ice try { - result__.prepare__(__ice_isA_name, OperationMode.Normal, context__, explicitContext__); + result__.prepare__(__ice_isA_name, OperationMode.Nonmutating, context__, explicitContext__); IceInternal.BasicStream os__ = result__.ostr__; os__.writeString(id); os__.endWriteEncaps(); @@ -1013,7 +1013,7 @@ namespace Ice try { - result__.prepare__(__ice_ping_name, OperationMode.Normal, context__, explicitContext__); + result__.prepare__(__ice_ping_name, OperationMode.Nonmutating, context__, explicitContext__); IceInternal.BasicStream os__ = result__.ostr__; os__.endWriteEncaps(); result__.send__(true); @@ -1142,7 +1142,7 @@ namespace Ice try { - result__.prepare__(__ice_ids_name, OperationMode.Normal, context__, explicitContext__); + result__.prepare__(__ice_ids_name, OperationMode.Nonmutating, context__, explicitContext__); IceInternal.BasicStream os__ = result__.ostr__; os__.endWriteEncaps(); result__.send__(true); @@ -1282,7 +1282,7 @@ namespace Ice try { - result__.prepare__(__ice_id_name, OperationMode.Normal, context__, explicitContext__); + result__.prepare__(__ice_id_name, OperationMode.Nonmutating, context__, explicitContext__); IceInternal.BasicStream os__ = result__.ostr__; os__.endWriteEncaps(); result__.send__(true); diff --git a/cs/test/Ice/operations/MyDerivedClassAMDI.cs b/cs/test/Ice/operations/MyDerivedClassAMDI.cs index 641acc18b45..85f9a560583 100644 --- a/cs/test/Ice/operations/MyDerivedClassAMDI.cs +++ b/cs/test/Ice/operations/MyDerivedClassAMDI.cs @@ -54,6 +54,34 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass private Thread _thread; } + // + // Override the Object "pseudo" operations to verify the operation mode. + // + + public override bool ice_isA(String id, Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return base.ice_isA(id, current); + } + + public override void ice_ping(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + base.ice_ping(current); + } + + public override string[] ice_ids(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return base.ice_ids(current); + } + + public override string ice_id(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return base.ice_id(current); + } + public override void shutdown_async(Test.AMD_MyClass_shutdown cb, Ice.Current current) { while(_opVoidThread != null) @@ -443,6 +471,18 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass cb.ice_response(p2, p3); } + public override void opIdempotent_async(Test.AMD_MyClass_opIdempotent cb, Ice.Current current) + { + test(current.mode == Ice.OperationMode.Idempotent); + cb.ice_response(); + } + + public override void opNonmutating_async(Test.AMD_MyClass_opNonmutating cb, Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + cb.ice_response(); + } + public override void opDerived_async(Test.AMD_MyDerivedClass_opDerived cb, Ice.Current current) { cb.ice_response(); diff --git a/cs/test/Ice/operations/MyDerivedClassAMDTieI.cs b/cs/test/Ice/operations/MyDerivedClassAMDTieI.cs index cebdae37354..e170034e3d2 100644 --- a/cs/test/Ice/operations/MyDerivedClassAMDTieI.cs +++ b/cs/test/Ice/operations/MyDerivedClassAMDTieI.cs @@ -448,6 +448,18 @@ public sealed class MyDerivedClassTieI : Test.MyDerivedClassOperations_ cb.ice_response(p2, p3); } + public void opIdempotent_async(Test.AMD_MyClass_opIdempotent cb, Ice.Current current) + { + test(current.mode == Ice.OperationMode.Idempotent); + cb.ice_response(); + } + + public void opNonmutating_async(Test.AMD_MyClass_opNonmutating cb, Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + cb.ice_response(); + } + public void opDerived_async(Test.AMD_MyDerivedClass_opDerived cb, Ice.Current current) { cb.ice_response(); diff --git a/cs/test/Ice/operations/MyDerivedClassI.cs b/cs/test/Ice/operations/MyDerivedClassI.cs index a96eb39c7c0..49dba4462c0 100644 --- a/cs/test/Ice/operations/MyDerivedClassI.cs +++ b/cs/test/Ice/operations/MyDerivedClassI.cs @@ -20,6 +20,34 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass } } + // + // Override the Object "pseudo" operations to verify the operation mode. + // + + public override bool ice_isA(String id, Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return base.ice_isA(id, current); + } + + public override void ice_ping(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + base.ice_ping(current); + } + + public override string[] ice_ids(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return base.ice_ids(current); + } + + public override string ice_id(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return base.ice_id(current); + } + public override void shutdown(Ice.Current current) { current.adapter.getCommunicator().shutdown(); @@ -407,6 +435,16 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass return p2; } + public override void opIdempotent(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Idempotent); + } + + public override void opNonmutating(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + } + public override void opDerived(Ice.Current current) { } diff --git a/cs/test/Ice/operations/MyDerivedClassTieI.cs b/cs/test/Ice/operations/MyDerivedClassTieI.cs index 4e305e70fa9..07ee7681964 100644 --- a/cs/test/Ice/operations/MyDerivedClassTieI.cs +++ b/cs/test/Ice/operations/MyDerivedClassTieI.cs @@ -413,6 +413,16 @@ public sealed class MyDerivedClassTieI : Test.MyDerivedClassOperations_ return p2; } + public void opIdempotent(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Idempotent); + } + + public void opNonmutating(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + } + public void opDerived(Ice.Current current) { } diff --git a/cs/test/Ice/operations/Oneways.cs b/cs/test/Ice/operations/Oneways.cs index 5c474785ed1..7518a80e3c4 100644 --- a/cs/test/Ice/operations/Oneways.cs +++ b/cs/test/Ice/operations/Oneways.cs @@ -22,10 +22,22 @@ class Oneways p = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); { + p.ice_ping(); + } + + { p.opVoid(); } { + p.opIdempotent(); + } + + { + p.opNonmutating(); + } + + { byte b; try { diff --git a/cs/test/Ice/operations/OnewaysAMI.cs b/cs/test/Ice/operations/OnewaysAMI.cs index 7552fb6e5aa..a3dc617a07a 100644 --- a/cs/test/Ice/operations/OnewaysAMI.cs +++ b/cs/test/Ice/operations/OnewaysAMI.cs @@ -67,6 +67,32 @@ class OnewaysAMI } } + private class AMI_MyClass_opIdempotentI : Test.AMI_MyClass_opIdempotent + { + public override void ice_response() + { + test(false); + } + + public override void ice_exception(Ice.Exception ex) + { + test(false); + } + } + + private class AMI_MyClass_opNonmutatingI : Test.AMI_MyClass_opNonmutating + { + public override void ice_response() + { + test(false); + } + + public override void ice_exception(Ice.Exception ex) + { + test(false); + } + } + private class AMI_MyClass_opVoidExI : Test.AMI_MyClass_opVoid { public override void ice_response() @@ -121,6 +147,16 @@ class OnewaysAMI } { + AMI_MyClass_opIdempotentI cb = new AMI_MyClass_opIdempotentI(); + p.opIdempotent_async(cb); + } + + { + AMI_MyClass_opNonmutatingI cb = new AMI_MyClass_opNonmutatingI(); + 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.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); diff --git a/cs/test/Ice/operations/OnewaysNewAMI.cs b/cs/test/Ice/operations/OnewaysNewAMI.cs index a16542e3d1e..ca6c35bf4b3 100644 --- a/cs/test/Ice/operations/OnewaysNewAMI.cs +++ b/cs/test/Ice/operations/OnewaysNewAMI.cs @@ -116,11 +116,21 @@ public class OnewaysNewAMI } { - { - Callback cb = new Callback(); - p.begin_opVoid().whenCompleted(cb.noException).whenSent((Ice.SentCallback)cb.sent); - cb.check(); - } + Callback cb = new Callback(); + p.begin_opVoid().whenCompleted(cb.noException).whenSent((Ice.SentCallback)cb.sent); + cb.check(); + } + + { + Callback cb = new Callback(); + p.begin_opIdempotent().whenCompleted(cb.noException).whenSent((Ice.SentCallback)cb.sent); + cb.check(); + } + + { + Callback cb = new Callback(); + p.begin_opNonmutating().whenCompleted(cb.noException).whenSent((Ice.SentCallback)cb.sent); + cb.check(); } { diff --git a/cs/test/Ice/operations/Test.ice b/cs/test/Ice/operations/Test.ice index d9245ac628b..70daa4ef4a6 100644 --- a/cs/test/Ice/operations/Test.ice +++ b/cs/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/cs/test/Ice/operations/TestAMD.ice b/cs/test/Ice/operations/TestAMD.ice index 84c482b0bc8..188ff18dbe0 100644 --- a/cs/test/Ice/operations/TestAMD.ice +++ b/cs/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/cs/test/Ice/operations/Twoways.cs b/cs/test/Ice/operations/Twoways.cs index 2450200fb40..73c0325b038 100644 --- a/cs/test/Ice/operations/Twoways.cs +++ b/cs/test/Ice/operations/Twoways.cs @@ -54,6 +54,20 @@ class Twoways internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p) { + p.ice_ping(); + + test(p.ice_isA(Test.MyClass.ice_staticId())); + + test(p.ice_id().Equals(Test.MyDerivedClass.ice_staticId())); + + { + string[] ids = p.ice_ids(); + test(ids.Length == 3); + test(ids[0].Equals("::Ice::Object")); + test(ids[1].Equals("::Test::MyClass")); + test(ids[2].Equals("::Test::MyDerivedClass")); + } + { p.opVoid(); } @@ -744,5 +758,13 @@ class Twoways ic.destroy(); } } + + { + p.opIdempotent(); + } + + { + p.opNonmutating(); + } } } diff --git a/cs/test/Ice/operations/TwowaysAMI.cs b/cs/test/Ice/operations/TwowaysAMI.cs index c68ecd37bdd..ddd46cfcf83 100644 --- a/cs/test/Ice/operations/TwowaysAMI.cs +++ b/cs/test/Ice/operations/TwowaysAMI.cs @@ -75,6 +75,46 @@ public class TwowaysAMI private Callback callback = new Callback(); } + private class AMI_MyClass_opIdempotentI : Test.AMI_MyClass_opIdempotent + { + public override void ice_response() + { + callback.called(); + } + + public override void ice_exception(Ice.Exception ex) + { + test(false); + } + + public virtual void check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + + private class AMI_MyClass_opNonmutatingI : Test.AMI_MyClass_opNonmutating + { + public override void ice_response() + { + callback.called(); + } + + public override void ice_exception(Ice.Exception ex) + { + test(false); + } + + public virtual void check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + private class AMI_MyClass_opVoidExI : Test.AMI_MyClass_opVoid { public override void ice_response() @@ -1486,6 +1526,18 @@ public class TwowaysAMI } { + AMI_MyClass_opIdempotentI cb = new AMI_MyClass_opIdempotentI(); + p.opIdempotent_async(cb); + cb.check(); + } + + { + AMI_MyClass_opNonmutatingI cb = new AMI_MyClass_opNonmutatingI(); + p.opNonmutating_async(cb); + cb.check(); + } + + { Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p); test(derived != null); AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI(); diff --git a/cs/test/Ice/operations/TwowaysNewAMI.cs b/cs/test/Ice/operations/TwowaysNewAMI.cs index 09ebd718a57..4df7ab75ca5 100644 --- a/cs/test/Ice/operations/TwowaysNewAMI.cs +++ b/cs/test/Ice/operations/TwowaysNewAMI.cs @@ -75,6 +75,29 @@ public class TwowaysNewAMI _d = d; } + public void ice_ping() + { + called(); + } + + public void ice_isA(bool r) + { + test(r); + called(); + } + + public void ice_ids(string[] ids) + { + test(ids.Length == 3); + called(); + } + + public void ice_id(string id) + { + test(id.Equals(Test.MyDerivedClass.ice_staticId())); + called(); + } + public void opVoid() { called(); @@ -492,6 +515,16 @@ public class TwowaysNewAMI called(); } + public void opIdempotent() + { + called(); + } + + public void opNonmutating() + { + called(); + } + public void opDerived() { called(); @@ -510,6 +543,50 @@ public class TwowaysNewAMI internal static void twowaysNewAMI(Ice.Communicator communicator, Test.MyClassPrx p) { { + Ice.AsyncResult r = p.begin_ice_ping(); + p.end_ice_ping(r); + } + + { + Callback cb = new Callback(); + p.begin_ice_ping().whenCompleted(cb.ice_ping, cb.exCB); + cb.check(); + } + + { + Ice.AsyncResult r = p.begin_ice_isA(Test.MyClass.ice_staticId()); + test(p.end_ice_isA(r)); + } + + { + Callback cb = new Callback(); + p.begin_ice_isA(Test.MyClass.ice_staticId()).whenCompleted(cb.ice_isA, cb.exCB); + cb.check(); + } + + { + Ice.AsyncResult r = p.begin_ice_ids(); + test(p.end_ice_ids(r).Length == 3); + } + + { + Callback cb = new Callback(); + p.begin_ice_ids().whenCompleted(cb.ice_ids, cb.exCB); + cb.check(); + } + + { + Ice.AsyncResult r = p.begin_ice_id(); + test(p.end_ice_id(r).Equals(Test.MyDerivedClass.ice_staticId())); + } + + { + Callback cb = new Callback(); + p.begin_ice_id().whenCompleted(cb.ice_id, cb.exCB); + cb.check(); + } + + { Ice.AsyncResult r = p.begin_opVoid(); p.end_opVoid(r); } @@ -948,6 +1025,28 @@ public class TwowaysNewAMI } { + Ice.AsyncResult r = p.begin_opIdempotent(); + p.end_opIdempotent(r); + } + + { + Callback cb = new Callback(); + p.begin_opIdempotent().whenCompleted(cb.opIdempotent, cb.exCB); + cb.check(); + } + + { + Ice.AsyncResult r = p.begin_opNonmutating(); + p.end_opNonmutating(r); + } + + { + Callback cb = new Callback(); + p.begin_opNonmutating().whenCompleted(cb.opNonmutating, cb.exCB); + cb.check(); + } + + { Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p); test(derived != null); Callback cb = new Callback(); diff --git a/java/test/Ice/operations/AMDMyDerivedClassI.java b/java/test/Ice/operations/AMDMyDerivedClassI.java index 3435c9482c2..1e9359d4bfb 100644 --- a/java/test/Ice/operations/AMDMyDerivedClassI.java +++ b/java/test/Ice/operations/AMDMyDerivedClassI.java @@ -22,11 +22,13 @@ import test.Ice.operations.AMD.Test.AMD_MyClass_opDoubleMarshaling; import test.Ice.operations.AMD.Test.AMD_MyClass_opFloatDouble; import test.Ice.operations.AMD.Test.AMD_MyClass_opFloatDoubleS; import test.Ice.operations.AMD.Test.AMD_MyClass_opFloatDoubleSS; +import test.Ice.operations.AMD.Test.AMD_MyClass_opIdempotent; import test.Ice.operations.AMD.Test.AMD_MyClass_opIntS; import test.Ice.operations.AMD.Test.AMD_MyClass_opLongFloatD; import test.Ice.operations.AMD.Test.AMD_MyClass_opMyClass; import test.Ice.operations.AMD.Test.AMD_MyClass_opMyEnum; import test.Ice.operations.AMD.Test.AMD_MyClass_opMyStructMyEnumD; +import test.Ice.operations.AMD.Test.AMD_MyClass_opNonmutating; import test.Ice.operations.AMD.Test.AMD_MyClass_opShortIntD; import test.Ice.operations.AMD.Test.AMD_MyClass_opShortIntLong; import test.Ice.operations.AMD.Test.AMD_MyClass_opShortIntLongS; @@ -78,6 +80,38 @@ public final class AMDMyDerivedClassI extends MyDerivedClass private AMD_MyClass_opVoid _cb; } + // + // Override the Object "pseudo" operations to verify the operation mode. + // + + public boolean + ice_isA(String id, Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return super.ice_isA(id, current); + } + + public void + ice_ping(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + super.ice_ping(current); + } + + public String[] + ice_ids(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return super.ice_ids(current); + } + + public String + ice_id(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return super.ice_id(current); + } + synchronized public void shutdown_async(AMD_MyClass_shutdown cb, Ice.Current current) @@ -510,6 +544,22 @@ public final class AMDMyDerivedClassI extends MyDerivedClass } public void + opIdempotent_async(AMD_MyClass_opIdempotent cb, + Ice.Current current) + { + test(current.mode == Ice.OperationMode.Idempotent); + cb.ice_response(); + } + + public void + opNonmutating_async(AMD_MyClass_opNonmutating cb, + Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + cb.ice_response(); + } + + public void opDerived_async(AMD_MyDerivedClass_opDerived cb, Ice.Current current) { diff --git a/java/test/Ice/operations/AMDTieMyDerivedClassI.java b/java/test/Ice/operations/AMDTieMyDerivedClassI.java index efb587a30be..15d1432debb 100644 --- a/java/test/Ice/operations/AMDTieMyDerivedClassI.java +++ b/java/test/Ice/operations/AMDTieMyDerivedClassI.java @@ -22,11 +22,13 @@ import test.Ice.operations.AMD.Test.AMD_MyClass_opDoubleMarshaling; import test.Ice.operations.AMD.Test.AMD_MyClass_opFloatDouble; import test.Ice.operations.AMD.Test.AMD_MyClass_opFloatDoubleS; import test.Ice.operations.AMD.Test.AMD_MyClass_opFloatDoubleSS; +import test.Ice.operations.AMD.Test.AMD_MyClass_opIdempotent; import test.Ice.operations.AMD.Test.AMD_MyClass_opIntS; import test.Ice.operations.AMD.Test.AMD_MyClass_opLongFloatD; import test.Ice.operations.AMD.Test.AMD_MyClass_opMyClass; import test.Ice.operations.AMD.Test.AMD_MyClass_opMyEnum; import test.Ice.operations.AMD.Test.AMD_MyClass_opMyStructMyEnumD; +import test.Ice.operations.AMD.Test.AMD_MyClass_opNonmutating; import test.Ice.operations.AMD.Test.AMD_MyClass_opShortIntD; import test.Ice.operations.AMD.Test.AMD_MyClass_opShortIntLong; import test.Ice.operations.AMD.Test.AMD_MyClass_opShortIntLongS; @@ -511,6 +513,22 @@ public final class AMDTieMyDerivedClassI implements _MyDerivedClassOperations } public void + opIdempotent_async(AMD_MyClass_opIdempotent cb, + Ice.Current current) + { + test(current.mode == Ice.OperationMode.Idempotent); + cb.ice_response(); + } + + public void + opNonmutating_async(AMD_MyClass_opNonmutating cb, + Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + cb.ice_response(); + } + + public void opDerived_async(AMD_MyDerivedClass_opDerived cb, Ice.Current current) { diff --git a/java/test/Ice/operations/MyDerivedClassI.java b/java/test/Ice/operations/MyDerivedClassI.java index 032dbdd62f0..8666bceeba5 100644 --- a/java/test/Ice/operations/MyDerivedClassI.java +++ b/java/test/Ice/operations/MyDerivedClassI.java @@ -54,6 +54,38 @@ public final class MyDerivedClassI extends MyDerivedClass } } + // + // Override the Object "pseudo" operations to verify the operation mode. + // + + public boolean + ice_isA(String id, Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return super.ice_isA(id, current); + } + + public void + ice_ping(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + super.ice_ping(current); + } + + public String[] + ice_ids(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return super.ice_ids(current); + } + + public String + ice_id(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + return super.ice_id(current); + } + public void shutdown(Ice.Current current) { @@ -456,6 +488,18 @@ public final class MyDerivedClassI extends MyDerivedClass } public void + opIdempotent(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Idempotent); + } + + public void + opNonmutating(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + } + + public void opDerived(Ice.Current current) { } diff --git a/java/test/Ice/operations/Oneways.java b/java/test/Ice/operations/Oneways.java index 313d3a7f2fa..5461bf767d1 100644 --- a/java/test/Ice/operations/Oneways.java +++ b/java/test/Ice/operations/Oneways.java @@ -30,10 +30,22 @@ class Oneways p = MyClassPrxHelper.uncheckedCast(p.ice_oneway()); { + p.ice_ping(); + } + + { p.opVoid(); } { + p.opIdempotent(); + } + + { + p.opNonmutating(); + } + + { Ice.ByteHolder b = new Ice.ByteHolder(); byte r; diff --git a/java/test/Ice/operations/OnewaysAMI.java b/java/test/Ice/operations/OnewaysAMI.java index 75c531f92e9..fd5c24fbe4e 100644 --- a/java/test/Ice/operations/OnewaysAMI.java +++ b/java/test/Ice/operations/OnewaysAMI.java @@ -10,6 +10,8 @@ package test.Ice.operations; import test.Ice.operations.Test.AMI_MyClass_opByte; +import test.Ice.operations.Test.AMI_MyClass_opIdempotent; +import test.Ice.operations.Test.AMI_MyClass_opNonmutating; import test.Ice.operations.Test.AMI_MyClass_opVoid; import test.Ice.operations.Test.MyClassPrx; import test.Ice.operations.Test.MyClassPrxHelper; @@ -75,6 +77,36 @@ class OnewaysAMI } } + private static class AMI_MyClass_opIdempotentI extends AMI_MyClass_opIdempotent + { + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + } + + private static class AMI_MyClass_opNonmutatingI extends AMI_MyClass_opNonmutating + { + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + } + private static class AMI_MyClass_opVoidExI extends AMI_MyClass_opVoid { public void @@ -137,6 +169,16 @@ class OnewaysAMI } { + AMI_MyClass_opIdempotentI cb = new AMI_MyClass_opIdempotentI(); + p.opIdempotent_async(cb); + } + + { + AMI_MyClass_opNonmutatingI cb = new AMI_MyClass_opNonmutatingI(); + 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. MyClassPrx indirect = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); diff --git a/java/test/Ice/operations/OnewaysNewAMI.java b/java/test/Ice/operations/OnewaysNewAMI.java index 7c69780e3c4..2f81d75f1fb 100644 --- a/java/test/Ice/operations/OnewaysNewAMI.java +++ b/java/test/Ice/operations/OnewaysNewAMI.java @@ -9,6 +9,8 @@ package test.Ice.operations; +import test.Ice.operations.Test.Callback_MyClass_opIdempotent; +import test.Ice.operations.Test.Callback_MyClass_opNonmutating; import test.Ice.operations.Test.Callback_MyClass_opVoid; import test.Ice.operations.Test.MyClass; import test.Ice.operations.Test.MyClassPrx; @@ -75,7 +77,7 @@ class OnewaysNewAMI void noException(Ice.LocalException ex) { test(false); - } + } } static void @@ -99,7 +101,7 @@ class OnewaysNewAMI { cb.noException(ex); } - + public void sent(boolean sentSynchronously) { @@ -158,7 +160,7 @@ class OnewaysNewAMI { cb.noException(ex); } - + public void sent(boolean sentSynchronously) { @@ -170,6 +172,58 @@ class OnewaysNewAMI } { + final Callback cb = new Callback(); + Callback_MyClass_opIdempotent callback = new Callback_MyClass_opIdempotent() + { + public void + response() + { + test(false); + } + + public void + exception(Ice.LocalException ex) + { + cb.noException(ex); + } + + public void + sent(boolean sentSynchronously) + { + cb.sent(sentSynchronously); + } + }; + p.begin_opIdempotent(callback); + cb.check(); + } + + { + final Callback cb = new Callback(); + Callback_MyClass_opNonmutating callback = new Callback_MyClass_opNonmutating() + { + public void + response() + { + test(false); + } + + public void + exception(Ice.LocalException ex) + { + cb.noException(ex); + } + + public void + sent(boolean sentSynchronously) + { + cb.sent(sentSynchronously); + } + }; + p.begin_opNonmutating(callback); + cb.check(); + } + + { try { p.begin_opByte((byte)0xff, (byte)0x0f); diff --git a/java/test/Ice/operations/Test.ice b/java/test/Ice/operations/Test.ice index 091a8ab5826..c50f705f7c4 100644 --- a/java/test/Ice/operations/Test.ice +++ b/java/test/Ice/operations/Test.ice @@ -167,6 +167,10 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD; Ice::Context opContext(); void opDoubleMarshaling(double p1, DoubleS p2); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); }; ["ami"] class MyDerivedClass extends MyClass diff --git a/java/test/Ice/operations/TestAMD.ice b/java/test/Ice/operations/TestAMD.ice index ebeb2aa161b..3700cd427f7 100644 --- a/java/test/Ice/operations/TestAMD.ice +++ b/java/test/Ice/operations/TestAMD.ice @@ -10,7 +10,7 @@ #ifndef TEST_AMD_ICE #define TEST_AMD_ICE -#include<Ice/Current.ice> +#include <Ice/Current.ice> [["java:package:test.Ice.operations.AMD"]] module Test @@ -164,9 +164,13 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD; void opByteSOneway(ByteS s); - StringStringD opContext(); + 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/java/test/Ice/operations/TieMyDerivedClassI.java b/java/test/Ice/operations/TieMyDerivedClassI.java index 6139d37839a..0b905dadeba 100644 --- a/java/test/Ice/operations/TieMyDerivedClassI.java +++ b/java/test/Ice/operations/TieMyDerivedClassI.java @@ -457,6 +457,18 @@ public final class TieMyDerivedClassI implements _MyDerivedClassOperations } public void + opIdempotent(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Idempotent); + } + + public void + opNonmutating(Ice.Current current) + { + test(current.mode == Ice.OperationMode.Nonmutating); + } + + public void opDerived(Ice.Current current) { } diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java index 27407c24dcb..5d51467248c 100644 --- a/java/test/Ice/operations/Twoways.java +++ b/java/test/Ice/operations/Twoways.java @@ -22,9 +22,11 @@ import test.Ice.operations.Test.FloatSSHolder; import test.Ice.operations.Test.IntSHolder; import test.Ice.operations.Test.LongFloatDHolder; import test.Ice.operations.Test.LongSHolder; +import test.Ice.operations.Test.MyClass; import test.Ice.operations.Test.MyClassPrx; import test.Ice.operations.Test.MyClassPrxHelper; import test.Ice.operations.Test.MyClassPrxHolder; +import test.Ice.operations.Test.MyDerivedClass; import test.Ice.operations.Test.MyEnum; import test.Ice.operations.Test.MyStruct; import test.Ice.operations.Test.MyEnumHolder; @@ -75,6 +77,21 @@ class Twoways twoways(test.Util.Application app, MyClassPrx p) { Ice.Communicator communicator = app.communicator(); + + p.ice_ping(); + + test(p.ice_isA(MyClass.ice_staticId())); + + test(p.ice_id().equals(MyDerivedClass.ice_staticId())); + + { + String[] ids = p.ice_ids(); + test(ids.length == 3); + test(ids[0].equals("::Ice::Object")); + test(ids[1].equals("::Test::MyClass")); + test(ids[2].equals("::Test::MyDerivedClass")); + } + { p.opVoid(); } @@ -796,5 +813,9 @@ class Twoways } p.opDoubleMarshaling(d, ds); } + + p.opIdempotent(); + + p.opNonmutating(); } } diff --git a/java/test/Ice/operations/TwowaysAMI.java b/java/test/Ice/operations/TwowaysAMI.java index e36729a3340..01322ce797d 100644 --- a/java/test/Ice/operations/TwowaysAMI.java +++ b/java/test/Ice/operations/TwowaysAMI.java @@ -20,10 +20,12 @@ import test.Ice.operations.Test.AMI_MyClass_opDoubleMarshaling; import test.Ice.operations.Test.AMI_MyClass_opFloatDouble; import test.Ice.operations.Test.AMI_MyClass_opFloatDoubleS; import test.Ice.operations.Test.AMI_MyClass_opFloatDoubleSS; +import test.Ice.operations.Test.AMI_MyClass_opIdempotent; import test.Ice.operations.Test.AMI_MyClass_opIntS; import test.Ice.operations.Test.AMI_MyClass_opLongFloatD; import test.Ice.operations.Test.AMI_MyClass_opMyClass; import test.Ice.operations.Test.AMI_MyClass_opMyEnum; +import test.Ice.operations.Test.AMI_MyClass_opNonmutating; import test.Ice.operations.Test.AMI_MyClass_opShortIntD; import test.Ice.operations.Test.AMI_MyClass_opShortIntLong; import test.Ice.operations.Test.AMI_MyClass_opShortIntLongS; @@ -1174,6 +1176,52 @@ class TwowaysAMI private Callback callback = new Callback(); } + private static class AMI_MyClass_opIdempotentI extends AMI_MyClass_opIdempotent + { + public void + ice_response() + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public void + check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + + private static class AMI_MyClass_opNonmutatingI extends AMI_MyClass_opNonmutating + { + public void + ice_response() + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public void + check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + static void twowaysAMI(test.Util.Application app, MyClassPrx p) { @@ -1683,6 +1731,18 @@ class TwowaysAMI } { + AMI_MyClass_opIdempotentI cb = new AMI_MyClass_opIdempotentI(); + p.opIdempotent_async(cb); + cb.check(); + } + + { + AMI_MyClass_opNonmutatingI cb = new AMI_MyClass_opNonmutatingI(); + p.opNonmutating_async(cb); + cb.check(); + } + + { MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(p); test(derived != null); AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI(); diff --git a/java/test/Ice/operations/TwowaysNewAMI.java b/java/test/Ice/operations/TwowaysNewAMI.java index 753115f4895..643e87cbfc7 100644 --- a/java/test/Ice/operations/TwowaysNewAMI.java +++ b/java/test/Ice/operations/TwowaysNewAMI.java @@ -21,10 +21,12 @@ import test.Ice.operations.Test.Callback_MyClass_opContext; import test.Ice.operations.Test.Callback_MyClass_opFloatDouble; import test.Ice.operations.Test.Callback_MyClass_opFloatDoubleS; import test.Ice.operations.Test.Callback_MyClass_opFloatDoubleSS; +import test.Ice.operations.Test.Callback_MyClass_opIdempotent; import test.Ice.operations.Test.Callback_MyClass_opIntS; import test.Ice.operations.Test.Callback_MyClass_opLongFloatD; import test.Ice.operations.Test.Callback_MyClass_opMyClass; import test.Ice.operations.Test.Callback_MyClass_opMyEnum; +import test.Ice.operations.Test.Callback_MyClass_opNonmutating; import test.Ice.operations.Test.Callback_MyClass_opShortIntD; import test.Ice.operations.Test.Callback_MyClass_opShortIntLong; import test.Ice.operations.Test.Callback_MyClass_opShortIntLongS; @@ -44,6 +46,7 @@ import test.Ice.operations.Test.AnotherStruct; import test.Ice.operations.Test.MyClass; import test.Ice.operations.Test.MyClassPrx; import test.Ice.operations.Test.MyClassPrxHelper; +import test.Ice.operations.Test.MyDerivedClass; import test.Ice.operations.Test.MyDerivedClassPrx; import test.Ice.operations.Test.MyDerivedClassPrxHelper; import test.Ice.operations.Test.MyEnum; @@ -144,7 +147,7 @@ class TwowaysNewAMI @Override public void response(String id) { - test(id.equals("::Test::MyDerivedClass")); + test(id.equals(MyDerivedClass.ice_staticId())); callback.called(); } @@ -1126,6 +1129,50 @@ class TwowaysNewAMI private Callback callback = new Callback(); } + private static class opIdempotentI extends Callback_MyClass_opIdempotent + { + @Override + public void response() + { + callback.called(); + } + + @Override + public void exception(Ice.LocalException ex) + { + test(false); + } + + public void check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + + private static class opNonmutatingI extends Callback_MyClass_opNonmutating + { + @Override + public void response() + { + callback.called(); + } + + @Override + public void exception(Ice.LocalException ex) + { + test(false); + } + + public void check() + { + callback.check(); + } + + private Callback callback = new Callback(); + } + static void twowaysNewAMI(test.Util.Application app, MyClassPrx p) { @@ -1139,7 +1186,7 @@ class TwowaysNewAMI { isAI cb = new isAI(); - p.begin_ice_isA("::Test::MyClass", cb); + p.begin_ice_isA(MyClass.ice_staticId(), cb); cb.check(); } @@ -1611,6 +1658,18 @@ class TwowaysNewAMI } { + opIdempotentI cb = new opIdempotentI(); + p.begin_opIdempotent(cb); + cb.check(); + } + + { + opNonmutatingI cb = new opNonmutatingI(); + p.begin_opNonmutating(cb); + cb.check(); + } + + { MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(p); test(derived != null); opDerivedI cb = new opDerivedI(); diff --git a/php/lib/Ice.php b/php/lib/Ice.php index 77ead5690d2..8c730bc59c3 100644 --- a/php/lib/Ice.php +++ b/php/lib/Ice.php @@ -111,10 +111,10 @@ require 'Ice/ObjectFactory.php'; require 'Ice/Process.php'; require 'Ice/Router.php'; -IcePHP_defineOperation($Ice__t_Object, 'ice_isA', 0, 0, array($IcePHP__t_string), null, $IcePHP__t_bool, null); -IcePHP_defineOperation($Ice__t_Object, 'ice_ping', 0, 0, null, null, null, null); -IcePHP_defineOperation($Ice__t_Object, 'ice_id', 0, 0, null, null, $IcePHP__t_string, null); -IcePHP_defineOperation($Ice__t_Object, 'ice_ids', 0, 0, null, null, $Ice__t_StringSeq, null); +IcePHP_defineOperation($Ice__t_Object, 'ice_isA', 2, 1, array($IcePHP__t_string), null, $IcePHP__t_bool, null); +IcePHP_defineOperation($Ice__t_Object, 'ice_ping', 2, 1, null, null, null, null); +IcePHP_defineOperation($Ice__t_Object, 'ice_id', 2, 1, null, null, $IcePHP__t_string, null); +IcePHP_defineOperation($Ice__t_Object, 'ice_ids', 2, 1, null, null, $Ice__t_StringSeq, null); // // Proxy comparison functions. diff --git a/php/lib/Ice_ns.php b/php/lib/Ice_ns.php index 3debec210b2..89ce09a917e 100644 --- a/php/lib/Ice_ns.php +++ b/php/lib/Ice_ns.php @@ -116,10 +116,10 @@ require 'Ice/ObjectFactory.php'; require 'Ice/Process.php'; require 'Ice/Router.php'; -IcePHP_defineOperation($Ice__t_Object, 'ice_isA', 0, 0, array($IcePHP__t_string), array(), $IcePHP__t_bool, null); -IcePHP_defineOperation($Ice__t_Object, 'ice_ping', 0, 0, null, null, null, null); -IcePHP_defineOperation($Ice__t_Object, 'ice_id', 0, 0, null, null, $IcePHP__t_string, null); -IcePHP_defineOperation($Ice__t_Object, 'ice_ids', 0, 0, null, null, $Ice__t_StringSeq, null); +IcePHP_defineOperation($Ice__t_Object, 'ice_isA', 2, 1, array($IcePHP__t_string), array(), $IcePHP__t_bool, null); +IcePHP_defineOperation($Ice__t_Object, 'ice_ping', 2, 1, null, null, null, null); +IcePHP_defineOperation($Ice__t_Object, 'ice_id', 2, 1, null, null, $IcePHP__t_string, null); +IcePHP_defineOperation($Ice__t_Object, 'ice_ids', 2, 1, null, null, $Ice__t_StringSeq, null); } namespace Ice diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php index 698f34921bc..5058d52e6e0 100644 --- a/php/test/Ice/operations/Client.php +++ b/php/test/Ice/operations/Client.php @@ -38,6 +38,22 @@ function twoways($communicator, $p) $enum3 = $NS ? constant("Test\\MyEnum::enum3") : constant("Test_MyEnum::enum3"); { + $p->ice_ping(); + } + + { + test($p->ice_isA("::Test::MyClass")); + } + + { + test(count($p->ice_ids()) == 3); + } + + { + test($p->ice_id() == "::Test::MyDerivedClass"); + } + + { $p->opVoid(); } @@ -441,6 +457,14 @@ function twoways($communicator, $p) } } } + + { + $p->opIdempotent(); + } + + { + $p->opNonmutating(); + } } function allTests($communicator) diff --git a/php/test/Ice/operations/Test.ice b/php/test/Ice/operations/Test.ice index 23dbb4b904f..0f3532dea83 100644 --- a/php/test/Ice/operations/Test.ice +++ b/php/test/Ice/operations/Test.ice @@ -147,6 +147,10 @@ dictionary<MyEnum, string> MyEnumStringD; // file dependencies. // StringStringD opContext(); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); }; ["ami"] class MyDerivedClass extends MyClass diff --git a/py/modules/IcePy/Operation.cpp b/py/modules/IcePy/Operation.cpp index 71a081e6e7c..c787f53c9e3 100644 --- a/py/modules/IcePy/Operation.cpp +++ b/py/modules/IcePy/Operation.cpp @@ -71,6 +71,7 @@ public: string dispatchName; bool sendsClasses; bool returnsClasses; + bool pseudoOp; private: @@ -1055,6 +1056,11 @@ IcePy::Operation::Operation(const char* n, PyObject* m, PyObject* sm, int amdFla { exceptions.push_back(getException(PyTuple_GET_ITEM(ex, i))); } + + // + // Does the operation name start with "ice_"? + // + pseudoOp = name.find("ice_") == 0; } void @@ -3695,7 +3701,13 @@ IcePy::TypedServantWrapper::ice_invoke_async(const Ice::AMD_Object_ice_invokePtr } } - __checkMode(op->mode, current.mode); + // + // See bug 4976. + // + if(!op->pseudoOp) + { + __checkMode(op->mode, current.mode); + } UpcallPtr up = new TypedUpcall(op, cb, current.adapter->getCommunicator()); up->dispatch(_servant, inParams, current); diff --git a/py/python/Ice.py b/py/python/Ice.py index b60dbba31e6..bfe2b58a988 100644 --- a/py/python/Ice.py +++ b/py/python/Ice.py @@ -81,7 +81,7 @@ Arguments: Returns: True if the target object supports the interface, or false otherwise. ''' - return id in self.ice_ids() + return id in self.ice_ids(current) def ice_ping(self, current=None): '''A reachability test for the target object.''' @@ -93,7 +93,7 @@ that are supported by the target object. Returns: A list of type ids. ''' - return [ self.ice_id() ] + return [ self.ice_id(current) ] def ice_id(self, current=None): '''Obtains the type id corresponding to the most-derived Slice diff --git a/py/test/Ice/operations/Oneways.py b/py/test/Ice/operations/Oneways.py index aa8a1e41efc..05a9b45c679 100644 --- a/py/test/Ice/operations/Oneways.py +++ b/py/test/Ice/operations/Oneways.py @@ -18,11 +18,26 @@ def oneways(communicator, p): p = Test.MyClassPrx.uncheckedCast(p.ice_oneway()) # + # ice_ping + # + p.ice_ping() + + # # opVoid # p.opVoid() # + # opIdempotent + # + p.opIdempotent() + + # + # opNonmutating + # + p.opNonmutating() + + # # opByte # try: diff --git a/py/test/Ice/operations/OnewaysAMI.py b/py/test/Ice/operations/OnewaysAMI.py index ceeb1d7c192..f29115a2f48 100644 --- a/py/test/Ice/operations/OnewaysAMI.py +++ b/py/test/Ice/operations/OnewaysAMI.py @@ -43,6 +43,26 @@ class AMI_MyClass_opVoidI(CallbackBase): def ice_exception(self, ex): test(False) +class AMI_MyClass_opIdempotentI(CallbackBase): + def __init__(self): + CallbackBase.__init__(self) + + def ice_response(self): + self.called() + + def ice_exception(self, ex): + test(False) + +class AMI_MyClass_opNonmutatingI(CallbackBase): + def __init__(self): + CallbackBase.__init__(self) + + def ice_response(self): + self.called() + + def ice_exception(self, ex): + test(False) + class AMI_MyClass_opVoidExI(CallbackBase): def __init__(self): CallbackBase.__init__(self) @@ -74,6 +94,12 @@ def onewaysAMI(communicator, p): # Let's check if we can reuse the same callback object for another call. p.opVoid_async(cb) + cb = AMI_MyClass_opIdempotentI() + p.opIdempotent_async(cb) + + cb = AMI_MyClass_opNonmutatingI() + 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. indirect = Test.MyClassPrx.uncheckedCast(p.ice_adapterId("dummy")) diff --git a/py/test/Ice/operations/OnewaysNewAMI.py b/py/test/Ice/operations/OnewaysNewAMI.py index 89c9672fae7..54cd0b918a4 100644 --- a/py/test/Ice/operations/OnewaysNewAMI.py +++ b/py/test/Ice/operations/OnewaysNewAMI.py @@ -70,6 +70,14 @@ def onewaysNewAMI(communicator, proxy): p.begin_opVoid(None, cb.noException, cb.sent) cb.check() + cb = Callback() + p.begin_opIdempotent(None, cb.noException, cb.sent) + cb.check() + + cb = Callback() + p.begin_opNonmutating(None, cb.noException, cb.sent) + cb.check() + try: p.begin_opByte(0xff, 0x0f) test(False) diff --git a/py/test/Ice/operations/ServerAMD.py b/py/test/Ice/operations/ServerAMD.py index ad430a75ed6..75c8dcebc9c 100755 --- a/py/test/Ice/operations/ServerAMD.py +++ b/py/test/Ice/operations/ServerAMD.py @@ -36,6 +36,22 @@ class MyDerivedClassI(Test.MyDerivedClass): self.opVoidThread = None self.opVoidThreadLock = threading.Lock() + def ice_isA(self, id, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + return Test.MyDerivedClass.ice_isA(self, id, current) + + def ice_ping(self, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + Test.MyDerivedClass.ice_ping(self, current) + + def ice_ids(self, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + return Test.MyDerivedClass.ice_ids(self, current) + + def ice_id(self, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + return Test.MyDerivedClass.ice_id(self, current) + def shutdown_async(self, cb, current=None): self.opVoidThreadLock.acquire() if self.opVoidThread: @@ -223,6 +239,14 @@ class MyDerivedClassI(Test.MyDerivedClass): def opContext_async(self, cb, current=None): cb.ice_response(current.ctx) + def opIdempotent_async(self, cb, current=None): + test(current.mode == Ice.OperationMode.Idempotent) + cb.ice_response() + + def opNonmutating_async(self, cb, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + cb.ice_response() + def opDerived_async(self, cb, current=None): cb.ice_response() diff --git a/py/test/Ice/operations/Test.ice b/py/test/Ice/operations/Test.ice index 936db9da713..9268458857e 100644 --- a/py/test/Ice/operations/Test.ice +++ b/py/test/Ice/operations/Test.ice @@ -164,6 +164,10 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD; Ice::Context opContext(); void opDoubleMarshaling(double p1, DoubleS p2); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); }; ["ami"] class MyDerivedClass extends MyClass diff --git a/py/test/Ice/operations/TestAMD.ice b/py/test/Ice/operations/TestAMD.ice index 9d90bec0cd8..c21a82381c8 100644 --- a/py/test/Ice/operations/TestAMD.ice +++ b/py/test/Ice/operations/TestAMD.ice @@ -162,6 +162,10 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD; StringStringD opContext(); void opDoubleMarshaling(double p1, DoubleS p2); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); }; ["ami", "amd"] class MyDerivedClass extends MyClass diff --git a/py/test/Ice/operations/TestI.py b/py/test/Ice/operations/TestI.py index 29ad24ce266..1ac8d24e89b 100644 --- a/py/test/Ice/operations/TestI.py +++ b/py/test/Ice/operations/TestI.py @@ -14,6 +14,22 @@ def test(b): raise RuntimeError('test assertion failed') class MyDerivedClassI(Test.MyDerivedClass): + def ice_isA(self, id, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + return Test.MyDerivedClass.ice_isA(self, id, current) + + def ice_ping(self, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + Test.MyDerivedClass.ice_ping(self, current) + + def ice_ids(self, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + return Test.MyDerivedClass.ice_ids(self, current) + + def ice_id(self, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + return Test.MyDerivedClass.ice_id(self, current) + def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -185,5 +201,11 @@ class MyDerivedClassI(Test.MyDerivedClass): for i in p2: test(i == d) + def opIdempotent(self, current=None): + test(current.mode == Ice.OperationMode.Idempotent) + + def opNonmutating(self, current=None): + test(current.mode == Ice.OperationMode.Nonmutating) + def opDerived(self, current=None): pass diff --git a/py/test/Ice/operations/Twoways.py b/py/test/Ice/operations/Twoways.py index c895841c17b..9f0e2c871c7 100644 --- a/py/test/Ice/operations/Twoways.py +++ b/py/test/Ice/operations/Twoways.py @@ -15,6 +15,30 @@ def test(b): def twoways(communicator, p): # + # ice_ping + # + p.ice_ping() + + # + # ice_isA + # + test(p.ice_isA(Test.MyClass.ice_staticId())) + + # + # ice_ids + # + ids = p.ice_ids() + test(len(ids) == 3) + test(ids[0] == "::Ice::Object") + test(ids[1] == "::Test::MyClass") + test(ids[2] == "::Test::MyDerivedClass") + + # + # ice_id + # + test(p.ice_id() == Test.MyDerivedClass.ice_staticId()) + + # # opVoid # p.opVoid() @@ -650,3 +674,12 @@ def twoways(communicator, p): ds.append(d); p.opDoubleMarshaling(d, ds); + # + # opIdempotent + # + p.opIdempotent() + + # + # opNonmutating + # + p.opNonmutating() diff --git a/py/test/Ice/operations/TwowaysAMI.py b/py/test/Ice/operations/TwowaysAMI.py index 23792521a1e..d98f8876bb5 100644 --- a/py/test/Ice/operations/TwowaysAMI.py +++ b/py/test/Ice/operations/TwowaysAMI.py @@ -551,6 +551,26 @@ class AMI_MyClass_opContextNotEqualI(CallbackBase): def ice_exception(self, ex): test(False) +class AMI_MyClass_opIdempotentI(CallbackBase): + def __init__(self): + CallbackBase.__init__(self) + + def ice_response(self): + self.called() + + def ice_exception(self, ex): + test(False) + +class AMI_MyClass_opNonmutatingI(CallbackBase): + def __init__(self): + CallbackBase.__init__(self) + + def ice_response(self): + self.called() + + def ice_exception(self, ex): + test(False) + class AMI_MyDerivedClass_opDerivedI(CallbackBase): def __init__(self): CallbackBase.__init__(self) @@ -929,6 +949,20 @@ def twowaysAMI(communicator, p): ic.destroy() + # + # opIdempotent + # + cb = AMI_MyClass_opIdempotentI() + p.opIdempotent_async(cb) + cb.check() + + # + # opNonmutating + # + cb = AMI_MyClass_opNonmutatingI() + p.opNonmutating_async(cb) + cb.check() + derived = Test.MyDerivedClassPrx.checkedCast(p) test(derived) cb = AMI_MyDerivedClass_opDerivedI() diff --git a/py/test/Ice/operations/TwowaysNewAMI.py b/py/test/Ice/operations/TwowaysNewAMI.py index 1ba06674086..635e0fb053f 100644 --- a/py/test/Ice/operations/TwowaysNewAMI.py +++ b/py/test/Ice/operations/TwowaysNewAMI.py @@ -345,6 +345,12 @@ class Callback(CallbackBase): test(r[j] == -j) self.called() + def opIdempotent(self): + self.called() + + def opNonmutating(self): + self.called() + def opDerived(self): self.called() @@ -357,7 +363,7 @@ def twowaysNewAMI(communicator, p): cb.check() cb = Callback() - p.begin_ice_isA("::Test::MyClass", cb.isA, cb.exCB) + p.begin_ice_isA(Test.MyClass.ice_staticId(), cb.isA, cb.exCB) cb.check() cb = Callback() @@ -619,6 +625,14 @@ def twowaysNewAMI(communicator, p): ic.destroy() + cb = Callback() + p.begin_opIdempotent(cb.opIdempotent, cb.exCB) + cb.check() + + cb = Callback() + p.begin_opNonmutating(cb.opNonmutating, cb.exCB) + cb.check() + derived = Test.MyDerivedClassPrx.checkedCast(p) test(derived) cb = Callback() diff --git a/rb/test/Ice/operations/Test.ice b/rb/test/Ice/operations/Test.ice index aaa65129c73..2db11b7dda2 100644 --- a/rb/test/Ice/operations/Test.ice +++ b/rb/test/Ice/operations/Test.ice @@ -162,6 +162,10 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD; void opByteSOneway(ByteS s); Ice::Context opContext(); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); }; ["ami"] class MyDerivedClass extends MyClass diff --git a/rb/test/Ice/operations/Twoways.rb b/rb/test/Ice/operations/Twoways.rb index 7b28e6da909..b821aa725fa 100644 --- a/rb/test/Ice/operations/Twoways.rb +++ b/rb/test/Ice/operations/Twoways.rb @@ -9,6 +9,30 @@ def twoways(communicator, p) # + # ice_ping + # + p.ice_ping + + # + # ice_isA + # + test(p.ice_isA(Test::MyClass::ice_staticId())) + + # + # ice_ids + # + ids = p.ice_ids + test(ids.length == 3) + test(ids[0] == "::Ice::Object") + test(ids[1] == "::Test::MyClass") + test(ids[2] == "::Test::MyDerivedClass") + + # + # ice_id + # + test(p.ice_id == Test::MyDerivedClass::ice_staticId()) + + # # opVoid # p.opVoid() @@ -481,6 +505,16 @@ def twoways(communicator, p) test(r == ctx) # + # opIdempotent + # + p.opIdempotent + + # + # opNonmutating + # + p.opNonmutating + + # # Test implicit context propagation # impls = [ 'Shared', 'PerThread' ] @@ -488,12 +522,12 @@ def twoways(communicator, p) initData = Ice::InitializationData.new initData.properties = communicator.getProperties().clone() initData.properties.setProperty('Ice.ImplicitContext', i) - ic = Ice.initialize(initData) - + ic = Ice::initialize(initData) + ctx = {'one'=>'ONE', 'two'=>'TWO', 'three'=>'THREE'} - + p = Test::MyClassPrx::uncheckedCast(ic.stringToProxy('test:default -p 12010')) - + ic.getImplicitContext().setContext(ctx) test(ic.getImplicitContext().getContext() == ctx) test(p.opContext() == ctx) @@ -503,24 +537,24 @@ def twoways(communicator, p) test(r == ''); test(ic.getImplicitContext().containsKey('zero') == true); test(ic.getImplicitContext().get('zero') == 'ZERO'); - + ctx = ic.getImplicitContext().getContext() test(p.opContext() == ctx) - + prxContext = {'one'=>'UN', 'four'=>'QUATRE'} - + combined = ctx.clone() combined.update(prxContext) test(combined['one'] == 'UN') - + p = Test::MyClassPrx::uncheckedCast(p.ice_context(prxContext)) ic.getImplicitContext().setContext({}) test(p.opContext() == prxContext) - + ic.getImplicitContext().setContext(ctx) test(p.opContext() == combined) - test(ic.getImplicitContext().remove('one') == 'ONE'); + test(ic.getImplicitContext().remove('one') == 'ONE'); ic.destroy() end |