diff options
Diffstat (limited to 'cpp/test/Ice/interceptor/AMDInterceptorI.cpp')
-rw-r--r-- | cpp/test/Ice/interceptor/AMDInterceptorI.cpp | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp index 33cfb5e0b38..158cf2736fa 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp @@ -4,7 +4,7 @@ #include <IceUtil/DisableWarnings.h> #include <AMDInterceptorI.h> -#include <Test.h> +#include <MyObjectI.h> #include <TestHelper.h> using namespace std; @@ -56,6 +56,24 @@ AMDInterceptorI::dispatch(Ice::Request& request) #endif Ice::Current& current = const_cast<Ice::Current&>(request.getCurrent()); + + Ice::Context::const_iterator p = current.ctx.find("raiseBeforeDispatch"); + if(p != current.ctx.end()) + { + if(p->second == "user") + { + throw Test::InvalidInputException(); + } + else if(p->second == "notExist") + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + else if(p->second == "system") + { + throw MySystemException(__FILE__, __LINE__); + } + } + _lastOperation = current.operation; if(_lastOperation == "amdAddWithRetry") @@ -85,6 +103,15 @@ AMDInterceptorI::dispatch(Ice::Request& request) current.ctx["retry"] = "no"; } + else if(current.ctx.find("retry") != current.ctx.end() && current.ctx["retry"] == "yes") + { + // + // Retry the dispatch to ensure that abandoning the result of the dispatch + // works fine and is thread-safe + // + _servant->ice_dispatch(request); + _servant->ice_dispatch(request); + } #ifdef ICE_CPP11_MAPPING _lastStatus = _servant->ice_dispatch(request, []() { return true; }, [this](exception_ptr ex) { @@ -105,6 +132,24 @@ AMDInterceptorI::dispatch(Ice::Request& request) #else _lastStatus = _servant->ice_dispatch(request, _defaultCb); #endif + + p = current.ctx.find("raiseAfterDispatch"); + if(p != current.ctx.end()) + { + if(p->second == "user") + { + throw Test::InvalidInputException(); + } + else if(p->second == "notExist") + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + else if(p->second == "system") + { + throw MySystemException(__FILE__, __LINE__); + } + } + return _lastStatus; } |