summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2018-11-13 15:52:14 -0500
committerBernard Normier <bernard@zeroc.com>2018-11-13 15:52:14 -0500
commita5854cfd05fa6aa5b7cc50ecbfcc9336fb32412c (patch)
tree58b9f74f2132985fe15913f1a7f65e82121b8eba /cpp/test
parentFix failure related to Slice Scanner fixes (diff)
downloadice-a5854cfd05fa6aa5b7cc50ecbfcc9336fb32412c.tar.bz2
ice-a5854cfd05fa6aa5b7cc50ecbfcc9336fb32412c.tar.xz
ice-a5854cfd05fa6aa5b7cc50ecbfcc9336fb32412c.zip
More bidir tests. Fixes #51.
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Ice/ami/AllTests.cpp56
-rw-r--r--cpp/test/Ice/ami/Test.ice2
-rw-r--r--cpp/test/Ice/ami/TestI.cpp10
-rw-r--r--cpp/test/Ice/ami/TestI.h2
4 files changed, 66 insertions, 4 deletions
diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp
index f1de69154ef..47aebe2ecf5 100644
--- a/cpp/test/Ice/ami/AllTests.cpp
+++ b/cpp/test/Ice/ami/AllTests.cpp
@@ -17,6 +17,30 @@ using namespace std;
namespace
{
+class PingReplyI : public Test::PingReply
+{
+public:
+ PingReplyI() :
+ _received(false)
+ {
+ }
+
+ virtual void reply(const Ice::Current&)
+ {
+ _received = true;
+ }
+
+ bool checkReceived()
+ {
+ return _received;
+ }
+
+private:
+ bool _received;
+};
+
+ICE_DEFINE_PTR(PingReplyIPtr, PingReplyI);
+
enum ThrowType { LocalException, UserException, StandardException, OtherException };
#ifdef ICE_CPP11_MAPPING
@@ -2418,6 +2442,22 @@ allTests(Test::TestHelper* helper, bool collocated)
cout << "ok" << endl;
}
+ if(p->ice_getConnection())
+ {
+ cout << "testing bidir... " << flush;
+ auto adapter = communicator->createObjectAdapter("");
+ auto replyI = make_shared<PingReplyI>();
+ auto reply = Ice::uncheckedCast<Test::PingReplyPrx>(adapter->addWithUUID(replyI));
+ adapter->activate();
+
+ p->ice_getConnection()->setAdapter(adapter);
+ p->pingBiDir(reply);
+ test(replyI->checkReceived());
+ adapter->destroy();
+
+ cout << "ok" << endl;
+ }
+
p->shutdown();
#else
@@ -4085,6 +4125,22 @@ allTests(Test::TestHelper* helper, bool collocated)
cout << "ok" << endl;
}
+ if(p->ice_getConnection())
+ {
+ cout << "testing bidir... " << flush;
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("");
+ PingReplyIPtr replyI = new PingReplyI();
+ Test::PingReplyPrx reply = Test::PingReplyPrx::uncheckedCast(adapter->addWithUUID(replyI));
+ adapter->activate();
+
+ p->ice_getConnection()->setAdapter(adapter);
+ p->pingBiDir(reply);
+ test(replyI->checkReceived());
+ adapter->destroy();
+
+ cout << "ok" << endl;
+ }
+
p->shutdown();
#endif
}
diff --git a/cpp/test/Ice/ami/Test.ice b/cpp/test/Ice/ami/Test.ice
index f940a2229cb..1373db16510 100644
--- a/cpp/test/Ice/ami/Test.ice
+++ b/cpp/test/Ice/ami/Test.ice
@@ -55,7 +55,7 @@ interface TestIntf
bool supportsAMD();
bool supportsFunctionalTests();
- void pingBiDir(Ice::Identity id);
+ void pingBiDir(PingReply* reply);
}
interface TestIntfController
diff --git a/cpp/test/Ice/ami/TestI.cpp b/cpp/test/Ice/ami/TestI.cpp
index 0e3f5f9bed6..587b9d45ed0 100644
--- a/cpp/test/Ice/ami/TestI.cpp
+++ b/cpp/test/Ice/ami/TestI.cpp
@@ -193,9 +193,15 @@ TestIntfI::supportsFunctionalTests(const Ice::Current&)
}
void
-TestIntfI::pingBiDir(ICE_IN(Ice::Identity) id, const Ice::Current& current)
+TestIntfI::pingBiDir(ICE_IN(Test::PingReplyPrxPtr) reply, const Ice::Current& current)
{
- ICE_UNCHECKED_CAST(Test::PingReplyPrx, current.con->createProxy(id))->reply();
+#ifdef ICE_CPP11_MAPPING
+ reply->ice_fixed(current.con)->replyAsync().get();
+#else
+ Test::PingReplyPrx fprx = reply->ice_fixed(current.con);
+ Ice::AsyncResultPtr result = fprx->begin_reply();
+ fprx->end_reply(result);
+#endif
}
void
diff --git a/cpp/test/Ice/ami/TestI.h b/cpp/test/Ice/ami/TestI.h
index 558d7b325df..c82f0b28ecc 100644
--- a/cpp/test/Ice/ami/TestI.h
+++ b/cpp/test/Ice/ami/TestI.h
@@ -46,7 +46,7 @@ public:
virtual bool supportsAMD(const Ice::Current&);
virtual bool supportsFunctionalTests(const Ice::Current&);
- virtual void pingBiDir(ICE_IN(Ice::Identity), const Ice::Current&);
+ virtual void pingBiDir(ICE_IN(Test::PingReplyPrxPtr), const Ice::Current&);
private: