summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/ami/TestI.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/test/Ice/ami/TestI.cs')
-rw-r--r--csharp/test/Ice/ami/TestI.cs87
1 files changed, 84 insertions, 3 deletions
diff --git a/csharp/test/Ice/ami/TestI.cs b/csharp/test/Ice/ami/TestI.cs
index 30c281984e3..5c7431abfcc 100644
--- a/csharp/test/Ice/ami/TestI.cs
+++ b/csharp/test/Ice/ami/TestI.cs
@@ -7,11 +7,24 @@
//
// **********************************************************************
-using Test;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
using System.Threading;
+using System.Threading.Tasks;
+using Test;
public class TestI : TestIntfDisp_
{
+ protected static void test(bool b)
+ {
+ if(!b)
+ {
+ Debug.Assert(false);
+ throw new Exception();
+ }
+ }
+
public TestI()
{
}
@@ -73,9 +86,15 @@ public class TestI : TestIntfDisp_
}
override public void
- close(bool force, Ice.Current current)
+ close(CloseMode mode, Ice.Current current)
+ {
+ current.con.close((Ice.ConnectionClose)((int)mode));
+ }
+
+ override public void
+ sleep(int ms, Ice.Current current)
{
- current.con.close(force);
+ Thread.Sleep(ms);
}
override public void
@@ -85,12 +104,74 @@ public class TestI : TestIntfDisp_
}
override public bool
+ supportsAMD(Ice.Current current)
+ {
+ return true;
+ }
+
+ override public bool
supportsFunctionalTests(Ice.Current current)
{
return false;
}
+ override public async Task
+ opAsyncDispatchAsync(Ice.Current current)
+ {
+ await System.Threading.Tasks.Task.Delay(10);
+ }
+
+ override public async Task<int>
+ opWithResultAsyncDispatchAsync(Ice.Current current)
+ {
+ await System.Threading.Tasks.Task.Delay(10);
+ test(Thread.CurrentThread.Name.Contains("Ice.ThreadPool.Server"));
+ var r = await self(current).opWithResultAsync();
+ test(Thread.CurrentThread.Name.Contains("Ice.ThreadPool.Server"));
+ return r;
+ }
+
+ override public async Task
+ opWithUEAsyncDispatchAsync(Ice.Current current)
+ {
+ test(Thread.CurrentThread.Name.Contains("Ice.ThreadPool.Server"));
+ await System.Threading.Tasks.Task.Delay(10);
+ test(Thread.CurrentThread.Name.Contains("Ice.ThreadPool.Server"));
+ await self(current).opWithUEAsync();
+ }
+
+ TestIntfPrx
+ self(Ice.Current current)
+ {
+ return TestIntfPrxHelper.uncheckedCast(current.adapter.createProxy(current.id));
+ }
+
+ override public Task
+ startDispatchAsync(Ice.Current current)
+ {
+ lock(this)
+ {
+ TaskCompletionSource<object> t = new TaskCompletionSource<object>();
+ _pending.Add(t);
+ return t.Task;
+ }
+ }
+
+ override public void
+ finishDispatch(Ice.Current current)
+ {
+ lock(this)
+ {
+ foreach(TaskCompletionSource<object> t in _pending)
+ {
+ t.SetResult(null);
+ }
+ }
+ _pending.Clear();
+ }
+
private int _batchCount;
+ private List<TaskCompletionSource<object>> _pending = new List<TaskCompletionSource<object>>();
}
public class TestControllerI : TestIntfControllerDisp_