diff options
Diffstat (limited to 'csharp/test/Ice/exceptions/Collocated.cs')
-rw-r--r-- | csharp/test/Ice/exceptions/Collocated.cs | 65 |
1 files changed, 18 insertions, 47 deletions
diff --git a/csharp/test/Ice/exceptions/Collocated.cs b/csharp/test/Ice/exceptions/Collocated.cs index dadf775a670..c9788d0d4f3 100644 --- a/csharp/test/Ice/exceptions/Collocated.cs +++ b/csharp/test/Ice/exceptions/Collocated.cs @@ -8,7 +8,6 @@ // ********************************************************************** using System; -using System.Diagnostics; using System.Reflection; [assembly: CLSCompliant(true)] @@ -17,59 +16,31 @@ using System.Reflection; [assembly: AssemblyDescription("Ice test")] [assembly: AssemblyCompany("ZeroC, Inc.")] -public class Collocated +public class Collocated : TestCommon.Application { - private static int run(string[] args, Ice.Communicator communicator) + public override int run(string[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object obj = new ThrowerI(); - adapter.add(obj, communicator.stringToIdentity("thrower")); - AllTests.allTests(communicator); + adapter.add(obj, Ice.Util.stringToIdentity("thrower")); + AllTests.allTests(this); 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(); -#if COMPACT - // - // When using Ice for .NET Compact Framework, we need to specify - // the assembly so that Ice can locate classes and exceptions. - // - initData.properties.setProperty("Ice.FactoryAssemblies", "collocated"); -#endif - - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(System.Exception ex) - { - System.Console.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - System.Console.WriteLine(ex); - status = 1; - } - } + Ice.InitializationData initData = base.getInitData(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); + initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max + return initData; + } - return status; + public static int Main(string[] args) + { + Collocated app = new Collocated(); + return app.runmain(args); } } |