summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/ami/TestI.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2017-02-09 16:31:31 -0800
committerMark Spruiell <mes@zeroc.com>2017-02-09 16:31:31 -0800
commitaf409fe78bdca7db6315ab0cc99ad063f8daecf7 (patch)
treeb0079f556247a14f43e77ca6a31cb42df019485b /cpp/test/Ice/ami/TestI.cpp
parentFixed enum-related warnings (diff)
downloadice-af409fe78bdca7db6315ab0cc99ad063f8daecf7.tar.bz2
ice-af409fe78bdca7db6315ab0cc99ad063f8daecf7.tar.xz
ice-af409fe78bdca7db6315ab0cc99ad063f8daecf7.zip
ICE-7560 - more AMI test fixes, renaming ConnectionClose enumerators
Diffstat (limited to 'cpp/test/Ice/ami/TestI.cpp')
-rw-r--r--cpp/test/Ice/ami/TestI.cpp57
1 files changed, 56 insertions, 1 deletions
diff --git a/cpp/test/Ice/ami/TestI.cpp b/cpp/test/Ice/ami/TestI.cpp
index d7aa1d44762..b52678a590e 100644
--- a/cpp/test/Ice/ami/TestI.cpp
+++ b/cpp/test/Ice/ami/TestI.cpp
@@ -105,13 +105,69 @@ TestIntfI::sleep(Ice::Int ms, const Ice::Current& current)
timedWait(IceUtil::Time::milliSeconds(ms));
}
+#ifdef ICE_CPP11_MAPPING
+void
+TestIntfI::startDispatchAsync(std::function<void()> response, std::function<void(std::exception_ptr)> ex,
+ const Ice::Current&)
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _pending.push_back(move(response));
+}
+#else
+void
+TestIntfI::startDispatch_async(const Test::AMD_TestIntf_startDispatchPtr& cb, const Ice::Current&)
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ _pending.push_back(cb);
+}
+#endif
+
+void
+TestIntfI::finishDispatch(const Ice::Current& current)
+{
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+#ifdef ICE_CPP11_MAPPING
+ for(vector<function<void()>>::iterator p = _pending.begin(); p != _pending.end(); ++p)
+ {
+ (*p)();
+ }
+#else
+ for(vector<Test::AMD_TestIntf_startDispatchPtr>::iterator p = _pending.begin(); p != _pending.end(); ++p)
+ {
+ (*p)->ice_response();
+ }
+#endif
+ _pending.clear();
+}
+
void
TestIntfI::shutdown(const Ice::Current& current)
{
+ //
+ // Just in case a request arrived late.
+ //
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+#ifdef ICE_CPP11_MAPPING
+ for(vector<function<void()>>::iterator p = _pending.begin(); p != _pending.end(); ++p)
+ {
+ (*p)();
+ }
+#else
+ for(vector<Test::AMD_TestIntf_startDispatchPtr>::iterator p = _pending.begin(); p != _pending.end(); ++p)
+ {
+ (*p)->ice_response();
+ }
+#endif
current.adapter->getCommunicator()->shutdown();
}
bool
+TestIntfI::supportsAMD(const Ice::Current&)
+{
+ return true;
+}
+
+bool
TestIntfI::supportsFunctionalTests(const Ice::Current&)
{
return false;
@@ -132,4 +188,3 @@ TestIntfControllerI::resumeAdapter(const Ice::Current&)
TestIntfControllerI::TestIntfControllerI(const Ice::ObjectAdapterPtr& adapter) : _adapter(adapter)
{
}
-