summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2008-02-08 16:57:37 -0800
committerMark Spruiell <mes@zeroc.com>2008-02-08 16:57:37 -0800
commite754cd9f687138f7d58b477718bf061801f68d95 (patch)
tree1ee35e6203ca8538bb30311d8e987eec56b205d3
parentcleaning up enum mapping (diff)
downloadice-e754cd9f687138f7d58b477718bf061801f68d95.tar.bz2
ice-e754cd9f687138f7d58b477718bf061801f68d95.tar.xz
ice-e754cd9f687138f7d58b477718bf061801f68d95.zip
bug 1960 - empty application name in Windows Firewall list
-rw-r--r--cs/demo/Glacier2/callback/Client.cs360
-rw-r--r--cs/demo/Glacier2/callback/Server.cs35
-rw-r--r--cs/demo/Glacier2/callback/SessionServer.cs52
-rw-r--r--cs/demo/Ice/async/Client.cs162
-rw-r--r--cs/demo/Ice/async/Server.cs58
-rw-r--r--cs/demo/Ice/bidir/Client.cs61
-rw-r--r--cs/demo/Ice/bidir/Server.cs57
-rw-r--r--cs/demo/Ice/callback/Client.cs282
-rw-r--r--cs/demo/Ice/callback/Server.cs35
-rw-r--r--cs/demo/Ice/hello/Client.cs320
-rw-r--r--cs/demo/Ice/hello/Server.cs36
-rw-r--r--cs/demo/Ice/invoke/Client.cs467
-rw-r--r--cs/demo/Ice/invoke/Server.cs35
-rw-r--r--cs/demo/Ice/latency/Client.cs97
-rw-r--r--cs/demo/Ice/latency/Server.cs37
-rw-r--r--cs/demo/Ice/minimal/Client.cs9
-rw-r--r--cs/demo/Ice/minimal/Server.cs7
-rw-r--r--cs/demo/Ice/multicast/Client.cs67
-rw-r--r--cs/demo/Ice/multicast/Server.cs43
-rw-r--r--cs/demo/Ice/nested/Client.cs108
-rw-r--r--cs/demo/Ice/nested/Server.cs39
-rw-r--r--cs/demo/Ice/session/Client.cs316
-rw-r--r--cs/demo/Ice/session/Server.cs46
-rw-r--r--cs/demo/Ice/throughput/Client.cs693
-rw-r--r--cs/demo/Ice/throughput/Server.cs37
-rw-r--r--cs/demo/Ice/value/Client.cs290
-rw-r--r--cs/demo/Ice/value/Server.cs40
-rw-r--r--cs/demo/IceBox/hello/Client.cs252
-rw-r--r--cs/demo/IceGrid/icebox/Client.cs42
-rw-r--r--cs/demo/IceGrid/simple/Client.cs146
-rw-r--r--cs/demo/IceGrid/simple/Server.cs40
-rw-r--r--cs/demo/IceStorm/clock/Publisher.cs186
-rw-r--r--cs/demo/IceStorm/clock/Subscriber.cs254
-rw-r--r--cs/demo/book/lifecycle/Client.cs69
-rw-r--r--cs/demo/book/lifecycle/DirectoryI.cs14
-rw-r--r--cs/demo/book/lifecycle/FileI.cs2
-rw-r--r--cs/demo/book/lifecycle/Server.cs69
-rw-r--r--cs/demo/book/printer/Client.cs9
-rw-r--r--cs/demo/book/printer/Server.cs7
-rw-r--r--cs/demo/book/simple_filesystem/Client.cs9
-rw-r--r--cs/demo/book/simple_filesystem/DirectoryI.cs9
-rw-r--r--cs/demo/book/simple_filesystem/FileI.cs8
-rw-r--r--cs/demo/book/simple_filesystem/Server.cs112
-rw-r--r--cs/src/IceBox/Server.cs51
-rw-r--r--cs/test/Glacier2/attack/Client.cs188
-rw-r--r--cs/test/Glacier2/attack/Server.cs65
-rw-r--r--cs/test/Glacier2/router/Client.cs676
-rw-r--r--cs/test/Glacier2/router/Server.cs42
-rw-r--r--cs/test/Ice/adapterDeactivation/Client.cs12
-rw-r--r--cs/test/Ice/adapterDeactivation/Collocated.cs12
-rw-r--r--cs/test/Ice/adapterDeactivation/Server.cs12
-rw-r--r--cs/test/Ice/application/Client.cs66
-rw-r--r--cs/test/Ice/background/Client.cs7
-rw-r--r--cs/test/Ice/background/Server.cs9
-rw-r--r--cs/test/Ice/binding/Client.cs8
-rw-r--r--cs/test/Ice/binding/Server.cs8
-rw-r--r--cs/test/Ice/dictMapping/Client.cs7
-rw-r--r--cs/test/Ice/dictMapping/Collocated.cs7
-rw-r--r--cs/test/Ice/dictMapping/Server.cs7
-rw-r--r--cs/test/Ice/exceptions/Client.cs8
-rw-r--r--cs/test/Ice/exceptions/Collocated.cs8
-rw-r--r--cs/test/Ice/exceptions/Server.cs8
-rw-r--r--cs/test/Ice/facets/Client.cs8
-rw-r--r--cs/test/Ice/facets/Collocated.cs8
-rw-r--r--cs/test/Ice/facets/Server.cs8
-rw-r--r--cs/test/Ice/faultTolerance/Client.cs8
-rw-r--r--cs/test/Ice/faultTolerance/Server.cs8
-rw-r--r--cs/test/Ice/hold/Client.cs8
-rw-r--r--cs/test/Ice/hold/Server.cs8
-rw-r--r--cs/test/Ice/inheritance/Client.cs8
-rw-r--r--cs/test/Ice/inheritance/Collocated.cs8
-rw-r--r--cs/test/Ice/inheritance/Server.cs8
-rw-r--r--cs/test/Ice/interceptor/Client.cs371
-rw-r--r--cs/test/Ice/location/Client.cs8
-rw-r--r--cs/test/Ice/location/Server.cs8
-rw-r--r--cs/test/Ice/objects/Client.cs8
-rw-r--r--cs/test/Ice/objects/Collocated.cs8
-rw-r--r--cs/test/Ice/objects/Server.cs8
-rw-r--r--cs/test/Ice/operations/Client.cs7
-rw-r--r--cs/test/Ice/operations/Collocated.cs7
-rw-r--r--cs/test/Ice/operations/Server.cs7
-rw-r--r--cs/test/Ice/proxy/Client.cs7
-rw-r--r--cs/test/Ice/proxy/Collocated.cs7
-rw-r--r--cs/test/Ice/proxy/Server.cs7
-rw-r--r--cs/test/Ice/retry/Client.cs7
-rw-r--r--cs/test/Ice/retry/Server.cs7
-rw-r--r--cs/test/Ice/seqMapping/Client.cs7
-rw-r--r--cs/test/Ice/seqMapping/Collocated.cs7
-rw-r--r--cs/test/Ice/seqMapping/Server.cs7
-rw-r--r--cs/test/Ice/servantLocator/Client.cs12
-rw-r--r--cs/test/Ice/servantLocator/Collocated.cs12
-rw-r--r--cs/test/Ice/servantLocator/Server.cs12
-rw-r--r--cs/test/Ice/stream/Client.cs9
-rw-r--r--cs/test/Ice/threads/Client.cs7
-rw-r--r--cs/test/Ice/threads/Server.cs7
-rw-r--r--cs/test/Ice/timeout/Client.cs7
-rw-r--r--cs/test/Ice/timeout/Server.cs7
-rw-r--r--cs/test/IceBox/configuration/Client.cs8
-rw-r--r--cs/test/IceGrid/simple/Client.cs8
-rw-r--r--cs/test/IceGrid/simple/Server.cs39
-rw-r--r--cs/test/IceSSL/configuration/Client.cs7
-rw-r--r--cs/test/IceSSL/configuration/Server.cs7
102 files changed, 3887 insertions, 3041 deletions
diff --git a/cs/demo/Glacier2/callback/Client.cs b/cs/demo/Glacier2/callback/Client.cs
index ebe5d0f2a11..4816f43399f 100644
--- a/cs/demo/Glacier2/callback/Client.cs
+++ b/cs/demo/Glacier2/callback/Client.cs
@@ -10,228 +10,238 @@
using Demo;
using System;
using System.Collections.Generic;
+using System.Reflection;
-public class Client : Ice.Application
-{
- private static void menu()
- {
- Console.WriteLine(
- "usage:\n" +
- "t: send callback as twoway\n" +
- "o: send callback as oneway\n" +
- "O: send callback as batch oneway\n" +
- "f: flush all batch requests\n" +
- "v: set/reset override context field\n" +
- "F: set/reset fake category\n" +
- "s: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
- }
+[assembly: CLSCompliant(true)]
- public override int run(string[] args)
- {
- if(args.Length > 0)
- {
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+[assembly: AssemblyTitle("Glacier2CallbackClient")]
+[assembly: AssemblyDescription("Glacier2 callback demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
- Ice.RouterPrx defaultRouter = communicator().getDefaultRouter();
- if(defaultRouter == null)
- {
- Console.Error.WriteLine("no default router set");
- return 1;
- }
-
- Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(defaultRouter);
- if(router == null)
+public class Client
+{
+ public class App : Ice.Application
+ {
+ private static void menu()
{
- Console.Error.WriteLine("configured router is not a Glacier2 router");
- return 1;
+ Console.WriteLine(
+ "usage:\n" +
+ "t: send callback as twoway\n" +
+ "o: send callback as oneway\n" +
+ "O: send callback as batch oneway\n" +
+ "f: flush all batch requests\n" +
+ "v: set/reset override context field\n" +
+ "F: set/reset fake category\n" +
+ "s: shutdown server\n" +
+ "x: exit\n" +
+ "?: help\n");
}
- while(true)
+ public override int run(string[] args)
{
- Console.WriteLine("This demo accepts any user-id / password combination.");
-
- String id;
- Console.Write("user id: ");
- Console.Out.Flush();
- id = Console.In.ReadLine();
-
- String pw;
- Console.Write("password: ");
- Console.Out.Flush();
- pw = Console.In.ReadLine();
-
- try
+ if(args.Length > 0)
{
- router.createSession(id, pw);
- break;
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
}
- catch(Glacier2.PermissionDeniedException ex)
+
+ Ice.RouterPrx defaultRouter = communicator().getDefaultRouter();
+ if(defaultRouter == null)
{
- Console.Write("permission denied:\n" + ex.reason);
+ Console.Error.WriteLine("no default router set");
+ return 1;
}
- catch(Glacier2.CannotCreateSessionException ex)
+
+ Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(defaultRouter);
+ if(router == null)
{
- Console.Write("cannot create session:\n" + ex.reason);
+ Console.Error.WriteLine("configured router is not a Glacier2 router");
+ return 1;
}
- }
- String category = router.getCategoryForClient();
- Ice.Identity callbackReceiverIdent = new Ice.Identity();
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
- Ice.Identity callbackReceiverFakeIdent = new Ice.Identity();
- callbackReceiverFakeIdent.name = "callbackReceiver";
- callbackReceiverFakeIdent.category = "fake";
-
- Ice.ObjectPrx @base = communicator().propertyToProxy("Callback.Proxy");
- CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base);
- CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway());
- CallbackPrx batchOneway = CallbackPrxHelper.uncheckedCast(twoway.ice_batchOneway());
-
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client");
- adapter.add(new CallbackReceiverI(), callbackReceiverIdent);
- adapter.add(new CallbackReceiverI(), callbackReceiverFakeIdent);
- adapter.activate();
-
- CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- adapter.createProxy(callbackReceiverIdent));
- CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
-
- menu();
-
- string line = null;
- string @override = null;
- bool fake = false;
- do
- {
- try
+ while(true)
{
- Console.Write("==> ");
+ Console.WriteLine("This demo accepts any user-id / password combination.");
+
+ String id;
+ Console.Write("user id: ");
+ Console.Out.Flush();
+ id = Console.In.ReadLine();
+
+ String pw;
+ Console.Write("password: ");
Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
+ pw = Console.In.ReadLine();
+
+ try
{
+ router.createSession(id, pw);
break;
}
- if(line.Equals("t"))
+ catch(Glacier2.PermissionDeniedException ex)
{
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "t";
- if(@override != null)
- {
- context["_ovrd"] = @override;
- }
- twoway.initiateCallback(twowayR, context);
+ Console.Write("permission denied:\n" + ex.reason);
}
- else if(line.Equals("o"))
+ catch(Glacier2.CannotCreateSessionException ex)
{
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "o";
- if(@override != null)
- {
- context["_ovrd"] = @override;
- }
- oneway.initiateCallback(onewayR, context);
+ Console.Write("cannot create session:\n" + ex.reason);
}
- else if(line.Equals("O"))
+ }
+
+ String category = router.getCategoryForClient();
+ Ice.Identity callbackReceiverIdent = new Ice.Identity();
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = category;
+ Ice.Identity callbackReceiverFakeIdent = new Ice.Identity();
+ callbackReceiverFakeIdent.name = "callbackReceiver";
+ callbackReceiverFakeIdent.category = "fake";
+
+ Ice.ObjectPrx @base = communicator().propertyToProxy("Callback.Proxy");
+ CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base);
+ CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway());
+ CallbackPrx batchOneway = CallbackPrxHelper.uncheckedCast(twoway.ice_batchOneway());
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client");
+ adapter.add(new CallbackReceiverI(), callbackReceiverIdent);
+ adapter.add(new CallbackReceiverI(), callbackReceiverFakeIdent);
+ adapter.activate();
+
+ CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ adapter.createProxy(callbackReceiverIdent));
+ CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
+
+ menu();
+
+ string line = null;
+ string @override = null;
+ bool fake = false;
+ do
+ {
+ try
{
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "O";
- if(@override != null)
+ Console.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
{
- context["_ovrd"] = @override;
- }
- batchOneway.initiateCallback(onewayR, context);
- }
- else if(line.Equals("f"))
- {
- communicator().flushBatchRequests();
- }
- else if(line.Equals("v"))
- {
- if(@override == null)
+ break;
+ }
+ if(line.Equals("t"))
{
- @override = "some_value";
- Console.WriteLine("override context field is now `" + @override + "'");
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ context["_fwd"] = "t";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
+ twoway.initiateCallback(twowayR, context);
}
- else
+ else if(line.Equals("o"))
{
- @override = null;
- Console.WriteLine("override context field is empty");
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ context["_fwd"] = "o";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
+ oneway.initiateCallback(onewayR, context);
}
- }
- else if(line.Equals("F"))
- {
- fake = !fake;
-
- if(fake)
+ else if(line.Equals("O"))
+ {
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ context["_fwd"] = "O";
+ if(@override != null)
+ {
+ context["_ovrd"] = @override;
+ }
+ batchOneway.initiateCallback(onewayR, context);
+ }
+ else if(line.Equals("f"))
+ {
+ communicator().flushBatchRequests();
+ }
+ else if(line.Equals("v"))
+ {
+ if(@override == null)
+ {
+ @override = "some_value";
+ Console.WriteLine("override context field is now `" + @override + "'");
+ }
+ else
+ {
+ @override = null;
+ Console.WriteLine("override context field is empty");
+ }
+ }
+ else if(line.Equals("F"))
{
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_identity(callbackReceiverFakeIdent));
- onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- onewayR.ice_identity(callbackReceiverFakeIdent));
+ fake = !fake;
+
+ if(fake)
+ {
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ twowayR.ice_identity(callbackReceiverFakeIdent));
+ onewayR = CallbackReceiverPrxHelper.uncheckedCast(
+ onewayR.ice_identity(callbackReceiverFakeIdent));
+ }
+ else
+ {
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ twowayR.ice_identity(callbackReceiverIdent));
+ onewayR = CallbackReceiverPrxHelper.uncheckedCast(
+ onewayR.ice_identity(callbackReceiverIdent));
+ }
+
+ Console.WriteLine("callback receiver identity: " +
+ communicator().identityToString(twowayR.ice_getIdentity()));
+ }
+ else if(line.Equals("s"))
+ {
+ twoway.shutdown();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
}
else
{
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_identity(callbackReceiverIdent));
- onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- onewayR.ice_identity(callbackReceiverIdent));
+ Console.WriteLine("unknown command `" + line + "'");
+ menu();
}
-
- Console.WriteLine("callback receiver identity: " +
- communicator().identityToString(twowayR.ice_getIdentity()));
- }
- else if(line.Equals("s"))
- {
- twoway.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
}
- else
+ catch(System.Exception ex)
{
- Console.WriteLine("unknown command `" + line + "'");
- menu();
+ Console.Error.WriteLine(ex);
}
}
- catch(System.Exception ex)
+ while(!line.Equals("x"));
+
+ try
+ {
+ router.destroySession();
+ }
+ catch(Glacier2.SessionNotExistException ex)
{
Console.Error.WriteLine(ex);
}
- }
- while(!line.Equals("x"));
+ catch(Ice.ConnectionLostException)
+ {
+ //
+ // Expected: the router closed the connection.
+ //
+ }
- try
- {
- router.destroySession();
+ return 0;
}
- catch(Glacier2.SessionNotExistException ex)
- {
- Console.Error.WriteLine(ex);
- }
- catch(Ice.ConnectionLostException)
- {
- //
- // Expected: the router closed the connection.
- //
- }
-
- return 0;
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Glacier2/callback/Server.cs b/cs/demo/Glacier2/callback/Server.cs
index eb839667eea..a5b67b1ccf5 100644
--- a/cs/demo/Glacier2/callback/Server.cs
+++ b/cs/demo/Glacier2/callback/Server.cs
@@ -8,27 +8,38 @@
// **********************************************************************
using Demo;
+using System;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("Glacier2CallbackServer")]
+[assembly: AssemblyDescription("Glacier2 callback demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server");
- adapter.add(new CallbackI(), communicator().stringToIdentity("callback"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server");
+ adapter.add(new CallbackI(), communicator().stringToIdentity("callback"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Glacier2/callback/SessionServer.cs b/cs/demo/Glacier2/callback/SessionServer.cs
index b3acb33eed4..b6118653e7e 100644
--- a/cs/demo/Glacier2/callback/SessionServer.cs
+++ b/cs/demo/Glacier2/callback/SessionServer.cs
@@ -8,38 +8,50 @@
// **********************************************************************
using System;
+using System.Collections.Generic;
+using System.Reflection;
-public class SessionServer : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("Glacier2CallbackSessionServer")]
+[assembly: AssemblyDescription("Glacier2 callback demo session server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class SessionServer
{
- sealed class DummyPermissionVerifierI : Glacier2.PermissionsVerifierDisp_
+ public class App : Ice.Application
{
- public override bool checkPermissions(String userId, String password, out string reason, Ice.Current current)
+ sealed class DummyPermissionVerifierI : Glacier2.PermissionsVerifierDisp_
{
- reason = null;
- Console.WriteLine("verified user `" + userId + "' with password `" + password + "'");
- return true;
+ public override bool checkPermissions(String userId, String password, out string reason,
+ Ice.Current current)
+ {
+ reason = null;
+ Console.WriteLine("verified user `" + userId + "' with password `" + password + "'");
+ return true;
+ }
}
- };
- public override int run(string[] args)
- {
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionServer");
- adapter.add(new DummyPermissionVerifierI(), communicator().stringToIdentity("verifier"));
- adapter.add(new SessionManagerI(), communicator().stringToIdentity("sessionmanager"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionServer");
+ adapter.add(new DummyPermissionVerifierI(), communicator().stringToIdentity("verifier"));
+ adapter.add(new SessionManagerI(), communicator().stringToIdentity("sessionmanager"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- SessionServer app = new SessionServer();
+ App app = new App();
int status = app.main(args, "config.sessionserver");
if(status != 0)
{
diff --git a/cs/demo/Ice/async/Client.cs b/cs/demo/Ice/async/Client.cs
index 61857ff1197..1a575c779c8 100644
--- a/cs/demo/Ice/async/Client.cs
+++ b/cs/demo/Ice/async/Client.cs
@@ -7,110 +7,120 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceAsyncClient")]
+[assembly: AssemblyDescription("Ice async demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public class AMI_Hello_sayHelloI : AMI_Hello_sayHello
+ public class App : Ice.Application
{
- public override void ice_response()
- {
- }
-
- public override void ice_exception(Ice.Exception ex)
+ public class AMI_Hello_sayHelloI : AMI_Hello_sayHello
{
- if(ex is RequestCanceledException)
+ public override void ice_response()
{
- Console.Error.WriteLine("RequestCanceledException");
}
- else
+
+ public override void ice_exception(Ice.Exception ex)
{
- Console.Error.WriteLine("sayHello AMI call failed:");
- Console.Error.WriteLine(ex);
+ if(ex is RequestCanceledException)
+ {
+ Console.Error.WriteLine("RequestCanceledException");
+ }
+ else
+ {
+ Console.Error.WriteLine("sayHello AMI call failed:");
+ Console.Error.WriteLine(ex);
+ }
}
}
- }
-
- private static void menu()
- {
- Console.Out.WriteLine(
- "usage:\n" +
- "i: send immediate greeting\n" +
- "d: send delayed greeting\n" +
- "s: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
- }
- public override int run(string[] args)
- {
- if(args.Length > 0)
+ private static void menu()
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
+ Console.Out.WriteLine(
+ "usage:\n" +
+ "i: send immediate greeting\n" +
+ "d: send delayed greeting\n" +
+ "s: shutdown server\n" +
+ "x: exit\n" +
+ "?: help\n");
}
- HelloPrx hello = HelloPrxHelper.checkedCast(communicator().propertyToProxy("Hello.Proxy"));
- if(hello == null)
+ public override int run(string[] args)
{
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- menu();
+ HelloPrx hello = HelloPrxHelper.checkedCast(communicator().propertyToProxy("Hello.Proxy"));
+ if(hello == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
- string line = null;
- do
- {
- try
+ menu();
+
+ string line = null;
+ do
{
- Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("i"))
- {
- hello.sayHello(0);
- }
- else if(line.Equals("d"))
- {
- hello.sayHello_async(new AMI_Hello_sayHelloI(), 5000);
- }
- else if(line.Equals("s"))
- {
- hello.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
+ try
{
- menu();
+ Console.Out.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
+ {
+ break;
+ }
+ if(line.Equals("i"))
+ {
+ hello.sayHello(0);
+ }
+ else if(line.Equals("d"))
+ {
+ hello.sayHello_async(new AMI_Hello_sayHelloI(), 5000);
+ }
+ else if(line.Equals("s"))
+ {
+ hello.shutdown();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ Console.Out.WriteLine("unknown command `" + line + "'");
+ menu();
+ }
}
- else
+ catch(Ice.Exception ex)
{
- Console.Out.WriteLine("unknown command `" + line + "'");
- menu();
+ Console.Error.WriteLine(ex);
}
}
- catch(Ice.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
- }
- while(!line.Equals("x"));
+ while(!line.Equals("x"));
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/async/Server.cs b/cs/demo/Ice/async/Server.cs
index 2733c9f02c2..0c2598bd527 100644
--- a/cs/demo/Ice/async/Server.cs
+++ b/cs/demo/Ice/async/Server.cs
@@ -7,45 +7,57 @@
//
// **********************************************************************
-public class Server : Ice.Application
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceAsyncServer")]
+[assembly: AssemblyDescription("Ice async demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- callbackOnInterrupt();
+ callbackOnInterrupt();
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- _workQueue = new WorkQueue();
- adapter.add(new HelloI(_workQueue), communicator().stringToIdentity("hello"));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
+ _workQueue = new WorkQueue();
+ adapter.add(new HelloI(_workQueue), communicator().stringToIdentity("hello"));
- _workQueue.Start();
- adapter.activate();
+ _workQueue.Start();
+ adapter.activate();
- communicator().waitForShutdown();
- _workQueue.Join();
- return 0;
- }
+ communicator().waitForShutdown();
+ _workQueue.Join();
+ return 0;
+ }
- public override void interruptCallback(int sig)
- {
- _workQueue.destroy();
- communicator().shutdown();
+ public override void interruptCallback(int sig)
+ {
+ _workQueue.destroy();
+ communicator().shutdown();
+ }
+
+ private WorkQueue _workQueue;
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
System.Environment.Exit(status);
}
}
-
- private WorkQueue _workQueue;
}
diff --git a/cs/demo/Ice/bidir/Client.cs b/cs/demo/Ice/bidir/Client.cs
index 04866755066..872fde959ce 100644
--- a/cs/demo/Ice/bidir/Client.cs
+++ b/cs/demo/Ice/bidir/Client.cs
@@ -8,41 +8,52 @@
// **********************************************************************
using Demo;
+using System;
+using System.Reflection;
-public class Client : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceBidirClient")]
+[assembly: AssemblyDescription("Ice bidir demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- CallbackSenderPrx server =
- CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("Callback.Client.CallbackServer"));
- if(server == null)
- {
- System.Console.Error.WriteLine("invalid proxy");
- return 1;
- }
+ CallbackSenderPrx server =
+ CallbackSenderPrxHelper.checkedCast(communicator().propertyToProxy("Callback.Client.CallbackServer"));
+ if(server == null)
+ {
+ System.Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("");
+ Ice.Identity ident = new Ice.Identity();
+ ident.name = Ice.Util.generateUUID();
+ ident.category = "";
+ adapter.add(new CallbackReceiverI(), ident);
+ adapter.activate();
+ server.ice_getConnection().setAdapter(adapter);
+ server.addClient(ident);
+ communicator().waitForShutdown();
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("");
- Ice.Identity ident = new Ice.Identity();
- ident.name = Ice.Util.generateUUID();
- ident.category = "";
- adapter.add(new CallbackReceiverI(), ident);
- adapter.activate();
- server.ice_getConnection().setAdapter(adapter);
- server.addClient(ident);
- communicator().waitForShutdown();
-
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/bidir/Server.cs b/cs/demo/Ice/bidir/Server.cs
index aba1f3bfc21..28c17d3fe23 100644
--- a/cs/demo/Ice/bidir/Server.cs
+++ b/cs/demo/Ice/bidir/Server.cs
@@ -8,42 +8,53 @@
// **********************************************************************
using Demo;
+using System;
using System.Threading;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceBidirServer")]
+[assembly: AssemblyDescription("Ice bidir demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server");
- CallbackSenderI sender = new CallbackSenderI(communicator());
- adapter.add(sender, communicator().stringToIdentity("sender"));
- adapter.activate();
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server");
+ CallbackSenderI sender = new CallbackSenderI(communicator());
+ adapter.add(sender, communicator().stringToIdentity("sender"));
+ adapter.activate();
- Thread t = new Thread(new ThreadStart(sender.Run));
- t.Start();
+ Thread t = new Thread(new ThreadStart(sender.Run));
+ t.Start();
- try
- {
- communicator().waitForShutdown();
- }
- finally
- {
- sender.destroy();
- t.Join();
- }
+ try
+ {
+ communicator().waitForShutdown();
+ }
+ finally
+ {
+ sender.destroy();
+ t.Join();
+ }
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/callback/Client.cs b/cs/demo/Ice/callback/Client.cs
index 3289bb633b4..3ec6ec8a570 100644
--- a/cs/demo/Ice/callback/Client.cs
+++ b/cs/demo/Ice/callback/Client.cs
@@ -7,183 +7,193 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceCallbackClient")]
+[assembly: AssemblyDescription("Ice callback demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- private static void menu()
+ public class App : Ice.Application
{
- Console.Out.Write("usage:\n"
- + "t: send callback as twoway\n"
- + "o: send callback as oneway\n"
- + "O: send callback as batch oneway\n"
- + "d: send callback as datagram\n"
- + "D: send callback as batch datagram\n"
- + "f: flush all batch requests");
- if(_haveSSL)
+ private static void menu()
{
- Console.Out.Write("\nS: switch secure mode on/off");
+ Console.Out.Write("usage:\n"
+ + "t: send callback as twoway\n"
+ + "o: send callback as oneway\n"
+ + "O: send callback as batch oneway\n"
+ + "d: send callback as datagram\n"
+ + "D: send callback as batch datagram\n"
+ + "f: flush all batch requests");
+ if(_haveSSL)
+ {
+ Console.Out.Write("\nS: switch secure mode on/off");
+ }
+ Console.Out.WriteLine("\ns: shutdown server\n"
+ + "x: exit\n"
+ + "?: help\n");
}
- Console.Out.WriteLine("\ns: shutdown server\n"
- + "x: exit\n"
- + "?: help\n");
- }
-
- public override int run(string[] args)
- {
- if(args.Length > 0)
+
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- try
- {
- communicator().getPluginManager().getPlugin("IceSSL");
- _haveSSL = true;
- }
- catch(Ice.NotRegisteredException)
- {
- }
+ try
+ {
+ communicator().getPluginManager().getPlugin("IceSSL");
+ _haveSSL = true;
+ }
+ catch(Ice.NotRegisteredException)
+ {
+ }
- CallbackSenderPrx twoway = CallbackSenderPrxHelper.checkedCast(
- communicator().propertyToProxy("Callback.CallbackServer").
- ice_twoway().ice_timeout(-1).ice_secure(false));
- if(twoway == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
- CallbackSenderPrx oneway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_oneway());
- CallbackSenderPrx batchOneway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchOneway());
- CallbackSenderPrx datagram = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_datagram());
- CallbackSenderPrx batchDatagram = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
-
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client");
- adapter.add(new CallbackReceiverI(), communicator().stringToIdentity("callbackReceiver"));
- adapter.activate();
-
- CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
- adapter.createProxy(communicator().stringToIdentity("callbackReceiver")));
- CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(
- twowayR.ice_oneway());
- CallbackReceiverPrx datagramR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram());
-
- bool secure = false;
+ CallbackSenderPrx twoway = CallbackSenderPrxHelper.checkedCast(
+ communicator().propertyToProxy("Callback.CallbackServer").
+ ice_twoway().ice_timeout(-1).ice_secure(false));
+ if(twoway == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
+ CallbackSenderPrx oneway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_oneway());
+ CallbackSenderPrx batchOneway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchOneway());
+ CallbackSenderPrx datagram = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_datagram());
+ CallbackSenderPrx batchDatagram = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client");
+ adapter.add(new CallbackReceiverI(), communicator().stringToIdentity("callbackReceiver"));
+ adapter.activate();
+
+ CallbackReceiverPrx twowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ adapter.createProxy(communicator().stringToIdentity("callbackReceiver")));
+ CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(
+ twowayR.ice_oneway());
+ CallbackReceiverPrx datagramR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_datagram());
+
+ bool secure = false;
- menu();
-
- string line = null;
- do
- {
- try
+ menu();
+
+ string line = null;
+ do
{
- Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("t"))
- {
- twoway.initiateCallback(twowayR);
- }
- else if(line.Equals("o"))
+ try
{
- oneway.initiateCallback(onewayR);
- }
- else if(line.Equals("O"))
- {
- batchOneway.initiateCallback(onewayR);
- }
- else if(line.Equals("d"))
- {
- if(secure)
+ Console.Out.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
{
- Console.Out.WriteLine("secure datagrams are not supported");
+ break;
}
- else
+ if(line.Equals("t"))
{
- datagram.initiateCallback(datagramR);
+ twoway.initiateCallback(twowayR);
}
- }
- else if(line.Equals("D"))
- {
- if(secure)
+ else if(line.Equals("o"))
{
- Console.Out.WriteLine("secure datagrams are not supported");
+ oneway.initiateCallback(onewayR);
}
- else
+ else if(line.Equals("O"))
{
- batchDatagram.initiateCallback(datagramR);
+ batchOneway.initiateCallback(onewayR);
}
- }
- else if(line.Equals("f"))
- {
- communicator().flushBatchRequests();
- }
- else if(_haveSSL && line.Equals("S"))
- {
- secure = !secure;
+ else if(line.Equals("d"))
+ {
+ if(secure)
+ {
+ Console.Out.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ datagram.initiateCallback(datagramR);
+ }
+ }
+ else if(line.Equals("D"))
+ {
+ if(secure)
+ {
+ Console.Out.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ batchDatagram.initiateCallback(datagramR);
+ }
+ }
+ else if(line.Equals("f"))
+ {
+ communicator().flushBatchRequests();
+ }
+ else if(_haveSSL && line.Equals("S"))
+ {
+ secure = !secure;
- twoway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_secure(secure));
- oneway = CallbackSenderPrxHelper.uncheckedCast(oneway.ice_secure(secure));
- batchOneway = CallbackSenderPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
- datagram = CallbackSenderPrxHelper.uncheckedCast(datagram.ice_secure(secure));
- batchDatagram = CallbackSenderPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
+ twoway = CallbackSenderPrxHelper.uncheckedCast(twoway.ice_secure(secure));
+ oneway = CallbackSenderPrxHelper.uncheckedCast(oneway.ice_secure(secure));
+ batchOneway = CallbackSenderPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
+ datagram = CallbackSenderPrxHelper.uncheckedCast(datagram.ice_secure(secure));
+ batchDatagram = CallbackSenderPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_secure(secure));
- onewayR = CallbackReceiverPrxHelper.uncheckedCast(onewayR.ice_secure(secure));
- datagramR = CallbackReceiverPrxHelper.uncheckedCast(datagramR.ice_secure(secure));
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_secure(secure));
+ onewayR = CallbackReceiverPrxHelper.uncheckedCast(onewayR.ice_secure(secure));
+ datagramR = CallbackReceiverPrxHelper.uncheckedCast(datagramR.ice_secure(secure));
- if(secure)
+ if(secure)
+ {
+ Console.Out.WriteLine("secure mode is now on");
+ }
+ else
+ {
+ Console.Out.WriteLine("secure mode is now off");
+ }
+ }
+ else if(line.Equals("s"))
{
- Console.Out.WriteLine("secure mode is now on");
+ twoway.shutdown();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
}
else
{
- Console.Out.WriteLine("secure mode is now off");
+ Console.Out.WriteLine("unknown command `" + line + "'");
+ menu();
}
}
- else if(line.Equals("s"))
- {
- twoway.shutdown();
- }
- else if(line.Equals("x"))
+ catch(System.Exception ex)
{
- // Nothing to do
+ Console.Error.WriteLine(ex);
}
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.Out.WriteLine("unknown command `" + line + "'");
- menu();
- }
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
}
+ while(!line.Equals("x"));
+
+ return 0;
}
- while(!line.Equals("x"));
-
- return 0;
+
+ private static bool _haveSSL = false;
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
System.Environment.Exit(status);
}
}
-
- private static bool _haveSSL = false;
}
diff --git a/cs/demo/Ice/callback/Server.cs b/cs/demo/Ice/callback/Server.cs
index 4a4b372765d..3e7e2ba37b6 100644
--- a/cs/demo/Ice/callback/Server.cs
+++ b/cs/demo/Ice/callback/Server.cs
@@ -8,27 +8,38 @@
// **********************************************************************
using Demo;
+using System;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceCallbackServer")]
+[assembly: AssemblyDescription("Ice callback demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server");
- adapter.add(new CallbackSenderI(), communicator().stringToIdentity("callback"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Server");
+ adapter.add(new CallbackSenderI(), communicator().stringToIdentity("callback"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/hello/Client.cs b/cs/demo/Ice/hello/Client.cs
index 31ec2163d82..f9231860f80 100644
--- a/cs/demo/Ice/hello/Client.cs
+++ b/cs/demo/Ice/hello/Client.cs
@@ -7,218 +7,228 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceHelloClient")]
+[assembly: AssemblyDescription("Ice hello demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client : Ice.Application
+public class Client
{
- private static void menu()
+ public class App : Ice.Application
{
- Console.Write(
- "usage:\n" +
- "t: send greeting as twoway\n" +
- "o: send greeting as oneway\n" +
- "O: send greeting as batch oneway\n" +
- "d: send greeting as datagram\n" +
- "D: send greeting as batch datagram\n" +
- "f: flush all batch requests\n" +
- "T: set a timeout\n" +
- "P: set a server delay");
- if(_haveSSL)
+ private static void menu()
{
- Console.Write("\nS: switch secure mode on/off");
+ Console.Write(
+ "usage:\n" +
+ "t: send greeting as twoway\n" +
+ "o: send greeting as oneway\n" +
+ "O: send greeting as batch oneway\n" +
+ "d: send greeting as datagram\n" +
+ "D: send greeting as batch datagram\n" +
+ "f: flush all batch requests\n" +
+ "T: set a timeout\n" +
+ "P: set a server delay");
+ if(_haveSSL)
+ {
+ Console.Write("\nS: switch secure mode on/off");
+ }
+ Console.WriteLine(
+ "\ns: shutdown server\n" +
+ "x: exit\n" +
+ "?: help\n");
}
- Console.WriteLine(
- "\ns: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
- }
- public override int run(string[] args)
- {
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- try
- {
- communicator().getPluginManager().getPlugin("IceSSL");
- _haveSSL = true;
- }
- catch(Ice.NotRegisteredException)
- {
- }
+ try
+ {
+ communicator().getPluginManager().getPlugin("IceSSL");
+ _haveSSL = true;
+ }
+ catch(Ice.NotRegisteredException)
+ {
+ }
- HelloPrx twoway = HelloPrxHelper.checkedCast(
- communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
- if(twoway == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
- HelloPrx oneway = (HelloPrx)twoway.ice_oneway();
- HelloPrx batchOneway = (HelloPrx)twoway.ice_batchOneway();
- HelloPrx datagram = (HelloPrx)twoway.ice_datagram();
- HelloPrx batchDatagram =(HelloPrx)twoway.ice_batchDatagram();
+ HelloPrx twoway = HelloPrxHelper.checkedCast(
+ communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
+ if(twoway == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
+ HelloPrx oneway = (HelloPrx)twoway.ice_oneway();
+ HelloPrx batchOneway = (HelloPrx)twoway.ice_batchOneway();
+ HelloPrx datagram = (HelloPrx)twoway.ice_datagram();
+ HelloPrx batchDatagram =(HelloPrx)twoway.ice_batchDatagram();
- bool secure = false;
- int timeout = -1;
- int delay = 0;
+ bool secure = false;
+ int timeout = -1;
+ int delay = 0;
- menu();
+ menu();
- string line = null;
- do
- {
- try
+ string line = null;
+ do
{
- Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("t"))
- {
- twoway.sayHello(delay);
- }
- else if(line.Equals("o"))
- {
- oneway.sayHello(delay);
- }
- else if(line.Equals("O"))
+ try
{
- batchOneway.sayHello(delay);
- }
- else if(line.Equals("d"))
- {
- if(secure)
+ Console.Out.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
{
- Console.WriteLine("secure datagrams are not supported");
+ break;
}
- else
+ if(line.Equals("t"))
{
- datagram.sayHello(delay);
+ twoway.sayHello(delay);
}
- }
- else if(line.Equals("D"))
- {
- if(secure)
+ else if(line.Equals("o"))
{
- Console.WriteLine("secure datagrams are not supported");
+ oneway.sayHello(delay);
}
- else
+ else if(line.Equals("O"))
{
- batchDatagram.sayHello(delay);
+ batchOneway.sayHello(delay);
}
- }
- else if(line.Equals("f"))
- {
- communicator().flushBatchRequests();
- }
- else if(line.Equals("T"))
- {
- if(timeout == -1)
+ else if(line.Equals("d"))
{
- timeout = 2000;
+ if(secure)
+ {
+ Console.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ datagram.sayHello(delay);
+ }
}
- else
+ else if(line.Equals("D"))
{
- timeout = -1;
+ if(secure)
+ {
+ Console.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ batchDatagram.sayHello(delay);
+ }
}
-
- twoway = (HelloPrx)twoway.ice_timeout(timeout);
- oneway = (HelloPrx)oneway.ice_timeout(timeout);
- batchOneway = (HelloPrx)batchOneway.ice_timeout(timeout);
-
- if(timeout == -1)
+ else if(line.Equals("f"))
{
- Console.WriteLine("timeout is now switched off");
+ communicator().flushBatchRequests();
}
- else
+ else if(line.Equals("T"))
{
- Console.WriteLine("timeout is now set to 2000ms");
+ if(timeout == -1)
+ {
+ timeout = 2000;
+ }
+ else
+ {
+ timeout = -1;
+ }
+
+ twoway = (HelloPrx)twoway.ice_timeout(timeout);
+ oneway = (HelloPrx)oneway.ice_timeout(timeout);
+ batchOneway = (HelloPrx)batchOneway.ice_timeout(timeout);
+
+ if(timeout == -1)
+ {
+ Console.WriteLine("timeout is now switched off");
+ }
+ else
+ {
+ Console.WriteLine("timeout is now set to 2000ms");
+ }
}
- }
- else if(line.Equals("P"))
- {
- if(delay == 0)
+ else if(line.Equals("P"))
{
- delay = 2500;
+ if(delay == 0)
+ {
+ delay = 2500;
+ }
+ else
+ {
+ delay = 0;
+ }
+
+ if(delay == 0)
+ {
+ Console.WriteLine("server delay is now deactivated");
+ }
+ else
+ {
+ Console.WriteLine("server delay is now set to 2500ms");
+ }
}
- else
+ else if(_haveSSL && line.Equals("S"))
{
- delay = 0;
+ secure = !secure;
+
+ twoway = (HelloPrx)twoway.ice_secure(secure);
+ oneway = (HelloPrx)oneway.ice_secure(secure);
+ batchOneway = (HelloPrx)batchOneway.ice_secure(secure);
+ datagram = (HelloPrx)datagram.ice_secure(secure);
+ batchDatagram = (HelloPrx)batchDatagram.ice_secure(secure);
+
+ if(secure)
+ {
+ Console.WriteLine("secure mode is now on");
+ }
+ else
+ {
+ Console.WriteLine("secure mode is now off");
+ }
}
-
- if(delay == 0)
+ else if(line.Equals("s"))
{
- Console.WriteLine("server delay is now deactivated");
+ twoway.shutdown();
}
- else
+ else if(line.Equals("x"))
{
- Console.WriteLine("server delay is now set to 2500ms");
+ // Nothing to do
}
- }
- else if(_haveSSL && line.Equals("S"))
- {
- secure = !secure;
-
- twoway = (HelloPrx)twoway.ice_secure(secure);
- oneway = (HelloPrx)oneway.ice_secure(secure);
- batchOneway = (HelloPrx)batchOneway.ice_secure(secure);
- datagram = (HelloPrx)datagram.ice_secure(secure);
- batchDatagram = (HelloPrx)batchDatagram.ice_secure(secure);
-
- if(secure)
+ else if(line.Equals("?"))
{
- Console.WriteLine("secure mode is now on");
+ menu();
}
else
{
- Console.WriteLine("secure mode is now off");
+ Console.WriteLine("unknown command `" + line + "'");
+ menu();
}
}
- else if(line.Equals("s"))
- {
- twoway.shutdown();
- }
- else if(line.Equals("x"))
+ catch(System.Exception ex)
{
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.WriteLine("unknown command `" + line + "'");
- menu();
+ Console.Error.WriteLine(ex);
}
}
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
+ while (!line.Equals("x"));
+
+ return 0;
}
- while (!line.Equals("x"));
-
- return 0;
+
+ private static bool _haveSSL = false;
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
System.Environment.Exit(status);
}
}
-
- private static bool _haveSSL = false;
}
diff --git a/cs/demo/Ice/hello/Server.cs b/cs/demo/Ice/hello/Server.cs
index 8d17253cc75..b4fc2a08f6b 100644
--- a/cs/demo/Ice/hello/Server.cs
+++ b/cs/demo/Ice/hello/Server.cs
@@ -7,26 +7,38 @@
//
// **********************************************************************
-public class Server : Ice.Application
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceHelloServer")]
+[assembly: AssemblyDescription("Ice hello demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- adapter.add(new HelloI(), communicator().stringToIdentity("hello"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
+ adapter.add(new HelloI(), communicator().stringToIdentity("hello"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/invoke/Client.cs b/cs/demo/Ice/invoke/Client.cs
index cc57a450acf..df7ff9b2813 100644
--- a/cs/demo/Ice/invoke/Client.cs
+++ b/cs/demo/Ice/invoke/Client.cs
@@ -7,288 +7,301 @@
//
// **********************************************************************
+using Demo;
using System;
using System.Collections.Generic;
-using Demo;
+using System.Reflection;
-public class Client : Ice.Application
-{
- private static void menu()
- {
- Console.WriteLine(
- "usage:\n" +
- "1: print string\n" +
- "2: print string sequence\n" +
- "3: print dictionary\n" +
- "4: print enum\n" +
- "5: print struct\n" +
- "6: print struct sequence\n" +
- "7: print class\n" +
- "8: get values\n" +
- "9: throw exception\n" +
- "s: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
- }
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceInvokeClient")]
+[assembly: AssemblyDescription("Ice invoke demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
- public override int
- run(string[] args)
+public class Client
+{
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ private static void menu()
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
+ Console.WriteLine(
+ "usage:\n" +
+ "1: print string\n" +
+ "2: print string sequence\n" +
+ "3: print dictionary\n" +
+ "4: print enum\n" +
+ "5: print struct\n" +
+ "6: print struct sequence\n" +
+ "7: print class\n" +
+ "8: get values\n" +
+ "9: throw exception\n" +
+ "s: shutdown server\n" +
+ "x: exit\n" +
+ "?: help\n");
}
- Ice.ObjectPrx obj = communicator().propertyToProxy("Printer.Proxy");
-
- menu();
-
- string line = null;
- do
+ public override int run(string[] args)
{
- try
+ if(args.Length > 0)
{
- Console.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- byte[] outParams;
+ Ice.ObjectPrx obj = communicator().propertyToProxy("Printer.Proxy");
- if(line.Equals("1"))
- {
- //
- // Marshal the in parameter.
- //
- Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
- outStream.writeString("The streaming API works!");
+ menu();
- //
- // Invoke operation.
- //
- if(!obj.ice_invoke("printString", Ice.OperationMode.Normal, outStream.finished(), out outParams))
+ string line = null;
+ do
+ {
+ try
+ {
+ Console.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
{
- Console.Error.WriteLine("Unknown user exception");
+ break;
}
- outStream.destroy();
- }
- else if(line.Equals("2"))
- {
- //
- // Marshal the in parameter.
- //
- Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
- string[] arr = { "The", "streaming", "API", "works!" };
- Demo.StringSeqHelper.write(outStream, arr);
+ byte[] outParams;
- //
- // Invoke operation.
- //
- if(!obj.ice_invoke("printStringSequence", Ice.OperationMode.Normal, outStream.finished(), out outParams))
+ if(line.Equals("1"))
{
- Console.Error.WriteLine("Unknown user exception");
- }
+ //
+ // Marshal the in parameter.
+ //
+ Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
+ outStream.writeString("The streaming API works!");
- outStream.destroy();
- }
- else if(line.Equals("3"))
- {
- //
- // Marshal the in parameter.
- //
- Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
- Dictionary<string, string> dict = new Dictionary<string, string>();
- dict["The"] = "streaming";
- dict["API"] = "works!";
- Demo.StringDictHelper.write(outStream, dict);
+ //
+ // Invoke operation.
+ //
+ if(!obj.ice_invoke("printString", Ice.OperationMode.Normal, outStream.finished(),
+ out outParams))
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ }
- //
- // Invoke operation.
- //
- if(!obj.ice_invoke("printDictionary", Ice.OperationMode.Normal, outStream.finished(), out outParams))
- {
- Console.Error.WriteLine("Unknown user exception");
+ outStream.destroy();
}
+ else if(line.Equals("2"))
+ {
+ //
+ // Marshal the in parameter.
+ //
+ Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
+ string[] arr = { "The", "streaming", "API", "works!" };
+ Demo.StringSeqHelper.write(outStream, arr);
- outStream.destroy();
- }
- else if(line.Equals("4"))
- {
- //
- // Marshal the in parameter.
- //
- Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
- Demo.ColorHelper.write(outStream, Demo.Color.green);
+ //
+ // Invoke operation.
+ //
+ if(!obj.ice_invoke("printStringSequence", Ice.OperationMode.Normal, outStream.finished(),
+ out outParams))
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ }
- //
- // Invoke operation.
- //
- if(!obj.ice_invoke("printEnum", Ice.OperationMode.Normal, outStream.finished(), out outParams))
- {
- Console.Error.WriteLine("Unknown user exception");
+ outStream.destroy();
}
+ else if(line.Equals("3"))
+ {
+ //
+ // Marshal the in parameter.
+ //
+ Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
+ Dictionary<string, string> dict = new Dictionary<string, string>();
+ dict["The"] = "streaming";
+ dict["API"] = "works!";
+ Demo.StringDictHelper.write(outStream, dict);
- outStream.destroy();
- }
- else if(line.Equals("5"))
- {
- //
- // Marshal the in parameter.
- //
- Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
- Demo.Structure s = new Demo.Structure();
- s.name = "red";
- s.value = Demo.Color.red;
- s.ice_write(outStream);
+ //
+ // Invoke operation.
+ //
+ if(!obj.ice_invoke("printDictionary", Ice.OperationMode.Normal, outStream.finished(),
+ out outParams))
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ }
- //
- // Invoke operation.
- //
- if(!obj.ice_invoke("printStruct", Ice.OperationMode.Normal, outStream.finished(), out outParams))
- {
- Console.Error.WriteLine("Unknown user exception");
+ outStream.destroy();
}
+ else if(line.Equals("4"))
+ {
+ //
+ // Marshal the in parameter.
+ //
+ Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
+ Demo.ColorHelper.write(outStream, Demo.Color.green);
- outStream.destroy();
- }
- else if(line.Equals("6"))
- {
- //
- // Marshal the in parameter.
- //
- Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
- Demo.Structure[] arr = new Demo.Structure[3];
- arr[0] = new Demo.Structure();
- arr[0].name = "red";
- arr[0].value = Demo.Color.red;
- arr[1] = new Demo.Structure();
- arr[1].name = "green";
- arr[1].value = Demo.Color.green;
- arr[2] = new Demo.Structure();
- arr[2].name = "blue";
- arr[2].value = Demo.Color.blue;
- Demo.StructureSeqHelper.write(outStream, arr);
+ //
+ // Invoke operation.
+ //
+ if(!obj.ice_invoke("printEnum", Ice.OperationMode.Normal, outStream.finished(), out outParams))
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ }
- //
- // Invoke operation.
- //
- if(!obj.ice_invoke("printStructSequence", Ice.OperationMode.Normal, outStream.finished(),
- out outParams))
- {
- Console.Error.WriteLine("Unknown user exception");
+ outStream.destroy();
}
+ else if(line.Equals("5"))
+ {
+ //
+ // Marshal the in parameter.
+ //
+ Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
+ Demo.Structure s = new Demo.Structure();
+ s.name = "red";
+ s.value = Demo.Color.red;
+ s.ice_write(outStream);
- outStream.destroy();
- }
- else if(line.Equals("7"))
- {
- //
- // Marshal the in parameter.
- //
- Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
- Demo.C c = new Demo.C();
- c.s = new Demo.Structure();
- c.s.name = "blue";
- c.s.value = Demo.Color.blue;
- Demo.CHelper.write(outStream, c);
- outStream.writePendingObjects();
+ //
+ // Invoke operation.
+ //
+ if(!obj.ice_invoke("printStruct", Ice.OperationMode.Normal, outStream.finished(),
+ out outParams))
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ }
- //
- // Invoke operation.
- //
- if(!obj.ice_invoke("printClass", Ice.OperationMode.Normal, outStream.finished(), out outParams))
+ outStream.destroy();
+ }
+ else if(line.Equals("6"))
{
- Console.Error.WriteLine("Unknown user exception");
+ //
+ // Marshal the in parameter.
+ //
+ Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
+ Demo.Structure[] arr = new Demo.Structure[3];
+ arr[0] = new Demo.Structure();
+ arr[0].name = "red";
+ arr[0].value = Demo.Color.red;
+ arr[1] = new Demo.Structure();
+ arr[1].name = "green";
+ arr[1].value = Demo.Color.green;
+ arr[2] = new Demo.Structure();
+ arr[2].name = "blue";
+ arr[2].value = Demo.Color.blue;
+ Demo.StructureSeqHelper.write(outStream, arr);
+
+ //
+ // Invoke operation.
+ //
+ if(!obj.ice_invoke("printStructSequence", Ice.OperationMode.Normal, outStream.finished(),
+ out outParams))
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ }
+
+ outStream.destroy();
}
+ else if(line.Equals("7"))
+ {
+ //
+ // Marshal the in parameter.
+ //
+ Ice.OutputStream outStream = Ice.Util.createOutputStream(communicator());
+ Demo.C c = new Demo.C();
+ c.s = new Demo.Structure();
+ c.s.name = "blue";
+ c.s.value = Demo.Color.blue;
+ Demo.CHelper.write(outStream, c);
+ outStream.writePendingObjects();
- outStream.destroy();
- }
- else if(line.Equals("8"))
- {
- //
- // Invoke operation.
- //
- if(!obj.ice_invoke("getValues", Ice.OperationMode.Normal, null, out outParams))
+ //
+ // Invoke operation.
+ //
+ if(!obj.ice_invoke("printClass", Ice.OperationMode.Normal, outStream.finished(), out outParams))
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ }
+
+ outStream.destroy();
+ }
+ else if(line.Equals("8"))
{
- Console.Error.WriteLine("Unknown user exception");
- continue;
+ //
+ // Invoke operation.
+ //
+ if(!obj.ice_invoke("getValues", Ice.OperationMode.Normal, null, out outParams))
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ continue;
+ }
+
+ //
+ // Unmarshal the results.
+ //
+ Ice.InputStream inStream = Ice.Util.createInputStream(communicator(), outParams);
+ Demo.CHelper ch = new Demo.CHelper(inStream);
+ ch.read();
+ String str = inStream.readString();
+ inStream.readPendingObjects();
+ inStream.destroy();
+ Demo.C c = ch.value;
+ Console.Error.WriteLine("Got string `" + str + "' and class: s.name=" + c.s.name +
+ ", s.value=" + c.s.value);
}
+ else if(line.Equals("9"))
+ {
+ //
+ // Invoke operation.
+ //
+ if(obj.ice_invoke("throwPrintFailure", Ice.OperationMode.Normal, null, out outParams))
+ {
+ Console.Error.WriteLine("Expected exception");
+ continue;
+ }
- //
- // Unmarshal the results.
- //
- Ice.InputStream inStream = Ice.Util.createInputStream(communicator(), outParams);
- Demo.CHelper ch = new Demo.CHelper(inStream);
- ch.read();
- String str = inStream.readString();
- inStream.readPendingObjects();
- inStream.destroy();
- Demo.C c = ch.value;
- Console.Error.WriteLine("Got string `" + str + "' and class: s.name=" + c.s.name +
- ", s.value=" + c.s.value);
- }
- else if(line.Equals("9"))
- {
- //
- // Invoke operation.
- //
- if(obj.ice_invoke("throwPrintFailure", Ice.OperationMode.Normal, null, out outParams))
+ Ice.InputStream inStream = Ice.Util.createInputStream(communicator(), outParams);
+ try
+ {
+ inStream.throwException();
+ }
+ catch(Demo.PrintFailure)
+ {
+ // Expected.
+ }
+ catch(Ice.UserException)
+ {
+ Console.Error.WriteLine("Unknown user exception");
+ }
+ inStream.destroy();
+ }
+ else if(line.Equals("s"))
{
- Console.Error.WriteLine("Expected exception");
- continue;
+ obj.ice_invoke("shutdown", Ice.OperationMode.Normal, null, out outParams);
}
-
- Ice.InputStream inStream = Ice.Util.createInputStream(communicator(), outParams);
- try
+ else if(line.Equals("x"))
{
- inStream.throwException();
+ // Nothing to do.
}
- catch(Demo.PrintFailure)
+ else if(line.Equals("?"))
{
- // Expected.
+ menu();
}
- catch(Ice.UserException)
+ else
{
- Console.Error.WriteLine("Unknown user exception");
+ Console.Error.WriteLine("unknown command `" + line + "'");
+ menu();
}
- inStream.destroy();
- }
- else if(line.Equals("s"))
- {
- obj.ice_invoke("shutdown", Ice.OperationMode.Normal, null, out outParams);
}
- else if(line.Equals("x"))
+ catch(Ice.LocalException ex)
{
- // Nothing to do.
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
- {
- Console.Error.WriteLine("unknown command `" + line + "'");
- menu();
+ Console.Error.WriteLine(ex);
}
}
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- }
- }
- while(!line.Equals("x"));
+ while(!line.Equals("x"));
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/invoke/Server.cs b/cs/demo/Ice/invoke/Server.cs
index c3f20e9454d..670d3bcc048 100644
--- a/cs/demo/Ice/invoke/Server.cs
+++ b/cs/demo/Ice/invoke/Server.cs
@@ -9,28 +9,37 @@
using Demo;
using System;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceInvokeServer")]
+[assembly: AssemblyDescription("Ice invoke demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int
- run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Printer");
- adapter.add(new PrinterI(), communicator().stringToIdentity("printer"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Printer");
+ adapter.add(new PrinterI(), communicator().stringToIdentity("printer"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/latency/Client.cs b/cs/demo/Ice/latency/Client.cs
index bf9e4a37c91..9ebf5fb863a 100644
--- a/cs/demo/Ice/latency/Client.cs
+++ b/cs/demo/Ice/latency/Client.cs
@@ -7,64 +7,73 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceLatencyClient")]
+[assembly: AssemblyDescription("Ice latency demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client : Ice.Application
+public class Client
{
- public override int
- run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- PingPrx ping = PingPrxHelper.checkedCast(communicator().propertyToProxy("Latency.Ping"));
- if(ping == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
-
- //
- // A method needs to be invoked thousands of times before the JIT compiler
- // will convert it to native code. To ensure an accurate latency measurement,
- // we need to "warm up" the JIT compiler.
- //
- {
- int reps = 20000;
- Console.Error.Write("warming up the JIT compiler...");
- Console.Error.Flush();
- for(int i = 0; i < reps; i++)
+ PingPrx ping = PingPrxHelper.checkedCast(communicator().propertyToProxy("Latency.Ping"));
+ if(ping == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
+
+ //
+ // A method needs to be invoked thousands of times before the JIT compiler
+ // will convert it to native code. To ensure an accurate latency measurement,
+ // we need to "warm up" the JIT compiler.
+ //
+ {
+ int reps = 20000;
+ Console.Error.Write("warming up the JIT compiler...");
+ Console.Error.Flush();
+ for(int i = 0; i < reps; i++)
+ {
+ ping.ice_ping();
+ }
+ Console.Error.WriteLine("ok");
+ }
+
+ long tv1 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
+ int repetitions = 100000;
+ Console.Out.WriteLine("pinging server " + repetitions + " times (this may take a while)");
+ for (int i = 0; i < repetitions; i++)
{
ping.ice_ping();
}
- Console.Error.WriteLine("ok");
- }
-
- long tv1 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
- int repetitions = 100000;
- Console.Out.WriteLine("pinging server " + repetitions + " times (this may take a while)");
- for (int i = 0; i < repetitions; i++)
- {
- ping.ice_ping();
+
+ long tv2 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
+ double total = (double)(tv2 - tv1);
+ double perPing = total / repetitions;
+
+ Console.Out.WriteLine("time for " + repetitions + " pings: " + total + "ms");
+ Console.Out.WriteLine("time per ping: " + perPing + "ms");
+
+ return 0;
}
-
- long tv2 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
- double total = (double)(tv2 - tv1);
- double perPing = total / repetitions;
-
- Console.Out.WriteLine("time for " + repetitions + " pings: " + total + "ms");
- Console.Out.WriteLine("time per ping: " + perPing + "ms");
-
- return 0;
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/latency/Server.cs b/cs/demo/Ice/latency/Server.cs
index d249a2d3767..f97d14586cc 100644
--- a/cs/demo/Ice/latency/Server.cs
+++ b/cs/demo/Ice/latency/Server.cs
@@ -7,30 +7,39 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Server : Ice.Application
+[assembly: AssemblyTitle("IceLatencyServer")]
+[assembly: AssemblyDescription("Ice latency demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int
- run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Latency");
- adapter.add(new Ping(), communicator().stringToIdentity("ping"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Latency");
+ adapter.add(new Ping(), communicator().stringToIdentity("ping"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/minimal/Client.cs b/cs/demo/Ice/minimal/Client.cs
index b3c3b52cc6d..3c327621d7c 100644
--- a/cs/demo/Ice/minimal/Client.cs
+++ b/cs/demo/Ice/minimal/Client.cs
@@ -7,8 +7,15 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceMinimalClient")]
+[assembly: AssemblyDescription("Ice minimal demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/demo/Ice/minimal/Server.cs b/cs/demo/Ice/minimal/Server.cs
index d696ae63410..d0e5066b345 100644
--- a/cs/demo/Ice/minimal/Server.cs
+++ b/cs/demo/Ice/minimal/Server.cs
@@ -8,6 +8,13 @@
// **********************************************************************
using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceMinimalServer")]
+[assembly: AssemblyDescription("Ice minimal demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/demo/Ice/multicast/Client.cs b/cs/demo/Ice/multicast/Client.cs
index 86ae847705c..4b0ee99f381 100644
--- a/cs/demo/Ice/multicast/Client.cs
+++ b/cs/demo/Ice/multicast/Client.cs
@@ -8,47 +8,58 @@
// **********************************************************************
using Demo;
+using System;
+using System.Reflection;
-public class Client : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceMulticastClient")]
+[assembly: AssemblyDescription("Ice multicast demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("DiscoverReply");
- DiscoverReplyI replyI = new DiscoverReplyI();
- DiscoverReplyPrx reply = DiscoverReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI));
- adapter.activate();
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("DiscoverReply");
+ DiscoverReplyI replyI = new DiscoverReplyI();
+ DiscoverReplyPrx reply = DiscoverReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI));
+ adapter.activate();
- DiscoverPrx discover = DiscoverPrxHelper.uncheckedCast(
- communicator().propertyToProxy("Discover.Proxy").ice_datagram());
- discover.lookup(reply);
- Ice.ObjectPrx obj = replyI.waitReply(2000);
+ DiscoverPrx discover = DiscoverPrxHelper.uncheckedCast(
+ communicator().propertyToProxy("Discover.Proxy").ice_datagram());
+ discover.lookup(reply);
+ Ice.ObjectPrx obj = replyI.waitReply(2000);
- if(obj == null)
- {
- System.Console.Error.WriteLine(appName() + ": no replies");
- return 1;
- }
- HelloPrx hello = HelloPrxHelper.checkedCast(obj);
- if(hello == null)
- {
- System.Console.Error.WriteLine(appName() + ": invalid reply");
- return 1;
- }
+ if(obj == null)
+ {
+ System.Console.Error.WriteLine(appName() + ": no replies");
+ return 1;
+ }
+ HelloPrx hello = HelloPrxHelper.checkedCast(obj);
+ if(hello == null)
+ {
+ System.Console.Error.WriteLine(appName() + ": invalid reply");
+ return 1;
+ }
- hello.sayHello();
- return 0;
+ hello.sayHello();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/multicast/Server.cs b/cs/demo/Ice/multicast/Server.cs
index 03806a61bff..4899f13ae6e 100644
--- a/cs/demo/Ice/multicast/Server.cs
+++ b/cs/demo/Ice/multicast/Server.cs
@@ -8,33 +8,44 @@
// **********************************************************************
using Demo;
+using System;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceMulticastServer")]
+[assembly: AssemblyDescription("Ice multicast demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- Ice.ObjectAdapter discoverAdapter = communicator().createObjectAdapter("Discover");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
+ Ice.ObjectAdapter discoverAdapter = communicator().createObjectAdapter("Discover");
- Ice.ObjectPrx hello = adapter.addWithUUID(new HelloI());
- discoverAdapter.add(new DiscoverI(hello), communicator().stringToIdentity("discover"));
+ Ice.ObjectPrx hello = adapter.addWithUUID(new HelloI());
+ discoverAdapter.add(new DiscoverI(hello), communicator().stringToIdentity("discover"));
- discoverAdapter.activate();
- adapter.activate();
-
- communicator().waitForShutdown();
- return 0;
+ discoverAdapter.activate();
+ adapter.activate();
+
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/nested/Client.cs b/cs/demo/Ice/nested/Client.cs
index cabfeb934dd..88ee6eacad0 100644
--- a/cs/demo/Ice/nested/Client.cs
+++ b/cs/demo/Ice/nested/Client.cs
@@ -7,72 +7,82 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceNestedClient")]
+[assembly: AssemblyDescription("Ice nested demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- NestedPrx nested = NestedPrxHelper.checkedCast(communicator().propertyToProxy("Nested.NestedServer"));
- if(nested == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
-
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Client");
- NestedPrx self =
- NestedPrxHelper.uncheckedCast(adapter.createProxy(communicator().stringToIdentity("nestedClient")));
- adapter.add(new NestedI(self), communicator().stringToIdentity("nestedClient"));
- adapter.activate();
-
- Console.Out.WriteLine("Note: The maximum nesting level is sz * 2, with sz being");
- Console.Out.WriteLine("the maximum number of threads in the server thread pool. If");
- Console.Out.WriteLine("you specify a value higher than that, the application will");
- Console.Out.WriteLine("block or timeout.");
- Console.Out.WriteLine();
-
- string s = null;
- do
- {
- try
+ NestedPrx nested = NestedPrxHelper.checkedCast(communicator().propertyToProxy("Nested.NestedServer"));
+ if(nested == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
+
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Client");
+ NestedPrx self =
+ NestedPrxHelper.uncheckedCast(adapter.createProxy(communicator().stringToIdentity("nestedClient")));
+ adapter.add(new NestedI(self), communicator().stringToIdentity("nestedClient"));
+ adapter.activate();
+
+ Console.Out.WriteLine("Note: The maximum nesting level is sz * 2, with sz being");
+ Console.Out.WriteLine("the maximum number of threads in the server thread pool. If");
+ Console.Out.WriteLine("you specify a value higher than that, the application will");
+ Console.Out.WriteLine("block or timeout.");
+ Console.Out.WriteLine();
+
+ string s = null;
+ do
{
- Console.Out.Write("enter nesting level or 'x' for exit: ");
- Console.Out.Flush();
- s = Console.In.ReadLine();
- if(s == null)
+ try
{
- break;
+ Console.Out.Write("enter nesting level or 'x' for exit: ");
+ Console.Out.Flush();
+ s = Console.In.ReadLine();
+ if(s == null)
+ {
+ break;
+ }
+ int level = System.Int32.Parse(s);
+ if(level > 0)
+ {
+ nested.nestedCall(level, self);
+ }
}
- int level = System.Int32.Parse(s);
- if(level > 0)
+ catch(System.FormatException)
{
- nested.nestedCall(level, self);
+ }
+ catch(System.Exception ex)
+ {
+ Console.Error.WriteLine(ex);
}
}
- catch(System.FormatException)
- {
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
+ while(!s.Equals("x"));
+
+ return 0;
}
- while(!s.Equals("x"));
-
- return 0;
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/nested/Server.cs b/cs/demo/Ice/nested/Server.cs
index 37282ffdda0..33f1f1013bd 100644
--- a/cs/demo/Ice/nested/Server.cs
+++ b/cs/demo/Ice/nested/Server.cs
@@ -8,29 +8,40 @@
// **********************************************************************
using Demo;
+using System;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceNestedServer")]
+[assembly: AssemblyDescription("Ice nested demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Server");
- NestedPrx self =
- NestedPrxHelper.uncheckedCast(adapter.createProxy(communicator().stringToIdentity("nestedServer")));
- adapter.add(new NestedI(self), communicator().stringToIdentity("nestedServer"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Nested.Server");
+ NestedPrx self =
+ NestedPrxHelper.uncheckedCast(adapter.createProxy(communicator().stringToIdentity("nestedServer")));
+ adapter.add(new NestedI(self), communicator().stringToIdentity("nestedServer"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/session/Client.cs b/cs/demo/Ice/session/Client.cs
index 3072a3bbead..bb6178d4df5 100644
--- a/cs/demo/Ice/session/Client.cs
+++ b/cs/demo/Ice/session/Client.cs
@@ -7,213 +7,223 @@
//
// **********************************************************************
+using Demo;
using System;
using System.Threading;
-using System.Collections;
-using Demo;
+using System.Collections.Generic;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceSessionClient")]
+[assembly: AssemblyDescription("Ice session demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- class SessionRefreshThread
+ public class App : Ice.Application
{
- public SessionRefreshThread(Ice.Logger logger, int timeout, SessionPrx session)
+ class SessionRefreshThread
{
- _logger = logger;
- _session = session;
- _timeout = timeout;
- _terminated = false;
- }
+ public SessionRefreshThread(Ice.Logger logger, int timeout, SessionPrx session)
+ {
+ _logger = logger;
+ _session = session;
+ _timeout = timeout;
+ _terminated = false;
+ }
- public void run()
- {
- lock(this)
+ public void run()
{
- while(!_terminated)
+ lock(this)
{
- System.Threading.Monitor.Wait(this, _timeout);
- if(!_terminated)
+ while(!_terminated)
{
- try
- {
- _session.refresh();
- }
- catch(Ice.Exception ex)
+ Monitor.Wait(this, _timeout);
+ if(!_terminated)
{
- _logger.warning("SessionRefreshThread: " + ex);
- _terminated = true;
+ try
+ {
+ _session.refresh();
+ }
+ catch(Ice.Exception ex)
+ {
+ _logger.warning("SessionRefreshThread: " + ex);
+ _terminated = true;
+ }
}
}
}
}
- }
- public void terminate()
- {
- lock(this)
+ public void terminate()
{
- _terminated = true;
- System.Threading.Monitor.Pulse(this);
+ lock(this)
+ {
+ _terminated = true;
+ Monitor.Pulse(this);
+ }
}
- }
- private Ice.Logger _logger;
- private SessionPrx _session;
- private int _timeout;
- private bool _terminated;
- }
-
- public override int run(string[] args)
- {
- if(args.Length > 0)
- {
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
+ private Ice.Logger _logger;
+ private SessionPrx _session;
+ private int _timeout;
+ private bool _terminated;
}
- string name;
- do
+ public override int run(string[] args)
{
- Console.Out.Write("Please enter your name ==> ");
- Console.Out.Flush();
-
- name = Console.In.ReadLine();
- if(name == null)
+ if(args.Length > 0)
{
+ Console.Error.WriteLine(appName() + ": too many arguments");
return 1;
}
- name = name.Trim();
- }
- while(name.Length == 0);
- Ice.ObjectPrx basePrx = communicator().propertyToProxy("SessionFactory.Proxy");
- SessionFactoryPrx factory = SessionFactoryPrxHelper.checkedCast(basePrx);
- if(factory == null)
- {
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
+ string name;
+ do
+ {
+ Console.Out.Write("Please enter your name ==> ");
+ Console.Out.Flush();
+
+ name = Console.In.ReadLine();
+ if(name == null)
+ {
+ return 1;
+ }
+ name = name.Trim();
+ }
+ while(name.Length == 0);
- SessionPrx session = factory.create(name);
+ Ice.ObjectPrx basePrx = communicator().propertyToProxy("SessionFactory.Proxy");
+ SessionFactoryPrx factory = SessionFactoryPrxHelper.checkedCast(basePrx);
+ if(factory == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
- SessionRefreshThread refresh = new SessionRefreshThread(communicator().getLogger(), 5000, session);
- Thread refreshThread = new Thread(new ThreadStart(refresh.run));
- refreshThread.Start();
+ SessionPrx session = factory.create(name);
- ArrayList hellos = new ArrayList();
+ SessionRefreshThread refresh = new SessionRefreshThread(communicator().getLogger(), 5000, session);
+ Thread refreshThread = new Thread(new ThreadStart(refresh.run));
+ refreshThread.Start();
- menu();
+ List<HelloPrx> hellos = new List<HelloPrx>();
- try
- {
- bool destroy = true;
- bool shutdown = false;
- while(true)
+ menu();
+
+ try
{
- Console.Out.Write("==> ");
- Console.Out.Flush();
- string line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Length > 0 && Char.IsDigit(line[0]))
+ bool destroy = true;
+ bool shutdown = false;
+ while(true)
{
- int index = Int32.Parse(line);
- if(index < hellos.Count)
+ Console.Out.Write("==> ");
+ Console.Out.Flush();
+ string line = Console.In.ReadLine();
+ if(line == null)
+ {
+ break;
+ }
+ if(line.Length > 0 && Char.IsDigit(line[0]))
+ {
+ int index = Int32.Parse(line);
+ if(index < hellos.Count)
+ {
+ HelloPrx hello = hellos[index];
+ hello.sayHello();
+ }
+ else
+ {
+ Console.Out.WriteLine("Index is too high. " + hellos.Count +
+ " hello objects exist so far.\n" +
+ "Use `c' to create a new hello object.");
+ }
+ }
+ else if(line.Equals("c"))
+ {
+ hellos.Add(session.createHello());
+ Console.Out.WriteLine("Created hello object " + (hellos.Count - 1));
+ }
+ else if(line.Equals("s"))
+ {
+ destroy = false;
+ shutdown = true;
+ break;
+ }
+ else if(line.Equals("x"))
+ {
+ break;
+ }
+ else if(line.Equals("t"))
{
- HelloPrx hello = (HelloPrx)hellos[index];
- hello.sayHello();
+ destroy = false;
+ break;
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
}
else
{
- Console.Out.WriteLine("Index is too high. " + hellos.Count +
- " hello objects exist so far.\n" +
- "Use `c' to create a new hello object.");
+ Console.Out.WriteLine("Unknown command `" + line + "'.");
+ menu();
}
}
- else if(line.Equals("c"))
- {
- hellos.Add(session.createHello());
- Console.Out.WriteLine("Created hello object " + (hellos.Count - 1));
- }
- else if(line.Equals("s"))
- {
- destroy = false;
- shutdown = true;
- break;
- }
- else if(line.Equals("x"))
- {
- break;
- }
- else if(line.Equals("t"))
+
+ //
+ // The refresher thread must be terminated before destroy is
+ // called, otherwise it might get ObjectNotExistException. refresh
+ // is set to 0 so that if session.destroy() raises an exception
+ // the thread will not be re-terminated and re-joined.
+ //
+ refresh.terminate();
+ refreshThread.Join();
+ refresh = null;
+
+ if(destroy)
{
- destroy = false;
- break;
+ session.destroy();
}
- else if(line.Equals("?"))
+ if(shutdown)
{
- menu();
+ factory.shutdown();
}
- else
+ }
+ catch(System.Exception)
+ {
+ //
+ // The refresher thread must be terminated in the event of a
+ // failure.
+ //
+ if(refresh != null)
{
- Console.Out.WriteLine("Unknown command `" + line + "'.");
- menu();
+ refresh.terminate();
+ refreshThread.Join();
+ refresh = null;
}
+ throw;
}
- //
- // The refresher thread must be terminated before destroy is
- // called, otherwise it might get ObjectNotExistException. refresh
- // is set to 0 so that if session.destroy() raises an exception
- // the thread will not be re-terminated and re-joined.
- //
- refresh.terminate();
- refreshThread.Join();
- refresh = null;
-
- if(destroy)
- {
- session.destroy();
- }
- if(shutdown)
- {
- factory.shutdown();
- }
+ return 0;
}
- catch(System.Exception)
+
+ private static void menu()
{
- //
- // The refresher thread must be terminated in the event of a
- // failure.
- //
- if(refresh != null)
- {
- refresh.terminate();
- refreshThread.Join();
- refresh = null;
- }
- throw;
+ Console.Out.WriteLine(
+ "usage:\n" +
+ "c: create a new per-client hello object\n" +
+ "0-9: send a greeting to a hello object\n" +
+ "s: shutdown the server and exit\n" +
+ "x: exit\n" +
+ "t: exit without destroying the session\n" +
+ "?: help\n");
}
-
- return 0;
- }
-
- private static void menu()
- {
- Console.Out.WriteLine(
- "usage:\n" +
- "c: create a new per-client hello object\n" +
- "0-9: send a greeting to a hello object\n" +
- "s: shutdown the server and exit\n" +
- "x: exit\n" +
- "t: exit without destroying the session\n" +
- "?: help\n");
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/session/Server.cs b/cs/demo/Ice/session/Server.cs
index 6c0f9c5a922..00c16e9af6f 100644
--- a/cs/demo/Ice/session/Server.cs
+++ b/cs/demo/Ice/session/Server.cs
@@ -7,39 +7,49 @@
//
// **********************************************************************
+using Demo;
using System;
using System.Threading;
-using Demo;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Server : Ice.Application
+[assembly: AssemblyTitle("IceSessionServer")]
+[assembly: AssemblyDescription("Ice session demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionFactory");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SessionFactory");
- ReapThread reaper = new ReapThread();
- Thread reaperThread = new Thread(new ThreadStart(reaper.run));
- reaperThread.Start();
+ ReapThread reaper = new ReapThread();
+ Thread reaperThread = new Thread(new ThreadStart(reaper.run));
+ reaperThread.Start();
- adapter.add(new SessionFactoryI(reaper), communicator().stringToIdentity("SessionFactory"));
- adapter.activate();
- communicator().waitForShutdown();
+ adapter.add(new SessionFactoryI(reaper), communicator().stringToIdentity("SessionFactory"));
+ adapter.activate();
+ communicator().waitForShutdown();
- reaper.terminate();
- reaperThread.Join();
+ reaper.terminate();
+ reaperThread.Join();
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/throughput/Client.cs b/cs/demo/Ice/throughput/Client.cs
index ca763c874fa..32c8fd7bbde 100644
--- a/cs/demo/Ice/throughput/Client.cs
+++ b/cs/demo/Ice/throughput/Client.cs
@@ -7,425 +7,434 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceThroughputClient")]
+[assembly: AssemblyDescription("Ice throughput demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- private static void menu()
- {
- Console.WriteLine("usage:\n"
- + "\n"
- + "toggle type of data to send:\n"
- + "1: sequence of bytes (default)\n"
- + "2: sequence of strings (\"hello\")\n"
- + "3: sequence of structs with a string (\"hello\") and a double\n"
- + "4: sequence of structs with two ints and a double\n"
- + "\n"
- + "select test to run:\n"
- + "t: Send sequence as twoway\n"
- + "o: Send sequence as oneway\n"
- + "r: Receive sequence\n"
- + "e: Echo (send and receive) sequence\n"
- + "\n"
- + "other commands\n"
- + "s: shutdown server\n"
- + "x: exit\n"
- + "?: help\n");
- }
-
- public override int
- run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ private static void menu()
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
+ Console.WriteLine("usage:\n"
+ + "\n"
+ + "toggle type of data to send:\n"
+ + "1: sequence of bytes (default)\n"
+ + "2: sequence of strings (\"hello\")\n"
+ + "3: sequence of structs with a string (\"hello\") and a double\n"
+ + "4: sequence of structs with two ints and a double\n"
+ + "\n"
+ + "select test to run:\n"
+ + "t: Send sequence as twoway\n"
+ + "o: Send sequence as oneway\n"
+ + "r: Receive sequence\n"
+ + "e: Echo (send and receive) sequence\n"
+ + "\n"
+ + "other commands\n"
+ + "s: shutdown server\n"
+ + "x: exit\n"
+ + "?: help\n");
}
-
- Ice.ObjectPrx b = communicator().propertyToProxy("Throughput.Throughput");
- ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(b);
- if(throughput == null)
+
+ public override int run(string[] args)
{
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
- ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
-
- byte[] byteSeq = new byte[ByteSeqSize.value];
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- string[] stringSeq = new string[StringSeqSize.value];
- for(int i = 0; i < StringSeqSize.value; ++i)
- {
- stringSeq[i] = "hello";
- }
+ Ice.ObjectPrx b = communicator().propertyToProxy("Throughput.Throughput");
+ ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(b);
+ if(throughput == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
+ ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
- StringDouble[] structSeq = new StringDouble[StringDoubleSeqSize.value];
- for(int i = 0; i < StringDoubleSeqSize.value; ++i)
- {
- structSeq[i] = new StringDouble();
- structSeq[i].s = "hello";
- structSeq[i].d = 3.14;
- }
+ byte[] byteSeq = new byte[ByteSeqSize.value];
- Fixed[] fixedSeq = new Fixed[FixedSeqSize.value];
- for(int i = 0; i < FixedSeqSize.value; ++i)
- {
- fixedSeq[i].i = 0;
- fixedSeq[i].j = 0;
- fixedSeq[i].d = 0;
- }
+ string[] stringSeq = new string[StringSeqSize.value];
+ for(int i = 0; i < StringSeqSize.value; ++i)
+ {
+ stringSeq[i] = "hello";
+ }
- //
- // A method needs to be invoked thousands of times before the
- // JIT compiler will convert it to native code. To ensure an
- // accurate throughput measurement, we need to "warm up" the
- // JIT compiler.
- //
- {
- byte[] emptyBytes = new byte[1];
- string[] emptyStrings = new string[1];
- StringDouble[] emptyStructs = new StringDouble[1];
- emptyStructs[0] = new StringDouble();
- Fixed[] emptyFixed = new Fixed[1];
+ StringDouble[] structSeq = new StringDouble[StringDoubleSeqSize.value];
+ for(int i = 0; i < StringDoubleSeqSize.value; ++i)
+ {
+ structSeq[i] = new StringDouble();
+ structSeq[i].s = "hello";
+ structSeq[i].d = 3.14;
+ }
- throughput.startWarmup();
+ Fixed[] fixedSeq = new Fixed[FixedSeqSize.value];
+ for(int i = 0; i < FixedSeqSize.value; ++i)
+ {
+ fixedSeq[i].i = 0;
+ fixedSeq[i].j = 0;
+ fixedSeq[i].d = 0;
+ }
- Console.Error.Write("warming up the client/server...");
- Console.Error.Flush();
- for(int i = 0; i < 10000; i++)
+ //
+ // A method needs to be invoked thousands of times before the
+ // JIT compiler will convert it to native code. To ensure an
+ // accurate throughput measurement, we need to "warm up" the
+ // JIT compiler.
+ //
{
- throughput.sendByteSeq(emptyBytes);
- throughput.sendStringSeq(emptyStrings);
- throughput.sendStructSeq(emptyStructs);
- throughput.sendFixedSeq(emptyFixed);
+ byte[] emptyBytes = new byte[1];
+ string[] emptyStrings = new string[1];
+ StringDouble[] emptyStructs = new StringDouble[1];
+ emptyStructs[0] = new StringDouble();
+ Fixed[] emptyFixed = new Fixed[1];
- throughput.recvByteSeq();
- throughput.recvStringSeq();
- throughput.recvStructSeq();
- throughput.recvFixedSeq();
+ throughput.startWarmup();
- throughput.echoByteSeq(emptyBytes);
- throughput.echoStringSeq(emptyStrings);
- throughput.echoStructSeq(emptyStructs);
- throughput.echoFixedSeq(emptyFixed);
- }
- throughput.endWarmup();
+ Console.Error.Write("warming up the client/server...");
+ Console.Error.Flush();
+ for(int i = 0; i < 10000; i++)
+ {
+ throughput.sendByteSeq(emptyBytes);
+ throughput.sendStringSeq(emptyStrings);
+ throughput.sendStructSeq(emptyStructs);
+ throughput.sendFixedSeq(emptyFixed);
- Console.Error.WriteLine("ok");
- }
-
- menu();
-
- //
- // By default use byte sequence.
- //
- char currentType = '1';
- int seqSize = ByteSeqSize.value;
+ throughput.recvByteSeq();
+ throughput.recvStringSeq();
+ throughput.recvStructSeq();
+ throughput.recvFixedSeq();
- string line = null;
- do
- {
- try
- {
- Console.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
+ throughput.echoByteSeq(emptyBytes);
+ throughput.echoStringSeq(emptyStrings);
+ throughput.echoStructSeq(emptyStructs);
+ throughput.echoFixedSeq(emptyFixed);
}
+ throughput.endWarmup();
- long tmsec = System.DateTime.Now.Ticks / 10000;
- const int repetitions = 100;
+ Console.Error.WriteLine("ok");
+ }
+
+ menu();
+
+ //
+ // By default use byte sequence.
+ //
+ char currentType = '1';
+ int seqSize = ByteSeqSize.value;
- if(line.Equals("1") || line.Equals("2") || line.Equals("3") || line.Equals("4"))
+ string line = null;
+ do
+ {
+ try
{
- currentType = line[0];
- switch(currentType)
+ Console.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
{
- case '1':
- {
- Console.WriteLine("using byte sequences");
- seqSize = ByteSeqSize.value;
- break;
- }
- case '2':
- {
- Console.WriteLine("using string sequences");
- seqSize = StringSeqSize.value;
- break;
- }
- case '3':
- {
- Console.WriteLine("using variable-length struct sequences");
- seqSize = StringDoubleSeqSize.value;
- break;
- }
- case '4':
- {
- Console.WriteLine("using fixed-length struct sequences");
- seqSize = FixedSeqSize.value;
- break;
- }
- }
- }
- else if(line.Equals("t") || line.Equals("o") || line.Equals("r") || line.Equals("e"))
- {
- char c = line[0];
- switch (c)
- {
- case 't':
- {
- Console.Write("sending");
- break;
- }
- case 'o':
- {
- Console.Write("sending");
- break;
- }
- case 'r':
- {
- Console.Write("receiving");
- break;
- }
- case 'e':
- {
- Console.Write("sending and receiving");
- break;
- }
+ break;
}
-
- Console.Write(" " + repetitions);
- switch(currentType)
+
+ long tmsec = System.DateTime.Now.Ticks / 10000;
+ const int repetitions = 100;
+
+ if(line.Equals("1") || line.Equals("2") || line.Equals("3") || line.Equals("4"))
{
- case '1':
- {
- Console.Write(" byte");
- break;
- }
- case '2':
+ currentType = line[0];
+ switch(currentType)
{
- Console.Write(" string");
- break;
+ case '1':
+ {
+ Console.WriteLine("using byte sequences");
+ seqSize = ByteSeqSize.value;
+ break;
+ }
+ case '2':
+ {
+ Console.WriteLine("using string sequences");
+ seqSize = StringSeqSize.value;
+ break;
+ }
+ case '3':
+ {
+ Console.WriteLine("using variable-length struct sequences");
+ seqSize = StringDoubleSeqSize.value;
+ break;
+ }
+ case '4':
+ {
+ Console.WriteLine("using fixed-length struct sequences");
+ seqSize = FixedSeqSize.value;
+ break;
+ }
+ }
+ }
+ else if(line.Equals("t") || line.Equals("o") || line.Equals("r") || line.Equals("e"))
+ {
+ char c = line[0];
+ switch (c)
+ {
+ case 't':
+ {
+ Console.Write("sending");
+ break;
+ }
+ case 'o':
+ {
+ Console.Write("sending");
+ break;
+ }
+ case 'r':
+ {
+ Console.Write("receiving");
+ break;
+ }
+ case 'e':
+ {
+ Console.Write("sending and receiving");
+ break;
+ }
}
- case '3':
+
+ Console.Write(" " + repetitions);
+ switch(currentType)
{
- Console.Write(" variable-length struct");
- break;
+ case '1':
+ {
+ Console.Write(" byte");
+ break;
+ }
+ case '2':
+ {
+ Console.Write(" string");
+ break;
+ }
+ case '3':
+ {
+ Console.Write(" variable-length struct");
+ break;
+ }
+ case '4':
+ {
+ Console.Write(" fixed-length struct");
+ break;
+ }
}
- case '4':
+ Console.Write(" sequences of size " + seqSize);
+
+ if(c == 'o')
{
- Console.Write(" fixed-length struct");
- break;
+ Console.Write(" as oneway");
}
- }
- Console.Write(" sequences of size " + seqSize);
-
- if(c == 'o')
- {
- Console.Write(" as oneway");
- }
-
- Console.WriteLine("...");
-
- for (int i = 0; i < repetitions; ++i)
- {
- switch(currentType)
+
+ Console.WriteLine("...");
+
+ for (int i = 0; i < repetitions; ++i)
{
- case '1':
+ switch(currentType)
{
- switch(c)
+ case '1':
{
- case 't':
+ switch(c)
{
- throughput.sendByteSeq(byteSeq);
- break;
- }
+ case 't':
+ {
+ throughput.sendByteSeq(byteSeq);
+ break;
+ }
- case 'o':
- {
- throughputOneway.sendByteSeq(byteSeq);
- break;
- }
+ case 'o':
+ {
+ throughputOneway.sendByteSeq(byteSeq);
+ break;
+ }
- case 'r':
- {
- throughput.recvByteSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoByteSeq(byteSeq);
- break;
+ case 'r':
+ {
+ throughput.recvByteSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoByteSeq(byteSeq);
+ break;
+ }
}
+ break;
}
- break;
- }
- case '2':
- {
- switch(c)
+ case '2':
{
- case 't':
+ switch(c)
{
- throughput.sendStringSeq(stringSeq);
- break;
- }
+ case 't':
+ {
+ throughput.sendStringSeq(stringSeq);
+ break;
+ }
- case 'o':
- {
- throughputOneway.sendStringSeq(stringSeq);
- break;
- }
+ case 'o':
+ {
+ throughputOneway.sendStringSeq(stringSeq);
+ break;
+ }
- case 'r':
- {
- throughput.recvStringSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoStringSeq(stringSeq);
- break;
+ case 'r':
+ {
+ throughput.recvStringSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoStringSeq(stringSeq);
+ break;
+ }
}
+ break;
}
- break;
- }
-
- case '3':
- {
- switch(c)
+
+ case '3':
{
- case 't':
+ switch(c)
{
- throughput.sendStructSeq(structSeq);
- break;
- }
+ case 't':
+ {
+ throughput.sendStructSeq(structSeq);
+ break;
+ }
- case 'o':
- {
- throughputOneway.sendStructSeq(structSeq);
- break;
- }
+ case 'o':
+ {
+ throughputOneway.sendStructSeq(structSeq);
+ break;
+ }
- case 'r':
- {
- throughput.recvStructSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoStructSeq(structSeq);
- break;
+ case 'r':
+ {
+ throughput.recvStructSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoStructSeq(structSeq);
+ break;
+ }
}
+ break;
}
- break;
- }
- case '4':
- {
- switch(c)
+ case '4':
{
- case 't':
+ switch(c)
{
- throughput.sendFixedSeq(fixedSeq);
- break;
- }
+ case 't':
+ {
+ throughput.sendFixedSeq(fixedSeq);
+ break;
+ }
- case 'o':
- {
- throughputOneway.sendFixedSeq(fixedSeq);
- break;
- }
+ case 'o':
+ {
+ throughputOneway.sendFixedSeq(fixedSeq);
+ break;
+ }
- case 'r':
- {
- throughput.recvFixedSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoFixedSeq(fixedSeq);
- break;
+ case 'r':
+ {
+ throughput.recvFixedSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoFixedSeq(fixedSeq);
+ break;
+ }
}
+ break;
}
- break;
}
}
- }
-
- double dmsec = System.DateTime.Now.Ticks / 10000 - tmsec;
- Console.WriteLine("time for " + repetitions + " sequences: " + dmsec.ToString("F") + "ms");
- Console.WriteLine("time per sequence: " + ((double)(dmsec / repetitions)).ToString("F") + "ms");
- int wireSize = 0;
- switch(currentType)
- {
- case '1':
- {
- wireSize = 1;
- break;
- }
- case '2':
- {
- wireSize = stringSeq[0].Length;
- break;
- }
- case '3':
+
+ double dmsec = System.DateTime.Now.Ticks / 10000 - tmsec;
+ Console.WriteLine("time for " + repetitions + " sequences: " + dmsec.ToString("F") + "ms");
+ Console.WriteLine("time per sequence: " + ((double)(dmsec / repetitions)).ToString("F") + "ms");
+ int wireSize = 0;
+ switch(currentType)
{
- wireSize = structSeq[0].s.Length;
- wireSize += 8; // Size of double on the wire.
- break;
+ case '1':
+ {
+ wireSize = 1;
+ break;
+ }
+ case '2':
+ {
+ wireSize = stringSeq[0].Length;
+ break;
+ }
+ case '3':
+ {
+ wireSize = structSeq[0].s.Length;
+ wireSize += 8; // Size of double on the wire.
+ break;
+ }
+ case '4':
+ {
+ wireSize = 16; // Sizes of two ints and a double on the wire.
+ break;
+ }
}
- case '4':
+ double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
+ if(c == 'e')
{
- wireSize = 16; // Sizes of two ints and a double on the wire.
- break;
+ mbit *= 2;
}
+ Console.WriteLine("throughput: " + mbit.ToString("#.##") + "Mbps");
}
- double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
- if(c == 'e')
+ else if(line.Equals("s"))
{
- mbit *= 2;
+ throughput.shutdown();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ Console.WriteLine("unknown command `" + line + "'");
+ menu();
}
- Console.WriteLine("throughput: " + mbit.ToString("#.##") + "Mbps");
- }
- else if(line.Equals("s"))
- {
- throughput.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
}
- else
+ catch(System.Exception ex)
{
- Console.WriteLine("unknown command `" + line + "'");
- menu();
+ Console.Error.WriteLine(ex);
}
}
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
+ while(!line.Equals("x"));
+
+ return 0;
}
- while(!line.Equals("x"));
-
- return 0;
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/throughput/Server.cs b/cs/demo/Ice/throughput/Server.cs
index 7876ef284fd..3ed018453de 100644
--- a/cs/demo/Ice/throughput/Server.cs
+++ b/cs/demo/Ice/throughput/Server.cs
@@ -7,27 +7,38 @@
//
// **********************************************************************
-public class Server : Ice.Application
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceThroughputServer")]
+[assembly: AssemblyDescription("Ice throughput demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int
- run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Throughput");
- adapter.add(new ThroughputI(), communicator().stringToIdentity("throughput"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Throughput");
+ adapter.add(new ThroughputI(), communicator().stringToIdentity("throughput"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/Ice/value/Client.cs b/cs/demo/Ice/value/Client.cs
index 223f7e14430..24d486ced8c 100644
--- a/cs/demo/Ice/value/Client.cs
+++ b/cs/demo/Ice/value/Client.cs
@@ -7,158 +7,168 @@
//
// **********************************************************************
+using Demo;
using System;
using System.Diagnostics;
-using Demo;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceValueClient")]
+[assembly: AssemblyDescription("Ice value demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
+
+ Ice.ObjectPrx @base = communicator().propertyToProxy("Value.Initial");
+ InitialPrx initial = InitialPrxHelper.checkedCast(@base);
+ if(initial == null)
+ {
+ Console.Error.WriteLine("invalid object reference");
+ return 1;
+ }
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Let's first transfer a simple object, for a class without");
+ Console.Out.WriteLine("operations, and print its contents. No factory is required");
+ Console.Out.WriteLine("for this.");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ Simple simple = initial.getSimple();
+ Console.Out.WriteLine("==> " + simple.message);
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Yes, this worked. Now let's try to transfer an object for a class");
+ Console.Out.WriteLine("with operations as type Demo.Printer, without installing a factory first.");
+ Console.Out.WriteLine("This should give us a `no factory' exception.");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ Printer printer;
+ PrinterPrx printerProxy;
+ try
+ {
+ initial.getPrinter(out printer, out printerProxy);
+ Console.Error.WriteLine("Did not get the expected NoObjectFactoryException!");
+ Environment.Exit(1);
+ }
+ catch(Ice.NoObjectFactoryException ex)
+ {
+ Console.Out.WriteLine("==> " + ex);
+ }
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Yep, that's what we expected. Now let's try again, but with");
+ Console.Out.WriteLine("installing an appropriate factory first. If successful, we print");
+ Console.Out.WriteLine("the object's content.");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ Ice.ObjectFactory factory = new ObjectFactory();
+ communicator().addObjectFactory(factory, "::Demo::Printer");
- Ice.ObjectPrx @base = communicator().propertyToProxy("Value.Initial");
- InitialPrx initial = InitialPrxHelper.checkedCast(@base);
- if(initial == null)
- {
- Console.Error.WriteLine("invalid object reference");
- return 1;
- }
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Let's first transfer a simple object, for a class without");
- Console.Out.WriteLine("operations, and print its contents. No factory is required");
- Console.Out.WriteLine("for this.");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- Simple simple = initial.getSimple();
- Console.Out.WriteLine("==> " + simple.message);
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Yes, this worked. Now let's try to transfer an object for a class");
- Console.Out.WriteLine("with operations as type Demo.Printer, without installing a factory first.");
- Console.Out.WriteLine("This should give us a `no factory' exception.");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- Printer printer;
- PrinterPrx printerProxy;
- try
- {
initial.getPrinter(out printer, out printerProxy);
- Console.Error.WriteLine("Did not get the expected NoObjectFactoryException!");
- Environment.Exit(1);
- }
- catch(Ice.NoObjectFactoryException ex)
- {
- Console.Out.WriteLine("==> " + ex);
- }
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Yep, that's what we expected. Now let's try again, but with");
- Console.Out.WriteLine("installing an appropriate factory first. If successful, we print");
- Console.Out.WriteLine("the object's content.");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- Ice.ObjectFactory factory = new ObjectFactory();
- communicator().addObjectFactory(factory, "::Demo::Printer");
-
- initial.getPrinter(out printer, out printerProxy);
- Console.Out.WriteLine("==> " + printer.message);
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Cool, it worked! Let's try calling the printBackwards() method");
- Console.Out.WriteLine("on the object we just received locally.");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- Console.Out.Write("==> ");
- printer.printBackwards();
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Now we call the same method, but on the remote object. Watch the");
- Console.Out.WriteLine("server's output.");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- printerProxy.printBackwards();
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Next, we transfer a derived object from the server as a base");
- Console.Out.WriteLine("object. Since we haven't yet installed a factory for the derived");
- Console.Out.WriteLine("class, the derived class (Demo.DerivedPrinter) is sliced");
- Console.Out.WriteLine("to its base class (Demo.Printer).");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- Printer derivedAsBase = initial.getDerivedPrinter();
- Console.Out.WriteLine("==> The type ID of the received object is \"" + derivedAsBase.ice_id() + "\"");
- Debug.Assert(derivedAsBase.ice_id().Equals("::Demo::Printer"));
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Now we install a factory for the derived class, and try again.");
- Console.Out.WriteLine("Because we receive the derived object as a base object,");
- Console.Out.WriteLine("we need to do a class cast to get from the base to the derived object.");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- communicator().addObjectFactory(factory, "::Demo::DerivedPrinter");
-
- derivedAsBase = initial.getDerivedPrinter();
- DerivedPrinter derived = (DerivedPrinter)derivedAsBase;
-
- Console.Out.WriteLine("==> class cast to derived object succeded");
- Console.Out.WriteLine("==> The type ID of the received object is \"" + derived.ice_id() + "\"");
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Let's print the message contained in the derived object, and");
- Console.Out.WriteLine("call the operation printUppercase() on the derived object");
- Console.Out.WriteLine("locally.");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- Console.Out.WriteLine("==> " + derived.derivedMessage);
- Console.Out.Write("==> ");
- derived.printUppercase();
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("Finally, we try the same again, but instead of returning the");
- Console.Out.WriteLine("derived object, we throw an exception containing the derived");
- Console.Out.WriteLine("object.");
- Console.Out.WriteLine("[press enter]");
- Console.In.ReadLine();
-
- try
- {
- initial.throwDerivedPrinter();
- }
- catch(DerivedPrinterException ex)
- {
- derived = ex.derived;
- Debug.Assert(derived != null);
+ Console.Out.WriteLine("==> " + printer.message);
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Cool, it worked! Let's try calling the printBackwards() method");
+ Console.Out.WriteLine("on the object we just received locally.");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ Console.Out.Write("==> ");
+ printer.printBackwards();
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Now we call the same method, but on the remote object. Watch the");
+ Console.Out.WriteLine("server's output.");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ printerProxy.printBackwards();
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Next, we transfer a derived object from the server as a base");
+ Console.Out.WriteLine("object. Since we haven't yet installed a factory for the derived");
+ Console.Out.WriteLine("class, the derived class (Demo.DerivedPrinter) is sliced");
+ Console.Out.WriteLine("to its base class (Demo.Printer).");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ Printer derivedAsBase = initial.getDerivedPrinter();
+ Console.Out.WriteLine("==> The type ID of the received object is \"" + derivedAsBase.ice_id() + "\"");
+ Debug.Assert(derivedAsBase.ice_id().Equals("::Demo::Printer"));
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Now we install a factory for the derived class, and try again.");
+ Console.Out.WriteLine("Because we receive the derived object as a base object,");
+ Console.Out.WriteLine("we need to do a class cast to get from the base to the derived object.");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ communicator().addObjectFactory(factory, "::Demo::DerivedPrinter");
+
+ derivedAsBase = initial.getDerivedPrinter();
+ DerivedPrinter derived = (DerivedPrinter)derivedAsBase;
+
+ Console.Out.WriteLine("==> class cast to derived object succeded");
+ Console.Out.WriteLine("==> The type ID of the received object is \"" + derived.ice_id() + "\"");
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Let's print the message contained in the derived object, and");
+ Console.Out.WriteLine("call the operation printUppercase() on the derived object");
+ Console.Out.WriteLine("locally.");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ Console.Out.WriteLine("==> " + derived.derivedMessage);
+ Console.Out.Write("==> ");
+ derived.printUppercase();
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("Finally, we try the same again, but instead of returning the");
+ Console.Out.WriteLine("derived object, we throw an exception containing the derived");
+ Console.Out.WriteLine("object.");
+ Console.Out.WriteLine("[press enter]");
+ Console.In.ReadLine();
+
+ try
+ {
+ initial.throwDerivedPrinter();
+ }
+ catch(DerivedPrinterException ex)
+ {
+ derived = ex.derived;
+ Debug.Assert(derived != null);
+ }
+
+ Console.Out.WriteLine("==> " + derived.derivedMessage);
+ Console.Out.Write("==> ");
+ derived.printUppercase();
+
+ Console.Out.WriteLine();
+ Console.Out.WriteLine("That's it for this demo. Have fun with Ice!");
+
+ initial.shutdown();
+
+ return 0;
}
-
- Console.Out.WriteLine("==> " + derived.derivedMessage);
- Console.Out.Write("==> ");
- derived.printUppercase();
-
- Console.Out.WriteLine();
- Console.Out.WriteLine("That's it for this demo. Have fun with Ice!");
-
- initial.shutdown();
-
- return 0;
}
-
+
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/Ice/value/Server.cs b/cs/demo/Ice/value/Server.cs
index 91781f109b5..e77bad8cdd0 100644
--- a/cs/demo/Ice/value/Server.cs
+++ b/cs/demo/Ice/value/Server.cs
@@ -7,27 +7,39 @@
//
// **********************************************************************
-public class Server : Ice.Application
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceValueServer")]
+[assembly: AssemblyDescription("Ice value demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Value");
- Ice.Object @object = new InitialI(adapter);
- adapter.add(@object, communicator().stringToIdentity("initial"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Value");
+ Ice.Object @object = new InitialI(adapter);
+ adapter.add(@object, communicator().stringToIdentity("initial"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
-
+
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args, "config.server");
if(status != 0)
{
diff --git a/cs/demo/IceBox/hello/Client.cs b/cs/demo/IceBox/hello/Client.cs
index 3b88359433e..dc15991287f 100644
--- a/cs/demo/IceBox/hello/Client.cs
+++ b/cs/demo/IceBox/hello/Client.cs
@@ -7,165 +7,175 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
-public class Client : Ice.Application
-{
- private static void menu()
- {
- Console.Write(
- "usage:\n" +
- "t: send greeting as twoway\n" +
- "o: send greeting as oneway\n" +
- "O: send greeting as batch oneway\n" +
- "d: send greeting as datagram\n" +
- "D: send greeting as batch datagram\n" +
- "f: flush all batch requests\n");
- if(_haveSSL)
- {
- Console.Write("\nS: switch secure mode on/off");
- }
- Console.WriteLine(
- "\nx: exit\n" +
- "?: help\n");
- }
-
- public override int run(string[] args)
- {
- if(args.Length > 0)
- {
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+[assembly: CLSCompliant(true)]
- try
- {
- communicator().getPluginManager().getPlugin("IceSSL");
- _haveSSL = true;
- }
- catch(Ice.NotRegisteredException)
- {
- }
+[assembly: AssemblyTitle("IceBoxHelloClient")]
+[assembly: AssemblyDescription("IceBox hello demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
- HelloPrx twoway = HelloPrxHelper.checkedCast(
- communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
- if(twoway == null)
+public class Client
+{
+ public class App : Ice.Application
+ {
+ private static void menu()
{
- Console.Error.WriteLine("invalid proxy");
- return 1;
+ Console.Write(
+ "usage:\n" +
+ "t: send greeting as twoway\n" +
+ "o: send greeting as oneway\n" +
+ "O: send greeting as batch oneway\n" +
+ "d: send greeting as datagram\n" +
+ "D: send greeting as batch datagram\n" +
+ "f: flush all batch requests\n");
+ if(_haveSSL)
+ {
+ Console.Write("\nS: switch secure mode on/off");
+ }
+ Console.WriteLine(
+ "\nx: exit\n" +
+ "?: help\n");
}
- HelloPrx oneway = HelloPrxHelper.uncheckedCast(twoway.ice_oneway());
- HelloPrx batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway());
- HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram());
- HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
-
- bool secure = false;
- menu();
-
- string line = null;
- do
+ public override int run(string[] args)
{
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
+
try
{
- Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("t"))
- {
- twoway.sayHello();
- }
- else if(line.Equals("o"))
- {
- oneway.sayHello();
- }
- else if(line.Equals("O"))
- {
- batchOneway.sayHello();
- }
- else if(line.Equals("d"))
+ communicator().getPluginManager().getPlugin("IceSSL");
+ _haveSSL = true;
+ }
+ catch(Ice.NotRegisteredException)
+ {
+ }
+
+ HelloPrx twoway = HelloPrxHelper.checkedCast(
+ communicator().propertyToProxy("Hello.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false));
+ if(twoway == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
+ HelloPrx oneway = HelloPrxHelper.uncheckedCast(twoway.ice_oneway());
+ HelloPrx batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway());
+ HelloPrx datagram = HelloPrxHelper.uncheckedCast(twoway.ice_datagram());
+ HelloPrx batchDatagram = HelloPrxHelper.uncheckedCast(twoway.ice_batchDatagram());
+
+ bool secure = false;
+
+ menu();
+
+ string line = null;
+ do
+ {
+ try
{
- if(secure)
+ Console.Out.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
{
- Console.WriteLine("secure datagrams are not supported");
+ break;
}
- else
+ if(line.Equals("t"))
{
- datagram.sayHello();
+ twoway.sayHello();
}
- }
- else if(line.Equals("D"))
- {
- if(secure)
+ else if(line.Equals("o"))
{
- Console.WriteLine("secure datagrams are not supported");
+ oneway.sayHello();
}
- else
+ else if(line.Equals("O"))
{
- batchDatagram.sayHello();
+ batchOneway.sayHello();
}
- }
- else if(line.Equals("f"))
- {
- communicator().flushBatchRequests();
- }
- else if(_haveSSL && line.Equals("S"))
- {
- secure = !secure;
+ else if(line.Equals("d"))
+ {
+ if(secure)
+ {
+ Console.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ datagram.sayHello();
+ }
+ }
+ else if(line.Equals("D"))
+ {
+ if(secure)
+ {
+ Console.WriteLine("secure datagrams are not supported");
+ }
+ else
+ {
+ batchDatagram.sayHello();
+ }
+ }
+ else if(line.Equals("f"))
+ {
+ communicator().flushBatchRequests();
+ }
+ else if(_haveSSL && line.Equals("S"))
+ {
+ secure = !secure;
- twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure));
- oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure));
- batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
- datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure));
- batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
-
- if(secure)
+ twoway = HelloPrxHelper.uncheckedCast(twoway.ice_secure(secure));
+ oneway = HelloPrxHelper.uncheckedCast(oneway.ice_secure(secure));
+ batchOneway = HelloPrxHelper.uncheckedCast(batchOneway.ice_secure(secure));
+ datagram = HelloPrxHelper.uncheckedCast(datagram.ice_secure(secure));
+ batchDatagram = HelloPrxHelper.uncheckedCast(batchDatagram.ice_secure(secure));
+
+ if(secure)
+ {
+ Console.WriteLine("secure mode is now on");
+ }
+ else
+ {
+ Console.WriteLine("secure mode is now off");
+ }
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
{
- Console.WriteLine("secure mode is now on");
+ menu();
}
else
{
- Console.WriteLine("secure mode is now off");
+ Console.WriteLine("unknown command `" + line + "'");
+ menu();
}
}
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
- {
- menu();
- }
- else
+ catch(System.Exception ex)
{
- Console.WriteLine("unknown command `" + line + "'");
- menu();
+ Console.Error.WriteLine(ex);
}
}
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
+ while (!line.Equals("x"));
+
+ return 0;
}
- while (!line.Equals("x"));
-
- return 0;
+
+ private static bool _haveSSL = false;
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
System.Environment.Exit(status);
}
}
-
- private static bool _haveSSL = false;
}
diff --git a/cs/demo/IceGrid/icebox/Client.cs b/cs/demo/IceGrid/icebox/Client.cs
index 790a2092c8d..53c695150af 100644
--- a/cs/demo/IceGrid/icebox/Client.cs
+++ b/cs/demo/IceGrid/icebox/Client.cs
@@ -7,34 +7,44 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceGridIceBoxClient")]
+[assembly: AssemblyDescription("IceGrid icebox demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client : Ice.Application
+public class Client
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- HelloPrx hello = HelloPrxHelper.uncheckedCast(communicator().propertyToProxy("Hello.Proxy"));
- if(hello == null)
- {
- Console.Error.WriteLine("Hello.Proxy not found");
- return 1;
- }
+ HelloPrx hello = HelloPrxHelper.uncheckedCast(communicator().propertyToProxy("Hello.Proxy"));
+ if(hello == null)
+ {
+ Console.Error.WriteLine("Hello.Proxy not found");
+ return 1;
+ }
- hello.sayHello();
+ hello.sayHello();
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/IceGrid/simple/Client.cs b/cs/demo/IceGrid/simple/Client.cs
index ec689656b66..972462c5933 100644
--- a/cs/demo/IceGrid/simple/Client.cs
+++ b/cs/demo/IceGrid/simple/Client.cs
@@ -7,95 +7,105 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
-public class Client : Ice.Application
-{
- private void menu()
- {
- Console.WriteLine(
- "usage:\n" +
- "t: send greeting\n" +
- "s: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
- }
+[assembly: CLSCompliant(true)]
- public override int run(string[] args)
+[assembly: AssemblyTitle("IceGridSimpleClient")]
+[assembly: AssemblyDescription("IceGrid simple demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
+{
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ private void menu()
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
+ Console.WriteLine(
+ "usage:\n" +
+ "t: send greeting\n" +
+ "s: shutdown server\n" +
+ "x: exit\n" +
+ "?: help\n");
}
- HelloPrx hello = null;
- try
- {
- hello = HelloPrxHelper.checkedCast(communicator().stringToProxy("hello"));
- }
- catch(Ice.NotRegisteredException)
+ public override int run(string[] args)
{
- IceGrid.QueryPrx query =
- IceGrid.QueryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Query"));
- hello = HelloPrxHelper.checkedCast(query.findObjectByType("::Demo::Hello"));
- }
- if(hello == null)
- {
- Console.WriteLine("couldn't find a `::Demo::Hello' object");
- return 1;
- }
-
- menu();
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- string line = null;
- do
- {
+ HelloPrx hello = null;
try
{
- Console.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("t"))
- {
- hello.sayHello();
- }
- else if(line.Equals("s"))
- {
- hello.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
+ hello = HelloPrxHelper.checkedCast(communicator().stringToProxy("hello"));
+ }
+ catch(Ice.NotRegisteredException)
+ {
+ IceGrid.QueryPrx query =
+ IceGrid.QueryPrxHelper.checkedCast(communicator().stringToProxy("DemoIceGrid/Query"));
+ hello = HelloPrxHelper.checkedCast(query.findObjectByType("::Demo::Hello"));
+ }
+ if(hello == null)
+ {
+ Console.WriteLine("couldn't find a `::Demo::Hello' object");
+ return 1;
+ }
+
+ menu();
+
+ string line = null;
+ do
+ {
+ try
{
- menu();
+ Console.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
+ {
+ break;
+ }
+ if(line.Equals("t"))
+ {
+ hello.sayHello();
+ }
+ else if(line.Equals("s"))
+ {
+ hello.shutdown();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ Console.WriteLine("unknown command `" + line + "'");
+ menu();
+ }
}
- else
+ catch(Ice.LocalException ex)
{
- Console.WriteLine("unknown command `" + line + "'");
- menu();
+ Console.WriteLine(ex);
}
}
- catch(Ice.LocalException ex)
- {
- Console.WriteLine(ex);
- }
- }
- while(!line.Equals("x"));
+ while(!line.Equals("x"));
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{
diff --git a/cs/demo/IceGrid/simple/Server.cs b/cs/demo/IceGrid/simple/Server.cs
index 25855be3d55..180f393576d 100644
--- a/cs/demo/IceGrid/simple/Server.cs
+++ b/cs/demo/IceGrid/simple/Server.cs
@@ -7,28 +7,40 @@
//
// **********************************************************************
-public class Server : Ice.Application
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceGridSimpleServer")]
+[assembly: AssemblyDescription("IceGrid simple demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- if(args.Length > 0)
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ System.Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
- Ice.Properties properties = communicator().getProperties();
- Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
- adapter.add(new HelloI(properties.getProperty("Ice.ProgramName")), id);
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Hello");
+ Ice.Properties properties = communicator().getProperties();
+ Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
+ adapter.add(new HelloI(properties.getProperty("Ice.ProgramName")), id);
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
static public void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args);
if(status != 0)
{
diff --git a/cs/demo/IceStorm/clock/Publisher.cs b/cs/demo/IceStorm/clock/Publisher.cs
index 26062ea1041..d8cae57f036 100644
--- a/cs/demo/IceStorm/clock/Publisher.cs
+++ b/cs/demo/IceStorm/clock/Publisher.cs
@@ -7,127 +7,137 @@
//
// **********************************************************************
+using Demo;
using System;
using System.Diagnostics;
using System.Globalization;
-using Demo;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Publisher : Ice.Application
+[assembly: AssemblyTitle("IceStormClockPublisher")]
+[assembly: AssemblyDescription("IceStorm clock demo publisher")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Publisher
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast(
- communicator().propertyToProxy("IceStorm.TopicManager.Proxy"));
- if(manager == null)
- {
- Console.WriteLine("invalid proxy");
- return 1;
- }
-
- string topicName = "time";
- bool datagram = false;
- bool twoway = false;
- int optsSet = 0;
- for(int i = 0; i < args.Length; ++i)
+ public override int run(string[] args)
{
- if(args[i].Equals("--datagram"))
- {
- datagram = true;
- ++optsSet;
- }
- else if(args[i].Equals("--twoway"))
+ IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast(
+ communicator().propertyToProxy("IceStorm.TopicManager.Proxy"));
+ if(manager == null)
{
- twoway = true;
- ++optsSet;
+ Console.WriteLine("invalid proxy");
+ return 1;
}
- else if(args[i].Equals("--oneway"))
+
+ string topicName = "time";
+ bool datagram = false;
+ bool twoway = false;
+ int optsSet = 0;
+ for(int i = 0; i < args.Length; ++i)
{
- ++optsSet;
+ if(args[i].Equals("--datagram"))
+ {
+ datagram = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--twoway"))
+ {
+ twoway = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--oneway"))
+ {
+ ++optsSet;
+ }
+ else if(args[i].StartsWith("--"))
+ {
+ usage();
+ return 1;
+ }
+ else
+ {
+ topicName = args[i];
+ break;
+ }
}
- else if(args[i].StartsWith("--"))
+
+ if(optsSet > 1)
{
usage();
return 1;
}
- else
- {
- topicName = args[i];
- break;
- }
- }
-
- if(optsSet > 1)
- {
- usage();
- return 1;
- }
- //
- // Retrieve the topic.
- //
- IceStorm.TopicPrx topic;
- try
- {
- topic = manager.retrieve(topicName);
- }
- catch(IceStorm.NoSuchTopic)
- {
+ //
+ // Retrieve the topic.
+ //
+ IceStorm.TopicPrx topic;
try
{
- topic = manager.create(topicName);
+ topic = manager.retrieve(topicName);
}
- catch(IceStorm.TopicExists)
+ catch(IceStorm.NoSuchTopic)
{
- Console.WriteLine("temporary error. try again.");
- return 1;
+ try
+ {
+ topic = manager.create(topicName);
+ }
+ catch(IceStorm.TopicExists)
+ {
+ Console.WriteLine("temporary error. try again.");
+ return 1;
+ }
}
- }
- //
- // Get the topic's publisher object, and create a Clock proxy with
- // the mode specified as an argument of this application.
- //
- Ice.ObjectPrx publisher = topic.getPublisher();
- if(datagram)
- {
- publisher = publisher.ice_datagram();
- }
- else if(twoway)
- {
- // Do nothing.
- }
- else //if(oneway)
- {
- publisher = publisher.ice_oneway();
- }
- ClockPrx clock = ClockPrxHelper.uncheckedCast(publisher);
+ //
+ // Get the topic's publisher object, and create a Clock proxy with
+ // the mode specified as an argument of this application.
+ //
+ Ice.ObjectPrx publisher = topic.getPublisher();
+ if(datagram)
+ {
+ publisher = publisher.ice_datagram();
+ }
+ else if(twoway)
+ {
+ // Do nothing.
+ }
+ else //if(oneway)
+ {
+ publisher = publisher.ice_oneway();
+ }
+ ClockPrx clock = ClockPrxHelper.uncheckedCast(publisher);
- Console.WriteLine("publishing tick events. Press ^C to terminate the application.");
- try
- {
- while(true)
+ Console.WriteLine("publishing tick events. Press ^C to terminate the application.");
+ try
{
- clock.tick(System.DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo));
+ while(true)
+ {
+ clock.tick(System.DateTime.Now.ToString("G", DateTimeFormatInfo.InvariantInfo));
- System.Threading.Thread.Sleep(1000);
+ System.Threading.Thread.Sleep(1000);
+ }
}
+ catch(Ice.CommunicatorDestroyedException)
+ {
+ // Ignore
+ }
+
+ return 0;
}
- catch(Ice.CommunicatorDestroyedException)
+
+ public void usage()
{
- // Ignore
+ Console.WriteLine("Usage: " + appName() + " [--datagram|--twoway|--oneway] [topic]");
}
-
- return 0;
- }
-
- public void usage()
- {
- Console.WriteLine("Usage: " + appName() + " [--datagram|--twoway|--oneway] [topic]");
}
public static void Main(string[] args)
{
- Publisher app = new Publisher();
+ App app = new App();
int status = app.main(args, "config.pub");
if(status != 0)
{
diff --git a/cs/demo/IceStorm/clock/Subscriber.cs b/cs/demo/IceStorm/clock/Subscriber.cs
index 0b757664a28..b403db93d2f 100644
--- a/cs/demo/IceStorm/clock/Subscriber.cs
+++ b/cs/demo/IceStorm/clock/Subscriber.cs
@@ -7,170 +7,180 @@
//
// **********************************************************************
+using Demo;
using System;
using System.Collections.Generic;
-using Demo;
+using System.Reflection;
-public class Subscriber : Ice.Application
-{
- public class ClockI : ClockDisp_
- {
- public override void tick(string date, Ice.Current current)
- {
- System.Console.Out.WriteLine(date);
- }
- }
+[assembly: CLSCompliant(true)]
- public override int run(string[] args)
+[assembly: AssemblyTitle("IceStormClockSubscriber")]
+[assembly: AssemblyDescription("IceStorm clock demo subscriber")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Subscriber
+{
+ public class App : Ice.Application
{
- IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast(
- communicator().propertyToProxy("IceStorm.TopicManager.Proxy"));
- if(manager == null)
+ public class ClockI : ClockDisp_
{
- Console.WriteLine("invalid proxy");
- return 1;
+ public override void tick(string date, Ice.Current current)
+ {
+ System.Console.Out.WriteLine(date);
+ }
}
- string topicName = "time";
- bool datagram = false;
- bool twoway = false;
- bool ordered = false;
- bool batch = false;
- int optsSet = 0;
- for(int i = 0; i < args.Length; ++i)
+ public override int run(string[] args)
{
- if(args[i].Equals("--datagram"))
+ IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast(
+ communicator().propertyToProxy("IceStorm.TopicManager.Proxy"));
+ if(manager == null)
{
- datagram = true;
- ++optsSet;
- }
- else if(args[i].Equals("--twoway"))
- {
- twoway = true;
- ++optsSet;
- }
- else if(args[i].Equals("--ordered"))
- {
- ordered = true;
- ++optsSet;
+ Console.WriteLine("invalid proxy");
+ return 1;
}
- else if(args[i].Equals("--oneway"))
+
+ string topicName = "time";
+ bool datagram = false;
+ bool twoway = false;
+ bool ordered = false;
+ bool batch = false;
+ int optsSet = 0;
+ for(int i = 0; i < args.Length; ++i)
{
- ++optsSet;
+ if(args[i].Equals("--datagram"))
+ {
+ datagram = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--twoway"))
+ {
+ twoway = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--ordered"))
+ {
+ ordered = true;
+ ++optsSet;
+ }
+ else if(args[i].Equals("--oneway"))
+ {
+ ++optsSet;
+ }
+ else if(args[i].Equals("--batch"))
+ {
+ batch = true;
+ }
+ else if(args[i].StartsWith("--"))
+ {
+ usage();
+ return 1;
+ }
+ else
+ {
+ topicName = args[i];
+ break;
+ }
}
- else if(args[i].Equals("--batch"))
+
+ if(batch && (twoway || ordered))
{
- batch = true;
+ Console.WriteLine(appName() + ": batch can only be set with oneway or datagram");
+ return 1;
}
- else if(args[i].StartsWith("--"))
+
+ if(optsSet > 1)
{
usage();
return 1;
}
- else
- {
- topicName = args[i];
- break;
- }
- }
-
- if(batch && (twoway || ordered))
- {
- Console.WriteLine(appName() + ": batch can only be set with oneway or datagram");
- return 1;
- }
-
- if(optsSet > 1)
- {
- usage();
- return 1;
- }
- //
- // Retrieve the topic.
- //
- IceStorm.TopicPrx topic;
- try
- {
- topic = manager.retrieve(topicName);
- }
- catch(IceStorm.NoSuchTopic)
- {
+ //
+ // Retrieve the topic.
+ //
+ IceStorm.TopicPrx topic;
try
{
- topic = manager.create(topicName);
+ topic = manager.retrieve(topicName);
}
- catch(IceStorm.TopicExists)
+ catch(IceStorm.NoSuchTopic)
{
- Console.WriteLine("temporary error. try again.");
- return 1;
+ try
+ {
+ topic = manager.create(topicName);
+ }
+ catch(IceStorm.TopicExists)
+ {
+ Console.WriteLine("temporary error. try again.");
+ return 1;
+ }
}
- }
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Clock.Subscriber");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Clock.Subscriber");
- //
- // Add a Servant for the Ice Object.
- //
- Ice.ObjectPrx subscriber = adapter.addWithUUID(new ClockI());
+ //
+ // Add a Servant for the Ice Object.
+ //
+ Ice.ObjectPrx subscriber = adapter.addWithUUID(new ClockI());
- Dictionary<string, string> qos = new Dictionary<string, string>();
+ Dictionary<string, string> qos = new Dictionary<string, string>();
- //
- // Set up the proxy.
- //
- if(datagram)
- {
- subscriber = subscriber.ice_datagram();
- }
- else if(twoway)
- {
- // Do nothing to the subscriber proxy. Its already twoway.
- }
- else if(ordered)
- {
- // Do nothing to the subscriber proxy. Its already twoway.
- qos["reliability"] = "ordered";
- }
- else // if(oneway)
- {
- subscriber = subscriber.ice_oneway();
- }
- if(batch)
- {
+ //
+ // Set up the proxy.
+ //
if(datagram)
{
- subscriber = subscriber.ice_batchDatagram();
+ subscriber = subscriber.ice_datagram();
}
- else
+ else if(twoway)
{
- subscriber = subscriber.ice_batchOneway();
+ // Do nothing to the subscriber proxy. Its already twoway.
+ }
+ else if(ordered)
+ {
+ // Do nothing to the subscriber proxy. Its already twoway.
+ qos["reliability"] = "ordered";
+ }
+ else // if(oneway)
+ {
+ subscriber = subscriber.ice_oneway();
+ }
+ if(batch)
+ {
+ if(datagram)
+ {
+ subscriber = subscriber.ice_batchDatagram();
+ }
+ else
+ {
+ subscriber = subscriber.ice_batchOneway();
+ }
}
- }
-
- topic.subscribeAndGetPublisher(qos, subscriber);
- adapter.activate();
- shutdownOnInterrupt();
- communicator().waitForShutdown();
+ topic.subscribeAndGetPublisher(qos, subscriber);
+ adapter.activate();
- //
- // Unsubscribe all subscribed objects.
- //
- topic.unsubscribe(subscriber);
+ shutdownOnInterrupt();
+ communicator().waitForShutdown();
- return 0;
- }
+ //
+ // Unsubscribe all subscribed objects.
+ //
+ topic.unsubscribe(subscriber);
- public void
- usage()
- {
- Console.WriteLine("Usage: " + appName() + " [--batch] [--datagram|--twoway|--ordered|--oneway] [topic]");
+ return 0;
+ }
+
+ public void
+ usage()
+ {
+ Console.WriteLine("Usage: " + appName() + " [--batch] [--datagram|--twoway|--ordered|--oneway] [topic]");
+ }
}
public static void Main(string[] args)
{
- Subscriber app = new Subscriber();
+ App app = new App();
int status = app.main(args, "config.sub");
if(status != 0)
{
diff --git a/cs/demo/book/lifecycle/Client.cs b/cs/demo/book/lifecycle/Client.cs
index 014a7fc34b7..b5a395a7a81 100644
--- a/cs/demo/book/lifecycle/Client.cs
+++ b/cs/demo/book/lifecycle/Client.cs
@@ -6,48 +6,59 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-using System;
+
using Filesystem;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceLifecycleClient")]
+[assembly: AssemblyDescription("Ice lifecycle demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public override int run(String[] args)
+ public class App : Ice.Application
{
- // Terminate cleanly on receipt of a signal.
- //
- shutdownOnInterrupt();
-
- // Create a proxy for the root directory
- //
- Ice.ObjectPrx @base = communicator().stringToProxy("RootDir:default -p 10000");
- if(@base == null)
+ public override int run(String[] args)
{
- throw new Error("Could not create proxy");
+ // Terminate cleanly on receipt of a signal.
+ //
+ shutdownOnInterrupt();
+
+ // Create a proxy for the root directory
+ //
+ Ice.ObjectPrx @base = communicator().stringToProxy("RootDir:default -p 10000");
+ if(@base == null)
+ {
+ throw new Error("Could not create proxy");
+ }
+
+ // Down-cast the proxy to a Directory proxy.
+ //
+ DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(@base);
+ if(rootDir == null)
+ {
+ throw new Error("Invalid proxy");
+ }
+
+ Parser p = new Parser(rootDir);
+ return p.parse();
}
- // Down-cast the proxy to a Directory proxy.
- //
- DirectoryPrx rootDir = DirectoryPrxHelper.checkedCast(@base);
- if(rootDir == null)
+ private class Error : SystemException
{
- throw new Error("Invalid proxy");
+ public Error(String msg)
+ : base(msg)
+ {
+ }
}
-
- Parser p = new Parser(rootDir);
- return p.parse();
}
static public void Main(String[] args)
{
- Client app = new Client();
+ App app = new App();
app.main(args);
}
-
- private class Error : SystemException
- {
- public Error(String msg)
- : base(msg)
- {
- }
- }
}
diff --git a/cs/demo/book/lifecycle/DirectoryI.cs b/cs/demo/book/lifecycle/DirectoryI.cs
index 38b181550a3..d71f91433ec 100644
--- a/cs/demo/book/lifecycle/DirectoryI.cs
+++ b/cs/demo/book/lifecycle/DirectoryI.cs
@@ -49,7 +49,7 @@ namespace FilesystemI
}
}
- lock(_lcMutex)
+ lock(lcMutex)
{
reap();
@@ -80,7 +80,7 @@ namespace FilesystemI
}
}
- lock(_lcMutex)
+ lock(lcMutex)
{
reap();
@@ -110,7 +110,7 @@ namespace FilesystemI
}
}
- lock(_lcMutex)
+ lock(lcMutex)
{
reap();
@@ -135,7 +135,7 @@ namespace FilesystemI
}
}
- lock(_lcMutex)
+ lock(lcMutex)
{
reap();
@@ -164,7 +164,7 @@ namespace FilesystemI
throw new ObjectNotExistException();
}
- lock(_lcMutex)
+ lock(lcMutex)
{
reap();
@@ -191,7 +191,7 @@ namespace FilesystemI
public DirectoryI(ObjectAdapter a, string name, DirectoryI parent)
{
- _lcMutex = new System.Object();
+ lcMutex = new System.Object();
_name = name;
_parent = parent;
_id = new Identity();
@@ -250,7 +250,7 @@ namespace FilesystemI
_reapMap.Clear();
}
- public static System.Object _lcMutex = new System.Object();
+ public static System.Object lcMutex = new System.Object();
private string _name; // Immutable
private DirectoryI _parent; // Immutable
diff --git a/cs/demo/book/lifecycle/FileI.cs b/cs/demo/book/lifecycle/FileI.cs
index 52211231d9f..74585d0129e 100644
--- a/cs/demo/book/lifecycle/FileI.cs
+++ b/cs/demo/book/lifecycle/FileI.cs
@@ -71,7 +71,7 @@ namespace FilesystemI
_destroyed = true;
}
- lock(DirectoryI._lcMutex)
+ lock(DirectoryI.lcMutex)
{
c.adapter.remove(id());
_parent.addReapEntry(_name);
diff --git a/cs/demo/book/lifecycle/Server.cs b/cs/demo/book/lifecycle/Server.cs
index d832ad551a4..28fc9e31c71 100644
--- a/cs/demo/book/lifecycle/Server.cs
+++ b/cs/demo/book/lifecycle/Server.cs
@@ -7,47 +7,54 @@
//
// **********************************************************************
-using System;
using FilesystemI;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-class FilesystemApp : Ice.Application
+[assembly: AssemblyTitle("IceLifecycleServer")]
+[assembly: AssemblyDescription("Ice lifecycle demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ class App : Ice.Application
{
- // Terminate cleanly on receipt of a signal.
- //
- shutdownOnInterrupt();
-
- // Create an object adapter
- //
- Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints(
- "LifecycleFilesystem", "default -p 10000");
-
- // Create the root directory.
- //
- new DirectoryI(adapter);
-
- // All objects are created, allow client requests now.
- //
- adapter.activate();
-
- //
- // Wait until we are done.
- communicator().waitForShutdown();
- if(interrupted())
+ public override int run(string[] args)
{
- System.Console.Error.WriteLine(appName() + ": received signal, shutting down");
+ // Terminate cleanly on receipt of a signal.
+ //
+ shutdownOnInterrupt();
+
+ // Create an object adapter
+ //
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints(
+ "LifecycleFilesystem", "default -p 10000");
+
+ // Create the root directory.
+ //
+ new DirectoryI(adapter);
+
+ // All objects are created, allow client requests now.
+ //
+ adapter.activate();
+
+ //
+ // Wait until we are done.
+ communicator().waitForShutdown();
+ if(interrupted())
+ {
+ System.Console.Error.WriteLine(appName() + ": received signal, shutting down");
+ }
+
+ return 0;
}
-
- return 0;
}
-}
-public class Server
-{
static public void Main(string[] args)
{
- FilesystemApp app = new FilesystemApp();
+ App app = new App();
app.main(args);
}
}
diff --git a/cs/demo/book/printer/Client.cs b/cs/demo/book/printer/Client.cs
index c8cb303762c..cb3b75b8c96 100644
--- a/cs/demo/book/printer/Client.cs
+++ b/cs/demo/book/printer/Client.cs
@@ -7,8 +7,15 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IcePrinterClient")]
+[assembly: AssemblyDescription("Ice printer demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/demo/book/printer/Server.cs b/cs/demo/book/printer/Server.cs
index 2f59b9a6ccc..1665e5facba 100644
--- a/cs/demo/book/printer/Server.cs
+++ b/cs/demo/book/printer/Server.cs
@@ -8,6 +8,13 @@
// **********************************************************************
using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IcePrinterServer")]
+[assembly: AssemblyDescription("Ice printer demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class PrinterI : Demo.PrinterDisp_
{
diff --git a/cs/demo/book/simple_filesystem/Client.cs b/cs/demo/book/simple_filesystem/Client.cs
index 15ebb21a2a2..3471231e235 100644
--- a/cs/demo/book/simple_filesystem/Client.cs
+++ b/cs/demo/book/simple_filesystem/Client.cs
@@ -7,8 +7,15 @@
//
// **********************************************************************
-using System;
using Filesystem;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceSimpleLifecycleClient")]
+[assembly: AssemblyDescription("Ice simple lifecycle demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/demo/book/simple_filesystem/DirectoryI.cs b/cs/demo/book/simple_filesystem/DirectoryI.cs
index 28e641a6ff5..6266ef77481 100644
--- a/cs/demo/book/simple_filesystem/DirectoryI.cs
+++ b/cs/demo/book/simple_filesystem/DirectoryI.cs
@@ -21,15 +21,16 @@ public class DirectoryI : DirectoryDisp_
// Create an identity. The parent has the fixed identity "/"
//
- Ice.Identity myID = _adapter.getCommunicator().stringToIdentity(_parent != null ? Ice.Util.generateUUID() : "RootDir");
+ Ice.Identity myID =
+ adapter.getCommunicator().stringToIdentity(_parent != null ? Ice.Util.generateUUID() : "RootDir");
// Add the identity to the object adapter
//
- _adapter.add(this, myID);
+ adapter.add(this, myID);
// Create a proxy for the new node and add it as a child to the parent
//
- NodePrx thisNode = NodePrxHelper.uncheckedCast(_adapter.createProxy(myID));
+ NodePrx thisNode = NodePrxHelper.uncheckedCast(adapter.createProxy(myID));
if (_parent != null)
_parent.addChild(thisNode);
}
@@ -56,7 +57,7 @@ public class DirectoryI : DirectoryDisp_
_contents.Add(child);
}
- public static Ice.ObjectAdapter _adapter;
+ public static Ice.ObjectAdapter adapter;
private string _name;
private DirectoryI _parent;
private ArrayList _contents = new ArrayList();
diff --git a/cs/demo/book/simple_filesystem/FileI.cs b/cs/demo/book/simple_filesystem/FileI.cs
index 4996a23b114..905409fcf15 100644
--- a/cs/demo/book/simple_filesystem/FileI.cs
+++ b/cs/demo/book/simple_filesystem/FileI.cs
@@ -23,15 +23,15 @@ public class FileI : FileDisp_
// Create an identity
//
- Ice.Identity myID = _adapter.getCommunicator().stringToIdentity(Ice.Util.generateUUID());
+ Ice.Identity myID = adapter.getCommunicator().stringToIdentity(Ice.Util.generateUUID());
// Add the identity to the object adapter
//
- _adapter.add(this, myID);
+ adapter.add(this, myID);
// Create a proxy for the new node and add it as a child to the parent
//
- NodePrx thisNode = NodePrxHelper.uncheckedCast(_adapter.createProxy(myID));
+ NodePrx thisNode = NodePrxHelper.uncheckedCast(adapter.createProxy(myID));
_parent.addChild(thisNode);
}
@@ -56,7 +56,7 @@ public class FileI : FileDisp_
_lines = text;
}
- public static Ice.ObjectAdapter _adapter;
+ public static Ice.ObjectAdapter adapter;
private string _name;
private DirectoryI _parent;
private string[] _lines;
diff --git a/cs/demo/book/simple_filesystem/Server.cs b/cs/demo/book/simple_filesystem/Server.cs
index 5dcbbc24e17..8b8b0704fce 100644
--- a/cs/demo/book/simple_filesystem/Server.cs
+++ b/cs/demo/book/simple_filesystem/Server.cs
@@ -9,73 +9,83 @@
using Filesystem;
using System;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceSimpleLifecycleServer")]
+[assembly: AssemblyDescription("Ice simple lifecycle demo server")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- // Terminate cleanly on receipt of a signal
- //
- shutdownOnInterrupt();
+ public override int run(string[] args)
+ {
+ // Terminate cleanly on receipt of a signal
+ //
+ shutdownOnInterrupt();
- // Create an object adapter (stored in the _adapter
- // static members)
- //
- Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints(
- "SimpleFilesystem", "default -p 10000");
- DirectoryI._adapter = adapter;
- FileI._adapter = adapter;
+ // Create an object adapter (stored in the _adapter
+ // static members)
+ //
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints(
+ "SimpleFilesystem", "default -p 10000");
+ DirectoryI.adapter = adapter;
+ FileI.adapter = adapter;
- // Create the root directory (with name "/" and no parent)
- //
- DirectoryI root = new DirectoryI("/", null);
+ // Create the root directory (with name "/" and no parent)
+ //
+ DirectoryI root = new DirectoryI("/", null);
- // Create a file called "README" in the root directory
- //
- File file = new FileI("README", root);
- string[] text;
- text = new string[]{ "This file system contains a collection of poetry." };
- try {
- file.write(text);
- } catch (GenericError e) {
- Console.Error.WriteLine(e.reason);
- }
+ // Create a file called "README" in the root directory
+ //
+ File file = new FileI("README", root);
+ string[] text;
+ text = new string[]{ "This file system contains a collection of poetry." };
+ try {
+ file.write(text);
+ } catch (GenericError e) {
+ Console.Error.WriteLine(e.reason);
+ }
- // Create a directory called "Coleridge" in the root directory
- //
- DirectoryI coleridge = new DirectoryI("Coleridge", root);
+ // Create a directory called "Coleridge" in the root directory
+ //
+ DirectoryI coleridge = new DirectoryI("Coleridge", root);
- // Create a file called "Kubla_Khan" in the Coleridge directory
- //
- file = new FileI("Kubla_Khan", coleridge);
- text = new string[]{ "In Xanadu did Kubla Khan",
- "A stately pleasure-dome decree:",
- "Where Alph, the sacred river, ran",
- "Through caverns measureless to man",
- "Down to a sunless sea." };
- try {
- file.write(text);
- } catch (GenericError e) {
- Console.Error.WriteLine(e.reason);
- }
+ // Create a file called "Kubla_Khan" in the Coleridge directory
+ //
+ file = new FileI("Kubla_Khan", coleridge);
+ text = new string[]{ "In Xanadu did Kubla Khan",
+ "A stately pleasure-dome decree:",
+ "Where Alph, the sacred river, ran",
+ "Through caverns measureless to man",
+ "Down to a sunless sea." };
+ try {
+ file.write(text);
+ } catch (GenericError e) {
+ Console.Error.WriteLine(e.reason);
+ }
- // All objects are created, allow client requests now
- //
- adapter.activate();
+ // All objects are created, allow client requests now
+ //
+ adapter.activate();
- // Wait until we are done
- //
- communicator().waitForShutdown();
+ // Wait until we are done
+ //
+ communicator().waitForShutdown();
- if (interrupted())
- Console.Error.WriteLine(appName() + ": terminating");
+ if (interrupted())
+ Console.Error.WriteLine(appName() + ": terminating");
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Server app = new Server();
+ App app = new App();
int status = app.main(args);
if(status != 0)
{
diff --git a/cs/src/IceBox/Server.cs b/cs/src/IceBox/Server.cs
index 3c912254fc7..06e1944bad9 100644
--- a/cs/src/IceBox/Server.cs
+++ b/cs/src/IceBox/Server.cs
@@ -12,36 +12,39 @@ using System;
namespace IceBox
{
-public class Server : Ice.Application
+public class Server
{
- private static void usage()
+ public class App : Ice.Application
{
- Console.Error.WriteLine("Usage: iceboxnet [options] --Ice.Config=<file>\n");
- Console.Error.WriteLine(
- "Options:\n" +
- "-h, --help Show this message.\n"
- );
- }
+ private static void usage()
+ {
+ Console.Error.WriteLine("Usage: iceboxnet [options] --Ice.Config=<file>\n");
+ Console.Error.WriteLine(
+ "Options:\n" +
+ "-h, --help Show this message.\n"
+ );
+ }
- public override int run(string[] args)
- {
- for(int i = 0; i < args.Length; ++i)
+ public override int run(string[] args)
{
- if(args[i].Equals("-h") || args[i].Equals("--help"))
+ for(int i = 0; i < args.Length; ++i)
{
- usage();
- return 0;
+ if(args[i].Equals("-h") || args[i].Equals("--help"))
+ {
+ usage();
+ return 0;
+ }
+ else if(!args[i].StartsWith("--"))
+ {
+ Console.Error.WriteLine("Server: unknown option `" + args[i] + "'");
+ usage();
+ return 1;
+ }
}
- else if(!args[i].StartsWith("--"))
- {
- Console.Error.WriteLine("Server: unknown option `" + args[i] + "'");
- usage();
- return 1;
- }
- }
- ServiceManagerI serviceManagerImpl = new ServiceManagerI(args);
- return serviceManagerImpl.run();
+ ServiceManagerI serviceManagerImpl = new ServiceManagerI(args);
+ return serviceManagerImpl.run();
+ }
}
public static void Main(string[] args)
@@ -50,7 +53,7 @@ public class Server : Ice.Application
initData.properties = Ice.Util.createProperties();
initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
- Server server = new Server();
+ App server = new App();
int status = server.main(args, initData);
if(status != 0)
{
diff --git a/cs/test/Glacier2/attack/Client.cs b/cs/test/Glacier2/attack/Client.cs
index 462d5a9bde4..82ac0bb5cdf 100644
--- a/cs/test/Glacier2/attack/Client.cs
+++ b/cs/test/Glacier2/attack/Client.cs
@@ -7,118 +7,128 @@
//
// **********************************************************************
+using Test;
using System;
using System.Collections;
using System.Diagnostics;
-using Test;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- 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.Write("creating session... ");
- 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)
+ public override int run(string[] args)
{
- if(i % 100 == 0)
+ 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.Write("creating session... ");
+ 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)
{
- for(int j = 0; j < msg.Length; ++j)
+ if(i % 100 == 0)
{
- Console.Out.Write('\b');
+ for(int j = 0; j < msg.Length; ++j)
+ {
+ Console.Out.Write('\b');
+ }
+
+ msg = "" + i;
+ Console.Out.Write(i);
+ Console.Out.Flush();
}
- msg = "" + i;
- Console.Out.Write(i);
- Console.Out.Flush();
- }
+ Ice.Identity ident = new Ice.Identity("", "");
+ ident.name += (char)('A' + rand.Next() % 26);
- 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);
+ }
- 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();
}
- BackendPrx newBackend = BackendPrxHelper.uncheckedCast(backendBase.ice_identity(ident));
-
- if(!backends.ContainsKey(newBackend))
+ for(int j = 0; j < msg.Length; ++j)
+ {
+ Console.Out.Write('\b');
+ }
+ for(int j = 0; j < msg.Length; ++j)
{
- backends.Add(newBackend, newBackend);
- backend = newBackend;
+ Console.Out.Write(' ');
}
- else
+ for(int j = 0; j < msg.Length; ++j)
{
- backend = (BackendPrx)backends[newBackend];
+ Console.Out.Write('\b');
}
+ Console.Out.WriteLine("ok");
- backend.ice_ping();
- }
+ Console.Out.Write("testing server and router shutdown... ");
+ Console.Out.Flush();
+ backend.shutdown();
+ communicator().setDefaultRouter(null);
+ Ice.ObjectPrx processBase =
+ communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348 -t 10000");
+ Ice.ProcessPrx process = Ice.ProcessPrxHelper.checkedCast(processBase);
+ test(process != null);
+ process.shutdown();
+ try
+ {
+ process.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException)
+ {
+ Console.Out.WriteLine("ok");
+ }
- 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 processBase =
- communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348 -t 10000");
- Ice.ProcessPrx process = Ice.ProcessPrxHelper.checkedCast(processBase);
- test(process != null);
- process.shutdown();
- try
- {
- process.ice_ping();
- test(false);
- }
- catch(Ice.LocalException)
- {
- Console.Out.WriteLine("ok");
+ return 0;
}
- return 0;
- }
-
- private static void
- test(bool b)
- {
- if(!b)
+ private static void
+ test(bool b)
{
- throw new Exception();
+ if(!b)
+ {
+ throw new Exception();
+ }
}
}
@@ -134,7 +144,7 @@ public class Client : Ice.Application
initData.properties = Ice.Util.createProperties(ref args);
initData.properties.setProperty("Ice.RetryIntervals", "-1");
- Client app = new Client();
+ App app = new App();
int status = app.main(args, initData);
if(status != 0)
diff --git a/cs/test/Glacier2/attack/Server.cs b/cs/test/Glacier2/attack/Server.cs
index 41adffa0557..5869d2c89d6 100644
--- a/cs/test/Glacier2/attack/Server.cs
+++ b/cs/test/Glacier2/attack/Server.cs
@@ -8,49 +8,60 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
-public sealed class ServantLocatorI : Ice.ServantLocator
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+class Server
{
- public ServantLocatorI()
+ sealed class ServantLocatorI : Ice.ServantLocator
{
- _backend = new BackendI();
- }
+ public ServantLocatorI()
+ {
+ _backend = new BackendI();
+ }
- public Ice.Object locate(Ice.Current curr, out System.Object cookie)
- {
- cookie = null;
- return _backend;
- }
+ public Ice.Object locate(Ice.Current curr, out System.Object cookie)
+ {
+ cookie = null;
+ return _backend;
+ }
- public void finished(Ice.Current curr, Ice.Object servant, System.Object cookie)
- {
- }
+ public void finished(Ice.Current curr, Ice.Object servant, System.Object cookie)
+ {
+ }
- public void deactivate(string category)
- {
- }
+ public void deactivate(string category)
+ {
+ }
- private Backend _backend;
-}
+ private Backend _backend;
+ }
-class Server : Ice.Application
-{
- public override int run(string[] args)
+ class App : Ice.Application
{
- communicator().getProperties().setProperty("BackendAdapter.Endpoints", "tcp -p 12010 -t 10000");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("BackendAdapter");
- adapter.addServantLocator(new ServantLocatorI(), "");
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
+ public override int run(string[] args)
+ {
+ communicator().getProperties().setProperty("BackendAdapter.Endpoints", "tcp -p 12010 -t 10000");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("BackendAdapter");
+ adapter.addServantLocator(new ServantLocatorI(), "");
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
Debug.Listeners.Add(new ConsoleTraceListener());
- Server app = new Server();
+ App app = new App();
int status = app.main(args);
if(status != 0)
{
diff --git a/cs/test/Glacier2/router/Client.cs b/cs/test/Glacier2/router/Client.cs
index b26179c0579..269129714d0 100644
--- a/cs/test/Glacier2/router/Client.cs
+++ b/cs/test/Glacier2/router/Client.cs
@@ -7,419 +7,429 @@
//
// **********************************************************************
+using Glacier2;
+using Test;
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using Glacier2;
-using Test;
+using System.Reflection;
-public class Client : Ice.Application
-{
- public override int run(string[] args)
- {
- Ice.ObjectPrx routerBase;
+[assembly: CLSCompliant(true)]
- {
- Console.Out.Write("testing stringToProxy for router... ");
- Console.Out.Flush();
- routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347 -t 30000");
- Console.Out.WriteLine("ok");
- }
-
- Glacier2.RouterPrx router;
-
- {
- Console.Out.Write("testing checked cast for router... ");
- Console.Out.Flush();
- router = Glacier2.RouterPrxHelper.checkedCast(routerBase);
- test(router != null);
- Console.Out.WriteLine("ok");
- }
-
- {
- Console.Out.Write("installing router with communicator... ");
- Console.Out.Flush();
- communicator().setDefaultRouter(router);
- Console.Out.WriteLine("ok");
- }
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+public class Client
+{
+ public class App : Ice.Application
+ {
+ public override int run(string[] args)
{
- Console.Out.Write("getting the session timeout... ");
- Console.Out.Flush();
- long timeout = router.getSessionTimeout();
- test(timeout == 30);
- Console.Out.WriteLine("ok");
- }
-
- Ice.ObjectPrx @base;
+ Ice.ObjectPrx routerBase;
- {
- Console.Out.Write("testing stringToProxy for server object... ");
- Console.Out.Flush();
- @base = communicator().stringToProxy("c1/callback:tcp -p 12010 -t 10000");
- Console.Out.WriteLine("ok");
- }
-
- {
- Console.Out.Write("trying to ping server before session creation... ");
- Console.Out.Flush();
- try
- {
- @base.ice_ping();
- test(false);
- }
- catch(Ice.ConnectionLostException)
{
+ Console.Out.Write("testing stringToProxy for router... ");
+ Console.Out.Flush();
+ routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347 -t 30000");
Console.Out.WriteLine("ok");
}
- catch(Ice.SocketException)
- {
- test(false);
- }
- }
-
+
+ Glacier2.RouterPrx router;
- {
- Console.Out.Write("trying to create session with wrong password... ");
- Console.Out.Flush();
- try
- {
- router.createSession("userid", "xxx");
- test(false);
- }
- catch(Glacier2.PermissionDeniedException)
{
+ Console.Out.Write("testing checked cast for router... ");
+ Console.Out.Flush();
+ router = Glacier2.RouterPrxHelper.checkedCast(routerBase);
+ test(router != null);
Console.Out.WriteLine("ok");
}
- catch(Glacier2.CannotCreateSessionException)
- {
- test(false);
- }
- }
- {
- Console.Out.Write("trying to destroy non-existing session... ");
- Console.Out.Flush();
- try
- {
- router.destroySession();
- test(false);
- }
- catch(Glacier2.SessionNotExistException)
{
+ Console.Out.Write("installing router with communicator... ");
+ Console.Out.Flush();
+ communicator().setDefaultRouter(router);
Console.Out.WriteLine("ok");
}
- }
- {
- Console.Out.Write("creating session with correct password... ");
- Console.Out.Flush();
- try
{
- router.createSession("userid", "abc123");
+ Console.Out.Write("getting the session timeout... ");
+ Console.Out.Flush();
+ long timeout = router.getSessionTimeout();
+ test(timeout == 30);
+ Console.Out.WriteLine("ok");
}
- catch(Glacier2.PermissionDeniedException)
+
+ Ice.ObjectPrx @base;
+
{
- test(false);
+ Console.Out.Write("testing stringToProxy for server object... ");
+ Console.Out.Flush();
+ @base = communicator().stringToProxy("c1/callback:tcp -p 12010 -t 10000");
+ Console.Out.WriteLine("ok");
}
- catch(Glacier2.CannotCreateSessionException)
+
{
- test(false);
+ Console.Out.Write("trying to ping server before session creation... ");
+ Console.Out.Flush();
+ try
+ {
+ @base.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException)
+ {
+ Console.Out.WriteLine("ok");
+ }
+ catch(Ice.SocketException)
+ {
+ test(false);
+ }
}
- Console.Out.WriteLine("ok");
- }
- {
- Console.Out.Write("trying to create a second session... ");
- Console.Out.Flush();
- try
+
{
- router.createSession("userid", "abc123");
- test(false);
+ Console.Out.Write("trying to create session with wrong password... ");
+ Console.Out.Flush();
+ try
+ {
+ router.createSession("userid", "xxx");
+ test(false);
+ }
+ catch(Glacier2.PermissionDeniedException)
+ {
+ Console.Out.WriteLine("ok");
+ }
+ catch(Glacier2.CannotCreateSessionException)
+ {
+ test(false);
+ }
+ }
+
+ {
+ Console.Out.Write("trying to destroy non-existing session... ");
+ Console.Out.Flush();
+ try
+ {
+ router.destroySession();
+ test(false);
+ }
+ catch(Glacier2.SessionNotExistException)
+ {
+ Console.Out.WriteLine("ok");
+ }
}
- catch(Glacier2.PermissionDeniedException)
+
{
- test(false);
+ Console.Out.Write("creating session with correct password... ");
+ Console.Out.Flush();
+ try
+ {
+ router.createSession("userid", "abc123");
+ }
+ catch(Glacier2.PermissionDeniedException)
+ {
+ test(false);
+ }
+ catch(Glacier2.CannotCreateSessionException)
+ {
+ test(false);
+ }
+ Console.Out.WriteLine("ok");
}
- catch(Glacier2.CannotCreateSessionException)
+
{
+ Console.Out.Write("trying to create a second session... ");
+ Console.Out.Flush();
+ try
+ {
+ router.createSession("userid", "abc123");
+ test(false);
+ }
+ catch(Glacier2.PermissionDeniedException)
+ {
+ test(false);
+ }
+ catch(Glacier2.CannotCreateSessionException)
+ {
+ Console.Out.WriteLine("ok");
+ }
+ }
+
+ {
+ Console.Out.Write("pinging server after session creation... ");
+ Console.Out.Flush();
+ @base.ice_ping();
Console.Out.WriteLine("ok");
}
- }
-
- {
- Console.Out.Write("pinging server after session creation... ");
- Console.Out.Flush();
- @base.ice_ping();
- Console.Out.WriteLine("ok");
- }
- CallbackPrx twoway;
+ CallbackPrx twoway;
- {
- Console.Out.Write("testing checked cast for server object... ");
- Console.Out.Flush();
- twoway = CallbackPrxHelper.checkedCast(@base);
- test(twoway != null);
- Console.Out.WriteLine("ok");
- }
-
- Ice.ObjectAdapter adapter;
-
- {
- Console.Out.Write("creating and activating callback receiver adapter... ");
- Console.Out.Flush();
- communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0");
- adapter = communicator().createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
- adapter.activate();
- Console.Out.WriteLine("ok");
- }
-
- String category;
-
- {
- Console.Out.Write("getting category from router... ");
- Console.Out.Flush();
- category = router.getCategoryForClient();
- Console.Out.WriteLine("ok");
- }
-
- CallbackReceiverI callbackReceiverImpl;
- Ice.Object callbackReceiver;
- CallbackReceiverPrx twowayR;
- CallbackReceiverPrx fakeTwowayR;
-
- {
- Console.Out.Write("creating and adding callback receiver object... ");
- Console.Out.Flush();
- callbackReceiverImpl = new CallbackReceiverI();
- callbackReceiver = callbackReceiverImpl;
- Ice.Identity callbackReceiverIdent = new Ice.Identity();
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
- twowayR = CallbackReceiverPrxHelper.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent));
- Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity();
- fakeCallbackReceiverIdent.name = "callbackReceiver";
- fakeCallbackReceiverIdent.category = "dummy";
- fakeTwowayR = CallbackReceiverPrxHelper.uncheckedCast(
- adapter.add(callbackReceiver, fakeCallbackReceiverIdent));
- Console.Out.WriteLine("ok");
- }
-
- {
- Console.Out.Write("testing oneway callback... ");
- Console.Out.Flush();
- CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway());
- CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "o";
- oneway.initiateCallback(onewayR, context);
- test(callbackReceiverImpl.callbackOK());
- Console.Out.WriteLine("ok");
- }
-
- {
- Console.Out.Write("testing twoway callback... ");
- Console.Out.Flush();
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "t";
- twoway.initiateCallback(twowayR, context);
- test(callbackReceiverImpl.callbackOK());
- Console.Out.WriteLine("ok");
- }
-
- {
- Console.Out.Write("ditto, but with user exception... ");
- Console.Out.Flush();
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "t";
- try
{
- twoway.initiateCallbackEx(twowayR, context);
- test(false);
- }
- catch(CallbackException ex)
- {
- test(ex.someValue == 3.14);
- test(ex.someString.Equals("3.14"));
+ Console.Out.Write("testing checked cast for server object... ");
+ Console.Out.Flush();
+ twoway = CallbackPrxHelper.checkedCast(@base);
+ test(twoway != null);
+ Console.Out.WriteLine("ok");
}
- test(callbackReceiverImpl.callbackOK());
- Console.Out.WriteLine("ok");
- }
- {
- Console.Out.Write("trying twoway callback with fake category... ");
- Console.Out.Flush();
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "t";
- try
- {
- twoway.initiateCallback(fakeTwowayR, context);
- test(false);
- }
- catch(Ice.ObjectNotExistException)
+ Ice.ObjectAdapter adapter;
+
{
+ Console.Out.Write("creating and activating callback receiver adapter... ");
+ Console.Out.Flush();
+ communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0");
+ adapter = communicator().createObjectAdapterWithRouter("CallbackReceiverAdapter", router);
+ adapter.activate();
Console.Out.WriteLine("ok");
}
- }
- {
- Console.Out.Write("testing whether other allowed category is accepted... ");
- Console.Out.Flush();
- Dictionary<string, string> context = new Dictionary<string, string>();
- 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... ");
- Console.Out.Flush();
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "t";
- try
- {
- CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
- twoway.ice_identity(communicator().stringToIdentity("c3/callback")));
- otherCategoryTwoway.initiateCallback(twowayR, context);
- test(false);
- }
- catch(Ice.ObjectNotExistException)
+ String category;
+
{
+ Console.Out.Write("getting category from router... ");
+ Console.Out.Flush();
+ category = router.getCategoryForClient();
Console.Out.WriteLine("ok");
}
- }
-
- {
- Console.Out.Write("testing whether user-id as category is accepted... ");
- Console.Out.Flush();
- Dictionary<string, string> context = new Dictionary<string, string>();
- 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");
- }
-
- {
- Console.Out.Write("testing server shutdown... ");
- Console.Out.Flush();
- twoway.shutdown();
- // No ping, otherwise the router prints a warning message if it's
- // started with --Ice.Warn.Connections.
- Console.Out.WriteLine("ok");
- /*
- try
- {
- base.ice_ping();
- test(false);
- }
- // If we use the glacier router, the exact exception reason gets
- // lost.
- catch(Ice.UnknownLocalException ex)
- {
- Console.Out.WriteLine("ok");
- }
- */
- }
-
- {
- Console.Out.Write("destroying session... ");
- Console.Out.Flush();
- try
- {
- router.destroySession();
- test(false);
- }
- catch(Ice.ConnectionLostException)
+
+ CallbackReceiverI callbackReceiverImpl;
+ Ice.Object callbackReceiver;
+ CallbackReceiverPrx twowayR;
+ CallbackReceiverPrx fakeTwowayR;
+
{
+ Console.Out.Write("creating and adding callback receiver object... ");
+ Console.Out.Flush();
+ callbackReceiverImpl = new CallbackReceiverI();
+ callbackReceiver = callbackReceiverImpl;
+ Ice.Identity callbackReceiverIdent = new Ice.Identity();
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = category;
+ twowayR = CallbackReceiverPrxHelper.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent));
+ Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity();
+ fakeCallbackReceiverIdent.name = "callbackReceiver";
+ fakeCallbackReceiverIdent.category = "dummy";
+ fakeTwowayR = CallbackReceiverPrxHelper.uncheckedCast(
+ adapter.add(callbackReceiver, fakeCallbackReceiverIdent));
+ Console.Out.WriteLine("ok");
}
- catch(Ice.LocalException)
+
{
- test(false);
+ Console.Out.Write("testing oneway callback... ");
+ Console.Out.Flush();
+ CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway());
+ CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ context["_fwd"] = "o";
+ oneway.initiateCallback(onewayR, context);
+ test(callbackReceiverImpl.callbackOK());
+ Console.Out.WriteLine("ok");
}
- Console.Out.WriteLine("ok");
- }
-
- {
- Console.Out.Write("trying to ping server after session destruction... ");
- Console.Out.Flush();
- try
{
- @base.ice_ping();
- test(false);
+ Console.Out.Write("testing twoway callback... ");
+ Console.Out.Flush();
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ context["_fwd"] = "t";
+ twoway.initiateCallback(twowayR, context);
+ test(callbackReceiverImpl.callbackOK());
+ Console.Out.WriteLine("ok");
}
- catch(Ice.ConnectionLostException)
+
{
+ Console.Out.Write("ditto, but with user exception... ");
+ Console.Out.Flush();
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ context["_fwd"] = "t";
+ try
+ {
+ twoway.initiateCallbackEx(twowayR, context);
+ test(false);
+ }
+ catch(CallbackException ex)
+ {
+ test(ex.someValue == 3.14);
+ test(ex.someString.Equals("3.14"));
+ }
+ test(callbackReceiverImpl.callbackOK());
Console.Out.WriteLine("ok");
}
- catch(Ice.SocketException)
+
{
- test(false);
+ Console.Out.Write("trying twoway callback with fake category... ");
+ Console.Out.Flush();
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ context["_fwd"] = "t";
+ try
+ {
+ twoway.initiateCallback(fakeTwowayR, context);
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException)
+ {
+ Console.Out.WriteLine("ok");
+ }
}
- }
-
- if(args.Length >= 1 && args[0].Equals("--shutdown"))
- {
+
{
- Console.Out.Write("uninstalling router with communicator... ");
+ Console.Out.Write("testing whether other allowed category is accepted... ");
Console.Out.Flush();
- communicator().setDefaultRouter(null);
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ 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");
}
- Ice.ObjectPrx processBase;
-
{
- Console.Out.Write("testing stringToProxy for admin object... ");
- processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348 -t 10000");
- Console.Out.WriteLine("ok");
+ Console.Out.Write("testing whether disallowed category gets rejected... ");
+ Console.Out.Flush();
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ 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("uninstalling router with process object... ");
- processBase.ice_router(null);
+ Console.Out.Write("testing whether user-id as category is accepted... ");
+ Console.Out.Flush();
+ Dictionary<string, string> context = new Dictionary<string, string>();
+ 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");
}
-*/
-
- Ice.ProcessPrx process;
{
- Console.Out.Write("testing checked cast for process object... ");
- process = Ice.ProcessPrxHelper.checkedCast(processBase);
- test(process != null);
+ Console.Out.Write("testing server shutdown... ");
+ Console.Out.Flush();
+ twoway.shutdown();
+ // No ping, otherwise the router prints a warning message if it's
+ // started with --Ice.Warn.Connections.
Console.Out.WriteLine("ok");
+ /*
+ try
+ {
+ base.ice_ping();
+ test(false);
+ }
+ // If we use the glacier router, the exact exception reason gets
+ // lost.
+ catch(Ice.UnknownLocalException ex)
+ {
+ Console.Out.WriteLine("ok");
+ }
+ */
}
- Console.Out.Write("testing Glacier2 shutdown... ");
- process.shutdown();
- try
{
- process.ice_ping();
- test(false);
+ Console.Out.Write("destroying session... ");
+ Console.Out.Flush();
+ try
+ {
+ router.destroySession();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException)
+ {
+ }
+ catch(Ice.LocalException)
+ {
+ test(false);
+ }
+
+ Console.Out.WriteLine("ok");
}
- catch(Ice.LocalException)
+
{
- Console.Out.WriteLine("ok");
+ Console.Out.Write("trying to ping server after session destruction... ");
+ Console.Out.Flush();
+ try
+ {
+ @base.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException)
+ {
+ Console.Out.WriteLine("ok");
+ }
+ catch(Ice.SocketException)
+ {
+ 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 processBase;
+
+ {
+ Console.Out.Write("testing stringToProxy for admin object... ");
+ processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348 -t 10000");
+ Console.Out.WriteLine("ok");
+ }
+
+ /*
+ {
+ Console.Out.Write("uninstalling router with process object... ");
+ processBase.ice_router(null);
+ Console.Out.WriteLine("ok");
+ }
+ */
+
+ Ice.ProcessPrx process;
+
+ {
+ Console.Out.Write("testing checked cast for process object... ");
+ process = Ice.ProcessPrxHelper.checkedCast(processBase);
+ test(process != null);
+ Console.Out.WriteLine("ok");
+ }
+
+ Console.Out.Write("testing Glacier2 shutdown... ");
+ process.shutdown();
+ try
+ {
+ process.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException)
+ {
+ Console.Out.WriteLine("ok");
+ }
+ }
+
+ return 0;
}
-
- return 0;
- }
- private static void
- test(bool b)
- {
- if(!b)
+ private static void
+ test(bool b)
{
- throw new Exception();
+ if(!b)
+ {
+ throw new Exception();
+ }
}
}
@@ -438,7 +448,7 @@ public class Client : Ice.Application
initData.properties.setProperty("Ice.Warn.Connections", "0");
- Client app = new Client();
+ App app = new App();
int status = app.main(args, initData);
if(status != 0)
diff --git a/cs/test/Glacier2/router/Server.cs b/cs/test/Glacier2/router/Server.cs
index 02543b62874..1e40f11c11d 100644
--- a/cs/test/Glacier2/router/Server.cs
+++ b/cs/test/Glacier2/router/Server.cs
@@ -9,31 +9,41 @@
using System;
using System.Diagnostics;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- communicator().getProperties().setProperty("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.activate();
- communicator().waitForShutdown();
- return 0;
+ public override int run(string[] args)
+ {
+ communicator().getProperties().setProperty("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.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
}
public static void Main(string[] args)
{
Debug.Listeners.Add(new ConsoleTraceListener());
- Server app = new Server();
+ App app = new App();
int status = app.main(args);
if(status != 0)
{
diff --git a/cs/test/Ice/adapterDeactivation/Client.cs b/cs/test/Ice/adapterDeactivation/Client.cs
index dccba5cfe1f..2d855294ede 100644
--- a/cs/test/Ice/adapterDeactivation/Client.cs
+++ b/cs/test/Ice/adapterDeactivation/Client.cs
@@ -8,11 +8,19 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
- internal class TestClient : Ice.Application
+ internal class App : Ice.Application
{
public override int run(string[] args)
{
@@ -25,7 +33,7 @@ public class Client
{
Debug.Listeners.Add(new ConsoleTraceListener());
- TestClient app = new TestClient();
+ App app = new App();
int result = app.main(args);
if(result != 0)
{
diff --git a/cs/test/Ice/adapterDeactivation/Collocated.cs b/cs/test/Ice/adapterDeactivation/Collocated.cs
index 5aa1cefb9ea..a6a55600efb 100644
--- a/cs/test/Ice/adapterDeactivation/Collocated.cs
+++ b/cs/test/Ice/adapterDeactivation/Collocated.cs
@@ -8,11 +8,19 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
- internal class TestClient : Ice.Application
+ internal class App : Ice.Application
{
public override int run(string[] args)
{
@@ -32,7 +40,7 @@ public class Collocated
{
Debug.Listeners.Add(new ConsoleTraceListener());
- TestClient app = new TestClient();
+ App app = new App();
int result = app.main(args);
if(result != 0)
{
diff --git a/cs/test/Ice/adapterDeactivation/Server.cs b/cs/test/Ice/adapterDeactivation/Server.cs
index b023f58a483..be2c9cb82e4 100644
--- a/cs/test/Ice/adapterDeactivation/Server.cs
+++ b/cs/test/Ice/adapterDeactivation/Server.cs
@@ -7,11 +7,19 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
- internal class TestServer : Ice.Application
+ internal class App : Ice.Application
{
public override int run(string[] args)
{
@@ -29,7 +37,7 @@ public class Server
{
Debug.Listeners.Add(new ConsoleTraceListener());
- TestServer app = new TestServer();
+ App app = new App();
int result = app.main(args);
if(result != 0)
{
diff --git a/cs/test/Ice/application/Client.cs b/cs/test/Ice/application/Client.cs
index 982f4b079e7..aa3728a67cc 100644
--- a/cs/test/Ice/application/Client.cs
+++ b/cs/test/Ice/application/Client.cs
@@ -9,51 +9,61 @@
using System;
using System.Diagnostics;
+using System.Reflection;
-public class Client : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public override void interruptCallback(int sig)
+ public class App : Ice.Application
{
- Console.WriteLine("handling signal " + sig);
- }
+ public override void interruptCallback(int 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);
+ 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);
- 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");
- return 0;
+ Console.WriteLine("ok");
+ return 0;
+ }
}
public static void Main(string[] args)
{
Debug.Listeners.Add(new ConsoleTraceListener());
- Client app = new Client();
+ App app = new App();
int status = app.main(args);
if(status != 0)
{
diff --git a/cs/test/Ice/background/Client.cs b/cs/test/Ice/background/Client.cs
index 1eba700019c..6092d50c09d 100644
--- a/cs/test/Ice/background/Client.cs
+++ b/cs/test/Ice/background/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/background/Server.cs b/cs/test/Ice/background/Server.cs
index 47c34f94991..caac923f686 100644
--- a/cs/test/Ice/background/Server.cs
+++ b/cs/test/Ice/background/Server.cs
@@ -8,8 +8,15 @@
// **********************************************************************
using System;
-using System.Diagnostics;
using System.IO;
+using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/binding/Client.cs b/cs/test/Ice/binding/Client.cs
index 46a9167f381..71e866a4713 100644
--- a/cs/test/Ice/binding/Client.cs
+++ b/cs/test/Ice/binding/Client.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/binding/Server.cs b/cs/test/Ice/binding/Server.cs
index 2888ae09e9d..06b393ee580 100644
--- a/cs/test/Ice/binding/Server.cs
+++ b/cs/test/Ice/binding/Server.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/dictMapping/Client.cs b/cs/test/Ice/dictMapping/Client.cs
index 9069c9af277..90ebcd39d5f 100644
--- a/cs/test/Ice/dictMapping/Client.cs
+++ b/cs/test/Ice/dictMapping/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/dictMapping/Collocated.cs b/cs/test/Ice/dictMapping/Collocated.cs
index b6d3b70a878..73412ceaf2d 100644
--- a/cs/test/Ice/dictMapping/Collocated.cs
+++ b/cs/test/Ice/dictMapping/Collocated.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
diff --git a/cs/test/Ice/dictMapping/Server.cs b/cs/test/Ice/dictMapping/Server.cs
index 8331dc978fd..3f317c872e0 100644
--- a/cs/test/Ice/dictMapping/Server.cs
+++ b/cs/test/Ice/dictMapping/Server.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/exceptions/Client.cs b/cs/test/Ice/exceptions/Client.cs
index ddb657c38af..f88d5edefad 100644
--- a/cs/test/Ice/exceptions/Client.cs
+++ b/cs/test/Ice/exceptions/Client.cs
@@ -8,7 +8,15 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/exceptions/Collocated.cs b/cs/test/Ice/exceptions/Collocated.cs
index 7db181c02ac..7452b6db6c1 100644
--- a/cs/test/Ice/exceptions/Collocated.cs
+++ b/cs/test/Ice/exceptions/Collocated.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
diff --git a/cs/test/Ice/exceptions/Server.cs b/cs/test/Ice/exceptions/Server.cs
index b0145656d05..9ea149e602c 100644
--- a/cs/test/Ice/exceptions/Server.cs
+++ b/cs/test/Ice/exceptions/Server.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public sealed class DummyLogger : Ice.Logger
{
diff --git a/cs/test/Ice/facets/Client.cs b/cs/test/Ice/facets/Client.cs
index 04c65ce1167..7dc865b88cb 100644
--- a/cs/test/Ice/facets/Client.cs
+++ b/cs/test/Ice/facets/Client.cs
@@ -8,7 +8,15 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/facets/Collocated.cs b/cs/test/Ice/facets/Collocated.cs
index 0ad4c7e22fe..74746de8dd3 100644
--- a/cs/test/Ice/facets/Collocated.cs
+++ b/cs/test/Ice/facets/Collocated.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
diff --git a/cs/test/Ice/facets/Server.cs b/cs/test/Ice/facets/Server.cs
index 638de2b77ce..3e58bc2fd34 100644
--- a/cs/test/Ice/facets/Server.cs
+++ b/cs/test/Ice/facets/Server.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/faultTolerance/Client.cs b/cs/test/Ice/faultTolerance/Client.cs
index ea74ecf350e..45149e67167 100644
--- a/cs/test/Ice/faultTolerance/Client.cs
+++ b/cs/test/Ice/faultTolerance/Client.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/faultTolerance/Server.cs b/cs/test/Ice/faultTolerance/Server.cs
index 1409ffd45b0..5109ec9a574 100644
--- a/cs/test/Ice/faultTolerance/Server.cs
+++ b/cs/test/Ice/faultTolerance/Server.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/hold/Client.cs b/cs/test/Ice/hold/Client.cs
index 6990e7a3c83..5e44d01d6c8 100644
--- a/cs/test/Ice/hold/Client.cs
+++ b/cs/test/Ice/hold/Client.cs
@@ -8,7 +8,15 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/hold/Server.cs b/cs/test/Ice/hold/Server.cs
index f8e6833970b..1732fb62b92 100644
--- a/cs/test/Ice/hold/Server.cs
+++ b/cs/test/Ice/hold/Server.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/inheritance/Client.cs b/cs/test/Ice/inheritance/Client.cs
index ad51f906ff3..a9f936b6ae7 100644
--- a/cs/test/Ice/inheritance/Client.cs
+++ b/cs/test/Ice/inheritance/Client.cs
@@ -8,7 +8,15 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/inheritance/Collocated.cs b/cs/test/Ice/inheritance/Collocated.cs
index 982f3326ed2..305c2aa9449 100644
--- a/cs/test/Ice/inheritance/Collocated.cs
+++ b/cs/test/Ice/inheritance/Collocated.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
diff --git a/cs/test/Ice/inheritance/Server.cs b/cs/test/Ice/inheritance/Server.cs
index fe625a4d1c5..1fc69c9de2c 100644
--- a/cs/test/Ice/inheritance/Server.cs
+++ b/cs/test/Ice/inheritance/Server.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/interceptor/Client.cs b/cs/test/Ice/interceptor/Client.cs
index 7ac045c99b4..4b7aea52c1c 100644
--- a/cs/test/Ice/interceptor/Client.cs
+++ b/cs/test/Ice/interceptor/Client.cs
@@ -8,221 +8,226 @@
// **********************************************************************
using System;
-using System.Collections;
using System.Diagnostics;
+using System.Reflection;
-public class Client : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- private static void test(bool b)
+ public class App : Ice.Application
{
- if(!b)
+ private static void test(bool b)
{
- throw new Exception();
+ if(!b)
+ {
+ throw new Exception();
+ }
}
- }
- private int
- run(Test.MyObjectPrx prx, InterceptorI interceptor)
- {
- Console.Out.Write("testing simple interceptor... ");
- Console.Out.Flush();
- test(interceptor.getLastOperation() == null);
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchAsync);
- prx.ice_ping();
- test(interceptor.getLastOperation().Equals("ice_ping"));
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
- String typeId = prx.ice_id();
- test(interceptor.getLastOperation().Equals("ice_id"));
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
- test(prx.ice_isA(typeId));
- test(interceptor.getLastOperation().Equals("ice_isA"));
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
- test(prx.add(33, 12) == 45);
- test(interceptor.getLastOperation().Equals("add"));
- test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchOK));
- Console.WriteLine("ok");
- Console.Out.Write("testing retry... ");
- Console.Out.Flush();
- test(prx.addWithRetry(33, 12) == 45);
- test(interceptor.getLastOperation().Equals("addWithRetry"));
- test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchOK));
- Console.WriteLine("ok");
- Console.Out.Write("testing user exception... ");
- Console.Out.Flush();
- try
+ private int run(Test.MyObjectPrx prx, InterceptorI interceptor)
{
- prx.badAdd(33, 12);
- test(false);
- }
- catch(Test.InvalidInputException)
- {
- // expected
- }
- test(interceptor.getLastOperation().Equals("badAdd"));
- test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchUserException));
- Console.WriteLine("ok");
- Console.Out.Write("testing ONE... ");
- Console.Out.Flush();
- interceptor.clear();
- try
- {
- prx.notExistAdd(33, 12);
- test(false);
- }
- catch(Ice.ObjectNotExistException)
- {
- // expected
- }
- test(interceptor.getLastOperation().Equals("notExistAdd"));
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchAsync);
- Console.WriteLine("ok");
- Console.Out.Write("testing system exception... ");
- Console.Out.Flush();
- interceptor.clear();
- try
- {
- prx.badSystemAdd(33, 12);
- test(false);
- }
- catch(Ice.UnknownLocalException)
- {
- }
- catch(Exception)
- {
- test(false);
+ Console.Out.Write("testing simple interceptor... ");
+ Console.Out.Flush();
+ test(interceptor.getLastOperation() == null);
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchAsync);
+ prx.ice_ping();
+ test(interceptor.getLastOperation().Equals("ice_ping"));
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ String typeId = prx.ice_id();
+ test(interceptor.getLastOperation().Equals("ice_id"));
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ test(prx.ice_isA(typeId));
+ test(interceptor.getLastOperation().Equals("ice_isA"));
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchOK);
+ test(prx.add(33, 12) == 45);
+ test(interceptor.getLastOperation().Equals("add"));
+ test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchOK));
+ Console.WriteLine("ok");
+ Console.Out.Write("testing retry... ");
+ Console.Out.Flush();
+ test(prx.addWithRetry(33, 12) == 45);
+ test(interceptor.getLastOperation().Equals("addWithRetry"));
+ test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchOK));
+ Console.WriteLine("ok");
+ Console.Out.Write("testing user exception... ");
+ Console.Out.Flush();
+ try
+ {
+ prx.badAdd(33, 12);
+ test(false);
+ }
+ catch(Test.InvalidInputException)
+ {
+ // expected
+ }
+ test(interceptor.getLastOperation().Equals("badAdd"));
+ test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchUserException));
+ Console.WriteLine("ok");
+ Console.Out.Write("testing ONE... ");
+ Console.Out.Flush();
+ interceptor.clear();
+ try
+ {
+ prx.notExistAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException)
+ {
+ // expected
+ }
+ test(interceptor.getLastOperation().Equals("notExistAdd"));
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchAsync);
+ Console.WriteLine("ok");
+ Console.Out.Write("testing system exception... ");
+ Console.Out.Flush();
+ interceptor.clear();
+ try
+ {
+ prx.badSystemAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.UnknownLocalException)
+ {
+ }
+ catch(Exception)
+ {
+ test(false);
+ }
+ test(interceptor.getLastOperation().Equals("badSystemAdd"));
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchAsync);
+ Console.WriteLine("ok");
+ if(!prx.ice_isCollocationOptimized())
+ {
+ Console.Out.Write("testing simple AMD... ");
+ Console.Out.Flush();
+ test(prx.amdAdd(33, 12) == 45);
+ test(interceptor.getLastOperation().Equals("amdAdd"));
+ test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
+ Console.WriteLine("ok");
+ }
+ return 0;
}
- test(interceptor.getLastOperation().Equals("badSystemAdd"));
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchAsync);
- Console.WriteLine("ok");
- if(!prx.ice_isCollocationOptimized())
+
+ private int runAmd(Test.MyObjectPrx prx, AMDInterceptorI interceptor)
{
- Console.Out.Write("testing simple AMD... ");
+ Console.Out.Write("testing simple interceptor... ");
Console.Out.Flush();
+ test(interceptor.getLastOperation() == null);
+ test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchAsync);
test(prx.amdAdd(33, 12) == 45);
test(interceptor.getLastOperation().Equals("amdAdd"));
test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus().Equals(Ice.DispatchStatus.DispatchOK));
Console.WriteLine("ok");
+ Console.Out.Write("testing retry... ");
+ Console.Out.Flush();
+ test(prx.amdAddWithRetry(33, 12) == 45);
+ test(interceptor.getLastOperation().Equals("amdAddWithRetry"));
+ test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus().Equals(Ice.DispatchStatus.DispatchOK));
+ Console.WriteLine("ok");
+ Console.Out.Write("testing user exception... ");
+ Console.Out.Flush();
+ try
+ {
+ prx.amdBadAdd(33, 12);
+ test(false);
+ }
+ catch(Test.InvalidInputException)
+ {
+ // expected
+ }
+ test(interceptor.getLastOperation().Equals("amdBadAdd"));
+ test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus().Equals(Ice.DispatchStatus.DispatchUserException));
+ Console.WriteLine("ok");
+ Console.Out.Write("testing ONE... ");
+ Console.Out.Flush();
+ interceptor.clear();
+ try
+ {
+ prx.amdNotExistAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException)
+ {
+ // expected
+ }
+ test(interceptor.getLastOperation().Equals("amdNotExistAdd"));
+ test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus() == Ice.DispatchStatus.DispatchAsync);
+ test(interceptor.getException() is Ice.ObjectNotExistException);
+ Console.WriteLine("ok");
+ Console.Out.Write("testing system exception... ");
+ Console.Out.Flush();
+ interceptor.clear();
+ try
+ {
+ prx.amdBadSystemAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.UnknownLocalException)
+ {
+ test(!prx.ice_isCollocationOptimized());
+ }
+ test(interceptor.getLastOperation().Equals("amdBadSystemAdd"));
+ test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
+ test(interceptor.getActualStatus() == Ice.DispatchStatus.DispatchAsync);
+ test(interceptor.getException() is Ice.InitializationException);
+ Console.WriteLine("ok");
+ return 0;
}
- return 0;
- }
-
- private int
- runAmd(Test.MyObjectPrx prx, AMDInterceptorI interceptor)
- {
- Console.Out.Write("testing simple interceptor... ");
- Console.Out.Flush();
- test(interceptor.getLastOperation() == null);
- test(interceptor.getLastStatus() == Ice.DispatchStatus.DispatchAsync);
- test(prx.amdAdd(33, 12) == 45);
- test(interceptor.getLastOperation().Equals("amdAdd"));
- test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus().Equals(Ice.DispatchStatus.DispatchOK));
- Console.WriteLine("ok");
- Console.Out.Write("testing retry... ");
- Console.Out.Flush();
- test(prx.amdAddWithRetry(33, 12) == 45);
- test(interceptor.getLastOperation().Equals("amdAddWithRetry"));
- test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus().Equals(Ice.DispatchStatus.DispatchOK));
- Console.WriteLine("ok");
- Console.Out.Write("testing user exception... ");
- Console.Out.Flush();
- try
- {
- prx.amdBadAdd(33, 12);
- test(false);
- }
- catch(Test.InvalidInputException)
- {
- // expected
- }
- test(interceptor.getLastOperation().Equals("amdBadAdd"));
- test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus().Equals(Ice.DispatchStatus.DispatchUserException));
- Console.WriteLine("ok");
- Console.Out.Write("testing ONE... ");
- Console.Out.Flush();
- interceptor.clear();
- try
- {
- prx.amdNotExistAdd(33, 12);
- test(false);
- }
- catch(Ice.ObjectNotExistException)
- {
- // expected
- }
- test(interceptor.getLastOperation().Equals("amdNotExistAdd"));
- test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus() == Ice.DispatchStatus.DispatchAsync);
- test(interceptor.getException() is Ice.ObjectNotExistException);
- Console.WriteLine("ok");
- Console.Out.Write("testing system exception... ");
- Console.Out.Flush();
- interceptor.clear();
- try
- {
- prx.amdBadSystemAdd(33, 12);
- test(false);
- }
- catch(Ice.UnknownLocalException)
- {
- test(!prx.ice_isCollocationOptimized());
- }
- test(interceptor.getLastOperation().Equals("amdBadSystemAdd"));
- test(interceptor.getLastStatus().Equals(Ice.DispatchStatus.DispatchAsync));
- test(interceptor.getActualStatus() == Ice.DispatchStatus.DispatchAsync);
- test(interceptor.getException() is Ice.InitializationException);
- Console.WriteLine("ok");
- return 0;
- }
-
- public override int run(string[] args)
- {
- //
- // Create OA and servants
- //
-
- communicator().getProperties().setProperty("MyOA.AdapterId", "myOA");
+ public override int run(string[] args)
+ {
+ //
+ // Create OA and servants
+ //
- Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost");
+ communicator().getProperties().setProperty("MyOA.AdapterId", "myOA");
- Ice.Object servant = new MyObjectI();
- InterceptorI interceptor = new InterceptorI(servant);
-
- Test.MyObjectPrx prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor));
-
- oa.activate();
-
- Console.WriteLine("Collocation optimization on");
- int rs = run(prx, interceptor);
- if(rs == 0)
- {
- Console.WriteLine("Collocation optimization off");
- interceptor.clear();
- prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));
- rs = run(prx, interceptor);
+ Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost");
+ Ice.Object servant = new MyObjectI();
+ InterceptorI interceptor = new InterceptorI(servant);
+
+ Test.MyObjectPrx prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor));
+
+ oa.activate();
+
+ Console.WriteLine("Collocation optimization on");
+ int rs = run(prx, interceptor);
if(rs == 0)
{
- Console.WriteLine("Now with AMD");
- AMDInterceptorI amdInterceptor = new AMDInterceptorI(servant);
- prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(amdInterceptor));
+ Console.WriteLine("Collocation optimization off");
+ interceptor.clear();
prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));
+ rs = run(prx, interceptor);
+
+ if(rs == 0)
+ {
+ Console.WriteLine("Now with AMD");
+ AMDInterceptorI amdInterceptor = new AMDInterceptorI(servant);
+ prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(amdInterceptor));
+ prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));
- rs = runAmd(prx, amdInterceptor);
+ rs = runAmd(prx, amdInterceptor);
+ }
}
+ return rs;
}
- return rs;
}
-
public static void Main(string[] args)
{
Debug.Listeners.Add(new ConsoleTraceListener());
- Client app = new Client();
+ App app = new App();
int status = app.main(args);
if(status != 0)
{
diff --git a/cs/test/Ice/location/Client.cs b/cs/test/Ice/location/Client.cs
index 20c9136a708..7bae5bb5174 100644
--- a/cs/test/Ice/location/Client.cs
+++ b/cs/test/Ice/location/Client.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/location/Server.cs b/cs/test/Ice/location/Server.cs
index 827f4727c30..cde601a5a2f 100644
--- a/cs/test/Ice/location/Server.cs
+++ b/cs/test/Ice/location/Server.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/objects/Client.cs b/cs/test/Ice/objects/Client.cs
index 8ef962457b8..6ce5bbb0b7e 100644
--- a/cs/test/Ice/objects/Client.cs
+++ b/cs/test/Ice/objects/Client.cs
@@ -8,7 +8,15 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/objects/Collocated.cs b/cs/test/Ice/objects/Collocated.cs
index 68fcae03ab6..46cabde19f6 100644
--- a/cs/test/Ice/objects/Collocated.cs
+++ b/cs/test/Ice/objects/Collocated.cs
@@ -8,7 +8,15 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/objects/Server.cs b/cs/test/Ice/objects/Server.cs
index 85e96f0384c..49cc5830022 100644
--- a/cs/test/Ice/objects/Server.cs
+++ b/cs/test/Ice/objects/Server.cs
@@ -7,7 +7,15 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/operations/Client.cs b/cs/test/Ice/operations/Client.cs
index 122016df5af..3b64c2cb6f4 100644
--- a/cs/test/Ice/operations/Client.cs
+++ b/cs/test/Ice/operations/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/operations/Collocated.cs b/cs/test/Ice/operations/Collocated.cs
index 3ce695f95f5..ca67e56c515 100644
--- a/cs/test/Ice/operations/Collocated.cs
+++ b/cs/test/Ice/operations/Collocated.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
diff --git a/cs/test/Ice/operations/Server.cs b/cs/test/Ice/operations/Server.cs
index f7c2ed50ace..145e417cd0a 100644
--- a/cs/test/Ice/operations/Server.cs
+++ b/cs/test/Ice/operations/Server.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/proxy/Client.cs b/cs/test/Ice/proxy/Client.cs
index 759445fc418..fd32e42800c 100644
--- a/cs/test/Ice/proxy/Client.cs
+++ b/cs/test/Ice/proxy/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/proxy/Collocated.cs b/cs/test/Ice/proxy/Collocated.cs
index 74feb0d1d93..25446178ce6 100644
--- a/cs/test/Ice/proxy/Collocated.cs
+++ b/cs/test/Ice/proxy/Collocated.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
diff --git a/cs/test/Ice/proxy/Server.cs b/cs/test/Ice/proxy/Server.cs
index d8668bb4e81..599d5e5871a 100644
--- a/cs/test/Ice/proxy/Server.cs
+++ b/cs/test/Ice/proxy/Server.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/retry/Client.cs b/cs/test/Ice/retry/Client.cs
index 7bcd92e392c..66ab0f6cafa 100644
--- a/cs/test/Ice/retry/Client.cs
+++ b/cs/test/Ice/retry/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/retry/Server.cs b/cs/test/Ice/retry/Server.cs
index 129ece1fc4e..1001b619c2a 100644
--- a/cs/test/Ice/retry/Server.cs
+++ b/cs/test/Ice/retry/Server.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/seqMapping/Client.cs b/cs/test/Ice/seqMapping/Client.cs
index 9069c9af277..90ebcd39d5f 100644
--- a/cs/test/Ice/seqMapping/Client.cs
+++ b/cs/test/Ice/seqMapping/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/seqMapping/Collocated.cs b/cs/test/Ice/seqMapping/Collocated.cs
index b6d3b70a878..73412ceaf2d 100644
--- a/cs/test/Ice/seqMapping/Collocated.cs
+++ b/cs/test/Ice/seqMapping/Collocated.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
diff --git a/cs/test/Ice/seqMapping/Server.cs b/cs/test/Ice/seqMapping/Server.cs
index db0bd3d3dcf..8e3a6da909f 100644
--- a/cs/test/Ice/seqMapping/Server.cs
+++ b/cs/test/Ice/seqMapping/Server.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/servantLocator/Client.cs b/cs/test/Ice/servantLocator/Client.cs
index 17ae79b04a9..2ae63f3c300 100644
--- a/cs/test/Ice/servantLocator/Client.cs
+++ b/cs/test/Ice/servantLocator/Client.cs
@@ -8,11 +8,19 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
- internal class TestClient : Ice.Application
+ internal class App : Ice.Application
{
public override int run(string[] args)
{
@@ -26,7 +34,7 @@ public class Client
{
Debug.Listeners.Add(new ConsoleTraceListener());
- TestClient app = new TestClient();
+ App app = new App();
int result = app.main(args);
if(result != 0)
{
diff --git a/cs/test/Ice/servantLocator/Collocated.cs b/cs/test/Ice/servantLocator/Collocated.cs
index d2e07dfe2ab..18304574bb8 100644
--- a/cs/test/Ice/servantLocator/Collocated.cs
+++ b/cs/test/Ice/servantLocator/Collocated.cs
@@ -8,11 +8,19 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Collocated
{
- internal class TestClient : Ice.Application
+ internal class App : Ice.Application
{
public override int run(string[] args)
{
@@ -34,7 +42,7 @@ public class Collocated
{
Debug.Listeners.Add(new ConsoleTraceListener());
- TestClient app = new TestClient();
+ App app = new App();
int result = app.main(args);
if(result != 0)
{
diff --git a/cs/test/Ice/servantLocator/Server.cs b/cs/test/Ice/servantLocator/Server.cs
index e5e10676427..4c1014f70f9 100644
--- a/cs/test/Ice/servantLocator/Server.cs
+++ b/cs/test/Ice/servantLocator/Server.cs
@@ -7,11 +7,19 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
- internal class TestServer : Ice.Application
+ internal class App : Ice.Application
{
public override int run(string[] args)
{
@@ -33,7 +41,7 @@ public class Server
{
Debug.Listeners.Add(new ConsoleTraceListener());
- TestServer app = new TestServer();
+ App app = new App();
int result = app.main(args);
if(result != 0)
{
diff --git a/cs/test/Ice/stream/Client.cs b/cs/test/Ice/stream/Client.cs
index 2fe61263f25..bd3558e1226 100644
--- a/cs/test/Ice/stream/Client.cs
+++ b/cs/test/Ice/stream/Client.cs
@@ -8,8 +8,15 @@
// **********************************************************************
using System;
-using System.Collections;
using System.Diagnostics;
+using System.Reflection;
+using System.Collections;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/threads/Client.cs b/cs/test/Ice/threads/Client.cs
index a50362d9625..d7d9c8c0182 100644
--- a/cs/test/Ice/threads/Client.cs
+++ b/cs/test/Ice/threads/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/threads/Server.cs b/cs/test/Ice/threads/Server.cs
index 1301605dbb1..86e4f456d31 100644
--- a/cs/test/Ice/threads/Server.cs
+++ b/cs/test/Ice/threads/Server.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/Ice/timeout/Client.cs b/cs/test/Ice/timeout/Client.cs
index 3e00f43d9d0..da11a9d5dfd 100644
--- a/cs/test/Ice/timeout/Client.cs
+++ b/cs/test/Ice/timeout/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/Ice/timeout/Server.cs b/cs/test/Ice/timeout/Server.cs
index 0c9b484acc3..c654366a4d7 100644
--- a/cs/test/Ice/timeout/Server.cs
+++ b/cs/test/Ice/timeout/Server.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{
diff --git a/cs/test/IceBox/configuration/Client.cs b/cs/test/IceBox/configuration/Client.cs
index b960674d51c..599525cb428 100644
--- a/cs/test/IceBox/configuration/Client.cs
+++ b/cs/test/IceBox/configuration/Client.cs
@@ -8,7 +8,15 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/IceGrid/simple/Client.cs b/cs/test/IceGrid/simple/Client.cs
index 11fa0aebc98..a309a3f67b1 100644
--- a/cs/test/IceGrid/simple/Client.cs
+++ b/cs/test/IceGrid/simple/Client.cs
@@ -8,7 +8,15 @@
// **********************************************************************
using Test;
+using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/IceGrid/simple/Server.cs b/cs/test/IceGrid/simple/Server.cs
index b85d3b640ee..f85d70772cd 100644
--- a/cs/test/IceGrid/simple/Server.cs
+++ b/cs/test/IceGrid/simple/Server.cs
@@ -7,32 +7,43 @@
//
// **********************************************************************
+using System;
using System.Diagnostics;
+using System.Reflection;
-public class Server : Ice.Application
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
{
- public override int run(string[] args)
+ public class App : Ice.Application
{
- 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)
+ public override int run(string[] 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)
+ {
+ }
+ communicator().waitForShutdown();
+ return 0;
}
- communicator().waitForShutdown();
- return 0;
}
public static void Main(string[] args)
{
Debug.Listeners.Add(new ConsoleTraceListener());
- Server server = new Server();
+ App server = new App();
int status = server.main(args);
if(status != 0)
{
diff --git a/cs/test/IceSSL/configuration/Client.cs b/cs/test/IceSSL/configuration/Client.cs
index fc3e74b65c1..ea962ab5041 100644
--- a/cs/test/IceSSL/configuration/Client.cs
+++ b/cs/test/IceSSL/configuration/Client.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Client
{
diff --git a/cs/test/IceSSL/configuration/Server.cs b/cs/test/IceSSL/configuration/Server.cs
index b1061b81815..1acc8ddd4a8 100644
--- a/cs/test/IceSSL/configuration/Server.cs
+++ b/cs/test/IceSSL/configuration/Server.cs
@@ -9,6 +9,13 @@
using System;
using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
public class Server
{