diff options
Diffstat (limited to 'cpp/test')
-rw-r--r-- | cpp/test/Ice/dispatcher/AllTests.cpp | 21 | ||||
-rw-r--r-- | cpp/test/Ice/dispatcher/Test.ice | 1 | ||||
-rw-r--r-- | cpp/test/Ice/dispatcher/TestI.cpp | 7 | ||||
-rw-r--r-- | cpp/test/Ice/dispatcher/TestI.h | 1 |
4 files changed, 30 insertions, 0 deletions
diff --git a/cpp/test/Ice/dispatcher/AllTests.cpp b/cpp/test/Ice/dispatcher/AllTests.cpp index 7e82afcf37d..a4a7cc25c5c 100644 --- a/cpp/test/Ice/dispatcher/AllTests.cpp +++ b/cpp/test/Ice/dispatcher/AllTests.cpp @@ -52,6 +52,18 @@ public: called(); } + void responseEx() + { + test(false); + } + + void exceptionEx(const ::Ice::Exception& ex) + { + test(dynamic_cast<const Ice::InvocationTimeoutException*>(&ex)); + test(Dispatcher::isDispatcherThread()); + called(); + } + void payload() { @@ -123,6 +135,15 @@ allTests(const Ice::CommunicatorPtr& communicator) i->begin_op(callback); cb->check(); + { + // + // Expect InvocationTimeoutException. + // + Test::TestIntfPrx to = p->ice_invocationTimeout(250); + to->begin_sleep(500, Test::newCallback_TestIntf_sleep(cb, &Callback::responseEx, &Callback::exceptionEx)); + cb->check(); + } + testController->holdAdapter(); Test::Callback_TestIntf_opWithPayloadPtr callback2 = diff --git a/cpp/test/Ice/dispatcher/Test.ice b/cpp/test/Ice/dispatcher/Test.ice index 857acae24a9..0379b4c7f4c 100644 --- a/cpp/test/Ice/dispatcher/Test.ice +++ b/cpp/test/Ice/dispatcher/Test.ice @@ -18,6 +18,7 @@ module Test interface TestIntf { void op(); + void sleep(int to); void opWithPayload(Ice::ByteSeq seq); void shutdown(); }; diff --git a/cpp/test/Ice/dispatcher/TestI.cpp b/cpp/test/Ice/dispatcher/TestI.cpp index 2a56d659f82..9140fc55fb0 100644 --- a/cpp/test/Ice/dispatcher/TestI.cpp +++ b/cpp/test/Ice/dispatcher/TestI.cpp @@ -11,6 +11,7 @@ #include <Ice/Ice.h> #include <Dispatcher.h> #include <TestCommon.h> +#include <IceUtil/Thread.h> using namespace std; @@ -21,6 +22,12 @@ TestIntfI::op(const Ice::Current&) } void +TestIntfI::sleep(Ice::Int to, const Ice::Current&) +{ + IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(to)); +} + +void TestIntfI::opWithPayload(const Ice::ByteSeq&, const Ice::Current&) { test(Dispatcher::isDispatcherThread()); diff --git a/cpp/test/Ice/dispatcher/TestI.h b/cpp/test/Ice/dispatcher/TestI.h index 99c64dd20d1..228a2842753 100644 --- a/cpp/test/Ice/dispatcher/TestI.h +++ b/cpp/test/Ice/dispatcher/TestI.h @@ -20,6 +20,7 @@ class TestIntfI : virtual public Test::TestIntf public: virtual void op(const Ice::Current&); + virtual void sleep(Ice::Int, const Ice::Current&); virtual void opWithPayload(const Ice::ByteSeq&, const Ice::Current&); virtual void shutdown(const Ice::Current&); }; |