summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/operations/Server.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/test/Ice/operations/Server.cs')
-rw-r--r--csharp/test/Ice/operations/Server.cs65
1 files changed, 21 insertions, 44 deletions
diff --git a/csharp/test/Ice/operations/Server.cs b/csharp/test/Ice/operations/Server.cs
index 1ad97f78f75..c50a2549772 100644
--- a/csharp/test/Ice/operations/Server.cs
+++ b/csharp/test/Ice/operations/Server.cs
@@ -8,7 +8,6 @@
// **********************************************************************
using System;
-using System.Diagnostics;
using System.Reflection;
[assembly: CLSCompliant(true)]
@@ -17,61 +16,39 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
//
// We don't want connection warnings because of the timeout test.
//
- communicator.getProperties().setProperty("Ice.Warn.Connections", "0");
+ communicator().getProperties().setProperty("Ice.Warn.Connections", "0");
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- //
- // Its possible to have batch oneway requests dispatched
- // after the adapter is deactivated due to thread
- // scheduling so we supress this warning.
- //
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ //
+ // Its possible to have batch oneway requests dispatched
+ // after the adapter is deactivated due to thread
+ // scheduling so we supress this warning.
+ //
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}