summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/operations/TwowaysAMI.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2014-09-24 21:06:55 +0200
committerJose <jose@zeroc.com>2014-09-24 21:06:55 +0200
commitb1087d646fa93c4208dd227d0c9df323ff7c858b (patch)
tree48532138bffdfac0dc5c818593d9c1958cfeeeb5 /cpp/test/Ice/operations/TwowaysAMI.cpp
parentPHP dependency fixes (diff)
downloadice-b1087d646fa93c4208dd227d0c9df323ff7c858b.tar.bz2
ice-b1087d646fa93c4208dd227d0c9df323ff7c858b.tar.xz
ice-b1087d646fa93c4208dd227d0c9df323ff7c858b.zip
Fixed (ICE-5511) - Consider removing the deprecated AMI mapping
Diffstat (limited to 'cpp/test/Ice/operations/TwowaysAMI.cpp')
-rw-r--r--cpp/test/Ice/operations/TwowaysAMI.cpp1414
1 files changed, 752 insertions, 662 deletions
diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp
index 4723440088c..d7f6bc06dbd 100644
--- a/cpp/test/Ice/operations/TwowaysAMI.cpp
+++ b/cpp/test/Ice/operations/TwowaysAMI.cpp
@@ -10,7 +10,6 @@
#include <Ice/Ice.h>
#include <TestCommon.h>
#include <Test.h>
-#include <limits>
//
// Work-around for GCC warning bug
@@ -24,7 +23,7 @@ using namespace std;
namespace
{
-class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
+class CallbackBase : public Ice::LocalObject
{
public:
@@ -39,10 +38,10 @@ public:
void check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_m);
while(!_called)
{
- wait();
+ _m.wait();
}
_called = false;
}
@@ -51,114 +50,84 @@ protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_m);
assert(!_called);
_called = true;
- notify();
+ _m.notify();
}
private:
+ IceUtil::Monitor<IceUtil::Mutex> _m;
bool _called;
};
-class AMI_MyClass_opVoidI : public Test::AMI_MyClass_opVoid, public CallbackBase
+typedef IceUtil::Handle<CallbackBase> CallbackBasePtr;
+
+class Callback : public CallbackBase
{
public:
- virtual void ice_response()
+ Callback()
{
- called();
}
- virtual void ice_exception(const ::Ice::Exception&)
+ Callback(const Ice::CommunicatorPtr& communicator)
+ : _communicator(communicator)
{
- test(false);
}
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opVoidI> AMI_MyClass_opVoidIPtr;
-class AMI_MyClass_opVoidExI : public Test::AMI_MyClass_opVoid, public CallbackBase
-{
-public:
-
- virtual void ice_response()
+ void ping()
{
- test(false);
+ called();
}
- virtual void ice_exception(const ::Ice::Exception& ex)
+ void isA(bool result)
{
- test(dynamic_cast<const ::Ice::NoEndpointException*>(&ex));
+ test(result);
called();
}
-};
-typedef IceUtil::Handle<AMI_MyClass_opVoidExI> AMI_MyClass_opVoidExIPtr;
-
-class AMI_MyClass_opByteI : public Test::AMI_MyClass_opByte, public CallbackBase
-{
-public:
-
- virtual void ice_response(::Ice::Byte r, ::Ice::Byte b)
+ void id(const string& id)
{
- test(b == Ice::Byte(0xf0));
- test(r == Ice::Byte(0xff));
+ test(id == Test::MyDerivedClass::ice_staticId());
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
+ void ids(const Ice::StringSeq& ids)
{
- test(false);
+ test(ids.size() == 3);
+ test(ids[0] == "::Ice::Object");
+ test(ids[1] == "::Test::MyClass");
+ test(ids[2] == "::Test::MyDerivedClass");
+ called();
}
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opByteI> AMI_MyClass_opByteIPtr;
-
-class AMI_MyClass_opByteExI : public Test::AMI_MyClass_opByte, public CallbackBase
-{
-public:
- virtual void ice_response(::Ice::Byte, ::Ice::Byte)
+ void opVoid()
{
- test(false);
+ called();
}
- virtual void ice_exception(const ::Ice::Exception& ex)
+ void opContext(const Ice::Context&)
{
- test(dynamic_cast<const ::Ice::NoEndpointException*>(&ex));
called();
}
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opByteExI> AMI_MyClass_opByteExIPtr;
+ void opByte(Ice::Byte r, Ice::Byte b)
+ {
+ test(b == Ice::Byte(0xf0));
+ test(r == Ice::Byte(0xff));
+ called();
+ }
-class AMI_MyClass_opBoolI : public Test::AMI_MyClass_opBool, public CallbackBase
-{
-public:
-
- virtual void ice_response(bool r, bool b)
+ void opBool(bool r, bool b)
{
test(b);
test(!r);
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opBoolI> AMI_MyClass_opBoolIPtr;
-
-class AMI_MyClass_opShortIntLongI : public Test::AMI_MyClass_opShortIntLong, public CallbackBase
-{
-public:
-
- virtual void ice_response(::Ice::Long r, ::Ice::Short s, ::Ice::Int i, ::Ice::Long l)
+ void opShortIntLong(Ice::Long r, Ice::Short s, Ice::Int i, Ice::Long l)
{
test(s == 10);
test(i == 11);
@@ -167,19 +136,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opShortIntLongI> AMI_MyClass_opShortIntLongIPtr;
-
-class AMI_MyClass_opFloatDoubleI : public Test::AMI_MyClass_opFloatDouble, public CallbackBase
-{
-public:
-
- virtual void ice_response(::Ice::Double r, ::Ice::Float f, ::Ice::Double d)
+ void opFloatDouble(Ice::Double r, Ice::Float f, Ice::Double d)
{
test(f == Ice::Float(3.14));
test(d == Ice::Double(1.1E10));
@@ -187,67 +144,29 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opFloatDoubleI> AMI_MyClass_opFloatDoubleIPtr;
-
-class AMI_MyClass_opStringI : public Test::AMI_MyClass_opString, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::std::string& r, const ::std::string& s)
+ void opString(const ::std::string& r, const ::std::string& s)
{
test(s == "world hello");
test(r == "hello world");
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opStringI> AMI_MyClass_opStringIPtr;
-
-class AMI_MyClass_opMyEnumI : public Test::AMI_MyClass_opMyEnum, public CallbackBase
-{
-public:
-
- virtual void ice_response(::Test::MyEnum r, ::Test::MyEnum e)
+ void opMyEnum(Test::MyEnum r, Test::MyEnum e)
{
test(e == Test::enum2);
test(r == Test::enum3);
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opMyEnumI> AMI_MyClass_opMyEnumIPtr;
-
-class AMI_MyClass_opMyClassI : public Test::AMI_MyClass_opMyClass, public CallbackBase
-{
-public:
-
- AMI_MyClass_opMyClassI(const Ice::CommunicatorPtr& communicator) :
- _communicator(communicator)
- {
- }
-
- virtual void ice_response(const ::Test::MyClassPrx& r, const ::Test::MyClassPrx& c1, const ::Test::MyClassPrx& c2)
+ void opMyClass(const Test::MyClassPrx& r, const Test::MyClassPrx& c1, const Test::MyClassPrx& c2)
{
test(c1->ice_getIdentity() == _communicator->stringToIdentity("test"));
test(c2->ice_getIdentity() == _communicator->stringToIdentity("noSuchIdentity"));
test(r->ice_getIdentity() == _communicator->stringToIdentity("test"));
+
+ //
// We can't do the callbacks below in connection serialization mode.
+ //
if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize"))
{
r->opVoid();
@@ -264,35 +183,17 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-
-private:
-
- Ice::CommunicatorPtr _communicator;
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opMyClassI> AMI_MyClass_opMyClassIPtr;
-
-class AMI_MyClass_opStructI : public Test::AMI_MyClass_opStruct, public CallbackBase
-{
-public:
-
- AMI_MyClass_opStructI(const Ice::CommunicatorPtr& communicator) :
- _communicator(communicator)
- {
- }
-
- virtual void ice_response(const ::Test::Structure& rso, const ::Test::Structure& so)
+ void opStruct(const Test::Structure& rso, const Test::Structure& so)
{
test(rso.p == 0);
test(rso.e == Test::enum2);
test(rso.s.s == "def");
test(so.e == Test::enum3);
test(so.s.s == "a new string");
+
+ //
// We can't do the callbacks below in connection serialization mode.
+ //
if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize"))
{
so.p->opVoid();
@@ -300,23 +201,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-
-private:
-
- Ice::CommunicatorPtr _communicator;
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opStructI> AMI_MyClass_opStructIPtr;
-
-class AMI_MyClass_opByteSI : public Test::AMI_MyClass_opByteS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::ByteS& rso, const ::Test::ByteS& bso)
+ void opByteS(const Test::ByteS& rso, const Test::ByteS& bso)
{
test(bso.size() == 4);
test(bso[0] == Ice::Byte(0x22));
@@ -335,19 +220,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opByteSI> AMI_MyClass_opByteSIPtr;
-
-class AMI_MyClass_opBoolSI : public Test::AMI_MyClass_opBoolS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::BoolS& rso, const ::Test::BoolS& bso)
+ void opBoolS(const Test::BoolS& rso, const Test::BoolS& bso)
{
test(bso.size() == 4);
test(bso[0]);
@@ -361,20 +234,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opBoolSI> AMI_MyClass_opBoolSIPtr;
-
-class AMI_MyClass_opShortIntLongSI : public Test::AMI_MyClass_opShortIntLongS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::LongS& rso, const ::Test::ShortS& sso, const ::Test::IntS& iso,
- const ::Test::LongS& lso)
+ void opShortIntLongS(const Test::LongS& rso, const Test::ShortS& sso, const Test::IntS& iso, const Test::LongS& lso)
{
test(sso.size() == 3);
test(sso[0] == 1);
@@ -399,19 +259,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opShortIntLongSI> AMI_MyClass_opShortIntLongSIPtr;
-
-class AMI_MyClass_opFloatDoubleSI : public Test::AMI_MyClass_opFloatDoubleS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::DoubleS& rso, const ::Test::FloatS& fso, const ::Test::DoubleS& dso)
+ void opFloatDoubleS(const Test::DoubleS& rso, const Test::FloatS& fso, const Test::DoubleS& dso)
{
test(fso.size() == 2);
test(fso[0] == ::Ice::Float(3.14));
@@ -429,19 +277,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opFloatDoubleSI> AMI_MyClass_opFloatDoubleSIPtr;
-
-class AMI_MyClass_opStringSI : public Test::AMI_MyClass_opStringS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::StringS& rso, const ::Test::StringS& sso)
+ void opStringS(const Test::StringS& rso, const Test::StringS& sso)
{
test(sso.size() == 4);
test(sso[0] == "abc");
@@ -455,19 +291,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opStringSI> AMI_MyClass_opStringSIPtr;
-
-class AMI_MyClass_opByteSSI : public Test::AMI_MyClass_opByteSS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::ByteSS& rso, const ::Test::ByteSS& bso)
+ void opByteSS(const Test::ByteSS& rso, const Test::ByteSS& bso)
{
test(bso.size() == 2);
test(bso[0].size() == 1);
@@ -491,19 +315,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opByteSSI> AMI_MyClass_opByteSSIPtr;
-
-class AMI_MyClass_opBoolSSI : public Test::AMI_MyClass_opBoolSS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::BoolSS& rso, const ::Test::BoolSS& bso)
+ void opBoolSS(const Test::BoolSS& rso, const Test::BoolSS& bso)
{
test(bso.size() == 4);
test(bso[0].size() == 1);
@@ -528,20 +340,10 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opBoolSSI> AMI_MyClass_opBoolSSIPtr;
-
-class AMI_MyClass_opShortIntLongSSI : public Test::AMI_MyClass_opShortIntLongSS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::LongSS& rso, const ::Test::ShortSS& sso, const ::Test::IntSS& iso,
- const ::Test::LongSS& lso)
+ void opShortIntLongSS(const Test::LongSS& rso,
+ const Test::ShortSS& sso,
+ const Test::IntSS& iso,
+ const Test::LongSS& lso)
{
test(rso.size() == 1);
test(rso[0].size() == 2);
@@ -571,19 +373,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opShortIntLongSSI> AMI_MyClass_opShortIntLongSSIPtr;
-
-class AMI_MyClass_opFloatDoubleSSI : public Test::AMI_MyClass_opFloatDoubleSS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::DoubleSS& rso, const ::Test::FloatSS& fso, const ::Test::DoubleSS& dso)
+ void opFloatDoubleSS(const Test::DoubleSS& rso, const Test::FloatSS& fso, const Test::DoubleSS& dso)
{
test(fso.size() == 3);
test(fso[0].size() == 1);
@@ -608,19 +398,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opFloatDoubleSSI> AMI_MyClass_opFloatDoubleSSIPtr;
-
-class AMI_MyClass_opStringSSI : public Test::AMI_MyClass_opStringSS, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::StringSS& rso, const ::Test::StringSS& sso)
+ void opStringSS(const Test::StringSS& rso, const Test::StringSS& sso)
{
test(sso.size() == 5);
test(sso[0].size() == 1);
@@ -640,19 +418,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opStringSSI> AMI_MyClass_opStringSSIPtr;
-
-class AMI_MyClass_opByteBoolDI : public Test::AMI_MyClass_opByteBoolD, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::ByteBoolD& ro, const ::Test::ByteBoolD& _do)
+ void opByteBoolD(const Test::ByteBoolD& ro, const Test::ByteBoolD& _do)
{
Test::ByteBoolD di1;
di1[10] = true;
@@ -670,19 +436,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opByteBoolDI> AMI_MyClass_opByteBoolDIPtr;
-
-class AMI_MyClass_opShortIntDI : public Test::AMI_MyClass_opShortIntD, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::ShortIntD& ro, const ::Test::ShortIntD& _do)
+ void opShortIntD(const Test::ShortIntD& ro, const Test::ShortIntD& _do)
{
Test::ShortIntD di1;
di1[110] = -1;
@@ -700,19 +454,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opShortIntDI> AMI_MyClass_opShortIntDIPtr;
-
-class AMI_MyClass_opLongFloatDI : public Test::AMI_MyClass_opLongFloatD, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::LongFloatD& ro, const ::Test::LongFloatD& _do)
+ void opLongFloatD(const Test::LongFloatD& ro, const Test::LongFloatD& _do)
{
Test::LongFloatD di1;
di1[999999110] = Ice::Float(-1.1);
@@ -730,19 +472,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opLongFloatDI> AMI_MyClass_opLongFloatDIPtr;
-
-class AMI_MyClass_opStringStringDI : public Test::AMI_MyClass_opStringStringD, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::StringStringD& ro, const ::Test::StringStringD& _do)
+ void opStringStringD(const Test::StringStringD& ro, const Test::StringStringD& _do)
{
Test::StringStringD di1;
di1["foo"] = "abc -1.1";
@@ -760,19 +490,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opStringStringDI> AMI_MyClass_opStringStringDIPtr;
-
-class AMI_MyClass_opStringMyEnumDI : public Test::AMI_MyClass_opStringMyEnumD, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::StringMyEnumD& ro, const ::Test::StringMyEnumD& _do)
+ void opStringMyEnumD(const Test::StringMyEnumD& ro, const Test::StringMyEnumD& _do)
{
Test::StringMyEnumD di1;
di1["abc"] = Test::enum1;
@@ -790,46 +508,7 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opStringMyEnumDI> AMI_MyClass_opStringMyEnumDIPtr;
-
-class AMI_MyClass_opMyEnumStringDI : public Test::AMI_MyClass_opMyEnumStringD, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::MyEnumStringD& ro, const ::Test::MyEnumStringD& _do)
- {
- Test::MyEnumStringD di1;
- di1[Test::enum1] = "abc";
- test(_do == di1);
- test(ro.size() == 3);
- test(ro.find(Test::enum1) != ro.end());
- test(ro.find(Test::enum1)->second == "abc");
- test(ro.find(Test::enum2) != ro.end());
- test(ro.find(Test::enum2)->second == "Hello!!");
- test(ro.find(Test::enum3) != ro.end());
- test(ro.find(Test::enum3)->second == "qwerty");
- called();
- }
-
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opMyEnumStringDI> AMI_MyClass_opMyEnumStringDIPtr;
-
-class AMI_MyClass_opMyStructMyEnumDI : public Test::AMI_MyClass_opMyStructMyEnumD, public CallbackBase
-{
-public:
-
- virtual void ice_response(const ::Test::MyStructMyEnumD& ro, const ::Test::MyStructMyEnumD& _do)
+ void opMyStructMyEnumD(const Test::MyStructMyEnumD& ro, const Test::MyStructMyEnumD& _do)
{
Test::MyStruct s11 = { 1, 1 };
Test::MyStruct s12 = { 1, 2 };
@@ -851,161 +530,45 @@ public:
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opMyStructMyEnumDI> AMI_MyClass_opMyStructMyEnumDIPtr;
-
-class AMI_MyClass_opIntSI : public Test::AMI_MyClass_opIntS, public CallbackBase
-{
-public:
-
- AMI_MyClass_opIntSI(int l) : _l(l) {}
-
- virtual void ice_response(const Test::IntS& r)
+ void opIntS(const Test::IntS& r)
{
- test(r.size() == static_cast<size_t>(_l));
- for(int j = 0; j < _l; ++j)
+ for(int j = 0; j < static_cast<int>(r.size()); ++j)
{
test(r[j] == -j);
}
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-
-private:
-
- int _l;
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opIntSI> AMI_MyClass_opIntSIPtr;
-
-class AMI_MyClass_opContextEqualI : public Test::AMI_MyClass_opContext, public CallbackBase
-{
-public:
-
- AMI_MyClass_opContextEqualI(const Test::StringStringD &d) : _d(d)
- {
- }
-
- virtual void ice_response(const Test::StringStringD& r)
- {
- test(r == _d);
- called();
- }
-
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-
-private:
-
- Test::StringStringD _d;
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opContextEqualI> AMI_MyClass_opContextEqualIPtr;
-
-class AMI_MyClass_opContextNotEqualI : public Test::AMI_MyClass_opContext, public CallbackBase
-{
-public:
-
- AMI_MyClass_opContextNotEqualI(const Test::StringStringD &d) : _d(d)
- {
- }
-
- virtual void ice_response(const Test::StringStringD& r)
+ void opDoubleMarshaling()
{
- test(r != _d);
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-
-private:
-
- Test::StringStringD _d;
-};
-
-typedef IceUtil::Handle<AMI_MyClass_opContextNotEqualI> AMI_MyClass_opContextNotEqualIPtr;
-
-class AMI_MyDerivedClass_opDerivedI : public Test::AMI_MyDerivedClass_opDerived, public CallbackBase
-{
-public:
-
- virtual void ice_response()
+ void opIdempotent()
{
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-typedef IceUtil::Handle<AMI_MyDerivedClass_opDerivedI> AMI_MyDerivedClass_opDerivedIPtr;
-
-class AMI_MyClass_opDoubleMarshalingI : public Test::AMI_MyClass_opDoubleMarshaling, public CallbackBase
-{
-public:
-
- virtual void ice_response()
+ void opNonmutating()
{
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
-};
-
-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()
+ void opDerived()
{
called();
}
- virtual void ice_exception(const ::Ice::Exception&)
+ void exCB(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();
- }
+private:
- virtual void ice_exception(const ::Ice::Exception&)
- {
- test(false);
- }
+ Ice::CommunicatorPtr _communicator;
};
-
-typedef IceUtil::Handle<AMI_MyClass_opNonmutatingI> AMI_MyClass_opNonmutatingIPtr;
+typedef IceUtil::Handle<Callback> CallbackPtr;
}
@@ -1013,114 +576,108 @@ void
twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
{
{
- // 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"));
- AMI_MyClass_opVoidExIPtr cb = new AMI_MyClass_opVoidExI;
- try
- {
- test(!indirect->opVoid_async(cb));
- }
- catch(const Ice::Exception&)
- {
- test(false);
- }
+ CallbackPtr cb = new Callback;
+ Ice::Callback_Object_ice_pingPtr callback = Ice::newCallback_Object_ice_ping(cb,
+ &Callback::ping,
+ &Callback::exCB);
+ p->begin_ice_ping(callback);
cb->check();
}
{
- //
- // Check that a call to a twoway 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"));
- AMI_MyClass_opByteExIPtr cb = new AMI_MyClass_opByteExI;
- try
- {
- test(!indirect->opByte_async(cb, 0, 0));
- }
- catch(const Ice::Exception&)
- {
- test(false);
- }
+ 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();
}
{
- AMI_MyClass_opVoidIPtr cb = new AMI_MyClass_opVoidI;
- p->opVoid_async(cb);
- cb->check();
- // Let's check if we can reuse the same callback object for another call.
- p->opVoid_async(cb);
+ 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();
}
{
- //
- // Check that CommunicatorDestroyedException is raised directly.
- //
- Ice::InitializationData initData;
- initData.properties = communicator->getProperties()->clone();
- Ice::CommunicatorPtr ic = Ice::initialize(initData);
- Ice::ObjectPrx obj = ic->stringToProxy(p->ice_toString());
- Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(obj);
-
- ic->destroy();
-
- AMI_MyClass_opVoidIPtr cb = new AMI_MyClass_opVoidI;
- try
- {
- test(!p2->opVoid_async(cb));
- test(false);
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- // Expected.
- }
+ CallbackPtr cb = new Callback;
+ Ice::Callback_Object_ice_idsPtr callback = Ice::newCallback_Object_ice_ids(cb,
+ &Callback::ids,
+ &Callback::exCB);
+ p->begin_ice_ids(callback);
+ cb->check();
}
{
- AMI_MyClass_opByteIPtr cb = new AMI_MyClass_opByteI;
- p->opByte_async(cb, Ice::Byte(0xff), Ice::Byte(0x0f));
+ CallbackPtr cb = new Callback;
+ Test::Callback_MyClass_opVoidPtr callback = Test::newCallback_MyClass_opVoid(cb,
+ &Callback::opVoid,
+ &Callback::exCB);
+ p->begin_opVoid(callback);
cb->check();
}
{
- AMI_MyClass_opBoolIPtr cb = new AMI_MyClass_opBoolI;
- p->opBool_async(cb, true, false);
+ CallbackPtr cb = new Callback;
+ 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();
}
{
- AMI_MyClass_opShortIntLongIPtr cb = new AMI_MyClass_opShortIntLongI;
- p->opShortIntLong_async(cb, 10, 11, 12);
+ 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();
}
{
- AMI_MyClass_opFloatDoubleIPtr cb = new AMI_MyClass_opFloatDoubleI;
- p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10));
+ 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();
- // Let's check if we can reuse the same callback object for another call.
- p->opFloatDouble_async(cb, Ice::Float(3.14), Ice::Double(1.1E10));
+ }
+
+ {
+ 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();
}
{
- AMI_MyClass_opStringIPtr cb = new AMI_MyClass_opStringI;
- p->opString_async(cb, "hello", "world");
+ 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();
}
{
- AMI_MyClass_opMyEnumIPtr cb = new AMI_MyClass_opMyEnumI;
- p->opMyEnum_async(cb, Test::enum2);
+ 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();
}
{
- AMI_MyClass_opMyClassIPtr cb = new AMI_MyClass_opMyClassI(communicator);
- p->opMyClass_async(cb, p);
+ 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();
}
@@ -1134,8 +691,11 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
si2.e = Test::enum2;
si2.s.s = "def";
- AMI_MyClass_opStructIPtr cb = new AMI_MyClass_opStructI(communicator);
- p->opStruct_async(cb, si1, si2);
+ 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();
}
@@ -1153,8 +713,11 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
bsi2.push_back(Ice::Byte(0xf3));
bsi2.push_back(Ice::Byte(0xf4));
- AMI_MyClass_opByteSIPtr cb = new AMI_MyClass_opByteSI;
- p->opByteS_async(cb, bsi1, bsi2);
+ 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();
}
@@ -1168,8 +731,11 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
bsi2.push_back(false);
- AMI_MyClass_opBoolSIPtr cb = new AMI_MyClass_opBoolSI;
- p->opBoolS_async(cb, bsi1, bsi2);
+ 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();
}
@@ -1191,8 +757,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
lsi.push_back(30);
lsi.push_back(20);
- AMI_MyClass_opShortIntLongSIPtr cb = new AMI_MyClass_opShortIntLongSI;
- p->opShortIntLongS_async(cb, ssi, isi, lsi);
+ 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();
}
@@ -1207,8 +775,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
dsi.push_back(Ice::Double(1.2E10));
dsi.push_back(Ice::Double(1.3E10));
- AMI_MyClass_opFloatDoubleSIPtr cb = new AMI_MyClass_opFloatDoubleSI;
- p->opFloatDoubleS_async(cb, fsi, dsi);
+ 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();
}
@@ -1222,8 +792,11 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
ssi2.push_back("xyz");
- AMI_MyClass_opStringSIPtr cb = new AMI_MyClass_opStringSI;
- p->opStringS_async(cb, ssi1, ssi2);
+ 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();
}
@@ -1242,8 +815,11 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
bsi2[1].push_back(Ice::Byte(0xf2));
bsi2[1].push_back(Ice::Byte(0xf1));
- AMI_MyClass_opByteSSIPtr cb = new AMI_MyClass_opByteSSI;
- p->opByteSS_async(cb, bsi1, bsi2);
+ 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();
}
@@ -1261,8 +837,12 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
bsi2[0].push_back(false);
bsi2[0].push_back(false);
bsi2[0].push_back(true);
- AMI_MyClass_opBoolSSIPtr cb = new AMI_MyClass_opBoolSSI;
- p->opBoolSS_async(cb, bsi1, bsi2);
+
+ CallbackPtr cb = new Callback;
+ Test::Callback_MyClass_opBoolSSPtr callback = Test::newCallback_MyClass_opBoolSS(cb,
+ &Callback::opBoolSS,
+ &Callback::exCB);
+ p->begin_opBoolSS(bsi1, bsi2, callback);
cb->check();
}
@@ -1283,12 +863,14 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
lsi[0].push_back(496);
lsi[0].push_back(1729);
- AMI_MyClass_opShortIntLongSSIPtr cb = new AMI_MyClass_opShortIntLongSSI;
- p->opShortIntLongSS_async(cb, ssi, isi, lsi);
+ CallbackPtr cb = new Callback;
+ Test::Callback_MyClass_opShortIntLongSSPtr callback = Test::newCallback_MyClass_opShortIntLongSS(cb,
+ &Callback::opShortIntLongSS,
+ &Callback::exCB);
+ p->begin_opShortIntLongSS(ssi, isi, lsi, callback);
cb->check();
}
-
{
Test::FloatSS fsi;
fsi.resize(3);
@@ -1302,8 +884,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
dsi[0].push_back(Ice::Double(1.2E10));
dsi[0].push_back(Ice::Double(1.3E10));
- AMI_MyClass_opFloatDoubleSSIPtr cb = new AMI_MyClass_opFloatDoubleSSI;
- p->opFloatDoubleSS_async(cb, fsi, dsi);
+ 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();
}
@@ -1319,8 +903,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
ssi2[2].push_back("xyz");
- AMI_MyClass_opStringSSIPtr cb = new AMI_MyClass_opStringSSI;
- p->opStringSS_async(cb, ssi1, ssi2);
+ 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();
}
@@ -1333,8 +919,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
di2[11] = false;
di2[101] = true;
- AMI_MyClass_opByteBoolDIPtr cb = new AMI_MyClass_opByteBoolDI;
- p->opByteBoolD_async(cb, di1, di2);
+ 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();
}
@@ -1347,8 +935,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
di2[111] = -100;
di2[1101] = 0;
- AMI_MyClass_opShortIntDIPtr cb = new AMI_MyClass_opShortIntDI;
- p->opShortIntD_async(cb, di1, di2);
+ 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();
}
@@ -1361,8 +951,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
di2[999999120] = Ice::Float(-100.4);
di2[999999130] = Ice::Float(0.5);
- AMI_MyClass_opLongFloatDIPtr cb = new AMI_MyClass_opLongFloatDI;
- p->opLongFloatD_async(cb, di1, di2);
+ 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();
}
@@ -1375,8 +967,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
di2["FOO"] = "abc -100.4";
di2["BAR"] = "abc 0.5";
- AMI_MyClass_opStringStringDIPtr cb = new AMI_MyClass_opStringStringDI;
- p->opStringStringD_async(cb, di1, di2);
+ 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();
}
@@ -1389,20 +983,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
di2["qwerty"] = Test::enum3;
di2["Hello!!"] = Test::enum2;
- AMI_MyClass_opStringMyEnumDIPtr cb = new AMI_MyClass_opStringMyEnumDI;
- p->opStringMyEnumD_async(cb, di1, di2);
- cb->check();
- }
-
- {
- Test::MyEnumStringD di1;
- di1[Test::enum1] = "abc";
- Test::MyEnumStringD di2;
- di2[Test::enum2] = "Hello!!";
- di2[Test::enum3] = "qwerty";
-
- AMI_MyClass_opMyEnumStringDIPtr cb = new AMI_MyClass_opMyEnumStringDI;
- p->opMyEnumStringD_async(cb, di1, di2);
+ 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();
}
@@ -1420,8 +1004,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
di2[s22] = Test::enum3;
di2[s23] = Test::enum2;
- AMI_MyClass_opMyStructMyEnumDIPtr cb = new AMI_MyClass_opMyStructMyEnumDI;
- p->opMyStructMyEnumD_async(cb, di1, di2);
+ 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();
}
@@ -1435,8 +1021,10 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
{
s.push_back(i);
}
- AMI_MyClass_opIntSIPtr cb = new AMI_MyClass_opIntSI(lengths[l]);
- p->opIntS_async(cb, s);
+ 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();
}
}
@@ -1448,28 +1036,28 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
ctx["three"] = "THREE";
{
test(p->ice_getContext().empty());
- AMI_MyClass_opContextNotEqualIPtr cb = new AMI_MyClass_opContextNotEqualI(ctx);
- p->opContext_async(cb);
- cb->check();
+ Ice::AsyncResultPtr r = p->begin_opContext();
+ Ice::Context c = p->end_opContext(r);
+ test(c != ctx);
}
{
test(p->ice_getContext().empty());
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p->opContext_async(cb, ctx);
- cb->check();
+ 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);
{
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p2->opContext_async(cb);
- cb->check();
+ 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));
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p2->opContext_async(cb, ctx);
- cb->check();
+ Ice::AsyncResultPtr r = p2->begin_opContext(ctx);
+ Ice::Context c = p2->end_opContext(r);
+ test(c == ctx);
}
#ifndef ICE_OS_WINRT
@@ -1494,24 +1082,24 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(
- ic->stringToProxy("test:default -p 12010"));
+ ic->stringToProxy("test:default -p 12010"));
ic->getImplicitContext()->setContext(ctx);
test(ic->getImplicitContext()->getContext() == ctx);
{
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p->opContext_async(cb);
- cb->check();
+ Ice::AsyncResultPtr r = p->begin_opContext();
+ Ice::Context c = p->end_opContext(r);
+ test(c == ctx);
}
ic->getImplicitContext()->put("zero", "ZERO");
ctx = ic->getImplicitContext()->getContext();
{
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx);
- p->opContext_async(cb);
- cb->check();
+ Ice::AsyncResultPtr r = p->begin_opContext();
+ Ice::Context c = p->end_opContext(r);
+ test(c == ctx);
}
Ice::Context prxContext;
@@ -1526,16 +1114,16 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
ic->getImplicitContext()->setContext(Ice::Context());
{
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(prxContext);
- p->opContext_async(cb);
- cb->check();
+ Ice::AsyncResultPtr r = p->begin_opContext();
+ Ice::Context c = p->end_opContext(r);
+ test(c == prxContext);
}
ic->getImplicitContext()->setContext(ctx);
{
- AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(combined);
- p->opContext_async(cb);
- cb->check();
+ Ice::AsyncResultPtr r = p->begin_opContext();
+ Ice::Context c = p->end_opContext(r);
+ test(c == combined);
}
ic->getImplicitContext()->setContext(Ice::Context());
@@ -1548,28 +1136,530 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p)
{
Ice::Double d = 1278312346.0 / 13.0;
Test::DoubleS ds(5, d);
- AMI_MyClass_opDoubleMarshalingIPtr cb = new AMI_MyClass_opDoubleMarshalingI;
- p->opDoubleMarshaling_async(cb, d, ds);
+ 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();
}
{
- AMI_MyClass_opIdempotentIPtr cb = new AMI_MyClass_opIdempotentI;
- p->opIdempotent_async(cb);
+ CallbackPtr cb = new Callback;
+ Test::Callback_MyClass_opIdempotentPtr callback =
+ Test::newCallback_MyClass_opIdempotent(cb, &Callback::opIdempotent, &Callback::exCB);
+ p->begin_opIdempotent(callback);
cb->check();
}
{
- AMI_MyClass_opNonmutatingIPtr cb = new AMI_MyClass_opNonmutatingI;
- p->opNonmutating_async(cb);
+ 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);
- AMI_MyDerivedClass_opDerivedIPtr cb = new AMI_MyDerivedClass_opDerivedI;
- derived->opDerived_async(cb);
+ CallbackPtr cb = new Callback;
+ Test::Callback_MyDerivedClass_opDerivedPtr callback =
+ Test::newCallback_MyDerivedClass_opDerived(cb, &Callback::opDerived, &Callback::exCB);
+ derived->begin_opDerived(callback);
+ cb->check();
+ }
+#ifdef ICE_CPP11
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_ice_ping([=](){ cb->ping(); }, [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_ice_isA(Test::MyClass::ice_staticId(), [=](bool isA){ cb->isA(isA); }, [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_ice_id([=](const string& id){ cb->id(id); }, [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_ice_ids([=](const Ice::StringSeq& ids){ cb->ids(ids); }, [=](const Ice::Exception& ex){ cb->exCB(ex); });
cb->check();
}
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_opVoid([=](){ cb->opVoid(); }, [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_opByte(Ice::Byte(0xff), Ice::Byte(0x0f),
+ [=](const Ice::Byte& p1, const Ice::Byte& p2){ cb->opByte(p1, p2); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ Test::Callback_MyClass_opBoolPtr callback = Test::newCallback_MyClass_opBool(cb,
+ &Callback::opBool,
+ &Callback::exCB);
+ p->begin_opBool(true, false, [=](bool p1, bool p2){ cb->opBool(p1, p2); }, [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_opShortIntLong(10, 11, 12,
+ [=](Ice::Long p1, Ice::Short p2, Ice::Int p3, Ice::Long p4){ cb->opShortIntLong(p1, p2, p3, p4); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10),
+ [=](Ice::Double p1, Ice::Float p2, Ice::Double p3){ cb->opFloatDouble(p1, p2, p3); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_opString("hello", "world",
+ [=](const string& p1, const string& p2){ cb->opString(p1, p2); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_opMyEnum(Test::enum2,
+ [=](Test::MyEnum p1, Test::MyEnum p2){ cb->opMyEnum(p1, p2); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback(communicator);
+ p->begin_opMyClass(p,
+ [=](const Test::MyClassPrx& p1, const Test::MyClassPrx p2, const Test::MyClassPrx p3)
+ {
+ cb->opMyClass(p1, p2, p3);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::Structure si1;
+ si1.p = p;
+ si1.e = Test::enum3;
+ si1.s.s = "abc";
+ Test::Structure si2;
+ si2.p = 0;
+ si2.e = Test::enum2;
+ si2.s.s = "def";
+
+ CallbackPtr cb = new Callback(communicator);
+ p->begin_opStruct(si1, si2,
+ [=](const Test::Structure& p1, const Test::Structure& p2)
+ {
+ cb->opStruct(p1, p2);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::ByteS bsi1;
+ Test::ByteS bsi2;
+
+ bsi1.push_back(Ice::Byte(0x01));
+ bsi1.push_back(Ice::Byte(0x11));
+ bsi1.push_back(Ice::Byte(0x12));
+ bsi1.push_back(Ice::Byte(0x22));
+
+ bsi2.push_back(Ice::Byte(0xf1));
+ bsi2.push_back(Ice::Byte(0xf2));
+ 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,
+ &Callback::opByteS,
+ &Callback::exCB);
+ p->begin_opByteS(bsi1, bsi2,
+ [=](const Test::ByteS& p1, const Test::ByteS& p2)
+ {
+ cb->opByteS(p1, p2);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::BoolS bsi1;
+ Test::BoolS bsi2;
+
+ bsi1.push_back(true);
+ bsi1.push_back(true);
+ bsi1.push_back(false);
+
+ bsi2.push_back(false);
+
+ CallbackPtr cb = new Callback;
+ p->begin_opBoolS(bsi1, bsi2,
+ [=](const Test::BoolS& p1, const Test::BoolS& p2)
+ {
+ cb->opBoolS(p1, p2);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::ShortS ssi;
+ Test::IntS isi;
+ Test::LongS lsi;
+
+ ssi.push_back(1);
+ ssi.push_back(2);
+ ssi.push_back(3);
+
+ isi.push_back(5);
+ isi.push_back(6);
+ isi.push_back(7);
+ isi.push_back(8);
+
+ lsi.push_back(10);
+ lsi.push_back(30);
+ lsi.push_back(20);
+
+ CallbackPtr cb = new Callback;
+ p->begin_opShortIntLongS(ssi, isi, lsi,
+ [=](const Test::LongS& p1, const Test::ShortS& p2, const Test::IntS& p3, const Test::LongS& p4)
+ {
+ cb->opShortIntLongS(p1, p2, p3, p4);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::FloatS fsi;
+ Test::DoubleS dsi;
+
+ fsi.push_back(Ice::Float(3.14));
+ fsi.push_back(Ice::Float(1.11));
+
+ dsi.push_back(Ice::Double(1.1E10));
+ dsi.push_back(Ice::Double(1.2E10));
+ dsi.push_back(Ice::Double(1.3E10));
+
+ CallbackPtr cb = new Callback;
+ p->begin_opFloatDoubleS(fsi, dsi,
+ [=](const Test::DoubleS& p1, const Test::FloatS& p2, const Test::DoubleS& p3)
+ {
+ cb->opFloatDoubleS(p1, p2, p3);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::StringS ssi1;
+ Test::StringS ssi2;
+
+ ssi1.push_back("abc");
+ ssi1.push_back("de");
+ ssi1.push_back("fghi");
+
+ ssi2.push_back("xyz");
+
+ CallbackPtr cb = new Callback;
+ p->begin_opStringS(ssi1, ssi2,
+ [=](const Test::StringS& p1, const Test::StringS& p2)
+ {
+ cb->opStringS(p1, p2);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::ByteSS bsi1;
+ bsi1.resize(2);
+ Test::ByteSS bsi2;
+ bsi2.resize(2);
+
+ bsi1[0].push_back(Ice::Byte(0x01));
+ bsi1[0].push_back(Ice::Byte(0x11));
+ bsi1[0].push_back(Ice::Byte(0x12));
+ bsi1[1].push_back(Ice::Byte(0xff));
+
+ bsi2[0].push_back(Ice::Byte(0x0e));
+ bsi2[1].push_back(Ice::Byte(0xf2));
+ bsi2[1].push_back(Ice::Byte(0xf1));
+
+ CallbackPtr cb = new Callback;
+ p->begin_opByteSS(bsi1, bsi2,
+ [=](const Test::ByteSS& p1, const Test::ByteSS& p2)
+ {
+ cb->opByteSS(p1, p2);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::FloatSS fsi;
+ fsi.resize(3);
+ Test::DoubleSS dsi;
+ dsi.resize(1);
+
+ fsi[0].push_back(Ice::Float(3.14));
+ fsi[1].push_back(Ice::Float(1.11));
+
+ dsi[0].push_back(Ice::Double(1.1E10));
+ dsi[0].push_back(Ice::Double(1.2E10));
+ dsi[0].push_back(Ice::Double(1.3E10));
+
+ CallbackPtr cb = new Callback;
+ p->begin_opFloatDoubleSS(fsi, dsi,
+ [=](const Test::DoubleSS& p1, const Test::FloatSS& p2, const Test::DoubleSS& p3)
+ {
+ cb->opFloatDoubleSS(p1, p2, p3);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::StringSS ssi1;
+ ssi1.resize(2);
+ Test::StringSS ssi2;
+ ssi2.resize(3);
+
+ ssi1[0].push_back("abc");
+ ssi1[1].push_back("de");
+ ssi1[1].push_back("fghi");
+
+ ssi2[2].push_back("xyz");
+
+ CallbackPtr cb = new Callback;
+ p->begin_opStringSS(ssi1, ssi2,
+ [=](const Test::StringSS& p1, const Test::StringSS& p2)
+ {
+ cb->opStringSS(p1, p2);
+ },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::ByteBoolD di1;
+ di1[10] = true;
+ di1[100] = false;
+ Test::ByteBoolD di2;
+ di2[10] = true;
+ di2[11] = false;
+ di2[101] = true;
+
+ CallbackPtr cb = new Callback;
+ p->begin_opByteBoolD(di1, di2,
+ [=](const Test::ByteBoolD& p1, const Test::ByteBoolD& p2)
+ {
+ cb->opByteBoolD(p1, p2);
+ },
+ [=](const Ice::Exception& ex)
+ {
+ cb->exCB(ex);
+ });
+ cb->check();
+ }
+
+ {
+ Test::ShortIntD di1;
+ di1[110] = -1;
+ di1[1100] = 123123;
+ Test::ShortIntD di2;
+ di2[110] = -1;
+ di2[111] = -100;
+ di2[1101] = 0;
+
+ CallbackPtr cb = new Callback;
+ p->begin_opShortIntD(di1, di2,
+ [=](const Test::ShortIntD& p1, const Test::ShortIntD& p2)
+ {
+ cb->opShortIntD(p1, p2);
+ },
+ [=](const Ice::Exception& ex)
+ {
+ cb->exCB(ex);
+ });
+ cb->check();
+ }
+
+ {
+ Test::LongFloatD di1;
+ di1[999999110] = Ice::Float(-1.1);
+ di1[999999111] = Ice::Float(123123.2);
+ Test::LongFloatD di2;
+ di2[999999110] = Ice::Float(-1.1);
+ di2[999999120] = Ice::Float(-100.4);
+ di2[999999130] = Ice::Float(0.5);
+
+ CallbackPtr cb = new Callback;
+ p->begin_opLongFloatD(di1, di2,
+ [=](const Test::LongFloatD& p1, const Test::LongFloatD& p2)
+ {
+ cb->opLongFloatD(p1, p2);
+ },
+ [=](const Ice::Exception& ex)
+ {
+ cb->exCB(ex);
+ });
+ cb->check();
+ }
+
+ {
+ Test::StringStringD di1;
+ di1["foo"] = "abc -1.1";
+ di1["bar"] = "abc 123123.2";
+ Test::StringStringD di2;
+ di2["foo"] = "abc -1.1";
+ di2["FOO"] = "abc -100.4";
+ di2["BAR"] = "abc 0.5";
+
+ CallbackPtr cb = new Callback;
+ p->begin_opStringStringD(di1, di2,
+ [=](const Test::StringStringD& p1, const Test::StringStringD& p2)
+ {
+ cb->opStringStringD(p1, p2);
+ },
+ [=](const Ice::Exception& ex)
+ {
+ cb->exCB(ex);
+ });
+ cb->check();
+ }
+
+ {
+ Test::StringMyEnumD di1;
+ di1["abc"] = Test::enum1;
+ di1[""] = Test::enum2;
+ Test::StringMyEnumD di2;
+ di2["abc"] = Test::enum1;
+ di2["qwerty"] = Test::enum3;
+ di2["Hello!!"] = Test::enum2;
+
+ CallbackPtr cb = new Callback;
+ p->begin_opStringMyEnumD(di1, di2,
+ [=](const Test::StringMyEnumD& p1, const Test::StringMyEnumD& p2)
+ {
+ cb->opStringMyEnumD(p1, p2);
+ },
+ [=](const Ice::Exception& ex)
+ {
+ cb->exCB(ex);
+ });
+ cb->check();
+ }
+
+ {
+ Test::MyStruct s11 = { 1, 1 };
+ Test::MyStruct s12 = { 1, 2 };
+ Test::MyStructMyEnumD di1;
+ di1[s11] = Test::enum1;
+ di1[s12] = Test::enum2;
+
+ Test::MyStruct s22 = { 2, 2 };
+ Test::MyStruct s23 = { 2, 3 };
+ Test::MyStructMyEnumD di2;
+ di2[s11] = Test::enum1;
+ di2[s22] = Test::enum3;
+ di2[s23] = Test::enum2;
+
+ CallbackPtr cb = new Callback;
+ p->begin_opMyStructMyEnumD(di1, di2,
+ [=](const Test::MyStructMyEnumD& p1, const Test::MyStructMyEnumD& p2)
+ {
+ cb->opMyStructMyEnumD(p1, p2);
+ },
+ [=](const Ice::Exception& ex)
+ {
+ cb->exCB(ex);
+ });
+ cb->check();
+ }
+
+ {
+ const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+
+ for(unsigned int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
+ {
+ Test::IntS s;
+ for(int i = 0; i < lengths[l]; ++i)
+ {
+ s.push_back(i);
+ }
+ CallbackPtr cb = new Callback;
+ p->begin_opIntS(s,
+ [=](const Test::IntS& p1)
+ {
+ cb->opIntS(p1);
+ },
+ [=](const Ice::Exception& ex)
+ {
+ cb->exCB(ex);
+ });
+ cb->check();
+ }
+ }
+
+ {
+ Ice::Double d = 1278312346.0 / 13.0;
+ Test::DoubleS ds(5, d);
+ CallbackPtr cb = new Callback;
+ p->begin_opDoubleMarshaling(d, ds,
+ [=](){ cb->opDoubleMarshaling(); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ Test::Callback_MyClass_opIdempotentPtr callback =
+ Test::newCallback_MyClass_opIdempotent(cb, &Callback::opIdempotent, &Callback::exCB);
+ p->begin_opIdempotent([=](){ cb->opIdempotent(); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ CallbackPtr cb = new Callback;
+ p->begin_opNonmutating([=](){ cb->opNonmutating(); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+
+ {
+ Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(p);
+ test(derived);
+ CallbackPtr cb = new Callback;
+ derived->begin_opDerived([=](){ cb->opDerived(); },
+ [=](const Ice::Exception& ex){ cb->exCB(ex); });
+ cb->check();
+ }
+#endif
}