diff options
Diffstat (limited to 'csharp/test')
-rw-r--r-- | csharp/test/Ice/ami/AllTests.cs | 40 | ||||
-rw-r--r-- | csharp/test/Ice/ami/Test.ice | 2 | ||||
-rw-r--r-- | csharp/test/Ice/ami/TestI.cs | 13 |
3 files changed, 15 insertions, 40 deletions
diff --git a/csharp/test/Ice/ami/AllTests.cs b/csharp/test/Ice/ami/AllTests.cs index c6defebb78c..81629acfcf4 100644 --- a/csharp/test/Ice/ami/AllTests.cs +++ b/csharp/test/Ice/ami/AllTests.cs @@ -23,43 +23,15 @@ namespace Ice { public override void reply(Ice.Current current) { - lock(this) - { - ++_replies; - Monitor.Pulse(this); - } - } - - public void reset() - { - lock(this) - { - _replies = 0; - } + _received = true; } - public bool waitReply(int expectedReplies, long timeout) + public bool checkReceived() { - lock(this) - { - long end = IceInternal.Time.currentMonotonicTimeMillis() + timeout; - while(_replies < expectedReplies) - { - int delay =(int)(end - IceInternal.Time.currentMonotonicTimeMillis()); - if(delay > 0) - { - Monitor.Wait(this, delay); - } - else - { - break; - } - } - return _replies == expectedReplies; - } + return _received; } - private int _replies = 0; + private bool _received = false; } private class Cookie @@ -3854,8 +3826,8 @@ namespace Ice adapter.activate(); p.ice_getConnection().setAdapter(adapter); - p.pingBiDir(reply.ice_getIdentity()); - replyI.waitReply(1, 100); + p.pingBiDir(reply); + test(replyI.checkReceived()); adapter.destroy(); } } diff --git a/csharp/test/Ice/ami/Test.ice b/csharp/test/Ice/ami/Test.ice index 3c36f84e5cc..b25dce15b40 100644 --- a/csharp/test/Ice/ami/Test.ice +++ b/csharp/test/Ice/ami/Test.ice @@ -56,7 +56,7 @@ interface TestIntf ["amd"] void opWithUEAsyncDispatch() throws TestIntfException; - void pingBiDir(Ice::Identity id); + void pingBiDir(PingReply* reply); } interface TestIntfController diff --git a/csharp/test/Ice/ami/TestI.cs b/csharp/test/Ice/ami/TestI.cs index 1bbc34e6f84..53831e4cefd 100644 --- a/csharp/test/Ice/ami/TestI.cs +++ b/csharp/test/Ice/ami/TestI.cs @@ -152,15 +152,18 @@ namespace Ice } override public void - pingBiDir(Ice.Identity id, Ice.Current current) + pingBiDir(Test.PingReplyPrx reply, Ice.Current current) { - var p = Test.PingReplyPrxHelper.uncheckedCast(current.con.createProxy(id)); - p.replyAsync().ContinueWith( + reply = Test.PingReplyPrxHelper.uncheckedCast(reply.ice_fixed(current.con)); + Thread dispatchThread = Thread.CurrentThread; + reply.replyAsync().ContinueWith( (t) => { - test(Thread.CurrentThread.Name.Contains("Ice.ThreadPool.Server")); + Thread callbackThread = Thread.CurrentThread; + test(dispatchThread != callbackThread); + test(callbackThread.Name.Contains("Ice.ThreadPool.Server")); }, - p.ice_scheduler()).Wait(); + reply.ice_scheduler()).Wait(); } Test.TestIntfPrx |