diff options
Diffstat (limited to 'csharp/test/Ice/exceptions/AllTests.cs')
-rw-r--r-- | csharp/test/Ice/exceptions/AllTests.cs | 84 |
1 files changed, 24 insertions, 60 deletions
diff --git a/csharp/test/Ice/exceptions/AllTests.cs b/csharp/test/Ice/exceptions/AllTests.cs index c7d595627a0..b0e7b109849 100644 --- a/csharp/test/Ice/exceptions/AllTests.cs +++ b/csharp/test/Ice/exceptions/AllTests.cs @@ -12,19 +12,7 @@ using System.Diagnostics; using System.Threading; using Test; -#if SILVERLIGHT -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; -#endif - -public class AllTests : TestCommon.TestApp +public class AllTests : TestCommon.AllTests { private class Callback { @@ -39,7 +27,7 @@ public class AllTests : TestCommon.TestApp { while(!_called) { - System.Threading.Monitor.Wait(this); + Monitor.Wait(this); } _called = false; @@ -52,36 +40,17 @@ public class AllTests : TestCommon.TestApp { Debug.Assert(!_called); _called = true; - System.Threading.Monitor.Pulse(this); + Monitor.Pulse(this); } } private bool _called; } -#if SILVERLIGHT - public override Ice.InitializationData initData() - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(); - WriteLine("setting Ice.FactoryAssemblies"); - initData.properties.setProperty("Ice.FactoryAssemblies", "exceptions,version=1.0.0.0"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - return initData; - } - override - public void run(Ice.Communicator communicator) -#else - public static ThrowerPrx allTests(Ice.Communicator communicator) -#endif + public static ThrowerPrx allTests(TestCommon.Application app) { -#if SILVERLIGHT - WriteLine("Ice.FactoryAssemblies: " + communicator.getProperties().getProperty("Ice.FactoryAssemblies")); -#endif - -#if !SILVERLIGHT + Ice.Communicator communicator = app.communicator(); { Write("testing object adapter registration exceptions... "); Ice.ObjectAdapter first; @@ -130,10 +99,10 @@ public class AllTests : TestCommon.TestApp communicator.getProperties().setProperty("TestAdapter1.Endpoints", "default"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1"); Ice.Object obj = new EmptyI(); - adapter.add(obj, communicator.stringToIdentity("x")); + adapter.add(obj, Ice.Util.stringToIdentity("x")); try { - adapter.add(obj, communicator.stringToIdentity("x")); + adapter.add(obj, Ice.Util.stringToIdentity("x")); test(false); } catch(Ice.AlreadyRegisteredException) @@ -142,7 +111,7 @@ public class AllTests : TestCommon.TestApp try { - adapter.add(obj, communicator.stringToIdentity("")); + adapter.add(obj, Ice.Util.stringToIdentity("")); test(false); } catch(Ice.IllegalIdentityException e) @@ -152,17 +121,17 @@ public class AllTests : TestCommon.TestApp try { - adapter.add(null, communicator.stringToIdentity("x")); + adapter.add(null, Ice.Util.stringToIdentity("x")); test(false); } catch(Ice.IllegalServantException) { } - adapter.remove(communicator.stringToIdentity("x")); + adapter.remove(Ice.Util.stringToIdentity("x")); try { - adapter.remove(communicator.stringToIdentity("x")); + adapter.remove(Ice.Util.stringToIdentity("x")); test(false); } catch(Ice.NotRegisteredException) @@ -190,14 +159,13 @@ public class AllTests : TestCommon.TestApp adapter.deactivate(); WriteLine("ok"); } -#endif + { Write("testing object factory registration exception... "); - Ice.ObjectFactory of = new ObjectFactoryI(); - communicator.addObjectFactory(of, "::x"); + communicator.getValueFactoryManager().add( _ => { return null; }, "::x"); try { - communicator.addObjectFactory(of, "::x"); + communicator.getValueFactoryManager().add( _ => { return null; }, "::x"); test(false); } catch(Ice.AlreadyRegisteredException) @@ -208,7 +176,7 @@ public class AllTests : TestCommon.TestApp Write("testing stringToProxy... "); Flush(); - String @ref = "thrower:default -p 12010"; + String @ref = "thrower:" + app.getTestEndpoint(0); Ice.ObjectPrx @base = communicator.stringToProxy(@ref); test(@base != null); WriteLine("ok"); @@ -233,8 +201,9 @@ public class AllTests : TestCommon.TestApp { test(ex.aMem == 1); } - catch(Exception) + catch(Exception ex) { + System.Console.WriteLine(ex); test(false); } @@ -254,7 +223,7 @@ public class AllTests : TestCommon.TestApp try { - thrower.throwAorDasAorD(- 1); + thrower.throwAorDasAorD(-1); test(false); } catch(D ex) @@ -463,7 +432,7 @@ public class AllTests : TestCommon.TestApp } ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast( - communicator.stringToProxy("thrower:default -p 12011")); + communicator.stringToProxy("thrower:" + app.getTestEndpoint(1))); try { thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits) @@ -472,7 +441,7 @@ public class AllTests : TestCommon.TestApp { } ThrowerPrx thrower3 = ThrowerPrxHelper.uncheckedCast( - communicator.stringToProxy("thrower:default -p 12012")); + communicator.stringToProxy("thrower:" + app.getTestEndpoint(2))); try { thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit @@ -489,7 +458,7 @@ public class AllTests : TestCommon.TestApp Flush(); { - Ice.Identity id = communicator.stringToIdentity("does not exist"); + Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); try { ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); @@ -674,7 +643,7 @@ public class AllTests : TestCommon.TestApp { test(false); } - cb.called(); + cb.called(); }); cb.check(); } @@ -941,7 +910,7 @@ public class AllTests : TestCommon.TestApp Flush(); { - Ice.Identity id = communicator.stringToIdentity("does not exist"); + Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); Callback cb = new Callback(); thrower2.begin_throwAasA(1).whenCompleted( @@ -1125,7 +1094,6 @@ public class AllTests : TestCommon.TestApp WriteLine("ok"); - // ---------------------------------------- if(thrower.supportsUndeclaredExceptions()) { Write("catching unknown user exception with new AMI mapping... "); @@ -1213,7 +1181,7 @@ public class AllTests : TestCommon.TestApp Flush(); { - Ice.Identity id = communicator.stringToIdentity("does not exist"); + Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); Callback cb = new Callback(); thrower2.begin_throwAasA(1).whenCompleted( @@ -1396,10 +1364,6 @@ public class AllTests : TestCommon.TestApp } WriteLine("ok"); -#if SILVERLIGHT - thrower.shutdown(); -#else return thrower; -#endif } } |