diff options
Diffstat (limited to 'cs/test')
107 files changed, 5447 insertions, 5447 deletions
diff --git a/cs/test/Glacier2/attack/Client.cs b/cs/test/Glacier2/attack/Client.cs index 1bf3c0493c5..a79f9ab1124 100644 --- a/cs/test/Glacier2/attack/Client.cs +++ b/cs/test/Glacier2/attack/Client.cs @@ -16,97 +16,97 @@ public class Client : Ice.Application public override int run(string[] args) { Console.Out.Write("getting router... "); - Console.Out.Flush(); - Ice.ObjectPrx routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347 -t 10000"); - Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(routerBase); - test(router != null); - Console.Out.WriteLine("ok"); + Console.Out.Flush(); + Ice.ObjectPrx routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347 -t 10000"); + Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(routerBase); + test(router != null); + Console.Out.WriteLine("ok"); Console.Out.Write("creating session... "); - Console.Out.Flush(); - router.createSession("userid", "abc123"); - communicator().setDefaultRouter(router); - Console.Out.WriteLine("ok"); + Console.Out.Flush(); + router.createSession("userid", "abc123"); + communicator().setDefaultRouter(router); + Console.Out.WriteLine("ok"); Console.Out.Write("making thousands of invocations on proxies... "); - Console.Out.Flush(); - Ice.ObjectPrx backendBase = communicator().stringToProxy("dummy:tcp -p 12010 -t 10000"); - BackendPrx backend = BackendPrxHelper.uncheckedCast(backendBase); - backend.ice_ping(); - - Hashtable backends = new Hashtable(); - Random rand = new Random(unchecked((int)DateTime.Now.Ticks)); - - String msg = ""; - for(int i = 1; i <= 10000; ++i) - { - if(i % 100 == 0) - { - for(int j = 0; j < msg.Length; ++j) - { - Console.Out.Write('\b'); - } - - msg = "" + i; - Console.Out.Write(i); - Console.Out.Flush(); - } - - Ice.Identity ident = new Ice.Identity("", ""); - ident.name += (char)('A' + rand.Next() % 26); - - int len = rand.Next() % 2; - for(int j = 0; j < len; ++j) - { - ident.category += (char)('a' + rand.Next() % 26); - } - - BackendPrx newBackend = BackendPrxHelper.uncheckedCast(backendBase.ice_identity(ident)); - - if(!backends.ContainsKey(newBackend)) - { - backends.Add(newBackend, newBackend); - backend = newBackend; - } - else - { - backend = (BackendPrx)backends[newBackend]; - } - - backend.ice_ping(); - } - - for(int j = 0; j < msg.Length; ++j) - { - Console.Out.Write('\b'); - } - for(int j = 0; j < msg.Length; ++j) - { - Console.Out.Write(' '); - } - for(int j = 0; j < msg.Length; ++j) - { - Console.Out.Write('\b'); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing server and router shutdown... "); - Console.Out.Flush(); - backend.shutdown(); - communicator().setDefaultRouter(null); - Ice.ObjectPrx adminBase = communicator().stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12348 -t 10000"); - Glacier2.AdminPrx admin = Glacier2.AdminPrxHelper.checkedCast(adminBase); - test(admin != null); - admin.shutdown(); - try - { - admin.ice_ping(); - test(false); - } - catch(Ice.LocalException) - { - Console.Out.WriteLine("ok"); - } + Console.Out.Flush(); + Ice.ObjectPrx backendBase = communicator().stringToProxy("dummy:tcp -p 12010 -t 10000"); + BackendPrx backend = BackendPrxHelper.uncheckedCast(backendBase); + backend.ice_ping(); + + Hashtable backends = new Hashtable(); + Random rand = new Random(unchecked((int)DateTime.Now.Ticks)); + + String msg = ""; + for(int i = 1; i <= 10000; ++i) + { + if(i % 100 == 0) + { + for(int j = 0; j < msg.Length; ++j) + { + Console.Out.Write('\b'); + } + + msg = "" + i; + Console.Out.Write(i); + Console.Out.Flush(); + } + + Ice.Identity ident = new Ice.Identity("", ""); + ident.name += (char)('A' + rand.Next() % 26); + + int len = rand.Next() % 2; + for(int j = 0; j < len; ++j) + { + ident.category += (char)('a' + rand.Next() % 26); + } + + BackendPrx newBackend = BackendPrxHelper.uncheckedCast(backendBase.ice_identity(ident)); + + if(!backends.ContainsKey(newBackend)) + { + backends.Add(newBackend, newBackend); + backend = newBackend; + } + else + { + backend = (BackendPrx)backends[newBackend]; + } + + backend.ice_ping(); + } + + for(int j = 0; j < msg.Length; ++j) + { + Console.Out.Write('\b'); + } + for(int j = 0; j < msg.Length; ++j) + { + Console.Out.Write(' '); + } + for(int j = 0; j < msg.Length; ++j) + { + Console.Out.Write('\b'); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing server and router shutdown... "); + Console.Out.Flush(); + backend.shutdown(); + communicator().setDefaultRouter(null); + Ice.ObjectPrx adminBase = communicator().stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12348 -t 10000"); + Glacier2.AdminPrx admin = Glacier2.AdminPrxHelper.checkedCast(adminBase); + test(admin != null); + admin.shutdown(); + try + { + admin.ice_ping(); + test(false); + } + catch(Ice.LocalException) + { + Console.Out.WriteLine("ok"); + } return 0; } @@ -126,16 +126,16 @@ public class Client : Ice.Application // We want to check whether the client retries for evicted // proxies, even with regular retries disabled. // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); initData.properties.setProperty("Ice.RetryIntervals", "-1"); Client app = new Client(); int status = app.main(args, initData); - if(status != 0) - { - Environment.Exit(status); - } + if(status != 0) + { + Environment.Exit(status); + } } } diff --git a/cs/test/Glacier2/attack/Server.cs b/cs/test/Glacier2/attack/Server.cs index be1f6086e93..207bc029607 100644 --- a/cs/test/Glacier2/attack/Server.cs +++ b/cs/test/Glacier2/attack/Server.cs @@ -37,9 +37,9 @@ class Server : Ice.Application { public override int run(string[] args) { - communicator().getProperties().setProperty("Ice.OA.BackendAdapter.Endpoints", "tcp -p 12010 -t 10000"); + communicator().getProperties().setProperty("Ice.OA.BackendAdapter.Endpoints", "tcp -p 12010 -t 10000"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("BackendAdapter"); - adapter.addServantLocator(new ServantLocatorI(), ""); + adapter.addServantLocator(new ServantLocatorI(), ""); adapter.activate(); communicator().waitForShutdown(); return 0; @@ -48,10 +48,10 @@ class Server : Ice.Application public static void Main(string[] args) { Server app = new Server(); - int status = app.main(args); - if(status != 0) - { - System.Environment.Exit(status); - } + int status = app.main(args); + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Glacier2/attack/run.py b/cs/test/Glacier2/attack/run.py index 4ed3cf3ee75..400e7d2b3a8 100755 --- a/cs/test/Glacier2/attack/run.py +++ b/cs/test/Glacier2/attack/run.py @@ -29,7 +29,7 @@ ice_home = os.environ['ICE_HOME'] router = os.path.join(ice_home, "bin", "glacier2router") command = router + TestUtil.cppClientServerOptions + \ - r' --Ice.PrintProcessId' \ + r' --Ice.PrintProcessId' \ r' --Glacier2.RoutingTable.MaxSize=10' + \ r' --Ice.OA.Glacier2.Client.Endpoints="default -p 12347 -t 10000"' + \ r' --Ice.OA.Glacier2.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348 -t 10000"' + \ diff --git a/cs/test/Glacier2/router/Callback.ice b/cs/test/Glacier2/router/Callback.ice index 48504d83c1b..038602852b5 100644 --- a/cs/test/Glacier2/router/Callback.ice +++ b/cs/test/Glacier2/router/Callback.ice @@ -24,7 +24,7 @@ interface CallbackReceiver void callback(); void callbackEx() - throws CallbackException; + throws CallbackException; }; interface Callback @@ -32,7 +32,7 @@ interface Callback void initiateCallback(CallbackReceiver* proxy); void initiateCallbackEx(CallbackReceiver* proxy) - throws CallbackException; + throws CallbackException; void shutdown(); }; diff --git a/cs/test/Glacier2/router/CallbackI.cs b/cs/test/Glacier2/router/CallbackI.cs index 3805e09f207..2c18e90d7bf 100644 --- a/cs/test/Glacier2/router/CallbackI.cs +++ b/cs/test/Glacier2/router/CallbackI.cs @@ -19,7 +19,7 @@ public sealed class CallbackI : Test.CallbackDisp_ public override void initiateCallback(CallbackReceiverPrx proxy, Ice.Current current) { - proxy.callback(current.ctx); + proxy.callback(current.ctx); } public override void @@ -45,12 +45,12 @@ public sealed class CallbackReceiverI : CallbackReceiverDisp_ public override void callback(Ice.Current current) { - lock(this) - { - Debug.Assert(!_callback); - _callback = true; - System.Threading.Monitor.Pulse(this); - } + lock(this) + { + Debug.Assert(!_callback); + _callback = true; + System.Threading.Monitor.Pulse(this); + } } public override void @@ -66,20 +66,20 @@ public sealed class CallbackReceiverI : CallbackReceiverDisp_ public bool callbackOK() { - lock(this) - { - while(!_callback) - { - System.Threading.Monitor.Wait(this, 5000); - if(!_callback) - { - return false; - } - } - - _callback = false; - return true; - } + lock(this) + { + while(!_callback) + { + System.Threading.Monitor.Wait(this, 5000); + if(!_callback) + { + return false; + } + } + + _callback = false; + return true; + } } private bool _callback; diff --git a/cs/test/Glacier2/router/Client.cs b/cs/test/Glacier2/router/Client.cs index 194d67c8fcc..f4940bd3646 100644 --- a/cs/test/Glacier2/router/Client.cs +++ b/cs/test/Glacier2/router/Client.cs @@ -41,13 +41,13 @@ public class Client : Ice.Application Console.Out.WriteLine("ok"); } - { - Console.Out.Write("getting the session timeout... "); + { + Console.Out.Write("getting the session timeout... "); Console.Out.Flush(); - long timeout = router.getSessionTimeout(); - test(timeout == 30); + long timeout = router.getSessionTimeout(); + test(timeout == 30); Console.Out.WriteLine("ok"); - } + } Ice.ObjectPrx @base; @@ -72,7 +72,7 @@ public class Client : Ice.Application } catch(Ice.SocketException) { - test(false); + test(false); } } @@ -166,8 +166,8 @@ public class Client : Ice.Application { Console.Out.Write("creating and activating callback receiver adapter... "); - Console.Out.Flush(); - communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0"); + Console.Out.Flush(); + communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0"); adapter = communicator().createObjectAdapterWithRouter("CallbackReceiverAdapter", router); adapter.activate(); Console.Out.WriteLine("ok"); @@ -261,48 +261,48 @@ public class Client : Ice.Application } } - { - Console.Out.Write("testing whether other allowed category is accepted... "); + { + Console.Out.Write("testing whether other allowed category is accepted... "); Console.Out.Flush(); Ice.Context context = new Ice.Context(); context["_fwd"] = "t"; - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(communicator().stringToIdentity("c2/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - test(callbackReceiverImpl.callbackOK()); - Console.Out.WriteLine("ok"); - } - - { - Console.Out.Write("testing whether disallowed category gets rejected... "); + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(communicator().stringToIdentity("c2/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + test(callbackReceiverImpl.callbackOK()); + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("testing whether disallowed category gets rejected... "); Console.Out.Flush(); Ice.Context context = new Ice.Context(); context["_fwd"] = "t"; - try - { - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(communicator().stringToIdentity("c3/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - test(false); - } - catch(Ice.ObjectNotExistException) - { - Console.Out.WriteLine("ok"); - } - } - - { - Console.Out.Write("testing whether user-id as category is accepted... "); + try + { + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(communicator().stringToIdentity("c3/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + test(false); + } + catch(Ice.ObjectNotExistException) + { + Console.Out.WriteLine("ok"); + } + } + + { + Console.Out.Write("testing whether user-id as category is accepted... "); Console.Out.Flush(); Ice.Context context = new Ice.Context(); context["_fwd"] = "t"; - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(communicator().stringToIdentity("_userid/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - test(callbackReceiverImpl.callbackOK()); - Console.Out.WriteLine("ok"); - } - + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(communicator().stringToIdentity("_userid/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + test(callbackReceiverImpl.callbackOK()); + Console.Out.WriteLine("ok"); + } + { Console.Out.Write("testing server shutdown... "); Console.Out.Flush(); @@ -331,14 +331,14 @@ public class Client : Ice.Application try { router.destroySession(); - test(false); + test(false); + } + catch(Ice.ConnectionLostException) + { } - catch(Ice.ConnectionLostException) - { - } catch(Ice.LocalException) { - test(false); + test(false); } Console.Out.WriteLine("ok"); @@ -358,57 +358,57 @@ public class Client : Ice.Application } catch(Ice.SocketException) { - test(false); + test(false); } } - - if(args.Length >= 1 && args[0].Equals("--shutdown")) - { - { - Console.Out.Write("uninstalling router with communicator... "); - Console.Out.Flush(); - communicator().setDefaultRouter(null); - Console.Out.WriteLine("ok"); - } - - Ice.ObjectPrx adminBase; - - { - Console.Out.Write("testing stringToProxy for admin object... "); - adminBase = communicator().stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12348 -t 10000"); - Console.Out.WriteLine("ok"); - } - + + if(args.Length >= 1 && args[0].Equals("--shutdown")) + { + { + Console.Out.Write("uninstalling router with communicator... "); + Console.Out.Flush(); + communicator().setDefaultRouter(null); + Console.Out.WriteLine("ok"); + } + + Ice.ObjectPrx adminBase; + + { + Console.Out.Write("testing stringToProxy for admin object... "); + adminBase = communicator().stringToProxy("Glacier2/admin:tcp -h 127.0.0.1 -p 12348 -t 10000"); + Console.Out.WriteLine("ok"); + } + /* - { - Console.Out.Write("uninstalling router with admin object... "); - adminBase.ice_router(null); - Console.Out.WriteLine("ok"); - } + { + Console.Out.Write("uninstalling router with admin object... "); + adminBase.ice_router(null); + Console.Out.WriteLine("ok"); + } */ - - Glacier2.AdminPrx admin; - - { - Console.Out.Write("testing checked cast for admin object... "); - admin = Glacier2.AdminPrxHelper.checkedCast(adminBase); - test(admin != null); - Console.Out.WriteLine("ok"); - } - - Console.Out.Write("testing Glacier2 shutdown... "); - admin.shutdown(); - try - { - admin.ice_ping(); - test(false); - } - catch(Ice.LocalException) - { - Console.Out.WriteLine("ok"); - } - } - + + Glacier2.AdminPrx admin; + + { + Console.Out.Write("testing checked cast for admin object... "); + admin = Glacier2.AdminPrxHelper.checkedCast(adminBase); + test(admin != null); + Console.Out.WriteLine("ok"); + } + + Console.Out.Write("testing Glacier2 shutdown... "); + admin.shutdown(); + try + { + admin.ice_ping(); + test(false); + } + catch(Ice.LocalException) + { + Console.Out.WriteLine("ok"); + } + } + return 0; } @@ -417,29 +417,29 @@ public class Client : Ice.Application { if(!b) { - throw new Exception(); + throw new Exception(); } } public static void Main(string[] args) { - // - // We must disable connection warnings, because we attempt to - // ping the router before session establishment, as well as - // after session destruction. Both will cause a - // ConnectionLostException. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - - initData.properties.setProperty("Ice.Warn.Connections", "0"); + // + // We must disable connection warnings, because we attempt to + // ping the router before session establishment, as well as + // after session destruction. Both will cause a + // ConnectionLostException. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); + + initData.properties.setProperty("Ice.Warn.Connections", "0"); Client app = new Client(); int status = app.main(args, initData); - if(status != 0) - { - Environment.Exit(status); - } + if(status != 0) + { + Environment.Exit(status); + } } } diff --git a/cs/test/Glacier2/router/Server.cs b/cs/test/Glacier2/router/Server.cs index 62e7292283f..afdd0139453 100644 --- a/cs/test/Glacier2/router/Server.cs +++ b/cs/test/Glacier2/router/Server.cs @@ -13,16 +13,16 @@ public class Server : Ice.Application { public override int run(string[] args) { - communicator().getProperties().setProperty("Ice.OA.CallbackAdapter.Endpoints", "tcp -p 12010 -t 10000"); + communicator().getProperties().setProperty("Ice.OA.CallbackAdapter.Endpoints", "tcp -p 12010 -t 10000"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); - adapter.add(new CallbackI(), - communicator().stringToIdentity("c1/callback")); // The test allows "c1" as category. - adapter.add(new CallbackI(), - communicator().stringToIdentity("c2/callback")); // The test allows "c2" as category. - adapter.add(new CallbackI(), - communicator().stringToIdentity("c3/callback")); // The test rejects "c3" as category. - adapter.add(new CallbackI(), - communicator().stringToIdentity("_userid/callback")); // The test allows the prefixed userid. + adapter.add(new CallbackI(), + communicator().stringToIdentity("c1/callback")); // The test allows "c1" as category. + adapter.add(new CallbackI(), + communicator().stringToIdentity("c2/callback")); // The test allows "c2" as category. + adapter.add(new CallbackI(), + communicator().stringToIdentity("c3/callback")); // The test rejects "c3" as category. + adapter.add(new CallbackI(), + communicator().stringToIdentity("_userid/callback")); // The test allows the prefixed userid. adapter.activate(); communicator().waitForShutdown(); return 0; @@ -32,9 +32,9 @@ public class Server : Ice.Application { Server app = new Server(); int status = app.main(args); - if(status != 0) - { - Environment.Exit(status); - } + if(status != 0) + { + Environment.Exit(status); + } } } diff --git a/cs/test/Ice/adapterDeactivation/AllTests.cs b/cs/test/Ice/adapterDeactivation/AllTests.cs index fea30e2c60e..f72f5d2bf78 100755 --- a/cs/test/Ice/adapterDeactivation/AllTests.cs +++ b/cs/test/Ice/adapterDeactivation/AllTests.cs @@ -36,33 +36,33 @@ public class AllTests test(obj.Equals(@base)); Console.Out.WriteLine("ok"); - { - Console.Out.Write("creating/destroying/recreating object adapter... "); - Console.Out.Flush(); - Ice.ObjectAdapter adapter = - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); - try - { - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); - test(false); - } - catch(Ice.AlreadyRegisteredException) - { - } - adapter.destroy(); + { + Console.Out.Write("creating/destroying/recreating object adapter... "); + Console.Out.Flush(); + Ice.ObjectAdapter adapter = + communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + try + { + communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); + test(false); + } + catch(Ice.AlreadyRegisteredException) + { + } + adapter.destroy(); - // - // Use a different port than the first adapter to avoid an "address already in use" error. - // - adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); - adapter.destroy(); - Console.Out.WriteLine("ok"); - } + // + // Use a different port than the first adapter to avoid an "address already in use" error. + // + adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); + adapter.destroy(); + Console.Out.WriteLine("ok"); + } - Console.Out.Write("creating/activating/deactivating object adapter in one operation... "); - Console.Out.Flush(); - obj.transient(); - Console.Out.WriteLine("ok"); + Console.Out.Write("creating/activating/deactivating object adapter in one operation... "); + Console.Out.Flush(); + obj.transient(); + Console.Out.WriteLine("ok"); Console.Out.Write("deactivating object adapter in the server... "); Console.Out.Flush(); @@ -71,15 +71,15 @@ public class AllTests Console.Out.Write("testing whether server is gone... "); Console.Out.Flush(); - try - { - obj.ice_ping(); - throw new System.ApplicationException(); - } - catch(Ice.LocalException) - { - Console.Out.WriteLine("ok"); - } + try + { + obj.ice_ping(); + throw new System.ApplicationException(); + } + catch(Ice.LocalException) + { + Console.Out.WriteLine("ok"); + } return obj; } diff --git a/cs/test/Ice/adapterDeactivation/Client.cs b/cs/test/Ice/adapterDeactivation/Client.cs index ff6710bafd4..263a673833a 100755 --- a/cs/test/Ice/adapterDeactivation/Client.cs +++ b/cs/test/Ice/adapterDeactivation/Client.cs @@ -24,9 +24,9 @@ public class Client { TestClient app = new TestClient(); int result = app.main(args); - if(result != 0) - { - System.Environment.Exit(result); - } + if(result != 0) + { + System.Environment.Exit(result); + } } } diff --git a/cs/test/Ice/adapterDeactivation/Collocated.cs b/cs/test/Ice/adapterDeactivation/Collocated.cs index a8936406dea..15146178b54 100755 --- a/cs/test/Ice/adapterDeactivation/Collocated.cs +++ b/cs/test/Ice/adapterDeactivation/Collocated.cs @@ -15,14 +15,14 @@ public class Collocated { public override int run(string[] args) { - communicator().getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - Ice.ServantLocator locator = new ServantLocatorI(); - adapter.addServantLocator(locator, ""); + communicator().getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ServantLocator locator = new ServantLocatorI(); + adapter.addServantLocator(locator, ""); AllTests.allTests(communicator()); - adapter.waitForDeactivate(); + adapter.waitForDeactivate(); return 0; } } @@ -31,9 +31,9 @@ public class Collocated { TestClient app = new TestClient(); int result = app.main(args); - if(result != 0) - { - System.Environment.Exit(result); - } + if(result != 0) + { + System.Environment.Exit(result); + } } } diff --git a/cs/test/Ice/adapterDeactivation/CookieI.cs b/cs/test/Ice/adapterDeactivation/CookieI.cs index f225eac92bb..8c8dd2541ed 100755 --- a/cs/test/Ice/adapterDeactivation/CookieI.cs +++ b/cs/test/Ice/adapterDeactivation/CookieI.cs @@ -13,6 +13,6 @@ public sealed class CookieI : Cookie { public override string message() { - return "blahblah"; + return "blahblah"; } } diff --git a/cs/test/Ice/adapterDeactivation/ServantLocatorI.cs b/cs/test/Ice/adapterDeactivation/ServantLocatorI.cs index 7bffa169418..41e7ac6b309 100755 --- a/cs/test/Ice/adapterDeactivation/ServantLocatorI.cs +++ b/cs/test/Ice/adapterDeactivation/ServantLocatorI.cs @@ -20,9 +20,9 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator ~ServantLocatorI() { lock(this) - { - test(_deactivated); - } + { + test(_deactivated); + } } private static void test(bool b) @@ -35,10 +35,10 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator public Ice.Object locate(Ice.Current current, out Ice.LocalObject cookie) { - lock(this) - { - test(!_deactivated); - } + lock(this) + { + test(!_deactivated); + } test(current.id.category.Length == 0); test(current.id.name.Equals("test")); @@ -50,10 +50,10 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator public void finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie) { - lock(this) - { - test(!_deactivated); - } + lock(this) + { + test(!_deactivated); + } Cookie co = (Cookie) cookie; test(co.message().Equals("blahblah")); @@ -61,12 +61,12 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator public void deactivate(string category) { - lock(this) - { - test(!_deactivated); + lock(this) + { + test(!_deactivated); - _deactivated = true; - } + _deactivated = true; + } } private bool _deactivated; diff --git a/cs/test/Ice/adapterDeactivation/Server.cs b/cs/test/Ice/adapterDeactivation/Server.cs index 513d83e3a61..44c4664dadc 100755 --- a/cs/test/Ice/adapterDeactivation/Server.cs +++ b/cs/test/Ice/adapterDeactivation/Server.cs @@ -27,9 +27,9 @@ public class Server { TestServer app = new TestServer(); int result = app.main(args); - if(result != 0) - { - System.Environment.Exit(result); - } + if(result != 0) + { + System.Environment.Exit(result); + } } } diff --git a/cs/test/Ice/adapterDeactivation/TestI.cs b/cs/test/Ice/adapterDeactivation/TestI.cs index 5c2c84326de..45027cb2ae6 100755 --- a/cs/test/Ice/adapterDeactivation/TestI.cs +++ b/cs/test/Ice/adapterDeactivation/TestI.cs @@ -24,6 +24,6 @@ public sealed class TestI : TestIntfDisp_ public override void deactivate(Ice.Current current) { current.adapter.deactivate(); - System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1000)); + System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1000)); } } diff --git a/cs/test/Ice/application/Client.cs b/cs/test/Ice/application/Client.cs index d3e5752ba38..18fe1b82909 100644 --- a/cs/test/Ice/application/Client.cs +++ b/cs/test/Ice/application/Client.cs @@ -13,38 +13,38 @@ public class Client : Ice.Application { public override void interruptCallback(int sig) { - Console.WriteLine("handling signal " + sig); + Console.WriteLine("handling signal " + sig); } public override int run(string[] args) { - ignoreInterrupt(); - Console.WriteLine("Ignore CTRL+C and the like for 5 seconds (try it!)"); - System.Threading.Thread.Sleep(5 * 1000); + ignoreInterrupt(); + Console.WriteLine("Ignore CTRL+C and the like for 5 seconds (try it!)"); + System.Threading.Thread.Sleep(5 * 1000); - callbackOnInterrupt(); + callbackOnInterrupt(); - holdInterrupt(); - Console.WriteLine("Hold CTRL+C and the like for 5 seconds (try it!)"); - System.Threading.Thread.Sleep(5 * 1000); + holdInterrupt(); + Console.WriteLine("Hold CTRL+C and the like for 5 seconds (try it!)"); + System.Threading.Thread.Sleep(5 * 1000); - releaseInterrupt(); - Console.WriteLine("Release CTRL+C (any held signals should be released)"); - System.Threading.Thread.Sleep(5 * 1000); + releaseInterrupt(); + Console.WriteLine("Release CTRL+C (any held signals should be released)"); + System.Threading.Thread.Sleep(5 * 1000); - holdInterrupt(); - Console.WriteLine("Hold CTRL+C and the like for 5 seconds (try it!)"); - System.Threading.Thread.Sleep(5 * 1000); + holdInterrupt(); + Console.WriteLine("Hold CTRL+C and the like for 5 seconds (try it!)"); + System.Threading.Thread.Sleep(5 * 1000); - callbackOnInterrupt(); - Console.WriteLine("Release CTRL+C (any held signals should be released)"); - System.Threading.Thread.Sleep(5 * 1000); + callbackOnInterrupt(); + Console.WriteLine("Release CTRL+C (any held signals should be released)"); + System.Threading.Thread.Sleep(5 * 1000); - shutdownOnInterrupt(); - Console.WriteLine("Test shutdown on destroy. Press CTRL+C to shutdown & terminate"); - communicator().waitForShutdown(); + shutdownOnInterrupt(); + Console.WriteLine("Test shutdown on destroy. Press CTRL+C to shutdown & terminate"); + communicator().waitForShutdown(); - Console.WriteLine("ok"); + Console.WriteLine("ok"); return 0; } @@ -52,9 +52,9 @@ public class Client : Ice.Application { Client app = new Client(); int status = app.main(args); - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/binding/AllTests.cs b/cs/test/Ice/binding/AllTests.cs index 1c6b81c6872..99621da6e30 100755 --- a/cs/test/Ice/binding/AllTests.cs +++ b/cs/test/Ice/binding/AllTests.cs @@ -27,703 +27,703 @@ public class AllTests { public override void ice_response(string name) { - lock(this) - { - _name = name; - Monitor.Pulse(this); - } + lock(this) + { + _name = name; + Monitor.Pulse(this); + } } public override void ice_exception(Ice.Exception ex) { test(false); } - - public string getResult() + + public string getResult() { - lock(this) + lock(this) { - while(_name == null) - { - Monitor.Wait(this); - } - return _name; - } - } - - private string _name = null; + while(_name == null) + { + Monitor.Wait(this); + } + return _name; + } + } + + private string _name = null; }; private static string getAdapterNameWithAMI(TestIntfPrx test) { - GetAdapterNameCB cb = new GetAdapterNameCB(); - test.getAdapterName_async(cb); - return cb.getResult(); + GetAdapterNameCB cb = new GetAdapterNameCB(); + test.getAdapterName_async(cb); + return cb.getResult(); } private static void shuffle(ref ArrayList array) { - for(int i = 0; i < array.Count - 1; ++i) - { - int r = rand_.Next(array.Count - i) + i; - Debug.Assert(r >= i && r < array.Count); - if(r != i) - { - object tmp = array[i]; - array[i] = array[r]; - array[r] = tmp; - } - } + for(int i = 0; i < array.Count - 1; ++i) + { + int r = rand_.Next(array.Count - i) + i; + Debug.Assert(r >= i && r < array.Count); + if(r != i) + { + object tmp = array[i]; + array[i] = array[r]; + array[r] = tmp; + } + } } private static TestIntfPrx createTestIntfPrx(ArrayList adapters) { - ArrayList endpoints = new ArrayList(); - TestIntfPrx obj = null; - IEnumerator p = adapters.GetEnumerator(); - while(p.MoveNext()) - { - obj = ((RemoteObjectAdapterPrx)p.Current).getTestIntf(); - endpoints.AddRange(ArrayList.Adapter(obj.ice_getEndpoints())); - } - return TestIntfPrxHelper.uncheckedCast( - obj.ice_endpoints((Ice.Endpoint[])endpoints.ToArray(typeof(Ice.Endpoint)))); + ArrayList endpoints = new ArrayList(); + TestIntfPrx obj = null; + IEnumerator p = adapters.GetEnumerator(); + while(p.MoveNext()) + { + obj = ((RemoteObjectAdapterPrx)p.Current).getTestIntf(); + endpoints.AddRange(ArrayList.Adapter(obj.ice_getEndpoints())); + } + return TestIntfPrxHelper.uncheckedCast( + obj.ice_endpoints((Ice.Endpoint[])endpoints.ToArray(typeof(Ice.Endpoint)))); } private static void deactivate(RemoteCommunicatorPrx communicator, ArrayList adapters) { - IEnumerator p = adapters.GetEnumerator(); - while(p.MoveNext()) - { - communicator.deactivateObjectAdapter((RemoteObjectAdapterPrx)p.Current); - } + IEnumerator p = adapters.GetEnumerator(); + while(p.MoveNext()) + { + communicator.deactivateObjectAdapter((RemoteObjectAdapterPrx)p.Current); + } } - private class StringComparator : IComparer - { - public int Compare(object l, object r) - { - return ((string)l).CompareTo((string)r); - } - }; + private class StringComparator : IComparer + { + public int Compare(object l, object r) + { + return ((string)l).CompareTo((string)r); + } + }; public static void allTests(Ice.Communicator communicator) { - string @ref = "communicator:default -p 12010 -t 10000"; - RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref)); - - Console.Out.Write("testing binding with single endpoint... "); - Console.Out.Flush(); - { - RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default"); - - TestIntfPrx test1 = adapter.getTestIntf(); - TestIntfPrx test2 = adapter.getTestIntf(); - test(test1.ice_getConnection() == test2.ice_getConnection()); - - test1.ice_ping(); - test2.ice_ping(); - - com.deactivateObjectAdapter(adapter); - - TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); - test(test3.ice_getConnection() == test1.ice_getConnection()); - test(test3.ice_getConnection() == test2.ice_getConnection()); - - try - { - test3.ice_ping(); - test(false); - } - catch(Ice.ConnectionRefusedException) - { - } - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing binding with multiple endpoints... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("Adapter11", "default")); - adapters.Add(com.createObjectAdapter("Adapter12", "default")); - adapters.Add(com.createObjectAdapter("Adapter13", "default")); - - // - // Ensure that when a connection is opened it's reused for new - // proxies and that all endpoints are eventually tried. - // - IceUtil.Set names = new IceUtil.Set(); - names.Add("Adapter11"); - names.Add("Adapter12"); - names.Add("Adapter13"); - while(names.Count > 0) - { - ArrayList adpts = new ArrayList(adapters); - - TestIntfPrx test1 = createTestIntfPrx(adpts); - shuffle(ref adpts); - TestIntfPrx test2 = createTestIntfPrx(adpts); - shuffle(ref adpts); - TestIntfPrx test3 = createTestIntfPrx(adpts); - test1.ice_ping(); - test(test1.ice_getConnection() == test2.ice_getConnection()); - test(test2.ice_getConnection() == test3.ice_getConnection()); - - names.Remove(test1.getAdapterName()); - test1.ice_getConnection().close(false); - } - - // - // Ensure that the proxy correctly caches the connection (we - // always send the request over the same connection.) - // - { - foreach(RemoteObjectAdapterPrx adpt in adapters) + string @ref = "communicator:default -p 12010 -t 10000"; + RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref)); + + Console.Out.Write("testing binding with single endpoint... "); + Console.Out.Flush(); + { + RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default"); + + TestIntfPrx test1 = adapter.getTestIntf(); + TestIntfPrx test2 = adapter.getTestIntf(); + test(test1.ice_getConnection() == test2.ice_getConnection()); + + test1.ice_ping(); + test2.ice_ping(); + + com.deactivateObjectAdapter(adapter); + + TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); + test(test3.ice_getConnection() == test1.ice_getConnection()); + test(test3.ice_getConnection() == test2.ice_getConnection()); + + try + { + test3.ice_ping(); + test(false); + } + catch(Ice.ConnectionRefusedException) + { + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing binding with multiple endpoints... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("Adapter11", "default")); + adapters.Add(com.createObjectAdapter("Adapter12", "default")); + adapters.Add(com.createObjectAdapter("Adapter13", "default")); + + // + // Ensure that when a connection is opened it's reused for new + // proxies and that all endpoints are eventually tried. + // + IceUtil.Set names = new IceUtil.Set(); + names.Add("Adapter11"); + names.Add("Adapter12"); + names.Add("Adapter13"); + while(names.Count > 0) + { + ArrayList adpts = new ArrayList(adapters); + + TestIntfPrx test1 = createTestIntfPrx(adpts); + shuffle(ref adpts); + TestIntfPrx test2 = createTestIntfPrx(adpts); + shuffle(ref adpts); + TestIntfPrx test3 = createTestIntfPrx(adpts); + test1.ice_ping(); + test(test1.ice_getConnection() == test2.ice_getConnection()); + test(test2.ice_getConnection() == test3.ice_getConnection()); + + names.Remove(test1.getAdapterName()); + test1.ice_getConnection().close(false); + } + + // + // Ensure that the proxy correctly caches the connection (we + // always send the request over the same connection.) + // + { + foreach(RemoteObjectAdapterPrx adpt in adapters) + { + adpt.getTestIntf().ice_ping(); + } + + TestIntfPrx t = createTestIntfPrx(adapters); + string name = t.getAdapterName(); + int nRetry = 10; + int i; + for(i = 0; i < nRetry && t.getAdapterName().Equals(name); i++); + test(i == nRetry); + + foreach(RemoteObjectAdapterPrx adpt in adapters) + { + adpt.getTestIntf().ice_getConnection().close(false); + } + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapters. + // + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); + names.Add("Adapter12"); + names.Add("Adapter13"); + while(names.Count > 0) + { + ArrayList adpts = new ArrayList(adapters); + + TestIntfPrx test1 = createTestIntfPrx(adpts); + shuffle(ref adpts); + TestIntfPrx test2 = createTestIntfPrx(adpts); + shuffle(ref adpts); + TestIntfPrx test3 = createTestIntfPrx(adpts); + + test(test1.ice_getConnection() == test2.ice_getConnection()); + test(test2.ice_getConnection() == test3.ice_getConnection()); + + names.Remove(test1.getAdapterName()); + test1.ice_getConnection().close(false); + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapter. + // + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); + TestIntfPrx obj = createTestIntfPrx(adapters); + test(obj.getAdapterName().Equals("Adapter12")); + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing binding with multiple endpoints and AMI... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("AdapterAMI11", "default")); + adapters.Add(com.createObjectAdapter("AdapterAMI12", "default")); + adapters.Add(com.createObjectAdapter("AdapterAMI13", "default")); + + // + // Ensure that when a connection is opened it's reused for new + // proxies and that all endpoints are eventually tried. + // + IceUtil.Set names = new IceUtil.Set(); + names.Add("AdapterAMI11"); + names.Add("AdapterAMI12"); + names.Add("AdapterAMI13"); + while(names.Count > 0) + { + ArrayList adpts = new ArrayList(adapters); + + TestIntfPrx test1 = createTestIntfPrx(adpts); + shuffle(ref adpts); + TestIntfPrx test2 = createTestIntfPrx(adpts); + shuffle(ref adpts); + TestIntfPrx test3 = createTestIntfPrx(adpts); + test1.ice_ping(); + test(test1.ice_getConnection() == test2.ice_getConnection()); + test(test2.ice_getConnection() == test3.ice_getConnection()); + + names.Remove(getAdapterNameWithAMI(test1)); + test1.ice_getConnection().close(false); + } + + // + // Ensure that the proxy correctly caches the connection (we + // always send the request over the same connection.) + // + { + foreach(RemoteObjectAdapterPrx adpt in adapters) + { + adpt.getTestIntf().ice_ping(); + } + + TestIntfPrx t = createTestIntfPrx(adapters); + string name = getAdapterNameWithAMI(t); + int nRetry = 10; + int i; + for(i = 0; i < nRetry && getAdapterNameWithAMI(t).Equals(name); i++); + test(i == nRetry); + + foreach(RemoteObjectAdapterPrx adpt in adapters) + { + adpt.getTestIntf().ice_getConnection().close(false); + } + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapters. + // + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); + names.Add("AdapterAMI12"); + names.Add("AdapterAMI13"); + while(names.Count > 0) + { + ArrayList adpts = new ArrayList(adapters); + + TestIntfPrx test1 = createTestIntfPrx(adpts); + shuffle(ref adpts); + TestIntfPrx test2 = createTestIntfPrx(adpts); + shuffle(ref adpts); + TestIntfPrx test3 = createTestIntfPrx(adpts); + + test(test1.ice_getConnection() == test2.ice_getConnection()); + test(test2.ice_getConnection() == test3.ice_getConnection()); + + names.Remove(getAdapterNameWithAMI(test1)); + test1.ice_getConnection().close(false); + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapter. + // + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); + TestIntfPrx obj = createTestIntfPrx(adapters); + test(getAdapterNameWithAMI(obj).Equals("AdapterAMI12")); + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing random endpoint selection... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("Adapter21", "default")); + adapters.Add(com.createObjectAdapter("Adapter22", "default")); + adapters.Add(com.createObjectAdapter("Adapter23", "default")); + + TestIntfPrx obj = createTestIntfPrx(adapters); + test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); + + IceUtil.Set names = new IceUtil.Set(); + names.Add("Adapter21"); + names.Add("Adapter22"); + names.Add("Adapter23"); + while(names.Count > 0) + { + names.Remove(obj.getAdapterName()); + obj.ice_getConnection().close(false); + } + + obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Random)); + test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); + + names.Add("Adapter21"); + names.Add("Adapter22"); + names.Add("Adapter23"); + while(names.Count > 0) + { + names.Remove(obj.getAdapterName()); + obj.ice_getConnection().close(false); + } + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing ordered endpoint selection... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("Adapter31", "default")); + adapters.Add(com.createObjectAdapter("Adapter32", "default")); + adapters.Add(com.createObjectAdapter("Adapter33", "default")); + + TestIntfPrx obj = createTestIntfPrx(adapters); + obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); + test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); + int nRetry = 3; + int i; + + // + // Ensure that endpoints are tried in order by deactiving the adapters + // one after the other. + // + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter31"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter32"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter33"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); + + try + { + obj.getAdapterName(); + } + catch(Ice.ConnectionRefusedException) + { + } + + Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); + + adapters.Clear(); + + // + // Now, re-activate the adapters with the same endpoints in the opposite + // order. + // + adapters.Add(com.createObjectAdapter("Adapter36", endpoints[2].ToString())); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter36"); i++); + test(i == nRetry); + obj.ice_getConnection().close(false); + adapters.Add(com.createObjectAdapter("Adapter35", endpoints[1].ToString())); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter35"); i++); + test(i == nRetry); + obj.ice_getConnection().close(false); + adapters.Add(com.createObjectAdapter("Adapter34", endpoints[0].ToString())); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter34"); i++); + test(i == nRetry); + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing per request binding with single endpoint... "); + Console.Out.Flush(); + { + RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter41", "default"); + + TestIntfPrx test1 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)); + TestIntfPrx test2 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)); + test(!test1.ice_isConnectionCached()); + test(!test2.ice_isConnectionCached()); + test(test1.ice_getConnection() == test2.ice_getConnection()); + + test1.ice_ping(); + + com.deactivateObjectAdapter(adapter); + + TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); + try + { + test(test3.ice_getConnection() == test1.ice_getConnection()); + test(false); + } + catch(Ice.ConnectionRefusedException) + { + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing per request binding with multiple endpoints... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("Adapter51", "default")); + adapters.Add(com.createObjectAdapter("Adapter52", "default")); + adapters.Add(com.createObjectAdapter("Adapter53", "default")); + + TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); + test(!obj.ice_isConnectionCached()); + + IceUtil.Set names = new IceUtil.Set(); + names.Add("Adapter51"); + names.Add("Adapter52"); + names.Add("Adapter53"); + while(names.Count > 0) + { + names.Remove(obj.getAdapterName()); + } + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); + + names.Add("Adapter52"); + names.Add("Adapter53"); + while(names.Count > 0) + { + names.Remove(obj.getAdapterName()); + } + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); + + + test(obj.getAdapterName().Equals("Adapter52")); + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing per request binding with multiple endpoints and AMI... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("AdapterAMI51", "default")); + adapters.Add(com.createObjectAdapter("AdapterAMI52", "default")); + adapters.Add(com.createObjectAdapter("AdapterAMI53", "default")); + + TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); + test(!obj.ice_isConnectionCached()); + + IceUtil.Set names = new IceUtil.Set(); + names.Add("AdapterAMI51"); + names.Add("AdapterAMI52"); + names.Add("AdapterAMI53"); + while(names.Count > 0) + { + names.Remove(getAdapterNameWithAMI(obj)); + } + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); + + names.Add("AdapterAMI52"); + names.Add("AdapterAMI53"); + while(names.Count > 0) + { + names.Remove(getAdapterNameWithAMI(obj)); + } + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); + + + test(getAdapterNameWithAMI(obj).Equals("AdapterAMI52")); + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing per request binding and ordered endpoint selection... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("Adapter61", "default")); + adapters.Add(com.createObjectAdapter("Adapter62", "default")); + adapters.Add(com.createObjectAdapter("Adapter63", "default")); + + TestIntfPrx obj = createTestIntfPrx(adapters); + obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); + test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); + obj = TestIntfPrxHelper.uncheckedCast(obj.ice_connectionCached(false)); + test(!obj.ice_isConnectionCached()); + int nRetry = 3; + int i; + + // + // Ensure that endpoints are tried in order by deactiving the adapters + // one after the other. + // + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter61"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter62"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter63"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); + + try + { + obj.getAdapterName(); + } + catch(Ice.ConnectionRefusedException) + { + } + + Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); + + adapters.Clear(); + + // + // Now, re-activate the adapters with the same endpoints in the opposite + // order. + // + adapters.Add(com.createObjectAdapter("Adapter66", endpoints[2].ToString())); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter66"); i++); + test(i == nRetry); + adapters.Add(com.createObjectAdapter("Adapter65", endpoints[1].ToString())); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter65"); i++); + test(i == nRetry); + adapters.Add(com.createObjectAdapter("Adapter64", endpoints[0].ToString())); + for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter64"); i++); + test(i == nRetry); + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing per request binding and ordered endpoint selection and AMI... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("AdapterAMI61", "default")); + adapters.Add(com.createObjectAdapter("AdapterAMI62", "default")); + adapters.Add(com.createObjectAdapter("AdapterAMI63", "default")); + + TestIntfPrx obj = createTestIntfPrx(adapters); + obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); + test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); + obj = TestIntfPrxHelper.uncheckedCast(obj.ice_connectionCached(false)); + test(!obj.ice_isConnectionCached()); + int nRetry = 3; + int i; + + // + // Ensure that endpoints are tried in order by deactiving the adapters + // one after the other. + // + for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI61"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); + for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI62"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); + for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI63"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); + + try + { + obj.getAdapterName(); + } + catch(Ice.ConnectionRefusedException) + { + } + + Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); + + adapters.Clear(); + + // + // Now, re-activate the adapters with the same endpoints in the opposite + // order. + // + adapters.Add(com.createObjectAdapter("AdapterAMI66", endpoints[2].ToString())); + for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI66"); i++); + test(i == nRetry); + adapters.Add(com.createObjectAdapter("AdapterAMI65", endpoints[1].ToString())); + for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI65"); i++); + test(i == nRetry); + adapters.Add(com.createObjectAdapter("AdapterAMI64", endpoints[0].ToString())); + for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI64"); i++); + test(i == nRetry); + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing endpoint mode filtering... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("Adapter71", "default")); + adapters.Add(com.createObjectAdapter("Adapter72", "udp")); + + TestIntfPrx obj = createTestIntfPrx(adapters); + test(obj.getAdapterName().Equals("Adapter71")); + + TestIntfPrx testUDP = TestIntfPrxHelper.uncheckedCast(obj.ice_datagram()); + test(obj.ice_getConnection() != testUDP.ice_getConnection()); + try + { + testUDP.getAdapterName(); + } + catch(Ice.TwowayOnlyException) + { + } + } + Console.Out.WriteLine("ok"); + + if(communicator.getProperties().getProperty("Ice.Plugin.IceSSL").Length > 0) + { + Console.Out.Write("testing unsecure vs. secure endpoints... "); + Console.Out.Flush(); + { + ArrayList adapters = new ArrayList(); + adapters.Add(com.createObjectAdapter("Adapter81", "ssl")); + adapters.Add(com.createObjectAdapter("Adapter82", "tcp")); + + TestIntfPrx obj = createTestIntfPrx(adapters); + int i; + for(i = 0; i < 5; i++) { - adpt.getTestIntf().ice_ping(); - } - - TestIntfPrx t = createTestIntfPrx(adapters); - string name = t.getAdapterName(); - int nRetry = 10; - int i; - for(i = 0; i < nRetry && t.getAdapterName().Equals(name); i++); - test(i == nRetry); - - foreach(RemoteObjectAdapterPrx adpt in adapters) + test(obj.getAdapterName().Equals("Adapter82")); + obj.ice_getConnection().close(false); + } + + TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(true)); + test(testSecure.ice_isSecure()); + testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(false)); + test(!testSecure.ice_isSecure()); + testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(true)); + test(testSecure.ice_isSecure()); + test(obj.ice_getConnection() != testSecure.ice_getConnection()); + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); + + for(i = 0; i < 5; i++) { - adpt.getTestIntf().ice_getConnection().close(false); - } - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapters. - // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); - names.Add("Adapter12"); - names.Add("Adapter13"); - while(names.Count > 0) - { - ArrayList adpts = new ArrayList(adapters); - - TestIntfPrx test1 = createTestIntfPrx(adpts); - shuffle(ref adpts); - TestIntfPrx test2 = createTestIntfPrx(adpts); - shuffle(ref adpts); - TestIntfPrx test3 = createTestIntfPrx(adpts); - - test(test1.ice_getConnection() == test2.ice_getConnection()); - test(test2.ice_getConnection() == test3.ice_getConnection()); - - names.Remove(test1.getAdapterName()); - test1.ice_getConnection().close(false); - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapter. - // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); - TestIntfPrx obj = createTestIntfPrx(adapters); - test(obj.getAdapterName().Equals("Adapter12")); - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing binding with multiple endpoints and AMI... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("AdapterAMI11", "default")); - adapters.Add(com.createObjectAdapter("AdapterAMI12", "default")); - adapters.Add(com.createObjectAdapter("AdapterAMI13", "default")); - - // - // Ensure that when a connection is opened it's reused for new - // proxies and that all endpoints are eventually tried. - // - IceUtil.Set names = new IceUtil.Set(); - names.Add("AdapterAMI11"); - names.Add("AdapterAMI12"); - names.Add("AdapterAMI13"); - while(names.Count > 0) - { - ArrayList adpts = new ArrayList(adapters); - - TestIntfPrx test1 = createTestIntfPrx(adpts); - shuffle(ref adpts); - TestIntfPrx test2 = createTestIntfPrx(adpts); - shuffle(ref adpts); - TestIntfPrx test3 = createTestIntfPrx(adpts); - test1.ice_ping(); - test(test1.ice_getConnection() == test2.ice_getConnection()); - test(test2.ice_getConnection() == test3.ice_getConnection()); - - names.Remove(getAdapterNameWithAMI(test1)); - test1.ice_getConnection().close(false); - } - - // - // Ensure that the proxy correctly caches the connection (we - // always send the request over the same connection.) - // - { - foreach(RemoteObjectAdapterPrx adpt in adapters) + test(obj.getAdapterName().Equals("Adapter81")); + obj.ice_getConnection().close(false); + } + + com.createObjectAdapter("Adapter83", (obj.ice_getEndpoints()[1]).ToString()); // Reactive tcp OA. + + for(i = 0; i < 5; i++) + { + test(obj.getAdapterName().Equals("Adapter83")); + obj.ice_getConnection().close(false); + } + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); + try { - adpt.getTestIntf().ice_ping(); - } - - TestIntfPrx t = createTestIntfPrx(adapters); - string name = getAdapterNameWithAMI(t); - int nRetry = 10; - int i; - for(i = 0; i < nRetry && getAdapterNameWithAMI(t).Equals(name); i++); - test(i == nRetry); - - foreach(RemoteObjectAdapterPrx adpt in adapters) + testSecure.ice_ping(); + test(false); + } + catch(Ice.ConnectionRefusedException) { - adpt.getTestIntf().ice_getConnection().close(false); - } - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapters. - // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); - names.Add("AdapterAMI12"); - names.Add("AdapterAMI13"); - while(names.Count > 0) - { - ArrayList adpts = new ArrayList(adapters); - - TestIntfPrx test1 = createTestIntfPrx(adpts); - shuffle(ref adpts); - TestIntfPrx test2 = createTestIntfPrx(adpts); - shuffle(ref adpts); - TestIntfPrx test3 = createTestIntfPrx(adpts); - - test(test1.ice_getConnection() == test2.ice_getConnection()); - test(test2.ice_getConnection() == test3.ice_getConnection()); - - names.Remove(getAdapterNameWithAMI(test1)); - test1.ice_getConnection().close(false); - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapter. - // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); - TestIntfPrx obj = createTestIntfPrx(adapters); - test(getAdapterNameWithAMI(obj).Equals("AdapterAMI12")); - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing random endpoint selection... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("Adapter21", "default")); - adapters.Add(com.createObjectAdapter("Adapter22", "default")); - adapters.Add(com.createObjectAdapter("Adapter23", "default")); - - TestIntfPrx obj = createTestIntfPrx(adapters); - test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); - - IceUtil.Set names = new IceUtil.Set(); - names.Add("Adapter21"); - names.Add("Adapter22"); - names.Add("Adapter23"); - while(names.Count > 0) - { - names.Remove(obj.getAdapterName()); - obj.ice_getConnection().close(false); - } - - obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Random)); - test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); - - names.Add("Adapter21"); - names.Add("Adapter22"); - names.Add("Adapter23"); - while(names.Count > 0) - { - names.Remove(obj.getAdapterName()); - obj.ice_getConnection().close(false); - } - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing ordered endpoint selection... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("Adapter31", "default")); - adapters.Add(com.createObjectAdapter("Adapter32", "default")); - adapters.Add(com.createObjectAdapter("Adapter33", "default")); - - TestIntfPrx obj = createTestIntfPrx(adapters); - obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); - test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); - int nRetry = 3; - int i; - - // - // Ensure that endpoints are tried in order by deactiving the adapters - // one after the other. - // - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter31"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter32"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter33"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); - - try - { - obj.getAdapterName(); - } - catch(Ice.ConnectionRefusedException) - { - } - - Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); - - adapters.Clear(); - - // - // Now, re-activate the adapters with the same endpoints in the opposite - // order. - // - adapters.Add(com.createObjectAdapter("Adapter36", endpoints[2].ToString())); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter36"); i++); - test(i == nRetry); - obj.ice_getConnection().close(false); - adapters.Add(com.createObjectAdapter("Adapter35", endpoints[1].ToString())); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter35"); i++); - test(i == nRetry); - obj.ice_getConnection().close(false); - adapters.Add(com.createObjectAdapter("Adapter34", endpoints[0].ToString())); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter34"); i++); - test(i == nRetry); - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing per request binding with single endpoint... "); - Console.Out.Flush(); - { - RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter41", "default"); - - TestIntfPrx test1 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)); - TestIntfPrx test2 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)); - test(!test1.ice_isConnectionCached()); - test(!test2.ice_isConnectionCached()); - test(test1.ice_getConnection() == test2.ice_getConnection()); - - test1.ice_ping(); - - com.deactivateObjectAdapter(adapter); - - TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); - try - { - test(test3.ice_getConnection() == test1.ice_getConnection()); - test(false); - } - catch(Ice.ConnectionRefusedException) - { - } - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing per request binding with multiple endpoints... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("Adapter51", "default")); - adapters.Add(com.createObjectAdapter("Adapter52", "default")); - adapters.Add(com.createObjectAdapter("Adapter53", "default")); - - TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); - test(!obj.ice_isConnectionCached()); - - IceUtil.Set names = new IceUtil.Set(); - names.Add("Adapter51"); - names.Add("Adapter52"); - names.Add("Adapter53"); - while(names.Count > 0) - { - names.Remove(obj.getAdapterName()); - } - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); - - names.Add("Adapter52"); - names.Add("Adapter53"); - while(names.Count > 0) - { - names.Remove(obj.getAdapterName()); - } - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); - - - test(obj.getAdapterName().Equals("Adapter52")); - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing per request binding with multiple endpoints and AMI... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("AdapterAMI51", "default")); - adapters.Add(com.createObjectAdapter("AdapterAMI52", "default")); - adapters.Add(com.createObjectAdapter("AdapterAMI53", "default")); - - TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); - test(!obj.ice_isConnectionCached()); - - IceUtil.Set names = new IceUtil.Set(); - names.Add("AdapterAMI51"); - names.Add("AdapterAMI52"); - names.Add("AdapterAMI53"); - while(names.Count > 0) - { - names.Remove(getAdapterNameWithAMI(obj)); - } - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); - - names.Add("AdapterAMI52"); - names.Add("AdapterAMI53"); - while(names.Count > 0) - { - names.Remove(getAdapterNameWithAMI(obj)); - } - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); - - - test(getAdapterNameWithAMI(obj).Equals("AdapterAMI52")); - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing per request binding and ordered endpoint selection... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("Adapter61", "default")); - adapters.Add(com.createObjectAdapter("Adapter62", "default")); - adapters.Add(com.createObjectAdapter("Adapter63", "default")); - - TestIntfPrx obj = createTestIntfPrx(adapters); - obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); - test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); - obj = TestIntfPrxHelper.uncheckedCast(obj.ice_connectionCached(false)); - test(!obj.ice_isConnectionCached()); - int nRetry = 3; - int i; - - // - // Ensure that endpoints are tried in order by deactiving the adapters - // one after the other. - // - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter61"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter62"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter63"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); - - try - { - obj.getAdapterName(); - } - catch(Ice.ConnectionRefusedException) - { - } - - Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); - - adapters.Clear(); - - // - // Now, re-activate the adapters with the same endpoints in the opposite - // order. - // - adapters.Add(com.createObjectAdapter("Adapter66", endpoints[2].ToString())); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter66"); i++); - test(i == nRetry); - adapters.Add(com.createObjectAdapter("Adapter65", endpoints[1].ToString())); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter65"); i++); - test(i == nRetry); - adapters.Add(com.createObjectAdapter("Adapter64", endpoints[0].ToString())); - for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter64"); i++); - test(i == nRetry); - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing per request binding and ordered endpoint selection and AMI... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("AdapterAMI61", "default")); - adapters.Add(com.createObjectAdapter("AdapterAMI62", "default")); - adapters.Add(com.createObjectAdapter("AdapterAMI63", "default")); - - TestIntfPrx obj = createTestIntfPrx(adapters); - obj = TestIntfPrxHelper.uncheckedCast(obj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)); - test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered); - obj = TestIntfPrxHelper.uncheckedCast(obj.ice_connectionCached(false)); - test(!obj.ice_isConnectionCached()); - int nRetry = 3; - int i; - - // - // Ensure that endpoints are tried in order by deactiving the adapters - // one after the other. - // - for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI61"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); - for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI62"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); - for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI63"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]); - - try - { - obj.getAdapterName(); - } - catch(Ice.ConnectionRefusedException) - { - } - - Ice.Endpoint[] endpoints = obj.ice_getEndpoints(); - - adapters.Clear(); - - // - // Now, re-activate the adapters with the same endpoints in the opposite - // order. - // - adapters.Add(com.createObjectAdapter("AdapterAMI66", endpoints[2].ToString())); - for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI66"); i++); - test(i == nRetry); - adapters.Add(com.createObjectAdapter("AdapterAMI65", endpoints[1].ToString())); - for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI65"); i++); - test(i == nRetry); - adapters.Add(com.createObjectAdapter("AdapterAMI64", endpoints[0].ToString())); - for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI64"); i++); - test(i == nRetry); - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing endpoint mode filtering... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("Adapter71", "default")); - adapters.Add(com.createObjectAdapter("Adapter72", "udp")); - - TestIntfPrx obj = createTestIntfPrx(adapters); - test(obj.getAdapterName().Equals("Adapter71")); - - TestIntfPrx testUDP = TestIntfPrxHelper.uncheckedCast(obj.ice_datagram()); - test(obj.ice_getConnection() != testUDP.ice_getConnection()); - try - { - testUDP.getAdapterName(); - } - catch(Ice.TwowayOnlyException) - { - } - } - Console.Out.WriteLine("ok"); - - if(communicator.getProperties().getProperty("Ice.Plugin.IceSSL").Length > 0) - { - Console.Out.Write("testing unsecure vs. secure endpoints... "); - Console.Out.Flush(); - { - ArrayList adapters = new ArrayList(); - adapters.Add(com.createObjectAdapter("Adapter81", "ssl")); - adapters.Add(com.createObjectAdapter("Adapter82", "tcp")); - - TestIntfPrx obj = createTestIntfPrx(adapters); - int i; - for(i = 0; i < 5; i++) - { - test(obj.getAdapterName().Equals("Adapter82")); - obj.ice_getConnection().close(false); - } - - TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(true)); - test(testSecure.ice_isSecure()); - testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(false)); - test(!testSecure.ice_isSecure()); - testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(true)); - test(testSecure.ice_isSecure()); - test(obj.ice_getConnection() != testSecure.ice_getConnection()); - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]); - - for(i = 0; i < 5; i++) - { - test(obj.getAdapterName().Equals("Adapter81")); - obj.ice_getConnection().close(false); - } - - com.createObjectAdapter("Adapter83", (obj.ice_getEndpoints()[1]).ToString()); // Reactive tcp OA. - - for(i = 0; i < 5; i++) - { - test(obj.getAdapterName().Equals("Adapter83")); - obj.ice_getConnection().close(false); - } - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]); - try - { - testSecure.ice_ping(); - test(false); - } - catch(Ice.ConnectionRefusedException) - { - } - - deactivate(com, adapters); - } - Console.Out.WriteLine("ok"); - } - - com.shutdown(); + } + + deactivate(com, adapters); + } + Console.Out.WriteLine("ok"); + } + + com.shutdown(); } private static System.Random rand_ = new System.Random(unchecked((int)System.DateTime.Now.Ticks)); diff --git a/cs/test/Ice/binding/Client.cs b/cs/test/Ice/binding/Client.cs index 778b4e68acb..17b3cedb6a1 100755 --- a/cs/test/Ice/binding/Client.cs +++ b/cs/test/Ice/binding/Client.cs @@ -39,14 +39,14 @@ public class Client } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/binding/RemoteCommunicatorI.cs b/cs/test/Ice/binding/RemoteCommunicatorI.cs index c37e15778dd..d87dc7ab85b 100644 --- a/cs/test/Ice/binding/RemoteCommunicatorI.cs +++ b/cs/test/Ice/binding/RemoteCommunicatorI.cs @@ -14,25 +14,25 @@ public class RemoteCommunicatorI : RemoteCommunicatorDisp_ public override RemoteObjectAdapterPrx createObjectAdapter(string name, string endpoints, Ice.Current current) { - Ice.Communicator com = current.adapter.getCommunicator(); - if(com.getProperties().getPropertyAsIntWithDefault("Ice.ThreadPerConnection", 0) == 0) + Ice.Communicator com = current.adapter.getCommunicator(); + if(com.getProperties().getPropertyAsIntWithDefault("Ice.ThreadPerConnection", 0) == 0) { com.getProperties().setProperty("Ice.OA." + name + ".ThreadPool.Size", "1"); } - Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints); - return RemoteObjectAdapterPrxHelper.uncheckedCast( - current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))); + Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints); + return RemoteObjectAdapterPrxHelper.uncheckedCast( + current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))); } public override void deactivateObjectAdapter(RemoteObjectAdapterPrx adapter, Ice.Current current) { - adapter.deactivate(); // Collocated call. + adapter.deactivate(); // Collocated call. } public override void shutdown(Ice.Current current) { - current.adapter.getCommunicator().shutdown(); + current.adapter.getCommunicator().shutdown(); } }; diff --git a/cs/test/Ice/binding/RemoteObjectAdapterI.cs b/cs/test/Ice/binding/RemoteObjectAdapterI.cs index 356a53fe2b4..565386a2a0d 100644 --- a/cs/test/Ice/binding/RemoteObjectAdapterI.cs +++ b/cs/test/Ice/binding/RemoteObjectAdapterI.cs @@ -13,28 +13,28 @@ public class RemoteObjectAdapterI : RemoteObjectAdapterDisp_ { public RemoteObjectAdapterI(Ice.ObjectAdapter adapter) { - _adapter = adapter; - _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), - _adapter.getCommunicator().stringToIdentity("test"))); - _adapter.activate(); + _adapter = adapter; + _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), + _adapter.getCommunicator().stringToIdentity("test"))); + _adapter.activate(); } public override TestIntfPrx getTestIntf(Ice.Current current) { - return _testIntf; + return _testIntf; } public override void deactivate(Ice.Current current) { - try - { - _adapter.destroy(); - } - catch(Ice.ObjectAdapterDeactivatedException) - { - } + try + { + _adapter.destroy(); + } + catch(Ice.ObjectAdapterDeactivatedException) + { + } } private Ice.ObjectAdapter _adapter; diff --git a/cs/test/Ice/binding/Server.cs b/cs/test/Ice/binding/Server.cs index b89e5fdba4c..ca689b01b55 100755 --- a/cs/test/Ice/binding/Server.cs +++ b/cs/test/Ice/binding/Server.cs @@ -11,14 +11,14 @@ public class Server { private static int run(string[] args, Ice.Communicator communicator) { - communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 2000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Identity id = communicator.stringToIdentity("communicator"); - adapter.add(new RemoteCommunicatorI(), id); - adapter.activate(); + communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 2000:udp"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Identity id = communicator.stringToIdentity("communicator"); + adapter.add(new RemoteCommunicatorI(), id); + adapter.activate(); - communicator.waitForShutdown(); - return 0; + communicator.waitForShutdown(); + return 0; } public static void Main(string[] args) @@ -28,7 +28,7 @@ public class Server try { - Ice.InitializationData initData = new Ice.InitializationData(); + Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = Ice.Util.createProperties(ref args); initData.properties.setProperty("Ice.ServerIdleTime", "30"); communicator = Ice.Util.initialize(ref args, initData); @@ -53,9 +53,9 @@ public class Server } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/binding/TestI.cs b/cs/test/Ice/binding/TestI.cs index 10897639cb5..ba98c21b1e6 100755 --- a/cs/test/Ice/binding/TestI.cs +++ b/cs/test/Ice/binding/TestI.cs @@ -13,7 +13,7 @@ public class TestI : TestIntfDisp_ { public override string getAdapterName(Ice.Current current) { - return current.adapter.getName(); + return current.adapter.getName(); } } diff --git a/cs/test/Ice/checksum/client/AllTests.cs b/cs/test/Ice/checksum/client/AllTests.cs index 88178b49120..ec4ecd36ae5 100755 --- a/cs/test/Ice/checksum/client/AllTests.cs +++ b/cs/test/Ice/checksum/client/AllTests.cs @@ -17,7 +17,7 @@ public class AllTests { if(!b) { - throw new Exception(); + throw new Exception(); } } diff --git a/cs/test/Ice/checksum/client/Client.cs b/cs/test/Ice/checksum/client/Client.cs index 65ad7698c73..80269f08af8 100755 --- a/cs/test/Ice/checksum/client/Client.cs +++ b/cs/test/Ice/checksum/client/Client.cs @@ -20,33 +20,33 @@ public class Client public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - 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; - } - } - + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + 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; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/Ice/checksum/server/Server.cs b/cs/test/Ice/checksum/server/Server.cs index 9cf1719207c..4e9d93d7a43 100755 --- a/cs/test/Ice/checksum/server/Server.cs +++ b/cs/test/Ice/checksum/server/Server.cs @@ -13,44 +13,44 @@ public class Server { private static int run(string[] args, Ice.Communicator communicator) { - communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object @object = new Test.ChecksumI(adapter); - adapter.add(@object, communicator.stringToIdentity("test")); - adapter.activate(); - communicator.waitForShutdown(); - return 0; + communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 2000"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object @object = new Test.ChecksumI(adapter); + adapter.add(@object, communicator.stringToIdentity("test")); + adapter.activate(); + communicator.waitForShutdown(); + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch (Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if (communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch (Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + + if (communicator != null) + { + try + { + communicator.destroy(); + } + catch (Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/Ice/checksum/server/TestI.cs b/cs/test/Ice/checksum/server/TestI.cs index 64069cca5be..deced1aa001 100755 --- a/cs/test/Ice/checksum/server/TestI.cs +++ b/cs/test/Ice/checksum/server/TestI.cs @@ -16,15 +16,15 @@ namespace Test _adapter = adapter; } - public override Ice.SliceChecksumDict getSliceChecksums(Ice.Current __current) - { - return Ice.SliceChecksums.checksums; - } + public override Ice.SliceChecksumDict getSliceChecksums(Ice.Current __current) + { + return Ice.SliceChecksums.checksums; + } - public override void shutdown(Ice.Current __current) - { + public override void shutdown(Ice.Current __current) + { _adapter.getCommunicator().shutdown(); - } + } private Ice.ObjectAdapter _adapter; } diff --git a/cs/test/Ice/exceptions/AllTests.cs b/cs/test/Ice/exceptions/AllTests.cs index 42b108fc675..c3f1f29faa1 100755 --- a/cs/test/Ice/exceptions/AllTests.cs +++ b/cs/test/Ice/exceptions/AllTests.cs @@ -16,170 +16,170 @@ public class AllTests { private static void test(bool b) { - if(!b) - { - throw new System.Exception(); - } + if(!b) + { + throw new System.Exception(); + } } private class Callback { - internal Callback() - { - _called = false; - } - - public virtual bool check() - { - lock(this) - { - while(!_called) - { - Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); - - if(!_called) - { - return false; // Must be timeout. - } - } - - return true; - } - } - - public virtual void called() - { - lock(this) - { - Debug.Assert(!_called); - _called = true; - Monitor.Pulse(this); - } - } - - private bool _called; + internal Callback() + { + _called = false; + } + + public virtual bool check() + { + lock(this) + { + while(!_called) + { + Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); + + if(!_called) + { + return false; // Must be timeout. + } + } + + return true; + } + } + + public virtual void called() + { + lock(this) + { + Debug.Assert(!_called); + _called = true; + Monitor.Pulse(this); + } + } + + private bool _called; } private class AMI_Thrower_throwAasAI : AMI_Thrower_throwAasA { - public AMI_Thrower_throwAasAI() - { - InitBlock(); - } - private void InitBlock() - { - callback = new Callback(); - } - public override void ice_response() - { - AllTests.test(false); - } - - public override void ice_exception(Ice.Exception exc) - { - try - { - throw exc; - } - catch(A ex) - { - AllTests.test(ex.aMem == 1); - } - catch(Exception) - { - AllTests.test(false); - } - callback.called(); - } - - public virtual bool check() - { - return callback.check(); - } - - private Callback callback; + public AMI_Thrower_throwAasAI() + { + InitBlock(); + } + private void InitBlock() + { + callback = new Callback(); + } + public override void ice_response() + { + AllTests.test(false); + } + + public override void ice_exception(Ice.Exception exc) + { + try + { + throw exc; + } + catch(A ex) + { + AllTests.test(ex.aMem == 1); + } + catch(Exception) + { + AllTests.test(false); + } + callback.called(); + } + + public virtual bool check() + { + return callback.check(); + } + + private Callback callback; } private class AMI_Thrower_throwAasAObjectNotExistI : AMI_Thrower_throwAasA { - public AMI_Thrower_throwAasAObjectNotExistI(Ice.Communicator comm) - { - InitBlock(comm); - } - private void InitBlock(Ice.Communicator comm) - { - callback = new Callback(); - communicator = comm; - } - public override void ice_response() - { - AllTests.test(false); - } - - public override void ice_exception(Ice.Exception exc) - { - try - { - throw exc; - } - catch(Ice.ObjectNotExistException ex) - { - Ice.Identity id = communicator.stringToIdentity("does not exist"); - AllTests.test(ex.id.Equals(id)); - } - catch(Exception) - { - AllTests.test(false); - } - callback.called(); - } - - public virtual bool check() - { - return callback.check(); - } - - private Ice.Communicator communicator; - private Callback callback; + public AMI_Thrower_throwAasAObjectNotExistI(Ice.Communicator comm) + { + InitBlock(comm); + } + private void InitBlock(Ice.Communicator comm) + { + callback = new Callback(); + communicator = comm; + } + public override void ice_response() + { + AllTests.test(false); + } + + public override void ice_exception(Ice.Exception exc) + { + try + { + throw exc; + } + catch(Ice.ObjectNotExistException ex) + { + Ice.Identity id = communicator.stringToIdentity("does not exist"); + AllTests.test(ex.id.Equals(id)); + } + catch(Exception) + { + AllTests.test(false); + } + callback.called(); + } + + public virtual bool check() + { + return callback.check(); + } + + private Ice.Communicator communicator; + private Callback callback; } private class AMI_Thrower_throwAasAFacetNotExistI : AMI_Thrower_throwAasA { - public override void ice_response() - { - AllTests.test(false); - } - - public override void ice_exception(Ice.Exception exc) - { - try - { - throw exc; - } - catch(Ice.FacetNotExistException ex) - { - AllTests.test(ex.facet.Equals("no such facet")); - } - catch(Exception) - { - AllTests.test(false); - } - callback.called(); - } - - public virtual bool check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public override void ice_response() + { + AllTests.test(false); + } + + public override void ice_exception(Ice.Exception exc) + { + try + { + throw exc; + } + catch(Ice.FacetNotExistException ex) + { + AllTests.test(ex.facet.Equals("no such facet")); + } + catch(Exception) + { + AllTests.test(false); + } + callback.called(); + } + + public virtual bool check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private class AMI_Thrower_throwAorDasAorDI : AMI_Thrower_throwAorDasAorD { public AMI_Thrower_throwAorDasAorDI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -223,7 +223,7 @@ public class AllTests { public AMI_Thrower_throwBasAI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -264,7 +264,7 @@ public class AllTests { public AMI_Thrower_throwCasAI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -306,7 +306,7 @@ public class AllTests { public AMI_Thrower_throwBasBI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -347,7 +347,7 @@ public class AllTests { public AMI_Thrower_throwCasBI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -389,7 +389,7 @@ public class AllTests { public AMI_Thrower_throwCasCI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -431,7 +431,7 @@ public class AllTests { public AMI_Thrower_throwUndeclaredAI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -470,7 +470,7 @@ public class AllTests { public AMI_Thrower_throwUndeclaredBI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -509,7 +509,7 @@ public class AllTests { public AMI_Thrower_throwUndeclaredCI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -548,7 +548,7 @@ public class AllTests { public AMI_Thrower_throwLocalExceptionI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -587,7 +587,7 @@ public class AllTests { public AMI_Thrower_throwNonIceExceptionI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -626,7 +626,7 @@ public class AllTests { public AMI_WrongOperation_noSuchOperationI() { - InitBlock(); + InitBlock(); } private void InitBlock() { @@ -667,57 +667,57 @@ public class AllTests { Console.Write("testing object adapter registration exceptions... "); Ice.ObjectAdapter first; - try - { - first = communicator.createObjectAdapter("TestAdapter0"); - } - catch(Ice.InitializationException) - { - // Expected - } + try + { + first = communicator.createObjectAdapter("TestAdapter0"); + } + catch(Ice.InitializationException) + { + // Expected + } - communicator.getProperties().setProperty("Ice.OA.TestAdapter0.Endpoints", "default"); - first = communicator.createObjectAdapter("TestAdapter0"); + communicator.getProperties().setProperty("Ice.OA.TestAdapter0.Endpoints", "default"); + first = communicator.createObjectAdapter("TestAdapter0"); try { - communicator.createObjectAdapter("TestAdapter0"); - test(false); + communicator.createObjectAdapter("TestAdapter0"); + test(false); } catch(Ice.AlreadyRegisteredException) { // Expected. } - try - { - Ice.ObjectAdapter second = - communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000"); - test(false); + try + { + Ice.ObjectAdapter second = + communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000"); + test(false); - // - // Quell mono error that variable second isn't used. - // - second.deactivate(); - } - catch(Ice.AlreadyRegisteredException) - { - // Expected - } - test(communicator.getProperties().getProperty("Ice.OA.TestAdapter0.Endpoints").Equals("default")); + // + // Quell mono error that variable second isn't used. + // + second.deactivate(); + } + catch(Ice.AlreadyRegisteredException) + { + // Expected + } + test(communicator.getProperties().getProperty("Ice.OA.TestAdapter0.Endpoints").Equals("default")); first.deactivate(); Console.WriteLine("ok"); } { Console.Write("testing servant registration exceptions... "); - communicator.getProperties().setProperty("Ice.OA.TestAdapter1.Endpoints", "default"); + communicator.getProperties().setProperty("Ice.OA.TestAdapter1.Endpoints", "default"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1"); Ice.Object obj = new EmptyI(); adapter.add(obj, communicator.stringToIdentity("x")); try { adapter.add(obj, communicator.stringToIdentity("x")); - test(false); + test(false); } catch(Ice.AlreadyRegisteredException) { @@ -727,7 +727,7 @@ public class AllTests try { adapter.remove(communicator.stringToIdentity("x")); - test(false); + test(false); } catch(Ice.NotRegisteredException) { @@ -738,14 +738,14 @@ public class AllTests { Console.Write("testing servant locator registration exceptions... "); - communicator.getProperties().setProperty("Ice.OA.TestAdapter2.Endpoints", "default"); + communicator.getProperties().setProperty("Ice.OA.TestAdapter2.Endpoints", "default"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2"); Ice.ServantLocator loc = new ServantLocatorI(); adapter.addServantLocator(loc, "x"); try { adapter.addServantLocator(loc, "x"); - test(false); + test(false); } catch(Ice.AlreadyRegisteredException) { @@ -762,7 +762,7 @@ public class AllTests try { communicator.addObjectFactory(of, "::x"); - test(false); + test(false); } catch(Ice.AlreadyRegisteredException) { @@ -958,22 +958,22 @@ public class AllTests thrower.throwUndeclaredA(1); test(false); } - catch(A ex) - { - // - // We get the original exception with collocation - // optimization. - // - test(collocated); - test(ex.aMem == 1); - } + catch(A ex) + { + // + // We get the original exception with collocation + // optimization. + // + test(collocated); + test(ex.aMem == 1); + } catch(Ice.UnknownUserException) { - // - // We get an unknown user exception without collocation - // optimization. - // - test(!collocated); + // + // We get an unknown user exception without collocation + // optimization. + // + test(!collocated); } catch(Exception) { @@ -985,23 +985,23 @@ public class AllTests thrower.throwUndeclaredB(1, 2); test(false); } - catch(B ex) - { - // - // We get the original exception with collocation - // optimization. - // - test(collocated); - test(ex.aMem == 1); - test(ex.bMem == 2); - } + catch(B ex) + { + // + // We get the original exception with collocation + // optimization. + // + test(collocated); + test(ex.aMem == 1); + test(ex.bMem == 2); + } catch(Ice.UnknownUserException) { - // - // We get an unknown user exception without collocation - // optimization. - // - test(!collocated); + // + // We get an unknown user exception without collocation + // optimization. + // + test(!collocated); } catch(Exception) { @@ -1013,24 +1013,24 @@ public class AllTests thrower.throwUndeclaredC(1, 2, 3); test(false); } - catch(C ex) - { - // - // We get the original exception with collocation - // optimization. - // - test(collocated); - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } + catch(C ex) + { + // + // We get the original exception with collocation + // optimization. + // + test(collocated); + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); + } catch(Ice.UnknownUserException) { - // - // We get an unknown user exception without collocation - // optimization. - // - test(!collocated); + // + // We get an unknown user exception without collocation + // optimization. + // + test(!collocated); } catch(Exception) { diff --git a/cs/test/Ice/exceptions/Client.cs b/cs/test/Ice/exceptions/Client.cs index 1aea337534a..b6ec40a8b15 100755 --- a/cs/test/Ice/exceptions/Client.cs +++ b/cs/test/Ice/exceptions/Client.cs @@ -14,44 +14,44 @@ public class Client private static int run(string[] args, Ice.Communicator communicator) { - ThrowerPrx thrower = AllTests.allTests(communicator, false); - thrower.shutdown(); - return 0; + ThrowerPrx thrower = AllTests.allTests(communicator, false); + thrower.shutdown(); + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - 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; - } - } - - if(status != 0) - { - System.Environment.Exit(status); - } + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + 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; + } + } + + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/exceptions/Collocated.cs b/cs/test/Ice/exceptions/Collocated.cs index 6c1d1827bf1..646950c28c8 100755 --- a/cs/test/Ice/exceptions/Collocated.cs +++ b/cs/test/Ice/exceptions/Collocated.cs @@ -17,42 +17,42 @@ public class Collocated Ice.Object obj = new ThrowerI(adapter); adapter.add(obj, communicator.stringToIdentity("thrower")); AllTests.allTests(communicator, true); - return 0; + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - 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; - } - } - - if(status != 0) - { - System.Environment.Exit(status); - } + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + 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; + } + } + + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/exceptions/ObjectFactoryI.cs b/cs/test/Ice/exceptions/ObjectFactoryI.cs index bcf2a782a1f..50833b7034d 100755 --- a/cs/test/Ice/exceptions/ObjectFactoryI.cs +++ b/cs/test/Ice/exceptions/ObjectFactoryI.cs @@ -11,7 +11,7 @@ public sealed class ObjectFactoryI : Ice.LocalObjectImpl, Ice.ObjectFactory { public Ice.Object create(string s) { - return null; + return null; } public void destroy() diff --git a/cs/test/Ice/exceptions/ServantLocatorI.cs b/cs/test/Ice/exceptions/ServantLocatorI.cs index 9a17dca24cb..60c08d192da 100755 --- a/cs/test/Ice/exceptions/ServantLocatorI.cs +++ b/cs/test/Ice/exceptions/ServantLocatorI.cs @@ -11,8 +11,8 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator { public Ice.Object locate(Ice.Current curr, out Ice.LocalObject cookie) { - cookie = null; - return null; + cookie = null; + return null; } public void finished(Ice.Current curr, Ice.Object servant, Ice.LocalObject cookie) diff --git a/cs/test/Ice/exceptions/Server.cs b/cs/test/Ice/exceptions/Server.cs index d4837fb2545..07c6ea31708 100755 --- a/cs/test/Ice/exceptions/Server.cs +++ b/cs/test/Ice/exceptions/Server.cs @@ -31,7 +31,7 @@ public class Server private static int run(string[] args, Ice.Communicator communicator) { Ice.Properties properties = communicator.getProperties(); - // We don't need to disable warnings because we have a dummy logger. + // We don't need to disable warnings because we have a dummy logger. //properties.setProperty("Ice.Warn.Dispatch", "0"); properties.setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 2000:udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); @@ -49,12 +49,12 @@ public class Server try { - // - // For this test, we need a dummy logger, otherwise the - // assertion test will print an error message. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.logger = new DummyLogger(); + // + // For this test, we need a dummy logger, otherwise the + // assertion test will print an error message. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.logger = new DummyLogger(); communicator = Ice.Util.initialize(ref args, initData); status = run(args, communicator); } @@ -77,9 +77,9 @@ public class Server } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/exceptions/ThrowerAMDI.cs b/cs/test/Ice/exceptions/ThrowerAMDI.cs index ba5ac03cd94..8fe79fa7546 100644 --- a/cs/test/Ice/exceptions/ThrowerAMDI.cs +++ b/cs/test/Ice/exceptions/ThrowerAMDI.cs @@ -20,7 +20,7 @@ public class ThrowerI : ThrowerDisp_ public override void shutdown_async(AMD_Thrower_shutdown cb, Ice.Current current) { _adapter.getCommunicator().shutdown(); - cb.ice_response(); + cb.ice_response(); } public override void supportsUndeclaredExceptions_async(AMD_Thrower_supportsUndeclaredExceptions cb, Ice.Current current) @@ -46,23 +46,23 @@ public class ThrowerI : ThrowerDisp_ { A ex = new A(); ex.aMem = a; - cb.ice_exception(ex); + cb.ice_exception(ex); } else { D ex = new D(); ex.dMem = a; - cb.ice_exception(ex); + cb.ice_exception(ex); } } public override void throwBasA_async(AMD_Thrower_throwBasA cb, int a, int b, Ice.Current current) { - B ex = new B(); - ex.aMem = a; - ex.bMem = b; - throw ex; - //cb.ice_exception(ex); + B ex = new B(); + ex.aMem = a; + ex.bMem = b; + throw ex; + //cb.ice_exception(ex); } public override void throwBasB_async(AMD_Thrower_throwBasB cb, int a, int b, Ice.Current current) @@ -71,25 +71,25 @@ public class ThrowerI : ThrowerDisp_ ex.aMem = a; ex.bMem = b; throw ex; - //cb.ice_exception(ex); + //cb.ice_exception(ex); } public override void throwCasA_async(AMD_Thrower_throwCasA cb, int a, int b, int c, Ice.Current current) { - C ex = new C(); - ex.aMem = a; - ex.bMem = b; - ex.cMem = c; - cb.ice_exception(ex); + C ex = new C(); + ex.aMem = a; + ex.bMem = b; + ex.cMem = c; + cb.ice_exception(ex); } public override void throwCasB_async(AMD_Thrower_throwCasB cb, int a, int b, int c, Ice.Current current) { - C ex = new C(); - ex.aMem = a; - ex.bMem = b; - ex.cMem = c; - cb.ice_exception(ex); + C ex = new C(); + ex.aMem = a; + ex.bMem = b; + ex.cMem = c; + cb.ice_exception(ex); } public override void throwCasC_async(AMD_Thrower_throwCasC cb, int a, int b, int c, Ice.Current current) @@ -98,7 +98,7 @@ public class ThrowerI : ThrowerDisp_ ex.aMem = a; ex.bMem = b; ex.cMem = c; - cb.ice_exception(ex); + cb.ice_exception(ex); } public override void throwUndeclaredA_async(AMD_Thrower_throwUndeclaredA cb, int a, Ice.Current current) @@ -110,10 +110,10 @@ public class ThrowerI : ThrowerDisp_ public override void throwUndeclaredB_async(AMD_Thrower_throwUndeclaredB cb, int a, int b, Ice.Current current) { - B ex = new B(); - ex.aMem = a; - ex.bMem = b; - cb.ice_exception(ex); + B ex = new B(); + ex.aMem = a; + ex.bMem = b; + cb.ice_exception(ex); } public override void throwUndeclaredC_async(AMD_Thrower_throwUndeclaredC cb, int a, int b, int c, Ice.Current current) diff --git a/cs/test/Ice/exceptions/ThrowerI.cs b/cs/test/Ice/exceptions/ThrowerI.cs index 106c92c06a3..8e3c5ca32e1 100755 --- a/cs/test/Ice/exceptions/ThrowerI.cs +++ b/cs/test/Ice/exceptions/ThrowerI.cs @@ -105,26 +105,26 @@ public sealed class ThrowerI : ThrowerDisp_ public override void throwUndeclaredA(int a, Ice.Current current) { - A ex = new A(); - ex.aMem = a; + A ex = new A(); + ex.aMem = a; throw ex; } public override void throwUndeclaredB(int a, int b, Ice.Current current) { B ex = new B(); - ex.aMem = a; - ex.bMem = b; - throw ex; + ex.aMem = a; + ex.bMem = b; + throw ex; } public override void throwUndeclaredC(int a, int b, int c, Ice.Current current) { C ex = new C(); - ex.aMem = a; - ex.bMem = b; - ex.cMem = c; - throw ex; + ex.aMem = a; + ex.bMem = b; + ex.cMem = c; + throw ex; } private Ice.ObjectAdapter _adapter; diff --git a/cs/test/Ice/facets/AllTests.cs b/cs/test/Ice/facets/AllTests.cs index 38fc714f178..1acb7436814 100755 --- a/cs/test/Ice/facets/AllTests.cs +++ b/cs/test/Ice/facets/AllTests.cs @@ -23,7 +23,7 @@ public class AllTests public static GPrx allTests(Ice.Communicator communicator) { Console.Write("testing facet registration exceptions... "); - communicator.getProperties().setProperty("Ice.OA.FacetExceptionTestAdapter.Endpoints", "default"); + communicator.getProperties().setProperty("Ice.OA.FacetExceptionTestAdapter.Endpoints", "default"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter"); Ice.Object obj = new EmptyI(); adapter.add(obj, communicator.stringToIdentity("d")); @@ -31,7 +31,7 @@ public class AllTests try { adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD"); - test(false); + test(false); } catch(Ice.AlreadyRegisteredException) { @@ -40,7 +40,7 @@ public class AllTests try { adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD"); - test(false); + test(false); } catch(Ice.NotRegisteredException) { @@ -48,31 +48,31 @@ public class AllTests Console.WriteLine("ok"); Console.Write("testing removeAllFacets... "); - Ice.Object obj1 = new EmptyI(); - Ice.Object obj2 = new EmptyI(); - adapter.addFacet(obj1, communicator.stringToIdentity("id1"), "f1"); - adapter.addFacet(obj2, communicator.stringToIdentity("id1"), "f2"); - Ice.Object obj3 = new EmptyI(); - adapter.addFacet(obj1, communicator.stringToIdentity("id2"), "f1"); - adapter.addFacet(obj2, communicator.stringToIdentity("id2"), "f2"); - adapter.addFacet(obj3, communicator.stringToIdentity("id2"), ""); - Ice.FacetMap fm = adapter.removeAllFacets(communicator.stringToIdentity("id1")); - test(fm.Count == 2); - test(fm["f1"] == obj1); - test(fm["f2"] == obj2); - try - { + Ice.Object obj1 = new EmptyI(); + Ice.Object obj2 = new EmptyI(); + adapter.addFacet(obj1, communicator.stringToIdentity("id1"), "f1"); + adapter.addFacet(obj2, communicator.stringToIdentity("id1"), "f2"); + Ice.Object obj3 = new EmptyI(); + adapter.addFacet(obj1, communicator.stringToIdentity("id2"), "f1"); + adapter.addFacet(obj2, communicator.stringToIdentity("id2"), "f2"); + adapter.addFacet(obj3, communicator.stringToIdentity("id2"), ""); + Ice.FacetMap fm = adapter.removeAllFacets(communicator.stringToIdentity("id1")); + test(fm.Count == 2); + test(fm["f1"] == obj1); + test(fm["f2"] == obj2); + try + { adapter.removeAllFacets(communicator.stringToIdentity("id1")); - test(false); - } - catch(Ice.NotRegisteredException) - { - } - fm = adapter.removeAllFacets(communicator.stringToIdentity("id2")); - test(fm.Count == 3); - test(fm["f1"] == obj1); - test(fm["f2"] == obj2); - test(fm[""] == obj3); + test(false); + } + catch(Ice.NotRegisteredException) + { + } + fm = adapter.removeAllFacets(communicator.stringToIdentity("id2")); + test(fm.Count == 3); + test(fm["f1"] == obj1); + test(fm["f2"] == obj2); + test(fm[""] == obj3); Console.WriteLine("ok"); adapter.deactivate(); diff --git a/cs/test/Ice/facets/Client.cs b/cs/test/Ice/facets/Client.cs index a448f10cb2d..f7aa0e4f393 100755 --- a/cs/test/Ice/facets/Client.cs +++ b/cs/test/Ice/facets/Client.cs @@ -42,14 +42,14 @@ public class Collocated } catch(Ice.LocalException ex) { - System.Console.WriteLine(ex); + System.Console.WriteLine(ex); status = 1; } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/facets/Collocated.cs b/cs/test/Ice/facets/Collocated.cs index 3c98f42ef45..a58ad7fda9d 100755 --- a/cs/test/Ice/facets/Collocated.cs +++ b/cs/test/Ice/facets/Collocated.cs @@ -16,9 +16,9 @@ public class Collocated Ice.Object d = new DI(); adapter.add(d, communicator.stringToIdentity("d")); adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD"); - Ice.Object f = new FI(); + Ice.Object f = new FI(); adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF"); - Ice.Object h = new HI(communicator); + Ice.Object h = new HI(communicator); adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH"); AllTests.allTests(communicator); @@ -50,14 +50,14 @@ public class Collocated } catch(Ice.LocalException ex) { - System.Console.WriteLine(ex); + System.Console.WriteLine(ex); status = 1; } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/facets/Server.cs b/cs/test/Ice/facets/Server.cs index 70377403c87..e2ed521fcaf 100755 --- a/cs/test/Ice/facets/Server.cs +++ b/cs/test/Ice/facets/Server.cs @@ -39,7 +39,7 @@ public class Server } catch(System.Exception ex) { - System.Console.WriteLine(ex); + System.Console.WriteLine(ex); status = 1; } @@ -51,14 +51,14 @@ public class Server } catch(Ice.LocalException ex) { - System.Console.WriteLine(ex); + System.Console.WriteLine(ex); status = 1; } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/faultTolerance/AllTests.cs b/cs/test/Ice/faultTolerance/AllTests.cs index 05dba8b9494..2fe0860745c 100755 --- a/cs/test/Ice/faultTolerance/AllTests.cs +++ b/cs/test/Ice/faultTolerance/AllTests.cs @@ -24,146 +24,146 @@ public class AllTests private class Callback { - public Callback() - { - _called = false; - } + public Callback() + { + _called = false; + } - public bool check() - { - lock(this) - { - while(!_called) - { - Monitor.Wait(this, TimeSpan.FromMilliseconds(30000)); + public bool check() + { + lock(this) + { + while(!_called) + { + Monitor.Wait(this, TimeSpan.FromMilliseconds(30000)); - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - } - - public void called() - { - lock(this) - { - Debug.Assert(!_called); - _called = true; - Monitor.Pulse(this); - } - } + if(!_called) + { + return false; // Must be timeout. + } + } + + _called = false; + return true; + } + } + + public void called() + { + lock(this) + { + Debug.Assert(!_called); + _called = true; + Monitor.Pulse(this); + } + } - private bool _called; + private bool _called; } private class AMI_Test_pidI : AMI_TestIntf_pid { - public override void ice_response(int pid) - { - _pid = pid; - callback.called(); - } - - public override void ice_exception(Ice.Exception ex) - { - test(false); - } - - public int pid() - { - return _pid; - } - - public bool check() - { - return callback.check(); - } + public override void ice_response(int pid) + { + _pid = pid; + callback.called(); + } + + public override void ice_exception(Ice.Exception ex) + { + test(false); + } + + public int pid() + { + return _pid; + } + + public bool check() + { + return callback.check(); + } - private int _pid; - - private Callback callback = new Callback(); + private int _pid; + + private Callback callback = new Callback(); } private class AMI_Test_shutdownI : AMI_TestIntf_shutdown { - public override void ice_response() - { - callback.called(); - } - - public override void ice_exception(Ice.Exception ex) - { - test(false); - } - - public bool check() - { - return callback.check(); - } + public override void ice_response() + { + callback.called(); + } + + public override void ice_exception(Ice.Exception ex) + { + test(false); + } + + public bool check() + { + return callback.check(); + } - private Callback callback = new Callback(); + private Callback callback = new Callback(); } private class AMI_Test_abortI : AMI_TestIntf_abort { - public override void ice_response() - { - test(false); - } - - public override void ice_exception(Ice.Exception ex) - { - try - { - throw ex; - } - catch(Ice.ConnectionLostException ) - { - } - catch(Ice.ConnectFailedException) - { - } - catch(Ice.SocketException) - { - } - catch(Exception) - { - test(false); - } - callback.called(); - } - - public bool check() - { - return callback.check(); - } + public override void ice_response() + { + test(false); + } + + public override void ice_exception(Ice.Exception ex) + { + try + { + throw ex; + } + catch(Ice.ConnectionLostException ) + { + } + catch(Ice.ConnectFailedException) + { + } + catch(Ice.SocketException) + { + } + catch(Exception) + { + test(false); + } + callback.called(); + } + + public bool check() + { + return callback.check(); + } - private Callback callback = new Callback(); + private Callback callback = new Callback(); } private class AMI_Test_idempotentAbortI : AMI_TestIntf_idempotentAbort { - public override void ice_response() - { - test(false); - } - - public override void ice_exception(Ice.Exception ex) - { - @delegate.ice_exception(ex); - } - - public bool check() - { - return @delegate.check(); - } + public override void ice_response() + { + test(false); + } + + public override void ice_exception(Ice.Exception ex) + { + @delegate.ice_exception(ex); + } + + public bool check() + { + return @delegate.check(); + } - private AMI_Test_abortI @delegate = new AMI_Test_abortI(); + private AMI_Test_abortI @delegate = new AMI_Test_abortI(); } public static void allTests(Ice.Communicator communicator, System.Collections.ArrayList ports) @@ -187,122 +187,122 @@ public class AllTests Console.Out.WriteLine("ok"); int oldPid = 0; - bool ami = false; + bool ami = false; for(int i = 1, j = 0; i <= ports.Count; ++i, ++j) { - if(j > 3) - { - j = 0; - ami = !ami; - } + if(j > 3) + { + j = 0; + ami = !ami; + } - if(!ami) - { - Console.Out.Write("testing server #" + i + "... "); - Console.Out.Flush(); - int pid = obj.pid(); - test(pid != oldPid); - Console.Out.WriteLine("ok"); - oldPid = pid; - } - else - { - Console.Out.Write("testing server #" + i + " with AMI... "); - Console.Out.Flush(); - AMI_Test_pidI cb = new AMI_Test_pidI(); - obj.pid_async(cb); - test(cb.check()); - int pid = cb.pid(); - test(pid != oldPid); - Console.Out.WriteLine("ok"); - oldPid = pid; - } + if(!ami) + { + Console.Out.Write("testing server #" + i + "... "); + Console.Out.Flush(); + int pid = obj.pid(); + test(pid != oldPid); + Console.Out.WriteLine("ok"); + oldPid = pid; + } + else + { + Console.Out.Write("testing server #" + i + " with AMI... "); + Console.Out.Flush(); + AMI_Test_pidI cb = new AMI_Test_pidI(); + obj.pid_async(cb); + test(cb.check()); + int pid = cb.pid(); + test(pid != oldPid); + Console.Out.WriteLine("ok"); + oldPid = pid; + } if(j == 0) { - if(!ami) - { - Console.Out.Write("shutting down server #" + i + "... "); - Console.Out.Flush(); - obj.shutdown(); - Console.Out.WriteLine("ok"); - } - else - { - Console.Out.Write("shutting down server #" + i + " with AMI... "); - AMI_Test_shutdownI cb = new AMI_Test_shutdownI(); - obj.shutdown_async(cb); - test(cb.check()); - Console.Out.WriteLine("ok"); - } + if(!ami) + { + Console.Out.Write("shutting down server #" + i + "... "); + Console.Out.Flush(); + obj.shutdown(); + Console.Out.WriteLine("ok"); + } + else + { + Console.Out.Write("shutting down server #" + i + " with AMI... "); + AMI_Test_shutdownI cb = new AMI_Test_shutdownI(); + obj.shutdown_async(cb); + test(cb.check()); + Console.Out.WriteLine("ok"); + } } else if(j == 1 || i + 1 > ports.Count) { - if(!ami) - { - Console.Out.Write("aborting server #" + i + "... "); - Console.Out.Flush(); - try - { - obj.abort(); - test(false); - } - catch(Ice.ConnectionLostException) - { - Console.Out.WriteLine("ok"); - } - catch(Ice.ConnectFailedException) - { - Console.Out.WriteLine("ok"); - } - catch(Ice.SocketException) - { - Console.Out.WriteLine("ok"); - } - } - else - { - Console.Out.Write("aborting server #" + i + " with AMI... "); - Console.Out.Flush(); - AMI_Test_abortI cb = new AMI_Test_abortI(); - obj.abort_async(cb); - test(cb.check()); - Console.Out.WriteLine("ok"); - } + if(!ami) + { + Console.Out.Write("aborting server #" + i + "... "); + Console.Out.Flush(); + try + { + obj.abort(); + test(false); + } + catch(Ice.ConnectionLostException) + { + Console.Out.WriteLine("ok"); + } + catch(Ice.ConnectFailedException) + { + Console.Out.WriteLine("ok"); + } + catch(Ice.SocketException) + { + Console.Out.WriteLine("ok"); + } + } + else + { + Console.Out.Write("aborting server #" + i + " with AMI... "); + Console.Out.Flush(); + AMI_Test_abortI cb = new AMI_Test_abortI(); + obj.abort_async(cb); + test(cb.check()); + Console.Out.WriteLine("ok"); + } } else if(j == 2 || j == 3) { - if(!ami) - { - Console.Out.Write("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... "); - Console.Out.Flush(); - try - { - obj.idempotentAbort(); - test(false); - } - catch(Ice.ConnectionLostException) - { - Console.Out.WriteLine("ok"); - } - catch(Ice.ConnectFailedException) - { - Console.Out.WriteLine("ok"); - } - catch(Ice.SocketException) - { - Console.Out.WriteLine("ok"); - } - } - else - { - Console.Out.Write("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... "); - Console.Out.Flush(); - AMI_Test_idempotentAbortI cb = new AMI_Test_idempotentAbortI(); - obj.idempotentAbort_async(cb); - test(cb.check()); - Console.Out.WriteLine("ok"); - } + if(!ami) + { + Console.Out.Write("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... "); + Console.Out.Flush(); + try + { + obj.idempotentAbort(); + test(false); + } + catch(Ice.ConnectionLostException) + { + Console.Out.WriteLine("ok"); + } + catch(Ice.ConnectFailedException) + { + Console.Out.WriteLine("ok"); + } + catch(Ice.SocketException) + { + Console.Out.WriteLine("ok"); + } + } + else + { + Console.Out.Write("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... "); + Console.Out.Flush(); + AMI_Test_idempotentAbortI cb = new AMI_Test_idempotentAbortI(); + obj.idempotentAbort_async(cb); + test(cb.check()); + Console.Out.WriteLine("ok"); + } ++i; } else diff --git a/cs/test/Ice/faultTolerance/Client.cs b/cs/test/Ice/faultTolerance/Client.cs index f2588fdf947..7ca2066d9ba 100755 --- a/cs/test/Ice/faultTolerance/Client.cs +++ b/cs/test/Ice/faultTolerance/Client.cs @@ -50,12 +50,12 @@ public class Client try { - // - // This test aborts servers, so we don't want warnings. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.Warn.Connections", "0"); + // + // This test aborts servers, so we don't want warnings. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); + initData.properties.setProperty("Ice.Warn.Connections", "0"); communicator = Ice.Util.initialize(ref args, initData); status = run(args, communicator); @@ -74,14 +74,14 @@ public class Client } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/faultTolerance/Server.cs b/cs/test/Ice/faultTolerance/Server.cs index 96a20dac3c1..f6bceb9fd61 100755 --- a/cs/test/Ice/faultTolerance/Server.cs +++ b/cs/test/Ice/faultTolerance/Server.cs @@ -68,21 +68,21 @@ public class Server try { - // - // In this test, we need longer server idle time, - // otherwise our test servers may time out before they are - // used in the test. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ServerIdleTime", "120"); // Two minutes + // + // In this test, we need longer server idle time, + // otherwise our test servers may time out before they are + // used in the test. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); + initData.properties.setProperty("Ice.ServerIdleTime", "120"); // Two minutes communicator = Ice.Util.initialize(ref args, initData); status = run(args, communicator); } catch(System.Exception ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } @@ -94,14 +94,14 @@ public class Server } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/faultTolerance/TestI.cs b/cs/test/Ice/faultTolerance/TestI.cs index a9f95c92904..4634f7c29d2 100755 --- a/cs/test/Ice/faultTolerance/TestI.cs +++ b/cs/test/Ice/faultTolerance/TestI.cs @@ -17,36 +17,36 @@ public sealed class TestI : TestIntfDisp_ { public TestI(Ice.ObjectAdapter adapter) { - lock(this) - { - _adapter = adapter; - _p = Process.GetCurrentProcess(); - _pid = _p.Id; - } + lock(this) + { + _adapter = adapter; + _p = Process.GetCurrentProcess(); + _pid = _p.Id; + } } private void commitSuicide() { - _p.Kill(); - Thread.Sleep(5000); // Give other threads time to die. + _p.Kill(); + Thread.Sleep(5000); // Give other threads time to die. } public override void abort(Ice.Current current) { - commitSuicide(); + commitSuicide(); } public override void idempotentAbort(Ice.Current current) { - commitSuicide(); + commitSuicide(); } public override int pid(Ice.Current current) { - lock(this) - { - return _pid; - } + lock(this) + { + return _pid; + } } public override void shutdown(Ice.Current current) diff --git a/cs/test/Ice/hold/AllTests.cs b/cs/test/Ice/hold/AllTests.cs index e49bb67d4c2..3c5fccc21f2 100644 --- a/cs/test/Ice/hold/AllTests.cs +++ b/cs/test/Ice/hold/AllTests.cs @@ -22,32 +22,32 @@ public class AllTests public static void allTests(Ice.Communicator communicator) { - Console.Out.Write("testing stringToProxy... "); - Console.Out.Flush(); - String @ref = "hold:default -p 12010 -t 10000"; - Ice.ObjectPrx @base = communicator.stringToProxy(@ref); - test(@base != null); - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing checked cast... "); - Console.Out.Flush(); - HoldPrx hold = HoldPrxHelper.checkedCast(@base); - test(hold != null); - test(hold.Equals(@base)); - Console.Out.WriteLine("ok"); - - Console.Out.Write("changing state between active and hold rapidly... "); - Console.Out.Flush(); - for(int i = 0; i < 100; ++i) - { - hold.putOnHold(0); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("changing state to hold and shutting down server... "); - Console.Out.Flush(); - hold.shutdown(); - Console.Out.WriteLine("ok"); + Console.Out.Write("testing stringToProxy... "); + Console.Out.Flush(); + String @ref = "hold:default -p 12010 -t 10000"; + Ice.ObjectPrx @base = communicator.stringToProxy(@ref); + test(@base != null); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing checked cast... "); + Console.Out.Flush(); + HoldPrx hold = HoldPrxHelper.checkedCast(@base); + test(hold != null); + test(hold.Equals(@base)); + Console.Out.WriteLine("ok"); + + Console.Out.Write("changing state between active and hold rapidly... "); + Console.Out.Flush(); + for(int i = 0; i < 100; ++i) + { + hold.putOnHold(0); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("changing state to hold and shutting down server... "); + Console.Out.Flush(); + hold.shutdown(); + Console.Out.WriteLine("ok"); } } - + diff --git a/cs/test/Ice/hold/Client.cs b/cs/test/Ice/hold/Client.cs index 53b21005f87..04d4d285cf1 100644 --- a/cs/test/Ice/hold/Client.cs +++ b/cs/test/Ice/hold/Client.cs @@ -46,9 +46,9 @@ public class Client } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/hold/HoldI.cs b/cs/test/Ice/hold/HoldI.cs index e223c28c7a2..dda87e2a806 100644 --- a/cs/test/Ice/hold/HoldI.cs +++ b/cs/test/Ice/hold/HoldI.cs @@ -15,21 +15,21 @@ public sealed class HoldI : HoldDisp_ public override void putOnHold(int seconds, Ice.Current current) { - if(seconds <= 0) - { - current.adapter.hold(); - current.adapter.activate(); - } - else - { + if(seconds <= 0) + { + current.adapter.hold(); + current.adapter.activate(); + } + else + { Debug.Assert(false); // TODO - } + } } public override void shutdown(Ice.Current current) { - current.adapter.hold(); - current.adapter.getCommunicator().shutdown(); + current.adapter.hold(); + current.adapter.getCommunicator().shutdown(); } } diff --git a/cs/test/Ice/hold/Server.cs b/cs/test/Ice/hold/Server.cs index 87be4ce37be..791aa42cdd3 100644 --- a/cs/test/Ice/hold/Server.cs +++ b/cs/test/Ice/hold/Server.cs @@ -48,9 +48,9 @@ public class Server } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/inheritance/Client.cs b/cs/test/Ice/inheritance/Client.cs index fd09ff69976..1ebe61d7967 100755 --- a/cs/test/Ice/inheritance/Client.cs +++ b/cs/test/Ice/inheritance/Client.cs @@ -42,14 +42,14 @@ public class Client } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } - if(status != 0) - { - System.Environment.Exit(status); - } + if(status != 0) + { + System.Environment.Exit(status); + } } } diff --git a/cs/test/Ice/inheritance/Collocated.cs b/cs/test/Ice/inheritance/Collocated.cs index dac749441d9..5155ca6b6a6 100755 --- a/cs/test/Ice/inheritance/Collocated.cs +++ b/cs/test/Ice/inheritance/Collocated.cs @@ -17,39 +17,39 @@ public class Collocated Ice.Object obj = new InitialI(adapter); adapter.add(obj, communicator.stringToIdentity("initial")); AllTests.allTests(communicator); - return 0; + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - 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; - } - } - + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + 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; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/Ice/inheritance/Server.cs b/cs/test/Ice/inheritance/Server.cs index bbc14d015f0..08480d329b7 100755 --- a/cs/test/Ice/inheritance/Server.cs +++ b/cs/test/Ice/inheritance/Server.cs @@ -44,7 +44,7 @@ public class Server } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } diff --git a/cs/test/Ice/location/AllTests.cs b/cs/test/Ice/location/AllTests.cs index d8a280258a4..d65d6153d50 100755 --- a/cs/test/Ice/location/AllTests.cs +++ b/cs/test/Ice/location/AllTests.cs @@ -23,10 +23,10 @@ public class AllTests public static void allTests(Ice.Communicator communicator) { ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast( - communicator.stringToProxy("ServerManager :default -t 10000 -p 12010")); + communicator.stringToProxy("ServerManager :default -t 10000 -p 12010")); test(manager != null); - TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator()); - test(locator != null); + TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator()); + test(locator != null); Console.Out.Write("testing stringToProxy... "); Console.Out.Flush(); @@ -34,41 +34,41 @@ public class AllTests Ice.ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter"); Ice.ObjectPrx base3 = communicator.stringToProxy("test"); Ice.ObjectPrx base4 = communicator.stringToProxy("ServerManager"); - Ice.ObjectPrx base5 = communicator.stringToProxy("test2"); - Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter"); + Ice.ObjectPrx base5 = communicator.stringToProxy("test2"); + Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter"); Console.Out.WriteLine("ok"); - Console.Out.Write("testing ice_locator and ice_getLocator... "); - test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); - Ice.LocatorPrx anotherLocator = - Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator")); - @base = @base.ice_locator(anotherLocator); - test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0); - communicator.setDefaultLocator(null); - @base = communicator.stringToProxy("test @ TestAdapter"); - test(@base.ice_getLocator() == null); - @base = @base.ice_locator(anotherLocator); - test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0); - communicator.setDefaultLocator(locator); - @base = communicator.stringToProxy("test @ TestAdapter"); - test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); - - // - // We also test ice_router/ice_getRouter (perhaps we should add a - // test/Ice/router test?) - // - test(@base.ice_getRouter() == null); - Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter")); - @base = @base.ice_router(anotherRouter); - test(Ice.Util.proxyIdentityCompare(@base.ice_getRouter(), anotherRouter) == 0); - Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter")); - communicator.setDefaultRouter(router); - @base = communicator.stringToProxy("test @ TestAdapter"); - test(Ice.Util.proxyIdentityCompare(@base.ice_getRouter(), communicator.getDefaultRouter()) == 0); - communicator.setDefaultRouter(null); - @base = communicator.stringToProxy("test @ TestAdapter"); - test(@base.ice_getRouter() == null); - Console.Out.WriteLine("ok"); + Console.Out.Write("testing ice_locator and ice_getLocator... "); + test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); + Ice.LocatorPrx anotherLocator = + Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator")); + @base = @base.ice_locator(anotherLocator); + test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0); + communicator.setDefaultLocator(null); + @base = communicator.stringToProxy("test @ TestAdapter"); + test(@base.ice_getLocator() == null); + @base = @base.ice_locator(anotherLocator); + test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0); + communicator.setDefaultLocator(locator); + @base = communicator.stringToProxy("test @ TestAdapter"); + test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0); + + // + // We also test ice_router/ice_getRouter (perhaps we should add a + // test/Ice/router test?) + // + test(@base.ice_getRouter() == null); + Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter")); + @base = @base.ice_router(anotherRouter); + test(Ice.Util.proxyIdentityCompare(@base.ice_getRouter(), anotherRouter) == 0); + Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter")); + communicator.setDefaultRouter(router); + @base = communicator.stringToProxy("test @ TestAdapter"); + test(Ice.Util.proxyIdentityCompare(@base.ice_getRouter(), communicator.getDefaultRouter()) == 0); + communicator.setDefaultRouter(null); + @base = communicator.stringToProxy("test @ TestAdapter"); + test(@base.ice_getRouter() == null); + Console.Out.WriteLine("ok"); // // Start a server, get the port of the adapter it's listening on, @@ -90,10 +90,10 @@ public class AllTests test(obj3 != null); ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4); test(obj4 != null); - TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5); - test(obj5 != null); - TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6); - test(obj6 != null); + TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5); + test(obj5 != null); + TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6); + test(obj6 != null); Console.Out.WriteLine("ok"); Console.Out.Write("testing id@AdapterId indirect proxy... "); @@ -115,7 +115,7 @@ public class AllTests obj.shutdown(); manager.startServer(); try - { + { obj6.ice_ping(); } catch(Ice.LocalException) @@ -128,77 +128,77 @@ public class AllTests Console.Out.Flush(); obj.shutdown(); manager.startServer(); - try - { - obj3 = TestIntfPrxHelper.checkedCast(base3); - obj3.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - try - { - obj2 = TestIntfPrxHelper.checkedCast(base2); - obj2.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - obj.shutdown(); - manager.startServer(); - try - { - obj2 = TestIntfPrxHelper.checkedCast(base2); - obj2.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - try - { - obj3 = TestIntfPrxHelper.checkedCast(base3); - obj3.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - obj.shutdown(); - manager.startServer(); - try - { - obj2 = TestIntfPrxHelper.checkedCast(base2); - obj2.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - obj.shutdown(); - manager.startServer(); - try - { - obj3 = TestIntfPrxHelper.checkedCast(base2); - obj3.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - obj.shutdown(); - manager.startServer(); - try - { - obj5 = TestIntfPrxHelper.checkedCast(base5); - obj5.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } + try + { + obj3 = TestIntfPrxHelper.checkedCast(base3); + obj3.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + try + { + obj2 = TestIntfPrxHelper.checkedCast(base2); + obj2.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + obj.shutdown(); + manager.startServer(); + try + { + obj2 = TestIntfPrxHelper.checkedCast(base2); + obj2.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + try + { + obj3 = TestIntfPrxHelper.checkedCast(base3); + obj3.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + obj.shutdown(); + manager.startServer(); + try + { + obj2 = TestIntfPrxHelper.checkedCast(base2); + obj2.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + obj.shutdown(); + manager.startServer(); + try + { + obj3 = TestIntfPrxHelper.checkedCast(base2); + obj3.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + obj.shutdown(); + manager.startServer(); + try + { + obj5 = TestIntfPrxHelper.checkedCast(base5); + obj5.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } Console.Out.WriteLine("ok"); Console.Out.Write("testing proxy with unknown identity... "); @@ -231,70 +231,70 @@ public class AllTests } Console.Out.WriteLine("ok"); - Console.Out.Write("testing locator cache timeout... "); - Console.Out.Flush(); - - int count = locator.getRequestCount(); - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. - test(++count == locator.getRequestCount()); - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. - test(++count == locator.getRequestCount()); - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. - test(count == locator.getRequestCount()); - System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1200 * 1000)); // 1200ms - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. - test(++count == locator.getRequestCount()); - - communicator.stringToProxy("test").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. - count += 2; - test(count == locator.getRequestCount()); - communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout - test(count == locator.getRequestCount()); - System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1200 * 1000)); // 1200ms - communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout - count += 2; - test(count == locator.getRequestCount()); - - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping(); - test(count == locator.getRequestCount()); - communicator.stringToProxy("test").ice_locatorCacheTimeout(-1).ice_ping(); - test(count == locator.getRequestCount()); - communicator.stringToProxy("test@TestAdapter").ice_ping(); - test(count == locator.getRequestCount()); - communicator.stringToProxy("test").ice_ping(); - test(count == locator.getRequestCount()); + Console.Out.Write("testing locator cache timeout... "); + Console.Out.Flush(); + + int count = locator.getRequestCount(); + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. + test(++count == locator.getRequestCount()); + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. + test(++count == locator.getRequestCount()); + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. + test(count == locator.getRequestCount()); + System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1200 * 1000)); // 1200ms + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. + test(++count == locator.getRequestCount()); + + communicator.stringToProxy("test").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. + count += 2; + test(count == locator.getRequestCount()); + communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout + test(count == locator.getRequestCount()); + System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1200 * 1000)); // 1200ms + communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout + count += 2; + test(count == locator.getRequestCount()); + + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping(); + test(count == locator.getRequestCount()); + communicator.stringToProxy("test").ice_locatorCacheTimeout(-1).ice_ping(); + test(count == locator.getRequestCount()); + communicator.stringToProxy("test@TestAdapter").ice_ping(); + test(count == locator.getRequestCount()); + communicator.stringToProxy("test").ice_ping(); + test(count == locator.getRequestCount()); - test(communicator.stringToProxy("test").ice_locatorCacheTimeout(99).ice_getLocatorCacheTimeout() == 99); + test(communicator.stringToProxy("test").ice_locatorCacheTimeout(99).ice_getLocatorCacheTimeout() == 99); - Console.Out.WriteLine("ok"); + Console.Out.WriteLine("ok"); Console.Out.Write("testing proxy from server... "); Console.Out.Flush(); HelloPrx hello = obj.getHello(); hello.sayHello(); - test(hello.ice_getAdapterId().Equals("TestAdapter")); - hello = obj.getReplicatedHello(); + test(hello.ice_getAdapterId().Equals("TestAdapter")); + hello = obj.getReplicatedHello(); hello.sayHello(); - test(hello.ice_getAdapterId().Equals("ReplicatedAdapter")); + test(hello.ice_getAdapterId().Equals("ReplicatedAdapter")); Console.Out.WriteLine("ok"); - Console.Out.Write("testing proxy from server after shutdown... "); + Console.Out.Write("testing proxy from server after shutdown... "); Console.Out.Flush(); - obj.shutdown(); - manager.startServer(); - hello.sayHello(); - Console.Out.WriteLine("ok"); + obj.shutdown(); + manager.startServer(); + hello.sayHello(); + Console.Out.WriteLine("ok"); - Console.Out.Write("testing object migration..."); - Console.Out.Flush(); - hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); - obj.migrateHello(); - hello.sayHello(); - obj.migrateHello(); - hello.sayHello(); - obj.migrateHello(); - hello.sayHello(); - Console.Out.WriteLine("ok"); + Console.Out.Write("testing object migration..."); + Console.Out.Flush(); + hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); + obj.migrateHello(); + hello.sayHello(); + obj.migrateHello(); + hello.sayHello(); + obj.migrateHello(); + hello.sayHello(); + Console.Out.WriteLine("ok"); Console.Out.Write("testing whether server is gone... "); Console.Out.Flush(); @@ -309,33 +309,33 @@ public class AllTests Console.Out.WriteLine("ok"); } - Console.Out.Write("testing indirect proxies to collocated objects... "); - Console.Out.Flush(); + Console.Out.Write("testing indirect proxies to collocated objects... "); + Console.Out.Flush(); - Ice.Properties properties = communicator.getProperties(); - properties.setProperty("Ice.PrintAdapterReady", "0"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "default"); - adapter.setLocator(locator); - TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry()); - test(registry != null); + Ice.Properties properties = communicator.getProperties(); + properties.setProperty("Ice.PrintAdapterReady", "0"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "default"); + adapter.setLocator(locator); + TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry()); + test(registry != null); - Ice.Identity id = new Ice.Identity(); - id.name = Ice.Util.generateUUID(); - registry.addObject(adapter.add(new HelloI(), id)); - adapter.activate(); + Ice.Identity id = new Ice.Identity(); + id.name = Ice.Util.generateUUID(); + registry.addObject(adapter.add(new HelloI(), id)); + adapter.activate(); - try - { - HelloPrx helloPrx = HelloPrxHelper.checkedCast( - communicator.stringToProxy("\"" + communicator.identityToString(id) + "\"")); - helloPrx.ice_getConnection(); - test(false); - } - catch(Ice.CollocationOptimizationException) - { - Console.Out.WriteLine("ok"); - } - adapter.deactivate(); + try + { + HelloPrx helloPrx = HelloPrxHelper.checkedCast( + communicator.stringToProxy("\"" + communicator.identityToString(id) + "\"")); + helloPrx.ice_getConnection(); + test(false); + } + catch(Ice.CollocationOptimizationException) + { + Console.Out.WriteLine("ok"); + } + adapter.deactivate(); Console.Out.Write("shutdown server manager... "); Console.Out.Flush(); diff --git a/cs/test/Ice/location/Client.cs b/cs/test/Ice/location/Client.cs index 5adf5c5e465..f57dff74198 100755 --- a/cs/test/Ice/location/Client.cs +++ b/cs/test/Ice/location/Client.cs @@ -22,7 +22,7 @@ public class Client try { - Ice.InitializationData initData = new Ice.InitializationData(); + Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = Ice.Util.createProperties(ref args); initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); communicator = Ice.Util.initialize(ref args, initData); @@ -42,7 +42,7 @@ public class Client } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } diff --git a/cs/test/Ice/location/Server.cs b/cs/test/Ice/location/Server.cs index 2bd8c822448..91ffe838e90 100755 --- a/cs/test/Ice/location/Server.cs +++ b/cs/test/Ice/location/Server.cs @@ -18,7 +18,7 @@ public class Server // communicator and object adapter). // Ice.Properties properties = communicator.getProperties(); - properties.setProperty("Ice.ThreadPool.Server.Size", "2"); + properties.setProperty("Ice.ThreadPool.Server.Size", "2"); properties.setProperty("Ice.OA.ServerManagerAdapter.Endpoints", "default -p 12010 -t 30000:udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter"); @@ -33,7 +33,7 @@ public class Server adapter.add(@object, communicator.stringToIdentity("ServerManager")); registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager"))); Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast( - adapter.add(registry, communicator.stringToIdentity("registry"))); + adapter.add(registry, communicator.stringToIdentity("registry"))); ServerLocator locator = new ServerLocator(registry, registryPrx); adapter.add(locator, communicator.stringToIdentity("locator")); diff --git a/cs/test/Ice/location/ServerLocator.cs b/cs/test/Ice/location/ServerLocator.cs index 7d6148d133a..6bbf6ae5af7 100755 --- a/cs/test/Ice/location/ServerLocator.cs +++ b/cs/test/Ice/location/ServerLocator.cs @@ -13,20 +13,20 @@ public class ServerLocator : Test.TestLocatorDisp_ { _registry = registry; _registryPrx = registryPrx; - _requestCount = 0; + _requestCount = 0; } public override void findAdapterById_async(Ice.AMD_Locator_findAdapterById response, string adapter, - Ice.Current current) + Ice.Current current) { - ++_requestCount; + ++_requestCount; response.ice_response(_registry.getAdapter(adapter)); } public override void findObjectById_async(Ice.AMD_Locator_findObjectById response, Ice.Identity id, - Ice.Current current) + Ice.Current current) { - ++_requestCount; + ++_requestCount; response.ice_response(_registry.getObject(id)); } @@ -37,7 +37,7 @@ public class ServerLocator : Test.TestLocatorDisp_ public override int getRequestCount(Ice.Current current) { - return _requestCount; + return _requestCount; } private ServerLocatorRegistry _registry; diff --git a/cs/test/Ice/location/ServerLocatorRegistry.cs b/cs/test/Ice/location/ServerLocatorRegistry.cs index 32811b304d1..47658e6da15 100755 --- a/cs/test/Ice/location/ServerLocatorRegistry.cs +++ b/cs/test/Ice/location/ServerLocatorRegistry.cs @@ -18,23 +18,23 @@ public class ServerLocatorRegistry : Test.TestLocatorRegistryDisp_ } public override void setAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setAdapterDirectProxy cb, string adapter, - Ice.ObjectPrx obj, Ice.Current current) + Ice.ObjectPrx obj, Ice.Current current) { _adapters[adapter] = obj; - cb.ice_response(); + cb.ice_response(); } public override void setReplicatedAdapterDirectProxy_async( - Ice.AMD_LocatorRegistry_setReplicatedAdapterDirectProxy cb, - string adapter, string replica, Ice.ObjectPrx obj, Ice.Current current) + Ice.AMD_LocatorRegistry_setReplicatedAdapterDirectProxy cb, + string adapter, string replica, Ice.ObjectPrx obj, Ice.Current current) { _adapters[adapter] = obj; _adapters[replica] = obj; - cb.ice_response(); + cb.ice_response(); } public override void setServerProcessProxy_async(Ice.AMD_LocatorRegistry_setServerProcessProxy cb, - string id, Ice.ProcessPrx proxy, Ice.Current current) + string id, Ice.ProcessPrx proxy, Ice.Current current) { cb.ice_response(); } diff --git a/cs/test/Ice/location/ServerManagerI.cs b/cs/test/Ice/location/ServerManagerI.cs index 940f12e75db..a84332b58ba 100755 --- a/cs/test/Ice/location/ServerManagerI.cs +++ b/cs/test/Ice/location/ServerManagerI.cs @@ -16,8 +16,8 @@ public class ServerManagerI : ServerManagerDisp_ Ice.InitializationData initData) { _adapter = adapter; - _registry = registry; - _communicators = new ArrayList();
+ _registry = registry; + _communicators = new ArrayList();
_initData = initData;
_initData.properties.setProperty("Ice.OA.TestAdapter.Endpoints", "default");
_initData.properties.setProperty("Ice.OA.TestAdapter.AdapterId", "TestAdapter");
@@ -28,12 +28,12 @@ public class ServerManagerI : ServerManagerDisp_ public override void startServer(Ice.Current current) { - foreach(Ice.Communicator c in _communicators) - { - c.waitForShutdown(); - c.destroy(); - } - _communicators.Clear(); + foreach(Ice.Communicator c in _communicators) + { + c.waitForShutdown(); + c.destroy(); + } + _communicators.Clear(); // // Simulate a server: create a new communicator and object @@ -44,7 +44,7 @@ public class ServerManagerI : ServerManagerDisp_ // the adapter id instead of the endpoints. // Ice.Communicator serverCommunicator = Ice.Util.initialize(_initData); - _communicators.Add(serverCommunicator); + _communicators.Add(serverCommunicator); Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2"); @@ -53,9 +53,9 @@ public class ServerManagerI : ServerManagerDisp_ adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); - Ice.Object @object = new TestI(adapter, adapter2, _registry); - _registry.addObject(adapter.add(@object, serverCommunicator.stringToIdentity("test"))); - _registry.addObject(adapter.add(@object, serverCommunicator.stringToIdentity("test2"))); + Ice.Object @object = new TestI(adapter, adapter2, _registry); + _registry.addObject(adapter.add(@object, serverCommunicator.stringToIdentity("test"))); + _registry.addObject(adapter.add(@object, serverCommunicator.stringToIdentity("test2"))); adapter.activate(); adapter2.activate(); @@ -63,11 +63,11 @@ public class ServerManagerI : ServerManagerDisp_ public override void shutdown(Ice.Current current) { - foreach(Ice.Communicator c in _communicators) - { - c.destroy(); - } - _communicators.Clear(); + foreach(Ice.Communicator c in _communicators) + { + c.destroy(); + } + _communicators.Clear(); _adapter.getCommunicator().shutdown(); } diff --git a/cs/test/Ice/location/TestI.cs b/cs/test/Ice/location/TestI.cs index b594f36e837..38047b76808 100755 --- a/cs/test/Ice/location/TestI.cs +++ b/cs/test/Ice/location/TestI.cs @@ -15,9 +15,9 @@ public class TestI : TestIntfDisp_ { _adapter1 = adapter1; _adapter2 = adapter2; - _registry = registry; + _registry = registry; - _registry.addObject(_adapter1.add(new HelloI(), adapter1.getCommunicator().stringToIdentity("hello"))); + _registry.addObject(_adapter1.add(new HelloI(), adapter1.getCommunicator().stringToIdentity("hello"))); } public override void shutdown(Ice.Current current) @@ -28,26 +28,26 @@ public class TestI : TestIntfDisp_ public override HelloPrx getHello(Ice.Current current) { return HelloPrxHelper.uncheckedCast(_adapter1.createIndirectProxy( - _adapter1.getCommunicator().stringToIdentity("hello"))); + _adapter1.getCommunicator().stringToIdentity("hello"))); } public override HelloPrx getReplicatedHello(Ice.Current current) { return HelloPrxHelper.uncheckedCast(_adapter1.createProxy( - _adapter1.getCommunicator().stringToIdentity("hello"))); + _adapter1.getCommunicator().stringToIdentity("hello"))); } public override void migrateHello(Ice.Current current) { - Ice.Identity id = _adapter1.getCommunicator().stringToIdentity("hello"); - try - { - _registry.addObject(_adapter2.add(_adapter1.remove(id), id)); - } - catch(Ice.NotRegisteredException) - { - _registry.addObject(_adapter1.add(_adapter2.remove(id), id)); - } + Ice.Identity id = _adapter1.getCommunicator().stringToIdentity("hello"); + try + { + _registry.addObject(_adapter2.add(_adapter1.remove(id), id)); + } + catch(Ice.NotRegisteredException) + { + _registry.addObject(_adapter1.add(_adapter2.remove(id), id)); + } } private Ice.ObjectAdapter _adapter1; diff --git a/cs/test/Ice/objects/AllTests.cs b/cs/test/Ice/objects/AllTests.cs index b39150ed5b5..1ccdac9ec78 100755 --- a/cs/test/Ice/objects/AllTests.cs +++ b/cs/test/Ice/objects/AllTests.cs @@ -73,17 +73,17 @@ public class AllTests test(b1.theA is B); test(((B) b1.theA).theA == b1.theA); test(((B) b1.theA).theB == b1); - //test(((B)b1.theA).theC is C); // Redundant -- theC is always of type C + //test(((B)b1.theA).theC is C); // Redundant -- theC is always of type C test(((C) (((B) b1.theA).theC)).theB == b1.theA); - if(!collocated) - { - test(b1.preMarshalInvoked); - test(b1.postUnmarshalInvoked()); - test(b1.theA.preMarshalInvoked); - test(b1.theA.postUnmarshalInvoked()); - test(((B)b1.theA).theC.preMarshalInvoked); - test(((B)b1.theA).theC.postUnmarshalInvoked()); - } + if(!collocated) + { + test(b1.preMarshalInvoked); + test(b1.postUnmarshalInvoked()); + test(b1.theA.preMarshalInvoked); + test(b1.theA.postUnmarshalInvoked()); + test(((B)b1.theA).theC.preMarshalInvoked); + test(((B)b1.theA).theC.postUnmarshalInvoked()); + } // More tests possible for b2 and d, but I think this is already // sufficient. test(b2.theA == b2); @@ -116,8 +116,8 @@ public class AllTests test(dout.theA == b1out); test(dout.theB == b2out); test(dout.theC == null); - if(!collocated) - { + if(!collocated) + { test(dout.preMarshalInvoked); test(dout.postUnmarshalInvoked()); test(dout.theA.preMarshalInvoked); @@ -126,35 +126,35 @@ public class AllTests test(dout.theB.postUnmarshalInvoked()); test(dout.theB.theC.preMarshalInvoked); test(dout.theB.theC.postUnmarshalInvoked()); - } + } Console.Out.WriteLine("ok"); - if(!collocated) - { - Console.Out.Write("testing UnexpectedObjectException..."); - Console.Out.Flush(); - @ref = "uoet:default -p 12010 -t 10000"; - @base = communicator.stringToProxy(@ref); - test(@base != null); - UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(@base); - test(uoet != null); - try - { - uoet.op(); - test(false); - } - catch(Ice.UnexpectedObjectException ex) - { - test(ex.type.Equals("::Test::AlsoEmpty")); - test(ex.expectedType.Equals("::Test::Empty")); - } - catch(System.Exception ex) - { - Console.Out.WriteLine(ex); - test(false); - } - Console.Out.WriteLine("ok"); - } + if(!collocated) + { + Console.Out.Write("testing UnexpectedObjectException..."); + Console.Out.Flush(); + @ref = "uoet:default -p 12010 -t 10000"; + @base = communicator.stringToProxy(@ref); + test(@base != null); + UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(@base); + test(uoet != null); + try + { + uoet.op(); + test(false); + } + catch(Ice.UnexpectedObjectException ex) + { + test(ex.type.Equals("::Test::AlsoEmpty")); + test(ex.expectedType.Equals("::Test::Empty")); + } + catch(System.Exception ex) + { + Console.Out.WriteLine(ex); + test(false); + } + Console.Out.WriteLine("ok"); + } return initial; } diff --git a/cs/test/Ice/objects/Client.cs b/cs/test/Ice/objects/Client.cs index b3e14f1f845..36f7a2cc3d4 100755 --- a/cs/test/Ice/objects/Client.cs +++ b/cs/test/Ice/objects/Client.cs @@ -41,10 +41,10 @@ public class Client private static int run(string[] args, Ice.Communicator communicator) { - Ice.ObjectFactory factory = new MyObjectFactory(); - communicator.addObjectFactory(factory, "::Test::B"); - communicator.addObjectFactory(factory, "::Test::C"); - communicator.addObjectFactory(factory, "::Test::D"); + Ice.ObjectFactory factory = new MyObjectFactory(); + communicator.addObjectFactory(factory, "::Test::B"); + communicator.addObjectFactory(factory, "::Test::C"); + communicator.addObjectFactory(factory, "::Test::D"); InitialPrx initial = AllTests.allTests(communicator, false); initial.shutdown(); diff --git a/cs/test/Ice/objects/Collocated.cs b/cs/test/Ice/objects/Collocated.cs index 3ad77ece4ec..ff1fbf24d69 100755 --- a/cs/test/Ice/objects/Collocated.cs +++ b/cs/test/Ice/objects/Collocated.cs @@ -19,41 +19,41 @@ public class Client Initial initial = new InitialI(adapter); adapter.add(initial, communicator.stringToIdentity("initial")); AllTests.allTests(communicator, true); - // We must call shutdown even in the collocated case for cyclic dependency cleanup - initial.shutdown(); - return 0; + // We must call shutdown even in the collocated case for cyclic dependency cleanup + initial.shutdown(); + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - 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; - } - } - + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + 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; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/Ice/objects/UnexpectedObjectExceptionTestI.cs b/cs/test/Ice/objects/UnexpectedObjectExceptionTestI.cs index 75ff147d8ae..8860e220923 100644 --- a/cs/test/Ice/objects/UnexpectedObjectExceptionTestI.cs +++ b/cs/test/Ice/objects/UnexpectedObjectExceptionTestI.cs @@ -13,12 +13,12 @@ public sealed class UnexpectedObjectExceptionTestI : Ice.Blobject { public override bool ice_invoke(byte[] inParams, out byte[] outParams, Ice.Current current) { - Ice.Communicator communicator = current.adapter.getCommunicator(); - Ice.OutputStream @out = Ice.Util.createOutputStream(communicator); - AlsoEmpty ae = new AlsoEmpty(); - Test.AlsoEmptyHelper.write(@out, ae); - @out.writePendingObjects(); - outParams = @out.finished(); - return true; + Ice.Communicator communicator = current.adapter.getCommunicator(); + Ice.OutputStream @out = Ice.Util.createOutputStream(communicator); + AlsoEmpty ae = new AlsoEmpty(); + Test.AlsoEmptyHelper.write(@out, ae); + @out.writePendingObjects(); + outParams = @out.finished(); + return true; } } diff --git a/cs/test/Ice/operations/AllTests.cs b/cs/test/Ice/operations/AllTests.cs index 7efa3c0220f..cc1c0a26e0f 100755 --- a/cs/test/Ice/operations/AllTests.cs +++ b/cs/test/Ice/operations/AllTests.cs @@ -13,165 +13,165 @@ public class AllTests { private static void test(bool b) { - if (!b) - { - throw new Exception(); - } + if (!b) + { + throw new Exception(); + } } public static Test.MyClassPrx allTests(Ice.Communicator communicator, bool collocated) { - Console.Out.Write("testing stringToProxy... "); - Console.Out.Flush(); - string rf = "test:default -p 12010 -t 5000"; - Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf); - test(baseProxy != null); - Console.Out.WriteLine("ok"); - Console.Out.Write("testing ice_getCommunicator... "); - Console.Out.Flush(); - test(baseProxy.ice_getCommunicator() == communicator); - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing proxy methods... "); - test(communicator.identityToString( - baseProxy.ice_identity(communicator.stringToIdentity("other")).ice_getIdentity()).Equals("other")); - test(baseProxy.ice_facet("facet").ice_getFacet().Equals("facet")); - test(baseProxy.ice_adapterId("id").ice_getAdapterId().Equals("id")); - test(baseProxy.ice_twoway().ice_isTwoway()); - test(baseProxy.ice_oneway().ice_isOneway()); - test(baseProxy.ice_batchOneway().ice_isBatchOneway()); - test(baseProxy.ice_datagram().ice_isDatagram()); - test(baseProxy.ice_batchDatagram().ice_isBatchDatagram()); - test(baseProxy.ice_secure(true).ice_isSecure()); - test(!baseProxy.ice_secure(false).ice_isSecure()); - test(baseProxy.ice_collocationOptimized(true).ice_isCollocationOptimized()); - test(!baseProxy.ice_collocationOptimized(false).ice_isCollocationOptimized()); - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing proxy comparison... "); - Console.Out.Flush(); - - test(communicator.stringToProxy("foo").Equals(communicator.stringToProxy("foo"))); - test(!communicator.stringToProxy("foo").Equals(communicator.stringToProxy("foo2"))); - - Ice.ObjectPrx compObj = communicator.stringToProxy("foo"); - - test(compObj.ice_facet("facet").Equals(compObj.ice_facet("facet"))); - test(!compObj.ice_facet("facet").Equals(compObj.ice_facet("facet1"))); - - test(compObj.ice_oneway().Equals(compObj.ice_oneway())); - test(!compObj.ice_oneway().Equals(compObj.ice_twoway())); - - test(compObj.ice_secure(true).Equals(compObj.ice_secure(true))); - test(!compObj.ice_secure(false).Equals(compObj.ice_secure(true))); - - test(compObj.ice_collocationOptimized(true).Equals(compObj.ice_collocationOptimized(true))); - test(!compObj.ice_collocationOptimized(false).Equals(compObj.ice_collocationOptimized(true))); - - test(compObj.ice_connectionCached(true).Equals(compObj.ice_connectionCached(true))); - test(!compObj.ice_connectionCached(false).Equals(compObj.ice_connectionCached(true))); - - test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).Equals( - compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random))); - test(!compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).Equals( - compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered))); - - test(compObj.ice_connectionId("id2").Equals(compObj.ice_connectionId("id2"))); - test(!compObj.ice_connectionId("id1").Equals(compObj.ice_connectionId("id2"))); - - test(compObj.ice_compress(true).Equals(compObj.ice_compress(true))); - test(!compObj.ice_compress(false).Equals(compObj.ice_compress(true))); - - test(compObj.ice_timeout(20).Equals(compObj.ice_timeout(20))); - test(!compObj.ice_timeout(10).Equals(compObj.ice_timeout(20))); - - Ice.ObjectPrx compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); - Ice.ObjectPrx compObj2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); - test(!compObj1.Equals(compObj2)); - - compObj1 = communicator.stringToProxy("foo@MyAdapter1"); - compObj2 = communicator.stringToProxy("foo@MyAdapter2"); - test(!compObj1.Equals(compObj2)); - - test(compObj1.ice_locatorCacheTimeout(20).Equals(compObj1.ice_locatorCacheTimeout(20))); - test(!compObj1.ice_locatorCacheTimeout(10).Equals(compObj1.ice_locatorCacheTimeout(20))); - - compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 1000"); - compObj2 = communicator.stringToProxy("foo@MyAdapter1"); - test(!compObj1.Equals(compObj2)); - - // - // TODO: Ideally we should also test comparison of fixed proxies. - // - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing checked cast... "); - Console.Out.Flush(); - Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy); - test(cl != null); - Test.MyDerivedClassPrx derivedProxy = Test.MyDerivedClassPrxHelper.checkedCast(cl); - test(derivedProxy != null); - test(cl.Equals(baseProxy)); - test(derivedProxy.Equals(baseProxy)); - test(cl.Equals(derivedProxy)); - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing checked cast with context... "); - Console.Out.Flush(); - string cref = "context:default -p 12010 -t 5000"; - Ice.ObjectPrx cbase = communicator.stringToProxy(cref); - test(cbase != null); - - Test.TestCheckedCastPrx tccp = Test.TestCheckedCastPrxHelper.checkedCast(cbase); - Ice.Context c = tccp.getContext(); - test(c == null || c.Count == 0); - - c = new Ice.Context(); - c["one"] = "hello"; - c["two"] = "world"; - tccp = Test.TestCheckedCastPrxHelper.checkedCast(cbase, c); - Ice.Context c2 = tccp.getContext(); - test(c.Equals(c2)); - Console.Out.WriteLine("ok"); - - if(!collocated) - { - Console.Out.Write("testing timeout... "); - Console.Out.Flush(); - try - { - Test.MyClassPrx clTimeout = Test.MyClassPrxHelper.uncheckedCast(cl.ice_timeout(500)); - clTimeout.opSleep(1000); - test(false); - } - catch(Ice.TimeoutException) - { - } - Console.Out.WriteLine("ok"); - } - - Console.Out.Write("testing twoway operations... "); - Console.Out.Flush(); - Twoways.twoways(communicator, cl); - Twoways.twoways(communicator, derivedProxy); - derivedProxy.opDerived(); - Console.Out.WriteLine("ok"); - - if(!collocated) - { - Console.Out.Write("testing twoway operations with AMI... "); - Console.Out.Flush(); - TwowaysAMI.twowaysAMI(communicator, cl); - TwowaysAMI.twowaysAMI(communicator, derivedProxy); - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing batch oneway operations... "); - Console.Out.Flush(); - BatchOneways.batchOneways(cl); - BatchOneways.batchOneways(derivedProxy); - Console.Out.WriteLine("ok"); - } - - return cl; + Console.Out.Write("testing stringToProxy... "); + Console.Out.Flush(); + string rf = "test:default -p 12010 -t 5000"; + Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf); + test(baseProxy != null); + Console.Out.WriteLine("ok"); + Console.Out.Write("testing ice_getCommunicator... "); + Console.Out.Flush(); + test(baseProxy.ice_getCommunicator() == communicator); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing proxy methods... "); + test(communicator.identityToString( + baseProxy.ice_identity(communicator.stringToIdentity("other")).ice_getIdentity()).Equals("other")); + test(baseProxy.ice_facet("facet").ice_getFacet().Equals("facet")); + test(baseProxy.ice_adapterId("id").ice_getAdapterId().Equals("id")); + test(baseProxy.ice_twoway().ice_isTwoway()); + test(baseProxy.ice_oneway().ice_isOneway()); + test(baseProxy.ice_batchOneway().ice_isBatchOneway()); + test(baseProxy.ice_datagram().ice_isDatagram()); + test(baseProxy.ice_batchDatagram().ice_isBatchDatagram()); + test(baseProxy.ice_secure(true).ice_isSecure()); + test(!baseProxy.ice_secure(false).ice_isSecure()); + test(baseProxy.ice_collocationOptimized(true).ice_isCollocationOptimized()); + test(!baseProxy.ice_collocationOptimized(false).ice_isCollocationOptimized()); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing proxy comparison... "); + Console.Out.Flush(); + + test(communicator.stringToProxy("foo").Equals(communicator.stringToProxy("foo"))); + test(!communicator.stringToProxy("foo").Equals(communicator.stringToProxy("foo2"))); + + Ice.ObjectPrx compObj = communicator.stringToProxy("foo"); + + test(compObj.ice_facet("facet").Equals(compObj.ice_facet("facet"))); + test(!compObj.ice_facet("facet").Equals(compObj.ice_facet("facet1"))); + + test(compObj.ice_oneway().Equals(compObj.ice_oneway())); + test(!compObj.ice_oneway().Equals(compObj.ice_twoway())); + + test(compObj.ice_secure(true).Equals(compObj.ice_secure(true))); + test(!compObj.ice_secure(false).Equals(compObj.ice_secure(true))); + + test(compObj.ice_collocationOptimized(true).Equals(compObj.ice_collocationOptimized(true))); + test(!compObj.ice_collocationOptimized(false).Equals(compObj.ice_collocationOptimized(true))); + + test(compObj.ice_connectionCached(true).Equals(compObj.ice_connectionCached(true))); + test(!compObj.ice_connectionCached(false).Equals(compObj.ice_connectionCached(true))); + + test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).Equals( + compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random))); + test(!compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).Equals( + compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered))); + + test(compObj.ice_connectionId("id2").Equals(compObj.ice_connectionId("id2"))); + test(!compObj.ice_connectionId("id1").Equals(compObj.ice_connectionId("id2"))); + + test(compObj.ice_compress(true).Equals(compObj.ice_compress(true))); + test(!compObj.ice_compress(false).Equals(compObj.ice_compress(true))); + + test(compObj.ice_timeout(20).Equals(compObj.ice_timeout(20))); + test(!compObj.ice_timeout(10).Equals(compObj.ice_timeout(20))); + + Ice.ObjectPrx compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); + Ice.ObjectPrx compObj2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); + test(!compObj1.Equals(compObj2)); + + compObj1 = communicator.stringToProxy("foo@MyAdapter1"); + compObj2 = communicator.stringToProxy("foo@MyAdapter2"); + test(!compObj1.Equals(compObj2)); + + test(compObj1.ice_locatorCacheTimeout(20).Equals(compObj1.ice_locatorCacheTimeout(20))); + test(!compObj1.ice_locatorCacheTimeout(10).Equals(compObj1.ice_locatorCacheTimeout(20))); + + compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 1000"); + compObj2 = communicator.stringToProxy("foo@MyAdapter1"); + test(!compObj1.Equals(compObj2)); + + // + // TODO: Ideally we should also test comparison of fixed proxies. + // + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing checked cast... "); + Console.Out.Flush(); + Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy); + test(cl != null); + Test.MyDerivedClassPrx derivedProxy = Test.MyDerivedClassPrxHelper.checkedCast(cl); + test(derivedProxy != null); + test(cl.Equals(baseProxy)); + test(derivedProxy.Equals(baseProxy)); + test(cl.Equals(derivedProxy)); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing checked cast with context... "); + Console.Out.Flush(); + string cref = "context:default -p 12010 -t 5000"; + Ice.ObjectPrx cbase = communicator.stringToProxy(cref); + test(cbase != null); + + Test.TestCheckedCastPrx tccp = Test.TestCheckedCastPrxHelper.checkedCast(cbase); + Ice.Context c = tccp.getContext(); + test(c == null || c.Count == 0); + + c = new Ice.Context(); + c["one"] = "hello"; + c["two"] = "world"; + tccp = Test.TestCheckedCastPrxHelper.checkedCast(cbase, c); + Ice.Context c2 = tccp.getContext(); + test(c.Equals(c2)); + Console.Out.WriteLine("ok"); + + if(!collocated) + { + Console.Out.Write("testing timeout... "); + Console.Out.Flush(); + try + { + Test.MyClassPrx clTimeout = Test.MyClassPrxHelper.uncheckedCast(cl.ice_timeout(500)); + clTimeout.opSleep(1000); + test(false); + } + catch(Ice.TimeoutException) + { + } + Console.Out.WriteLine("ok"); + } + + Console.Out.Write("testing twoway operations... "); + Console.Out.Flush(); + Twoways.twoways(communicator, cl); + Twoways.twoways(communicator, derivedProxy); + derivedProxy.opDerived(); + Console.Out.WriteLine("ok"); + + if(!collocated) + { + Console.Out.Write("testing twoway operations with AMI... "); + Console.Out.Flush(); + TwowaysAMI.twowaysAMI(communicator, cl); + TwowaysAMI.twowaysAMI(communicator, derivedProxy); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing batch oneway operations... "); + Console.Out.Flush(); + BatchOneways.batchOneways(cl); + BatchOneways.batchOneways(derivedProxy); + Console.Out.WriteLine("ok"); + } + + return cl; } } diff --git a/cs/test/Ice/operations/BatchOneways.cs b/cs/test/Ice/operations/BatchOneways.cs index 1545fd6d972..6c9100c506d 100644 --- a/cs/test/Ice/operations/BatchOneways.cs +++ b/cs/test/Ice/operations/BatchOneways.cs @@ -21,58 +21,58 @@ class BatchOneways internal static void batchOneways(Test.MyClassPrx p) { - byte[] tbs1 = new byte[10 * 1024]; - byte[] tbs2 = new byte[99 * 1024]; - byte[] tbs3 = new byte[100 * 1024]; - Test.ByteS bs1 = new Test.ByteS(tbs1); - Test.ByteS bs2 = new Test.ByteS(tbs2); - Test.ByteS bs3 = new Test.ByteS(tbs3); + byte[] tbs1 = new byte[10 * 1024]; + byte[] tbs2 = new byte[99 * 1024]; + byte[] tbs3 = new byte[100 * 1024]; + Test.ByteS bs1 = new Test.ByteS(tbs1); + Test.ByteS bs2 = new Test.ByteS(tbs2); + Test.ByteS bs3 = new Test.ByteS(tbs3); - try + try { p.opByteSOneway(bs1); - test(true); + test(true); + } + catch(Ice.MemoryLimitException) + { + test(false); } - catch(Ice.MemoryLimitException) - { - test(false); - } - try + try { p.opByteSOneway(bs2); - test(true); + test(true); + } + catch(Ice.MemoryLimitException) + { + test(false); } - catch(Ice.MemoryLimitException) - { - test(false); - } - try + try { p.opByteSOneway(bs3); - test(false); + test(false); + } + catch(Ice.MemoryLimitException) + { + test(true); } - catch(Ice.MemoryLimitException) - { - test(true); - } - Test.MyClassPrx batch = Test.MyClassPrxHelper.uncheckedCast(p.ice_batchOneway()); + Test.MyClassPrx batch = Test.MyClassPrxHelper.uncheckedCast(p.ice_batchOneway()); - for(int i = 0 ; i < 30 ; ++i) - { - try - { - batch.opByteSOneway(bs1); - test(true); - } - catch(Ice.MemoryLimitException) - { - test(false); - } - } + for(int i = 0 ; i < 30 ; ++i) + { + try + { + batch.opByteSOneway(bs1); + test(true); + } + catch(Ice.MemoryLimitException) + { + test(false); + } + } - batch.ice_getConnection().flushBatchRequests(); + batch.ice_getConnection().flushBatchRequests(); } } diff --git a/cs/test/Ice/operations/Client.cs b/cs/test/Ice/operations/Client.cs index a25f9994190..e4d323a33e3 100755 --- a/cs/test/Ice/operations/Client.cs +++ b/cs/test/Ice/operations/Client.cs @@ -13,70 +13,70 @@ public class Client { private static int run(String[] args, Ice.Communicator communicator) { - Test.MyClassPrx myClass = AllTests.allTests(communicator, false); - - Console.Out.Write("testing server shutdown... "); - Console.Out.Flush(); - myClass.shutdown(); - try - { - myClass.opVoid(); - throw new System.Exception(); - } - catch(Ice.LocalException) - { - Console.Out.WriteLine("ok"); - } - - return 0; + Test.MyClassPrx myClass = AllTests.allTests(communicator, false); + + Console.Out.Write("testing server shutdown... "); + Console.Out.Flush(); + myClass.shutdown(); + try + { + myClass.opVoid(); + throw new System.Exception(); + } + catch(Ice.LocalException) + { + Console.Out.WriteLine("ok"); + } + + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI. - initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); + initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI. + initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - // - // We must set MessageSizeMax to an explicit values, - // because we run tests to check whether - // Ice.MemoryLimitException is raised as expected. - // - initData.properties.setProperty("Ice.MessageSizeMax", "100"); + // + // We must set MessageSizeMax to an explicit values, + // because we run tests to check whether + // Ice.MemoryLimitException is raised as expected. + // + initData.properties.setProperty("Ice.MessageSizeMax", "100"); - // - // We don't want connection warnings because of the timeout test. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); + // + // We don't want connection warnings because of the timeout test. + // + initData.properties.setProperty("Ice.Warn.Connections", "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; - } - } - + 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; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/Ice/operations/Collocated.cs b/cs/test/Ice/operations/Collocated.cs index f29bf70fa93..51597ecac0b 100755 --- a/cs/test/Ice/operations/Collocated.cs +++ b/cs/test/Ice/operations/Collocated.cs @@ -15,10 +15,10 @@ public class Collocated { communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 5000"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Identity id = communicator.stringToIdentity("test"); - adapter.add(new MyDerivedClassI(adapter, id), id); - adapter.add(new TestCheckedCastI(), communicator.stringToIdentity("context")); - adapter.activate(); + Ice.Identity id = communicator.stringToIdentity("test"); + adapter.add(new MyDerivedClassI(adapter, id), id); + adapter.add(new TestCheckedCastI(), communicator.stringToIdentity("context")); + adapter.activate(); AllTests.allTests(communicator, true); @@ -27,38 +27,38 @@ public class Collocated public static void Main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); - initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI. - initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "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; - } - } - + int status = 0; + Ice.Communicator communicator = null; + + try + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); + initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI. + initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "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; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/Ice/operations/MyDerivedClassAMDI.cs b/cs/test/Ice/operations/MyDerivedClassAMDI.cs index 52d641fdaf0..50680b35633 100755 --- a/cs/test/Ice/operations/MyDerivedClassAMDI.cs +++ b/cs/test/Ice/operations/MyDerivedClassAMDI.cs @@ -14,10 +14,10 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass { private static void test(bool b) { - if (!b) - { - throw new Exception(); - } + if (!b) + { + throw new Exception(); + } } internal class Thread_opVoid @@ -27,30 +27,30 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass _cb = cb; } - public void Start() - { - lock(this) - { - _thread = new Thread(new ThreadStart(Run)); - _thread.Start(); - } - } + public void Start() + { + lock(this) + { + _thread = new Thread(new ThreadStart(Run)); + _thread.Start(); + } + } public void Run() { _cb.ice_response(); } - public void Join() - { - lock(this) - { - _thread.Join(); - } - } + public void Join() + { + lock(this) + { + _thread.Join(); + } + } private Test.AMD_MyClass_opVoid _cb; - private Thread _thread; + private Thread _thread; } public MyDerivedClassI(Ice.ObjectAdapter adapter, Ice.Identity identity) @@ -85,8 +85,8 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass public override void opSleep_async(Test.AMD_MyClass_opSleep cb, int duration, Ice.Current current) { - System.Threading.Thread.Sleep(duration); - cb.ice_response(); + System.Threading.Thread.Sleep(duration); + cb.ice_response(); } public override void opBool_async(Test.AMD_MyClass_opBool cb, bool p1, bool p2, Ice.Current current) @@ -215,7 +215,7 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass { Test.MyClassPrx p2 = p1; Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy( - _adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); + _adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); cb.ice_response(Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(_identity)), p2, p3); } @@ -299,19 +299,19 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass public override void opByteSOneway_async(Test.AMD_MyClass_opByteSOneway cb, Test.ByteS s, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public override void opDoubleMarshaling_async(Test.AMD_MyClass_opDoubleMarshaling cb, double p1, Test.DoubleS p2, - Ice.Current current) - { - double d = 1278312346.0 / 13.0; - test(p1 == d); - for(int i = 0; i < p2.Count; ++i) - { - test(p2[i] == d); - } - cb.ice_response(); + Ice.Current current) + { + double d = 1278312346.0 / 13.0; + test(p1 == d); + for(int i = 0; i < p2.Count; ++i) + { + test(p2[i] == d); + } + cb.ice_response(); } public override void opStringS_async(Test.AMD_MyClass_opStringS cb, Test.StringS p1, Test.StringS p2, Ice.Current current) diff --git a/cs/test/Ice/operations/MyDerivedClassI.cs b/cs/test/Ice/operations/MyDerivedClassI.cs index c35e85f5d28..115727d07cd 100755 --- a/cs/test/Ice/operations/MyDerivedClassI.cs +++ b/cs/test/Ice/operations/MyDerivedClassI.cs @@ -13,21 +13,21 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass { private static void test(bool b) { - if (!b) - { - throw new Exception(); - } + if (!b) + { + throw new Exception(); + } } public MyDerivedClassI(Ice.ObjectAdapter adapter, Ice.Identity identity) { - _adapter = adapter; - _identity = identity; + _adapter = adapter; + _identity = identity; } public override void shutdown(Ice.Current current) { - _adapter.getCommunicator().shutdown(); + _adapter.getCommunicator().shutdown(); } public override void opVoid(Ice.Current current) @@ -36,226 +36,226 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass public override void opSleep(int duration, Ice.Current current) { - System.Threading.Thread.Sleep(duration); + System.Threading.Thread.Sleep(duration); } public override bool opBool(bool p1, bool p2, out bool p3, Ice.Current current) { - p3 = p1; - return p2; + p3 = p1; + return p2; } public override Test.BoolS opBoolS(Test.BoolS p1, Test.BoolS p2, out Test.BoolS p3, Ice.Current current) { - p3 = new Test.BoolS(); - p3.AddRange(p1); - p3.AddRange(p2); - Test.BoolS r = new Test.BoolS(); - for(int i = 0; i < p1.Count; i++) - { - r.Add(p1[p1.Count - (i + 1)]); - } - return r; + p3 = new Test.BoolS(); + p3.AddRange(p1); + p3.AddRange(p2); + Test.BoolS r = new Test.BoolS(); + for(int i = 0; i < p1.Count; i++) + { + r.Add(p1[p1.Count - (i + 1)]); + } + return r; } public override Test.BoolSS opBoolSS(Test.BoolSS p1, Test.BoolSS p2, out Test.BoolSS p3, Ice.Current current) { - p3 = new Test.BoolSS(); - p3.AddRange(p1); - p3.AddRange(p2); - Test.BoolSS r = new Test.BoolSS(); - for(int i = 0; i < p1.Count; i++) - { - r.Add(p1[p1.Count - (i + 1)]); - } - return r; + p3 = new Test.BoolSS(); + p3.AddRange(p1); + p3.AddRange(p2); + Test.BoolSS r = new Test.BoolSS(); + for(int i = 0; i < p1.Count; i++) + { + r.Add(p1[p1.Count - (i + 1)]); + } + return r; } public override byte opByte(byte p1, byte p2, out byte p3, Ice.Current current) { - p3 = (byte)(p1 ^ p2); - return p1; + p3 = (byte)(p1 ^ p2); + return p1; } public override Test.ByteBoolD opByteBoolD(Test.ByteBoolD p1, Test.ByteBoolD p2, out Test.ByteBoolD p3, Ice.Current current) { - p3 = p1; - Test.ByteBoolD r = new Test.ByteBoolD(); - r.AddRange(p1); - r.AddRange(p2); - return r; + p3 = p1; + Test.ByteBoolD r = new Test.ByteBoolD(); + r.AddRange(p1); + r.AddRange(p2); + return r; } public override Test.ByteS opByteS(Test.ByteS p1, Test.ByteS p2, out Test.ByteS p3, Ice.Current current) { - p3 = new Test.ByteS(); - for(int i = 0; i < p1.Count; i++) - { - p3.Add(p1[p1.Count - (i + 1)]); - } - - Test.ByteS r = new Test.ByteS(p1.ToArray()); - r.AddRange(p2); - return r; + p3 = new Test.ByteS(); + for(int i = 0; i < p1.Count; i++) + { + p3.Add(p1[p1.Count - (i + 1)]); + } + + Test.ByteS r = new Test.ByteS(p1.ToArray()); + r.AddRange(p2); + return r; } public override Test.ByteSS opByteSS(Test.ByteSS p1, Test.ByteSS p2, out Test.ByteSS p3, Ice.Current current) { - p3 = new Test.ByteSS(); - for(int i = 0; i < p1.Count; i++) - { - p3.Add(p1[p1.Count - (i + 1)]); - } - - Test.ByteSS r = new Test.ByteSS(); - r.AddRange(p1); - r.AddRange(p2); - return r; + p3 = new Test.ByteSS(); + for(int i = 0; i < p1.Count; i++) + { + p3.Add(p1[p1.Count - (i + 1)]); + } + + Test.ByteSS r = new Test.ByteSS(); + r.AddRange(p1); + r.AddRange(p2); + return r; } public override double opFloatDouble(float p1, double p2, out float p3, out double p4, Ice.Current current) { - p3 = p1; - p4 = p2; - return p2; + p3 = p1; + p4 = p2; + return p2; } public override Test.DoubleS opFloatDoubleS(Test.FloatS p1, Test.DoubleS p2, out Test.FloatS p3, out Test.DoubleS p4, - Ice.Current current) - { - p3 = p1; - p4 = new Test.DoubleS(); - for(int i = 0; i < p2.Count; i++) - { - p4.Add(p2[p2.Count - (i + 1)]); - } - Test.DoubleS r = new Test.DoubleS(); - r.AddRange(p2); - for(int i = 0; i < p1.Count; i++) - { - r.Add(p1[i]); - } - return r; + Ice.Current current) + { + p3 = p1; + p4 = new Test.DoubleS(); + for(int i = 0; i < p2.Count; i++) + { + p4.Add(p2[p2.Count - (i + 1)]); + } + Test.DoubleS r = new Test.DoubleS(); + r.AddRange(p2); + for(int i = 0; i < p1.Count; i++) + { + r.Add(p1[i]); + } + return r; } public override Test.DoubleSS opFloatDoubleSS(Test.FloatSS p1, Test.DoubleSS p2, - out Test.FloatSS p3, out Test.DoubleSS p4, + out Test.FloatSS p3, out Test.DoubleSS p4, Ice.Current current) { - p3 = p1; - p4 = new Test.DoubleSS(); - for(int i = 0; i < p2.Count; i++) - { - p4.Add(p2[p2.Count - (i + 1)]); - } - Test.DoubleSS r = new Test.DoubleSS(); - r.AddRange(p2); - r.AddRange(p2); - return r; + p3 = p1; + p4 = new Test.DoubleSS(); + for(int i = 0; i < p2.Count; i++) + { + p4.Add(p2[p2.Count - (i + 1)]); + } + Test.DoubleSS r = new Test.DoubleSS(); + r.AddRange(p2); + r.AddRange(p2); + return r; } public override Test.LongFloatD opLongFloatD(Test.LongFloatD p1, Test.LongFloatD p2, out Test.LongFloatD p3, Ice.Current current) { - p3 = p1; - Test.LongFloatD r = new Test.LongFloatD(); - r.AddRange(p1); - r.AddRange(p2); - return r; + p3 = p1; + Test.LongFloatD r = new Test.LongFloatD(); + r.AddRange(p1); + r.AddRange(p2); + return r; } public override Test.MyClassPrx opMyClass(Test.MyClassPrx p1, out Test.MyClassPrx p2, out Test.MyClassPrx p3, Ice.Current current) { - p2 = p1; - p3 = Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy( - _adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); - return Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(_identity)); + p2 = p1; + p3 = Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy( + _adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); + return Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(_identity)); } public override Test.MyEnum opMyEnum(Test.MyEnum p1, out Test.MyEnum p2, Ice.Current current) { - p2 = p1; - return Test.MyEnum.enum3; + p2 = p1; + return Test.MyEnum.enum3; } public override Test.ShortIntD opShortIntD(Test.ShortIntD p1, Test.ShortIntD p2, out Test.ShortIntD p3, Ice.Current current) { - p3 = p1; - Test.ShortIntD r = new Test.ShortIntD(); - r.AddRange(p1); - r.AddRange(p2); - return r; + p3 = p1; + Test.ShortIntD r = new Test.ShortIntD(); + r.AddRange(p1); + r.AddRange(p2); + return r; } public override long opShortIntLong(short p1, int p2, long p3, out short p4, out int p5, out long p6, Ice.Current current) { - p4 = p1; - p5 = p2; - p6 = p3; - return p3; + p4 = p1; + p5 = p2; + p6 = p3; + return p3; } public override Test.LongS opShortIntLongS(Test.ShortS p1, Test.IntS p2, Test.LongS p3, out Test.ShortS p4, out Test.IntS p5, out Test.LongS p6, - Ice.Current current) - { - p4 = p1; - p5 = new Test.IntS(); - for(int i = 0; i < p2.Count; i++) - { - p5.Add(p2[p2.Count - (i + 1)]); - } - p6 = new Test.LongS(); - p6.AddRange(p3); - p6.AddRange(p3); - return p3; + Ice.Current current) + { + p4 = p1; + p5 = new Test.IntS(); + for(int i = 0; i < p2.Count; i++) + { + p5.Add(p2[p2.Count - (i + 1)]); + } + p6 = new Test.LongS(); + p6.AddRange(p3); + p6.AddRange(p3); + return p3; } public override Test.LongSS opShortIntLongSS(Test.ShortSS p1, Test.IntSS p2, Test.LongSS p3, out Test.ShortSS p4, out Test.IntSS p5, out Test.LongSS p6, - Ice.Current current) - { - p4 = p1; - p5 = new Test.IntSS(); - for(int i = 0; i < p2.Count; i++) - { - p5.Add(p2[p2.Count - (i + 1)]); - } - p6 = new Test.LongSS(); - p6.AddRange(p3); - p6.AddRange(p3); - return p3; + Ice.Current current) + { + p4 = p1; + p5 = new Test.IntSS(); + for(int i = 0; i < p2.Count; i++) + { + p5.Add(p2[p2.Count - (i + 1)]); + } + p6 = new Test.LongSS(); + p6.AddRange(p3); + p6.AddRange(p3); + return p3; } public override string opString(string p1, string p2, out string p3, Ice.Current current) { - p3 = p2 + " " + p1; - return p1 + " " + p2; + p3 = p2 + " " + p1; + return p1 + " " + p2; } public override Test.StringMyEnumD opStringMyEnumD(Test.StringMyEnumD p1, Test.StringMyEnumD p2, out Test.StringMyEnumD p3, Ice.Current current) { - p3 = p1; - Test.StringMyEnumD r = new Test.StringMyEnumD(); - r.AddRange(p1); - r.AddRange(p2); - return r; + p3 = p1; + Test.StringMyEnumD r = new Test.StringMyEnumD(); + r.AddRange(p1); + r.AddRange(p2); + return r; } public override Test.IntS opIntS(Test.IntS s, Ice.Current current) { - Test.IntS r = new Test.IntS(); - for(int i = 0; i < s.Count; ++i) - { - r.Add(-s[i]); - } - return r; + Test.IntS r = new Test.IntS(); + for(int i = 0; i < s.Count; ++i) + { + r.Add(-s[i]); + } + return r; } public override void opByteSOneway(Test.ByteS s, Ice.Current current) @@ -264,46 +264,46 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass public override Ice.Context opContext(Ice.Current current) { - return current.ctx == null ? new Ice.Context() : (Ice.Context)current.ctx.Clone(); + return current.ctx == null ? new Ice.Context() : (Ice.Context)current.ctx.Clone(); } public override void opDoubleMarshaling(double p1, Test.DoubleS p2, Ice.Current current) { - double d = 1278312346.0 / 13.0; - test(p1 == d); - for(int i = 0; i < p2.Count; ++i) - { - test(p2[i] == d); - } + double d = 1278312346.0 / 13.0; + test(p1 == d); + for(int i = 0; i < p2.Count; ++i) + { + test(p2[i] == d); + } } public override Test.StringS opStringS(Test.StringS p1, Test.StringS p2, out Test.StringS p3, Ice.Current current) { - p3 = new Test.StringS(); - p3.AddRange(p1); - p3.AddRange(p2); - - Test.StringS r = new Test.StringS(); - for(int i = 0; i < p1.Count; i++) - { - r.Add(p1[p1.Count - (i + 1)]); - } - return r; + p3 = new Test.StringS(); + p3.AddRange(p1); + p3.AddRange(p2); + + Test.StringS r = new Test.StringS(); + for(int i = 0; i < p1.Count; i++) + { + r.Add(p1[p1.Count - (i + 1)]); + } + return r; } public override Test.StringSS opStringSS(Test.StringSS p1, Test.StringSS p2, out Test.StringSS p3, Ice.Current current) { - p3 = new Test.StringSS(); - p3.AddRange(p1); - p3.AddRange(p2); - - Test.StringSS r = new Test.StringSS(); - for(int i = 0; i < p2.Count; i++) - { - r.Add(p2[p2.Count - (i + 1)]); - } - return r; + p3 = new Test.StringSS(); + p3.AddRange(p1); + p3.AddRange(p2); + + Test.StringSS r = new Test.StringSS(); + for(int i = 0; i < p2.Count; i++) + { + r.Add(p2[p2.Count - (i + 1)]); + } + return r; } public override Test.StringSS[] opStringSSS(Test.StringSS[] p1, Test.StringSS[] p2, out Test.StringSS[] p3, @@ -312,7 +312,7 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass p3 = new Test.StringSS[p1.Length + p2.Length]; p1.CopyTo(p3, 0); p2.CopyTo(p3, p1.Length); - + Test.StringSS[] r = new Test.StringSS[p2.Length]; for(int i = 0; i < p2.Length; i++) { @@ -324,19 +324,19 @@ public sealed class MyDerivedClassI : Test.MyDerivedClass public override Test.StringStringD opStringStringD(Test.StringStringD p1, Test.StringStringD p2, out Test.StringStringD p3, Ice.Current current) { - p3 = p1; - Test.StringStringD r = new Test.StringStringD(); - r.AddRange(p1); - r.AddRange(p2); - return r; + p3 = p1; + Test.StringStringD r = new Test.StringStringD(); + r.AddRange(p1); + r.AddRange(p2); + return r; } public override Test.Structure opStruct(Test.Structure p1, Test.Structure p2, out Test.Structure p3, Ice.Current current) { - p3 = p1; - p3.s.s = "a new string"; - return p2; + p3 = p1; + p3.s.s = "a new string"; + return p2; } public override void opDerived(Ice.Current current) diff --git a/cs/test/Ice/operations/Server.cs b/cs/test/Ice/operations/Server.cs index 81ee60c999b..59057b74b1e 100755 --- a/cs/test/Ice/operations/Server.cs +++ b/cs/test/Ice/operations/Server.cs @@ -13,51 +13,51 @@ public class Server { private static int run(string[] args, Ice.Communicator communicator) { - // - // We don't want connection warnings because of the timeout test. - // - communicator.getProperties().setProperty("Ice.Warn.Connections", "0"); - - communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 5000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Identity id = communicator.stringToIdentity("test"); - adapter.add(new MyDerivedClassI(adapter, id), id); - adapter.add(new TestCheckedCastI(), communicator.stringToIdentity("context")); - adapter.activate(); + // + // We don't want connection warnings because of the timeout test. + // + communicator.getProperties().setProperty("Ice.Warn.Connections", "0"); + + communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 5000:udp"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Identity id = communicator.stringToIdentity("test"); + adapter.add(new MyDerivedClassI(adapter, id), id); + adapter.add(new TestCheckedCastI(), communicator.stringToIdentity("context")); + adapter.activate(); - communicator.waitForShutdown(); - return 0; + communicator.waitForShutdown(); + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/Ice/operations/Test.ice b/cs/test/Ice/operations/Test.ice index d1ad5739181..3a9939957a3 100644 --- a/cs/test/Ice/operations/Test.ice +++ b/cs/test/Ice/operations/Test.ice @@ -75,75 +75,75 @@ dictionary<string, MyEnum> StringMyEnumD; void opSleep(int duration); byte opByte(byte p1, byte p2, - out byte p3); + out byte p3); bool opBool(bool p1, bool p2, - out bool p3); + out bool p3); long opShortIntLong(short p1, int p2, long p3, - out short p4, out int p5, out long p6); + out short p4, out int p5, out long p6); double opFloatDouble(float p1, double p2, - out float p3, out double p4); + out float p3, out double p4); string opString(string p1, string p2, - out string p3); + out string p3); MyEnum opMyEnum(MyEnum p1, out MyEnum p2); MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); Structure opStruct(Structure p1, Structure p2, - out Structure p3); + out Structure p3); ByteS opByteS(ByteS p1, ByteS p2, - out ByteS p3); + out ByteS p3); BoolS opBoolS(BoolS p1, BoolS p2, - out BoolS p3); + out BoolS p3); LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, - out ::Test::ShortS p4, out IntS p5, out LongS p6); + out ::Test::ShortS p4, out IntS p5, out LongS p6); DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, - out FloatS p3, out DoubleS p4); + out FloatS p3, out DoubleS p4); StringS opStringS(StringS p1, StringS p2, - out StringS p3); + out StringS p3); ByteSS opByteSS(ByteSS p1, ByteSS p2, - out ByteSS p3); + out ByteSS p3); BoolSS opBoolSS(BoolSS p1, BoolSS p2, - out BoolSS p3); + out BoolSS p3); LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, - out ShortSS p4, out IntSS p5, out LongSS p6); + out ShortSS p4, out IntSS p5, out LongSS p6); DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, - out FloatSS p3, out DoubleSS p4); + out FloatSS p3, out DoubleSS p4); StringSS opStringSS(StringSS p1, StringSS p2, - out StringSS p3); + out StringSS p3); StringSSS opStringSSS(StringSSS p1, StringSSS p2, - out StringSSS p3); + out StringSSS p3); ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, - out ByteBoolD p3); + out ByteBoolD p3); ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, - out ShortIntD p3); + out ShortIntD p3); LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, - out LongFloatD p3); + out LongFloatD p3); StringStringD opStringStringD(StringStringD p1, StringStringD p2, - out StringStringD p3); + out StringStringD p3); StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, - out StringMyEnumD p3); + out StringMyEnumD p3); IntS opIntS(IntS s); diff --git a/cs/test/Ice/operations/TestAMD.ice b/cs/test/Ice/operations/TestAMD.ice index 2cf969d1e86..9bd3bc27efe 100644 --- a/cs/test/Ice/operations/TestAMD.ice +++ b/cs/test/Ice/operations/TestAMD.ice @@ -75,75 +75,75 @@ dictionary<string, MyEnum> StringMyEnumD; void opSleep(int duration); byte opByte(byte p1, byte p2, - out byte p3); + out byte p3); bool opBool(bool p1, bool p2, - out bool p3); + out bool p3); long opShortIntLong(short p1, int p2, long p3, - out short p4, out int p5, out long p6); + out short p4, out int p5, out long p6); double opFloatDouble(float p1, double p2, - out float p3, out double p4); + out float p3, out double p4); string opString(string p1, string p2, - out string p3); + out string p3); MyEnum opMyEnum(MyEnum p1, out MyEnum p2); MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); Structure opStruct(Structure p1, Structure p2, - out Structure p3); + out Structure p3); ByteS opByteS(ByteS p1, ByteS p2, - out ByteS p3); + out ByteS p3); BoolS opBoolS(BoolS p1, BoolS p2, - out BoolS p3); + out BoolS p3); LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, - out ::Test::ShortS p4, out IntS p5, out LongS p6); + out ::Test::ShortS p4, out IntS p5, out LongS p6); DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, - out FloatS p3, out DoubleS p4); + out FloatS p3, out DoubleS p4); StringS opStringS(StringS p1, StringS p2, - out StringS p3); + out StringS p3); ByteSS opByteSS(ByteSS p1, ByteSS p2, - out ByteSS p3); + out ByteSS p3); BoolSS opBoolSS(BoolSS p1, BoolSS p2, - out BoolSS p3); + out BoolSS p3); LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, - out ShortSS p4, out IntSS p5, out LongSS p6); + out ShortSS p4, out IntSS p5, out LongSS p6); DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, - out FloatSS p3, out DoubleSS p4); + out FloatSS p3, out DoubleSS p4); StringSS opStringSS(StringSS p1, StringSS p2, - out StringSS p3); + out StringSS p3); StringSSS opStringSSS(StringSSS p1, StringSSS p2, - out StringSSS p3); + out StringSSS p3); ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, - out ByteBoolD p3); + out ByteBoolD p3); ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, - out ShortIntD p3); + out ShortIntD p3); LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, - out LongFloatD p3); + out LongFloatD p3); StringStringD opStringStringD(StringStringD p1, StringStringD p2, - out StringStringD p3); + out StringStringD p3); StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, - out StringMyEnumD p3); + out StringMyEnumD p3); IntS opIntS(IntS s); diff --git a/cs/test/Ice/operations/TestCheckedCastAMDI.cs b/cs/test/Ice/operations/TestCheckedCastAMDI.cs index 3f2250308e9..168d7d18a91 100644 --- a/cs/test/Ice/operations/TestCheckedCastAMDI.cs +++ b/cs/test/Ice/operations/TestCheckedCastAMDI.cs @@ -19,7 +19,7 @@ public sealed class TestCheckedCastI : Test.TestCheckedCastDisp_ ice_isA(string s, Ice.Current current) { _ctx = current.ctx; - return base.ice_isA(s, current); + return base.ice_isA(s, current); } private Ice.Context _ctx; diff --git a/cs/test/Ice/operations/TestCheckedCastI.cs b/cs/test/Ice/operations/TestCheckedCastI.cs index 1abe6420eb0..36d7df27c05 100644 --- a/cs/test/Ice/operations/TestCheckedCastI.cs +++ b/cs/test/Ice/operations/TestCheckedCastI.cs @@ -19,7 +19,7 @@ public sealed class TestCheckedCastI : Test.TestCheckedCastDisp_ ice_isA(string s, Ice.Current current) { _ctx = current.ctx; - return base.ice_isA(s, current); + return base.ice_isA(s, current); } private Ice.Context _ctx; diff --git a/cs/test/Ice/operations/Twoways.cs b/cs/test/Ice/operations/Twoways.cs index 39778303e59..4b2f53ec25a 100755 --- a/cs/test/Ice/operations/Twoways.cs +++ b/cs/test/Ice/operations/Twoways.cs @@ -13,685 +13,685 @@ class Twoways { private static void test(bool b) { - if(!b) - { - throw new System.Exception(); - } + if(!b) + { + throw new System.Exception(); + } } internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p) { - { - p.opVoid(); - } - - { - byte b; - byte r; - - r = p.opByte(0xff, 0x0f, out b); - test(b == 0xf0); - test(r == 0xff); - } - - { - bool b; - bool r; - - r = p.opBool(true, false, out b); - test(b); - test(!r); - } - - { - short s; - int i; - long l; - long r; - - r = p.opShortIntLong(10, 11, 12L, out s, out i, out l); - test(s == 10); - test(i == 11); - test(l == 12); - test(r == 12L); - - r = p.opShortIntLong(Int16.MinValue, Int32.MinValue, Int64.MinValue, out s, out i, out l); - test(s == Int16.MinValue); - test(i == Int32.MinValue); - test(l == Int64.MinValue); - test(r == Int64.MinValue); - - r = p.opShortIntLong(Int16.MaxValue, Int32.MaxValue, Int64.MaxValue, out s, out i, out l); - test(s == Int16.MaxValue); - test(i == Int32.MaxValue); - test(l == Int64.MaxValue); - test(r == Int64.MaxValue); - } - - { - float f; - double d; - double r; - - r = p.opFloatDouble(3.14f, 1.1e10, out f, out d); - test(f == 3.14f); - test(d == 1.1e10); - test(r == 1.1e10); - - r = p.opFloatDouble(Single.Epsilon, Double.MinValue, out f, out d); - test(f == Single.Epsilon); - test(d == Double.MinValue); - test(r == Double.MinValue); - - r = p.opFloatDouble(Single.MaxValue, Double.MaxValue, out f, out d); - test(f == Single.MaxValue); - test(d == Double.MaxValue); - test(r == Double.MaxValue); - } - - { - string s; - string r; - - r = p.opString("hello", "world", out s); - test(s.Equals("world hello")); - test(r.Equals("hello world")); - } - - { - Test.MyEnum e; - Test.MyEnum r; - - r = p.opMyEnum(Test.MyEnum.enum2, out e); - test(e == Test.MyEnum.enum2); - test(r == Test.MyEnum.enum3); - } - - { - Test.MyClassPrx c1; - Test.MyClassPrx c2; - Test.MyClassPrx r; - - r = p.opMyClass(p, out c1, out c2); - test(Ice.Util.proxyIdentityAndFacetCompare(c1, p) == 0); - test(Ice.Util.proxyIdentityAndFacetCompare(c2, p) != 0); - test(Ice.Util.proxyIdentityAndFacetCompare(r, p) == 0); - test(c1.ice_getIdentity().Equals(communicator.stringToIdentity("test"))); - test(c2.ice_getIdentity().Equals(communicator.stringToIdentity("noSuchIdentity"))); - test(r.ice_getIdentity().Equals(communicator.stringToIdentity("test"))); - r.opVoid(); - c1.opVoid(); - try - { - c2.opVoid(); - test(false); - } - catch(Ice.ObjectNotExistException) - { - } - - r = p.opMyClass(null, out c1, out c2); - test(c1 == null); - test(c2 != null); - test(Ice.Util.proxyIdentityAndFacetCompare(r, p) == 0); - r.opVoid(); - } - - { - Test.Structure si1 = new Test.Structure(); - si1.p = p; - si1.e = Test.MyEnum.enum3; - si1.s = new Test.AnotherStruct(); - si1.s.s = "abc"; - Test.Structure si2 = new Test.Structure(); - si2.p = null; - si2.e = Test.MyEnum.enum2; - si2.s = new Test.AnotherStruct(); - si2.s.s = "def"; - - Test.Structure so; - Test.Structure rso = p.opStruct(si1, si2, out so); - test(rso.p == null); - test(rso.e == Test.MyEnum.enum2); - test(rso.s.s.Equals("def")); - test(so.p.Equals(p)); - test(so.e == Test.MyEnum.enum3); - test(so.s.s.Equals("a new string")); - so.p.opVoid(); - } - - { - byte[] tbsi1 = new byte[] { 0x01, 0x11, 0x12, 0x22 }; - Test.ByteS bsi1 = new Test.ByteS(tbsi1); - byte[] tbsi2 = new byte[] { 0xf1, 0xf2, 0xf3, 0xf4 }; - Test.ByteS bsi2 = new Test.ByteS(tbsi2); - - Test.ByteS bso; - Test.ByteS rso; - - rso = p.opByteS(bsi1, bsi2, out bso); - test(bso.Count == 4); - test(bso[0] == 0x22); - test(bso[1] == 0x12); - test(bso[2] == 0x11); - test(bso[3] == 0x01); - test(rso.Count == 8); - test(rso[0] == 0x01); - test(rso[1] == 0x11); - test(rso[2] == 0x12); - test(rso[3] == 0x22); - test(rso[4] == 0xf1); - test(rso[5] == 0xf2); - test(rso[6] == 0xf3); - test(rso[7] == 0xf4); - } - - { - bool[] tbsi1 = new bool[] { true, true, false }; - Test.BoolS bsi1 = new Test.BoolS(tbsi1); - bool[] tbsi2 = new bool[] { false }; - Test.BoolS bsi2 = new Test.BoolS(tbsi2); - - Test.BoolS bso; - Test.BoolS rso; - - rso = p.opBoolS(bsi1, bsi2, out bso); - test(bso.Count == 4); - test(bso[0]); - test(bso[1]); - test(!bso[2]); - test(!bso[3]); - test(rso.Count == 3); - test(!rso[0]); - test(rso[1]); - test(rso[2]); - } - - { - short[] tssi = new short[] { 1, 2, 3 }; - Test.ShortS ssi = new Test.ShortS(tssi); - int[] tisi = new int[] { 5, 6, 7, 8 }; - Test.IntS isi = new Test.IntS(tisi); - long[] tlsi = new long[] { 10, 30, 20 }; - Test.LongS lsi = new Test.LongS(tlsi); - - Test.ShortS sso; - Test.IntS iso; - Test.LongS lso; - Test.LongS rso; - - rso = p.opShortIntLongS(ssi, isi, lsi, out sso, out iso, out lso); - test(sso.Count == 3); - test(sso[0] == 1); - test(sso[1] == 2); - test(sso[2] == 3); - test(iso.Count == 4); - test(iso[0] == 8); - test(iso[1] == 7); - test(iso[2] == 6); - test(iso[3] == 5); - test(lso.Count == 6); - test(lso[0] == 10); - test(lso[1] == 30); - test(lso[2] == 20); - test(lso[3] == 10); - test(lso[4] == 30); - test(lso[5] == 20); - test(rso.Count == 3); - test(rso[0] == 10); - test(rso[1] == 30); - test(rso[2] == 20); - } - - { - float[] tfsi = new float[] { 3.14f, 1.11f }; - Test.FloatS fsi = new Test.FloatS(tfsi); - double[] tdsi = new double[] { 1.1e10, 1.2e10, 1.3e10 }; - Test.DoubleS dsi = new Test.DoubleS(tdsi); - - Test.FloatS fso; - Test.DoubleS dso; - Test.DoubleS rso; - - rso = p.opFloatDoubleS(fsi, dsi, out fso, out dso); - test(fso.Count == 2); - test(fso[0] == 3.14f); - test(fso[1] == 1.11f); - test(dso.Count == 3); - test(dso[0] == 1.3e10); - test(dso[1] == 1.2e10); - test(dso[2] == 1.1e10); - test(rso.Count == 5); - test(rso[0] == 1.1e10); - test(rso[1] == 1.2e10); - test(rso[2] == 1.3e10); - test((float)rso[3] == 3.14f); - test((float)rso[4] == 1.11f); - } - - { - string[] tssi1 = new string[] { "abc", "de", "fghi" }; - Test.StringS ssi1 = new Test.StringS(tssi1); - string[] tssi2 = new string[] { "xyz" }; - Test.StringS ssi2 = new Test.StringS(tssi2); - - Test.StringS sso; - Test.StringS rso; - - rso = p.opStringS(ssi1, ssi2, out sso); - test(sso.Count == 4); - test(sso[0].Equals("abc")); - test(sso[1].Equals("de")); - test(sso[2].Equals("fghi")); - test(sso[3].Equals("xyz")); - test(rso.Count == 3); - test(rso[0].Equals("fghi")); - test(rso[1].Equals("de")); - test(rso[2].Equals("abc")); - } - - { - Test.ByteS s11 = new Test.ByteS(new byte[] { 0x01, 0x11, 0x12 }); - Test.ByteS s12 = new Test.ByteS(new byte[] { 0xff }); - Test.ByteSS bsi1 = new Test.ByteSS(new Test.ByteS[] { s11, s12 }); + { + p.opVoid(); + } + + { + byte b; + byte r; + + r = p.opByte(0xff, 0x0f, out b); + test(b == 0xf0); + test(r == 0xff); + } + + { + bool b; + bool r; + + r = p.opBool(true, false, out b); + test(b); + test(!r); + } + + { + short s; + int i; + long l; + long r; + + r = p.opShortIntLong(10, 11, 12L, out s, out i, out l); + test(s == 10); + test(i == 11); + test(l == 12); + test(r == 12L); + + r = p.opShortIntLong(Int16.MinValue, Int32.MinValue, Int64.MinValue, out s, out i, out l); + test(s == Int16.MinValue); + test(i == Int32.MinValue); + test(l == Int64.MinValue); + test(r == Int64.MinValue); + + r = p.opShortIntLong(Int16.MaxValue, Int32.MaxValue, Int64.MaxValue, out s, out i, out l); + test(s == Int16.MaxValue); + test(i == Int32.MaxValue); + test(l == Int64.MaxValue); + test(r == Int64.MaxValue); + } + + { + float f; + double d; + double r; + + r = p.opFloatDouble(3.14f, 1.1e10, out f, out d); + test(f == 3.14f); + test(d == 1.1e10); + test(r == 1.1e10); + + r = p.opFloatDouble(Single.Epsilon, Double.MinValue, out f, out d); + test(f == Single.Epsilon); + test(d == Double.MinValue); + test(r == Double.MinValue); + + r = p.opFloatDouble(Single.MaxValue, Double.MaxValue, out f, out d); + test(f == Single.MaxValue); + test(d == Double.MaxValue); + test(r == Double.MaxValue); + } + + { + string s; + string r; + + r = p.opString("hello", "world", out s); + test(s.Equals("world hello")); + test(r.Equals("hello world")); + } + + { + Test.MyEnum e; + Test.MyEnum r; + + r = p.opMyEnum(Test.MyEnum.enum2, out e); + test(e == Test.MyEnum.enum2); + test(r == Test.MyEnum.enum3); + } + + { + Test.MyClassPrx c1; + Test.MyClassPrx c2; + Test.MyClassPrx r; + + r = p.opMyClass(p, out c1, out c2); + test(Ice.Util.proxyIdentityAndFacetCompare(c1, p) == 0); + test(Ice.Util.proxyIdentityAndFacetCompare(c2, p) != 0); + test(Ice.Util.proxyIdentityAndFacetCompare(r, p) == 0); + test(c1.ice_getIdentity().Equals(communicator.stringToIdentity("test"))); + test(c2.ice_getIdentity().Equals(communicator.stringToIdentity("noSuchIdentity"))); + test(r.ice_getIdentity().Equals(communicator.stringToIdentity("test"))); + r.opVoid(); + c1.opVoid(); + try + { + c2.opVoid(); + test(false); + } + catch(Ice.ObjectNotExistException) + { + } + + r = p.opMyClass(null, out c1, out c2); + test(c1 == null); + test(c2 != null); + test(Ice.Util.proxyIdentityAndFacetCompare(r, p) == 0); + r.opVoid(); + } + + { + Test.Structure si1 = new Test.Structure(); + si1.p = p; + si1.e = Test.MyEnum.enum3; + si1.s = new Test.AnotherStruct(); + si1.s.s = "abc"; + Test.Structure si2 = new Test.Structure(); + si2.p = null; + si2.e = Test.MyEnum.enum2; + si2.s = new Test.AnotherStruct(); + si2.s.s = "def"; + + Test.Structure so; + Test.Structure rso = p.opStruct(si1, si2, out so); + test(rso.p == null); + test(rso.e == Test.MyEnum.enum2); + test(rso.s.s.Equals("def")); + test(so.p.Equals(p)); + test(so.e == Test.MyEnum.enum3); + test(so.s.s.Equals("a new string")); + so.p.opVoid(); + } + + { + byte[] tbsi1 = new byte[] { 0x01, 0x11, 0x12, 0x22 }; + Test.ByteS bsi1 = new Test.ByteS(tbsi1); + byte[] tbsi2 = new byte[] { 0xf1, 0xf2, 0xf3, 0xf4 }; + Test.ByteS bsi2 = new Test.ByteS(tbsi2); + + Test.ByteS bso; + Test.ByteS rso; + + rso = p.opByteS(bsi1, bsi2, out bso); + test(bso.Count == 4); + test(bso[0] == 0x22); + test(bso[1] == 0x12); + test(bso[2] == 0x11); + test(bso[3] == 0x01); + test(rso.Count == 8); + test(rso[0] == 0x01); + test(rso[1] == 0x11); + test(rso[2] == 0x12); + test(rso[3] == 0x22); + test(rso[4] == 0xf1); + test(rso[5] == 0xf2); + test(rso[6] == 0xf3); + test(rso[7] == 0xf4); + } + + { + bool[] tbsi1 = new bool[] { true, true, false }; + Test.BoolS bsi1 = new Test.BoolS(tbsi1); + bool[] tbsi2 = new bool[] { false }; + Test.BoolS bsi2 = new Test.BoolS(tbsi2); + + Test.BoolS bso; + Test.BoolS rso; + + rso = p.opBoolS(bsi1, bsi2, out bso); + test(bso.Count == 4); + test(bso[0]); + test(bso[1]); + test(!bso[2]); + test(!bso[3]); + test(rso.Count == 3); + test(!rso[0]); + test(rso[1]); + test(rso[2]); + } + + { + short[] tssi = new short[] { 1, 2, 3 }; + Test.ShortS ssi = new Test.ShortS(tssi); + int[] tisi = new int[] { 5, 6, 7, 8 }; + Test.IntS isi = new Test.IntS(tisi); + long[] tlsi = new long[] { 10, 30, 20 }; + Test.LongS lsi = new Test.LongS(tlsi); + + Test.ShortS sso; + Test.IntS iso; + Test.LongS lso; + Test.LongS rso; + + rso = p.opShortIntLongS(ssi, isi, lsi, out sso, out iso, out lso); + test(sso.Count == 3); + test(sso[0] == 1); + test(sso[1] == 2); + test(sso[2] == 3); + test(iso.Count == 4); + test(iso[0] == 8); + test(iso[1] == 7); + test(iso[2] == 6); + test(iso[3] == 5); + test(lso.Count == 6); + test(lso[0] == 10); + test(lso[1] == 30); + test(lso[2] == 20); + test(lso[3] == 10); + test(lso[4] == 30); + test(lso[5] == 20); + test(rso.Count == 3); + test(rso[0] == 10); + test(rso[1] == 30); + test(rso[2] == 20); + } + + { + float[] tfsi = new float[] { 3.14f, 1.11f }; + Test.FloatS fsi = new Test.FloatS(tfsi); + double[] tdsi = new double[] { 1.1e10, 1.2e10, 1.3e10 }; + Test.DoubleS dsi = new Test.DoubleS(tdsi); + + Test.FloatS fso; + Test.DoubleS dso; + Test.DoubleS rso; + + rso = p.opFloatDoubleS(fsi, dsi, out fso, out dso); + test(fso.Count == 2); + test(fso[0] == 3.14f); + test(fso[1] == 1.11f); + test(dso.Count == 3); + test(dso[0] == 1.3e10); + test(dso[1] == 1.2e10); + test(dso[2] == 1.1e10); + test(rso.Count == 5); + test(rso[0] == 1.1e10); + test(rso[1] == 1.2e10); + test(rso[2] == 1.3e10); + test((float)rso[3] == 3.14f); + test((float)rso[4] == 1.11f); + } + + { + string[] tssi1 = new string[] { "abc", "de", "fghi" }; + Test.StringS ssi1 = new Test.StringS(tssi1); + string[] tssi2 = new string[] { "xyz" }; + Test.StringS ssi2 = new Test.StringS(tssi2); + + Test.StringS sso; + Test.StringS rso; + + rso = p.opStringS(ssi1, ssi2, out sso); + test(sso.Count == 4); + test(sso[0].Equals("abc")); + test(sso[1].Equals("de")); + test(sso[2].Equals("fghi")); + test(sso[3].Equals("xyz")); + test(rso.Count == 3); + test(rso[0].Equals("fghi")); + test(rso[1].Equals("de")); + test(rso[2].Equals("abc")); + } + + { + Test.ByteS s11 = new Test.ByteS(new byte[] { 0x01, 0x11, 0x12 }); + Test.ByteS s12 = new Test.ByteS(new byte[] { 0xff }); + Test.ByteSS bsi1 = new Test.ByteSS(new Test.ByteS[] { s11, s12 }); - Test.ByteS s21 = new Test.ByteS(new byte[] { 0x0e }); - Test.ByteS s22 = new Test.ByteS(new byte[] { 0xf2, 0xf1 }); - Test.ByteSS bsi2 = new Test.ByteSS(new Test.ByteS[] { s21, s22 }); - - Test.ByteSS bso; - Test.ByteSS rso; - - rso = p.opByteSS(bsi1, bsi2, out bso); - test(bso.Count == 2); - test(bso[0].Count == 1); - test(bso[0][0] == 0xff); - test(bso[1].Count == 3); - test(bso[1][0] == 0x01); - test(bso[1][1] == 0x11); - test(bso[1][2] == 0x12); - test(rso.Count == 4); - test(rso[0].Count == 3); - test(rso[0][0] == 0x01); - test(rso[0][1] == 0x11); - test(rso[0][2] == 0x12); - test(rso[1].Count == 1); - test(rso[1][0] == 0xff); - test(rso[2].Count == 1); - test(rso[2][0] == 0x0e); - test(rso[3].Count == 2); - test(rso[3][0] == 0xf2); - test(rso[3][1] == 0xf1); - } - - { - Test.FloatS f11 = new Test.FloatS(new float[] { 3.14f }); - Test.FloatS f12 = new Test.FloatS(new float[] { 1.11f }); - Test.FloatS f13 = new Test.FloatS(new float[] { }); - Test.FloatSS fsi = new Test.FloatSS(new Test.FloatS[] { f11, f12, f13 }); + Test.ByteS s21 = new Test.ByteS(new byte[] { 0x0e }); + Test.ByteS s22 = new Test.ByteS(new byte[] { 0xf2, 0xf1 }); + Test.ByteSS bsi2 = new Test.ByteSS(new Test.ByteS[] { s21, s22 }); + + Test.ByteSS bso; + Test.ByteSS rso; + + rso = p.opByteSS(bsi1, bsi2, out bso); + test(bso.Count == 2); + test(bso[0].Count == 1); + test(bso[0][0] == 0xff); + test(bso[1].Count == 3); + test(bso[1][0] == 0x01); + test(bso[1][1] == 0x11); + test(bso[1][2] == 0x12); + test(rso.Count == 4); + test(rso[0].Count == 3); + test(rso[0][0] == 0x01); + test(rso[0][1] == 0x11); + test(rso[0][2] == 0x12); + test(rso[1].Count == 1); + test(rso[1][0] == 0xff); + test(rso[2].Count == 1); + test(rso[2][0] == 0x0e); + test(rso[3].Count == 2); + test(rso[3][0] == 0xf2); + test(rso[3][1] == 0xf1); + } + + { + Test.FloatS f11 = new Test.FloatS(new float[] { 3.14f }); + Test.FloatS f12 = new Test.FloatS(new float[] { 1.11f }); + Test.FloatS f13 = new Test.FloatS(new float[] { }); + Test.FloatSS fsi = new Test.FloatSS(new Test.FloatS[] { f11, f12, f13 }); - Test.DoubleS d11 = new Test.DoubleS(new double[] { 1.1e10, 1.2e10, 1.3e10 }); - Test.DoubleSS dsi = new Test.DoubleSS(new Test.DoubleS[] { d11 }); - - Test.FloatSS fso; - Test.DoubleSS dso; - Test.DoubleSS rso; - - rso = p.opFloatDoubleSS(fsi, dsi, out fso, out dso); - test(fso.Count == 3); - test(fso[0].Count == 1); - test(fso[0][0] == 3.14f); - test(fso[1].Count == 1); - test(fso[1][0] == 1.11f); - test(fso[2].Count == 0); - test(dso.Count == 1); - test(dso[0].Count == 3); - test(dso[0][0] == 1.1e10); - test(dso[0][1] == 1.2e10); - test(dso[0][2] == 1.3e10); - test(rso.Count == 2); - test(rso[0].Count == 3); - test(rso[0][0] == 1.1e10); - test(rso[0][1] == 1.2e10); - test(rso[0][2] == 1.3e10); - test(rso[1].Count == 3); - test(rso[1][0] == 1.1e10); - test(rso[1][1] == 1.2e10); - test(rso[1][2] == 1.3e10); - } - - { - Test.StringS s11 = new Test.StringS(); - s11.Add("abc"); - Test.StringS s12 = new Test.StringS(); - s12.Add("de"); - s12.Add("fghi"); - Test.StringSS ssi1 = new Test.StringSS(); - ssi1.Add(s11); - ssi1.Add(s12); + Test.DoubleS d11 = new Test.DoubleS(new double[] { 1.1e10, 1.2e10, 1.3e10 }); + Test.DoubleSS dsi = new Test.DoubleSS(new Test.DoubleS[] { d11 }); + + Test.FloatSS fso; + Test.DoubleSS dso; + Test.DoubleSS rso; + + rso = p.opFloatDoubleSS(fsi, dsi, out fso, out dso); + test(fso.Count == 3); + test(fso[0].Count == 1); + test(fso[0][0] == 3.14f); + test(fso[1].Count == 1); + test(fso[1][0] == 1.11f); + test(fso[2].Count == 0); + test(dso.Count == 1); + test(dso[0].Count == 3); + test(dso[0][0] == 1.1e10); + test(dso[0][1] == 1.2e10); + test(dso[0][2] == 1.3e10); + test(rso.Count == 2); + test(rso[0].Count == 3); + test(rso[0][0] == 1.1e10); + test(rso[0][1] == 1.2e10); + test(rso[0][2] == 1.3e10); + test(rso[1].Count == 3); + test(rso[1][0] == 1.1e10); + test(rso[1][1] == 1.2e10); + test(rso[1][2] == 1.3e10); + } + + { + Test.StringS s11 = new Test.StringS(); + s11.Add("abc"); + Test.StringS s12 = new Test.StringS(); + s12.Add("de"); + s12.Add("fghi"); + Test.StringSS ssi1 = new Test.StringSS(); + ssi1.Add(s11); + ssi1.Add(s12); - Test.StringS s21 = new Test.StringS(); - Test.StringS s22 = new Test.StringS(); - Test.StringS s23 = new Test.StringS(); - s23.Add("xyz"); - Test.StringSS ssi2 = new Test.StringSS(); - ssi2.Add(s21); - ssi2.Add(s22); - ssi2.Add(s23); + Test.StringS s21 = new Test.StringS(); + Test.StringS s22 = new Test.StringS(); + Test.StringS s23 = new Test.StringS(); + s23.Add("xyz"); + Test.StringSS ssi2 = new Test.StringSS(); + ssi2.Add(s21); + ssi2.Add(s22); + ssi2.Add(s23); - Test.StringSS sso; - Test.StringSS rso; - - rso = p.opStringSS(ssi1, ssi2, out sso); - test(sso.Count == 5); - test(sso[0].Count == 1); - test(sso[0][0].Equals("abc")); - test(sso[1].Count == 2); - test(sso[1][0].Equals("de")); - test(sso[1][1].Equals("fghi")); - test(sso[2].Count == 0); - test(sso[3].Count == 0); - test(sso[4].Count == 1); - test(sso[4][0].Equals("xyz")); - test(rso.Count == 3); - test(rso[0].Count == 1); - test(rso[0][0].Equals("xyz")); - test(rso[1].Count == 0); - test(rso[2].Count == 0); - } - - { - Test.StringSS[] sssi1 = { new Test.StringSS(), new Test.StringSS() }; - sssi1[0].Add(new Test.StringS()); - sssi1[0].Add(new Test.StringS()); - sssi1[0][0].Add("abc"); - sssi1[0][0].Add("de"); - sssi1[0][1].Add("xyz"); - sssi1[1].Add(new Test.StringS()); - sssi1[1][0].Add("hello"); - Test.StringSS[] sssi2 = { new Test.StringSS(), new Test.StringSS(), new Test.StringSS() }; - sssi2[0].Add(new Test.StringS()); - sssi2[0].Add(new Test.StringS()); - sssi2[0][0].Add(""); - sssi2[0][0].Add(""); - sssi2[0][1].Add("abcd"); - sssi2[1].Add(new Test.StringS()); - sssi2[1][0].Add(""); + Test.StringSS sso; + Test.StringSS rso; + + rso = p.opStringSS(ssi1, ssi2, out sso); + test(sso.Count == 5); + test(sso[0].Count == 1); + test(sso[0][0].Equals("abc")); + test(sso[1].Count == 2); + test(sso[1][0].Equals("de")); + test(sso[1][1].Equals("fghi")); + test(sso[2].Count == 0); + test(sso[3].Count == 0); + test(sso[4].Count == 1); + test(sso[4][0].Equals("xyz")); + test(rso.Count == 3); + test(rso[0].Count == 1); + test(rso[0][0].Equals("xyz")); + test(rso[1].Count == 0); + test(rso[2].Count == 0); + } + + { + Test.StringSS[] sssi1 = { new Test.StringSS(), new Test.StringSS() }; + sssi1[0].Add(new Test.StringS()); + sssi1[0].Add(new Test.StringS()); + sssi1[0][0].Add("abc"); + sssi1[0][0].Add("de"); + sssi1[0][1].Add("xyz"); + sssi1[1].Add(new Test.StringS()); + sssi1[1][0].Add("hello"); + Test.StringSS[] sssi2 = { new Test.StringSS(), new Test.StringSS(), new Test.StringSS() }; + sssi2[0].Add(new Test.StringS()); + sssi2[0].Add(new Test.StringS()); + sssi2[0][0].Add(""); + sssi2[0][0].Add(""); + sssi2[0][1].Add("abcd"); + sssi2[1].Add(new Test.StringS()); + sssi2[1][0].Add(""); Test.StringSS[] ssso; - Test.StringSS[] rsso = p.opStringSSS(sssi1, sssi2, out ssso); - test(ssso.Length == 5); - test(ssso[0].Count == 2); - test(ssso[0][0].Count == 2); - test(ssso[0][1].Count == 1); - test(ssso[1].Count == 1); - test(ssso[1][0].Count == 1); - test(ssso[2].Count == 2); - test(ssso[2][0].Count == 2); - test(ssso[2][1].Count == 1); - test(ssso[3].Count == 1); - test(ssso[3][0].Count == 1); - test(ssso[4].Count == 0); - test(ssso[0][0][0].Equals("abc")); - test(ssso[0][0][1].Equals("de")); - test(ssso[0][1][0].Equals("xyz")); - test(ssso[1][0][0].Equals("hello")); - test(ssso[2][0][0].Equals("")); - test(ssso[2][0][1].Equals("")); - test(ssso[2][1][0].Equals("abcd")); - test(ssso[3][0][0].Equals("")); + Test.StringSS[] rsso = p.opStringSSS(sssi1, sssi2, out ssso); + test(ssso.Length == 5); + test(ssso[0].Count == 2); + test(ssso[0][0].Count == 2); + test(ssso[0][1].Count == 1); + test(ssso[1].Count == 1); + test(ssso[1][0].Count == 1); + test(ssso[2].Count == 2); + test(ssso[2][0].Count == 2); + test(ssso[2][1].Count == 1); + test(ssso[3].Count == 1); + test(ssso[3][0].Count == 1); + test(ssso[4].Count == 0); + test(ssso[0][0][0].Equals("abc")); + test(ssso[0][0][1].Equals("de")); + test(ssso[0][1][0].Equals("xyz")); + test(ssso[1][0][0].Equals("hello")); + test(ssso[2][0][0].Equals("")); + test(ssso[2][0][1].Equals("")); + test(ssso[2][1][0].Equals("abcd")); + test(ssso[3][0][0].Equals("")); - test(rsso.Length == 3); - test(rsso[0].Count == 0); - test(rsso[1].Count == 1); - test(rsso[1][0].Count == 1); - test(rsso[2].Count == 2); - test(rsso[2][0].Count == 2); - test(rsso[2][1].Count == 1); - test(rsso[1][0][0].Equals("")); - test(rsso[2][0][0].Equals("")); - test(rsso[2][0][1].Equals("")); - test(rsso[2][1][0].Equals("abcd")); - } + test(rsso.Length == 3); + test(rsso[0].Count == 0); + test(rsso[1].Count == 1); + test(rsso[1][0].Count == 1); + test(rsso[2].Count == 2); + test(rsso[2][0].Count == 2); + test(rsso[2][1].Count == 1); + test(rsso[1][0][0].Equals("")); + test(rsso[2][0][0].Equals("")); + test(rsso[2][0][1].Equals("")); + test(rsso[2][1][0].Equals("abcd")); + } - { - Test.ByteBoolD di1 = new Test.ByteBoolD(); - di1[10] = true; - di1[100] = false; - Test.ByteBoolD di2 = new Test.ByteBoolD(); - di2[10] = true; - di2[11] = false; - di2[101] = true; - - Test.ByteBoolD _do; - Test.ByteBoolD ro = p.opByteBoolD(di1, di2, out _do); - - test(_do.Equals(di1)); - test(ro.Count == 4); - test(ro[10] == true); - test(ro[11] == false); - test(ro[100] == false); - test(ro[101] == true); - } - - { - Test.ShortIntD di1 = new Test.ShortIntD(); - di1[110] = -1; - di1[1100] = 123123; - Test.ShortIntD di2 = new Test.ShortIntD(); - di2[110] = 1; - di2[111] = -100; - di2[1101] = 0; - - Test.ShortIntD _do; - Test.ShortIntD ro = p.opShortIntD(di1, di2, out _do); - - test(_do.Equals(di1)); - test(ro.Count == 4); - test(ro[110] == -1); - test(ro[111] == -100); - test(ro[1100] == 123123); - test(ro[1101] == 0); - } - - { - Test.LongFloatD di1 = new Test.LongFloatD(); - di1[999999110L] = -1.1f; - di1[999999111L] = 123123.2f; - Test.LongFloatD di2 = new Test.LongFloatD(); - di2[999999110L] = -1.1f; - di2[999999120L] = -100.4f; - di2[999999130L] = 0.5f; - - Test.LongFloatD _do; - Test.LongFloatD ro = p.opLongFloatD(di1, di2, out _do); - - test(_do.Equals(di1)); - test(ro.Count == 4); - test(ro[999999110L] == -1.1f); - test(ro[999999120L] == -100.4f); - test(ro[999999111L] == 123123.2f); - test(ro[999999130L] == 0.5f); - } - - { - Test.StringStringD di1 = new Test.StringStringD(); - di1["foo"] = "abc -1.1"; - di1["bar"] = "abc 123123.2"; - Test.StringStringD di2 = new Test.StringStringD(); - di2["foo"] = "abc -1.1"; - di2["FOO"] = "abc -100.4"; - di2["BAR"] = "abc 0.5"; - - Test.StringStringD _do; - Test.StringStringD ro = p.opStringStringD(di1, di2, out _do); - - test(_do.Equals(di1)); - test(ro.Count == 4); - test(ro["foo"].Equals("abc -1.1")); - test(ro["FOO"].Equals("abc -100.4")); - test(ro["bar"].Equals("abc 123123.2")); - test(ro["BAR"].Equals("abc 0.5")); - } - - { - Test.StringMyEnumD di1 = new Test.StringMyEnumD(); - di1["abc"] = Test.MyEnum.enum1; - di1[""] = Test.MyEnum.enum2; - Test.StringMyEnumD di2 = new Test.StringMyEnumD(); - di2["abc"] = Test.MyEnum.enum1; - di2["qwerty"] = Test.MyEnum.enum3; - di2["Hello!!"] = Test.MyEnum.enum2; - - Test.StringMyEnumD _do; - Test.StringMyEnumD ro = p.opStringMyEnumD(di1, di2, out _do); - - test(_do.Equals(di1)); - test(ro.Count == 4); - test(ro["abc"] == Test.MyEnum.enum1); - test(ro["qwerty"] == Test.MyEnum.enum3); - test(ro[""] == Test.MyEnum.enum2); - test(ro["Hello!!"] == Test.MyEnum.enum2); - } - - { - int[] lengths = new int[] { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - - for(int l = 0; l < lengths.Length; ++l) - { - Test.IntS s = new Test.IntS(); - for(int i = 0; i < lengths[l]; ++i) - { - s.Add(i); - } - Test.IntS r = p.opIntS(s); - test(r.Count == lengths[l]); - for(int j = 0; j < r.Count; ++j) - { - test(r[j] == -j); - } - } - } + { + Test.ByteBoolD di1 = new Test.ByteBoolD(); + di1[10] = true; + di1[100] = false; + Test.ByteBoolD di2 = new Test.ByteBoolD(); + di2[10] = true; + di2[11] = false; + di2[101] = true; + + Test.ByteBoolD _do; + Test.ByteBoolD ro = p.opByteBoolD(di1, di2, out _do); + + test(_do.Equals(di1)); + test(ro.Count == 4); + test(ro[10] == true); + test(ro[11] == false); + test(ro[100] == false); + test(ro[101] == true); + } + + { + Test.ShortIntD di1 = new Test.ShortIntD(); + di1[110] = -1; + di1[1100] = 123123; + Test.ShortIntD di2 = new Test.ShortIntD(); + di2[110] = 1; + di2[111] = -100; + di2[1101] = 0; + + Test.ShortIntD _do; + Test.ShortIntD ro = p.opShortIntD(di1, di2, out _do); + + test(_do.Equals(di1)); + test(ro.Count == 4); + test(ro[110] == -1); + test(ro[111] == -100); + test(ro[1100] == 123123); + test(ro[1101] == 0); + } + + { + Test.LongFloatD di1 = new Test.LongFloatD(); + di1[999999110L] = -1.1f; + di1[999999111L] = 123123.2f; + Test.LongFloatD di2 = new Test.LongFloatD(); + di2[999999110L] = -1.1f; + di2[999999120L] = -100.4f; + di2[999999130L] = 0.5f; + + Test.LongFloatD _do; + Test.LongFloatD ro = p.opLongFloatD(di1, di2, out _do); + + test(_do.Equals(di1)); + test(ro.Count == 4); + test(ro[999999110L] == -1.1f); + test(ro[999999120L] == -100.4f); + test(ro[999999111L] == 123123.2f); + test(ro[999999130L] == 0.5f); + } + + { + Test.StringStringD di1 = new Test.StringStringD(); + di1["foo"] = "abc -1.1"; + di1["bar"] = "abc 123123.2"; + Test.StringStringD di2 = new Test.StringStringD(); + di2["foo"] = "abc -1.1"; + di2["FOO"] = "abc -100.4"; + di2["BAR"] = "abc 0.5"; + + Test.StringStringD _do; + Test.StringStringD ro = p.opStringStringD(di1, di2, out _do); + + test(_do.Equals(di1)); + test(ro.Count == 4); + test(ro["foo"].Equals("abc -1.1")); + test(ro["FOO"].Equals("abc -100.4")); + test(ro["bar"].Equals("abc 123123.2")); + test(ro["BAR"].Equals("abc 0.5")); + } + + { + Test.StringMyEnumD di1 = new Test.StringMyEnumD(); + di1["abc"] = Test.MyEnum.enum1; + di1[""] = Test.MyEnum.enum2; + Test.StringMyEnumD di2 = new Test.StringMyEnumD(); + di2["abc"] = Test.MyEnum.enum1; + di2["qwerty"] = Test.MyEnum.enum3; + di2["Hello!!"] = Test.MyEnum.enum2; + + Test.StringMyEnumD _do; + Test.StringMyEnumD ro = p.opStringMyEnumD(di1, di2, out _do); + + test(_do.Equals(di1)); + test(ro.Count == 4); + test(ro["abc"] == Test.MyEnum.enum1); + test(ro["qwerty"] == Test.MyEnum.enum3); + test(ro[""] == Test.MyEnum.enum2); + test(ro["Hello!!"] == Test.MyEnum.enum2); + } + + { + int[] lengths = new int[] { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; + + for(int l = 0; l < lengths.Length; ++l) + { + Test.IntS s = new Test.IntS(); + for(int i = 0; i < lengths[l]; ++i) + { + s.Add(i); + } + Test.IntS r = p.opIntS(s); + test(r.Count == lengths[l]); + for(int j = 0; j < r.Count; ++j) + { + test(r[j] == -j); + } + } + } - { - Ice.Context ctx = new Ice.Context(); - ctx["one"] = "ONE"; - ctx["two"] = "TWO"; - ctx["three"] = "THREE"; - { - test(p.ice_getContext().Count == 0); - Ice.Context r = p.opContext(); - test(!r.Equals(ctx)); - } - { - Ice.Context r = p.opContext(ctx); - test(p.ice_getContext().Count == 0); - test(r.Equals(ctx)); - } - { - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); - test(p2.ice_getContext().Equals(ctx)); - Ice.Context r = p2.opContext(); - test(r.Equals(ctx)); - r = p2.opContext(ctx); - test(r.Equals(ctx)); - } - { - // - // Test that default context is obtained correctly from communicator. - // + { + Ice.Context ctx = new Ice.Context(); + ctx["one"] = "ONE"; + ctx["two"] = "TWO"; + ctx["three"] = "THREE"; + { + test(p.ice_getContext().Count == 0); + Ice.Context r = p.opContext(); + test(!r.Equals(ctx)); + } + { + Ice.Context r = p.opContext(ctx); + test(p.ice_getContext().Count == 0); + test(r.Equals(ctx)); + } + { + Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); + test(p2.ice_getContext().Equals(ctx)); + Ice.Context r = p2.opContext(); + test(r.Equals(ctx)); + r = p2.opContext(ctx); + test(r.Equals(ctx)); + } + { + // + // Test that default context is obtained correctly from communicator. + // /* DEPRECATED - Ice.Context dflt = new Ice.Context(); - dflt["a"] = "b"; - communicator.setDefaultContext(dflt); - test(!p.opContext().Equals(dflt)); + Ice.Context dflt = new Ice.Context(); + dflt["a"] = "b"; + communicator.setDefaultContext(dflt); + test(!p.opContext().Equals(dflt)); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new Ice.Context())); - test(p2.opContext().Count == 0); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new Ice.Context())); + test(p2.opContext().Count == 0); - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); - test(p2.opContext().Equals(dflt)); + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); + test(p2.opContext().Equals(dflt)); - communicator.setDefaultContext(new Ice.Context()); - test(p2.opContext().Count != 0); + communicator.setDefaultContext(new Ice.Context()); + test(p2.opContext().Count != 0); - communicator.setDefaultContext(dflt); - Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( - communicator.stringToProxy("test:default -p 12010 -t 10000")); - test(c.opContext().Equals(dflt)); + communicator.setDefaultContext(dflt); + Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( + communicator.stringToProxy("test:default -p 12010 -t 10000")); + test(c.opContext().Equals(dflt)); - dflt["a"] = "c"; - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); - test(c2.opContext()["a"].Equals("c")); + dflt["a"] = "c"; + Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); + test(c2.opContext()["a"].Equals("c")); - dflt.Clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); - test(c3.opContext()["a"] == null); + dflt.Clear(); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); + test(c3.opContext()["a"] == null); - Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); - test(c4.opContext()["a"].Equals("b")); + Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); + test(c4.opContext()["a"].Equals("b")); - dflt["a"] = "d"; - communicator.setDefaultContext(dflt); + dflt["a"] = "d"; + communicator.setDefaultContext(dflt); - Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); - test(c5.opContext()["a"].Equals("d")); + Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); + test(c5.opContext()["a"].Equals("d")); - communicator.setDefaultContext(new Ice.Context()); + communicator.setDefaultContext(new Ice.Context()); */ - } - } - { - // - // Test implicit context propagation - // - - String[] impls = {"Shared", "SharedWithoutLocking", "PerThread"}; - for(int i = 0; i < 3; i++) - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties().ice_clone_(); - initData.properties.setProperty("Ice.ImplicitContext", impls[i]); - - Ice.Communicator ic = Ice.Util.initialize(initData); - - Ice.Context ctx = new Ice.Context(); - ctx["one"] = "ONE"; - ctx["two"] = "TWO"; - ctx["three"] = "THREE"; - - Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( - ic.stringToProxy("test:default -p 12010 -t 10000")); + } + } + { + // + // Test implicit context propagation + // + + String[] impls = {"Shared", "SharedWithoutLocking", "PerThread"}; + for(int i = 0; i < 3; i++) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties().ice_clone_(); + initData.properties.setProperty("Ice.ImplicitContext", impls[i]); + + Ice.Communicator ic = Ice.Util.initialize(initData); + + Ice.Context ctx = new Ice.Context(); + ctx["one"] = "ONE"; + ctx["two"] = "TWO"; + ctx["three"] = "THREE"; + + Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( + ic.stringToProxy("test:default -p 12010 -t 10000")); - ic.getImplicitContext().setContext(ctx); - test(ic.getImplicitContext().getContext().Equals(ctx)); - test(p3.opContext().Equals(ctx)); - - ic.getImplicitContext().set("zero", "ZERO"); - test(ic.getImplicitContext().get("zero").Equals("ZERO")); - test(ic.getImplicitContext().getWithDefault("foobar", "foo").Equals("foo")); - - ctx = ic.getImplicitContext().getContext(); - test(p3.opContext().Equals(ctx)); - - Ice.Context prxContext = new Ice.Context(); - prxContext["one"] = "UN"; - prxContext["four"] = "QUATRE"; - - Ice.Context combined = (Ice.Context)prxContext.Clone(); - combined.AddRange(ctx); - test(combined["one"].Equals("UN")); - - p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); - - ic.getImplicitContext().setContext(null); - test(p3.opContext().Equals(prxContext)); - - ic.getImplicitContext().setContext(ctx); - test(p3.opContext().Equals(combined)); - - ic.destroy(); - } - } + ic.getImplicitContext().setContext(ctx); + test(ic.getImplicitContext().getContext().Equals(ctx)); + test(p3.opContext().Equals(ctx)); + + ic.getImplicitContext().set("zero", "ZERO"); + test(ic.getImplicitContext().get("zero").Equals("ZERO")); + test(ic.getImplicitContext().getWithDefault("foobar", "foo").Equals("foo")); + + ctx = ic.getImplicitContext().getContext(); + test(p3.opContext().Equals(ctx)); + + Ice.Context prxContext = new Ice.Context(); + prxContext["one"] = "UN"; + prxContext["four"] = "QUATRE"; + + Ice.Context combined = (Ice.Context)prxContext.Clone(); + combined.AddRange(ctx); + test(combined["one"].Equals("UN")); + + p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); + + ic.getImplicitContext().setContext(null); + test(p3.opContext().Equals(prxContext)); + + ic.getImplicitContext().setContext(ctx); + test(p3.opContext().Equals(combined)); + + ic.destroy(); + } + } } } diff --git a/cs/test/Ice/operations/TwowaysAMI.cs b/cs/test/Ice/operations/TwowaysAMI.cs index 942cbe6d67a..c4864ce30d6 100755 --- a/cs/test/Ice/operations/TwowaysAMI.cs +++ b/cs/test/Ice/operations/TwowaysAMI.cs @@ -34,7 +34,7 @@ public class TwowaysAMI { while(!_called) { - Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); + Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); if(!_called) { @@ -81,23 +81,23 @@ public class TwowaysAMI private class AMI_MyClass_opVoidExI : Test.AMI_MyClass_opVoid { - public override void ice_response() - { - test(false); - } + public override void ice_response() + { + test(false); + } - public override void ice_exception(Ice.Exception ex) - { - test(ex is Ice.TwowayOnlyException); - callback.called(); - } + public override void ice_exception(Ice.Exception ex) + { + test(ex is Ice.TwowayOnlyException); + callback.called(); + } - public virtual bool check() - { - return callback.check(); - } + public virtual bool check() + { + return callback.check(); + } - private Callback callback = new Callback(); + private Callback callback = new Callback(); } private class AMI_MyClass_opByteI : Test.AMI_MyClass_opByte @@ -124,23 +124,23 @@ public class TwowaysAMI private class AMI_MyClass_opByteExI : Test.AMI_MyClass_opByte { - public override void ice_response(byte r, byte b) - { - test(false); - } + public override void ice_response(byte r, byte b) + { + test(false); + } - public override void ice_exception(Ice.Exception ex) - { - test(ex is Ice.TwowayOnlyException); - callback.called(); - } + public override void ice_exception(Ice.Exception ex) + { + test(ex is Ice.TwowayOnlyException); + callback.called(); + } - public virtual bool check() - { - return callback.check(); - } + public virtual bool check() + { + return callback.check(); + } - private Callback callback = new Callback(); + private Callback callback = new Callback(); } private class AMI_MyClass_opBoolI : Test.AMI_MyClass_opBool @@ -259,29 +259,29 @@ public class TwowaysAMI private class AMI_MyClass_opMyClassI : Test.AMI_MyClass_opMyClass { public AMI_MyClass_opMyClassI(Ice.Communicator comunicator) - { - _communicator = comunicator; - } + { + _communicator = comunicator; + } public override void ice_response(Test.MyClassPrx r, Test.MyClassPrx c1, Test.MyClassPrx c2) { test(c1.ice_getIdentity().Equals(_communicator.stringToIdentity("test"))); test(c2.ice_getIdentity().Equals(_communicator.stringToIdentity("noSuchIdentity"))); test(r.ice_getIdentity().Equals(_communicator.stringToIdentity("test"))); - // We can't do the callbacks below in thread per connection mode. - if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0) - { - r.opVoid(); - c1.opVoid(); - try - { - c2.opVoid(); - test(false); - } - catch(Ice.ObjectNotExistException) - { - } - } + // We can't do the callbacks below in thread per connection mode. + if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0) + { + r.opVoid(); + c1.opVoid(); + try + { + c2.opVoid(); + test(false); + } + catch(Ice.ObjectNotExistException) + { + } + } callback.called(); } @@ -296,15 +296,15 @@ public class TwowaysAMI } private Callback callback = new Callback(); - private Ice.Communicator _communicator; + private Ice.Communicator _communicator; } private class AMI_MyClass_opStructI : Test.AMI_MyClass_opStruct { - public AMI_MyClass_opStructI(Ice.Communicator comunicator) - { - _communicator = comunicator; - } + public AMI_MyClass_opStructI(Ice.Communicator comunicator) + { + _communicator = comunicator; + } public override void ice_response(Test.Structure rso, Test.Structure so) { @@ -313,11 +313,11 @@ public class TwowaysAMI test(rso.s.s.Equals("def")); test(so.e == Test.MyEnum.enum3); test(so.s.s.Equals("a new string")); - // We can't do the callbacks below in thread per connection mode. - if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0) - { - so.p.opVoid(); - } + // We can't do the callbacks below in thread per connection mode. + if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0) + { + so.p.opVoid(); + } callback.called(); } @@ -670,26 +670,26 @@ public class TwowaysAMI test(ssso[3].Count == 1); test(ssso[3][0].Count == 1); test(ssso[4].Count == 0); - test(ssso[0][0][0].Equals("abc")); - test(ssso[0][0][1].Equals("de")); - test(ssso[0][1][0].Equals("xyz")); - test(ssso[1][0][0].Equals("hello")); - test(ssso[2][0][0].Equals("")); - test(ssso[2][0][1].Equals("")); - test(ssso[2][1][0].Equals("abcd")); - test(ssso[3][0][0].Equals("")); + test(ssso[0][0][0].Equals("abc")); + test(ssso[0][0][1].Equals("de")); + test(ssso[0][1][0].Equals("xyz")); + test(ssso[1][0][0].Equals("hello")); + test(ssso[2][0][0].Equals("")); + test(ssso[2][0][1].Equals("")); + test(ssso[2][1][0].Equals("abcd")); + test(ssso[3][0][0].Equals("")); - test(rsso.Length == 3); - test(rsso[0].Count == 0); - test(rsso[1].Count == 1); - test(rsso[1][0].Count == 1); - test(rsso[2].Count == 2); - test(rsso[2][0].Count == 2); - test(rsso[2][1].Count == 1); - test(rsso[1][0][0].Equals("")); - test(rsso[2][0][0].Equals("")); - test(rsso[2][0][1].Equals("")); - test(rsso[2][1][0].Equals("abcd")); + test(rsso.Length == 3); + test(rsso[0].Count == 0); + test(rsso[1].Count == 1); + test(rsso[1][0].Count == 1); + test(rsso[2].Count == 2); + test(rsso[2][0].Count == 2); + test(rsso[2][1].Count == 1); + test(rsso[1][0][0].Equals("")); + test(rsso[2][0][0].Equals("")); + test(rsso[2][0][1].Equals("")); + test(rsso[2][1][0].Equals("abcd")); callback.called(); } @@ -856,7 +856,7 @@ public class TwowaysAMI internal AMI_MyClass_opIntSI(int l) { _l = l; - callback = new Callback(); + callback = new Callback(); } public override void ice_response(Test.IntS r) @@ -888,7 +888,7 @@ public class TwowaysAMI internal AMI_MyClass_opContextEqualI(Ice.Context d) { _d = d; - callback = new Callback(); + callback = new Callback(); } public override void ice_response(Ice.Context r) @@ -916,7 +916,7 @@ public class TwowaysAMI internal AMI_MyClass_opContextNotEqualI(Ice.Context d) { _d = d; - callback = new Callback(); + callback = new Callback(); } public override void ice_response(Ice.Context r) @@ -962,36 +962,36 @@ public class TwowaysAMI internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) { { - // Check that a call to a void operation raises TwowayOnlyException - // in the ice_exception() callback instead of at the point of call. - Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); - AMI_MyClass_opVoidExI cb = new AMI_MyClass_opVoidExI(); - try - { - oneway.opVoid_async(cb); - } - catch(Ice.Exception) - { - test(false); - } - test(cb.check()); - } + // Check that a call to a void operation raises TwowayOnlyException + // in the ice_exception() callback instead of at the point of call. + Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); + AMI_MyClass_opVoidExI cb = new AMI_MyClass_opVoidExI(); + try + { + oneway.opVoid_async(cb); + } + catch(Ice.Exception) + { + test(false); + } + test(cb.check()); + } - { - // Check that a call to a twoway operation raises TwowayOnlyException - // in the ice_exception() callback instead of at the point of call. - Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); - AMI_MyClass_opByteExI cb = new AMI_MyClass_opByteExI(); - try - { - oneway.opByte_async(cb, (byte)0, (byte)0); - } - catch(Ice.Exception) - { - test(false); - } - test(cb.check()); - } + { + // Check that a call to a twoway operation raises TwowayOnlyException + // in the ice_exception() callback instead of at the point of call. + Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); + AMI_MyClass_opByteExI cb = new AMI_MyClass_opByteExI(); + try + { + oneway.opByte_async(cb, (byte)0, (byte)0); + } + catch(Ice.Exception) + { + test(false); + } + test(cb.check()); + } { AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI(); @@ -1105,19 +1105,19 @@ public class TwowaysAMI } { - Test.ByteSS bsi1 = new Test.ByteSS(); - bsi1.Add(new Test.ByteS()); - bsi1.Add(new Test.ByteS()); - bsi1[0].Add(0x01); - bsi1[0].Add(0x11); - bsi1[0].Add(0x12); - bsi1[1].Add(0xff); - Test.ByteSS bsi2 = new Test.ByteSS(); - bsi2.Add(new Test.ByteS()); - bsi2.Add(new Test.ByteS()); - bsi2[0].Add(0x0e); - bsi2[1].Add(0xf2); - bsi2[1].Add(0xf1); + Test.ByteSS bsi1 = new Test.ByteSS(); + bsi1.Add(new Test.ByteS()); + bsi1.Add(new Test.ByteS()); + bsi1[0].Add(0x01); + bsi1[0].Add(0x11); + bsi1[0].Add(0x12); + bsi1[1].Add(0xff); + Test.ByteSS bsi2 = new Test.ByteSS(); + bsi2.Add(new Test.ByteS()); + bsi2.Add(new Test.ByteS()); + bsi2[0].Add(0x0e); + bsi2[1].Add(0xf2); + bsi2[1].Add(0xf1); AMI_MyClass_opByteSSI cb = new AMI_MyClass_opByteSSI(); p.opByteSS_async(cb, bsi1, bsi2); @@ -1126,12 +1126,12 @@ public class TwowaysAMI { Test.FloatSS fsi = new Test.FloatSS(); - fsi.Add(new Test.FloatS(new float[] { 3.14f })); - fsi.Add(new Test.FloatS(new float[] { 1.11f })); - fsi.Add(new Test.FloatS(new float[] { })); + fsi.Add(new Test.FloatS(new float[] { 3.14f })); + fsi.Add(new Test.FloatS(new float[] { 1.11f })); + fsi.Add(new Test.FloatS(new float[] { })); Test.DoubleSS dsi = new Test.DoubleSS(); - dsi.Add(new Test.DoubleS(new double[] { 1.1E10, 1.2E10, 1.3E10 })); + dsi.Add(new Test.DoubleS(new double[] { 1.1E10, 1.2E10, 1.3E10 })); AMI_MyClass_opFloatDoubleSSI cb = new AMI_MyClass_opFloatDoubleSSI(); p.opFloatDoubleSS_async(cb, fsi, dsi); @@ -1139,45 +1139,45 @@ public class TwowaysAMI } { - Test.StringSS ssi1 = new Test.StringSS(); - ssi1.Add(new Test.StringS()); - ssi1.Add(new Test.StringS()); - ssi1[0].Add("abc"); - ssi1[1].Add("de"); - ssi1[1].Add("fghi"); - Test.StringSS ssi2 = new Test.StringSS(); - ssi2.Add(new Test.StringS()); - ssi2.Add(new Test.StringS()); - ssi2.Add(new Test.StringS()); - ssi2[2].Add("xyz"); + Test.StringSS ssi1 = new Test.StringSS(); + ssi1.Add(new Test.StringS()); + ssi1.Add(new Test.StringS()); + ssi1[0].Add("abc"); + ssi1[1].Add("de"); + ssi1[1].Add("fghi"); + Test.StringSS ssi2 = new Test.StringSS(); + ssi2.Add(new Test.StringS()); + ssi2.Add(new Test.StringS()); + ssi2.Add(new Test.StringS()); + ssi2[2].Add("xyz"); AMI_MyClass_opStringSSI cb = new AMI_MyClass_opStringSSI(); p.opStringSS_async(cb, ssi1, ssi2); test(cb.check()); } - { - Test.StringSS[] sssi1 = { new Test.StringSS(), new Test.StringSS() }; - sssi1[0].Add(new Test.StringS()); - sssi1[0].Add(new Test.StringS()); - sssi1[0][0].Add("abc"); - sssi1[0][0].Add("de"); - sssi1[0][1].Add("xyz"); - sssi1[1].Add(new Test.StringS()); - sssi1[1][0].Add("hello"); - Test.StringSS[] sssi2 = { new Test.StringSS(), new Test.StringSS(), new Test.StringSS() }; - sssi2[0].Add(new Test.StringS()); - sssi2[0].Add(new Test.StringS()); - sssi2[0][0].Add(""); - sssi2[0][0].Add(""); - sssi2[0][1].Add("abcd"); - sssi2[1].Add(new Test.StringS()); - sssi2[1][0].Add(""); + { + Test.StringSS[] sssi1 = { new Test.StringSS(), new Test.StringSS() }; + sssi1[0].Add(new Test.StringS()); + sssi1[0].Add(new Test.StringS()); + sssi1[0][0].Add("abc"); + sssi1[0][0].Add("de"); + sssi1[0][1].Add("xyz"); + sssi1[1].Add(new Test.StringS()); + sssi1[1][0].Add("hello"); + Test.StringSS[] sssi2 = { new Test.StringSS(), new Test.StringSS(), new Test.StringSS() }; + sssi2[0].Add(new Test.StringS()); + sssi2[0].Add(new Test.StringS()); + sssi2[0][0].Add(""); + sssi2[0][0].Add(""); + sssi2[0][1].Add("abcd"); + sssi2[1].Add(new Test.StringS()); + sssi2[1][0].Add(""); - AMI_MyClass_opStringSSSI cb = new AMI_MyClass_opStringSSSI(); - p.opStringSSS_async(cb, sssi1, sssi2); - test(cb.check()); - } + AMI_MyClass_opStringSSSI cb = new AMI_MyClass_opStringSSSI(); + p.opStringSSS_async(cb, sssi1, sssi2); + test(cb.check()); + } { Test.ByteBoolD di1 = new Test.ByteBoolD(); @@ -1266,7 +1266,7 @@ public class TwowaysAMI } { - Ice.Context ctx = new Ice.Context(); + Ice.Context ctx = new Ice.Context(); ctx["one"] = "ONE"; ctx["two"] = "TWO"; ctx["three"] = "THREE"; @@ -1294,166 +1294,166 @@ public class TwowaysAMI p2.opContext_async(cb, ctx); test(cb.check()); } - { - // - // Test that default context is obtained correctly from communicator. - // + { + // + // Test that default context is obtained correctly from communicator. + // /* DEPRECATED - Ice.Context dflt = new Ice.Context(); - dflt["a"] = "b"; - communicator.setDefaultContext(dflt); - { - AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(dflt); - p.opContext_async(cb); - test(cb.check()); - } + Ice.Context dflt = new Ice.Context(); + dflt["a"] = "b"; + communicator.setDefaultContext(dflt); + { + AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(dflt); + p.opContext_async(cb); + test(cb.check()); + } - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new Ice.Context())); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new Ice.Context()); - p2.opContext_async(cb); - test(cb.check()); - } + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new Ice.Context())); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new Ice.Context()); + p2.opContext_async(cb); + test(cb.check()); + } - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(dflt); - p2.opContext_async(cb); - test(cb.check()); - } + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(dflt); + p2.opContext_async(cb); + test(cb.check()); + } - communicator.setDefaultContext(new Ice.Context()); - { - AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(new Ice.Context()); - p2.opContext_async(cb); - test(cb.check()); - } + communicator.setDefaultContext(new Ice.Context()); + { + AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(new Ice.Context()); + p2.opContext_async(cb); + test(cb.check()); + } - communicator.setDefaultContext(dflt); - Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( - communicator.stringToProxy("test:default -p 12010 -t 10000")); - { - Ice.Context tmp = new Ice.Context(); - tmp["a"] = "b"; - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c.opContext_async(cb); - test(cb.check()); - } + communicator.setDefaultContext(dflt); + Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( + communicator.stringToProxy("test:default -p 12010 -t 10000")); + { + Ice.Context tmp = new Ice.Context(); + tmp["a"] = "b"; + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c.opContext_async(cb); + test(cb.check()); + } - dflt["a"] = "c"; - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); - { - Ice.Context tmp = new Ice.Context(); - tmp["a"] = "c"; - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c2.opContext_async(cb); - test(cb.check()); - } + dflt["a"] = "c"; + Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); + { + Ice.Context tmp = new Ice.Context(); + tmp["a"] = "c"; + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c2.opContext_async(cb); + test(cb.check()); + } - dflt.Clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); - { - Ice.Context tmp = new Ice.Context(); - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c3.opContext_async(cb); - test(cb.check()); - } + dflt.Clear(); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); + { + Ice.Context tmp = new Ice.Context(); + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c3.opContext_async(cb); + test(cb.check()); + } - Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); - { - Ice.Context tmp = new Ice.Context(); - tmp["a"] = "b"; - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c4.opContext_async(cb); - test(cb.check()); - } + Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); + { + Ice.Context tmp = new Ice.Context(); + tmp["a"] = "b"; + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c4.opContext_async(cb); + test(cb.check()); + } - dflt["a"] = "d"; - communicator.setDefaultContext(dflt); + dflt["a"] = "d"; + communicator.setDefaultContext(dflt); - Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); - { - Ice.Context tmp = new Ice.Context(); - tmp["a"] = "d"; - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c5.opContext_async(cb); - test(cb.check()); - } + Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); + { + Ice.Context tmp = new Ice.Context(); + tmp["a"] = "d"; + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c5.opContext_async(cb); + test(cb.check()); + } - communicator.setDefaultContext(new Ice.Context()); + communicator.setDefaultContext(new Ice.Context()); */ - } + } } - { - // - // Test implicit context propagation - // - - String[] impls = {"Shared", "SharedWithoutLocking", "PerThread"}; - for(int i = 0; i < 3; i++) - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties().ice_clone_(); - initData.properties.setProperty("Ice.ImplicitContext", impls[i]); - - Ice.Communicator ic = Ice.Util.initialize(initData); - - Ice.Context ctx = new Ice.Context(); - ctx["one"] = "ONE"; - ctx["two"] = "TWO"; - ctx["three"] = "THREE"; - - Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( - ic.stringToProxy("test:default -p 12010 -t 10000")); - - ic.getImplicitContext().setContext(ctx); - test(ic.getImplicitContext().getContext().Equals(ctx)); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p3.opContext_async(cb); - test(cb.check()); - } - - - ic.getImplicitContext().set("zero", "ZERO"); - test(ic.getImplicitContext().get("zero").Equals("ZERO")); - test(ic.getImplicitContext().getWithDefault("foobar", "foo").Equals("foo")); - - ctx = ic.getImplicitContext().getContext(); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p3.opContext_async(cb); - test(cb.check()); - } - - Ice.Context prxContext = new Ice.Context(); - prxContext["one"] = "UN"; - prxContext["four"] = "QUATRE"; - - Ice.Context combined = (Ice.Context)prxContext.Clone(); - combined.AddRange(ctx); - test(combined["one"].Equals("UN")); - - p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); - - ic.getImplicitContext().setContext(null); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(prxContext); - p3.opContext_async(cb); - test(cb.check()); - } - - ic.getImplicitContext().setContext(ctx); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(combined); - p3.opContext_async(cb); - test(cb.check()); - } - - ic.destroy(); - } - } + { + // + // Test implicit context propagation + // + + String[] impls = {"Shared", "SharedWithoutLocking", "PerThread"}; + for(int i = 0; i < 3; i++) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties().ice_clone_(); + initData.properties.setProperty("Ice.ImplicitContext", impls[i]); + + Ice.Communicator ic = Ice.Util.initialize(initData); + + Ice.Context ctx = new Ice.Context(); + ctx["one"] = "ONE"; + ctx["two"] = "TWO"; + ctx["three"] = "THREE"; + + Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( + ic.stringToProxy("test:default -p 12010 -t 10000")); + + ic.getImplicitContext().setContext(ctx); + test(ic.getImplicitContext().getContext().Equals(ctx)); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); + p3.opContext_async(cb); + test(cb.check()); + } + + + ic.getImplicitContext().set("zero", "ZERO"); + test(ic.getImplicitContext().get("zero").Equals("ZERO")); + test(ic.getImplicitContext().getWithDefault("foobar", "foo").Equals("foo")); + + ctx = ic.getImplicitContext().getContext(); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); + p3.opContext_async(cb); + test(cb.check()); + } + + Ice.Context prxContext = new Ice.Context(); + prxContext["one"] = "UN"; + prxContext["four"] = "QUATRE"; + + Ice.Context combined = (Ice.Context)prxContext.Clone(); + combined.AddRange(ctx); + test(combined["one"].Equals("UN")); + + p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); + + ic.getImplicitContext().setContext(null); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(prxContext); + p3.opContext_async(cb); + test(cb.check()); + } + + ic.getImplicitContext().setContext(ctx); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(combined); + p3.opContext_async(cb); + test(cb.check()); + } + + ic.destroy(); + } + } { Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p); diff --git a/cs/test/Ice/retry/AllTests.cs b/cs/test/Ice/retry/AllTests.cs index b86b4bf487d..658330d6023 100644 --- a/cs/test/Ice/retry/AllTests.cs +++ b/cs/test/Ice/retry/AllTests.cs @@ -30,11 +30,11 @@ public class AllTests public bool check() { - lock(this) - { + lock(this) + { while(!_called) { - Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); + Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); if(!_called) { @@ -44,17 +44,17 @@ public class AllTests _called = false; return true; - } + } } public void called() { - lock(this) - { + lock(this) + { Debug.Assert(!_called); _called = true; Monitor.Pulse(this); - } + } } private bool _called; @@ -89,8 +89,8 @@ public class AllTests public override void ice_exception(Ice.Exception ex) { - test(ex is Ice.ConnectionLostException); - callback.called(); + test(ex is Ice.ConnectionLostException); + callback.called(); } public bool check() @@ -108,7 +108,7 @@ public class AllTests string rf = "retry:default -p 12010 -t 10000"; Ice.ObjectPrx base1 = communicator.stringToProxy(rf); test(base1 != null); - Ice.ObjectPrx base2 = communicator.stringToProxy(rf); + Ice.ObjectPrx base2 = communicator.stringToProxy(rf); test(base2 != null); Console.Out.WriteLine("ok"); @@ -116,51 +116,51 @@ public class AllTests Console.Out.Flush(); Test.RetryPrx retry1 = Test.RetryPrxHelper.checkedCast(base1); test(retry1 != null); - test(retry1.Equals(base1)); + test(retry1.Equals(base1)); Test.RetryPrx retry2 = Test.RetryPrxHelper.checkedCast(base2); test(retry2 != null); - test(retry2.Equals(base2)); + test(retry2.Equals(base2)); Console.Out.WriteLine("ok"); - Console.Out.Write("calling regular operation with first proxy... "); - Console.Out.Flush(); - retry1.op(false); - Console.Out.WriteLine("ok"); - - Console.Out.Write("calling operation to kill connection with second proxy... "); - Console.Out.Flush(); - try - { - retry2.op(true); - test(false); - } - catch(Ice.ConnectionLostException) - { - Console.Out.WriteLine("ok"); - } + Console.Out.Write("calling regular operation with first proxy... "); + Console.Out.Flush(); + retry1.op(false); + Console.Out.WriteLine("ok"); + + Console.Out.Write("calling operation to kill connection with second proxy... "); + Console.Out.Flush(); + try + { + retry2.op(true); + test(false); + } + catch(Ice.ConnectionLostException) + { + Console.Out.WriteLine("ok"); + } Console.Out.Write("calling regular operation with first proxy again... "); Console.Out.Flush(); - retry1.op(false); - Console.Out.WriteLine("ok"); - - AMIRegular cb1 = new AMIRegular(); - AMIException cb2 = new AMIException(); - - Console.Out.Write("calling regular AMI operation with first proxy... "); - retry1.op_async(cb1, false); - test(cb1.check()); - Console.Out.WriteLine("ok"); - - Console.Out.Write("calling AMI operation to kill connection with second proxy... "); - retry2.op_async(cb2, true); - test(cb2.check()); - Console.Out.WriteLine("ok"); - - Console.Out.Write("calling regular AMI operation with first proxy again... "); - retry1.op_async(cb1, false); - test(cb1.check()); - Console.Out.WriteLine("ok"); + retry1.op(false); + Console.Out.WriteLine("ok"); + + AMIRegular cb1 = new AMIRegular(); + AMIException cb2 = new AMIException(); + + Console.Out.Write("calling regular AMI operation with first proxy... "); + retry1.op_async(cb1, false); + test(cb1.check()); + Console.Out.WriteLine("ok"); + + Console.Out.Write("calling AMI operation to kill connection with second proxy... "); + retry2.op_async(cb2, true); + test(cb2.check()); + Console.Out.WriteLine("ok"); + + Console.Out.Write("calling regular AMI operation with first proxy again... "); + retry1.op_async(cb1, false); + test(cb1.check()); + Console.Out.WriteLine("ok"); return retry1; } diff --git a/cs/test/Ice/retry/Client.cs b/cs/test/Ice/retry/Client.cs index 807e06e2df8..51c97ede8b4 100644 --- a/cs/test/Ice/retry/Client.cs +++ b/cs/test/Ice/retry/Client.cs @@ -25,19 +25,19 @@ public class Client try { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); - // - // For this test, we want to disable retries. - // - initData.properties.setProperty("Ice.RetryIntervals", "-1"); + // + // For this test, we want to disable retries. + // + initData.properties.setProperty("Ice.RetryIntervals", "-1"); - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); - + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + communicator = Ice.Util.initialize(ref args, initData); status = run(args, communicator); } @@ -55,7 +55,7 @@ public class Client } catch(Ice.LocalException ex) { - Console.Error.WriteLine(ex); + Console.Error.WriteLine(ex); status = 1; } } diff --git a/cs/test/Ice/retry/RetryI.cs b/cs/test/Ice/retry/RetryI.cs index de6d4172b1c..02954e9fcdd 100644 --- a/cs/test/Ice/retry/RetryI.cs +++ b/cs/test/Ice/retry/RetryI.cs @@ -18,9 +18,9 @@ public sealed class RetryI : Test.RetryDisp_ public override void op(bool kill, Ice.Current current) { if(kill) - { - current.con.close(true); - } + { + current.con.close(true); + } } public override void shutdown(Ice.Current current) diff --git a/cs/test/Ice/retry/Server.cs b/cs/test/Ice/retry/Server.cs index e38db983162..b869ed13837 100644 --- a/cs/test/Ice/retry/Server.cs +++ b/cs/test/Ice/retry/Server.cs @@ -13,7 +13,7 @@ public class Server { public static int run(string[] args, Ice.Communicator communicator) { - communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); + communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new RetryI(), communicator.stringToIdentity("retry")); adapter.activate(); diff --git a/cs/test/Ice/servantLocator/AllTests.cs b/cs/test/Ice/servantLocator/AllTests.cs index 66754cd5c8b..2a658343e78 100755 --- a/cs/test/Ice/servantLocator/AllTests.cs +++ b/cs/test/Ice/servantLocator/AllTests.cs @@ -23,98 +23,98 @@ public class AllTests public static void testExceptions(TestIntfPrx obj, bool collocated) { - try - { - obj.requestFailedException(); - test(false); - } - catch(ObjectNotExistException ex) - { - if(!collocated) - { - test(ex.id.Equals(obj.ice_getIdentity())); - test(ex.facet.Equals(obj.ice_getFacet())); - test(ex.operation.Equals("requestFailedException")); - } - } + try + { + obj.requestFailedException(); + test(false); + } + catch(ObjectNotExistException ex) + { + if(!collocated) + { + test(ex.id.Equals(obj.ice_getIdentity())); + test(ex.facet.Equals(obj.ice_getFacet())); + test(ex.operation.Equals("requestFailedException")); + } + } - try - { - obj.unknownUserException(); - test(false); - } - catch(UnknownUserException ex) - { - test(ex.unknown.Equals("reason")); - } + try + { + obj.unknownUserException(); + test(false); + } + catch(UnknownUserException ex) + { + test(ex.unknown.Equals("reason")); + } - try - { - obj.unknownLocalException(); - test(false); - } - catch(UnknownLocalException ex) - { - test(ex.unknown.Equals("reason")); - } + try + { + obj.unknownLocalException(); + test(false); + } + catch(UnknownLocalException ex) + { + test(ex.unknown.Equals("reason")); + } - try - { - obj.unknownException(); - test(false); - } - catch(UnknownException ex) - { - test(ex.unknown.Equals("reason")); - } + try + { + obj.unknownException(); + test(false); + } + catch(UnknownException ex) + { + test(ex.unknown.Equals("reason")); + } - try - { - obj.userException(); - test(false); - } - catch(UnknownUserException ex) - { - //Console.Error.WriteLine(ex.unknown); - test(!collocated); - test(ex.unknown.IndexOf("Test.TestIntfUserException") >= 0); - } - catch(TestIntfUserException) - { - test(collocated); - } + try + { + obj.userException(); + test(false); + } + catch(UnknownUserException ex) + { + //Console.Error.WriteLine(ex.unknown); + test(!collocated); + test(ex.unknown.IndexOf("Test.TestIntfUserException") >= 0); + } + catch(TestIntfUserException) + { + test(collocated); + } - try - { - obj.localException(); - test(false); - } - catch(UnknownLocalException ex) - { - //Console.Error.WriteLine(ex.unknown); - test(!collocated); - test(ex.unknown.IndexOf("Ice.SocketException") >= 0); - } - catch(SocketException) - { - test(collocated); - } + try + { + obj.localException(); + test(false); + } + catch(UnknownLocalException ex) + { + //Console.Error.WriteLine(ex.unknown); + test(!collocated); + test(ex.unknown.IndexOf("Ice.SocketException") >= 0); + } + catch(SocketException) + { + test(collocated); + } - try - { - obj.csException(); - test(false); - } - catch(UnknownException ex) - { - //Console.Error.WriteLine(ex.unknown); - test(!collocated); - test(ex.unknown.IndexOf("System.Exception: message") >= 0); - } - catch(System.Exception) - { - test(collocated); - } + try + { + obj.csException(); + test(false); + } + catch(UnknownException ex) + { + //Console.Error.WriteLine(ex.unknown); + test(!collocated); + test(ex.unknown.IndexOf("System.Exception: message") >= 0); + } + catch(System.Exception) + { + test(collocated); + } } public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated) @@ -133,54 +133,54 @@ public class AllTests test(obj.Equals(@base)); Console.Out.WriteLine("ok"); - Console.Out.Write("testing servant locator..."); + Console.Out.Write("testing servant locator..."); Console.Out.Flush(); - @base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); - obj = TestIntfPrxHelper.checkedCast(@base); - try - { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010 -t 10000")); - } - catch(ObjectNotExistException) - { - } - Console.Out.WriteLine("ok"); + @base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(@base); + try + { + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010 -t 10000")); + } + catch(ObjectNotExistException) + { + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing default servant locator..."); + Console.Out.Write("testing default servant locator..."); Console.Out.Flush(); - @base = communicator.stringToProxy("anothercat/locate:default -p 12010 -t 10000"); - obj = TestIntfPrxHelper.checkedCast(@base); - @base = communicator.stringToProxy("locate:default -p 12010 -t 10000"); - obj = TestIntfPrxHelper.checkedCast(@base); - try - { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010 -t 10000")); - } - catch(ObjectNotExistException) - { - } - try - { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010 -t 10000")); - } - catch(ObjectNotExistException) - { - } - Console.Out.WriteLine("ok"); + @base = communicator.stringToProxy("anothercat/locate:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(@base); + @base = communicator.stringToProxy("locate:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(@base); + try + { + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010 -t 10000")); + } + catch(ObjectNotExistException) + { + } + try + { + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010 -t 10000")); + } + catch(ObjectNotExistException) + { + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing locate exceptions... "); + Console.Out.Write("testing locate exceptions... "); Console.Out.Flush(); - @base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); - obj = TestIntfPrxHelper.checkedCast(@base); - testExceptions(obj, collocated); - Console.Out.WriteLine("ok"); + @base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(@base); + testExceptions(obj, collocated); + Console.Out.WriteLine("ok"); - Console.Out.Write("testing finished exceptions... "); + Console.Out.Write("testing finished exceptions... "); Console.Out.Flush(); - @base = communicator.stringToProxy("category/finished:default -p 12010 -t 10000"); - obj = TestIntfPrxHelper.checkedCast(@base); - testExceptions(obj, collocated); - Console.Out.WriteLine("ok"); + @base = communicator.stringToProxy("category/finished:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(@base); + testExceptions(obj, collocated); + Console.Out.WriteLine("ok"); return obj; } diff --git a/cs/test/Ice/servantLocator/Client.cs b/cs/test/Ice/servantLocator/Client.cs index e926daaf993..f3f2297a6a8 100755 --- a/cs/test/Ice/servantLocator/Client.cs +++ b/cs/test/Ice/servantLocator/Client.cs @@ -15,8 +15,8 @@ public class Client { public override int run(string[] args) { - TestIntfPrx obj = AllTests.allTests(communicator(), false); - obj.shutdown(); + TestIntfPrx obj = AllTests.allTests(communicator(), false); + obj.shutdown(); return 0; } } @@ -25,9 +25,9 @@ public class Client { TestClient app = new TestClient(); int result = app.main(args); - if(result != 0) - { - System.Environment.Exit(result); - } + if(result != 0) + { + System.Environment.Exit(result); + } } } diff --git a/cs/test/Ice/servantLocator/Collocated.cs b/cs/test/Ice/servantLocator/Collocated.cs index fcb518de41f..285436fb28e 100755 --- a/cs/test/Ice/servantLocator/Collocated.cs +++ b/cs/test/Ice/servantLocator/Collocated.cs @@ -15,13 +15,13 @@ public class Collocated { public override int run(string[] args) { - communicator().getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + communicator().getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); + communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.addServantLocator(new ServantLocatorI("category"), "category"); adapter.addServantLocator(new ServantLocatorI(""), ""); - adapter.add(new TestI(), communicator().stringToIdentity("asm")); + adapter.add(new TestI(), communicator().stringToIdentity("asm")); AllTests.allTests(communicator(), true); @@ -33,9 +33,9 @@ public class Collocated { TestClient app = new TestClient(); int result = app.main(args); - if(result != 0) - { - System.Environment.Exit(result); - } + if(result != 0) + { + System.Environment.Exit(result); + } } } diff --git a/cs/test/Ice/servantLocator/CookieI.cs b/cs/test/Ice/servantLocator/CookieI.cs index f225eac92bb..8c8dd2541ed 100755 --- a/cs/test/Ice/servantLocator/CookieI.cs +++ b/cs/test/Ice/servantLocator/CookieI.cs @@ -13,6 +13,6 @@ public sealed class CookieI : Cookie { public override string message() { - return "blahblah"; + return "blahblah"; } } diff --git a/cs/test/Ice/servantLocator/ServantLocatorI.cs b/cs/test/Ice/servantLocator/ServantLocatorI.cs index 1ebb6ae20f6..956a39af743 100755 --- a/cs/test/Ice/servantLocator/ServantLocatorI.cs +++ b/cs/test/Ice/servantLocator/ServantLocatorI.cs @@ -15,16 +15,16 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator { public ServantLocatorI(String category) { - _category = category; + _category = category; _deactivated = false; } ~ServantLocatorI() { lock(this) - { - test(_deactivated); - } + { + test(_deactivated); + } } private static void test(bool b) @@ -37,24 +37,24 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator public Ice.Object locate(Ice.Current current, out Ice.LocalObject cookie) { - lock(this) - { - test(!_deactivated); - } + lock(this) + { + test(!_deactivated); + } - test(current.id.category.Equals(_category) || _category.Length == 0); - - if(current.id.name.Equals("unknown")) - { - cookie = null; - return null; - } + test(current.id.category.Equals(_category) || _category.Length == 0); + + if(current.id.name.Equals("unknown")) + { + cookie = null; + return null; + } - test(current.id.name.Equals("locate") || current.id.name.Equals("finished")); - if(current.id.name.Equals("locate")) - { - exception(current); - } + test(current.id.name.Equals("locate") || current.id.name.Equals("finished")); + if(current.id.name.Equals("locate")) + { + exception(current); + } cookie = new CookieI(); @@ -63,18 +63,18 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator public void finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie) { - lock(this) - { - test(!_deactivated); - } + lock(this) + { + test(!_deactivated); + } - test(current.id.category.Equals(_category) || _category.Length == 0); - test(current.id.name.Equals("locate") || current.id.name.Equals("finished")); - - if(current.id.name.Equals("finished")) - { - exception(current); - } + test(current.id.category.Equals(_category) || _category.Length == 0); + test(current.id.name.Equals("locate") || current.id.name.Equals("finished")); + + if(current.id.name.Equals("finished")) + { + exception(current); + } Cookie co = (Cookie) cookie; test(co.message().Equals("blahblah")); @@ -82,52 +82,52 @@ public sealed class ServantLocatorI : Ice.LocalObjectImpl, Ice.ServantLocator public void deactivate(string category) { - lock(this) - { - test(!_deactivated); + lock(this) + { + test(!_deactivated); - _deactivated = true; - } + _deactivated = true; + } } private void exception(Ice.Current current) { - if(current.operation.Equals("requestFailedException")) - { - throw new ObjectNotExistException(); - } - else if(current.operation.Equals("unknownUserException")) - { - UnknownUserException ex = new UnknownUserException(); - ex.unknown = "reason"; - throw ex; - } - else if(current.operation.Equals("unknownLocalException")) - { - UnknownLocalException ex = new UnknownLocalException(); - ex.unknown = "reason"; - throw ex; - } - else if(current.operation.Equals("unknownException")) - { - UnknownException ex = new UnknownException(); - ex.unknown = "reason"; - throw ex; - } - else if(current.operation.Equals("userException")) - { - throw new TestIntfUserException(); - } - else if(current.operation.Equals("localException")) - { - SocketException ex = new SocketException(); - ex.error = 0; - throw ex; - } - else if(current.operation.Equals("csException")) - { - throw new System.Exception("message"); - } + if(current.operation.Equals("requestFailedException")) + { + throw new ObjectNotExistException(); + } + else if(current.operation.Equals("unknownUserException")) + { + UnknownUserException ex = new UnknownUserException(); + ex.unknown = "reason"; + throw ex; + } + else if(current.operation.Equals("unknownLocalException")) + { + UnknownLocalException ex = new UnknownLocalException(); + ex.unknown = "reason"; + throw ex; + } + else if(current.operation.Equals("unknownException")) + { + UnknownException ex = new UnknownException(); + ex.unknown = "reason"; + throw ex; + } + else if(current.operation.Equals("userException")) + { + throw new TestIntfUserException(); + } + else if(current.operation.Equals("localException")) + { + SocketException ex = new SocketException(); + ex.error = 0; + throw ex; + } + else if(current.operation.Equals("csException")) + { + throw new System.Exception("message"); + } } private bool _deactivated; diff --git a/cs/test/Ice/servantLocator/Server.cs b/cs/test/Ice/servantLocator/Server.cs index 6280e1373d4..9cfa58c81ed 100755 --- a/cs/test/Ice/servantLocator/Server.cs +++ b/cs/test/Ice/servantLocator/Server.cs @@ -14,12 +14,12 @@ public class Server public override int run(string[] args) { communicator().getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 2000"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.addServantLocator(new ServantLocatorI("category"), "category"); adapter.addServantLocator(new ServantLocatorI(""), ""); - adapter.add(new TestI(), communicator().stringToIdentity("asm")); + adapter.add(new TestI(), communicator().stringToIdentity("asm")); adapter.activate(); adapter.waitForDeactivate(); @@ -31,9 +31,9 @@ public class Server { TestServer app = new TestServer(); int result = app.main(args); - if(result != 0) - { - System.Environment.Exit(result); - } + if(result != 0) + { + System.Environment.Exit(result); + } } } diff --git a/cs/test/Ice/servantLocator/TestAMDI.cs b/cs/test/Ice/servantLocator/TestAMDI.cs index 555c6ada355..817da133ff5 100644 --- a/cs/test/Ice/servantLocator/TestAMDI.cs +++ b/cs/test/Ice/servantLocator/TestAMDI.cs @@ -13,42 +13,42 @@ public sealed class TestI : TestIntfDisp_ { public override void requestFailedException_async(AMD_TestIntf_requestFailedException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public override void unknownUserException_async(AMD_TestIntf_unknownUserException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public override void unknownLocalException_async(AMD_TestIntf_unknownLocalException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public override void unknownException_async(AMD_TestIntf_unknownException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public override void localException_async(AMD_TestIntf_localException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public override void userException_async(AMD_TestIntf_userException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public override void csException_async(AMD_TestIntf_csException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public override void shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current) { current.adapter.deactivate(); - cb.ice_response(); + cb.ice_response(); } } diff --git a/cs/test/Ice/slicing/exceptions/AllTests.cs b/cs/test/Ice/slicing/exceptions/AllTests.cs index a46ae4e6f02..f9b4c41b0bb 100755 --- a/cs/test/Ice/slicing/exceptions/AllTests.cs +++ b/cs/test/Ice/slicing/exceptions/AllTests.cs @@ -35,7 +35,7 @@ public class AllTests { while(!_called) { - Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); + Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); if(!_called) { @@ -524,7 +524,7 @@ public class AllTests try { testPrx.baseAsBase(); - test(false); + test(false); } catch(Base b) { @@ -553,7 +553,7 @@ public class AllTests try { testPrx.unknownDerivedAsBase(); - test(false); + test(false); } catch(Base b) { @@ -582,7 +582,7 @@ public class AllTests try { testPrx.knownDerivedAsBase(); - test(false); + test(false); } catch(KnownDerived k) { @@ -612,7 +612,7 @@ public class AllTests try { testPrx.knownDerivedAsKnownDerived(); - test(false); + test(false); } catch(KnownDerived k) { @@ -642,7 +642,7 @@ public class AllTests try { testPrx.unknownIntermediateAsBase(); - test(false); + test(false); } catch(Base b) { @@ -671,7 +671,7 @@ public class AllTests try { testPrx.knownIntermediateAsBase(); - test(false); + test(false); } catch(KnownIntermediate ki) { @@ -701,7 +701,7 @@ public class AllTests try { testPrx.knownMostDerivedAsBase(); - test(false); + test(false); } catch(KnownMostDerived kmd) { @@ -732,7 +732,7 @@ public class AllTests try { testPrx.knownIntermediateAsKnownIntermediate(); - test(false); + test(false); } catch(KnownIntermediate ki) { @@ -762,7 +762,7 @@ public class AllTests try { testPrx.knownMostDerivedAsKnownIntermediate(); - test(false); + test(false); } catch(KnownMostDerived kmd) { @@ -793,7 +793,7 @@ public class AllTests try { testPrx.knownMostDerivedAsKnownMostDerived(); - test(false); + test(false); } catch(KnownMostDerived kmd) { @@ -824,7 +824,7 @@ public class AllTests try { testPrx.unknownMostDerived1AsBase(); - test(false); + test(false); } catch(KnownIntermediate ki) { @@ -854,7 +854,7 @@ public class AllTests try { testPrx.unknownMostDerived1AsKnownIntermediate(); - test(false); + test(false); } catch(KnownIntermediate ki) { @@ -884,7 +884,7 @@ public class AllTests try { testPrx.unknownMostDerived2AsBase(); - test(false); + test(false); } catch(Base b) { diff --git a/cs/test/Ice/slicing/exceptions/Client.cs b/cs/test/Ice/slicing/exceptions/Client.cs index e8fccab0a11..e8e20d1c254 100755 --- a/cs/test/Ice/slicing/exceptions/Client.cs +++ b/cs/test/Ice/slicing/exceptions/Client.cs @@ -42,7 +42,7 @@ public class Client } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } diff --git a/cs/test/Ice/slicing/exceptions/Server.cs b/cs/test/Ice/slicing/exceptions/Server.cs index 37980e22481..0274f0df698 100755 --- a/cs/test/Ice/slicing/exceptions/Server.cs +++ b/cs/test/Ice/slicing/exceptions/Server.cs @@ -34,7 +34,7 @@ public class Server } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } diff --git a/cs/test/Ice/slicing/exceptions/TestAMDI.cs b/cs/test/Ice/slicing/exceptions/TestAMDI.cs index f88709e30aa..81f9470814a 100755 --- a/cs/test/Ice/slicing/exceptions/TestAMDI.cs +++ b/cs/test/Ice/slicing/exceptions/TestAMDI.cs @@ -47,7 +47,7 @@ public sealed class TestI : TestIntfDisp_ } public override void knownDerivedAsKnownDerived_async(AMD_TestIntf_knownDerivedAsKnownDerived cb, - Ice.Current current) + Ice.Current current) { KnownDerived d = new KnownDerived(); d.b = "KnownDerived.b"; @@ -81,7 +81,7 @@ public sealed class TestI : TestIntfDisp_ } public override void knownIntermediateAsKnownIntermediate_async( - AMD_TestIntf_knownIntermediateAsKnownIntermediate cb, Ice.Current current) + AMD_TestIntf_knownIntermediateAsKnownIntermediate cb, Ice.Current current) { KnownIntermediate ki = new KnownIntermediate(); ki.b = "KnownIntermediate.b"; @@ -90,7 +90,7 @@ public sealed class TestI : TestIntfDisp_ } public override void knownMostDerivedAsKnownIntermediate_async(AMD_TestIntf_knownMostDerivedAsKnownIntermediate cb, - Ice.Current current) + Ice.Current current) { KnownMostDerived kmd = new KnownMostDerived(); kmd.b = "KnownMostDerived.b"; @@ -100,7 +100,7 @@ public sealed class TestI : TestIntfDisp_ } public override void knownMostDerivedAsKnownMostDerived_async(AMD_TestIntf_knownMostDerivedAsKnownMostDerived cb, - Ice.Current current) + Ice.Current current) { KnownMostDerived kmd = new KnownMostDerived(); kmd.b = "KnownMostDerived.b"; @@ -119,7 +119,7 @@ public sealed class TestI : TestIntfDisp_ } public override void unknownMostDerived1AsKnownIntermediate_async( - AMD_TestIntf_unknownMostDerived1AsKnownIntermediate cb, Ice.Current current) + AMD_TestIntf_unknownMostDerived1AsKnownIntermediate cb, Ice.Current current) { UnknownMostDerived1 umd1 = new UnknownMostDerived1(); umd1.b = "UnknownMostDerived1.b"; diff --git a/cs/test/Ice/slicing/objects/AllTests.cs b/cs/test/Ice/slicing/objects/AllTests.cs index 8971c255dd7..3877c0a9a07 100755 --- a/cs/test/Ice/slicing/objects/AllTests.cs +++ b/cs/test/Ice/slicing/objects/AllTests.cs @@ -35,7 +35,7 @@ public class AllTests { while(!_called) { - Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); + Monitor.Wait(this, TimeSpan.FromMilliseconds(5000)); if(!_called) { @@ -177,7 +177,7 @@ public class AllTests { public override void ice_response(Ice.Object o) { - AllTests.test(false); + AllTests.test(false); } public override void ice_exception(Ice.Exception exc) @@ -909,11 +909,11 @@ public class AllTests try { testPrx.SUnknownAsObject(); - test(false); + test(false); + } + catch(Ice.NoObjectFactoryException) + { } - catch(Ice.NoObjectFactoryException) - { - } catch(Exception) { test(false); @@ -924,16 +924,16 @@ public class AllTests Console.Out.Write("unknown with Object as Object (AMI)... "); Console.Out.Flush(); { - try - { - AMI_Test_SUnknownAsObjectI cb = new AMI_Test_SUnknownAsObjectI(); - testPrx.SUnknownAsObject_async(cb); - test(cb.check()); - } - catch(Exception) - { - test(false); - } + try + { + AMI_Test_SUnknownAsObjectI cb = new AMI_Test_SUnknownAsObjectI(); + testPrx.SUnknownAsObject_async(cb); + test(cb.check()); + } + catch(Exception) + { + test(false); + } } Console.Out.WriteLine("ok"); @@ -1275,8 +1275,8 @@ public class AllTests try { D3 p3 = (D3) b2; - test(false); - D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable. + test(false); + D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable. } catch(InvalidCastException) { @@ -1329,8 +1329,8 @@ public class AllTests try { D3 p3 = (D3) b2; - test(false); - D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable. + test(false); + D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable. } catch(InvalidCastException) { @@ -1368,8 +1368,8 @@ public class AllTests try { D3 p1 = (D3) b1; - test(false); - D3 tmp = p1; p1 = tmp; // Stop compiler warning about unused variable. + test(false); + D3 tmp = p1; p1 = tmp; // Stop compiler warning about unused variable. } catch(InvalidCastException) { @@ -1423,8 +1423,8 @@ public class AllTests try { D3 p1 = (D3) b1; - test(false); - D3 tmp = p1; p1 = tmp; // Stop compiler warning about unused variable. + test(false); + D3 tmp = p1; p1 = tmp; // Stop compiler warning about unused variable. } catch(InvalidCastException) { diff --git a/cs/test/Ice/slicing/objects/Client.cs b/cs/test/Ice/slicing/objects/Client.cs index a3cffeb1dd6..4c852f3a056 100755 --- a/cs/test/Ice/slicing/objects/Client.cs +++ b/cs/test/Ice/slicing/objects/Client.cs @@ -30,7 +30,7 @@ public class Client } catch(System.Exception ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } @@ -42,7 +42,7 @@ public class Client } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } diff --git a/cs/test/Ice/slicing/objects/Server.cs b/cs/test/Ice/slicing/objects/Server.cs index 0d066363375..733947ba4e6 100755 --- a/cs/test/Ice/slicing/objects/Server.cs +++ b/cs/test/Ice/slicing/objects/Server.cs @@ -34,7 +34,7 @@ public class Server } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } @@ -46,7 +46,7 @@ public class Server } catch(Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } } diff --git a/cs/test/Ice/slicing/objects/Test.ice b/cs/test/Ice/slicing/objects/Test.ice index bcb4e35380a..9676cac734a 100755 --- a/cs/test/Ice/slicing/objects/Test.ice +++ b/cs/test/Ice/slicing/objects/Test.ice @@ -67,7 +67,7 @@ exception DerivedException extends BaseException D1 pd1; }; -class Forward; // Forward-declared class defined in another compilation unit +class Forward; // Forward-declared class defined in another compilation unit ["ami"] interface TestIntf { @@ -104,7 +104,7 @@ class Forward; // Forward-declared class defined in another compilation unit void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; - void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. + void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. void shutdown(); }; diff --git a/cs/test/Ice/slicing/objects/TestAMD.ice b/cs/test/Ice/slicing/objects/TestAMD.ice index ee8b5d4e0e7..ec20140338c 100644 --- a/cs/test/Ice/slicing/objects/TestAMD.ice +++ b/cs/test/Ice/slicing/objects/TestAMD.ice @@ -67,7 +67,7 @@ exception DerivedException extends BaseException D1 pd1; }; -class Forward; // Forward-declared class defined in another compilation unit +class Forward; // Forward-declared class defined in another compilation unit ["ami", "amd"] interface TestIntf { @@ -104,7 +104,7 @@ class Forward; // Forward-declared class defined in another compilation unit void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; - void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. + void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. void shutdown(); }; diff --git a/cs/test/Ice/stream/Client.cs b/cs/test/Ice/stream/Client.cs index 5a0642724db..eb734ed2bbd 100644 --- a/cs/test/Ice/stream/Client.cs +++ b/cs/test/Ice/stream/Client.cs @@ -114,36 +114,36 @@ public class Client public class MyClassFactoryWrapper : Ice.LocalObjectImpl, Ice.ObjectFactory { - public MyClassFactoryWrapper() - { - _factory = null; - } + public MyClassFactoryWrapper() + { + _factory = null; + } public Ice.Object create(string type) { - if(_factory != null) - { - return _factory.create(type); - } - return new Test.MyClass(); + if(_factory != null) + { + return _factory.create(type); + } + return new Test.MyClass(); } public void destroy() { } - public void setFactory(Ice.ObjectFactory factory) - { - _factory = factory; - } + public void setFactory(Ice.ObjectFactory factory) + { + _factory = factory; + } - private Ice.ObjectFactory _factory; + private Ice.ObjectFactory _factory; } private static int run(string[] args, Ice.Communicator communicator) { - MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper(); - communicator.addObjectFactory(factoryWrapper, Test.MyClass.ice_staticId()); + MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper(); + communicator.addObjectFactory(factoryWrapper, Test.MyClass.ice_staticId()); Ice.InputStream @in; Ice.OutputStream @out; diff --git a/cs/test/Ice/timeout/AllTests.cs b/cs/test/Ice/timeout/AllTests.cs index 23fb64c1650..d708ddef863 100644 --- a/cs/test/Ice/timeout/AllTests.cs +++ b/cs/test/Ice/timeout/AllTests.cs @@ -30,11 +30,11 @@ public class AllTests public bool check() { - lock(this) - { + lock(this) + { while(!_called) { - Monitor.Wait(this, 5000); + Monitor.Wait(this, 5000); if(!_called) { @@ -44,17 +44,17 @@ public class AllTests _called = false; return true; - } + } } public void called() { - lock(this) - { + lock(this) + { Debug.Assert(!_called); _called = true; Monitor.Pulse(this); - } + } } private bool _called; @@ -89,8 +89,8 @@ public class AllTests public override void ice_exception(Ice.Exception ex) { - test(ex is Ice.TimeoutException); - callback.called(); + test(ex is Ice.TimeoutException); + callback.called(); } public bool check() @@ -130,8 +130,8 @@ public class AllTests public override void ice_exception(Ice.Exception ex) { - test(ex is Ice.TimeoutException); - callback.called(); + test(ex is Ice.TimeoutException); + callback.called(); } public bool check() @@ -144,269 +144,269 @@ public class AllTests public static Test.TimeoutPrx allTests(Ice.Communicator communicator) { - string sref = "timeout:default -p 12010 -t 10000"; - Ice.ObjectPrx obj = communicator.stringToProxy(sref); - test(obj != null); - - Test.TimeoutPrx timeout = Test.TimeoutPrxHelper.checkedCast(obj); - test(timeout != null); - - Console.Out.Write("testing connect timeout... "); - Console.Out.Flush(); - { - // - // Expect ConnectTimeoutException. - // - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(750); - to.ice_getConnection().close(true); // Force a reconnect. - try - { - to.op(); - test(false); - } - catch(Ice.ConnectTimeoutException) - { - // Expected. - } - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - to.holdAdapter(500); - to.ice_getConnection().close(true); // Force a reconnect. - try - { - to.op(); - } - catch(Ice.ConnectTimeoutException) - { - test(false); - } - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing read timeout... "); - Console.Out.Flush(); - { - // - // Expect TimeoutException. - // - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - try - { - to.sleep(750); - test(false); - } - catch(Ice.TimeoutException) - { - // Expected. - } - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - try - { - to.sleep(500); - } - catch(Ice.TimeoutException) - { - test(false); - } - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing write timeout... "); - Console.Out.Flush(); - { - // - // Expect TimeoutException. - // - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(750); - try - { - byte[] seq = new byte[100000]; - to.sendData(seq); - test(false); - } - catch(Ice.TimeoutException) - { - // Expected. - } - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - to.holdAdapter(500); - try - { - byte[] seq = new byte[100000]; - to.sendData(seq); - } - catch(Ice.TimeoutException) - { - test(false); - } - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing AMI read timeout... "); - Console.Out.Flush(); - { - // - // The resolution of AMI timeouts is limited by the connection monitor - // thread. We set Ice.MonitorConnections=1 (one second) in main(). - // - // Expect TimeoutException. - // - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - AMISleepEx cb = new AMISleepEx(); - to.sleep_async(cb, 2000); - test(cb.check()); - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - AMISleep cb = new AMISleep(); - to.sleep_async(cb, 500); - test(cb.check()); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing AMI write timeout... "); - Console.Out.Flush(); - { - // - // The resolution of AMI timeouts is limited by the connection monitor - // thread. We set Ice.MonitorConnections=1 (one second) in main(). - // - // Expect TimeoutException. - // - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(2000); - byte[] seq = new byte[100000]; - AMISendDataEx cb = new AMISendDataEx(); - to.sendData_async(cb, seq); - test(cb.check()); - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - to.holdAdapter(500); - byte[] seq = new byte[100000]; - AMISendData cb = new AMISendData(); - to.sendData_async(cb, seq); - test(cb.check()); - } - Console.Out.WriteLine("ok"); - - Console.Out.Write("testing timeout overrides... "); - Console.Out.Flush(); - { - // - // Test Ice.Override.Timeout. This property overrides all - // endpoint timeouts. - // - string[] args = new string[0]; - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties().ice_clone_(); - initData.properties.setProperty("Ice.Override.Timeout", "500"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - Test.TimeoutPrx to = Test.TimeoutPrxHelper.checkedCast(comm.stringToProxy(sref)); - try - { - to.sleep(750); - test(false); - } - catch(Ice.TimeoutException) - { - // Expected. - } - // - // Calling ice_timeout() should have no effect. - // - timeout.op(); // Ensure adapter is active. - to = Test.TimeoutPrxHelper.checkedCast(to.ice_timeout(1000)); - try - { - to.sleep(750); - test(false); - } - catch(Ice.TimeoutException) - { - // Expected. - } - comm.destroy(); - } - { - // - // Test Ice.Override.ConnectTimeout. - // - string[] args = new string[0]; - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties().ice_clone_(); - initData.properties.setProperty("Ice.Override.ConnectTimeout", "750"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - timeout.holdAdapter(1000); - Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref)); - try - { - to.op(); - test(false); - } - catch(Ice.ConnectTimeoutException) - { - // Expected. - } - // - // Calling ice_timeout() should have no effect on the connect timeout. - // - timeout.op(); // Ensure adapter is active. - timeout.holdAdapter(1000); - to = Test.TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1250)); - try - { - to.op(); - test(false); - } - catch(Ice.ConnectTimeoutException) - { - // Expected. - } - // - // Verify that timeout set via ice_timeout() is still used for requests. - // - to.op(); // Force connection. - try - { - to.sleep(1500); - test(false); - } - catch(Ice.TimeoutException) - { - // Expected. - } - comm.destroy(); - } - Console.Out.WriteLine("ok"); - - return timeout; + string sref = "timeout:default -p 12010 -t 10000"; + Ice.ObjectPrx obj = communicator.stringToProxy(sref); + test(obj != null); + + Test.TimeoutPrx timeout = Test.TimeoutPrxHelper.checkedCast(obj); + test(timeout != null); + + Console.Out.Write("testing connect timeout... "); + Console.Out.Flush(); + { + // + // Expect ConnectTimeoutException. + // + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + to.holdAdapter(750); + to.ice_getConnection().close(true); // Force a reconnect. + try + { + to.op(); + test(false); + } + catch(Ice.ConnectTimeoutException) + { + // Expected. + } + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + to.holdAdapter(500); + to.ice_getConnection().close(true); // Force a reconnect. + try + { + to.op(); + } + catch(Ice.ConnectTimeoutException) + { + test(false); + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing read timeout... "); + Console.Out.Flush(); + { + // + // Expect TimeoutException. + // + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + try + { + to.sleep(750); + test(false); + } + catch(Ice.TimeoutException) + { + // Expected. + } + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + try + { + to.sleep(500); + } + catch(Ice.TimeoutException) + { + test(false); + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing write timeout... "); + Console.Out.Flush(); + { + // + // Expect TimeoutException. + // + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + to.holdAdapter(750); + try + { + byte[] seq = new byte[100000]; + to.sendData(seq); + test(false); + } + catch(Ice.TimeoutException) + { + // Expected. + } + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + to.holdAdapter(500); + try + { + byte[] seq = new byte[100000]; + to.sendData(seq); + } + catch(Ice.TimeoutException) + { + test(false); + } + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing AMI read timeout... "); + Console.Out.Flush(); + { + // + // The resolution of AMI timeouts is limited by the connection monitor + // thread. We set Ice.MonitorConnections=1 (one second) in main(). + // + // Expect TimeoutException. + // + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + AMISleepEx cb = new AMISleepEx(); + to.sleep_async(cb, 2000); + test(cb.check()); + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + AMISleep cb = new AMISleep(); + to.sleep_async(cb, 500); + test(cb.check()); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing AMI write timeout... "); + Console.Out.Flush(); + { + // + // The resolution of AMI timeouts is limited by the connection monitor + // thread. We set Ice.MonitorConnections=1 (one second) in main(). + // + // Expect TimeoutException. + // + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + to.holdAdapter(2000); + byte[] seq = new byte[100000]; + AMISendDataEx cb = new AMISendDataEx(); + to.sendData_async(cb, seq); + test(cb.check()); + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + to.holdAdapter(500); + byte[] seq = new byte[100000]; + AMISendData cb = new AMISendData(); + to.sendData_async(cb, seq); + test(cb.check()); + } + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing timeout overrides... "); + Console.Out.Flush(); + { + // + // Test Ice.Override.Timeout. This property overrides all + // endpoint timeouts. + // + string[] args = new string[0]; + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties().ice_clone_(); + initData.properties.setProperty("Ice.Override.Timeout", "500"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + Test.TimeoutPrx to = Test.TimeoutPrxHelper.checkedCast(comm.stringToProxy(sref)); + try + { + to.sleep(750); + test(false); + } + catch(Ice.TimeoutException) + { + // Expected. + } + // + // Calling ice_timeout() should have no effect. + // + timeout.op(); // Ensure adapter is active. + to = Test.TimeoutPrxHelper.checkedCast(to.ice_timeout(1000)); + try + { + to.sleep(750); + test(false); + } + catch(Ice.TimeoutException) + { + // Expected. + } + comm.destroy(); + } + { + // + // Test Ice.Override.ConnectTimeout. + // + string[] args = new string[0]; + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties().ice_clone_(); + initData.properties.setProperty("Ice.Override.ConnectTimeout", "750"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + timeout.holdAdapter(1000); + Test.TimeoutPrx to = Test.TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref)); + try + { + to.op(); + test(false); + } + catch(Ice.ConnectTimeoutException) + { + // Expected. + } + // + // Calling ice_timeout() should have no effect on the connect timeout. + // + timeout.op(); // Ensure adapter is active. + timeout.holdAdapter(1000); + to = Test.TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1250)); + try + { + to.op(); + test(false); + } + catch(Ice.ConnectTimeoutException) + { + // Expected. + } + // + // Verify that timeout set via ice_timeout() is still used for requests. + // + to.op(); // Force connection. + try + { + to.sleep(1500); + test(false); + } + catch(Ice.TimeoutException) + { + // Expected. + } + comm.destroy(); + } + Console.Out.WriteLine("ok"); + + return timeout; } } diff --git a/cs/test/Ice/timeout/Client.cs b/cs/test/Ice/timeout/Client.cs index 918af83701c..d78d71a9e2c 100644 --- a/cs/test/Ice/timeout/Client.cs +++ b/cs/test/Ice/timeout/Client.cs @@ -13,57 +13,57 @@ public class Client { public static int run(string[] args, Ice.Communicator communicator) { - Test.TimeoutPrx timeout = AllTests.allTests(communicator); - timeout.shutdown(); - return 0; + Test.TimeoutPrx timeout = AllTests.allTests(communicator); + timeout.shutdown(); + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; + int status = 0; + Ice.Communicator communicator = null; - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); + try + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); - // - // For this test, we want to disable retries. - // - initData.properties.setProperty("Ice.RetryIntervals", "-1"); + // + // For this test, we want to disable retries. + // + initData.properties.setProperty("Ice.RetryIntervals", "-1"); - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); - // - // Check for AMI timeouts every second. - // - initData.properties.setProperty("Ice.MonitorConnections", "1"); + // + // Check for AMI timeouts every second. + // + initData.properties.setProperty("Ice.MonitorConnections", "1"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } + communicator = Ice.Util.initialize(ref args, initData); + status = run(args, communicator); + } + catch(Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + } if(status != 0) { diff --git a/cs/test/Ice/timeout/Server.cs b/cs/test/Ice/timeout/Server.cs index 12a3436eee9..6480f3011b2 100644 --- a/cs/test/Ice/timeout/Server.cs +++ b/cs/test/Ice/timeout/Server.cs @@ -13,51 +13,51 @@ public class Server { public static int run(string[] args, Ice.Communicator communicator) { - communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new TimeoutI(), communicator.stringToIdentity("timeout")); - adapter.activate(); + communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + adapter.add(new TimeoutI(), communicator.stringToIdentity("timeout")); + adapter.activate(); - communicator.waitForShutdown(); - return 0; + communicator.waitForShutdown(); + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; + int status = 0; + Ice.Communicator communicator = null; - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(ref args); + try + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(ref args); - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); - communicator = Ice.Util.initialize(ref args, initData); - status = run(args, communicator); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } + communicator = Ice.Util.initialize(ref args, initData); + status = run(args, communicator); + } + catch(Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + } if(status != 0) { diff --git a/cs/test/Ice/timeout/TimeoutI.cs b/cs/test/Ice/timeout/TimeoutI.cs index 0c3b10c8f84..4507befdfa1 100644 --- a/cs/test/Ice/timeout/TimeoutI.cs +++ b/cs/test/Ice/timeout/TimeoutI.cs @@ -14,15 +14,15 @@ internal class ActivateAdapterThread { internal ActivateAdapterThread(Ice.ObjectAdapter adapter, int timeout) { - _adapter = adapter; - _timeout = timeout; + _adapter = adapter; + _timeout = timeout; } internal void run() { - _adapter.waitForHold(); - Thread.Sleep(_timeout); - _adapter.activate(); + _adapter.waitForHold(); + Thread.Sleep(_timeout); + _adapter.activate(); } private Ice.ObjectAdapter _adapter; @@ -41,19 +41,19 @@ internal class TimeoutI : Test.TimeoutDisp_ public override void sleep(int to, Ice.Current current) { - Thread.Sleep(to); + Thread.Sleep(to); } public override void holdAdapter(int to, Ice.Current current) { - current.adapter.hold(); - ActivateAdapterThread act = new ActivateAdapterThread(current.adapter, to); - Thread thread = new Thread(new ThreadStart(act.run)); - thread.Start(); + current.adapter.hold(); + ActivateAdapterThread act = new ActivateAdapterThread(current.adapter, to); + Thread thread = new Thread(new ThreadStart(act.run)); + thread.Start(); } public override void shutdown(Ice.Current current) { - current.adapter.getCommunicator().shutdown(); + current.adapter.getCommunicator().shutdown(); } } diff --git a/cs/test/IceGrid/simple/AllTests.cs b/cs/test/IceGrid/simple/AllTests.cs index 6c87ef05f4a..8a642b2e467 100644 --- a/cs/test/IceGrid/simple/AllTests.cs +++ b/cs/test/IceGrid/simple/AllTests.cs @@ -16,47 +16,47 @@ public class AllTests class SessionKeepAliveThread { public SessionKeepAliveThread(IceGrid.AdminSessionPrx session, int timeout) - { - _session = session; - _timeout = timeout; - _terminated = false; - } + { + _session = session; + _timeout = timeout; + _terminated = false; + } - public void run() - { - lock(this) - { + public void run() + { + lock(this) + { while(!_terminated) { - System.Threading.Monitor.Wait(this, _timeout); + System.Threading.Monitor.Wait(this, _timeout); if(_terminated) { - break; - } + break; + } try { _session.keepAlive(); } catch(Ice.LocalException) { - break; + break; } } - } - } + } + } - public void terminate() - { - lock(this) - { - _terminated = true; - System.Threading.Monitor.Pulse(this); - } - } + public void terminate() + { + lock(this) + { + _terminated = true; + System.Threading.Monitor.Pulse(this); + } + } - private IceGrid.AdminSessionPrx _session; - private int _timeout; - private bool _terminated; + private IceGrid.AdminSessionPrx _session; + private int _timeout; + private bool _terminated; } private static void @@ -70,193 +70,193 @@ public class AllTests public static void allTests(Ice.Communicator communicator) { - Console.Out.Write("testing stringToProxy... "); - Console.Out.Flush(); - String rf = "test @ TestAdapter"; - Ice.ObjectPrx @base = communicator.stringToProxy(rf); - test(@base != null); - Console.Out.WriteLine("ok"); + Console.Out.Write("testing stringToProxy... "); + Console.Out.Flush(); + String rf = "test @ TestAdapter"; + Ice.ObjectPrx @base = communicator.stringToProxy(rf); + test(@base != null); + Console.Out.WriteLine("ok"); - Console.Out.Write("testing checked cast... "); - Console.Out.Flush(); - TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base); - test(obj != null); - test(obj.Equals(@base)); - Console.Out.WriteLine("ok"); - - Console.Out.Write("pinging server... "); - Console.Out.Flush(); - obj.ice_ping(); - Console.Out.WriteLine("ok"); - - System.Console.Out.Write("shutting down server... "); - System.Console.Out.Flush(); - obj.shutdown(); - System.Console.Out.WriteLine("ok"); + Console.Out.Write("testing checked cast... "); + Console.Out.Flush(); + TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base); + test(obj != null); + test(obj.Equals(@base)); + Console.Out.WriteLine("ok"); + + Console.Out.Write("pinging server... "); + Console.Out.Flush(); + obj.ice_ping(); + Console.Out.WriteLine("ok"); + + System.Console.Out.Write("shutting down server... "); + System.Console.Out.Flush(); + obj.shutdown(); + System.Console.Out.WriteLine("ok"); } public static void allTestsWithDeploy(Ice.Communicator communicator) { - Console.Out.Write("testing stringToProxy... "); - Console.Out.Flush(); - Ice.ObjectPrx @base = communicator.stringToProxy("test @ TestAdapter"); - test(@base != null); - Ice.ObjectPrx @base2 = communicator.stringToProxy("test"); - test(@base2 != null); - Console.Out.WriteLine("ok"); + Console.Out.Write("testing stringToProxy... "); + Console.Out.Flush(); + Ice.ObjectPrx @base = communicator.stringToProxy("test @ TestAdapter"); + test(@base != null); + Ice.ObjectPrx @base2 = communicator.stringToProxy("test"); + test(@base2 != null); + Console.Out.WriteLine("ok"); - Console.Out.Write("testing checked cast... "); - Console.Out.Flush(); - TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base); - test(obj != null); - test(obj.Equals(@base)); - TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(@base2); - test(obj2 != null); - test(obj2.Equals(@base2)); - Console.Out.WriteLine("ok"); - - Console.Out.Write("pinging server... "); - Console.Out.Flush(); - obj.ice_ping(); - obj2.ice_ping(); - Console.Out.WriteLine("ok"); + Console.Out.Write("testing checked cast... "); + Console.Out.Flush(); + TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base); + test(obj != null); + test(obj.Equals(@base)); + TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(@base2); + test(obj2 != null); + test(obj2.Equals(@base2)); + Console.Out.WriteLine("ok"); + + Console.Out.Write("pinging server... "); + Console.Out.Flush(); + obj.ice_ping(); + obj2.ice_ping(); + Console.Out.WriteLine("ok"); - Console.Out.Write("testing reference with unknown identity... "); - Console.Out.Flush(); - try - { - communicator.stringToProxy("unknown/unknown").ice_ping(); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - test(ex.kindOfObject.Equals("object")); - test(ex.id.Equals("unknown/unknown")); - } - Console.Out.WriteLine("ok"); + Console.Out.Write("testing reference with unknown identity... "); + Console.Out.Flush(); + try + { + communicator.stringToProxy("unknown/unknown").ice_ping(); + test(false); + } + catch(Ice.NotRegisteredException ex) + { + test(ex.kindOfObject.Equals("object")); + test(ex.id.Equals("unknown/unknown")); + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing reference with unknown adapter... "); - Console.Out.Flush(); - try - { - communicator.stringToProxy("test @ TestAdapterUnknown").ice_ping(); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - test(ex.kindOfObject.Equals("object adapter")); - test(ex.id.Equals("TestAdapterUnknown")); - } - Console.Out.WriteLine("ok"); + Console.Out.Write("testing reference with unknown adapter... "); + Console.Out.Flush(); + try + { + communicator.stringToProxy("test @ TestAdapterUnknown").ice_ping(); + test(false); + } + catch(Ice.NotRegisteredException ex) + { + test(ex.kindOfObject.Equals("object adapter")); + test(ex.id.Equals("TestAdapterUnknown")); + } + Console.Out.WriteLine("ok"); - IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast( - communicator.stringToProxy("IceGrid/Registry")); - test(registry != null); - IceGrid.AdminSessionPrx session = null; - try - { - session = registry.createAdminSession("foo", "bar"); - } - catch(IceGrid.PermissionDeniedException) - { - test(false); - } + IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast( + communicator.stringToProxy("IceGrid/Registry")); + test(registry != null); + IceGrid.AdminSessionPrx session = null; + try + { + session = registry.createAdminSession("foo", "bar"); + } + catch(IceGrid.PermissionDeniedException) + { + test(false); + } - SessionKeepAliveThread keepAlive = new SessionKeepAliveThread(session, registry.getSessionTimeout()/2); - Thread keepAliveThread = new Thread(new ThreadStart(keepAlive.run)); - keepAliveThread.Start(); + SessionKeepAliveThread keepAlive = new SessionKeepAliveThread(session, registry.getSessionTimeout()/2); + Thread keepAliveThread = new Thread(new ThreadStart(keepAlive.run)); + keepAliveThread.Start(); - IceGrid.AdminPrx admin = session.getAdmin(); - test(admin != null); + IceGrid.AdminPrx admin = session.getAdmin(); + test(admin != null); - try - { - admin.enableServer("server", false); - admin.stopServer("server"); - } - catch(IceGrid.ServerNotExistException) - { - test(false); - } - catch(IceGrid.ServerStopException) - { - test(false); - } - catch(IceGrid.NodeUnreachableException) - { - test(false); - } + try + { + admin.enableServer("server", false); + admin.stopServer("server"); + } + catch(IceGrid.ServerNotExistException) + { + test(false); + } + catch(IceGrid.ServerStopException) + { + test(false); + } + catch(IceGrid.NodeUnreachableException) + { + test(false); + } - Console.Out.Write("testing whether server is still reachable... "); - Console.Out.Flush(); - try - { - obj = TestIntfPrxHelper.checkedCast(@base); - test(false); - } - catch(Ice.NoEndpointException) - { - } - try - { - obj2 = TestIntfPrxHelper.checkedCast(@base2); - test(false); - } - catch(Ice.NoEndpointException) - { - } - - try - { - admin.enableServer("server", true); - } - catch(IceGrid.ServerNotExistException) - { - test(false); - } - catch(IceGrid.NodeUnreachableException) - { - test(false); - } + Console.Out.Write("testing whether server is still reachable... "); + Console.Out.Flush(); + try + { + obj = TestIntfPrxHelper.checkedCast(@base); + test(false); + } + catch(Ice.NoEndpointException) + { + } + try + { + obj2 = TestIntfPrxHelper.checkedCast(@base2); + test(false); + } + catch(Ice.NoEndpointException) + { + } + + try + { + admin.enableServer("server", true); + } + catch(IceGrid.ServerNotExistException) + { + test(false); + } + catch(IceGrid.NodeUnreachableException) + { + test(false); + } - try - { - obj = TestIntfPrxHelper.checkedCast(@base); - } - catch(Ice.NoEndpointException) - { - test(false); - } - try - { - obj2 = TestIntfPrxHelper.checkedCast(@base2); - } - catch(Ice.NoEndpointException) - { - test(false); - } - Console.Out.WriteLine("ok"); - - try - { - admin.stopServer("server"); - } - catch(IceGrid.ServerNotExistException) - { - test(false); - } - catch(IceGrid.ServerStopException) - { - test(false); - } - catch(IceGrid.NodeUnreachableException) - { - test(false); - } + try + { + obj = TestIntfPrxHelper.checkedCast(@base); + } + catch(Ice.NoEndpointException) + { + test(false); + } + try + { + obj2 = TestIntfPrxHelper.checkedCast(@base2); + } + catch(Ice.NoEndpointException) + { + test(false); + } + Console.Out.WriteLine("ok"); + + try + { + admin.stopServer("server"); + } + catch(IceGrid.ServerNotExistException) + { + test(false); + } + catch(IceGrid.ServerStopException) + { + test(false); + } + catch(IceGrid.NodeUnreachableException) + { + test(false); + } - keepAlive.terminate(); - keepAliveThread.Join(); - session.destroy(); + keepAlive.terminate(); + keepAliveThread.Join(); + session.destroy(); } } diff --git a/cs/test/IceGrid/simple/Client.cs b/cs/test/IceGrid/simple/Client.cs index 3f9288b5619..60ac9178368 100644 --- a/cs/test/IceGrid/simple/Client.cs +++ b/cs/test/IceGrid/simple/Client.cs @@ -14,26 +14,26 @@ public class Client private static int run(string[] args, Ice.Communicator communicator) { - bool withDeploy = false; - for(int i = 0; i < args.Length; i++) - { - if(args[i].Equals("--with-deploy")) - { - withDeploy = true; - break; - } - } + bool withDeploy = false; + for(int i = 0; i < args.Length; i++) + { + if(args[i].Equals("--with-deploy")) + { + withDeploy = true; + break; + } + } - if(!withDeploy) - { - AllTests.allTests(communicator); - } - else - { - AllTests.allTestsWithDeploy(communicator); - } + if(!withDeploy) + { + AllTests.allTests(communicator); + } + else + { + AllTests.allTestsWithDeploy(communicator); + } - return 0; + return 0; } public static void Main(string[] args) @@ -48,7 +48,7 @@ public class Client } catch (Ice.LocalException ex) { - System.Console.Error.WriteLine(ex); + System.Console.Error.WriteLine(ex); status = 1; } diff --git a/cs/test/IceGrid/simple/Server.cs b/cs/test/IceGrid/simple/Server.cs index 9ca43f9621e..06da761a3f9 100644 --- a/cs/test/IceGrid/simple/Server.cs +++ b/cs/test/IceGrid/simple/Server.cs @@ -11,25 +11,25 @@ public class Server : Ice.Application { public override int run(string[] args) { - args = communicator().getProperties().parseCommandLineOptions("TestAdapter", args); + args = communicator().getProperties().parseCommandLineOptions("TestAdapter", args); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new TestI(adapter), communicator().stringToIdentity("test")); - shutdownOnInterrupt(); - try - { - adapter.activate(); - } - catch(Ice.ObjectAdapterDeactivatedException) - { - } + shutdownOnInterrupt(); + try + { + adapter.activate(); + } + catch(Ice.ObjectAdapterDeactivatedException) + { + } communicator().waitForShutdown(); return 0; } public static void Main(string[] args) { - Server server = new Server(); - int status = server.main(args); + Server server = new Server(); + int status = server.main(args); if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/IceGrid/simple/run.py b/cs/test/IceGrid/simple/run.py index 976811c7958..94f40095a02 100755 --- a/cs/test/IceGrid/simple/run.py +++ b/cs/test/IceGrid/simple/run.py @@ -32,7 +32,7 @@ testdir = os.path.join(toplevel, "test", name) # Test client/server without on demand activation. # IceGridAdmin.iceGridClientServerTest(name, "", "--Ice.OA.TestAdapter.Endpoints=default" + \ - " --Ice.OA.TestAdapter.AdapterId=TestAdapter") + " --Ice.OA.TestAdapter.AdapterId=TestAdapter") # # Test client/server with on demand activation. diff --git a/cs/test/IceSSL/certs/makecerts.py b/cs/test/IceSSL/certs/makecerts.py index 316741597c9..cccd648711f 100755 --- a/cs/test/IceSSL/certs/makecerts.py +++ b/cs/test/IceSSL/certs/makecerts.py @@ -47,7 +47,7 @@ cppcerts = os.path.join(os.environ["ICE_HOME"], "test", "IceSSL", "certs") for x in ("cacert1.pem", "cacert2.pem"): if force or not os.path.exists(x): - shutil.copyfile(os.path.join(cppcerts, x), x) + shutil.copyfile(os.path.join(cppcerts, x), x) certs = [\ "c_rsa_nopass_ca1_exp", \ @@ -60,10 +60,10 @@ certs = [\ for x in certs: if force or not os.path.exists(x + ".pfx"): - cert = os.path.join(cppcerts, x) - os.system("openssl pkcs12 -in " + cert + "_pub.pem -inkey " + cert + "_priv.pem -export -out " + x + \ - ".pfx -passout pass:password") - print "Created " + x + ".pfx" + cert = os.path.join(cppcerts, x) + os.system("openssl pkcs12 -in " + cert + "_pub.pem -inkey " + cert + "_priv.pem -export -out " + x + \ + ".pfx -passout pass:password") + print "Created " + x + ".pfx" # # Done. diff --git a/cs/test/IceSSL/configuration/AllTests.cs b/cs/test/IceSSL/configuration/AllTests.cs index 48efcfde69b..4894ccba697 100755 --- a/cs/test/IceSSL/configuration/AllTests.cs +++ b/cs/test/IceSSL/configuration/AllTests.cs @@ -18,36 +18,36 @@ internal class CertificateVerifierI : IceSSL.CertificateVerifier { internal CertificateVerifierI() { - reset(); + reset(); } public bool verify(IceSSL.ConnectionInfo info) { - hadCert_ = info.certs != null; - invoked_ = true; - return returnValue_; + hadCert_ = info.certs != null; + invoked_ = true; + return returnValue_; } internal void reset() { - returnValue_ = true; - invoked_ = false; - hadCert_ = false; + returnValue_ = true; + invoked_ = false; + hadCert_ = false; } internal void returnValue(bool b) { - returnValue_ = b; + returnValue_ = b; } internal bool invoked() { - return invoked_; + return invoked_; } internal bool hadCert() { - return hadCert_; + return hadCert_; } private bool returnValue_; @@ -59,612 +59,612 @@ public class AllTests { private static void test(bool b) { - if (!b) - { - throw new Exception(); - } + if (!b) + { + throw new Exception(); + } } private static Ice.Properties createClientProps(string testDir, string defaultHost) { - Ice.Properties result = Ice.Util.createProperties(); - // - // TODO: - // - // When an application loads icesslcs.dll directly, as this one does, we - // must ensure that it uses the same DLL as the one loaded dynamically - // by Ice. - // - // When Mono supports .NET 2.0, we'll need to fix this. - // - result.setProperty("Ice.Plugin.IceSSL", testDir + "/../../../bin/icesslcs.dll:IceSSL.PluginFactory"); - result.setProperty("Ice.ThreadPerConnection", "1"); - if(defaultHost.Length > 0) - { - result.setProperty("Ice.Default.Host", defaultHost); - } - return result; + Ice.Properties result = Ice.Util.createProperties(); + // + // TODO: + // + // When an application loads icesslcs.dll directly, as this one does, we + // must ensure that it uses the same DLL as the one loaded dynamically + // by Ice. + // + // When Mono supports .NET 2.0, we'll need to fix this. + // + result.setProperty("Ice.Plugin.IceSSL", testDir + "/../../../bin/icesslcs.dll:IceSSL.PluginFactory"); + result.setProperty("Ice.ThreadPerConnection", "1"); + if(defaultHost.Length > 0) + { + result.setProperty("Ice.Default.Host", defaultHost); + } + return result; } private static Test.Properties createServerProps(string testDir, string defaultHost) { - Test.Properties result = new Test.Properties(); - result["Ice.Plugin.IceSSL"] = testDir + "/../../../bin/icesslcs.dll:IceSSL.PluginFactory"; - result["Ice.ThreadPerConnection"] = "1"; - if(defaultHost.Length > 0) - { - result["Ice.Default.Host"] = defaultHost; - } - return result; + Test.Properties result = new Test.Properties(); + result["Ice.Plugin.IceSSL"] = testDir + "/../../../bin/icesslcs.dll:IceSSL.PluginFactory"; + result["Ice.ThreadPerConnection"] = "1"; + if(defaultHost.Length > 0) + { + result["Ice.Default.Host"] = defaultHost; + } + return result; } public static void allTests(Ice.Communicator communicator, string testDir) { - string factoryRef = "factory:tcp -p 12010 -t 10000"; - Ice.ObjectPrx b = communicator.stringToProxy(factoryRef); - test(b != null); - Test.ServerFactoryPrx factory = Test.ServerFactoryPrxHelper.checkedCast(b); + string factoryRef = "factory:tcp -p 12010 -t 10000"; + Ice.ObjectPrx b = communicator.stringToProxy(factoryRef); + test(b != null); + Test.ServerFactoryPrx factory = Test.ServerFactoryPrxHelper.checkedCast(b); - string defaultHost = communicator.getProperties().getProperty("Ice.Default.Host"); - string defaultDir = testDir + "/../certs"; + string defaultHost = communicator.getProperties().getProperty("Ice.Default.Host"); + string defaultDir = testDir + "/../certs"; - // - // Load the CA certificates. We could use the IceSSL.ImportCert property, but - // it would be nice to remove the CA certificates when the test finishes, so - // this test manually installs the certificates in the LocalMachine:AuthRoot - // store. - // - // Note that the client and server are assumed to run on the same machine, - // so the certificates installed by the client are also available to the - // server. - // - string caCert1File = defaultDir + "/cacert1.pem"; - string caCert2File = defaultDir + "/cacert2.pem"; - X509Certificate2 caCert1 = new X509Certificate2(caCert1File); - X509Certificate2 caCert2 = new X509Certificate2(caCert2File); - X509Store store = new X509Store(StoreName.AuthRoot, StoreLocation.LocalMachine); - store.Open(OpenFlags.ReadWrite); + // + // Load the CA certificates. We could use the IceSSL.ImportCert property, but + // it would be nice to remove the CA certificates when the test finishes, so + // this test manually installs the certificates in the LocalMachine:AuthRoot + // store. + // + // Note that the client and server are assumed to run on the same machine, + // so the certificates installed by the client are also available to the + // server. + // + string caCert1File = defaultDir + "/cacert1.pem"; + string caCert2File = defaultDir + "/cacert2.pem"; + X509Certificate2 caCert1 = new X509Certificate2(caCert1File); + X509Certificate2 caCert2 = new X509Certificate2(caCert2File); + X509Store store = new X509Store(StoreName.AuthRoot, StoreLocation.LocalMachine); + store.Open(OpenFlags.ReadWrite); - try - { - string[] args = new string[0]; - Console.Out.Write("testing manual initialization... "); - Console.Out.Flush(); - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("Ice.InitPlugins", "0"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - Ice.ObjectPrx p = comm.stringToProxy("dummy:ssl -p 9999"); - try - { - p.ice_ping(); - test(false); - } - catch(Ice.PluginInitializationException) - { - // Expected. - } - catch(Ice.LocalException) - { - test(false); - } - comm.destroy(); - } - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("Ice.InitPlugins", "0"); - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); - initData.properties.setProperty("IceSSL.Password", "password"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - Ice.PluginManager pm = comm.getPluginManager(); - pm.initializePlugins(); - Ice.ObjectPrx obj = comm.stringToProxy(factoryRef); - test(obj != null); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(obj); - Test.Properties d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - store.Add(caCert1); - Test.ServerPrx server = fact.createServer(d); - try - { - server.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); - comm.destroy(); - } - { - // - // Supply our own certificate. - // - X509Certificate2 cert = new X509Certificate2(defaultDir + "/c_rsa_nopass_ca1.pfx", "password"); - X509Certificate2Collection coll = new X509Certificate2Collection(); - coll.Add(cert); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("Ice.InitPlugins", "0"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - Ice.PluginManager pm = comm.getPluginManager(); - IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL"); - test(plugin != null); - plugin.setCertificates(coll); - pm.initializePlugins(); - Ice.ObjectPrx obj = comm.stringToProxy(factoryRef); - test(obj != null); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(obj); - Test.Properties d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - store.Add(caCert1); - Test.ServerPrx server = fact.createServer(d); - try - { - server.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); - comm.destroy(); - } - Console.Out.WriteLine("ok"); + try + { + string[] args = new string[0]; + Console.Out.Write("testing manual initialization... "); + Console.Out.Flush(); + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("Ice.InitPlugins", "0"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + Ice.ObjectPrx p = comm.stringToProxy("dummy:ssl -p 9999"); + try + { + p.ice_ping(); + test(false); + } + catch(Ice.PluginInitializationException) + { + // Expected. + } + catch(Ice.LocalException) + { + test(false); + } + comm.destroy(); + } + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("Ice.InitPlugins", "0"); + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); + initData.properties.setProperty("IceSSL.Password", "password"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + Ice.PluginManager pm = comm.getPluginManager(); + pm.initializePlugins(); + Ice.ObjectPrx obj = comm.stringToProxy(factoryRef); + test(obj != null); + Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(obj); + Test.Properties d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + store.Add(caCert1); + Test.ServerPrx server = fact.createServer(d); + try + { + server.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); + comm.destroy(); + } + { + // + // Supply our own certificate. + // + X509Certificate2 cert = new X509Certificate2(defaultDir + "/c_rsa_nopass_ca1.pfx", "password"); + X509Certificate2Collection coll = new X509Certificate2Collection(); + coll.Add(cert); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("Ice.InitPlugins", "0"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + Ice.PluginManager pm = comm.getPluginManager(); + IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL"); + test(plugin != null); + plugin.setCertificates(coll); + pm.initializePlugins(); + Ice.ObjectPrx obj = comm.stringToProxy(factoryRef); + test(obj != null); + Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(obj); + Test.Properties d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + store.Add(caCert1); + Test.ServerPrx server = fact.createServer(d); + try + { + server.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); + comm.destroy(); + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing certificate verification... "); - Console.Out.Flush(); - { - // - // Test IceSSL.VerifyPeer=1. Client does not have a certificate. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - Test.Properties d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "1"; - store.Add(caCert1); - Test.ServerPrx server = fact.createServer(d); - try - { - server.noCert(); - } - catch(Ice.LocalException) - { - test(false); - } - // - // Validate that we can get the connection info. - // - try - { - IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(server.ice_getConnection()); - test(info.certs != null); - } - catch(IceSSL.ConnectionInvalidException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); + Console.Out.Write("testing certificate verification... "); + Console.Out.Flush(); + { + // + // Test IceSSL.VerifyPeer=1. Client does not have a certificate. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + Test.Properties d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "1"; + store.Add(caCert1); + Test.ServerPrx server = fact.createServer(d); + try + { + server.noCert(); + } + catch(Ice.LocalException) + { + test(false); + } + // + // Validate that we can get the connection info. + // + try + { + IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(server.ice_getConnection()); + test(info.certs != null); + } + catch(IceSSL.ConnectionInvalidException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); - // - // Test IceSSL.VerifyPeer=2. This should fail because the client - // does not supply a certificate. - // - d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - store.Add(caCert1); - server = fact.createServer(d); - try - { - server.ice_ping(); - test(false); - } - catch(Ice.ConnectionLostException) - { - // Expected. - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); + // + // Test IceSSL.VerifyPeer=2. This should fail because the client + // does not supply a certificate. + // + d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + store.Add(caCert1); + server = fact.createServer(d); + try + { + server.ice_ping(); + test(false); + } + catch(Ice.ConnectionLostException) + { + // Expected. + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); - comm.destroy(); + comm.destroy(); - // - // Test IceSSL.VerifyPeer=1. Client has a certificate. - // - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); - initData.properties.setProperty("IceSSL.Password", "password"); - comm = Ice.Util.initialize(ref args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "1"; - store.Add(caCert1); - server = fact.createServer(d); - try - { - X509Certificate2 clientCert = - new X509Certificate2(defaultDir + "/c_rsa_nopass_ca1.pfx", "password"); - server.checkCert(clientCert.Subject, clientCert.Issuer); + // + // Test IceSSL.VerifyPeer=1. Client has a certificate. + // + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); + initData.properties.setProperty("IceSSL.Password", "password"); + comm = Ice.Util.initialize(ref args, initData); + fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "1"; + store.Add(caCert1); + server = fact.createServer(d); + try + { + X509Certificate2 clientCert = + new X509Certificate2(defaultDir + "/c_rsa_nopass_ca1.pfx", "password"); + server.checkCert(clientCert.Subject, clientCert.Issuer); - X509Certificate2 serverCert = - new X509Certificate2(defaultDir + "/s_rsa_nopass_ca1.pfx", "password"); - X509Certificate2 caCert = new X509Certificate2(defaultDir + "/cacert1.pem"); + X509Certificate2 serverCert = + new X509Certificate2(defaultDir + "/s_rsa_nopass_ca1.pfx", "password"); + X509Certificate2 caCert = new X509Certificate2(defaultDir + "/cacert1.pem"); - IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(server.ice_getConnection()); + IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(server.ice_getConnection()); - test(caCert.Equals(info.certs[1])); - test(serverCert.Equals(info.certs[0])); - } - catch(Exception) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); + test(caCert.Equals(info.certs[1])); + test(serverCert.Equals(info.certs[0])); + } + catch(Exception) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); - // - // Test IceSSL.VerifyPeer=2. Client has a certificate. - // - d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - store.Add(caCert1); - server = fact.createServer(d); - try - { - X509Certificate2 clientCert = - new X509Certificate2(defaultDir + "/c_rsa_nopass_ca1.pfx", "password"); - server.checkCert(clientCert.Subject, clientCert.Issuer); - } - catch(Exception) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); + // + // Test IceSSL.VerifyPeer=2. Client has a certificate. + // + d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + store.Add(caCert1); + server = fact.createServer(d); + try + { + X509Certificate2 clientCert = + new X509Certificate2(defaultDir + "/c_rsa_nopass_ca1.pfx", "password"); + server.checkCert(clientCert.Subject, clientCert.Issuer); + } + catch(Exception) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); - comm.destroy(); + comm.destroy(); - // - // Test IceSSL.VerifyPeer=1. This should fail because the - // client doesn't trust the server's CA. - // - initData.properties = createClientProps(testDir, defaultHost); - comm = Ice.Util.initialize(ref args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "1"; - // Don't add the CA certificate. - //store.Add(caCert1); - server = fact.createServer(d); - try - { - server.ice_ping(); - test(false); - } - catch(Ice.SecurityException) - { - // Expected. - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - comm.destroy(); + // + // Test IceSSL.VerifyPeer=1. This should fail because the + // client doesn't trust the server's CA. + // + initData.properties = createClientProps(testDir, defaultHost); + comm = Ice.Util.initialize(ref args, initData); + fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "1"; + // Don't add the CA certificate. + //store.Add(caCert1); + server = fact.createServer(d); + try + { + server.ice_ping(); + test(false); + } + catch(Ice.SecurityException) + { + // Expected. + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + comm.destroy(); - // - // Verify that IceSSL.CheckCertName has no effect in a server. - // - initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); - initData.properties.setProperty("IceSSL.Password", "password"); - comm = Ice.Util.initialize(ref args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.CheckCertName"] = "1"; - store.Add(caCert1); - server = fact.createServer(d); - try - { - server.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); - comm.destroy(); - } - Console.Out.WriteLine("ok"); + // + // Verify that IceSSL.CheckCertName has no effect in a server. + // + initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); + initData.properties.setProperty("IceSSL.Password", "password"); + comm = Ice.Util.initialize(ref args, initData); + fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.CheckCertName"] = "1"; + store.Add(caCert1); + server = fact.createServer(d); + try + { + server.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); + comm.destroy(); + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing custom certificate verifier... "); - Console.Out.Flush(); - { - // - // Verify that a server certificate is present. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); - initData.properties.setProperty("IceSSL.Password", "password"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL"); - test(plugin != null); - CertificateVerifierI verifier = new CertificateVerifierI(); - plugin.setCertificateVerifier(verifier); + Console.Out.Write("testing custom certificate verifier... "); + Console.Out.Flush(); + { + // + // Verify that a server certificate is present. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); + initData.properties.setProperty("IceSSL.Password", "password"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL"); + test(plugin != null); + CertificateVerifierI verifier = new CertificateVerifierI(); + plugin.setCertificateVerifier(verifier); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - Test.Properties d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - store.Add(caCert1); - Test.ServerPrx server = fact.createServer(d); - try - { - IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(server.ice_getConnection()); - server.checkCipher(info.cipher); - } - catch(Ice.LocalException) - { - test(false); - } - test(verifier.invoked()); - test(verifier.hadCert()); + Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + Test.Properties d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + store.Add(caCert1); + Test.ServerPrx server = fact.createServer(d); + try + { + IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(server.ice_getConnection()); + server.checkCipher(info.cipher); + } + catch(Ice.LocalException) + { + test(false); + } + test(verifier.invoked()); + test(verifier.hadCert()); - // - // Have the verifier return false. Close the connection explicitly - // to force a new connection to be established. - // - verifier.reset(); - verifier.returnValue(false); - server.ice_getConnection().close(false); - try - { - server.ice_ping(); - test(false); - } - catch(Ice.SecurityException) - { - // Expected. - } - catch(Ice.LocalException) - { - test(false); - } - test(verifier.invoked()); - test(verifier.hadCert()); - fact.destroyServer(server); - store.Remove(caCert1); + // + // Have the verifier return false. Close the connection explicitly + // to force a new connection to be established. + // + verifier.reset(); + verifier.returnValue(false); + server.ice_getConnection().close(false); + try + { + server.ice_ping(); + test(false); + } + catch(Ice.SecurityException) + { + // Expected. + } + catch(Ice.LocalException) + { + test(false); + } + test(verifier.invoked()); + test(verifier.hadCert()); + fact.destroyServer(server); + store.Remove(caCert1); - comm.destroy(); - } - Console.Out.WriteLine("ok"); + comm.destroy(); + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing protocols... "); - Console.Out.Flush(); - { - // - // This should fail because the client and server have no protocol - // in common. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); - initData.properties.setProperty("IceSSL.Password", "password"); - initData.properties.setProperty("IceSSL.Protocols", "ssl3"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - Test.Properties d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - d["IceSSL.Protocols"] = "tls1"; - store.Add(caCert1); - Test.ServerPrx server = fact.createServer(d); - try - { - server.ice_ping(); - test(false); - } - catch(Ice.ConnectionLostException) - { - // Expected. - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); - comm.destroy(); + Console.Out.Write("testing protocols... "); + Console.Out.Flush(); + { + // + // This should fail because the client and server have no protocol + // in common. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); + initData.properties.setProperty("IceSSL.Password", "password"); + initData.properties.setProperty("IceSSL.Protocols", "ssl3"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + Test.Properties d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + d["IceSSL.Protocols"] = "tls1"; + store.Add(caCert1); + Test.ServerPrx server = fact.createServer(d); + try + { + server.ice_ping(); + test(false); + } + catch(Ice.ConnectionLostException) + { + // Expected. + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); + comm.destroy(); - // - // This should succeed. - // - comm = Ice.Util.initialize(ref args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - d["IceSSL.Protocols"] = "tls1, ssl3"; - store.Add(caCert1); - server = fact.createServer(d); - try - { - server.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); - comm.destroy(); - } - Console.Out.WriteLine("ok"); + // + // This should succeed. + // + comm = Ice.Util.initialize(ref args, initData); + fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + d["IceSSL.Protocols"] = "tls1, ssl3"; + store.Add(caCert1); + server = fact.createServer(d); + try + { + server.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); + comm.destroy(); + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing expired certificates... "); - Console.Out.Flush(); - { - // - // This should fail because the server's certificate is expired. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); - initData.properties.setProperty("IceSSL.Password", "password"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - Test.Properties d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1_exp.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - store.Add(caCert1); - Test.ServerPrx server = fact.createServer(d); - try - { - server.ice_ping(); - test(false); - } - catch(Ice.SecurityException) - { - // Expected. - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); - comm.destroy(); + Console.Out.Write("testing expired certificates... "); + Console.Out.Flush(); + { + // + // This should fail because the server's certificate is expired. + // + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); + initData.properties.setProperty("IceSSL.Password", "password"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + Test.Properties d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1_exp.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + store.Add(caCert1); + Test.ServerPrx server = fact.createServer(d); + try + { + server.ice_ping(); + test(false); + } + catch(Ice.SecurityException) + { + // Expected. + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); + comm.destroy(); - // - // This should fail because the client's certificate is expired. - // - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1_exp.pfx"); - initData.properties.setProperty("IceSSL.Password", "password"); - comm = Ice.Util.initialize(ref args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - store.Add(caCert1); - server = fact.createServer(d); - try - { - server.ice_ping(); - test(false); - } - catch(Ice.ConnectionLostException) - { - // Expected. - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); - comm.destroy(); - } - Console.Out.WriteLine("ok"); + // + // This should fail because the client's certificate is expired. + // + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1_exp.pfx"); + initData.properties.setProperty("IceSSL.Password", "password"); + comm = Ice.Util.initialize(ref args, initData); + fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + store.Add(caCert1); + server = fact.createServer(d); + try + { + server.ice_ping(); + test(false); + } + catch(Ice.ConnectionLostException) + { + // Expected. + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); + comm.destroy(); + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing multiple CA certificates... "); - Console.Out.Flush(); - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); - initData.properties.setProperty("IceSSL.Password", "password"); - Ice.Communicator comm = Ice.Util.initialize(ref args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); - test(fact != null); - Test.Properties d = createServerProps(testDir, defaultHost); - d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca2.pfx"; - d["IceSSL.Password"] = "password"; - d["IceSSL.VerifyPeer"] = "2"; - store.Add(caCert1); - store.Add(caCert2); - Test.ServerPrx server = fact.createServer(d); - try - { - server.ice_ping(); - } - catch(Ice.LocalException) - { - test(false); - } - fact.destroyServer(server); - store.Remove(caCert1); - store.Remove(caCert2); - comm.destroy(); - } - Console.Out.WriteLine("ok"); + Console.Out.Write("testing multiple CA certificates... "); + Console.Out.Flush(); + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); + initData.properties.setProperty("IceSSL.Password", "password"); + Ice.Communicator comm = Ice.Util.initialize(ref args, initData); + Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + test(fact != null); + Test.Properties d = createServerProps(testDir, defaultHost); + d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca2.pfx"; + d["IceSSL.Password"] = "password"; + d["IceSSL.VerifyPeer"] = "2"; + store.Add(caCert1); + store.Add(caCert2); + Test.ServerPrx server = fact.createServer(d); + try + { + server.ice_ping(); + } + catch(Ice.LocalException) + { + test(false); + } + fact.destroyServer(server); + store.Remove(caCert1); + store.Remove(caCert2); + comm.destroy(); + } + Console.Out.WriteLine("ok"); - Console.Out.Write("testing password failure... "); - Console.Out.Flush(); - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = createClientProps(testDir, defaultHost); - initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); - // Don't specify the password. - //props.setProperty("IceSSL.Password", "password"); - try - { - Ice.Util.initialize(ref args, initData); - test(false); - } - catch(Ice.PluginInitializationException) - { - // Expected. - } - catch(Ice.LocalException) - { - test(false); - } - } - Console.Out.WriteLine("ok"); + Console.Out.Write("testing password failure... "); + Console.Out.Flush(); + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = createClientProps(testDir, defaultHost); + initData.properties.setProperty("IceSSL.CertFile", defaultDir + "/c_rsa_nopass_ca1.pfx"); + // Don't specify the password. + //props.setProperty("IceSSL.Password", "password"); + try + { + Ice.Util.initialize(ref args, initData); + test(false); + } + catch(Ice.PluginInitializationException) + { + // Expected. + } + catch(Ice.LocalException) + { + test(false); + } + } + Console.Out.WriteLine("ok"); Console.Out.Write("testing IceSSL.TrustOnly... "); Console.Out.Flush(); @@ -746,7 +746,7 @@ public class AllTests d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; d["IceSSL.Password"] = "password"; d["IceSSL.TrustOnly"] = - "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"; + "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"; store.Add(caCert1); Test.ServerPrx server = fact.createServer(d); try @@ -963,7 +963,7 @@ public class AllTests d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; d["IceSSL.Password"] = "password"; d["IceSSL.TrustOnly.Client"] = - "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Server"; + "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Server"; store.Add(caCert1); Test.ServerPrx server = fact.createServer(d); try @@ -1030,7 +1030,7 @@ public class AllTests d["IceSSL.CertFile"] = defaultDir + "/s_rsa_nopass_ca1.pfx"; d["IceSSL.Password"] = "password"; d["IceSSL.TrustOnly.Server"] = - "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"; + "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"; store.Add(caCert1); Test.ServerPrx server = fact.createServer(d); try @@ -1096,7 +1096,7 @@ public class AllTests d["IceSSL.Password"] = "password"; d["IceSSL.TrustOnly.Server"] = "CN=bogus"; d["IceSSL.TrustOnly.Server.ServerAdapter"] = - "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"; + "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"; store.Add(caCert1); Test.ServerPrx server = fact.createServer(d); try @@ -1142,14 +1142,14 @@ public class AllTests comm.destroy(); } Console.Out.WriteLine("ok"); - } - finally - { - store.Remove(caCert1); - store.Remove(caCert2); - store.Close(); - } + } + finally + { + store.Remove(caCert1); + store.Remove(caCert2); + store.Close(); + } - factory.shutdown(); + factory.shutdown(); } } diff --git a/cs/test/IceSSL/configuration/Client.cs b/cs/test/IceSSL/configuration/Client.cs index 8e54afb2966..29e9b6f3915 100755 --- a/cs/test/IceSSL/configuration/Client.cs +++ b/cs/test/IceSSL/configuration/Client.cs @@ -13,46 +13,46 @@ public class Client { private static int run(String[] args, Ice.Communicator communicator) { - if(args.Length < 1) - { - Console.Error.WriteLine("Usage: client testdir"); - return 1; - } + if(args.Length < 1) + { + Console.Error.WriteLine("Usage: client testdir"); + return 1; + } - AllTests.allTests(communicator, args[0]); - - return 0; + AllTests.allTests(communicator, args[0]); + + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - 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; - } - } - + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + 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; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/IceSSL/configuration/Server.cs b/cs/test/IceSSL/configuration/Server.cs index 4854873ef0e..2f80a64f334 100755 --- a/cs/test/IceSSL/configuration/Server.cs +++ b/cs/test/IceSSL/configuration/Server.cs @@ -13,45 +13,45 @@ public class Server { private static int run(string[] args, Ice.Communicator communicator) { - communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "tcp -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Identity id = communicator.stringToIdentity("factory"); - adapter.add(new ServerFactoryI(), id); - adapter.activate(); + communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "tcp -p 12010"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Identity id = communicator.stringToIdentity("factory"); + adapter.add(new ServerFactoryI(), id); + adapter.activate(); - communicator.waitForShutdown(); - return 0; + communicator.waitForShutdown(); + return 0; } public static void Main(string[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(ref args); - status = run(args, communicator); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - Console.Error.WriteLine(ex); - status = 1; - } - } - + int status = 0; + Ice.Communicator communicator = null; + + try + { + communicator = Ice.Util.initialize(ref args); + status = run(args, communicator); + } + catch(Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + + if(communicator != null) + { + try + { + communicator.destroy(); + } + catch(Ice.LocalException ex) + { + Console.Error.WriteLine(ex); + status = 1; + } + } + if(status != 0) { System.Environment.Exit(status); diff --git a/cs/test/IceSSL/configuration/TestI.cs b/cs/test/IceSSL/configuration/TestI.cs index 2cc2f3e6ed9..d1761e4000b 100755 --- a/cs/test/IceSSL/configuration/TestI.cs +++ b/cs/test/IceSSL/configuration/TestI.cs @@ -15,64 +15,64 @@ internal sealed class ServerI : ServerDisp_ { internal ServerI(Ice.Communicator communicator) { - communicator_ = communicator; + communicator_ = communicator; } public override void noCert(Ice.Current current) { - try - { - IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(current.con); - test(info.certs == null); - } - catch(IceSSL.ConnectionInvalidException) - { - test(false); - } + try + { + IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(current.con); + test(info.certs == null); + } + catch(IceSSL.ConnectionInvalidException) + { + test(false); + } } public override void checkCert(string subjectDN, string issuerDN, Ice.Current current) { - try - { - IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(current.con); - test(info.certs.Length == 2 && - info.certs[0].Subject.Equals(subjectDN) && - info.certs[0].Issuer.Equals(issuerDN)); - } - catch(IceSSL.ConnectionInvalidException) - { - test(false); - } + try + { + IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(current.con); + test(info.certs.Length == 2 && + info.certs[0].Subject.Equals(subjectDN) && + info.certs[0].Issuer.Equals(issuerDN)); + } + catch(IceSSL.ConnectionInvalidException) + { + test(false); + } } public override void checkCipher(string cipher, Ice.Current current) { - try - { - IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(current.con); - test(info.cipher.Equals(cipher)); - } - catch(IceSSL.ConnectionInvalidException) - { - test(false); - } + try + { + IceSSL.ConnectionInfo info = IceSSL.Util.getConnectionInfo(current.con); + test(info.cipher.Equals(cipher)); + } + catch(IceSSL.ConnectionInvalidException) + { + test(false); + } } internal void destroy() { - communicator_.destroy(); + communicator_.destroy(); } private static void test(bool b) { - if (!b) - { - throw new Exception(); - } + if (!b) + { + throw new Exception(); + } } private Ice.Communicator communicator_; @@ -82,47 +82,47 @@ internal sealed class ServerFactoryI : ServerFactoryDisp_ { private static void test(bool b) { - if (!b) - { - throw new Exception(); - } + if (!b) + { + throw new Exception(); + } } public override ServerPrx createServer(Properties props, Ice.Current current) { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(); - foreach(string key in props.Keys) - { - initData.properties.setProperty(key, props[key]); - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(); + foreach(string key in props.Keys) + { + initData.properties.setProperty(key, props[key]); + } - string[] args = new string[0]; - Ice.Communicator communicator = Ice.Util.initialize(ref args, initData); - Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("ServerAdapter", "ssl"); - ServerI server = new ServerI(communicator); - Ice.ObjectPrx obj = adapter.addWithUUID(server); - servers_[obj.ice_getIdentity()] = server; - adapter.activate(); + string[] args = new string[0]; + Ice.Communicator communicator = Ice.Util.initialize(ref args, initData); + Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("ServerAdapter", "ssl"); + ServerI server = new ServerI(communicator); + Ice.ObjectPrx obj = adapter.addWithUUID(server); + servers_[obj.ice_getIdentity()] = server; + adapter.activate(); - return ServerPrxHelper.uncheckedCast(obj); + return ServerPrxHelper.uncheckedCast(obj); } public override void destroyServer(ServerPrx srv, Ice.Current current) { - Ice.Identity key = srv.ice_getIdentity(); - if(servers_.Contains(key)) - { - ServerI server = servers_[key] as ServerI; - server.destroy(); - servers_.Remove(key); - } + Ice.Identity key = srv.ice_getIdentity(); + if(servers_.Contains(key)) + { + ServerI server = servers_[key] as ServerI; + server.destroy(); + servers_.Remove(key); + } } public override void shutdown(Ice.Current current) { - test(servers_.Count == 0); - current.adapter.getCommunicator().shutdown(); + test(servers_.Count == 0); + current.adapter.getCommunicator().shutdown(); } private Hashtable servers_ = new Hashtable(); diff --git a/cs/test/IceUtil/inputUtil/Client.cs b/cs/test/IceUtil/inputUtil/Client.cs index 3d34169b3e2..f24815fcc2e 100755 --- a/cs/test/IceUtil/inputUtil/Client.cs +++ b/cs/test/IceUtil/inputUtil/Client.cs @@ -13,96 +13,96 @@ public class Client { private static void test(bool b) { - if (!b) - { - throw new Exception(); - } + if (!b) + { + throw new Exception(); + } } public static void Main(string[] argvs) { System.Console.Out.Write("testing string to command line arguments... "); System.Console.Out.Flush(); - string[] args; + string[] args; - try - { - test(IceUtil.Options.split("").Length == 0); - - args = IceUtil.Options.split("\"\""); - test(args.Length == 1 && args[0].Equals("")); - args = IceUtil.Options.split("''"); - test(args.Length == 1 && args[0].Equals("")); - args = IceUtil.Options.split("$''"); - test(args.Length == 1 && args[0].Equals("")); + try + { + test(IceUtil.Options.split("").Length == 0); + + args = IceUtil.Options.split("\"\""); + test(args.Length == 1 && args[0].Equals("")); + args = IceUtil.Options.split("''"); + test(args.Length == 1 && args[0].Equals("")); + args = IceUtil.Options.split("$''"); + test(args.Length == 1 && args[0].Equals("")); - args = IceUtil.Options.split("-a -b -c"); - test(args.Length == 3 && args[0].Equals("-a") && args[1].Equals("-b") && args[2].Equals("-c")); - args = IceUtil.Options.split("\"-a\" '-b' $'-c'"); - test(args.Length == 3 && args[0].Equals("-a") && args[1].Equals("-b") && args[2].Equals("-c")); - args = IceUtil.Options.split(" '-b' \"-a\" $'-c' "); - test(args.Length == 3 && args[0].Equals("-b") && args[1].Equals("-a") && args[2].Equals("-c")); - args = IceUtil.Options.split(" $'-c' '-b' \"-a\" "); - test(args.Length == 3 && args[0].Equals("-c") && args[1].Equals("-b") && args[2].Equals("-a")); + args = IceUtil.Options.split("-a -b -c"); + test(args.Length == 3 && args[0].Equals("-a") && args[1].Equals("-b") && args[2].Equals("-c")); + args = IceUtil.Options.split("\"-a\" '-b' $'-c'"); + test(args.Length == 3 && args[0].Equals("-a") && args[1].Equals("-b") && args[2].Equals("-c")); + args = IceUtil.Options.split(" '-b' \"-a\" $'-c' "); + test(args.Length == 3 && args[0].Equals("-b") && args[1].Equals("-a") && args[2].Equals("-c")); + args = IceUtil.Options.split(" $'-c' '-b' \"-a\" "); + test(args.Length == 3 && args[0].Equals("-c") && args[1].Equals("-b") && args[2].Equals("-a")); - // Testing single quote - args = IceUtil.Options.split("-Dir='C:\\\\test\\\\file'"); // -Dir='C:\\test\\file' - test(args.Length == 1 && args[0].Equals("-Dir=C:\\\\test\\\\file")); // -Dir=C:\\test\\file - args = IceUtil.Options.split("-Dir='C:\\test\\file'"); // -Dir='C:\test\file' - test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file - args = IceUtil.Options.split("-Dir='C:\\test\\filewith\"quote'"); // -Dir='C:\test\filewith"quote' - test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\filewith\"quote")); // -Dir=C:\test\filewith"quote + // Testing single quote + args = IceUtil.Options.split("-Dir='C:\\\\test\\\\file'"); // -Dir='C:\\test\\file' + test(args.Length == 1 && args[0].Equals("-Dir=C:\\\\test\\\\file")); // -Dir=C:\\test\\file + args = IceUtil.Options.split("-Dir='C:\\test\\file'"); // -Dir='C:\test\file' + test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file + args = IceUtil.Options.split("-Dir='C:\\test\\filewith\"quote'"); // -Dir='C:\test\filewith"quote' + test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\filewith\"quote")); // -Dir=C:\test\filewith"quote - // Testing double quote - args = IceUtil.Options.split("-Dir=\"C:\\\\test\\\\file\""); // -Dir="C:\\test\\file" - test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file - args = IceUtil.Options.split("-Dir=\"C:\\test\\file\""); // -Dir="C:\test\file" - test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file - args = IceUtil.Options.split("-Dir=\"C:\\test\\filewith\\\"quote\""); // -Dir="C:\test\filewith\"quote" - test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\filewith\"quote")); // -Dir=C:\test\filewith"quote + // Testing double quote + args = IceUtil.Options.split("-Dir=\"C:\\\\test\\\\file\""); // -Dir="C:\\test\\file" + test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file + args = IceUtil.Options.split("-Dir=\"C:\\test\\file\""); // -Dir="C:\test\file" + test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file + args = IceUtil.Options.split("-Dir=\"C:\\test\\filewith\\\"quote\""); // -Dir="C:\test\filewith\"quote" + test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\filewith\"quote")); // -Dir=C:\test\filewith"quote - // Testing ANSI quote - args = IceUtil.Options.split("-Dir=$'C:\\\\test\\\\file'"); // -Dir=$'C:\\test\\file' - test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file - args = IceUtil.Options.split("-Dir=$'C:\\oest\\oile'"); // -Dir='C:\oest\oile' - test(args.Length == 1 && args[0].Equals("-Dir=C:\\oest\\oile")); // -Dir=C:\oest\oile - args = IceUtil.Options.split("-Dir=$'C:\\oest\\oilewith\"quote'"); // -Dir=$'C:\oest\oilewith"quote' - test(args.Length == 1 && args[0].Equals("-Dir=C:\\oest\\oilewith\"quote")); // -Dir=C:\oest\oilewith"quote - args = IceUtil.Options.split("-Dir=$'\\103\\072\\134\\164\\145\\163\\164\\134\\146\\151\\154\\145'"); - test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file - args = IceUtil.Options.split("-Dir=$'\\x43\\x3A\\x5C\\x74\\x65\\x73\\x74\\x5C\\x66\\x69\\x6C\\x65'"); - test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file - args = IceUtil.Options.split("-Dir=$'\\cM\\c_'"); // Control characters - test(args.Length == 1 && args[0].Equals("-Dir=\x0D\x1F")); - args = IceUtil.Options.split("-Dir=$'C:\\\\\\146\\x66\\cMi'"); // -Dir=$'C:\\\146\x66i\cMi' - test(args.Length == 1 && args[0].Equals("-Dir=C:\\ff\x0Di")); - args = IceUtil.Options.split("-Dir=$'C:\\\\\\cM\\x66\\146i'"); // -Dir=$'C:\\\cM\x66\146i' - test(args.Length == 1 && args[0].Equals("-Dir=C:\\\x000Dffi")); - } - catch(IceUtil.Options.BadQuote) - { - test(false); - } + // Testing ANSI quote + args = IceUtil.Options.split("-Dir=$'C:\\\\test\\\\file'"); // -Dir=$'C:\\test\\file' + test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file + args = IceUtil.Options.split("-Dir=$'C:\\oest\\oile'"); // -Dir='C:\oest\oile' + test(args.Length == 1 && args[0].Equals("-Dir=C:\\oest\\oile")); // -Dir=C:\oest\oile + args = IceUtil.Options.split("-Dir=$'C:\\oest\\oilewith\"quote'"); // -Dir=$'C:\oest\oilewith"quote' + test(args.Length == 1 && args[0].Equals("-Dir=C:\\oest\\oilewith\"quote")); // -Dir=C:\oest\oilewith"quote + args = IceUtil.Options.split("-Dir=$'\\103\\072\\134\\164\\145\\163\\164\\134\\146\\151\\154\\145'"); + test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file + args = IceUtil.Options.split("-Dir=$'\\x43\\x3A\\x5C\\x74\\x65\\x73\\x74\\x5C\\x66\\x69\\x6C\\x65'"); + test(args.Length == 1 && args[0].Equals("-Dir=C:\\test\\file")); // -Dir=C:\test\file + args = IceUtil.Options.split("-Dir=$'\\cM\\c_'"); // Control characters + test(args.Length == 1 && args[0].Equals("-Dir=\x0D\x1F")); + args = IceUtil.Options.split("-Dir=$'C:\\\\\\146\\x66\\cMi'"); // -Dir=$'C:\\\146\x66i\cMi' + test(args.Length == 1 && args[0].Equals("-Dir=C:\\ff\x0Di")); + args = IceUtil.Options.split("-Dir=$'C:\\\\\\cM\\x66\\146i'"); // -Dir=$'C:\\\cM\x66\146i' + test(args.Length == 1 && args[0].Equals("-Dir=C:\\\x000Dffi")); + } + catch(IceUtil.Options.BadQuote) + { + test(false); + } - string[] badQuoteCommands = new string[6]; - badQuoteCommands[0] = "\""; - badQuoteCommands[1] = "'"; - badQuoteCommands[2] = "\\$'"; - badQuoteCommands[3] = "-Dir=\"test"; - badQuoteCommands[4] = "-Dir='test"; - badQuoteCommands[5] = "-Dir=$'test"; - for(int i = 0; i < 6; ++i) - { - try - { - IceUtil.Options.split(badQuoteCommands[i]); - test(false); - } - catch(IceUtil.Options.BadQuote) - { - } - } + string[] badQuoteCommands = new string[6]; + badQuoteCommands[0] = "\""; + badQuoteCommands[1] = "'"; + badQuoteCommands[2] = "\\$'"; + badQuoteCommands[3] = "-Dir=\"test"; + badQuoteCommands[4] = "-Dir='test"; + badQuoteCommands[5] = "-Dir=$'test"; + for(int i = 0; i < 6; ++i) + { + try + { + IceUtil.Options.split(badQuoteCommands[i]); + test(false); + } + catch(IceUtil.Options.BadQuote) + { + } + } - System.Console.Out.WriteLine("ok"); + System.Console.Out.WriteLine("ok"); } } |