diff options
author | Benoit Foucher <benoit@zeroc.com> | 2019-07-11 17:42:59 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2019-07-11 17:42:59 +0200 |
commit | bcd2c2d1b01e721be924b96247be86384ddc9738 (patch) | |
tree | 7b84ec6832dc13c548fe7d3c7098675c61bb06ec /csharp/test/Ice/interceptor/Client.cs | |
parent | Fix .gitignore syntax (diff) | |
download | ice-bcd2c2d1b01e721be924b96247be86384ddc9738.tar.bz2 ice-bcd2c2d1b01e721be924b96247be86384ddc9738.tar.xz ice-bcd2c2d1b01e721be924b96247be86384ddc9738.zip |
Fixed dispatcher interceptor bug #435
Diffstat (limited to 'csharp/test/Ice/interceptor/Client.cs')
-rw-r--r-- | csharp/test/Ice/interceptor/Client.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/csharp/test/Ice/interceptor/Client.cs b/csharp/test/Ice/interceptor/Client.cs index a459ee8fb65..6c8b59cfd52 100644 --- a/csharp/test/Ice/interceptor/Client.cs +++ b/csharp/test/Ice/interceptor/Client.cs @@ -3,6 +3,7 @@ // using System; +using System.Collections.Generic; using Test; namespace Ice @@ -89,6 +90,11 @@ namespace Ice test(interceptor.getLastOperation().Equals("badSystemAdd")); test(!interceptor.getLastStatus()); output.WriteLine("ok"); + + output.Write("testing exceptions raised by the interceptor... "); + output.Flush(); + testInterceptorExceptions(prx); + output.WriteLine("ok"); } private void runAmdTest(Test.MyObjectPrx prx, InterceptorI interceptor) @@ -163,6 +169,11 @@ namespace Ice test(interceptor.getLastOperation().Equals("amdBadSystemAdd")); test(interceptor.getLastStatus()); output.WriteLine("ok"); + + output.Write("testing exceptions raised by the interceptor... "); + output.Flush(); + testInterceptorExceptions(prx); + output.WriteLine("ok"); } public override void run(string[] args) @@ -206,6 +217,51 @@ namespace Ice { return TestDriver.runTest<Client>(args); } + + private void testInterceptorExceptions(Test.MyObjectPrx prx) + { + var exceptions = new List<Tuple<string, string>>(); + exceptions.Add(new Tuple<string, string>("raiseBeforeDispatch", "user")); + exceptions.Add(new Tuple<string, string>("raiseBeforeDispatch", "notExist")); + exceptions.Add(new Tuple<string, string>("raiseBeforeDispatch", "system")); + exceptions.Add(new Tuple<string, string>("raiseAfterDispatch", "user")); + exceptions.Add(new Tuple<string, string>("raiseAfterDispatch", "notExist")); + exceptions.Add(new Tuple<string, string>("raiseAfterDispatch", "system")); + foreach(var e in exceptions) + { + var ctx = new Dictionary<string, string>(); + ctx.Add(e.Item1, e.Item2); + try + { + prx.ice_ping(ctx); + test(false); + } + catch(Ice.UnknownUserException) + { + test(e.Item2.Equals("user")); + } + catch(Ice.ObjectNotExistException) + { + test(e.Item2.Equals("notExist")); + } + catch(Ice.UnknownException) + { + test(e.Item2.Equals("system")); // non-collocated + } + catch(MySystemException) + { + test(e.Item2.Equals("system")); // collocated + } + { + Ice.ObjectPrx batch = prx.ice_batchOneway(); + batch.ice_ping(ctx); + batch.ice_ping(); + batch.ice_flushBatchRequests(); + } + } + // Force the last batch request to be dispatched by the server thread using invocation timeouts + prx.ice_invocationTimeout(10000).ice_ping(); + } } } } |