summaryrefslogtreecommitdiff
path: root/csharp/test
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/test')
-rw-r--r--csharp/test/Glacier2/router/Client.cs658
-rw-r--r--csharp/test/Glacier2/router/Server.cs35
-rw-r--r--csharp/test/Glacier2/router/msbuild/client/client.csproj3
-rw-r--r--csharp/test/Glacier2/router/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Glacier2/router/run.py57
-rw-r--r--csharp/test/Glacier2/sessionHelper/Client.cs740
-rw-r--r--csharp/test/Glacier2/sessionHelper/Server.cs27
-rw-r--r--csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj3
-rw-r--r--csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Glacier2/sessionHelper/run.py48
-rw-r--r--csharp/test/Ice/acm/AllTests.cs7
-rw-r--r--csharp/test/Ice/acm/Client.cs46
-rw-r--r--csharp/test/Ice/acm/Server.cs56
-rw-r--r--csharp/test/Ice/acm/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/acm/run.py24
-rw-r--r--csharp/test/Ice/adapterDeactivation/AllTests.cs9
-rw-r--r--csharp/test/Ice/adapterDeactivation/Client.cs17
-rw-r--r--csharp/test/Ice/adapterDeactivation/Collocated.cs33
-rw-r--r--csharp/test/Ice/adapterDeactivation/Server.cs29
-rw-r--r--csharp/test/Ice/adapterDeactivation/TestI.cs3
-rw-r--r--csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/adapterDeactivation/run.py25
-rw-r--r--csharp/test/Ice/admin/AllTests.cs83
-rw-r--r--csharp/test/Ice/admin/Client.cs38
-rw-r--r--csharp/test/Ice/admin/Server.cs40
-rw-r--r--csharp/test/Ice/admin/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/admin/run.py24
-rw-r--r--csharp/test/Ice/ami/AllTests.cs9
-rw-r--r--csharp/test/Ice/ami/Client.cs57
-rw-r--r--csharp/test/Ice/ami/Collocated.cs61
-rw-r--r--csharp/test/Ice/ami/Server.cs78
-rw-r--r--csharp/test/Ice/ami/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/ami/run.py25
-rw-r--r--csharp/test/Ice/application/test.py11
-rw-r--r--csharp/test/Ice/background/AllTests.cs15
-rw-r--r--csharp/test/Ice/background/Client.cs95
-rw-r--r--csharp/test/Ice/background/Server.cs93
-rw-r--r--csharp/test/Ice/background/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/background/run.py24
-rw-r--r--csharp/test/Ice/binding/AllTests.cs21
-rw-r--r--csharp/test/Ice/binding/Client.cs36
-rw-r--r--csharp/test/Ice/binding/RemoteCommunicatorI.cs15
-rw-r--r--csharp/test/Ice/binding/Server.cs52
-rw-r--r--csharp/test/Ice/binding/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/binding/run.py24
-rw-r--r--csharp/test/Ice/checksum/AllTests.cs16
-rw-r--r--csharp/test/Ice/checksum/Client.cs36
-rw-r--r--csharp/test/Ice/checksum/msbuild/client/client.csproj3
-rwxr-xr-xcsharp/test/Ice/checksum/run.py24
-rw-r--r--csharp/test/Ice/checksum/server/Server.cs40
-rw-r--r--csharp/test/Ice/checksum/server/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/checksum/test.py11
-rw-r--r--csharp/test/Ice/defaultServant/AllTests.cs3
-rw-r--r--csharp/test/Ice/defaultServant/Client.cs36
-rwxr-xr-xcsharp/test/Ice/defaultServant/run.py31
-rw-r--r--csharp/test/Ice/defaultValue/AllTests.cs2
-rw-r--r--csharp/test/Ice/defaultValue/Client.cs20
-rwxr-xr-xcsharp/test/Ice/defaultValue/run.py30
-rw-r--r--csharp/test/Ice/dictMapping/AllTests.cs7
-rw-r--r--csharp/test/Ice/dictMapping/Client.cs36
-rw-r--r--csharp/test/Ice/dictMapping/Collocated.cs40
-rw-r--r--csharp/test/Ice/dictMapping/Server.cs40
-rw-r--r--csharp/test/Ice/dictMapping/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/dictMapping/run.py27
-rw-r--r--csharp/test/Ice/dispatcher/AllTests.cs10
-rw-r--r--csharp/test/Ice/dispatcher/Client.cs57
-rw-r--r--csharp/test/Ice/dispatcher/Collocated.cs57
-rw-r--r--csharp/test/Ice/dispatcher/Server.cs67
-rw-r--r--csharp/test/Ice/dispatcher/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/dispatcher/run.py25
-rw-r--r--csharp/test/Ice/echo/Server.cs42
-rw-r--r--csharp/test/Ice/echo/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/echo/run.py30
-rw-r--r--csharp/test/Ice/enums/AllTests.cs7
-rw-r--r--csharp/test/Ice/enums/Client.cs38
-rw-r--r--csharp/test/Ice/enums/Server.cs52
-rw-r--r--csharp/test/Ice/enums/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/enums/run.py28
-rw-r--r--csharp/test/Ice/exceptions/AllTests.cs11
-rw-r--r--csharp/test/Ice/exceptions/Client.cs50
-rw-r--r--csharp/test/Ice/exceptions/Collocated.cs54
-rw-r--r--csharp/test/Ice/exceptions/Server.cs73
-rw-r--r--csharp/test/Ice/exceptions/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/exceptions/run.py50
-rw-r--r--csharp/test/Ice/facets/AllTests.cs18
-rw-r--r--csharp/test/Ice/facets/Client.cs36
-rw-r--r--csharp/test/Ice/facets/Collocated.cs42
-rw-r--r--csharp/test/Ice/facets/Server.cs42
-rw-r--r--csharp/test/Ice/facets/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/facets/run.py25
-rw-r--r--csharp/test/Ice/faultTolerance/AllTests.cs7
-rw-r--r--csharp/test/Ice/faultTolerance/Client.cs50
-rw-r--r--csharp/test/Ice/faultTolerance/Server.cs56
-rw-r--r--csharp/test/Ice/faultTolerance/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/faultTolerance/run.py55
-rw-r--r--csharp/test/Ice/hash/Client.cs25
-rwxr-xr-xcsharp/test/Ice/hash/run.py23
-rw-r--r--csharp/test/Ice/hold/AllTests.cs23
-rw-r--r--csharp/test/Ice/hold/Client.cs36
-rw-r--r--csharp/test/Ice/hold/Server.cs60
-rw-r--r--csharp/test/Ice/hold/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/hold/run.py24
-rw-r--r--csharp/test/Ice/info/AllTests.cs28
-rw-r--r--csharp/test/Ice/info/Client.cs36
-rw-r--r--csharp/test/Ice/info/Server.cs43
-rw-r--r--csharp/test/Ice/info/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/info/run.py24
-rw-r--r--csharp/test/Ice/inheritance/AllTests.cs41
-rw-r--r--csharp/test/Ice/inheritance/Client.cs37
-rw-r--r--csharp/test/Ice/inheritance/Collocated.cs40
-rw-r--r--csharp/test/Ice/inheritance/Server.cs40
-rw-r--r--csharp/test/Ice/inheritance/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/inheritance/run.py25
-rw-r--r--csharp/test/Ice/interceptor/Client.cs414
-rw-r--r--csharp/test/Ice/interceptor/msbuild/client/client.csproj3
-rwxr-xr-xcsharp/test/Ice/interceptor/run.py31
-rw-r--r--csharp/test/Ice/invoke/AllTests.cs7
-rw-r--r--csharp/test/Ice/invoke/Client.cs38
-rw-r--r--csharp/test/Ice/invoke/Server.cs42
-rw-r--r--csharp/test/Ice/invoke/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/invoke/run.py26
-rw-r--r--csharp/test/Ice/location/AllTests.cs51
-rw-r--r--csharp/test/Ice/location/Client.cs46
-rw-r--r--csharp/test/Ice/location/Server.cs55
-rw-r--r--csharp/test/Ice/location/ServerManagerI.cs19
-rw-r--r--csharp/test/Ice/location/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/location/run.py24
-rw-r--r--csharp/test/Ice/metrics/AllTests.cs88
-rw-r--r--csharp/test/Ice/metrics/Client.cs60
-rw-r--r--csharp/test/Ice/metrics/Collocated.cs70
-rw-r--r--csharp/test/Ice/metrics/Server.cs66
-rw-r--r--csharp/test/Ice/metrics/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/metrics/run.py27
-rw-r--r--csharp/test/Ice/networkProxy/AllTests.cs15
-rw-r--r--csharp/test/Ice/networkProxy/Client.cs38
-rw-r--r--csharp/test/Ice/networkProxy/Server.cs42
-rw-r--r--csharp/test/Ice/networkProxy/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/networkProxy/run.py45
-rw-r--r--csharp/test/Ice/objects/AllTests.cs9
-rw-r--r--csharp/test/Ice/objects/Client.cs37
-rw-r--r--csharp/test/Ice/objects/Collocated.cs41
-rw-r--r--csharp/test/Ice/objects/Server.cs47
-rw-r--r--csharp/test/Ice/objects/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/objects/run.py34
-rw-r--r--csharp/test/Ice/operations/AllTests.cs19
-rw-r--r--csharp/test/Ice/operations/Client.cs55
-rw-r--r--csharp/test/Ice/operations/Collocated.cs64
-rw-r--r--csharp/test/Ice/operations/Oneways.cs3
-rw-r--r--csharp/test/Ice/operations/OnewaysAMI.cs3
-rw-r--r--csharp/test/Ice/operations/Server.cs62
-rw-r--r--csharp/test/Ice/operations/Twoways.cs5
-rw-r--r--csharp/test/Ice/operations/TwowaysAMI.cs8
-rw-r--r--csharp/test/Ice/operations/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj3
-rw-r--r--csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj3
-rw-r--r--csharp/test/Ice/operations/msbuild/servertie/servertie.csproj3
-rwxr-xr-xcsharp/test/Ice/operations/run.py31
-rw-r--r--csharp/test/Ice/optional/AllTests.cs7
-rw-r--r--csharp/test/Ice/optional/Client.cs37
-rw-r--r--csharp/test/Ice/optional/Server.cs41
-rw-r--r--csharp/test/Ice/optional/ServerAMD.cs41
-rw-r--r--csharp/test/Ice/optional/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/optional/run.py29
-rwxr-xr-xcsharp/test/Ice/plugin/run.py30
-rw-r--r--csharp/test/Ice/properties/Client.cs6
-rwxr-xr-xcsharp/test/Ice/properties/run.py45
-rw-r--r--csharp/test/Ice/proxy/AllTests.cs27
-rw-r--r--csharp/test/Ice/proxy/Client.cs39
-rw-r--r--csharp/test/Ice/proxy/Collocated.cs55
-rw-r--r--csharp/test/Ice/proxy/Server.cs46
-rw-r--r--csharp/test/Ice/proxy/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/proxy/run.py27
-rw-r--r--csharp/test/Ice/retry/AllTests.cs5
-rw-r--r--csharp/test/Ice/retry/Client.cs100
-rw-r--r--csharp/test/Ice/retry/Collocated.cs108
-rw-r--r--csharp/test/Ice/retry/Server.cs50
-rw-r--r--csharp/test/Ice/retry/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/retry/run.py25
-rw-r--r--csharp/test/Ice/seqMapping/AllTests.cs7
-rw-r--r--csharp/test/Ice/seqMapping/Client.cs36
-rw-r--r--csharp/test/Ice/seqMapping/Collocated.cs43
-rw-r--r--csharp/test/Ice/seqMapping/Server.cs41
-rw-r--r--csharp/test/Ice/seqMapping/ServerAMD.cs41
-rw-r--r--csharp/test/Ice/seqMapping/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/seqMapping/run.py27
-rw-r--r--csharp/test/Ice/serialize/AllTests.cs8
-rw-r--r--csharp/test/Ice/serialize/Client.cs38
-rwxr-xr-xcsharp/test/Ice/serialize/run.py25
-rw-r--r--csharp/test/Ice/servantLocator/AllTests.cs31
-rw-r--r--csharp/test/Ice/servantLocator/Client.cs18
-rw-r--r--csharp/test/Ice/servantLocator/Collocated.cs30
-rw-r--r--csharp/test/Ice/servantLocator/Server.cs31
-rw-r--r--csharp/test/Ice/servantLocator/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/servantLocator/run.py27
-rw-r--r--csharp/test/Ice/slicing/exceptions/AllTests.cs7
-rw-r--r--csharp/test/Ice/slicing/exceptions/Client.cs37
-rw-r--r--csharp/test/Ice/slicing/exceptions/Server.cs43
-rw-r--r--csharp/test/Ice/slicing/exceptions/ServerAMD.cs43
-rw-r--r--csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/slicing/exceptions/run.py36
-rw-r--r--csharp/test/Ice/slicing/objects/AllTests.cs7
-rw-r--r--csharp/test/Ice/slicing/objects/Client.cs37
-rw-r--r--csharp/test/Ice/slicing/objects/Server.cs43
-rw-r--r--csharp/test/Ice/slicing/objects/ServerAMD.cs43
-rw-r--r--csharp/test/Ice/slicing/objects/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj3
-rwxr-xr-xcsharp/test/Ice/slicing/objects/run.py36
-rw-r--r--csharp/test/Ice/stream/AllTests.cs5
-rw-r--r--csharp/test/Ice/stream/Client.cs38
-rwxr-xr-xcsharp/test/Ice/stream/run.py29
-rw-r--r--csharp/test/Ice/threadPoolPriority/Client.cs44
-rw-r--r--csharp/test/Ice/threadPoolPriority/Server.cs50
-rw-r--r--csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj3
-rw-r--r--csharp/test/Ice/threadPoolPriority/run.py24
-rw-r--r--csharp/test/Ice/timeout/AllTests.cs7
-rw-r--r--csharp/test/Ice/timeout/Client.cs88
-rw-r--r--csharp/test/Ice/timeout/Server.cs70
-rw-r--r--csharp/test/Ice/timeout/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/timeout/run.py24
-rw-r--r--csharp/test/Ice/udp/AllTests.cs15
-rw-r--r--csharp/test/Ice/udp/Client.cs53
-rw-r--r--csharp/test/Ice/udp/Server.cs68
-rw-r--r--csharp/test/Ice/udp/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/Ice/udp/run.py43
-rw-r--r--csharp/test/IceBox/admin/AllTests.cs9
-rw-r--r--csharp/test/IceBox/admin/Client.cs49
-rw-r--r--csharp/test/IceBox/admin/config.admin4
-rw-r--r--csharp/test/IceBox/admin/msbuild/client/client.csproj3
-rwxr-xr-xcsharp/test/IceBox/admin/run.py24
-rw-r--r--csharp/test/IceBox/configuration/AllTests.cs26
-rw-r--r--csharp/test/IceBox/configuration/Client.cs48
-rw-r--r--csharp/test/IceBox/configuration/config.service12
-rw-r--r--csharp/test/IceBox/configuration/config.service1-22
-rw-r--r--csharp/test/IceBox/configuration/config.service22
-rw-r--r--csharp/test/IceBox/configuration/config.service2-22
-rw-r--r--csharp/test/IceBox/configuration/config.service32
-rw-r--r--csharp/test/IceBox/configuration/config.service42
-rw-r--r--csharp/test/IceBox/configuration/msbuild/client/client.csproj3
-rwxr-xr-xcsharp/test/IceBox/configuration/run.py28
-rw-r--r--csharp/test/IceDiscovery/simple/AllTests.cs57
-rw-r--r--csharp/test/IceDiscovery/simple/Client.cs38
-rw-r--r--csharp/test/IceDiscovery/simple/Server.cs42
-rw-r--r--csharp/test/IceDiscovery/simple/msbuild/client/client.csproj3
-rw-r--r--csharp/test/IceDiscovery/simple/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/IceDiscovery/simple/run.py54
-rw-r--r--csharp/test/IceGrid/simple/AllTests.cs28
-rw-r--r--csharp/test/IceGrid/simple/Client.cs38
-rw-r--r--csharp/test/IceGrid/simple/application.xml (renamed from csharp/test/IceGrid/simple/simple_server.xml)0
-rw-r--r--csharp/test/IceGrid/simple/msbuild/client/client.csproj3
-rw-r--r--csharp/test/IceGrid/simple/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/IceGrid/simple/run.py37
-rw-r--r--csharp/test/IceGrid/simple/simple_mono_server.xml22
-rw-r--r--csharp/test/IceSSL/configuration/AllTests.cs5
-rw-r--r--csharp/test/IceSSL/configuration/Client.cs40
-rw-r--r--csharp/test/IceSSL/configuration/Server.cs42
-rw-r--r--csharp/test/IceSSL/configuration/msbuild/client/client.csproj3
-rw-r--r--csharp/test/IceSSL/configuration/msbuild/server/server.csproj3
-rwxr-xr-xcsharp/test/IceSSL/configuration/run.py30
-rw-r--r--csharp/test/IceUtil/inputUtil/Client.cs25
-rw-r--r--csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj3
-rwxr-xr-xcsharp/test/IceUtil/inputUtil/run.py30
-rw-r--r--csharp/test/Slice/keyword/Client.cs2
-rwxr-xr-xcsharp/test/Slice/keyword/run.py30
-rwxr-xr-xcsharp/test/Slice/macros/run.py30
-rwxr-xr-xcsharp/test/Slice/structure/run.py30
-rw-r--r--csharp/test/TestCommon/TestApp.cs195
274 files changed, 2917 insertions, 6372 deletions
diff --git a/csharp/test/Glacier2/router/Client.cs b/csharp/test/Glacier2/router/Client.cs
index a767709c22c..45c138b3394 100644
--- a/csharp/test/Glacier2/router/Client.cs
+++ b/csharp/test/Glacier2/router/Client.cs
@@ -18,424 +18,413 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
+ Ice.ObjectPrx routerBase;
{
- Ice.ObjectPrx routerBase;
+ Console.Out.Write("testing stringToProxy for router... ");
+ Console.Out.Flush();
+ routerBase = communicator().stringToProxy("Glacier2/router:" + getTestEndpoint(10));
+ 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("testing router finder... ");
+ Console.Out.Flush();
+ Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast(
+ communicator().stringToProxy("Ice/RouterFinder:" + getTestEndpoint(10)));
+ test(finder.getRouter().ice_getIdentity().Equals(router.ice_getIdentity()));
+ Console.Out.WriteLine("ok");
+ }
+
+ {
+ Console.Out.Write("installing router with communicator... ");
+ Console.Out.Flush();
+ communicator().setDefaultRouter(router);
+ Console.Out.WriteLine("ok");
+ }
+
+ {
+ Console.Out.Write("getting the session timeout... ");
+ Console.Out.Flush();
+ long timeout = router.getSessionTimeout();
+ test(timeout == 30);
+ Console.Out.WriteLine("ok");
+ }
+
+ Ice.ObjectPrx @base;
+
+ {
+ Console.Out.Write("testing stringToProxy for server object... ");
+ Console.Out.Flush();
+ @base = communicator().stringToProxy("c1/callback:" + getTestEndpoint(0));
+ Console.Out.WriteLine("ok");
+ }
+
+ {
+ Console.Out.Write("trying to ping server before session creation... ");
+ Console.Out.Flush();
+ try
{
- Console.Out.Write("testing stringToProxy for router... ");
- Console.Out.Flush();
- routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347");
- Console.Out.WriteLine("ok");
+ @base.ice_ping();
+ test(false);
}
-
- Glacier2.RouterPrx router;
+ catch(Ice.ConnectionLostException)
{
- Console.Out.Write("testing checked cast for router... ");
- Console.Out.Flush();
- router = Glacier2.RouterPrxHelper.checkedCast(routerBase);
- test(router != null);
Console.Out.WriteLine("ok");
}
+ catch(Ice.SocketException)
+ {
+ test(false);
+ }
+ }
+ {
+ Console.Out.Write("trying to create session with wrong password... ");
+ Console.Out.Flush();
+ try
{
- Console.Out.Write("testing router finder... ");
- Console.Out.Flush();
- Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast(
- communicator().stringToProxy("Ice/RouterFinder:default -p 12347"));
- test(finder.getRouter().ice_getIdentity().Equals(router.ice_getIdentity()));
- Console.Out.WriteLine("ok");
+ router.createSession("userid", "xxx");
+ test(false);
}
-
+ catch(Glacier2.PermissionDeniedException)
{
- Console.Out.Write("installing router with communicator... ");
- Console.Out.Flush();
- communicator().setDefaultRouter(router);
Console.Out.WriteLine("ok");
}
-
+ catch(Glacier2.CannotCreateSessionException)
{
- Console.Out.Write("getting the session timeout... ");
- Console.Out.Flush();
- long timeout = router.getSessionTimeout();
- test(timeout == 30);
- Console.Out.WriteLine("ok");
+ test(false);
}
+ }
- Ice.ObjectPrx @base;
-
+ {
+ Console.Out.Write("trying to destroy non-existing session... ");
+ Console.Out.Flush();
+ try
+ {
+ router.destroySession();
+ test(false);
+ }
+ catch(Glacier2.SessionNotExistException)
{
- Console.Out.Write("testing stringToProxy for server object... ");
- Console.Out.Flush();
- @base = communicator().stringToProxy("c1/callback:tcp -p 12010");
Console.Out.WriteLine("ok");
}
+ }
+ {
+ Console.Out.Write("creating session with correct password... ");
+ Console.Out.Flush();
+ try
{
- 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);
- }
+ router.createSession("userid", "abc123");
}
-
-
+ catch(Glacier2.PermissionDeniedException)
{
- 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);
- }
+ test(false);
}
-
+ catch(Glacier2.CannotCreateSessionException)
{
- Console.Out.Write("trying to destroy non-existing session... ");
- Console.Out.Flush();
- try
- {
- router.destroySession();
- test(false);
- }
- catch(Glacier2.SessionNotExistException)
- {
- Console.Out.WriteLine("ok");
- }
+ test(false);
}
+ Console.Out.WriteLine("ok");
+ }
+ {
+ Console.Out.Write("trying to create a second session... ");
+ Console.Out.Flush();
+ try
{
- 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");
+ router.createSession("userid", "abc123");
+ test(false);
}
-
+ catch(Glacier2.PermissionDeniedException)
{
- 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");
- }
+ test(false);
}
-
+ catch(Glacier2.CannotCreateSessionException)
{
- Console.Out.Write("pinging server after session creation... ");
- Console.Out.Flush();
- @base.ice_ping();
Console.Out.WriteLine("ok");
}
+ }
- CallbackPrx twoway;
+ {
+ Console.Out.Write("pinging server after session creation... ");
+ Console.Out.Flush();
+ @base.ice_ping();
+ Console.Out.WriteLine("ok");
+ }
- {
- Console.Out.Write("testing checked cast for server object... ");
- Console.Out.Flush();
- twoway = CallbackPrxHelper.checkedCast(@base);
- test(twoway != null);
- Console.Out.WriteLine("ok");
- }
+ 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");
+ }
- Ice.ObjectAdapter adapter;
+ 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);
+ 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);
+ 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
{
- 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");
+ twoway.initiateCallbackEx(twowayR, context);
+ test(false);
}
+ catch(CallbackException ex)
+ {
+ test(ex.someValue == 3.14);
+ test(ex.someString.Equals("3.14"));
+ }
+ callbackReceiverImpl.callbackOK();
+ Console.Out.WriteLine("ok");
+ }
- String category;
-
+ {
+ 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.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("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(Ice.Util.stringToIdentity("c2/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ 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
{
- 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");
+ CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
+ twoway.ice_identity(Ice.Util.stringToIdentity("c3/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ test(false);
}
-
+ catch(Ice.ObjectNotExistException)
{
- 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);
- callbackReceiverImpl.callbackOK();
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(Ice.Util.stringToIdentity("_userid/callback")));
+ otherCategoryTwoway.initiateCallback(twowayR, context);
+ callbackReceiverImpl.callbackOK();
+ Console.Out.WriteLine("ok");
+ }
+
+ if(args.Length >= 1 && args[0].Equals("--shutdown"))
+ {
+ 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
{
- Console.Out.Write("testing twoway callback... ");
- Console.Out.Flush();
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "t";
- twoway.initiateCallback(twowayR, context);
- callbackReceiverImpl.callbackOK();
- Console.Out.WriteLine("ok");
+ router.destroySession();
}
-
+ catch(Ice.LocalException)
{
- 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"));
- }
- callbackReceiverImpl.callbackOK();
- Console.Out.WriteLine("ok");
+ test(false);
}
+ Console.Out.WriteLine("ok");
+ }
+
+ {
+ Console.Out.Write("trying to ping server after session destruction... ");
+ Console.Out.Flush();
+ try
{
- 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");
- }
+ @base.ice_ping();
+ test(false);
}
-
+ catch(Ice.ConnectionLostException)
{
- 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(Ice.Util.stringToIdentity("c2/callback")));
- otherCategoryTwoway.initiateCallback(twowayR, context);
- callbackReceiverImpl.callbackOK();
Console.Out.WriteLine("ok");
}
-
+ catch(Ice.SocketException)
{
- 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(Ice.Util.stringToIdentity("c3/callback")));
- otherCategoryTwoway.initiateCallback(twowayR, context);
- test(false);
- }
- catch(Ice.ObjectNotExistException)
- {
- Console.Out.WriteLine("ok");
- }
+ test(false);
}
+ }
+ if(args.Length >= 1 && args[0].Equals("--shutdown"))
+ {
{
- Console.Out.Write("testing whether user-id as category is accepted... ");
+ Console.Out.Write("uninstalling router with communicator... ");
Console.Out.Flush();
- Dictionary<string, string> context = new Dictionary<string, string>();
- context["_fwd"] = "t";
- CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast(
- twoway.ice_identity(Ice.Util.stringToIdentity("_userid/callback")));
- otherCategoryTwoway.initiateCallback(twowayR, context);
- callbackReceiverImpl.callbackOK();
+ communicator().setDefaultRouter(null);
Console.Out.WriteLine("ok");
}
+ Ice.ObjectPrx processBase;
+
{
- 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.Write("testing stringToProxy for admin object... ");
+ processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp"));
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();
- }
- catch(Ice.LocalException)
- {
- test(false);
- }
-
+ Console.Out.Write("uninstalling router with process object... ");
+ processBase.ice_router(null);
Console.Out.WriteLine("ok");
}
+*/
+
+ Ice.ProcessPrx process;
{
- 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);
- }
+ Console.Out.Write("testing checked cast for process object... ");
+ process = Ice.ProcessPrxHelper.checkedCast(processBase);
+ test(process != null);
+ Console.Out.WriteLine("ok");
}
- if(args.Length >= 1 && args[0].Equals("--shutdown"))
+ Console.Out.Write("testing Glacier2 shutdown... ");
+ process.shutdown();
+ try
{
- {
- 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");
- 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");
- }
+ process.ice_ping();
+ test(false);
}
-
- return 0;
- }
-
- private static void
- test(bool b)
- {
- if(!b)
+ catch(Ice.LocalException)
{
- throw new Exception();
+ Console.Out.WriteLine("ok");
}
}
+
+ return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
//
// We must disable connection warnings, because we attempt to
@@ -443,11 +432,14 @@ public class Client
// after session destruction. Both will cause a
// ConnectionLostException.
//
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
-
+ Ice.InitializationData initData = base.getInitData(ref args);
initData.properties.setProperty("Ice.Warn.Connections", "0");
- App app = new App();
- return app.main(args, initData);
+ return initData;
+ }
+
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Glacier2/router/Server.cs b/csharp/test/Glacier2/router/Server.cs
index 4f8ae5a9e1c..f70adc61e6d 100644
--- a/csharp/test/Glacier2/router/Server.cs
+++ b/csharp/test/Glacier2/router/Server.cs
@@ -17,33 +17,24 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- public class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
- {
- communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
- adapter.add(new CallbackI(),
- Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category.
- adapter.add(new CallbackI(),
- Ice.Util.stringToIdentity("c2/callback")); // The test allows "c2" as category.
- adapter.add(new CallbackI(),
- Ice.Util.stringToIdentity("c3/callback")); // The test rejects "c3" as category.
- adapter.add(new CallbackI(),
- Ice.Util.stringToIdentity("_userid/callback")); // The test allows the prefixed userid.
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
- }
+ communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
+ adapter.add(new CallbackI(), Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category.
+ adapter.add(new CallbackI(), Ice.Util.stringToIdentity("c2/callback")); // The test allows "c2" as category.
+ adapter.add(new CallbackI(), Ice.Util.stringToIdentity("c3/callback")); // The test rejects "c3" as category.
+ adapter.add(new CallbackI(), Ice.Util.stringToIdentity("_userid/callback")); // The test allows the prefixed userid.
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
}
public static int Main(string[] args)
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- App app = new App();
- return app.main(args, initData);
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Glacier2/router/msbuild/client/client.csproj b/csharp/test/Glacier2/router/msbuild/client/client.csproj
index 96bbae3b0c6..c6bb052c7a9 100644
--- a/csharp/test/Glacier2/router/msbuild/client/client.csproj
+++ b/csharp/test/Glacier2/router/msbuild/client/client.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\CallbackI.cs">
<Link>CallbackI.cs</Link>
</Compile>
diff --git a/csharp/test/Glacier2/router/msbuild/server/server.csproj b/csharp/test/Glacier2/router/msbuild/server/server.csproj
index 84d40c5ef7d..12f5c47b42c 100644
--- a/csharp/test/Glacier2/router/msbuild/server/server.csproj
+++ b/csharp/test/Glacier2/router/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\CallbackI.cs">
<Link>CallbackI.cs</Link>
</Compile>
diff --git a/csharp/test/Glacier2/router/run.py b/csharp/test/Glacier2/router/run.py
deleted file mode 100755
index 429857cc84a..00000000000
--- a/csharp/test/Glacier2/router/run.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-router = os.path.join(TestUtil.getCppBinDir(), "glacier2router")
-
-#
-# Generate the crypt passwords file
-#
-TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"})
-
-args = ' --Ice.Warn.Dispatch=0' + \
- ' --Ice.Warn.Connections=0' + \
- ' --Glacier2.Filter.Category.Accept="c1 c2"' + \
- ' --Glacier2.Filter.Category.AcceptUser="2"' + \
- ' --Glacier2.SessionTimeout="30"' + \
- ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \
- ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \
- ' --Ice.Admin.InstanceName=Glacier2' + \
- ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"'
-
-sys.stdout.write("starting router... ")
-sys.stdout.flush()
-routerConfig = TestUtil.DriverConfig("server")
-routerConfig.lang = "cpp"
-starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig)
-print("ok")
-
-TestUtil.clientServerTest()
-
-#
-# We run the test again, to check whether the glacier router can
-# handle multiple clients. Also, when we run for the second time, we
-# want the client to shutdown the router after running the tests.
-#
-TestUtil.clientServerTest(additionalClientOptions=" --shutdown")
-
-starterProc.waitTestSuccess()
diff --git a/csharp/test/Glacier2/sessionHelper/Client.cs b/csharp/test/Glacier2/sessionHelper/Client.cs
index 9d00931328c..cb0e1709b45 100644
--- a/csharp/test/Glacier2/sessionHelper/Client.cs
+++ b/csharp/test/Glacier2/sessionHelper/Client.cs
@@ -18,480 +18,482 @@ using System.Threading;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public class App : Ice.Application
+ public class SessionCallback1 : Glacier2.SessionCallback
{
- public App(string[] args)
+ public
+ SessionCallback1(Client app)
{
- me = this;
+ _app = app;
+ }
- _initData = new Ice.InitializationData();
- _initData.properties = Ice.Util.createProperties(ref args);
- _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347");
- _initData.dispatcher = delegate(Action action, Ice.Connection connection)
- {
- action();
- };
+ public void
+ connected(Glacier2.SessionHelper session)
+ {
+ test(false);
}
- public class SessionCalback1 : Glacier2.SessionCallback
+ public void
+ disconnected(Glacier2.SessionHelper session)
{
- public void
- connected(Glacier2.SessionHelper session)
- {
- test(false);
- }
+ test(false);
+ }
- public void
- disconnected(Glacier2.SessionHelper session)
+ public void
+ connectFailed(Glacier2.SessionHelper session, Exception exception)
+ {
+ try
{
- test(false);
+ throw exception;
}
-
- public void
- connectFailed(Glacier2.SessionHelper session, Exception exception)
+ catch(Glacier2.PermissionDeniedException)
{
- try
- {
- throw exception;
- }
- catch(Glacier2.PermissionDeniedException)
- {
- Console.Out.WriteLine("ok");
- lock(me)
- {
- wakeUp();
- }
- }
- catch(Exception)
- {
- test(false);
- }
+ Console.Out.WriteLine("ok");
+ _app.wakeUp();
}
-
- public void
- createdCommunicator(Glacier2.SessionHelper session)
+ catch(Exception)
{
- test(session.communicator() != null);
+ test(false);
}
}
- public class SessionCalback2 : Glacier2.SessionCallback
+ public void
+ createdCommunicator(Glacier2.SessionHelper session)
{
- public void
- connected(Glacier2.SessionHelper session)
+ test(session.communicator() != null);
+ }
+
+ private Client _app;
+ }
+
+ public class SessionCallback2 : Glacier2.SessionCallback
+ {
+ public
+ SessionCallback2(Client app)
+ {
+ _app = app;
+ }
+
+ public void
+ connected(Glacier2.SessionHelper session)
+ {
+ Console.Out.WriteLine("ok");
+ _app.wakeUp();
+ }
+
+ public void
+ disconnected(Glacier2.SessionHelper session)
+ {
+ Console.Out.WriteLine("ok");
+ _app.wakeUp();
+ }
+
+ public void
+ connectFailed(Glacier2.SessionHelper session, Exception ex)
+ {
+ Console.Out.WriteLine(ex.ToString());
+ test(false);
+ }
+
+ public void
+ createdCommunicator(Glacier2.SessionHelper session)
+ {
+ test(session.communicator() != null);
+ }
+
+ private Client _app;
+ }
+
+ public class SessionCallback3 : Glacier2.SessionCallback
+ {
+ public
+ SessionCallback3(Client app)
+ {
+ _app = app;
+ }
+
+ public void
+ connected(Glacier2.SessionHelper session)
+ {
+ test(false);
+ }
+
+ public void
+ disconnected(Glacier2.SessionHelper session)
+ {
+ test(false);
+ }
+
+ public void
+ connectFailed(Glacier2.SessionHelper session, Exception exception)
+ {
+ try
{
- Console.Out.WriteLine("ok");
- lock(me)
- {
- wakeUp();
- }
+ throw exception;
}
-
- public void
- disconnected(Glacier2.SessionHelper session)
+ catch(Ice.ConnectionRefusedException)
{
Console.Out.WriteLine("ok");
- lock(me)
- {
- wakeUp();
- }
+ _app.wakeUp();
}
-
- public void
- connectFailed(Glacier2.SessionHelper session, Exception ex)
+ catch(Exception)
{
- Console.Out.WriteLine(ex.ToString());
test(false);
}
-
- public void
- createdCommunicator(Glacier2.SessionHelper session)
- {
- test(session.communicator() != null);
- }
}
- public class SessionCalback3 : Glacier2.SessionCallback
+ public void
+ createdCommunicator(Glacier2.SessionHelper session)
{
- public void
- connected(Glacier2.SessionHelper session)
- {
- test(false);
- }
+ test(session.communicator() != null);
+ }
- public void
- disconnected(Glacier2.SessionHelper session)
- {
- test(false);
- }
+ private Client _app;
+ }
- public void
- connectFailed(Glacier2.SessionHelper session, Exception exception)
- {
- try
- {
- throw exception;
- }
- catch(Ice.ConnectionRefusedException)
- {
- Console.Out.WriteLine("ok");
- lock(me)
- {
- wakeUp();
- }
- }
- catch(Exception)
- {
- test(false);
- }
- }
+ public class SessionCallback4 : Glacier2.SessionCallback
+ {
+ public
+ SessionCallback4(Client app)
+ {
+ _app = app;
+ }
- public void
- createdCommunicator(Glacier2.SessionHelper session)
- {
- test(session.communicator() != null);
- }
+ public void
+ connected(Glacier2.SessionHelper session)
+ {
+ test(false);
}
- public class SessionCalback4 : Glacier2.SessionCallback
+ public void
+ disconnected(Glacier2.SessionHelper session)
{
- public void
- connected(Glacier2.SessionHelper session)
- {
- test(false);
- }
+ test(false);
+ }
- public void
- disconnected(Glacier2.SessionHelper session)
+ public void
+ connectFailed(Glacier2.SessionHelper session, Exception exception)
+ {
+ try
{
- test(false);
+ throw exception;
}
-
- public void
- connectFailed(Glacier2.SessionHelper session, Exception exception)
+ catch(Ice.CommunicatorDestroyedException)
{
- try
- {
- throw exception;
- }
- catch(Ice.CommunicatorDestroyedException)
- {
- Console.Out.WriteLine("ok");
- lock(me)
- {
- wakeUp();
- }
- }
- catch(Exception)
- {
- test(false);
- }
+ Console.Out.WriteLine("ok");
+ _app.wakeUp();
}
-
- public void
- createdCommunicator(Glacier2.SessionHelper session)
+ catch(Exception)
{
- test(session.communicator() != null);
+ test(false);
}
}
- public Ice.InitializationData getInitData()
+ public void
+ createdCommunicator(Glacier2.SessionHelper session)
{
- return _initData;
+ test(session.communicator() != null);
}
- public override int run(string[] args)
- {
- String protocol = communicator().getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp");
- String host = communicator().getProperties().getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");
- _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCalback1());
-
- //
- // Test to create a session with wrong userid/password
- //
- lock(this)
- {
- Console.Out.Write("testing SessionHelper connect with wrong userid/password... ");
- Console.Out.Flush();
-
- _factory.setProtocol(protocol);
- _session = _factory.connect("userid", "xxx");
- while(true)
- {
- try
- {
- Monitor.Wait(this);
- break;
- }
- catch(ThreadInterruptedException)
- {
- }
- }
- }
+ private Client _app;
+ }
- _initData.properties.setProperty("Ice.Default.Router", "");
- _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCalback4());
- lock(this)
- {
- Console.Out.Write("testing SessionHelper connect interrupt... ");
- Console.Out.Flush();
- _factory.setRouterHost(host);
- _factory.setPort(12011);
- _factory.setProtocol(protocol);
- _session = _factory.connect("userid", "abc123");
+ public override int run(string[] args)
+ {
+ string protocol = getTestProtocol();
+ string host = getTestHost();
- Thread.Sleep(100);
- _session.destroy();
+ _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCallback1(this));
- while(true)
- {
- try
- {
- Monitor.Wait(this);
- break;
- }
- catch(ThreadInterruptedException)
- {
- }
- }
- }
+ //
+ // Test to create a session with wrong userid/password
+ //
+ lock(this)
+ {
+ Console.Out.Write("testing SessionHelper connect with wrong userid/password... ");
+ Console.Out.Flush();
- _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCalback2());
- lock(this)
+ _factory.setProtocol(protocol);
+ _session = _factory.connect("userid", "xxx");
+ while(true)
{
- Console.Out.Write("testing SessionHelper connect... ");
- Console.Out.Flush();
- _factory.setRouterHost(host);
- _factory.setPort(12347);
- _factory.setProtocol(protocol);
- _session = _factory.connect("userid", "abc123");
- while(true)
- {
- try
- {
- Monitor.Wait(this);
- break;
- }
- catch(ThreadInterruptedException)
- {
- }
- }
-
- Console.Out.Write("testing SessionHelper isConnected after connect... ");
- Console.Out.Flush();
- test(_session.isConnected());
- Console.Out.WriteLine("ok");
-
- Console.Out.Write("testing SessionHelper categoryForClient after connect... ");
- Console.Out.Flush();
try
{
- test(!_session.categoryForClient().Equals(""));
+ Monitor.Wait(this);
+ break;
}
- catch(Glacier2.SessionNotExistException)
+ catch(ThreadInterruptedException)
{
- test(false);
}
- Console.Out.WriteLine("ok");
-
- // try
- // {
- // test(_session.session() != null);
- // }
- // catch(Glacier2.SessionNotExistException ex)
- // {
- // test(false);
- // }
-
- Console.Out.Write("testing stringToProxy for server object... ");
- Console.Out.Flush();
- Ice.ObjectPrx @base = _session.communicator().stringToProxy("callback:default -p 12010");
- 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("testing checked cast for server object... ");
- Console.Out.Flush();
- CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base);
- test(twoway != null);
- Console.Out.WriteLine("ok");
+ }
+ }
- Console.Out.Write("testing server shutdown... ");
- Console.Out.Flush();
- twoway.shutdown();
- Console.Out.WriteLine("ok");
+ _initData.properties.setProperty("Ice.Default.Router", "");
+ _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCallback4(this));
+ lock(this)
+ {
+ Console.Out.Write("testing SessionHelper connect interrupt... ");
+ Console.Out.Flush();
+ _factory.setRouterHost(host);
+ _factory.setPort(getTestPort(1));
+ _factory.setProtocol(protocol);
+ _session = _factory.connect("userid", "abc123");
- test(_session.communicator() != null);
- Console.Out.Write("testing SessionHelper destroy... ");
- Console.Out.Flush();
- _session.destroy();
- while(true)
- {
- try
- {
- Monitor.Wait(this);
- break;
- }
- catch(ThreadInterruptedException)
- {
- }
- }
+ Thread.Sleep(100);
+ _session.destroy();
- Console.Out.Write("testing SessionHelper isConnected after destroy... ");
- Console.Out.Flush();
- test(_session.isConnected() == false);
- Console.Out.WriteLine("ok");
-
- Console.Out.Write("testing SessionHelper categoryForClient after destroy... ");
- Console.Out.Flush();
+ while(true)
+ {
try
{
- test(!_session.categoryForClient().Equals(""));
- test(false);
+ Monitor.Wait(this);
+ break;
}
- catch(Glacier2.SessionNotExistException)
+ catch(ThreadInterruptedException)
{
}
- Console.Out.WriteLine("ok");
+ }
+ }
- Console.Out.Write("testing SessionHelper session after destroy... ");
+ _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCallback2(this));
+ lock(this)
+ {
+ Console.Out.Write("testing SessionHelper connect... ");
+ Console.Out.Flush();
+ _factory.setRouterHost(host);
+ _factory.setPort(getTestPort(10));
+ _factory.setProtocol(protocol);
+ _session = _factory.connect("userid", "abc123");
+ while(true)
+ {
try
{
- _session.session();
- test(false);
+ Monitor.Wait(this);
+ break;
}
- catch(Glacier2.SessionNotExistException)
+ catch(ThreadInterruptedException)
{
}
- Console.Out.WriteLine("ok");
+ }
+
+ Console.Out.Write("testing SessionHelper isConnected after connect... ");
+ Console.Out.Flush();
+ test(_session.isConnected());
+ Console.Out.WriteLine("ok");
- Console.Out.Write("testing SessionHelper communicator after destroy... ");
- Console.Out.Flush();
+ Console.Out.Write("testing SessionHelper categoryForClient after connect... ");
+ Console.Out.Flush();
+ try
+ {
+ test(!_session.categoryForClient().Equals(""));
+ }
+ catch(Glacier2.SessionNotExistException)
+ {
+ test(false);
+ }
+ Console.Out.WriteLine("ok");
+
+// try
+// {
+// test(_session.session() != null);
+// }
+// catch(Glacier2.SessionNotExistException ex)
+// {
+// test(false);
+// }
+
+ Console.Out.Write("testing stringToProxy for server object... ");
+ Console.Out.Flush();
+ Ice.ObjectPrx @base = _session.communicator().stringToProxy("callback:" + getTestEndpoint(0));
+ 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("testing checked cast for server object... ");
+ Console.Out.Flush();
+ CallbackPrx twoway = CallbackPrxHelper.checkedCast(@base);
+ test(twoway != null);
+ Console.Out.WriteLine("ok");
+
+ Console.Out.Write("testing server shutdown... ");
+ Console.Out.Flush();
+ twoway.shutdown();
+ Console.Out.WriteLine("ok");
+
+ test(_session.communicator() != null);
+ Console.Out.Write("testing SessionHelper destroy... ");
+ Console.Out.Flush();
+ _session.destroy();
+ while(true)
+ {
try
{
- test(_session.communicator() != null);
- _session.communicator().stringToProxy("dummy");
- test(false);
+ Monitor.Wait(this);
+ break;
}
- catch(Ice.CommunicatorDestroyedException)
+ catch(ThreadInterruptedException)
{
}
- Console.Out.WriteLine("ok");
+ }
+ Console.Out.Write("testing SessionHelper isConnected after destroy... ");
+ Console.Out.Flush();
+ test(_session.isConnected() == false);
+ Console.Out.WriteLine("ok");
- Console.Out.Write("uninstalling router with communicator... ");
- Console.Out.Flush();
- communicator().setDefaultRouter(null);
- Console.Out.WriteLine("ok");
+ Console.Out.Write("testing SessionHelper categoryForClient after destroy... ");
+ Console.Out.Flush();
+ try
+ {
+ test(!_session.categoryForClient().Equals(""));
+ test(false);
+ }
+ catch(Glacier2.SessionNotExistException)
+ {
+ }
+ Console.Out.WriteLine("ok");
- Ice.ObjectPrx processBase;
- {
- Console.Out.Write("testing stringToProxy for process object... ");
- processBase = communicator().stringToProxy("Glacier2/admin -f Process:default -h \"" + host + "\" -p 12348");
- Console.Out.WriteLine("ok");
- }
+ Console.Out.Write("testing SessionHelper session after destroy... ");
+ try
+ {
+ _session.session();
+ test(false);
+ }
+ catch(Glacier2.SessionNotExistException)
+ {
+ }
+ Console.Out.WriteLine("ok");
+ Console.Out.Write("testing SessionHelper communicator after destroy... ");
+ Console.Out.Flush();
+ try
+ {
+ test(_session.communicator() != null);
+ _session.communicator().stringToProxy("dummy");
+ test(false);
+ }
+ catch(Ice.CommunicatorDestroyedException)
+ {
+ }
+ Console.Out.WriteLine("ok");
- Ice.ProcessPrx process;
- {
- Console.Out.Write("testing checked cast for admin 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");
- }
+ 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 process object... ");
+ processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp"));
+ Console.Out.WriteLine("ok");
}
- _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCalback3());
- lock(this)
+
+ Ice.ProcessPrx process;
{
- Console.Out.Write("testing SessionHelper connect after router shutdown... ");
- Console.Out.Flush();
-
- _factory.setRouterHost(host);
- _factory.setPort(12347);
- _factory.setProtocol(protocol);
- _session = _factory.connect("userid", "abc123");
- while(true)
- {
- try
- {
- Monitor.Wait(this);
- break;
- }
- catch(ThreadInterruptedException)
- {
- }
- }
+ Console.Out.Write("testing checked cast for admin object... ");
+ process = Ice.ProcessPrxHelper.checkedCast(processBase);
+ test(process != null);
+ Console.Out.WriteLine("ok");
+ }
- Console.Out.Write("testing SessionHelper isConnect after connect failure... ");
- Console.Out.Flush();
- test(_session.isConnected() == false);
+ Console.Out.Write("testing Glacier2 shutdown... ");
+ process.shutdown();
+ try
+ {
+ process.ice_ping();
+ test(false);
+ }
+ catch(Ice.LocalException)
+ {
Console.Out.WriteLine("ok");
+ }
+ }
- Console.Out.Write("testing SessionHelper communicator after connect failure... ");
- Console.Out.Flush();
+ _factory = new Glacier2.SessionFactoryHelper(_initData, new SessionCallback3(this));
+ lock(this)
+ {
+ Console.Out.Write("testing SessionHelper connect after router shutdown... ");
+ Console.Out.Flush();
+
+ _factory.setRouterHost(host);
+ _factory.setPort(getTestPort(10));
+ _factory.setProtocol(protocol);
+ _session = _factory.connect("userid", "abc123");
+ while(true)
+ {
try
{
- test(_session.communicator() != null);
- _session.communicator().stringToProxy("dummy");
- test(false);
+ Monitor.Wait(this);
+ break;
}
- catch(Ice.CommunicatorDestroyedException)
+ catch(ThreadInterruptedException)
{
}
- Console.Out.WriteLine("ok");
+ }
- Console.Out.Write("testing SessionHelper destroy after connect failure... ");
- Console.Out.Flush();
- _session.destroy();
- Console.Out.WriteLine("ok");
+ Console.Out.Write("testing SessionHelper isConnect after connect failure... ");
+ Console.Out.Flush();
+ test(_session.isConnected() == false);
+ Console.Out.WriteLine("ok");
+
+ Console.Out.Write("testing SessionHelper communicator after connect failure... ");
+ Console.Out.Flush();
+ try
+ {
+ test(_session.communicator() != null);
+ _session.communicator().stringToProxy("dummy");
+ test(false);
+ }
+ catch(Ice.CommunicatorDestroyedException)
+ {
}
+ Console.Out.WriteLine("ok");
- return 0;
+ Console.Out.Write("testing SessionHelper destroy after connect failure... ");
+ Console.Out.Flush();
+ _session.destroy();
+ Console.Out.WriteLine("ok");
}
- public static void
- wakeUp()
- {
- Monitor.Pulse(me);
- }
+ return 0;
+ }
- private static void
- test(bool b)
+ public void
+ wakeUp()
+ {
+ lock(this)
{
- if(!b)
- {
- throw new Exception();
- }
+ Monitor.Pulse(this);
}
+ }
- public static App me;
- private Ice.InitializationData _initData;
- private Glacier2.SessionHelper _session;
- private Glacier2.SessionFactoryHelper _factory;
+ protected override Ice.InitializationData getInitData(ref string[] args)
+ {
+ _initData = base.getInitData(ref args);
+ _initData.properties.setProperty("Ice.Warn.Connections", "0");
+ _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:" +
+ getTestEndpoint(_initData.properties, 10));
+ _initData.dispatcher = delegate(Action action, Ice.Connection connection)
+ {
+ action();
+ };
+ return _initData;
}
public static int Main(string[] args)
{
- App app = new App(args);
- app.getInitData().properties.setProperty("Ice.Warn.Connections", "0");
- return app.main(args, app.getInitData());
+ Client app = new Client();
+ return app.runmain(args);
}
+
+ private Glacier2.SessionHelper _session;
+ private Glacier2.SessionFactoryHelper _factory;
+ private Ice.InitializationData _initData;
}
diff --git a/csharp/test/Glacier2/sessionHelper/Server.cs b/csharp/test/Glacier2/sessionHelper/Server.cs
index 0b518572cbf..1a7d8e73673 100644
--- a/csharp/test/Glacier2/sessionHelper/Server.cs
+++ b/csharp/test/Glacier2/sessionHelper/Server.cs
@@ -16,27 +16,24 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- public class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
- {
- communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", "default -p 12011");
- communicator().createObjectAdapter("DeactivatedAdapter");
+ communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", getTestEndpoint(1));
+ communicator().createObjectAdapter("DeactivatedAdapter");
- communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
- adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback"));
- adapter.activate();
- communicator().waitForShutdown();
- return 0;
- }
+ communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter");
+ adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback"));
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
}
public static int Main(string[] args)
{
- App app = new App();
- return app.main(args);
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj b/csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj
index ef5a3db3f89..eabb39ab33d 100644
--- a/csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj
+++ b/csharp/test/Glacier2/sessionHelper/msbuild/client/client.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\CallbackI.cs">
<Link>CallbackI.cs</Link>
</Compile>
diff --git a/csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj b/csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj
index 25b7f3f222b..473ea1ffafc 100644
--- a/csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj
+++ b/csharp/test/Glacier2/sessionHelper/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\CallbackI.cs">
<Link>CallbackI.cs</Link>
</Compile>
diff --git a/csharp/test/Glacier2/sessionHelper/run.py b/csharp/test/Glacier2/sessionHelper/run.py
deleted file mode 100755
index 3e8c8b6e2d3..00000000000
--- a/csharp/test/Glacier2/sessionHelper/run.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-#
-# Generate the crypt passwords file
-#
-TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"})
-
-router = os.path.join(TestUtil.getCppBinDir(), "glacier2router")
-
-args = ' --Ice.Warn.Dispatch=0' + \
- ' --Ice.Warn.Connections=0' + \
- ' --Glacier2.SessionTimeout="30"' + \
- ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Glacier2.Server.Endpoints=default' \
- ' --Ice.Admin.Endpoints="default -p 12348"' + \
- ' --Ice.Admin.InstanceName=Glacier2' + \
- ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"'
-
-sys.stdout.write("starting router... ")
-sys.stdout.flush()
-routerConfig = TestUtil.DriverConfig("server")
-routerConfig.lang = "cpp"
-starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig)
-print("ok")
-
-TestUtil.clientServerTest(additionalClientOptions=" --shutdown")
-
-starterProc.waitTestSuccess()
diff --git a/csharp/test/Ice/acm/AllTests.cs b/csharp/test/Ice/acm/AllTests.cs
index 4991e562454..4059809084d 100644
--- a/csharp/test/Ice/acm/AllTests.cs
+++ b/csharp/test/Ice/acm/AllTests.cs
@@ -253,7 +253,7 @@ abstract class TestCase
protected bool _closed;
};
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
class InvocationHeartbeatTest : TestCase
{
@@ -515,9 +515,10 @@ public class AllTests : TestCommon.TestApp
}
};
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
- string @ref = "communicator:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string @ref = "communicator:" + app.getTestEndpoint(0);
RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref));
List<TestCase> tests = new List<TestCase>();
diff --git a/csharp/test/Ice/acm/Client.cs b/csharp/test/Ice/acm/Client.cs
index 1774765bfdf..c00cae416a5 100644
--- a/csharp/test/Ice/acm/Client.cs
+++ b/csharp/test/Ice/acm/Client.cs
@@ -17,46 +17,24 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/acm/Server.cs b/csharp/test/Ice/acm/Server.cs
index 1482464c5cb..4ff3c7fc856 100644
--- a/csharp/test/Ice/acm/Server.cs
+++ b/csharp/test/Ice/acm/Server.cs
@@ -17,56 +17,34 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- communicator.getProperties().setProperty("TestAdapter.ACM.Timeout", "0");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ communicator().getProperties().setProperty("TestAdapter.ACM.Timeout", "0");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Identity id = Ice.Util.stringToIdentity("communicator");
adapter.add(new RemoteCommunicatorI(), id);
adapter.activate();
- communicator.getProperties().setProperty("Ice.PrintAdapterReady", "0");
+ communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0");
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.ACM.Timeout", "1");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.ACM.Timeout", "1");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/acm/msbuild/server/server.csproj b/csharp/test/Ice/acm/msbuild/server/server.csproj
index f00ee8268b7..b1bb314fc5b 100644
--- a/csharp/test/Ice/acm/msbuild/server/server.csproj
+++ b/csharp/test/Ice/acm/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/acm/run.py b/csharp/test/Ice/acm/run.py
deleted file mode 100755
index bfec815018d..00000000000
--- a/csharp/test/Ice/acm/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/adapterDeactivation/AllTests.cs b/csharp/test/Ice/adapterDeactivation/AllTests.cs
index 1236e202fd8..43290043aff 100644
--- a/csharp/test/Ice/adapterDeactivation/AllTests.cs
+++ b/csharp/test/Ice/adapterDeactivation/AllTests.cs
@@ -10,13 +10,14 @@
using System;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static TestIntfPrx allTests(Ice.Communicator communicator)
+ public static TestIntfPrx allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
- string @ref = "test:default -p 12010";
+ string @ref = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
WriteLine("ok");
@@ -65,7 +66,7 @@ public class AllTests : TestCommon.TestApp
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = communicator.getProperties().ice_clone_();
Ice.Communicator comm = Ice.Util.initialize(initData);
- comm.stringToProxy("test:default -p 12010").begin_ice_ping();
+ comm.stringToProxy("test:" + app.getTestEndpoint(0)).begin_ice_ping();
comm.destroy();
}
WriteLine("ok");
diff --git a/csharp/test/Ice/adapterDeactivation/Client.cs b/csharp/test/Ice/adapterDeactivation/Client.cs
index ec0bcbf9ccb..d0f32efec89 100644
--- a/csharp/test/Ice/adapterDeactivation/Client.cs
+++ b/csharp/test/Ice/adapterDeactivation/Client.cs
@@ -18,20 +18,17 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- internal class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
- {
- AllTests.allTests(communicator());
- return 0;
- }
+ AllTests.allTests(this);
+ return 0;
}
-
+
public static int Main(string[] args)
{
- App app = new App();
- return app.main(args);
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/adapterDeactivation/Collocated.cs b/csharp/test/Ice/adapterDeactivation/Collocated.cs
index 30a4fa2c598..0bede6c409e 100644
--- a/csharp/test/Ice/adapterDeactivation/Collocated.cs
+++ b/csharp/test/Ice/adapterDeactivation/Collocated.cs
@@ -16,33 +16,30 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- internal class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
- {
- communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
- //
- // 2 threads are necessary to dispatch the collocated transient() call with AMI
- //
- communicator().getProperties().setProperty("TestAdapter.ThreadPool.Size", "2");
+ //
+ // 2 threads are necessary to dispatch the collocated transient() call with AMI
+ //
+ communicator().getProperties().setProperty("TestAdapter.ThreadPool.Size", "2");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ServantLocator locator = new ServantLocatorI();
- adapter.addServantLocator(locator, "");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ServantLocator locator = new ServantLocatorI();
+ adapter.addServantLocator(locator, "");
- AllTests.allTests(communicator());
+ AllTests.allTests(this);
- adapter.waitForDeactivate();
- return 0;
- }
+ adapter.waitForDeactivate();
+ return 0;
}
public static int Main(string[] args)
{
- App app = new App();
- return app.main(args);
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/adapterDeactivation/Server.cs b/csharp/test/Ice/adapterDeactivation/Server.cs
index a7cc8b99fc9..6af39d08350 100644
--- a/csharp/test/Ice/adapterDeactivation/Server.cs
+++ b/csharp/test/Ice/adapterDeactivation/Server.cs
@@ -16,25 +16,22 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- internal class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
- {
- communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- Ice.ServantLocator locator = new ServantLocatorI();
- adapter.addServantLocator(locator, "");
- adapter.activate();
- adapter.waitForDeactivate();
- return 0;
- }
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ServantLocator locator = new ServantLocatorI();
+ adapter.addServantLocator(locator, "");
+ adapter.activate();
+ adapter.waitForDeactivate();
+ return 0;
}
-
+
public static int Main(string[] args)
{
- App app = new App();
- return app.main(args);
+ Server app = new Server();
+ return app.runmain(args);
}
-}
+} \ No newline at end of file
diff --git a/csharp/test/Ice/adapterDeactivation/TestI.cs b/csharp/test/Ice/adapterDeactivation/TestI.cs
index c259c8c855f..fd53fa02018 100644
--- a/csharp/test/Ice/adapterDeactivation/TestI.cs
+++ b/csharp/test/Ice/adapterDeactivation/TestI.cs
@@ -15,8 +15,7 @@ public sealed class TestI : TestIntfDisp_
{
Ice.Communicator communicator = current.adapter.getCommunicator();
- Ice.ObjectAdapter adapter =
- communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
adapter.activate();
adapter.destroy();
}
diff --git a/csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj b/csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj
index 2b5db259b7e..2ba0dbdabf7 100644
--- a/csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj
+++ b/csharp/test/Ice/adapterDeactivation/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\CookieI.cs">
<Link>CookieI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/adapterDeactivation/run.py b/csharp/test/Ice/adapterDeactivation/run.py
deleted file mode 100755
index df7bc2b4ac3..00000000000
--- a/csharp/test/Ice/adapterDeactivation/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/admin/AllTests.cs b/csharp/test/Ice/admin/AllTests.cs
index 198232d96ec..75071ea151b 100644
--- a/csharp/test/Ice/admin/AllTests.cs
+++ b/csharp/test/Ice/admin/AllTests.cs
@@ -14,7 +14,7 @@ using System.Threading;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
static void
testFacets(Ice.Communicator com, bool builtInFacets)
@@ -92,8 +92,9 @@ public class AllTests : TestCommon.TestApp
}
}
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing communicator operations... ");
Flush();
{
@@ -172,7 +173,7 @@ public class AllTests : TestCommon.TestApp
}
WriteLine("ok");
- string @ref = "factory:default -p 12010 -t 10000";
+ string @ref = "factory:" + app.getTestEndpoint(0) + " -t 10000";
RemoteCommunicatorFactoryPrx factory =
RemoteCommunicatorFactoryPrxHelper.uncheckedCast(communicator.stringToProxy(@ref));
@@ -264,30 +265,30 @@ public class AllTests : TestCommon.TestApp
props.Add("Ice.Admin.InstanceName", "Test");
props.Add("NullLogger", "1");
RemoteCommunicatorPrx com = factory.createCommunicator(props);
-
+
com.trace("testCat", "trace");
com.warning("warning");
com.error("error");
com.print("print");
-
+
Ice.ObjectPrx obj = com.getAdmin();
Ice.LoggerAdminPrx logger = Ice.LoggerAdminPrxHelper.checkedCast(obj, "Logger");
test(logger != null);
string prefix = null;
-
+
//
// Get all
//
Ice.LogMessage[] logMessages = logger.getLog(null, null, -1, out prefix);
-
+
test(logMessages.Length == 4);
test(prefix.Equals("NullLogger"));
- test(logMessages[0].traceCategory.Equals("testCat") && logMessages[0].message.Equals("trace"));
+ test(logMessages[0].traceCategory.Equals("testCat") && logMessages[0].message.Equals("trace"));
test(logMessages[1].message.Equals("warning"));
test(logMessages[2].message.Equals("error"));
test(logMessages[3].message.Equals("print"));
-
+
//
// Get only errors and warnings
//
@@ -295,35 +296,35 @@ public class AllTests : TestCommon.TestApp
com.print("print2");
com.trace("testCat", "trace2");
com.warning("warning2");
-
+
Ice.LogMessageType[] messageTypes = {Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.WarningMessage};
-
+
logMessages = logger.getLog(messageTypes, null, -1, out prefix);
-
+
test(logMessages.Length == 4);
test(prefix.Equals("NullLogger"));
-
+
foreach(var msg in logMessages)
{
test(msg.type == Ice.LogMessageType.ErrorMessage || msg.type == Ice.LogMessageType.WarningMessage);
}
-
+
//
// Get only errors and traces with Cat = "testCat"
//
com.trace("testCat2", "A");
com.trace("testCat", "trace3");
com.trace("testCat2", "B");
-
+
messageTypes = new Ice.LogMessageType[]{Ice.LogMessageType.ErrorMessage, Ice.LogMessageType.TraceMessage};
string[] categories = {"testCat"};
logMessages = logger.getLog(messageTypes, categories, -1, out prefix);
test(logMessages.Length == 5);
test(prefix.Equals("NullLogger"));
-
+
foreach(var msg in logMessages)
- {
- test(msg.type == Ice.LogMessageType.ErrorMessage ||
+ {
+ test(msg.type == Ice.LogMessageType.ErrorMessage ||
(msg.type == Ice.LogMessageType.TraceMessage && msg.traceCategory.Equals("testCat")));
}
@@ -335,20 +336,20 @@ public class AllTests : TestCommon.TestApp
logMessages = logger.getLog(messageTypes, categories, 2, out prefix);
test(logMessages.Length == 2);
test(prefix.Equals("NullLogger"));
-
+
test(logMessages[0].message.Equals("trace3"));
test(logMessages[1].message.Equals("error3"));
-
+
//
// Now, test RemoteLogger
//
- Ice.ObjectAdapter adapter =
+ Ice.ObjectAdapter adapter =
communicator.createObjectAdapterWithEndpoints("RemoteLoggerAdapter", "tcp -h localhost");
-
+
RemoteLoggerI remoteLogger = new RemoteLoggerI();
-
+
Ice.RemoteLoggerPrx myProxy = Ice.RemoteLoggerPrxHelper.uncheckedCast(adapter.addWithUUID(remoteLogger));
-
+
adapter.activate();
//
@@ -356,25 +357,25 @@ public class AllTests : TestCommon.TestApp
//
logMessages = logger.getLog(null, null, -1, out prefix);
remoteLogger.checkNextInit(prefix, logMessages);
-
+
logger.attachRemoteLogger(myProxy, null, null, -1);
remoteLogger.wait(1);
-
+
remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace", "testCat");
remoteLogger.checkNextLog(Ice.LogMessageType.WarningMessage, "rwarning", "");
remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror", "");
remoteLogger.checkNextLog(Ice.LogMessageType.PrintMessage, "rprint", "");
-
+
com.trace("testCat", "rtrace");
com.warning("rwarning");
com.error("rerror");
com.print("rprint");
remoteLogger.wait(4);
-
+
test(logger.detachRemoteLogger(myProxy));
test(!logger.detachRemoteLogger(myProxy));
-
+
//
// Use Error + Trace with "traceCat" filter with 4 limit
//
@@ -384,10 +385,10 @@ public class AllTests : TestCommon.TestApp
logger.attachRemoteLogger(myProxy, messageTypes, categories, 4);
remoteLogger.wait(1);
-
+
remoteLogger.checkNextLog(Ice.LogMessageType.TraceMessage, "rtrace2", "testCat");
remoteLogger.checkNextLog(Ice.LogMessageType.ErrorMessage, "rerror2", "");
-
+
com.warning("rwarning2");
com.trace("testCat", "rtrace2");
com.warning("rwarning3");
@@ -395,13 +396,13 @@ public class AllTests : TestCommon.TestApp
com.print("rprint2");
remoteLogger.wait(2);
-
+
//
// Attempt reconnection with slightly different proxy
//
try
{
- logger.attachRemoteLogger(Ice.RemoteLoggerPrxHelper.uncheckedCast(myProxy.ice_oneway()),
+ logger.attachRemoteLogger(Ice.RemoteLoggerPrxHelper.uncheckedCast(myProxy.ice_oneway()),
messageTypes, categories, 4);
test(false);
}
@@ -409,7 +410,7 @@ public class AllTests : TestCommon.TestApp
{
// expected
}
-
+
com.destroy();
}
WriteLine("ok");
@@ -541,7 +542,7 @@ public class AllTests : TestCommon.TestApp
Monitor.PulseAll(this);
}
}
-
+
override public void log(Ice.LogMessage logMessage, Ice.Current current)
{
lock(this)
@@ -549,12 +550,12 @@ public class AllTests : TestCommon.TestApp
Ice.LogMessage front = _expectedLogMessages.Dequeue();
test(front.type == logMessage.type && front.message.Equals(logMessage.message) &&
front.traceCategory.Equals(logMessage.traceCategory));
-
+
_receivedCalls++;
Monitor.PulseAll(this);
}
}
-
+
internal void checkNextInit(string prefix, Ice.LogMessage[] logMessages)
{
lock(this)
@@ -563,7 +564,7 @@ public class AllTests : TestCommon.TestApp
_expectedInitMessages = logMessages;
}
}
-
+
internal void checkNextLog(Ice.LogMessageType messageType,string message, string category)
{
lock(this)
@@ -572,20 +573,20 @@ public class AllTests : TestCommon.TestApp
_expectedLogMessages.Enqueue(logMessage);
}
}
-
+
internal void wait(int calls)
{
lock(this)
{
_receivedCalls -= calls;
-
+
while(_receivedCalls < 0)
{
Monitor.Wait(this);
}
}
}
-
+
private int _receivedCalls = 0;
private string _expectedPrefix;
private Ice.LogMessage[] _expectedInitMessages;
diff --git a/csharp/test/Ice/admin/Client.cs b/csharp/test/Ice/admin/Client.cs
index 0c8c690e755..3371a595aeb 100644
--- a/csharp/test/Ice/admin/Client.cs
+++ b/csharp/test/Ice/admin/Client.cs
@@ -17,45 +17,17 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- Debug.Listeners.Add(new ConsoleTraceListener());
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/admin/Server.cs b/csharp/test/Ice/admin/Server.cs
index 048d076412c..5413ae94984 100644
--- a/csharp/test/Ice/admin/Server.cs
+++ b/csharp/test/Ice/admin/Server.cs
@@ -16,49 +16,23 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 10000");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Identity id = Ice.Util.stringToIdentity("factory");
adapter.add(new RemoteCommunicatorFactoryI(), id);
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/admin/msbuild/server/server.csproj b/csharp/test/Ice/admin/msbuild/server/server.csproj
index 96ea322e9f2..e6a5bcad856 100644
--- a/csharp/test/Ice/admin/msbuild/server/server.csproj
+++ b/csharp/test/Ice/admin/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/admin/run.py b/csharp/test/Ice/admin/run.py
deleted file mode 100755
index 8d9a8c0837c..00000000000
--- a/csharp/test/Ice/admin/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/ami/AllTests.cs b/csharp/test/Ice/ami/AllTests.cs
index 723097ca599..cf6e642e0dc 100644
--- a/csharp/test/Ice/ami/AllTests.cs
+++ b/csharp/test/Ice/ami/AllTests.cs
@@ -14,7 +14,7 @@ using System.Threading;
using System.Threading.Tasks;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Cookie
{
@@ -700,15 +700,16 @@ public class AllTests : TestCommon.TestApp
ThrowType _t;
}
- public static void allTests(Ice.Communicator communicator, bool collocated)
+ public static void allTests(TestCommon.Application app, bool collocated)
{
- string sref = "test:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string sref = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
Test.TestIntfPrx p = Test.TestIntfPrxHelper.uncheckedCast(obj);
- sref = "testController:default -p 12011";
+ sref = "testController:" + app.getTestEndpoint(1);
obj = communicator.stringToProxy(sref);
test(obj != null);
diff --git a/csharp/test/Ice/ami/Client.cs b/csharp/test/Ice/ami/Client.cs
index 6a6e407ea27..bc64d64276a 100644
--- a/csharp/test/Ice/ami/Client.cs
+++ b/csharp/test/Ice/ami/Client.cs
@@ -16,52 +16,29 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator, false);
+ AllTests.allTests(this, false);
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.AMICallback", "0");
- //
- // Limit the send buffer size, this test relies on the socket
- // send() blocking after sending a given amount of data.
- //
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ //
+ // Limit the send buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/ami/Collocated.cs b/csharp/test/Ice/ami/Collocated.cs
index 0627679d450..f229fbfeae8 100644
--- a/csharp/test/Ice/ami/Collocated.cs
+++ b/csharp/test/Ice/ami/Collocated.cs
@@ -16,58 +16,41 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
+ communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Collocated test doesn't need to activate the OA
adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
//adapter2.activate(); // Collocated test doesn't need to activate the OA
- AllTests.allTests(communicator, true);
+ AllTests.allTests(this, true);
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.AMICallback", "0");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ //
+ // Limit the send buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/ami/Server.cs b/csharp/test/Ice/ami/Server.cs
index 4d544317ca3..d07fb4e30bf 100644
--- a/csharp/test/Ice/ami/Server.cs
+++ b/csharp/test/Ice/ami/Server.cs
@@ -16,69 +16,47 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
+ communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
adapter2.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ServerIdleTime", "30");
-
- //
- // Disable collocation optimization to test async/await dispatch.
- //
- initData.properties.setProperty("Ice.Default.CollocationOptimized", "0");
-
- //
- // Limit the recv buffer size, this test relies on the socket
- // send() blocking after sending a given amount of data.
- //
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ServerIdleTime", "30");
+
+ //
+ // Disable collocation optimization to test async/await dispatch.
+ //
+ initData.properties.setProperty("Ice.Default.CollocationOptimized", "0");
+
+ //
+ // Limit the recv buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/ami/msbuild/server/server.csproj b/csharp/test/Ice/ami/msbuild/server/server.csproj
index 12c447b7a1c..428d2935f11 100644
--- a/csharp/test/Ice/ami/msbuild/server/server.csproj
+++ b/csharp/test/Ice/ami/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/ami/run.py b/csharp/test/Ice/ami/run.py
deleted file mode 100755
index df7bc2b4ac3..00000000000
--- a/csharp/test/Ice/ami/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/application/test.py b/csharp/test/Ice/application/test.py
new file mode 100644
index 00000000000..305861e65c4
--- /dev/null
+++ b/csharp/test/Ice/application/test.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+# Run this test manually
diff --git a/csharp/test/Ice/background/AllTests.cs b/csharp/test/Ice/background/AllTests.cs
index b92ddfdf635..0a81a8e6d7a 100644
--- a/csharp/test/Ice/background/AllTests.cs
+++ b/csharp/test/Ice/background/AllTests.cs
@@ -193,15 +193,16 @@ public class AllTests
private Thread _thread;
}
- public static Test.BackgroundPrx allTests(Ice.Communicator communicator)
+ public static Test.BackgroundPrx allTests(TestCommon.Application app)
{
- string sref = "background:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string sref = "background:" + app.getTestEndpoint(0);
Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj);
- sref = "backgroundController:tcp -p 12011";
+ sref = "backgroundController:" + app.getTestEndpoint(1, "tcp");
obj = communicator.stringToProxy(sref);
test(obj != null);
@@ -241,7 +242,7 @@ public class AllTests
Console.Out.Flush();
{
Ice.LocatorPrx locator;
- obj = communicator.stringToProxy("locator:default -p 12010").ice_invocationTimeout(250);
+ obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)).ice_invocationTimeout(250);
locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway();
@@ -256,7 +257,7 @@ public class AllTests
}
backgroundController.resumeCall("findAdapterById");
- obj = communicator.stringToProxy("locator:default -p 12010");
+ obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0));
locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
obj = obj.ice_locator(locator);
obj.ice_ping();
@@ -282,7 +283,7 @@ public class AllTests
{
Ice.RouterPrx router;
- obj = communicator.stringToProxy("router:default -p 12010").ice_invocationTimeout(250);
+ obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)).ice_invocationTimeout(250);
router = Ice.RouterPrxHelper.uncheckedCast(obj);
obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway();
@@ -297,7 +298,7 @@ public class AllTests
}
backgroundController.resumeCall("getClientProxy");
- obj = communicator.stringToProxy("router:default -p 12010");
+ obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0));
router = Ice.RouterPrxHelper.uncheckedCast(obj);
obj = communicator.stringToProxy("background@Test").ice_router(router);
BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
diff --git a/csharp/test/Ice/background/Client.cs b/csharp/test/Ice/background/Client.cs
index da54678ded4..92fabf45672 100644
--- a/csharp/test/Ice/background/Client.cs
+++ b/csharp/test/Ice/background/Client.cs
@@ -16,73 +16,48 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.BackgroundPrx background = AllTests.allTests(communicator);
+ PluginI plugin = new PluginI(communicator());
+ plugin.initialize();
+ communicator().getPluginManager().addPlugin("Test", plugin);
+ Test.BackgroundPrx background = AllTests.allTests(this);
background.shutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
-
- //
- // For this test, we want to disable retries.
- //
- initData.properties.setProperty("Ice.RetryIntervals", "-1");
-
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties.setProperty("Ice.Warn.Connections", "0");
-
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
-
- // This test relies on filling the TCP send/recv buffer, so
- // we rely on a fixed value for these buffers.
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
-
- //
- // Setup the test transport plug-in.
- //
- string defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
- initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
-
- communicator = Ice.Util.initialize(ref args, initData);
- PluginI plugin = new PluginI(communicator);
- plugin.initialize();
- communicator.getPluginManager().addPlugin("Test", plugin);
-
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ //
+ // For this test, we want to disable retries.
+ //
+ initData.properties.setProperty("Ice.RetryIntervals", "-1");
+
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+
+ // This test relies on filling the TCP send/recv buffer, so
+ // we rely on a fixed value for these buffers.
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+
+ //
+ // Setup the test transport plug-in.
+ //
+ string defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/background/Server.cs b/csharp/test/Ice/background/Server.cs
index 2e1dcb3b7f7..f387b8a8729 100644
--- a/csharp/test/Ice/background/Server.cs
+++ b/csharp/test/Ice/background/Server.cs
@@ -18,7 +18,7 @@ using System.Threading.Tasks;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
internal class LocatorI : Ice.LocatorDisp_
{
@@ -77,25 +77,29 @@ public class Server
private BackgroundControllerI _controller;
}
- public static int run(string[] args, Ice.Communicator communicator, TextWriter @out)
+ public override int run(string[] args)
{
+ PluginI plugin = new PluginI(communicator());
+ plugin.initialize();
+ communicator().getPluginManager().addPlugin("Test", plugin);
+
//
// When running as a MIDlet the properties for the server may be
// overridden by configuration. If it isn't then we assume
// defaults.
//
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").Length == 0)
+ if(communicator().getProperties().getProperty("TestAdapter.Endpoints").Length == 0)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
}
- if(communicator.getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0)
+ if(communicator().getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0)
{
- communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
- communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1, "tcp"));
+ communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
}
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
BackgroundControllerI backgroundController = new BackgroundControllerI(adapter);
@@ -107,63 +111,36 @@ public class Server
adapter2.add(backgroundController, Ice.Util.stringToIdentity("backgroundController"));
adapter2.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
-
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ Ice.InitializationData initData = base.getInitData(ref args);
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
-
- // This test relies on filling the TCP send/recv buffer, so
- // we rely on a fixed value for these buffers.
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
- //
- // Setup the test transport plug-in.
- //
- string defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
- initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
- communicator = Ice.Util.initialize(ref args, initData);
- PluginI plugin = new PluginI(communicator);
- plugin.initialize();
- communicator.getPluginManager().addPlugin("Test", plugin);
+ // This test relies on filling the TCP send/recv buffer, so
+ // we rely on a fixed value for these buffers.
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
- status = run(args, communicator, Console.Out);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ //
+ // Setup the test transport plug-in.
+ //
+ string defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol);
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/background/msbuild/server/server.csproj b/csharp/test/Ice/background/msbuild/server/server.csproj
index c1181cb04cc..5f224c503d8 100644
--- a/csharp/test/Ice/background/msbuild/server/server.csproj
+++ b/csharp/test/Ice/background/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Acceptor.cs">
<Link>Acceptor.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/background/run.py b/csharp/test/Ice/background/run.py
deleted file mode 100755
index bfec815018d..00000000000
--- a/csharp/test/Ice/background/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/binding/AllTests.cs b/csharp/test/Ice/binding/AllTests.cs
index de76daa74f8..edd2e316928 100644
--- a/csharp/test/Ice/binding/AllTests.cs
+++ b/csharp/test/Ice/binding/AllTests.cs
@@ -12,7 +12,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private static string getAdapterNameWithAMI(TestIntfPrx testIntf)
{
@@ -89,9 +89,10 @@ public class AllTests : TestCommon.TestApp
}
};
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
- string @ref = "communicator:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string @ref = "communicator:" + app.getTestEndpoint(0);
RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref));
System.Random rand = new System.Random(unchecked((int)System.DateTime.Now.Ticks));
@@ -840,19 +841,21 @@ public class AllTests : TestCommon.TestApp
clientProps.Add(bothPreferIPv4);
clientProps.Add(bothPreferIPv6);
+ string endpoint = "tcp -p " + app.getTestPort(2).ToString();
+
Ice.Properties anyipv4 = ipv4.ice_clone_();
- anyipv4.setProperty("Adapter.Endpoints", "tcp -p 12012");
- anyipv4.setProperty("Adapter.PublishedEndpoints", "tcp -h 127.0.0.1 -p 12012");
+ anyipv4.setProperty("Adapter.Endpoints", endpoint);
+ anyipv4.setProperty("Adapter.PublishedEndpoints", endpoint + " -h 127.0.0.1");
Ice.Properties anyipv6 = ipv6.ice_clone_();
- anyipv6.setProperty("Adapter.Endpoints", "tcp -p 12012");
- anyipv6.setProperty("Adapter.PublishedEndpoints", "tcp -h \".1\" -p 12012");
+ anyipv6.setProperty("Adapter.Endpoints", endpoint);
+ anyipv6.setProperty("Adapter.PublishedEndpoints", endpoint + " -h \".1\"");
Ice.Properties anyboth = Ice.Util.createProperties();
anyboth.setProperty("Ice.IPv4", "1");
anyboth.setProperty("Ice.IPv6", "1");
- anyboth.setProperty("Adapter.Endpoints", "tcp -p 12012");
- anyboth.setProperty("Adapter.PublishedEndpoints", "tcp -h \"::1\" -p 12012:tcp -h 127.0.0.1 -p 12012");
+ anyboth.setProperty("Adapter.Endpoints", endpoint);
+ anyboth.setProperty("Adapter.PublishedEndpoints", endpoint + " -h \"::1\":" + endpoint + " -h 127.0.0.1");
Ice.Properties localipv4 = ipv4.ice_clone_();
localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1");
diff --git a/csharp/test/Ice/binding/Client.cs b/csharp/test/Ice/binding/Client.cs
index 7c7b51e3b37..fcc80eedcff 100644
--- a/csharp/test/Ice/binding/Client.cs
+++ b/csharp/test/Ice/binding/Client.cs
@@ -16,43 +16,17 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(ex.ToString());
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/binding/RemoteCommunicatorI.cs b/csharp/test/Ice/binding/RemoteCommunicatorI.cs
index 7c9ffc15479..ed33ad23ce6 100644
--- a/csharp/test/Ice/binding/RemoteCommunicatorI.cs
+++ b/csharp/test/Ice/binding/RemoteCommunicatorI.cs
@@ -11,17 +11,19 @@ using Test;
public class RemoteCommunicatorI : RemoteCommunicatorDisp_
{
+
+ public RemoteCommunicatorI(TestCommon.Application app)
+ {
+ _app = app;
+ }
+
public override RemoteObjectAdapterPrx
createObjectAdapter(string name, string endpts, Ice.Current current)
{
string endpoints = endpts;
if(endpoints.IndexOf("-p") < 0)
{
- // Use a fixed port if none is specified (bug 2896)
- endpoints += " -h \"" +
- (current.adapter.getCommunicator().getProperties().getPropertyWithDefault(
- "Ice.Default.Host", "127.0.0.1")) +
- "\" -p " + _nextPort++;
+ endpoints = _app.getTestEndpoint(_nextPort++, endpoints);
}
Ice.Communicator com = current.adapter.getCommunicator();
@@ -43,5 +45,6 @@ public class RemoteCommunicatorI : RemoteCommunicatorDisp_
current.adapter.getCommunicator().shutdown();
}
- private int _nextPort = 10001;
+ private TestCommon.Application _app;
+ private int _nextPort = 10;
};
diff --git a/csharp/test/Ice/binding/Server.cs b/csharp/test/Ice/binding/Server.cs
index f427698fbd3..04fea198ac2 100644
--- a/csharp/test/Ice/binding/Server.cs
+++ b/csharp/test/Ice/binding/Server.cs
@@ -16,52 +16,30 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Identity id = Ice.Util.stringToIdentity("communicator");
- adapter.add(new RemoteCommunicatorI(), id);
+ adapter.add(new RemoteCommunicatorI(this), id);
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ServerIdleTime", "30");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ServerIdleTime", "30");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/binding/msbuild/server/server.csproj b/csharp/test/Ice/binding/msbuild/server/server.csproj
index 6b8d8e6a658..c0ff88ad39b 100644
--- a/csharp/test/Ice/binding/msbuild/server/server.csproj
+++ b/csharp/test/Ice/binding/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\RemoteCommunicatorI.cs">
<Link>RemoteCommunicatorI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/binding/run.py b/csharp/test/Ice/binding/run.py
deleted file mode 100755
index bfec815018d..00000000000
--- a/csharp/test/Ice/binding/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/checksum/AllTests.cs b/csharp/test/Ice/checksum/AllTests.cs
index 4831da2b0ce..353b4763c40 100644
--- a/csharp/test/Ice/checksum/AllTests.cs
+++ b/csharp/test/Ice/checksum/AllTests.cs
@@ -10,21 +10,13 @@
using System;
using System.Collections.Generic;
-public class AllTests
+public class AllTests : TestCommon.AllTests
{
- private static void
- test(bool b)
- {
- if(!b)
- {
- throw new Exception();
- }
- }
-
public static Test.ChecksumPrx
- allTests(Ice.Communicator communicator, bool collocated)
+ allTests(TestCommon.Application app, bool collocated)
{
- string rf = "test:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string rf = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf);
test(baseProxy != null);
diff --git a/csharp/test/Ice/checksum/Client.cs b/csharp/test/Ice/checksum/Client.cs
index 6969ea91115..d98cf02d4da 100644
--- a/csharp/test/Ice/checksum/Client.cs
+++ b/csharp/test/Ice/checksum/Client.cs
@@ -10,44 +10,18 @@
using System;
using System.Diagnostics;
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.ChecksumPrx checksum = AllTests.allTests(communicator, false);
+ Test.ChecksumPrx checksum = AllTests.allTests(this, false);
checksum.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/checksum/msbuild/client/client.csproj b/csharp/test/Ice/checksum/msbuild/client/client.csproj
index 73b8cc2a4f2..a292f0e3914 100644
--- a/csharp/test/Ice/checksum/msbuild/client/client.csproj
+++ b/csharp/test/Ice/checksum/msbuild/client/client.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\AllTests.cs">
<Link>AllTests.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/checksum/run.py b/csharp/test/Ice/checksum/run.py
deleted file mode 100755
index 8d960dffc1d..00000000000
--- a/csharp/test/Ice/checksum/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(server = os.path.join(os.getcwd(), "server", "server"))
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/checksum/server/Server.cs b/csharp/test/Ice/checksum/server/Server.cs
index 50cde4c714f..29bdc48e609 100644
--- a/csharp/test/Ice/checksum/server/Server.cs
+++ b/csharp/test/Ice/checksum/server/Server.cs
@@ -9,48 +9,22 @@
using System;
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object @object = new Test.ChecksumI();
adapter.add(@object, Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch (Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/checksum/server/msbuild/server/server.csproj b/csharp/test/Ice/checksum/server/msbuild/server/server.csproj
index d558b16a746..e6a1b313310 100644
--- a/csharp/test/Ice/checksum/server/msbuild/server/server.csproj
+++ b/csharp/test/Ice/checksum/server/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/checksum/test.py b/csharp/test/Ice/checksum/test.py
new file mode 100644
index 00000000000..38254e6d252
--- /dev/null
+++ b/csharp/test/Ice/checksum/test.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__name__, [ClientServerTestCase(server="server\server")])
diff --git a/csharp/test/Ice/defaultServant/AllTests.cs b/csharp/test/Ice/defaultServant/AllTests.cs
index b966da4da25..6701ccdde82 100644
--- a/csharp/test/Ice/defaultServant/AllTests.cs
+++ b/csharp/test/Ice/defaultServant/AllTests.cs
@@ -20,8 +20,9 @@ public class AllTests
}
public static void
- allTests(Ice.Communicator communicator)
+ allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost");
oa.activate();
diff --git a/csharp/test/Ice/defaultServant/Client.cs b/csharp/test/Ice/defaultServant/Client.cs
index 00d9b182597..93793376dd9 100644
--- a/csharp/test/Ice/defaultServant/Client.cs
+++ b/csharp/test/Ice/defaultServant/Client.cs
@@ -16,44 +16,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/defaultServant/run.py b/csharp/test/Ice/defaultServant/run.py
deleted file mode 100755
index 09987879f33..00000000000
--- a/csharp/test/Ice/defaultServant/run.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0", startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
diff --git a/csharp/test/Ice/defaultValue/AllTests.cs b/csharp/test/Ice/defaultValue/AllTests.cs
index d637192a5c9..832608a8187 100644
--- a/csharp/test/Ice/defaultValue/AllTests.cs
+++ b/csharp/test/Ice/defaultValue/AllTests.cs
@@ -7,7 +7,7 @@
//
// **********************************************************************
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
public static void allTests()
{
diff --git a/csharp/test/Ice/defaultValue/Client.cs b/csharp/test/Ice/defaultValue/Client.cs
index 8896ff77f82..eecb6e28e6f 100644
--- a/csharp/test/Ice/defaultValue/Client.cs
+++ b/csharp/test/Ice/defaultValue/Client.cs
@@ -16,30 +16,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args)
+ public override int run(string[] args)
{
AllTests.allTests();
-
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
-
- try
- {
- status = run(args);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/defaultValue/run.py b/csharp/test/Ice/defaultValue/run.py
deleted file mode 100755
index d414711377b..00000000000
--- a/csharp/test/Ice/defaultValue/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-sys.stdout.write("starting client...")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, startReader = False)
-print("ok")
-clientProc.startReader()
-clientProc.waitTestSuccess()
diff --git a/csharp/test/Ice/dictMapping/AllTests.cs b/csharp/test/Ice/dictMapping/AllTests.cs
index cabf73185b6..4b0f29cc4b3 100644
--- a/csharp/test/Ice/dictMapping/AllTests.cs
+++ b/csharp/test/Ice/dictMapping/AllTests.cs
@@ -7,12 +7,13 @@
//
// **********************************************************************
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static Test.MyClassPrx allTests(Ice.Communicator communicator, bool collocated)
+ public static Test.MyClassPrx allTests(TestCommon.Application app, bool collocated)
{
+ Ice.Communicator communicator = app.communicator();
Flush();
- string rf = "test:default -p 12010";
+ string rf = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf);
Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy);
diff --git a/csharp/test/Ice/dictMapping/Client.cs b/csharp/test/Ice/dictMapping/Client.cs
index a17768dc7a3..5227260717b 100644
--- a/csharp/test/Ice/dictMapping/Client.cs
+++ b/csharp/test/Ice/dictMapping/Client.cs
@@ -17,11 +17,11 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.MyClassPrx myClass = AllTests.allTests(communicator, false);
+ Test.MyClassPrx myClass = AllTests.allTests(this, false);
Console.Out.Write("shutting down server... ");
Console.Out.Flush();
@@ -32,33 +32,7 @@ public class Client
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/dictMapping/Collocated.cs b/csharp/test/Ice/dictMapping/Collocated.cs
index d2edaf61525..286925b70de 100644
--- a/csharp/test/Ice/dictMapping/Collocated.cs
+++ b/csharp/test/Ice/dictMapping/Collocated.cs
@@ -16,49 +16,23 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
- AllTests.allTests(communicator, true);
+ AllTests.allTests(this, true);
return 0;
}
public static int Main(String[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/dictMapping/Server.cs b/csharp/test/Ice/dictMapping/Server.cs
index e1485f81a45..abefefaf580 100644
--- a/csharp/test/Ice/dictMapping/Server.cs
+++ b/csharp/test/Ice/dictMapping/Server.cs
@@ -16,48 +16,22 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/dictMapping/msbuild/server/server.csproj b/csharp/test/Ice/dictMapping/msbuild/server/server.csproj
index 6fac50ddec5..8a64d9beb10 100644
--- a/csharp/test/Ice/dictMapping/msbuild/server/server.csproj
+++ b/csharp/test/Ice/dictMapping/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MyClassI.cs">
<Link>MyClassI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj
index 864df6b6f68..d00af7b2de6 100644
--- a/csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/dictMapping/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MyClassAMDI.cs">
<Link>MyClassAMDI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/dictMapping/run.py b/csharp/test/Ice/dictMapping/run.py
deleted file mode 100755
index d0771952158..00000000000
--- a/csharp/test/Ice/dictMapping/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server="serveramd")
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/dispatcher/AllTests.cs b/csharp/test/Ice/dispatcher/AllTests.cs
index 61e7413236a..8c019347a07 100644
--- a/csharp/test/Ice/dispatcher/AllTests.cs
+++ b/csharp/test/Ice/dispatcher/AllTests.cs
@@ -11,8 +11,7 @@
using System.Diagnostics;
using Test;
-
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Callback
{
@@ -75,15 +74,16 @@ public class AllTests : TestCommon.TestApp
private bool _called;
}
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
- string sref = "test:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string sref = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
Test.TestIntfPrx p = Test.TestIntfPrxHelper.uncheckedCast(obj);
- sref = "testController:tcp -p 12011";
+ sref = "testController:" + app.getTestEndpoint(1);
obj = communicator.stringToProxy(sref);
test(obj != null);
diff --git a/csharp/test/Ice/dispatcher/Client.cs b/csharp/test/Ice/dispatcher/Client.cs
index e7a69b700be..35d82a3e596 100644
--- a/csharp/test/Ice/dispatcher/Client.cs
+++ b/csharp/test/Ice/dispatcher/Client.cs
@@ -16,54 +16,37 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ //
+ // Limit the send buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ initData.dispatcher = new Dispatcher().dispatch;
+ return initData;
+ }
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.AMICallback", "0");
- //
- // Limit the send buffer size, this test relies on the socket
- // send() blocking after sending a given amount of data.
- //
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
- initData.dispatcher = new Dispatcher().dispatch;
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
+ return app.runmain(args);
}
- catch(Exception ex)
+ finally
{
- Console.Error.WriteLine(ex);
- status = 1;
+ Dispatcher.terminate();
}
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- Dispatcher.terminate();
-
- return status;
}
}
diff --git a/csharp/test/Ice/dispatcher/Collocated.cs b/csharp/test/Ice/dispatcher/Collocated.cs
index ae25fc29faf..fe7fd156df7 100644
--- a/csharp/test/Ice/dispatcher/Collocated.cs
+++ b/csharp/test/Ice/dispatcher/Collocated.cs
@@ -16,61 +16,44 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
- communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
+ communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
//adapter2.activate(); // Don't activate OA to ensure collocation is used.
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+ initData.dispatcher = new Dispatcher().dispatch;
+ return initData;
+ }
+ public static int Main(string[] args)
+ {
+ Collocated app = new Collocated();
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.AMICallback", "0");
- initData.dispatcher = new Dispatcher().dispatch;
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
+ return app.runmain(args);
}
- catch(Exception ex)
+ finally
{
- Console.Error.WriteLine(ex);
- status = 1;
+ Dispatcher.terminate();
}
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- Dispatcher.terminate();
-
- return status;
}
}
diff --git a/csharp/test/Ice/dispatcher/Server.cs b/csharp/test/Ice/dispatcher/Server.cs
index f0f87059499..fe0771a6b16 100644
--- a/csharp/test/Ice/dispatcher/Server.cs
+++ b/csharp/test/Ice/dispatcher/Server.cs
@@ -16,66 +16,49 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
- communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
+ communicator().getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter");
adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController"));
adapter2.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ServerIdleTime", "30");
+ //
+ // Limit the recv buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ initData.dispatcher = new Dispatcher().dispatch;
+ return initData;
+ }
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ServerIdleTime", "30");
- //
- // Limit the recv buffer size, this test relies on the socket
- // send() blocking after sending a given amount of data.
- //
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
- initData.dispatcher = new Dispatcher().dispatch;
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
+ return app.runmain(args);
}
- catch(System.Exception ex)
+ finally
{
- System.Console.Error.WriteLine(ex);
- status = 1;
+ Dispatcher.terminate();
}
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- Dispatcher.terminate();
-
- return status;
}
}
diff --git a/csharp/test/Ice/dispatcher/msbuild/server/server.csproj b/csharp/test/Ice/dispatcher/msbuild/server/server.csproj
index 4fad8ba4bc8..04e30888141 100644
--- a/csharp/test/Ice/dispatcher/msbuild/server/server.csproj
+++ b/csharp/test/Ice/dispatcher/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Dispatcher.cs">
<Link>Dispatcher.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/dispatcher/run.py b/csharp/test/Ice/dispatcher/run.py
deleted file mode 100755
index df7bc2b4ac3..00000000000
--- a/csharp/test/Ice/dispatcher/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/echo/Server.cs b/csharp/test/Ice/echo/Server.cs
index 28cd7d37aaa..871a6bc0aa3 100644
--- a/csharp/test/Ice/echo/Server.cs
+++ b/csharp/test/Ice/echo/Server.cs
@@ -16,7 +16,7 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
private class EchoI : Test.EchoDisp_
{
@@ -43,50 +43,22 @@ public class Server
private BlobjectI _blob;
}
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
BlobjectI blob = new BlobjectI();
adapter.addDefaultServant(blob, "");
adapter.add(new EchoI(blob), Ice.Util.stringToIdentity("__echo"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/echo/msbuild/server/server.csproj b/csharp/test/Ice/echo/msbuild/server/server.csproj
index 55484eb16e7..985b3cec79a 100644
--- a/csharp/test/Ice/echo/msbuild/server/server.csproj
+++ b/csharp/test/Ice/echo/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\BlobjectI.cs">
<Link>BlobjectI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/echo/run.py b/csharp/test/Ice/echo/run.py
deleted file mode 100755
index b4443ff6130..00000000000
--- a/csharp/test/Ice/echo/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-sys.stdout.write("starting server... ")
-sys.stdout.flush()
-server = os.path.join(os.getcwd(), "server")
-p = TestUtil.startServer(server)
-print("ok")
-sys.stdout.flush()
-
-p.waitTestSuccess()
diff --git a/csharp/test/Ice/enums/AllTests.cs b/csharp/test/Ice/enums/AllTests.cs
index 2204b4cbf23..9b3d16c9834 100644
--- a/csharp/test/Ice/enums/AllTests.cs
+++ b/csharp/test/Ice/enums/AllTests.cs
@@ -10,11 +10,12 @@
using System;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static TestIntfPrx allTests(Ice.Communicator communicator)
+ public static TestIntfPrx allTests(TestCommon.Application app)
{
- string sref = "test:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string sref = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
TestIntfPrx proxy = TestIntfPrxHelper.uncheckedCast(obj);
diff --git a/csharp/test/Ice/enums/Client.cs b/csharp/test/Ice/enums/Client.cs
index 1585a8ba793..e225e0c480f 100644
--- a/csharp/test/Ice/enums/Client.cs
+++ b/csharp/test/Ice/enums/Client.cs
@@ -17,46 +17,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.TestIntfPrx proxy = AllTests.allTests(communicator);
+ Test.TestIntfPrx proxy = AllTests.allTests(this);
proxy.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
- Debug.Listeners.Add(new ConsoleTraceListener());
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/enums/Server.cs b/csharp/test/Ice/enums/Server.cs
index 8a34cfd5a48..a6b6e03daaf 100644
--- a/csharp/test/Ice/enums/Server.cs
+++ b/csharp/test/Ice/enums/Server.cs
@@ -17,55 +17,31 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- Debug.Listeners.Add(new ConsoleTraceListener());
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ServerIdleTime", "30");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ServerIdleTime", "30");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/enums/msbuild/server/server.csproj b/csharp/test/Ice/enums/msbuild/server/server.csproj
index 96e314fb535..4129c58bf9f 100644
--- a/csharp/test/Ice/enums/msbuild/server/server.csproj
+++ b/csharp/test/Ice/enums/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/enums/run.py b/csharp/test/Ice/enums/run.py
deleted file mode 100755
index b7e267999af..00000000000
--- a/csharp/test/Ice/enums/run.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueClientServerTest(configName = "1.1", message = "Running test with 1.1 encoding.")
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/exceptions/AllTests.cs b/csharp/test/Ice/exceptions/AllTests.cs
index c7fe94f7497..30b5702b2db 100644
--- a/csharp/test/Ice/exceptions/AllTests.cs
+++ b/csharp/test/Ice/exceptions/AllTests.cs
@@ -12,7 +12,7 @@ using System.Diagnostics;
using System.Threading;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Callback
{
@@ -48,8 +48,9 @@ public class AllTests : TestCommon.TestApp
}
- public static ThrowerPrx allTests(Ice.Communicator communicator)
+ public static ThrowerPrx allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
{
Write("testing object adapter registration exceptions... ");
Ice.ObjectAdapter first;
@@ -175,7 +176,7 @@ public class AllTests : TestCommon.TestApp
Write("testing stringToProxy... ");
Flush();
- String @ref = "thrower:default -p 12010";
+ String @ref = "thrower:" + app.getTestEndpoint(0);
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
WriteLine("ok");
@@ -431,7 +432,7 @@ public class AllTests : TestCommon.TestApp
}
ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(
- communicator.stringToProxy("thrower:default -p 12011"));
+ communicator.stringToProxy("thrower:" + app.getTestEndpoint(1)));
try
{
thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits)
@@ -440,7 +441,7 @@ public class AllTests : TestCommon.TestApp
{
}
ThrowerPrx thrower3 = ThrowerPrxHelper.uncheckedCast(
- communicator.stringToProxy("thrower:default -p 12012"));
+ communicator.stringToProxy("thrower:" + app.getTestEndpoint(2)));
try
{
thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit
diff --git a/csharp/test/Ice/exceptions/Client.cs b/csharp/test/Ice/exceptions/Client.cs
index 5974abde6e0..660197e44cc 100644
--- a/csharp/test/Ice/exceptions/Client.cs
+++ b/csharp/test/Ice/exceptions/Client.cs
@@ -17,49 +17,27 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- ThrowerPrx thrower = AllTests.allTests(communicator);
+ ThrowerPrx thrower = AllTests.allTests(this);
thrower.shutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/exceptions/Collocated.cs b/csharp/test/Ice/exceptions/Collocated.cs
index f5b4787dc7a..6d406d406e0 100644
--- a/csharp/test/Ice/exceptions/Collocated.cs
+++ b/csharp/test/Ice/exceptions/Collocated.cs
@@ -16,51 +16,31 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object obj = new ThrowerI();
adapter.add(obj, Ice.Util.stringToIdentity("thrower"));
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/exceptions/Server.cs b/csharp/test/Ice/exceptions/Server.cs
index a8af5586552..41c1d39e4d6 100644
--- a/csharp/test/Ice/exceptions/Server.cs
+++ b/csharp/test/Ice/exceptions/Server.cs
@@ -35,23 +35,23 @@ public sealed class DummyLogger : Ice.Logger
}
public string getPrefix()
- {
+ {
return "";
- }
-
+ }
+
public Ice.Logger cloneWithPrefix(string prefix)
{
return new DummyLogger();
}
}
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
- Ice.ObjectAdapter adapter3 = communicator.createObjectAdapter("TestAdapter3");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter2");
+ Ice.ObjectAdapter adapter3 = communicator().createObjectAdapter("TestAdapter3");
Ice.Object obj = new ThrowerI();
adapter.add(obj, Ice.Util.stringToIdentity("thrower"));
adapter2.add(obj, Ice.Util.stringToIdentity("thrower"));
@@ -59,50 +59,27 @@ public class Server
adapter.activate();
adapter2.activate();
adapter3.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
- initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011");
- initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0");
- initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012");
- initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp");
+ initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max
+ initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(initData.properties, 1));
+ initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0");
+ initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(initData.properties, 2));
+ initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/exceptions/msbuild/server/server.csproj b/csharp/test/Ice/exceptions/msbuild/server/server.csproj
index b895e9990d4..3078314ea2c 100644
--- a/csharp/test/Ice/exceptions/msbuild/server/server.csproj
+++ b/csharp/test/Ice/exceptions/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\EmptyI.cs">
<Link>EmptyI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj
index ab8448afac5..a8b8e2b560f 100644
--- a/csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/exceptions/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\EmptyI.cs">
<Link>EmptyI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/exceptions/run.py b/csharp/test/Ice/exceptions/run.py
deleted file mode 100755
index 4ee5f87d923..00000000000
--- a/csharp/test/Ice/exceptions/run.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
-
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
- additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat")
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueClientServerTest(configName = "compactAMD", localOnly = True,
- message = "Running test with compact (default) format and AMD server.",
- server="serveramd")
-
-TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
- message = "Running test with sliced format and AMD server.",
- server="serveramd",
- additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat")
-
-TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
- message = "Running test with 1.0 encoding and AMD server.",
- server="serveramd",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/facets/AllTests.cs b/csharp/test/Ice/facets/AllTests.cs
index d0f94544531..a54d1521ab2 100644
--- a/csharp/test/Ice/facets/AllTests.cs
+++ b/csharp/test/Ice/facets/AllTests.cs
@@ -12,11 +12,13 @@ using System.Collections.Generic;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static GPrx allTests(Ice.Communicator communicator)
+ public static GPrx allTests(TestCommon.Application app)
{
-
+
+ Ice.Communicator communicator = app.communicator();
+
Write("testing Ice.Admin.Facets property... ");
test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").Length == 0);
communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar");
@@ -96,7 +98,7 @@ public class AllTests : TestCommon.TestApp
Write("testing stringToProxy... ");
Flush();
- string @ref = "d:default -p 12010";
+ string @ref = "d:" + app.getTestEndpoint(0);
Ice.ObjectPrx db = communicator.stringToProxy(@ref);
test(db != null);
WriteLine("ok");
@@ -151,7 +153,7 @@ public class AllTests : TestCommon.TestApp
test(d.callC().Equals("C"));
test(d.callD().Equals("D"));
WriteLine("ok");
-
+
Write("testing facets A, B, C, and D... ");
Flush();
df = DPrxHelper.checkedCast(d, "facetABCD");
@@ -161,7 +163,7 @@ public class AllTests : TestCommon.TestApp
test(df.callC().Equals("C"));
test(df.callD().Equals("D"));
WriteLine("ok");
-
+
Write("testing facets E and F... ");
Flush();
FPrx ff = FPrxHelper.checkedCast(d, "facetEF");
@@ -169,14 +171,14 @@ public class AllTests : TestCommon.TestApp
test(ff.callE().Equals("E"));
test(ff.callF().Equals("F"));
WriteLine("ok");
-
+
Write("testing facet G... ");
Flush();
GPrx gf = GPrxHelper.checkedCast(ff, "facetGH");
test(gf != null);
test(gf.callG().Equals("G"));
WriteLine("ok");
-
+
Write("testing whether casting preserves the facet... ");
Flush();
HPrx hf = HPrxHelper.checkedCast(gf);
diff --git a/csharp/test/Ice/facets/Client.cs b/csharp/test/Ice/facets/Client.cs
index e080de59e8e..77b3fb62bd6 100644
--- a/csharp/test/Ice/facets/Client.cs
+++ b/csharp/test/Ice/facets/Client.cs
@@ -17,44 +17,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- GPrx g = AllTests.allTests(communicator);
+ GPrx g = AllTests.allTests(this);
g.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/facets/Collocated.cs b/csharp/test/Ice/facets/Collocated.cs
index 5d8c3f63257..5e8e43c92e4 100644
--- a/csharp/test/Ice/facets/Collocated.cs
+++ b/csharp/test/Ice/facets/Collocated.cs
@@ -16,54 +16,28 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object d = new DI();
adapter.add(d, Ice.Util.stringToIdentity("d"));
adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
Ice.Object f = new FI();
adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
- Ice.Object h = new HI(communicator);
+ Ice.Object h = new HI(communicator());
adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/facets/Server.cs b/csharp/test/Ice/facets/Server.cs
index 63d297d9e8b..b1e07674f05 100644
--- a/csharp/test/Ice/facets/Server.cs
+++ b/csharp/test/Ice/facets/Server.cs
@@ -16,55 +16,29 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object d = new DI();
adapter.add(d, Ice.Util.stringToIdentity("d"));
adapter.addFacet(d, Ice.Util.stringToIdentity("d"), "facetABCD");
Ice.Object f = new FI();
adapter.addFacet(f, Ice.Util.stringToIdentity("d"), "facetEF");
- Ice.Object h = new HI(communicator);
+ Ice.Object h = new HI(communicator());
adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH");
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/facets/msbuild/server/server.csproj b/csharp/test/Ice/facets/msbuild/server/server.csproj
index 5b0ebe99adf..8b4885f85f1 100644
--- a/csharp/test/Ice/facets/msbuild/server/server.csproj
+++ b/csharp/test/Ice/facets/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\AI.cs">
<Link>AI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/facets/run.py b/csharp/test/Ice/facets/run.py
deleted file mode 100755
index df7bc2b4ac3..00000000000
--- a/csharp/test/Ice/facets/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/faultTolerance/AllTests.cs b/csharp/test/Ice/faultTolerance/AllTests.cs
index 7d47a3edf96..54541e5fec2 100644
--- a/csharp/test/Ice/faultTolerance/AllTests.cs
+++ b/csharp/test/Ice/faultTolerance/AllTests.cs
@@ -12,7 +12,7 @@ using System.Diagnostics;
using System.Collections.Generic;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Callback
{
@@ -69,14 +69,15 @@ public class AllTests : TestCommon.TestApp
}
}
- public static void allTests(Ice.Communicator communicator, List<int> ports)
+ public static void allTests(TestCommon.Application app, List<int> ports)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
string refString = "test";
for(int i = 0; i < ports.Count; i++)
{
- refString += ":default -p " + ports[i];
+ refString += ":" + app.getTestEndpoint(ports[i]);
}
Ice.ObjectPrx basePrx = communicator.stringToProxy(refString);
test(basePrx != null);
diff --git a/csharp/test/Ice/faultTolerance/Client.cs b/csharp/test/Ice/faultTolerance/Client.cs
index fdb28f904f6..c76f205d245 100644
--- a/csharp/test/Ice/faultTolerance/Client.cs
+++ b/csharp/test/Ice/faultTolerance/Client.cs
@@ -16,14 +16,14 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
private static void usage()
{
Console.Error.WriteLine("Usage: client port...");
}
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
System.Collections.Generic.List<int> ports = new System.Collections.Generic.List<int>();
for(int i = 0; i < args.Length; i++)
@@ -48,46 +48,20 @@ public class Client
return 1;
}
- AllTests.allTests(communicator, ports);
+ AllTests.allTests(this, ports);
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- //
- // This test aborts servers, so we don't want warnings.
- //
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.Connections", "0");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/faultTolerance/Server.cs b/csharp/test/Ice/faultTolerance/Server.cs
index 57101bf3edf..acbf8ccbf6c 100644
--- a/csharp/test/Ice/faultTolerance/Server.cs
+++ b/csharp/test/Ice/faultTolerance/Server.cs
@@ -16,14 +16,14 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
private static void usage()
{
Console.Error.WriteLine("Usage: Server port");
}
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
int port = 0;
for(int i = 0; i < args.Length; i++)
@@ -61,53 +61,25 @@ public class Server
return 1;
}
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(port));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object obj = new TestI();
adapter.add(obj, Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- //
- // In this test, we need longer server idle time,
- // otherwise our test servers may time out before they are
- // used in the test.
- //
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ServerIdleTime", "120"); // Two minutes
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ServerIdleTime", "120");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/faultTolerance/msbuild/server/server.csproj b/csharp/test/Ice/faultTolerance/msbuild/server/server.csproj
index c790d7616f2..81baf79c862 100644
--- a/csharp/test/Ice/faultTolerance/msbuild/server/server.csproj
+++ b/csharp/test/Ice/faultTolerance/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/faultTolerance/run.py b/csharp/test/Ice/faultTolerance/run.py
deleted file mode 100755
index 519cfa7c16d..00000000000
--- a/csharp/test/Ice/faultTolerance/run.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-server = os.path.join(os.getcwd(), "server")
-client = os.path.join(os.getcwd(), "client")
-
-if TestUtil.isCygwin():
- print("\nYou may get spurious \"Signal 127\" messages during this test run.")
- print("These are expected and can be safely ignored.\n")
-
-num = 12
-base = 12340
-
-serverProc = []
-for i in range(0, num):
- sys.stdout.write("starting server #%d... " % (i + 1))
- sys.stdout.flush()
- serverProc.append(TestUtil.startServer(server, " %d" % (base + i)))
- print("ok")
-
-ports = ""
-for i in range(0, num):
- ports = "%s %d" % (ports, base + i)
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, ports, startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
-for p in serverProc:
- #p.waitTestSuccess()
- # We simuluate the abort of the server by calling Process.Kill(). However, this
- # results in a non-zero exit status. Therefore we ignore the status.
- p.wait()
diff --git a/csharp/test/Ice/hash/Client.cs b/csharp/test/Ice/hash/Client.cs
index 489c800dc9a..a1c4aa0165c 100644
--- a/csharp/test/Ice/hash/Client.cs
+++ b/csharp/test/Ice/hash/Client.cs
@@ -19,9 +19,10 @@ using System.Collections.Generic;
public class Client
{
- private static void test(bool b)
+ private static void
+ test(bool b)
{
- if(!b)
+ if (!b)
{
throw new Exception();
}
@@ -50,8 +51,8 @@ public class Client
communicator = Ice.Util.initialize(ref args, initData);
{
Random rand = new Random();
- for(i = 0; proxyCollisions < maxCollisions &&
- endpointCollisions < maxCollisions &&
+ for(i = 0; proxyCollisions < maxCollisions &&
+ endpointCollisions < maxCollisions &&
i < maxIterations; ++i)
{
System.IO.StringWriter sw = new System.IO.StringWriter();
@@ -67,7 +68,7 @@ public class Client
Ice.ObjectPrx obj = communicator.stringToProxy(sw.ToString());
List<Ice.Endpoint> endpoints = new List<Ice.Endpoint>(obj.ice_getEndpoints());
-
+
if(seenProxy.ContainsKey(obj.GetHashCode()))
{
@@ -81,7 +82,7 @@ public class Client
{
seenProxy[obj.GetHashCode()] = obj;
}
-
+
foreach(Ice.Endpoint endpoint in endpoints)
{
if(seenEndpoint.ContainsKey(endpoint.GetHashCode()))
@@ -244,7 +245,7 @@ public class Client
Random rand = new Random();
int exceptionCollisions = 0;
- for(i = 0; i < maxIterations &&
+ for(i = 0; i < maxIterations &&
exceptionCollisions < maxCollisions; ++i)
{
Test.OtherException ex = new Test.OtherException(rand.Next(100), rand.Next(100), 0, false);
@@ -276,7 +277,7 @@ public class Client
Random rand = new Random();
int exceptionCollisions = 0;
- for(i = 0; i < maxIterations &&
+ for(i = 0; i < maxIterations &&
exceptionCollisions < maxCollisions; ++i)
{
Test.OtherException ex = new Test.OtherException(rand.Next(100) * 2^30, rand.Next(100) * 2^30, rand.Next(100) * 2^30, false);
@@ -305,7 +306,7 @@ public class Client
Random rand = new Random();
int exceptionCollisions = 0;
- for(i = 0; i < maxIterations &&
+ for(i = 0; i < maxIterations &&
exceptionCollisions < maxCollisions; ++i)
{
int v = rand.Next(1000);
@@ -358,7 +359,7 @@ public class Client
int structCollisions = 0;
for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
{
- Test.PointF pf = new Test.PointF((float)rand.NextDouble(), (float)rand.NextDouble(),
+ Test.PointF pf = new Test.PointF((float)rand.NextDouble(), (float)rand.NextDouble(),
(float)rand.NextDouble());
if(seenPointF.ContainsKey(pf.GetHashCode()))
{
@@ -383,7 +384,7 @@ public class Client
structCollisions = 0;
for(i = 0; i < maxIterations && structCollisions < maxCollisions; ++i)
{
- Test.PointD pd = new Test.PointD(rand.NextDouble(), rand.NextDouble(),
+ Test.PointD pd = new Test.PointD(rand.NextDouble(), rand.NextDouble(),
rand.NextDouble());
if(seenPointD.ContainsKey(pd.GetHashCode()))
{
@@ -496,7 +497,7 @@ public class Client
{
Test.Draw draw = new Test.Draw(
new Test.Color(rand.Next(255), rand.Next(255), rand.Next(255), rand.Next(255)),
- new Test.Pen(rand.Next(10),
+ new Test.Pen(rand.Next(10),
new Test.Color(rand.Next(255), rand.Next(255), rand.Next(255), rand.Next(255))),
false);
diff --git a/csharp/test/Ice/hash/run.py b/csharp/test/Ice/hash/run.py
deleted file mode 100755
index 0ddc0891279..00000000000
--- a/csharp/test/Ice/hash/run.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.simpleTest()
diff --git a/csharp/test/Ice/hold/AllTests.cs b/csharp/test/Ice/hold/AllTests.cs
index 813f1e3a59a..41c2aab173f 100644
--- a/csharp/test/Ice/hold/AllTests.cs
+++ b/csharp/test/Ice/hold/AllTests.cs
@@ -10,7 +10,7 @@
using System;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Condition
{
@@ -18,7 +18,7 @@ public class AllTests : TestCommon.TestApp
{
_value = value;
}
-
+
public void
set(bool value)
{
@@ -36,7 +36,7 @@ public class AllTests : TestCommon.TestApp
return _value;
}
}
-
+
private bool _value;
}
@@ -67,18 +67,19 @@ public class AllTests : TestCommon.TestApp
private int _expected;
}
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
- String @ref = "hold:default -p 12010";
+ String @ref = "hold:" + app.getTestEndpoint(0);
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
- String refSerialized = "hold:default -p 12011";
+ String refSerialized = "hold:" + app.getTestEndpoint(1);
Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized);
test(baseSerialized != null);
WriteLine("ok");
-
+
Write("testing checked cast... ");
Flush();
HoldPrx hold = HoldPrxHelper.checkedCast(@base);
@@ -90,7 +91,7 @@ public class AllTests : TestCommon.TestApp
test(holdSerialized != null);
test(holdSerialized.Equals(baseSerialized));
WriteLine("ok");
-
+
Write("changing state between active and hold rapidly... ");
Flush();
for(int i = 0; i < 100; ++i)
@@ -110,7 +111,7 @@ public class AllTests : TestCommon.TestApp
holdSerializedOneway.putOnHold(0);
}
WriteLine("ok");
-
+
Write("testing without serialize mode... ");
Flush();
System.Random rand = new System.Random();
@@ -209,7 +210,7 @@ public class AllTests : TestCommon.TestApp
hold.putOnHold(-1);
hold.ice_ping();
hold.putOnHold(-1);
- hold.ice_ping();
+ hold.ice_ping();
}
WriteLine("ok");
@@ -219,4 +220,4 @@ public class AllTests : TestCommon.TestApp
WriteLine("ok");
}
}
-
+
diff --git a/csharp/test/Ice/hold/Client.cs b/csharp/test/Ice/hold/Client.cs
index d0f293fe44e..fcc80eedcff 100644
--- a/csharp/test/Ice/hold/Client.cs
+++ b/csharp/test/Ice/hold/Client.cs
@@ -16,43 +16,17 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/hold/Server.cs b/csharp/test/Ice/hold/Server.cs
index 1b3ad90b04b..163c0009e76 100644
--- a/csharp/test/Ice/hold/Server.cs
+++ b/csharp/test/Ice/hold/Server.cs
@@ -16,32 +16,32 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
Timer timer = new Timer();
- communicator.getProperties().setProperty("TestAdapter1.Endpoints", "default -p 12010:udp");
- communicator.getProperties().setProperty("TestAdapter1.ThreadPool.Size", "5");
- communicator.getProperties().setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
- communicator.getProperties().setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
- communicator.getProperties().setProperty("TestAdapter1.ThreadPool.Serialize", "0");
- Ice.ObjectAdapter adapter1 = communicator.createObjectAdapter("TestAdapter1");
+ communicator().getProperties().setProperty("TestAdapter1.Endpoints", getTestEndpoint(0) + ":udp");
+ communicator().getProperties().setProperty("TestAdapter1.ThreadPool.Size", "5");
+ communicator().getProperties().setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
+ communicator().getProperties().setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
+ communicator().getProperties().setProperty("TestAdapter1.ThreadPool.Serialize", "0");
+ Ice.ObjectAdapter adapter1 = communicator().createObjectAdapter("TestAdapter1");
adapter1.add(new HoldI(timer, adapter1), Ice.Util.stringToIdentity("hold"));
- communicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p 12011:udp");
- communicator.getProperties().setProperty("TestAdapter2.ThreadPool.Size", "5");
- communicator.getProperties().setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
- communicator.getProperties().setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
- communicator.getProperties().setProperty("TestAdapter2.ThreadPool.Serialize", "1");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2");
+ communicator().getProperties().setProperty("TestAdapter2.Endpoints", getTestEndpoint(1) + ":udp");
+ communicator().getProperties().setProperty("TestAdapter2.ThreadPool.Size", "5");
+ communicator().getProperties().setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
+ communicator().getProperties().setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
+ communicator().getProperties().setProperty("TestAdapter2.ThreadPool.Serialize", "1");
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter2");
adapter2.add(new HoldI(timer, adapter2), Ice.Util.stringToIdentity("hold"));
adapter1.activate();
adapter2.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
timer.shutdown();
timer.waitForShutdown();
@@ -51,33 +51,7 @@ public class Server
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/hold/msbuild/server/server.csproj b/csharp/test/Ice/hold/msbuild/server/server.csproj
index f3d11e87f30..a90b40fc4bc 100644
--- a/csharp/test/Ice/hold/msbuild/server/server.csproj
+++ b/csharp/test/Ice/hold/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\HoldI.cs">
<Link>HoldI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/hold/run.py b/csharp/test/Ice/hold/run.py
deleted file mode 100755
index bfec815018d..00000000000
--- a/csharp/test/Ice/hold/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/info/AllTests.cs b/csharp/test/Ice/info/AllTests.cs
index 138bc702d1a..cb62a19f513 100644
--- a/csharp/test/Ice/info/AllTests.cs
+++ b/csharp/test/Ice/info/AllTests.cs
@@ -11,7 +11,7 @@
using System.Collections.Generic;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private static Ice.TCPEndpointInfo getTCPEndpointInfo(Ice.EndpointInfo info)
{
@@ -37,8 +37,9 @@ public class AllTests : TestCommon.TestApp
return null;
}
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing proxy endpoint information... ");
Flush();
{
@@ -113,8 +114,9 @@ public class AllTests : TestCommon.TestApp
adapter.destroy();
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p 12020");
- communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020");
+ int port = app.getTestPort(1);
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p " + port);
+ communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", app.getTestEndpoint(1));
adapter = communicator.createObjectAdapter("TestAdapter");
endpoints = adapter.getEndpoints();
@@ -125,18 +127,22 @@ public class AllTests : TestCommon.TestApp
foreach(Ice.Endpoint endpoint in endpoints)
{
tcpEndpoint = getTCPEndpointInfo(endpoint.getInfo());
- test(tcpEndpoint.port == 12020);
+ test(tcpEndpoint.port == port);
}
tcpEndpoint = getTCPEndpointInfo(publishedEndpoints[0].getInfo());
test(tcpEndpoint.host.Equals("127.0.0.1"));
- test(tcpEndpoint.port == 12020);
+ test(tcpEndpoint.port == port);
adapter.destroy();
}
WriteLine("ok");
- Ice.ObjectPrx @base = communicator.stringToProxy("test:default -p 12010:udp -p 12010");
+ int endpointPort = app.getTestPort(0);
+
+ Ice.ObjectPrx @base = communicator.stringToProxy("test:" +
+ app.getTestEndpoint(0) + ":" +
+ app.getTestEndpoint(0, "udp"));
TestIntfPrx testIntf = TestIntfPrxHelper.checkedCast(@base);
Write("test connection endpoint information... ");
@@ -144,7 +150,7 @@ public class AllTests : TestCommon.TestApp
{
Ice.EndpointInfo info = @base.ice_getConnection().getEndpoint().getInfo();
Ice.TCPEndpointInfo tcpinfo = getTCPEndpointInfo(info);
- test(tcpinfo.port == 12010);
+ test(tcpinfo.port == endpointPort);
test(!tcpinfo.compress);
test(tcpinfo.host.Equals(defaultHost));
@@ -156,7 +162,7 @@ public class AllTests : TestCommon.TestApp
info = @base.ice_datagram().ice_getConnection().getEndpoint().getInfo();
Ice.UDPEndpointInfo udp = (Ice.UDPEndpointInfo)info;
- test(udp.port == 12010);
+ test(udp.port == endpointPort);
test(udp.host.Equals(defaultHost));
}
WriteLine("ok");
@@ -171,7 +177,7 @@ public class AllTests : TestCommon.TestApp
Ice.TCPConnectionInfo ipInfo = getTCPConnectionInfo(info);
test(!info.incoming);
test(info.adapterName.Length == 0);
- test(ipInfo.remotePort == 12010);
+ test(ipInfo.remotePort == endpointPort);
test(ipInfo.localPort > 0);
if(defaultHost.Equals("127.0.0.1"))
{
@@ -211,7 +217,7 @@ public class AllTests : TestCommon.TestApp
test(!udpInfo.incoming);
test(udpInfo.adapterName.Length == 0);
test(udpInfo.localPort > 0);
- test(udpInfo.remotePort == 12010);
+ test(udpInfo.remotePort == endpointPort);
if(defaultHost.Equals("127.0.0.1"))
{
diff --git a/csharp/test/Ice/info/Client.cs b/csharp/test/Ice/info/Client.cs
index d0f293fe44e..fcc80eedcff 100644
--- a/csharp/test/Ice/info/Client.cs
+++ b/csharp/test/Ice/info/Client.cs
@@ -16,43 +16,17 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/info/Server.cs b/csharp/test/Ice/info/Server.cs
index 82b0a7d08ef..b447b093168 100644
--- a/csharp/test/Ice/info/Server.cs
+++ b/csharp/test/Ice/info/Server.cs
@@ -16,50 +16,23 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":" +
+ getTestEndpoint(0, "udp"));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/info/msbuild/server/server.csproj b/csharp/test/Ice/info/msbuild/server/server.csproj
index e86d820f535..aeb7b7f41b9 100644
--- a/csharp/test/Ice/info/msbuild/server/server.csproj
+++ b/csharp/test/Ice/info/msbuild/server/server.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/info/run.py b/csharp/test/Ice/info/run.py
deleted file mode 100755
index 8d9a8c0837c..00000000000
--- a/csharp/test/Ice/info/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/inheritance/AllTests.cs b/csharp/test/Ice/inheritance/AllTests.cs
index a3e48def188..6c2b4fd088c 100644
--- a/csharp/test/Ice/inheritance/AllTests.cs
+++ b/csharp/test/Ice/inheritance/AllTests.cs
@@ -9,24 +9,25 @@
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static InitialPrx allTests(Ice.Communicator communicator)
+ public static InitialPrx allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
- string ref_Renamed = "initial:default -p 12010";
+ string ref_Renamed = "initial:" + app.getTestEndpoint(0);
Ice.ObjectPrx @base = communicator.stringToProxy(ref_Renamed);
test(@base != null);
WriteLine("ok");
-
+
Write("testing checked cast... ");
Flush();
InitialPrx initial = InitialPrxHelper.checkedCast(@base);
test(initial != null);
test(initial.Equals(@base));
WriteLine("ok");
-
+
Write("getting proxies for class hierarchy... ");
Flush();
Test.MA.CAPrx ca = initial.caop();
@@ -40,7 +41,7 @@ public class AllTests : TestCommon.TestApp
test(cb != cd);
test(cc != cd);
WriteLine("ok");
-
+
Write("getting proxies for interface hierarchy... ");
Flush();
Test.MA.IAPrx ia = initial.iaop();
@@ -53,13 +54,13 @@ public class AllTests : TestCommon.TestApp
test(ib1 != ic);
test(ib2 != ic);
WriteLine("ok");
-
+
Write("invoking proxy operations on class hierarchy... ");
Flush();
Test.MA.CAPrx cao;
Test.MB.CBPrx cbo;
Test.MA.CCPrx cco;
-
+
cao = ca.caop(ca);
test(cao.Equals(ca));
cao = ca.caop(cb);
@@ -78,7 +79,7 @@ public class AllTests : TestCommon.TestApp
test(cao.Equals(cb));
cao = cc.caop(cc);
test(cao.Equals(cc));
-
+
cao = cb.cbop(cb);
test(cao.Equals(cb));
cbo = cb.cbop(cb);
@@ -95,7 +96,7 @@ public class AllTests : TestCommon.TestApp
test(cao.Equals(cc));
cbo = cc.cbop(cc);
test(cbo.Equals(cc));
-
+
cao = cc.ccop(cc);
test(cao.Equals(cc));
cbo = cc.ccop(cc);
@@ -103,14 +104,14 @@ public class AllTests : TestCommon.TestApp
cco = cc.ccop(cc);
test(cco.Equals(cc));
WriteLine("ok");
-
+
Write("ditto, but for interface hierarchy... ");
Flush();
Test.MA.IAPrx iao;
Test.MB.IB1Prx ib1o;
Test.MB.IB2Prx ib2o;
Test.MA.ICPrx ico;
-
+
iao = ia.iaop(ia);
test(iao.Equals(ia));
iao = ia.iaop(ib1);
@@ -143,7 +144,7 @@ public class AllTests : TestCommon.TestApp
test(iao.Equals(ib2));
iao = ic.iaop(ic);
test(iao.Equals(ic));
-
+
iao = ib1.ib1op(ib1);
test(iao.Equals(ib1));
ib1o = ib1.ib1op(ib1);
@@ -160,7 +161,7 @@ public class AllTests : TestCommon.TestApp
test(iao.Equals(ic));
ib1o = ic.ib1op(ic);
test(ib1o.Equals(ic));
-
+
iao = ib2.ib2op(ib2);
test(iao.Equals(ib2));
ib2o = ib2.ib2op(ib2);
@@ -177,7 +178,7 @@ public class AllTests : TestCommon.TestApp
test(iao.Equals(ic));
ib2o = ic.ib2op(ic);
test(ib2o.Equals(ic));
-
+
iao = ic.icop(ic);
test(iao.Equals(ic));
ib1o = ic.icop(ic);
@@ -187,31 +188,31 @@ public class AllTests : TestCommon.TestApp
ico = ic.icop(ic);
test(ico.Equals(ic));
WriteLine("ok");
-
+
Write("ditto, but for class implementing interfaces... ");
Flush();
-
+
cao = cd.caop(cd);
test(cao.Equals(cd));
cbo = cd.cbop(cd);
test(cbo.Equals(cd));
cco = cd.ccop(cd);
test(cco.Equals(cd));
-
+
iao = cd.iaop(cd);
test(iao.Equals(cd));
ib1o = cd.ib1op(cd);
test(ib1o.Equals(cd));
ib2o = cd.ib2op(cd);
test(ib2o.Equals(cd));
-
+
cao = cd.cdop(cd);
test(cao.Equals(cd));
cbo = cd.cdop(cd);
test(cbo.Equals(cd));
cco = cd.cdop(cd);
test(cco.Equals(cd));
-
+
iao = cd.cdop(cd);
test(iao.Equals(cd));
ib1o = cd.cdop(cd);
diff --git a/csharp/test/Ice/inheritance/Client.cs b/csharp/test/Ice/inheritance/Client.cs
index 805670012c6..3ffaca65c44 100644
--- a/csharp/test/Ice/inheritance/Client.cs
+++ b/csharp/test/Ice/inheritance/Client.cs
@@ -17,45 +17,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- InitialPrx initial = AllTests.allTests(communicator);
+ InitialPrx initial = AllTests.allTests(this);
initial.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/inheritance/Collocated.cs b/csharp/test/Ice/inheritance/Collocated.cs
index ab0cfc4951f..df775566080 100644
--- a/csharp/test/Ice/inheritance/Collocated.cs
+++ b/csharp/test/Ice/inheritance/Collocated.cs
@@ -17,47 +17,21 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object obj = new InitialI(adapter);
adapter.add(obj, Ice.Util.stringToIdentity("initial"));
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- System.Console.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/inheritance/Server.cs b/csharp/test/Ice/inheritance/Server.cs
index d4988c372b9..2844a25ff3d 100644
--- a/csharp/test/Ice/inheritance/Server.cs
+++ b/csharp/test/Ice/inheritance/Server.cs
@@ -16,48 +16,22 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object @object = new InitialI(adapter);
adapter.add(@object, Ice.Util.stringToIdentity("initial"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/inheritance/msbuild/server/server.csproj b/csharp/test/Ice/inheritance/msbuild/server/server.csproj
index 03cb5b53388..683ce6ed690 100644
--- a/csharp/test/Ice/inheritance/msbuild/server/server.csproj
+++ b/csharp/test/Ice/inheritance/msbuild/server/server.csproj
@@ -65,6 +65,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\CAI.cs">
<Link>CAI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/inheritance/run.py b/csharp/test/Ice/inheritance/run.py
deleted file mode 100755
index df7bc2b4ac3..00000000000
--- a/csharp/test/Ice/inheritance/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/interceptor/Client.cs b/csharp/test/Ice/interceptor/Client.cs
index e50b0e34cd8..00ca5d77d1e 100644
--- a/csharp/test/Ice/interceptor/Client.cs
+++ b/csharp/test/Ice/interceptor/Client.cs
@@ -16,227 +16,215 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public class App : Ice.Application
+ private int run(Test.MyObjectPrx prx, InterceptorI interceptor)
{
- private static void test(bool b)
- {
- 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());
- prx.ice_ping();
- test(interceptor.getLastOperation().Equals("ice_ping"));
- test(!interceptor.getLastStatus());
- String typeId = prx.ice_id();
- test(interceptor.getLastOperation().Equals("ice_id"));
- test(!interceptor.getLastStatus());
- test(prx.ice_isA(typeId));
- test(interceptor.getLastOperation().Equals("ice_isA"));
- test(!interceptor.getLastStatus());
- test(prx.add(33, 12) == 45);
- test(interceptor.getLastOperation().Equals("add"));
- test(!interceptor.getLastStatus());
- 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());
- 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());
- 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());
- Console.WriteLine("ok");
- Console.Out.Write("testing system exception... ");
- Console.Out.Flush();
- interceptor.clear();
- try
- {
- prx.badSystemAdd(33, 12);
- test(false);
- }
- catch(Ice.UnknownException)
- {
- test(!prx.ice_isCollocationOptimized());
- }
- catch(MySystemException)
- {
- test(prx.ice_isCollocationOptimized());
- }
- catch(Exception)
- {
- test(false);
- }
- test(interceptor.getLastOperation().Equals("badSystemAdd"));
- test(!interceptor.getLastStatus());
- Console.WriteLine("ok");
-
- return 0;
- }
-
- private int runAmd(Test.MyObjectPrx prx, InterceptorI interceptor)
- {
- Console.Out.Write("testing simple interceptor... ");
- Console.Out.Flush();
- test(interceptor.getLastOperation() == null);
- test(!interceptor.getLastStatus());
- test(prx.amdAdd(33, 12) == 45);
- test(interceptor.getLastOperation().Equals("amdAdd"));
- test(interceptor.getLastStatus());
- 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());
- 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());
- 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());
- Console.WriteLine("ok");
-
- Console.Out.Write("testing system exception... ");
- Console.Out.Flush();
- interceptor.clear();
- try
- {
- prx.amdBadSystemAdd(33, 12);
- test(false);
- }
- catch(Ice.UnknownException)
- {
- test(!prx.ice_isCollocationOptimized());
- }
- catch(MySystemException)
- {
- test(prx.ice_isCollocationOptimized());
- }
- catch(Exception)
- {
- test(false);
- }
- test(interceptor.getLastOperation().Equals("amdBadSystemAdd"));
- test(interceptor.getLastStatus());
- Console.WriteLine("ok");
- return 0;
- }
-
- public override int run(string[] args)
- {
- //
- // Create OA and servants
- //
-
- communicator().getProperties().setProperty("MyOA.AdapterId", "myOA");
-
- 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));
-
- Console.WriteLine("Collocation optimization on");
- int rs = run(prx, interceptor);
- if(rs != 0)
- {
- return rs;
- }
-
- Console.WriteLine("Now with AMD");
- interceptor.clear();
- rs = runAmd(prx, interceptor);
- if(rs != 0)
- {
- return rs;
- }
-
- oa.activate(); // Only necessary for non-collocation optimized tests
-
- Console.WriteLine("Collocation optimization off");
- interceptor.clear();
- prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));
- rs = run(prx, interceptor);
- if(rs != 0)
- {
- return rs;
- }
-
- Console.WriteLine("Now with AMD");
- interceptor.clear();
- rs = runAmd(prx, interceptor);
+ Console.Out.Write("testing simple interceptor... ");
+ Console.Out.Flush();
+ test(interceptor.getLastOperation() == null);
+ test(!interceptor.getLastStatus());
+ prx.ice_ping();
+ test(interceptor.getLastOperation().Equals("ice_ping"));
+ test(!interceptor.getLastStatus());
+ String typeId = prx.ice_id();
+ test(interceptor.getLastOperation().Equals("ice_id"));
+ test(!interceptor.getLastStatus());
+ test(prx.ice_isA(typeId));
+ test(interceptor.getLastOperation().Equals("ice_isA"));
+ test(!interceptor.getLastStatus());
+ test(prx.add(33, 12) == 45);
+ test(interceptor.getLastOperation().Equals("add"));
+ test(!interceptor.getLastStatus());
+ 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());
+ 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());
+ 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());
+ Console.WriteLine("ok");
+ Console.Out.Write("testing system exception... ");
+ Console.Out.Flush();
+ interceptor.clear();
+ try
+ {
+ prx.badSystemAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.UnknownException)
+ {
+ test(!prx.ice_isCollocationOptimized());
+ }
+ catch(MySystemException)
+ {
+ test(prx.ice_isCollocationOptimized());
+ }
+ catch(Exception)
+ {
+ test(false);
+ }
+ test(interceptor.getLastOperation().Equals("badSystemAdd"));
+ test(!interceptor.getLastStatus());
+ Console.WriteLine("ok");
+
+ return 0;
+ }
+ private int runAmd(Test.MyObjectPrx prx, InterceptorI interceptor)
+ {
+ Console.Out.Write("testing simple interceptor... ");
+ Console.Out.Flush();
+ test(interceptor.getLastOperation() == null);
+ test(!interceptor.getLastStatus());
+ test(prx.amdAdd(33, 12) == 45);
+ test(interceptor.getLastOperation().Equals("amdAdd"));
+ test(interceptor.getLastStatus());
+ 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());
+ 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());
+ 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());
+ Console.WriteLine("ok");
+
+ Console.Out.Write("testing system exception... ");
+ Console.Out.Flush();
+ interceptor.clear();
+ try
+ {
+ prx.amdBadSystemAdd(33, 12);
+ test(false);
+ }
+ catch(Ice.UnknownException)
+ {
+ test(!prx.ice_isCollocationOptimized());
+ }
+ catch(MySystemException)
+ {
+ test(prx.ice_isCollocationOptimized());
+ }
+ catch(Exception)
+ {
+ test(false);
+ }
+ test(interceptor.getLastOperation().Equals("amdBadSystemAdd"));
+ test(interceptor.getLastStatus());
+ Console.WriteLine("ok");
+ return 0;
+ }
+
+ public override int run(string[] args)
+ {
+ //
+ // Create OA and servants
+ //
+
+ communicator().getProperties().setProperty("MyOA.AdapterId", "myOA");
+
+ 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));
+
+ Console.WriteLine("Collocation optimization on");
+ int rs = run(prx, interceptor);
+ if(rs != 0)
+ {
return rs;
}
+
+ Console.WriteLine("Now with AMD");
+ interceptor.clear();
+ rs = runAmd(prx, interceptor);
+ if(rs != 0)
+ {
+ return rs;
+ }
+
+ oa.activate(); // Only necessary for non-collocation optimized tests
+
+ Console.WriteLine("Collocation optimization off");
+ interceptor.clear();
+ prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));
+ rs = run(prx, interceptor);
+ if(rs != 0)
+ {
+ return rs;
+ }
+
+ Console.WriteLine("Now with AMD");
+ interceptor.clear();
+ rs = runAmd(prx, interceptor);
+
+ return rs;
}
public static int Main(string[] args)
{
- App app = new App();
- Ice.InitializationData data = new Ice.InitializationData();
- return app.main(args, data);
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/interceptor/msbuild/client/client.csproj b/csharp/test/Ice/interceptor/msbuild/client/client.csproj
index b5c54a6f110..e85673c996f 100644
--- a/csharp/test/Ice/interceptor/msbuild/client/client.csproj
+++ b/csharp/test/Ice/interceptor/msbuild/client/client.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Client.cs">
<Link>Client.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/interceptor/run.py b/csharp/test/Ice/interceptor/run.py
deleted file mode 100755
index 81357cdeec4..00000000000
--- a/csharp/test/Ice/interceptor/run.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-sys.stdout.write("starting client...")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0", startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
diff --git a/csharp/test/Ice/invoke/AllTests.cs b/csharp/test/Ice/invoke/AllTests.cs
index 23c321d80f3..7ea73c5feb3 100644
--- a/csharp/test/Ice/invoke/AllTests.cs
+++ b/csharp/test/Ice/invoke/AllTests.cs
@@ -13,7 +13,7 @@ using System.Collections.Generic;
using System.Diagnostics;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private static string testString = "This is a test string";
@@ -182,9 +182,10 @@ public class AllTests : TestCommon.TestApp
private CallbackBase callback = new CallbackBase();
}
- public static Test.MyClassPrx allTests(Ice.Communicator communicator)
+ public static Test.MyClassPrx allTests(TestCommon.Application app)
{
- Ice.ObjectPrx baseProxy = communicator.stringToProxy("test:default -p 12010");
+ Ice.Communicator communicator = app.communicator();
+ Ice.ObjectPrx baseProxy = communicator.stringToProxy("test:" + app.getTestEndpoint(0));
Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy);
Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(cl.ice_oneway());
Test.MyClassPrx batchOneway = Test.MyClassPrxHelper.uncheckedCast(cl.ice_batchOneway());
diff --git a/csharp/test/Ice/invoke/Client.cs b/csharp/test/Ice/invoke/Client.cs
index 2d8eedad21a..5b0dd91cb2f 100644
--- a/csharp/test/Ice/invoke/Client.cs
+++ b/csharp/test/Ice/invoke/Client.cs
@@ -16,46 +16,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.MyClassPrx myClass = AllTests.allTests(communicator);
+ Test.MyClassPrx myClass = AllTests.allTests(this);
myClass.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/invoke/Server.cs b/csharp/test/Ice/invoke/Server.cs
index 7a86cd8bab7..299d14abc60 100644
--- a/csharp/test/Ice/invoke/Server.cs
+++ b/csharp/test/Ice/invoke/Server.cs
@@ -50,9 +50,9 @@ public class ServantLocatorI : Ice.ServantLocator
private Ice.Object _blobject;
}
-public class Server
+public class Server : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
bool async = false;
for(int i = 0; i < args.Length; ++i)
@@ -63,47 +63,19 @@ public class Server
}
}
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.addServantLocator(new ServantLocatorI(async), "");
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/invoke/msbuild/server/server.csproj b/csharp/test/Ice/invoke/msbuild/server/server.csproj
index 55a1317b7de..a5863af2c0a 100644
--- a/csharp/test/Ice/invoke/msbuild/server/server.csproj
+++ b/csharp/test/Ice/invoke/msbuild/server/server.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\BlobjectI.cs">
<Link>BlobjectI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/invoke/run.py b/csharp/test/Ice/invoke/run.py
deleted file mode 100755
index 2b09a4e5f86..00000000000
--- a/csharp/test/Ice/invoke/run.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "blobject", message = "Running test with Blobject server.")
-TestUtil.queueClientServerTest(configName = "blobjectAsync", message = "Running test with BlobjectAsync server.",
- additionalServerOptions = "--async")
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/location/AllTests.cs b/csharp/test/Ice/location/AllTests.cs
index 129737c3073..adf84b5abda 100644
--- a/csharp/test/Ice/location/AllTests.cs
+++ b/csharp/test/Ice/location/AllTests.cs
@@ -11,18 +11,19 @@ using System;
using Test;
using System.Collections.Generic;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast(
- communicator.stringToProxy("ServerManager :default -p 12010"));
+ communicator.stringToProxy("ServerManager :" + app.getTestEndpoint(0)));
test(manager != null);
TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator());
test(locator != null);
TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry());
test(registry != null);
-
+
Write("testing stringToProxy... ");
Flush();
Ice.ObjectPrx @base = communicator.stringToProxy("test @ TestAdapter");
@@ -32,10 +33,10 @@ public class AllTests : TestCommon.TestApp
Ice.ObjectPrx base5 = communicator.stringToProxy("test2");
Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter");
WriteLine("ok");
-
+
Write("testing ice_locator and ice_getLocator... ");
test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
- Ice.LocatorPrx anotherLocator =
+ Ice.LocatorPrx anotherLocator =
Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator"));
@base = @base.ice_locator(anotherLocator);
test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0);
@@ -46,8 +47,8 @@ public class AllTests : TestCommon.TestApp
test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), anotherLocator) == 0);
communicator.setDefaultLocator(locator);
@base = communicator.stringToProxy("test @ TestAdapter");
- test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
-
+ test(Ice.Util.proxyIdentityCompare(@base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
+
//
// We also test ice_router/ice_getRouter (perhaps we should add a
// test/Ice/router test?)
@@ -69,7 +70,7 @@ public class AllTests : TestCommon.TestApp
Flush();
manager.startServer();
WriteLine("ok");
-
+
Write("testing checked cast... ");
Flush();
TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base);
@@ -85,7 +86,7 @@ public class AllTests : TestCommon.TestApp
TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6);
test(obj6 != null);
WriteLine("ok");
-
+
Write("testing id@AdapterId indirect proxy... ");
Flush();
obj.shutdown();
@@ -105,7 +106,7 @@ public class AllTests : TestCommon.TestApp
obj.shutdown();
manager.startServer();
try
- {
+ {
obj6.ice_ping();
}
catch(Ice.LocalException)
@@ -113,7 +114,7 @@ public class AllTests : TestCommon.TestApp
test(false);
}
WriteLine("ok");
-
+
Write("testing identity indirect proxy... ");
Flush();
obj.shutdown();
@@ -199,7 +200,7 @@ public class AllTests : TestCommon.TestApp
test(ex.id.Equals("unknown/unknown"));
}
WriteLine("ok");
-
+
Write("testing proxy with unknown adapter... ");
Flush();
try
@@ -214,10 +215,10 @@ public class AllTests : TestCommon.TestApp
test(ex.id.Equals("TestAdapterUnknown"));
}
WriteLine("ok");
-
+
Write("testing locator cache timeout... ");
Flush();
-
+
int count = locator.getRequestCount();
communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache.
test(++count == locator.getRequestCount());
@@ -228,7 +229,7 @@ public class AllTests : TestCommon.TestApp
System.Threading.Thread.Sleep(1200); // 1200ms
communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
test(++count == locator.getRequestCount());
-
+
communicator.stringToProxy("test").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache.
count += 2;
test(count == locator.getRequestCount());
@@ -238,12 +239,12 @@ public class AllTests : TestCommon.TestApp
communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout
count += 2;
test(count == locator.getRequestCount());
-
- communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping();
+
+ communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping();
test(count == locator.getRequestCount());
communicator.stringToProxy("test").ice_locatorCacheTimeout(-1).ice_ping();
test(count == locator.getRequestCount());
- communicator.stringToProxy("test@TestAdapter").ice_ping();
+ communicator.stringToProxy("test@TestAdapter").ice_ping();
test(count == locator.getRequestCount());
communicator.stringToProxy("test").ice_ping();
test(count == locator.getRequestCount());
@@ -262,7 +263,7 @@ public class AllTests : TestCommon.TestApp
test(hello.ice_getAdapterId().Equals("ReplicatedAdapter"));
hello.sayHello();
WriteLine("ok");
-
+
Write("testing locator request queuing... ");
Flush();
hello = (HelloPrx)obj.getReplicatedHello().ice_locatorCacheTimeout(0).ice_connectionCached(false);
@@ -347,7 +348,7 @@ public class AllTests : TestCommon.TestApp
{
test(false);
}
-
+
try
{
communicator.stringToProxy("test@TestAdapter3").ice_locatorCacheTimeout(0).ice_ping();
@@ -362,7 +363,7 @@ public class AllTests : TestCommon.TestApp
test(false);
}
catch(Ice.LocalException)
- {
+ {
}
registry.setAdapterDirectProxy("TestAdapter3", locator.findAdapterById("TestAdapter"));
try
@@ -432,7 +433,7 @@ public class AllTests : TestCommon.TestApp
test(false);
}
catch(Ice.LocalException)
- {
+ {
}
try
{
@@ -451,7 +452,7 @@ public class AllTests : TestCommon.TestApp
{
test(false);
}
-
+
registry.addObject(communicator.stringToProxy("test4"));
try
{
@@ -462,7 +463,7 @@ public class AllTests : TestCommon.TestApp
{
}
WriteLine("ok");
-
+
Write("testing locator cache background updates... ");
Flush();
{
diff --git a/csharp/test/Ice/location/Client.cs b/csharp/test/Ice/location/Client.cs
index fc333cef871..781e212f9fa 100644
--- a/csharp/test/Ice/location/Client.cs
+++ b/csharp/test/Ice/location/Client.cs
@@ -16,46 +16,24 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(initData.properties, 0));
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/location/Server.cs b/csharp/test/Ice/location/Server.cs
index 902f536f7f5..ac0be0825bb 100644
--- a/csharp/test/Ice/location/Server.cs
+++ b/csharp/test/Ice/location/Server.cs
@@ -16,21 +16,20 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator,
- Ice.InitializationData initData)
+ public override int run(string[] args)
{
//
// Register the server manager. The server manager creates a new
// 'server' (a server isn't a different process, it's just a new
// communicator and object adapter).
//
- Ice.Properties properties = communicator.getProperties();
+ Ice.Properties properties = communicator().getProperties();
properties.setProperty("Ice.ThreadPool.Server.Size", "2");
- properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp");
+ properties.setProperty("ServerManagerAdapter.Endpoints", getTestEndpoint(0) + ":udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ServerManagerAdapter");
//
// We also register a sample server locator which implements the
@@ -38,7 +37,7 @@ public class Server
// 'servers' created with the server manager interface.
//
ServerLocatorRegistry registry = new ServerLocatorRegistry();
- Ice.Object @object = new ServerManagerI(registry, initData);
+ Ice.Object @object = new ServerManagerI(registry, _initData, this);
adapter.add(@object, Ice.Util.stringToIdentity("ServerManager"));
registry.addObject(adapter.createProxy(Ice.Util.stringToIdentity("ServerManager")));
Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(
@@ -48,42 +47,22 @@ public class Server
adapter.add(locator, Ice.Util.stringToIdentity("locator"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator, initData);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ _initData = base.getInitData(ref args);
+ return _initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
+
+ private Ice.InitializationData _initData;
}
diff --git a/csharp/test/Ice/location/ServerManagerI.cs b/csharp/test/Ice/location/ServerManagerI.cs
index 3e5458e43ac..1a6f2bf7197 100644
--- a/csharp/test/Ice/location/ServerManagerI.cs
+++ b/csharp/test/Ice/location/ServerManagerI.cs
@@ -12,17 +12,17 @@ using Test;
public class ServerManagerI : ServerManagerDisp_
{
- internal ServerManagerI(ServerLocatorRegistry registry,
- Ice.InitializationData initData)
+ internal ServerManagerI(ServerLocatorRegistry registry, Ice.InitializationData initData, TestCommon.Application app)
{
_registry = registry;
_communicators = new ArrayList();
_initData = initData;
+ _app = app;
_initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter");
_initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter");
_initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2");
}
-
+
public override void startServer(Ice.Current current)
{
foreach(Ice.Communicator c in _communicators)
@@ -47,16 +47,16 @@ public class ServerManagerI : ServerManagerDisp_
// Use fixed port to ensure that OA re-activation doesn't re-use previous port from
// another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter).
//
- serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + _nextPort++);
- serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p " + _nextPort++);
+ serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", _app.getTestEndpoint(_nextPort++));
+ serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", _app.getTestEndpoint(_nextPort++));
Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter");
Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2");
-
- Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010");
+
+ Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:" + _app.getTestEndpoint(0));
adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
-
+
Ice.Object @object = new TestI(adapter, adapter2, _registry);
_registry.addObject(adapter.add(@object, Ice.Util.stringToIdentity("test")));
_registry.addObject(adapter.add(@object, Ice.Util.stringToIdentity("test2")));
@@ -79,5 +79,6 @@ public class ServerManagerI : ServerManagerDisp_
private ServerLocatorRegistry _registry;
private ArrayList _communicators;
private Ice.InitializationData _initData;
- private int _nextPort = 12011;
+ private TestCommon.Application _app;
+ private int _nextPort = 1;
}
diff --git a/csharp/test/Ice/location/msbuild/server/server.csproj b/csharp/test/Ice/location/msbuild/server/server.csproj
index e02829fe996..289f58429cb 100644
--- a/csharp/test/Ice/location/msbuild/server/server.csproj
+++ b/csharp/test/Ice/location/msbuild/server/server.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\HelloI.cs">
<Link>HelloI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/location/run.py b/csharp/test/Ice/location/run.py
deleted file mode 100755
index bfec815018d..00000000000
--- a/csharp/test/Ice/location/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/metrics/AllTests.cs b/csharp/test/Ice/metrics/AllTests.cs
index 7cc9b2979d2..64e04338908 100644
--- a/csharp/test/Ice/metrics/AllTests.cs
+++ b/csharp/test/Ice/metrics/AllTests.cs
@@ -13,7 +13,7 @@ using System.Threading;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
static IceMX.ConnectionMetrics
getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected)
@@ -78,6 +78,12 @@ public class AllTests : TestCommon.TestApp
private bool _wait;
};
+ static string
+ getPort(Ice.PropertiesAdminPrx p)
+ {
+ return TestCommon.Application.getTestPort(p.ice_getCommunicator().getProperties(), 0).ToString();
+ }
+
static private Dictionary<string, string>
getClientProps(Ice.PropertiesAdminPrx p, Dictionary<string, string> orig, string m)
{
@@ -96,7 +102,7 @@ public class AllTests : TestCommon.TestApp
map += "Map." + m + '.';
}
props["IceMX.Metrics.View." + map + "Reject.parent"] = "Ice\\.Admin";
- props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = "12010";
+ props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = getPort(p);
props["IceMX.Metrics.View." + map + "Reject.identity"] = ".*/admin|controller";
return props;
}
@@ -119,7 +125,7 @@ public class AllTests : TestCommon.TestApp
map += "Map." + m + '.';
}
props["IceMX.Metrics.View." + map + "Reject.parent"] = "Ice\\.Admin|Controller";
- props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = "12010";
+ props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = getPort(p);
return props;
}
@@ -383,9 +389,17 @@ public class AllTests : TestCommon.TestApp
return m;
}
- public static MetricsPrx allTests(Ice.Communicator communicator, CommunicatorObserverI obsv)
+ public static MetricsPrx allTests(TestCommon.Application app, CommunicatorObserverI obsv)
{
- MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:default -p 12010"));
+ Ice.Communicator communicator = app.communicator();
+
+ string host = app.getTestHost();
+ string port = app.getTestPort(0).ToString();
+ string hostAndPort = host + ":" + port;
+ string protocol = app.getTestProtocol();
+ string endpoint = protocol + " -h " + host + " -p " + port;
+
+ MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:" + endpoint));
bool collocated = metrics.ice_getConnection() == null;
Write("testing metrics admin facet checkedCast... ");
@@ -483,9 +497,6 @@ public class AllTests : TestCommon.TestApp
WriteLine("ok");
-
- string endpoint = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp") +
- " -h 127.0.0.1 -p 12010";
string type = "";
string isSecure = "";
if(!collocated)
@@ -571,7 +582,7 @@ public class AllTests : TestCommon.TestApp
test(map["active"].current == 1);
ControllerPrx controller = ControllerPrxHelper.checkedCast(
- communicator.stringToProxy("controller:default -p 12011"));
+ communicator.stringToProxy("controller:" + app.getTestEndpoint(1)));
controller.hold();
map = toMap(clientMetrics.getMetricsView("View", out timestamp)["Connection"]);
@@ -637,16 +648,16 @@ public class AllTests : TestCommon.TestApp
testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", isSecure);
testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500");
testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "False");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", host);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", port);
testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "False");
testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "");
testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", host);
//testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "");
- testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1");
- testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010");
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", host);
+ testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", port);
testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "");
testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "");
@@ -668,13 +679,13 @@ public class AllTests : TestCommon.TestApp
test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 1);
IceMX.Metrics m1 = clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"][0];
- test(m1.current == 0 && m1.total == 1 && m1.id.Equals("127.0.0.1:12010"));
+ test(m1.current == 0 && m1.total == 1 && m1.id.Equals(hostAndPort));
metrics.ice_getConnection().close(false);
controller.hold();
try
{
- communicator.stringToProxy("test:tcp -p 12010 -h 127.0.0.1").ice_timeout(10).ice_ping();
+ communicator.stringToProxy("test:tcp -h 127.0.0.1 -p " + port).ice_timeout(10).ice_ping();
test(false);
}
catch(Ice.ConnectTimeoutException)
@@ -687,13 +698,13 @@ public class AllTests : TestCommon.TestApp
controller.resume();
test(clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"].Length == 1);
m1 = clientMetrics.getMetricsView("View", out timestamp)["ConnectionEstablishment"][0];
- test(m1.id.Equals("127.0.0.1:12010") && m1.total == 3 && m1.failures == 2);
+ test(m1.id.Equals(hostAndPort) && m1.total == 3 && m1.failures == 2);
checkFailure(clientMetrics, "ConnectionEstablishment", m1.id, "::Ice::ConnectTimeoutException", 2);
System.Action c = () => { connect(metrics); };
testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", hostAndPort, c);
testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint",
endpoint + " -t 60000", c);
@@ -705,9 +716,8 @@ public class AllTests : TestCommon.TestApp
testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointTimeout", "60000", c);
testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "False",
c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1",
- c);
- testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", host, c);
+ testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", port, c);
WriteLine("ok");
@@ -718,19 +728,27 @@ public class AllTests : TestCommon.TestApp
updateProps(clientProps, serverProps, update, props, "EndpointLookup");
test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 0);
- Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite");
- prx.ice_ping();
+ Ice.ObjectPrx prx =
+ communicator.stringToProxy("metrics:" + protocol + " -p " + port + " -h localhost -t 500");
+ try
+ {
+ prx.ice_ping();
+ prx.ice_getConnection().close(false);
+ }
+ catch(Ice.LocalException)
+ {
+ }
test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 1);
m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0];
- test(m1.current <= 1 && m1.total == 1 && m1.id.Equals(prx.ice_getConnection().getEndpoint().ToString()));
+ test(m1.current <= 1 && m1.total == 1);
prx.ice_getConnection().close(false);
bool dnsException = false;
try
{
- communicator.stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com").ice_ping();
+ communicator.stringToProxy("test:tcp -t 500 -h unknownfoo.zeroc.com -p " + port).ice_ping();
test(false);
}
catch(Ice.DNSException)
@@ -743,11 +761,11 @@ public class AllTests : TestCommon.TestApp
}
test(clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"].Length == 2);
m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][0];
- if(!m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500"))
+ if(!m1.id.Equals("tcp -h unknownfoo.zeroc.com -p " + port + " -t 500"))
{
m1 = clientMetrics.getMetricsView("View", out timestamp)["EndpointLookup"][1];
}
- test(m1.id.Equals("tcp -h unknownfoo.zeroc.com -p 12010 -t 500") && m1.total == 2 &&
+ test(m1.id.Equals("tcp -h unknownfoo.zeroc.com -p " + port + " -t 500") && m1.total == 2 &&
(!dnsException || m1.failures == 2));
if(dnsException)
{
@@ -765,10 +783,10 @@ public class AllTests : TestCommon.TestApp
testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", type, c);
testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "False", c);
testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", isSecure, c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "500", c);
testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "False", c);
testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c);
- testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c);
+ testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", port, c);
WriteLine("ok");
}
@@ -866,16 +884,16 @@ public class AllTests : TestCommon.TestApp
testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", isSecure, op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "60000", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "False", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", host, op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", port, op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "True", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op);
- testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op);
- //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", host, op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", port, op);
+ testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", host, op);
+ //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", port, op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op);
testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op);
}
diff --git a/csharp/test/Ice/metrics/Client.cs b/csharp/test/Ice/metrics/Client.cs
index eed092ffb08..3b9c3c76c57 100644
--- a/csharp/test/Ice/metrics/Client.cs
+++ b/csharp/test/Ice/metrics/Client.cs
@@ -17,56 +17,32 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.MetricsPrx metrics = AllTests.allTests(communicator, _observer);
+ Test.MetricsPrx metrics = AllTests.allTests(this, _observer);
metrics.shutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
- Debug.Listeners.Add(new ConsoleTraceListener());
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
- initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
- initData.properties.setProperty("Ice.Admin.InstanceName", "client");
- initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
-
- initData.observer = _observer;
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.observer = _observer;
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "client");
+ initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
static CommunicatorObserverI _observer = new CommunicatorObserverI();
diff --git a/csharp/test/Ice/metrics/Collocated.cs b/csharp/test/Ice/metrics/Collocated.cs
index 4d7c5ed6a6e..240727114b8 100644
--- a/csharp/test/Ice/metrics/Collocated.cs
+++ b/csharp/test/Ice/metrics/Collocated.cs
@@ -17,66 +17,44 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
- communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
+ Ice.ObjectAdapter controllerAdapter = communicator().createObjectAdapter("ControllerAdapter");
controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
//controllerAdapter.activate(); // Don't activate OA to ensure collocation is used.
- Test.MetricsPrx metrics = AllTests.allTests(communicator, _observer);
+ Test.MetricsPrx metrics = AllTests.allTests(this, _observer);
metrics.shutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
- Debug.Listeners.Add(new ConsoleTraceListener());
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
- initData.properties.setProperty("Ice.Admin.InstanceName", "client");
- initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- initData.observer = _observer;
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.observer = _observer;
+ initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics");
+ initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0));
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "client");
+ initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
static CommunicatorObserverI _observer = new CommunicatorObserverI();
diff --git a/csharp/test/Ice/metrics/Server.cs b/csharp/test/Ice/metrics/Server.cs
index d76fbd4c8cf..5bdfbacbe1b 100644
--- a/csharp/test/Ice/metrics/Server.cs
+++ b/csharp/test/Ice/metrics/Server.cs
@@ -1,3 +1,4 @@
+
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
@@ -17,62 +18,39 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics"));
adapter.activate();
- communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011");
- Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter");
+ communicator().getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
+ Ice.ObjectAdapter controllerAdapter = communicator().createObjectAdapter("ControllerAdapter");
controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller"));
controllerAdapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
- Debug.Listeners.Add(new ConsoleTraceListener());
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry");
- initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010");
- initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
- initData.properties.setProperty("Ice.Admin.InstanceName", "server");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.MessageSizeMax", "50000");
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0));
+ initData.properties.setProperty("Ice.Admin.Endpoints", "tcp");
+ initData.properties.setProperty("Ice.Admin.InstanceName", "server");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties.setProperty("Ice.MessageSizeMax", "50000");
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/metrics/msbuild/server/server.csproj b/csharp/test/Ice/metrics/msbuild/server/server.csproj
index 97fe12b6255..af0717efd7f 100644
--- a/csharp/test/Ice/metrics/msbuild/server/server.csproj
+++ b/csharp/test/Ice/metrics/msbuild/server/server.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MetricsI.cs">
<Link>MetricsI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj
index 26cf755bf03..0f2d6e0211c 100644
--- a/csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/metrics/msbuild/serveramd/serveramd.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MetricsAMDI.cs">
<Link>MetricsAMDI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/metrics/run.py b/csharp/test/Ice/metrics/run.py
deleted file mode 100755
index 2077e17b3d9..00000000000
--- a/csharp/test/Ice/metrics/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server = "serveramd")
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/networkProxy/AllTests.cs b/csharp/test/Ice/networkProxy/AllTests.cs
index 455fe310c60..b007535aab2 100644
--- a/csharp/test/Ice/networkProxy/AllTests.cs
+++ b/csharp/test/Ice/networkProxy/AllTests.cs
@@ -7,7 +7,7 @@
//
// **********************************************************************
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private static Ice.IPConnectionInfo getIPConnectionInfo(Ice.ConnectionInfo info)
{
@@ -21,12 +21,19 @@ public class AllTests : TestCommon.TestApp
return null;
}
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
- string sref = "test:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string sref = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
+ int proxyPort = communicator.getProperties().getPropertyAsInt("Ice.HTTPProxyPort");
+ if(proxyPort == 0)
+ {
+ proxyPort = communicator.getProperties().getPropertyAsInt("Ice.SOCKSProxyPort");
+ }
+
Test.TestIntfPrx testPrx = Test.TestIntfPrxHelper.checkedCast(obj);
test(testPrx != null);
@@ -41,7 +48,7 @@ public class AllTests : TestCommon.TestApp
Flush();
{
Ice.IPConnectionInfo info = getIPConnectionInfo(testPrx.ice_getConnection().getInfo());
- test(info.remotePort == 12030 || info.remotePort == 12031); // make sure we are connected to the proxy port.
+ test(info.remotePort == proxyPort); // make sure we are connected to the proxy port.
}
WriteLine("ok");
diff --git a/csharp/test/Ice/networkProxy/Client.cs b/csharp/test/Ice/networkProxy/Client.cs
index b5404ab14b8..fcc80eedcff 100644
--- a/csharp/test/Ice/networkProxy/Client.cs
+++ b/csharp/test/Ice/networkProxy/Client.cs
@@ -16,45 +16,17 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/networkProxy/Server.cs b/csharp/test/Ice/networkProxy/Server.cs
index 59d35c7831a..4cd846a25d9 100644
--- a/csharp/test/Ice/networkProxy/Server.cs
+++ b/csharp/test/Ice/networkProxy/Server.cs
@@ -16,7 +16,7 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
class TestI : Test.TestIntfDisp_
{
@@ -26,48 +26,20 @@ public class Server
}
}
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new TestI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/networkProxy/msbuild/server/server.csproj b/csharp/test/Ice/networkProxy/msbuild/server/server.csproj
index 5335543fe54..cf11357ec61 100644
--- a/csharp/test/Ice/networkProxy/msbuild/server/server.csproj
+++ b/csharp/test/Ice/networkProxy/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/networkProxy/run.py b/csharp/test/Ice/networkProxy/run.py
deleted file mode 100755
index dcf9ffb84e6..00000000000
--- a/csharp/test/Ice/networkProxy/run.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, NetworkProxy
-
-sys.stdout.write("starting SOCKS proxy... ")
-sys.stdout.flush()
-socksProxy = NetworkProxy.SocksProxy(12030)
-print("ok")
-
-TestUtil.clientServerTest(additionalClientOptions="--Ice.SOCKSProxyHost=localhost --Ice.SOCKSProxyPort=12030")
-
-sys.stdout.write("terminating SOCKS proxy... ")
-sys.stdout.flush()
-socksProxy.terminate()
-print("ok")
-
-sys.stdout.write("starting HTTP proxy... ")
-sys.stdout.flush()
-httpProxy = NetworkProxy.HttpProxy(12031)
-print("ok")
-
-TestUtil.clientServerTest(additionalClientOptions="--Ice.HTTPProxyHost=localhost --Ice.HTTPProxyPort=12031")
-
-sys.stdout.write("terminating HTTP proxy... ")
-sys.stdout.flush()
-httpProxy.terminate()
-print("ok")
diff --git a/csharp/test/Ice/objects/AllTests.cs b/csharp/test/Ice/objects/AllTests.cs
index 2914e1310ee..2b22c6179cc 100644
--- a/csharp/test/Ice/objects/AllTests.cs
+++ b/csharp/test/Ice/objects/AllTests.cs
@@ -11,7 +11,7 @@ using System;
using System.Diagnostics;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
public static Ice.Value MyValueFactory(string type)
{
@@ -77,8 +77,9 @@ public class AllTests : TestCommon.TestApp
private bool _destroyed;
}
- public static InitialPrx allTests(Ice.Communicator communicator)
+ public static InitialPrx allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
communicator.getValueFactoryManager().add(MyValueFactory, "::Test::B");
communicator.getValueFactoryManager().add(MyValueFactory, "::Test::C");
communicator.getValueFactoryManager().add(MyValueFactory, "::Test::D");
@@ -96,7 +97,7 @@ public class AllTests : TestCommon.TestApp
Write("testing stringToProxy... ");
Flush();
- String @ref = "initial:default -p 12010";
+ String @ref = "initial:" + app.getTestEndpoint(0);
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
WriteLine("ok");
@@ -296,7 +297,7 @@ public class AllTests : TestCommon.TestApp
Write("testing UnexpectedObjectException...");
Flush();
- @ref = "uoet:default -p 12010";
+ @ref = "uoet:" + app.getTestEndpoint(0);
@base = communicator.stringToProxy(@ref);
test(@base != null);
UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(@base);
diff --git a/csharp/test/Ice/objects/Client.cs b/csharp/test/Ice/objects/Client.cs
index 805670012c6..3ffaca65c44 100644
--- a/csharp/test/Ice/objects/Client.cs
+++ b/csharp/test/Ice/objects/Client.cs
@@ -17,45 +17,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- InitialPrx initial = AllTests.allTests(communicator);
+ InitialPrx initial = AllTests.allTests(this);
initial.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/objects/Collocated.cs b/csharp/test/Ice/objects/Collocated.cs
index 69a6a90aaf5..ffd7dacee36 100644
--- a/csharp/test/Ice/objects/Collocated.cs
+++ b/csharp/test/Ice/objects/Collocated.cs
@@ -17,17 +17,17 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Collocated : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
var initial = new InitialI(adapter);
adapter.add(initial, Ice.Util.stringToIdentity("initial"));
UnexpectedObjectExceptionTestI uet = new UnexpectedObjectExceptionTestI();
adapter.add(uet, Ice.Util.stringToIdentity("uoet"));
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
// We must call shutdown even in the collocated case for cyclic dependency cleanup
initial.shutdown();
return 0;
@@ -35,34 +35,7 @@ public class Client
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- var data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/objects/Server.cs b/csharp/test/Ice/objects/Server.cs
index 1e2a501842a..b5ff2287fdb 100644
--- a/csharp/test/Ice/objects/Server.cs
+++ b/csharp/test/Ice/objects/Server.cs
@@ -17,7 +17,7 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
public static Ice.Value MyValueFactory(string type)
{
@@ -37,53 +37,26 @@ public class Server
return null;
}
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getValueFactoryManager().add(MyValueFactory, "::Test::I");
- communicator.getValueFactoryManager().add(MyValueFactory, "::Test::J");
- communicator.getValueFactoryManager().add(MyValueFactory, "::Test::H");
+ communicator().getValueFactoryManager().add(MyValueFactory, "::Test::I");
+ communicator().getValueFactoryManager().add(MyValueFactory, "::Test::J");
+ communicator().getValueFactoryManager().add(MyValueFactory, "::Test::H");
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object @object = new InitialI(adapter);
adapter.add(@object, Ice.Util.stringToIdentity("initial"));
@object = new UnexpectedObjectExceptionTestI();
adapter.add(@object, Ice.Util.stringToIdentity("uoet"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/objects/msbuild/server/server.csproj b/csharp/test/Ice/objects/msbuild/server/server.csproj
index 93415b77007..c5a3bd27735 100644
--- a/csharp/test/Ice/objects/msbuild/server/server.csproj
+++ b/csharp/test/Ice/objects/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\BI.cs">
<Link>BI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/objects/run.py b/csharp/test/Ice/objects/run.py
deleted file mode 100755
index 716a06db2c4..00000000000
--- a/csharp/test/Ice/objects/run.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
-
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
- additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat")
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/operations/AllTests.cs b/csharp/test/Ice/operations/AllTests.cs
index 4854f467da5..ea3f0b1dcdc 100644
--- a/csharp/test/Ice/operations/AllTests.cs
+++ b/csharp/test/Ice/operations/AllTests.cs
@@ -7,37 +7,38 @@
//
// **********************************************************************
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static Test.MyClassPrx allTests(Ice.Communicator communicator)
+ public static Test.MyClassPrx allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Flush();
- string rf = "test:default -p 12010";
+ string rf = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf);
Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy);
Test.MyDerivedClassPrx derivedProxy = Test.MyDerivedClassPrxHelper.checkedCast(cl);
Write("testing twoway operations... ");
Flush();
- Twoways.twoways(communicator, cl);
- Twoways.twoways(communicator, derivedProxy);
+ Twoways.twoways(app, cl);
+ Twoways.twoways(app, derivedProxy);
derivedProxy.opDerived();
WriteLine("ok");
Write("testing oneway operations... ");
Flush();
- Oneways.oneways(communicator, cl);
+ Oneways.oneways(app, cl);
WriteLine("ok");
Write("testing twoway operations with AMI... ");
Flush();
- TwowaysAMI.twowaysAMI(communicator, cl);
- TwowaysAMI.twowaysAMI(communicator, derivedProxy);
+ TwowaysAMI.twowaysAMI(app, cl);
+ TwowaysAMI.twowaysAMI(app, derivedProxy);
WriteLine("ok");
Write("testing oneway operations with AMI... ");
Flush();
- OnewaysAMI.onewaysAMI(communicator, cl);
+ OnewaysAMI.onewaysAMI(app, cl);
WriteLine("ok");
Write("testing batch oneway operations... ");
diff --git a/csharp/test/Ice/operations/Client.cs b/csharp/test/Ice/operations/Client.cs
index 8fd188fbefe..7abae9dbc81 100644
--- a/csharp/test/Ice/operations/Client.cs
+++ b/csharp/test/Ice/operations/Client.cs
@@ -16,11 +16,11 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.MyClassPrx myClass = AllTests.allTests(communicator);
+ Test.MyClassPrx myClass = AllTests.allTests(this);
Console.Out.Write("testing server shutdown... ");
Console.Out.Flush();
@@ -38,45 +38,18 @@ public class Client
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- //
- // In this test, we need at least two threads in the
- // client side thread pool for nested AMI.
- //
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
- initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
- initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
+ initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
+ initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/operations/Collocated.cs b/csharp/test/Ice/operations/Collocated.cs
index 91a9f66514e..7c458798bdf 100644
--- a/csharp/test/Ice/operations/Collocated.cs
+++ b/csharp/test/Ice/operations/Collocated.cs
@@ -16,13 +16,13 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.AdapterId", "test");
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.AdapterId", "test");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
@@ -31,53 +31,23 @@ public class Collocated
throw new Exception();
}
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
- public static int Main(String[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI.
- initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
- initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
-
- //
- // Its possible to have batch oneway requests dispatched
- // after the adapter is deactivated due to thread
- // scheduling so we supress this warning.
- //
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
+ initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
+ initData.properties.setProperty("Ice.BatchAutoFlushSize", "100");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/operations/Oneways.cs b/csharp/test/Ice/operations/Oneways.cs
index e0052738b22..f2be548ecfb 100644
--- a/csharp/test/Ice/operations/Oneways.cs
+++ b/csharp/test/Ice/operations/Oneways.cs
@@ -17,8 +17,9 @@ class Oneways
}
}
- internal static void oneways(Ice.Communicator communicator, Test.MyClassPrx p)
+ internal static void oneways(TestCommon.Application app, Test.MyClassPrx p)
{
+ Ice.Communicator communicator = app.communicator();
p = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway());
{
diff --git a/csharp/test/Ice/operations/OnewaysAMI.cs b/csharp/test/Ice/operations/OnewaysAMI.cs
index 26488c47dec..5fa7edfd3b9 100644
--- a/csharp/test/Ice/operations/OnewaysAMI.cs
+++ b/csharp/test/Ice/operations/OnewaysAMI.cs
@@ -71,8 +71,9 @@ public class OnewaysAMI
}
}
- internal static void onewaysAMI(Ice.Communicator communicator, Test.MyClassPrx proxy)
+ internal static void onewaysAMI(TestCommon.Application app, Test.MyClassPrx proxy)
{
+ Ice.Communicator communicator = app.communicator();
Test.MyClassPrx p = Test.MyClassPrxHelper.uncheckedCast(proxy.ice_oneway());
{
diff --git a/csharp/test/Ice/operations/Server.cs b/csharp/test/Ice/operations/Server.cs
index 75f43e12218..abaff20c6ac 100644
--- a/csharp/test/Ice/operations/Server.cs
+++ b/csharp/test/Ice/operations/Server.cs
@@ -16,61 +16,39 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
//
// We don't want connection warnings because of the timeout test.
//
- communicator.getProperties().setProperty("Ice.Warn.Connections", "0");
+ communicator().getProperties().setProperty("Ice.Warn.Connections", "0");
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- //
- // Its possible to have batch oneway requests dispatched
- // after the adapter is deactivated due to thread
- // scheduling so we supress this warning.
- //
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ //
+ // Its possible to have batch oneway requests dispatched
+ // after the adapter is deactivated due to thread
+ // scheduling so we supress this warning.
+ //
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/operations/Twoways.cs b/csharp/test/Ice/operations/Twoways.cs
index d2166a195e2..e4af24c21f0 100644
--- a/csharp/test/Ice/operations/Twoways.cs
+++ b/csharp/test/Ice/operations/Twoways.cs
@@ -52,8 +52,9 @@ class Twoways
private Thread _thread;
}
- internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p)
+ internal static void twoways(TestCommon.Application app, Test.MyClassPrx p)
{
+ Ice.Communicator communicator = app.communicator();
string[] literals = p.opStringLiterals();
test(Test.s0.value.Equals("\\") &&
@@ -1452,7 +1453,7 @@ class Twoways
ctx["three"] = "THREE";
Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast(
- ic.stringToProxy("test:default -p 12010"));
+ ic.stringToProxy("test:" + app.getTestEndpoint(0)));
ic.getImplicitContext().setContext(ctx);
test(Ice.CollectionComparer.Equals(ic.getImplicitContext().getContext(), ctx));
diff --git a/csharp/test/Ice/operations/TwowaysAMI.cs b/csharp/test/Ice/operations/TwowaysAMI.cs
index 0e6ed89ce5b..c93f4257a85 100644
--- a/csharp/test/Ice/operations/TwowaysAMI.cs
+++ b/csharp/test/Ice/operations/TwowaysAMI.cs
@@ -997,8 +997,10 @@ public class TwowaysAMI
private Dictionary<string, string> _d;
}
- internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p)
+ internal static void twowaysAMI(TestCommon.Application app, Test.MyClassPrx p)
{
+ Ice.Communicator communicator = app.communicator();
+
{
p.ice_pingAsync().Wait();
}
@@ -3249,7 +3251,7 @@ public class TwowaysAMI
ctx["three"] = "THREE";
Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast(
- ic.stringToProxy("test:default -p 12010"));
+ ic.stringToProxy("test:" + app.getTestEndpoint(0)));
ic.getImplicitContext().setContext(ctx);
test(Ice.CollectionComparer.Equals(ic.getImplicitContext().getContext(), ctx));
@@ -3319,7 +3321,7 @@ public class TwowaysAMI
ctx["three"] = "THREE";
Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast(
- ic.stringToProxy("test:default -p 12010"));
+ ic.stringToProxy("test:" + app.getTestEndpoint(0)));
ic.getImplicitContext().setContext(ctx);
test(Ice.CollectionComparer.Equals(ic.getImplicitContext().getContext(), ctx));
diff --git a/csharp/test/Ice/operations/msbuild/server/server.csproj b/csharp/test/Ice/operations/msbuild/server/server.csproj
index 6b092fb369f..c19e2b12ae2 100644
--- a/csharp/test/Ice/operations/msbuild/server/server.csproj
+++ b/csharp/test/Ice/operations/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MyDerivedClassI.cs">
<Link>MyDerivedClassI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj
index 381865ceaf4..d649f4c128e 100644
--- a/csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/operations/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MyDerivedClassAMDI.cs">
<Link>MyDerivedClassAMDI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj b/csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj
index 76964393e9f..24330bdb085 100644
--- a/csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj
+++ b/csharp/test/Ice/operations/msbuild/serveramdtie/serveramdtie.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MyDerivedClassAMDTieI.cs">
<Link>MyDerivedClassAMDTieI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/operations/msbuild/servertie/servertie.csproj b/csharp/test/Ice/operations/msbuild/servertie/servertie.csproj
index 1ab79768722..dac77f48c71 100644
--- a/csharp/test/Ice/operations/msbuild/servertie/servertie.csproj
+++ b/csharp/test/Ice/operations/msbuild/servertie/servertie.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MyDerivedClassTieI.cs">
<Link>MyDerivedClassTieI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/operations/run.py b/csharp/test/Ice/operations/run.py
deleted file mode 100755
index 5af929929e1..00000000000
--- a/csharp/test/Ice/operations/run.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(additionalClientOptions = "--Ice.Warn.AMICallback=0")
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- additionalClientOptions = "--Ice.Warn.AMICallback=0", server="serveramd")
-TestUtil.queueClientServerTest(configName = "tie", message = "Running test with tie server.",
- additionalClientOptions = "--Ice.Warn.AMICallback=0", server="servertie")
-TestUtil.queueClientServerTest(configName = "amdTie", localOnly = True, message = "Running test with AMD tie server.",
- additionalClientOptions = "--Ice.Warn.AMICallback=0", server="serveramdtie")
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/optional/AllTests.cs b/csharp/test/Ice/optional/AllTests.cs
index ff2ea227be7..22bd54fbf3d 100644
--- a/csharp/test/Ice/optional/AllTests.cs
+++ b/csharp/test/Ice/optional/AllTests.cs
@@ -10,16 +10,17 @@
using System;
using System.Collections.Generic;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static Test.InitialPrx allTests(Ice.Communicator communicator)
+ public static Test.InitialPrx allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
FactoryI factory = new FactoryI();
communicator.getValueFactoryManager().add(factory.create, "");
Write("testing stringToProxy... ");
Flush();
- string @ref = "initial:default -p 12010";
+ string @ref = "initial:" + app.getTestEndpoint(0);
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
WriteLine("ok");
diff --git a/csharp/test/Ice/optional/Client.cs b/csharp/test/Ice/optional/Client.cs
index dbf94133fb2..48b224dca50 100644
--- a/csharp/test/Ice/optional/Client.cs
+++ b/csharp/test/Ice/optional/Client.cs
@@ -16,11 +16,11 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.InitialPrx initial = AllTests.allTests(communicator);
+ Test.InitialPrx initial = AllTests.allTests(this);
initial.shutdown();
@@ -29,34 +29,7 @@ public class Client
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(System.Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/optional/Server.cs b/csharp/test/Ice/optional/Server.cs
index dee39c8c23c..e02c941371a 100644
--- a/csharp/test/Ice/optional/Server.cs
+++ b/csharp/test/Ice/optional/Server.cs
@@ -17,49 +17,22 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/optional/ServerAMD.cs b/csharp/test/Ice/optional/ServerAMD.cs
index 814404845b2..875347098cd 100644
--- a/csharp/test/Ice/optional/ServerAMD.cs
+++ b/csharp/test/Ice/optional/ServerAMD.cs
@@ -16,49 +16,22 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/optional/msbuild/server/server.csproj b/csharp/test/Ice/optional/msbuild/server/server.csproj
index 43b1ba2126b..8d83443b7b0 100644
--- a/csharp/test/Ice/optional/msbuild/server/server.csproj
+++ b/csharp/test/Ice/optional/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj
index aed61469c31..610f50e5107 100644
--- a/csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/optional/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\ServerAMD.cs">
<Link>ServerAMD.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/optional/run.py b/csharp/test/Ice/optional/run.py
deleted file mode 100755
index bf6714640bd..00000000000
--- a/csharp/test/Ice/optional/run.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
- additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat")
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server="serveramd")
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/plugin/run.py b/csharp/test/Ice/plugin/run.py
deleted file mode 100755
index 89c01e6ae16..00000000000
--- a/csharp/test/Ice/plugin/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-sys.stdout.write("starting client...")
-clientProc = TestUtil.startClient(client, " --Ice.Warn.Dispatch=0 2>&1", startReader = False)
-print("ok")
-clientProc.startReader()
-clientProc.waitTestSuccess()
-
diff --git a/csharp/test/Ice/properties/Client.cs b/csharp/test/Ice/properties/Client.cs
index 1ec20a77e75..1ef773e55d6 100644
--- a/csharp/test/Ice/properties/Client.cs
+++ b/csharp/test/Ice/properties/Client.cs
@@ -66,7 +66,7 @@ public class Client
Console.Error.WriteLine(ex);
status = 1;
}
-
+
//
// Try to load multiple config files.
//
@@ -116,10 +116,10 @@ public class Client
"AServer", "\\\\server\\dir",
"BServer", "\\server\\dir",
""};
-
+
for(int i = 0; props[i].Length > 0; i += 2)
{
- test(properties.getProperty(props[i]).Equals(props[i + 1]));
+ test(properties.getProperty(props[i]).Equals(props[i + 1]));
}
Console.Out.WriteLine("ok");
}
diff --git a/csharp/test/Ice/properties/run.py b/csharp/test/Ice/properties/run.py
deleted file mode 100755
index 70e96e63e13..00000000000
--- a/csharp/test/Ice/properties/run.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-#
-# Write config
-#
-if sys.version_info[0] == 2:
- configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config"
- decodedPath = configPath.decode("utf-8")
-else:
- configPath = "./config/\u4e2d\u56fd_client.config"
- decodedPath = configPath # No need to decode with Python3, strings are already Unicode
-
-TestUtil.createFile(decodedPath,
- ["# Automatically generated by Ice test driver.",
- "Ice.Trace.Protocol=1",
- "Ice.Trace.Network=1",
- "Ice.ProgramName=PropertiesClient",
- "Config.Path=" + configPath],
- "utf-8")
-
-TestUtil.simpleTest()
-
-if os.path.exists(decodedPath):
- os.remove(decodedPath)
diff --git a/csharp/test/Ice/proxy/AllTests.cs b/csharp/test/Ice/proxy/AllTests.cs
index 85072f7f9bb..f83712fb994 100644
--- a/csharp/test/Ice/proxy/AllTests.cs
+++ b/csharp/test/Ice/proxy/AllTests.cs
@@ -10,13 +10,14 @@
using System;
using System.Collections.Generic;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static Test.MyClassPrx allTests(Ice.Communicator communicator)
+ public static Test.MyClassPrx allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
- string rf = "test:default -p 12010";
+ string rf = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf);
test(baseProxy != null);
@@ -337,7 +338,7 @@ public class AllTests : TestCommon.TestApp
Flush();
Ice.Properties prop = communicator.getProperties();
String propertyPrefix = "Foo.Proxy";
- prop.setProperty(propertyPrefix, "test:default -p 12010");
+ prop.setProperty(propertyPrefix, "test:" + app.getTestEndpoint(0));
b1 = communicator.propertyToProxy(propertyPrefix);
test(b1.ice_getIdentity().name.Equals("test") && b1.ice_getIdentity().category.Length == 0 &&
b1.ice_getAdapterId().Length == 0 && b1.ice_getFacet().Length == 0);
@@ -387,7 +388,7 @@ public class AllTests : TestCommon.TestApp
//test(b1.ice_getLocatorCacheTimeout() == 60);
//prop.setProperty("Ice.Default.LocatorCacheTimeout", "");
- prop.setProperty(propertyPrefix, "test:default -p 12010");
+ prop.setProperty(propertyPrefix, "test:" + app.getTestEndpoint(0));
property = propertyPrefix + ".Router";
test(b1.ice_getRouter() == null);
@@ -748,7 +749,7 @@ public class AllTests : TestCommon.TestApp
Write("testing encoding versioning... ");
Flush();
- string ref20 = "test -e 2.0:default -p 12010";
+ string ref20 = "test -e 2.0:" + app.getTestEndpoint(0);
Test.MyClassPrx cl20 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20));
try
{
@@ -760,7 +761,7 @@ public class AllTests : TestCommon.TestApp
// Server 2.0 endpoint doesn't support 1.1 version.
}
- string ref10 = "test -e 1.0:default -p 12010";
+ string ref10 = "test -e 1.0:" + app.getTestEndpoint(0);
Test.MyClassPrx cl10 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10));
cl10.ice_ping();
cl10.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
@@ -768,7 +769,7 @@ public class AllTests : TestCommon.TestApp
// 1.3 isn't supported but since a 1.3 proxy supports 1.1, the
// call will use the 1.1 encoding
- string ref13 = "test -e 1.3:default -p 12010";
+ string ref13 = "test -e 1.3:" + app.getTestEndpoint(0);
Test.MyClassPrx cl13 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13));
cl13.ice_ping();
cl13.end_ice_ping(cl13.begin_ice_ping());
@@ -819,7 +820,7 @@ public class AllTests : TestCommon.TestApp
Write("testing protocol versioning... ");
Flush();
- ref20 = "test -p 2.0:default -p 12010";
+ ref20 = "test -p 2.0:" + app.getTestEndpoint(0);
cl20 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20));
try
{
@@ -831,13 +832,13 @@ public class AllTests : TestCommon.TestApp
// Server 2.0 proxy doesn't support 1.0 version.
}
- ref10 = "test -p 1.0:default -p 12010";
+ ref10 = "test -p 1.0:" + app.getTestEndpoint(0);
cl10 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10));
cl10.ice_ping();
// 1.3 isn't supported but since a 1.3 proxy supports 1.1, the
// call will use the 1.1 protocol
- ref13 = "test -p 1.3:default -p 12010";
+ ref13 = "test -p 1.3:" + app.getTestEndpoint(0);
cl13 = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13));
cl13.ice_ping();
cl13.end_ice_ping(cl13.begin_ice_ping());
@@ -970,10 +971,6 @@ public class AllTests : TestCommon.TestApp
// Working?
bool ssl = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("ssl");
bool tcp = communicator.getProperties().getProperty("Ice.Default.Protocol").Equals("tcp");
- if(tcp)
- {
- p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping();
- }
// Two legal TCP endpoints expressed as opaque endpoints
p1 = communicator.stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==");
diff --git a/csharp/test/Ice/proxy/Client.cs b/csharp/test/Ice/proxy/Client.cs
index 187f95e9c4f..5b0dd91cb2f 100644
--- a/csharp/test/Ice/proxy/Client.cs
+++ b/csharp/test/Ice/proxy/Client.cs
@@ -16,47 +16,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.MyClassPrx myClass = AllTests.allTests(communicator);
+ Test.MyClassPrx myClass = AllTests.allTests(this);
myClass.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/proxy/Collocated.cs b/csharp/test/Ice/proxy/Collocated.cs
index b13cb01b8ba..eb811643b80 100644
--- a/csharp/test/Ice/proxy/Collocated.cs
+++ b/csharp/test/Ice/proxy/Collocated.cs
@@ -16,55 +16,32 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
return 0;
}
- public static int Main(String[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI.
- initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI.
+ initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
- return status;
+ public static int Main(String[] args)
+ {
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/proxy/Server.cs b/csharp/test/Ice/proxy/Server.cs
index 4c30820cbb7..c79dc95d9ac 100644
--- a/csharp/test/Ice/proxy/Server.cs
+++ b/csharp/test/Ice/proxy/Server.cs
@@ -16,56 +16,28 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
//
// We don't want connection warnings because of the timeout test.
//
- communicator.getProperties().setProperty("Ice.Warn.Connections", "0");
- communicator.getProperties().setProperty("Ice.Warn.Dispatch", "0");
+ communicator().getProperties().setProperty("Ice.Warn.Connections", "0");
+ communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0");
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/proxy/msbuild/server/server.csproj b/csharp/test/Ice/proxy/msbuild/server/server.csproj
index a95bb319d8f..9118d44b2a4 100644
--- a/csharp/test/Ice/proxy/msbuild/server/server.csproj
+++ b/csharp/test/Ice/proxy/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MyDerivedClassI.cs">
<Link>MyDerivedClassI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj
index ffaddc4eae9..d50dbdc92a2 100644
--- a/csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/proxy/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\MyDerivedClassAMDI.cs">
<Link>MyDerivedClassAMDI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/proxy/run.py b/csharp/test/Ice/proxy/run.py
deleted file mode 100755
index 88a9c6c01bc..00000000000
--- a/csharp/test/Ice/proxy/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server="serveramd")
-TestUtil.queueCollocatedTest(additionalOptions = "--Ice.ToStringMode=Compat")
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/retry/AllTests.cs b/csharp/test/Ice/retry/AllTests.cs
index bc356c6c843..53be072cbf6 100644
--- a/csharp/test/Ice/retry/AllTests.cs
+++ b/csharp/test/Ice/retry/AllTests.cs
@@ -11,7 +11,7 @@ using System;
using System.Diagnostics;
using System.Threading;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Callback
{
@@ -47,8 +47,9 @@ public class AllTests : TestCommon.TestApp
}
static public Test.RetryPrx
- allTests(Ice.Communicator communicator, Ice.Communicator communicator2, string rf)
+ allTests(TestCommon.Application app, Ice.Communicator communicator2, string rf)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
Ice.ObjectPrx base1 = communicator.stringToProxy(rf);
diff --git a/csharp/test/Ice/retry/Client.cs b/csharp/test/Ice/retry/Client.cs
index db792e0c336..1fc01d4a5b1 100644
--- a/csharp/test/Ice/retry/Client.cs
+++ b/csharp/test/Ice/retry/Client.cs
@@ -16,81 +16,51 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator, Ice.Communicator communicator2)
+ public override int run(string[] args)
{
- Test.RetryPrx retry = AllTests.allTests(communicator, communicator2, "retry:default -p 12010");
- retry.shutdown();
- return 0;
- }
-
- public static int Main(string[] args)
- {
- int status = 0;
- Ice.Communicator communicator = null;
- Ice.Communicator communicator2 = null;
+ //
+ // Configure a second communicator for the invocation timeout
+ // + retry test, we need to configure a large retry interval
+ // to avoid time-sensitive failures.
+ //
+ Ice.InitializationData initData2 = new Ice.InitializationData();
+ initData2.properties = communicator().getProperties().ice_clone_();
+ initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000");
+ initData2.observer = Instrumentation.getObserver();
+ Ice.Communicator communicator2 = Ice.Util.initialize(initData2);
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.observer = Instrumentation.getObserver();
-
- initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1");
-
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties.setProperty("Ice.Warn.Connections", "0");
-
- communicator = Ice.Util.initialize(ref args, initData);
-
- //
- // Configure a second communicator for the invocation timeout
- // + retry test, we need to configure a large retry interval
- // to avoid time-sensitive failures.
- //
- Ice.InitializationData initData2 = new Ice.InitializationData();
- initData2.properties = initData.properties.ice_clone_();
- initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000");
- initData2.observer = Instrumentation.getObserver();
- communicator2 = Ice.Util.initialize(initData2);
-
- status = run(args, communicator, communicator2);
+ Test.RetryPrx retry = AllTests.allTests(this, communicator2, "retry:" + getTestEndpoint(0));
+ retry.shutdown();
+ return 0;
}
- catch(Exception ex)
+ finally
{
- Console.Error.WriteLine(ex);
- status = 1;
+ communicator2.destroy();
}
+ }
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ protected override Ice.InitializationData getInitData(ref string[] args)
+ {
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.observer = Instrumentation.getObserver();
- if(communicator2 != null)
- {
- try
- {
- communicator2.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1");
- return status;
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ return initData;
}
+
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
+ }
+
}
diff --git a/csharp/test/Ice/retry/Collocated.cs b/csharp/test/Ice/retry/Collocated.cs
index 2fd9b6b8e8a..1c9fd1c388f 100644
--- a/csharp/test/Ice/retry/Collocated.cs
+++ b/csharp/test/Ice/retry/Collocated.cs
@@ -16,91 +16,47 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static void setupObjectAdapter(Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("");
- adapter.add(new RetryI(), Ice.Util.stringToIdentity("retry"));
- }
-
- public static int run(string[] args, Ice.Communicator communicator, Ice.Communicator communicator2)
- {
- setupObjectAdapter(communicator);
- setupObjectAdapter(communicator2);
-
- Test.RetryPrx retry = AllTests.allTests(communicator, communicator2, "retry");
+ //
+ // Configure a second communicator for the invocation timeout
+ // + retry test, we need to configure a large retry interval
+ // to avoid time-sensitive failures.
+ //
+ Ice.InitializationData initData2 = new Ice.InitializationData();
+ initData2.properties = communicator().getProperties().ice_clone_();
+ initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000");
+ initData2.observer = Instrumentation.getObserver();
+ Ice.Communicator communicator2 = Ice.Util.initialize(initData2);
+
+ communicator().createObjectAdapter("").add(new RetryI(), Ice.Util.stringToIdentity("retry"));
+ communicator2.createObjectAdapter("").add(new RetryI(), Ice.Util.stringToIdentity("retry"));
+
+ Test.RetryPrx retry = AllTests.allTests(this, communicator2, "retry");
retry.shutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
- Ice.Communicator communicator2 = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.observer = Instrumentation.getObserver();
-
- initData.properties.setProperty("Ice.RetryIntervals", "0 1 400 1");
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.observer = Instrumentation.getObserver();
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.RetryIntervals", "0 1 10 1");
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- communicator = Ice.Util.initialize(ref args, initData);
-
- //
- // Configure a second communicator for the invocation timeout
- // + retry test, we need to configure a large retry interval
- // to avoid time-sensitive failures.
- //
- Ice.InitializationData initData2 = new Ice.InitializationData();
- initData2.properties = initData.properties.ice_clone_();
- initData2.properties.setProperty("Ice.RetryIntervals", "0 1 10000");
- initData2.observer = Instrumentation.getObserver();
- communicator2 = Ice.Util.initialize(initData2);
-
- status = run(args, communicator, communicator2);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- if(communicator2 != null)
- {
- try
- {
- communicator2.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/retry/Server.cs b/csharp/test/Ice/retry/Server.cs
index f0796f26ca9..0ac50592238 100644
--- a/csharp/test/Ice/retry/Server.cs
+++ b/csharp/test/Ice/retry/Server.cs
@@ -16,51 +16,29 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new RetryI(), Ice.Util.stringToIdentity("retry"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Warn.Dispatch", "0");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Dispatch", "0");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/retry/msbuild/server/server.csproj b/csharp/test/Ice/retry/msbuild/server/server.csproj
index 1257f83aa31..35e4488a31e 100644
--- a/csharp/test/Ice/retry/msbuild/server/server.csproj
+++ b/csharp/test/Ice/retry/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\RetryI.cs">
<Link>RetryI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/retry/run.py b/csharp/test/Ice/retry/run.py
deleted file mode 100755
index df7bc2b4ac3..00000000000
--- a/csharp/test/Ice/retry/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/seqMapping/AllTests.cs b/csharp/test/Ice/seqMapping/AllTests.cs
index cabf73185b6..4b0f29cc4b3 100644
--- a/csharp/test/Ice/seqMapping/AllTests.cs
+++ b/csharp/test/Ice/seqMapping/AllTests.cs
@@ -7,12 +7,13 @@
//
// **********************************************************************
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
- public static Test.MyClassPrx allTests(Ice.Communicator communicator, bool collocated)
+ public static Test.MyClassPrx allTests(TestCommon.Application app, bool collocated)
{
+ Ice.Communicator communicator = app.communicator();
Flush();
- string rf = "test:default -p 12010";
+ string rf = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx baseProxy = communicator.stringToProxy(rf);
Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy);
diff --git a/csharp/test/Ice/seqMapping/Client.cs b/csharp/test/Ice/seqMapping/Client.cs
index 2b99829d7eb..5227260717b 100644
--- a/csharp/test/Ice/seqMapping/Client.cs
+++ b/csharp/test/Ice/seqMapping/Client.cs
@@ -17,11 +17,11 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.MyClassPrx myClass = AllTests.allTests(communicator, false);
+ Test.MyClassPrx myClass = AllTests.allTests(this, false);
Console.Out.Write("shutting down server... ");
Console.Out.Flush();
@@ -32,33 +32,7 @@ public class Client
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/seqMapping/Collocated.cs b/csharp/test/Ice/seqMapping/Collocated.cs
index 4662e271666..32a4f730a4d 100644
--- a/csharp/test/Ice/seqMapping/Collocated.cs
+++ b/csharp/test/Ice/seqMapping/Collocated.cs
@@ -16,50 +16,23 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
//adapter.activate(); // Don't activate OA to ensure collocation is used.
- AllTests.allTests(communicator, true);
+ AllTests.allTests(this, true);
return 0;
}
- public static int Main(String[] args)
+ public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/seqMapping/Server.cs b/csharp/test/Ice/seqMapping/Server.cs
index 8e19d27c13f..edc3cba873b 100644
--- a/csharp/test/Ice/seqMapping/Server.cs
+++ b/csharp/test/Ice/seqMapping/Server.cs
@@ -16,49 +16,22 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/seqMapping/ServerAMD.cs b/csharp/test/Ice/seqMapping/ServerAMD.cs
index 8e19d27c13f..edc3cba873b 100644
--- a/csharp/test/Ice/seqMapping/ServerAMD.cs
+++ b/csharp/test/Ice/seqMapping/ServerAMD.cs
@@ -16,49 +16,22 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new MyClassI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/seqMapping/msbuild/server/server.csproj b/csharp/test/Ice/seqMapping/msbuild/server/server.csproj
index 257c5f6d658..9487a91607c 100644
--- a/csharp/test/Ice/seqMapping/msbuild/server/server.csproj
+++ b/csharp/test/Ice/seqMapping/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Custom.cs">
<Link>Custom.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj
index a7e3ce4f310..6db9184cb89 100644
--- a/csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/seqMapping/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Custom.cs">
<Link>Custom.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/seqMapping/run.py b/csharp/test/Ice/seqMapping/run.py
deleted file mode 100755
index d0771952158..00000000000
--- a/csharp/test/Ice/seqMapping/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server="serveramd")
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/serialize/AllTests.cs b/csharp/test/Ice/serialize/AllTests.cs
index bd9c24dcb3a..1274715e03e 100644
--- a/csharp/test/Ice/serialize/AllTests.cs
+++ b/csharp/test/Ice/serialize/AllTests.cs
@@ -15,7 +15,7 @@ using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
//
// There does not appear to be any way to compare collections
@@ -63,8 +63,10 @@ public class AllTests : TestCommon.TestApp
return true;
}
- static public int run(Ice.Communicator communicator)
+ static public int run(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
+
Write("testing serialization... ");
Flush();
@@ -164,7 +166,7 @@ public class AllTests : TestCommon.TestApp
private static T inOut<T>(T o, Ice.Communicator communicator)
{
- BinaryFormatter bin = new BinaryFormatter(null,
+ BinaryFormatter bin = new BinaryFormatter(null,
new StreamingContext(StreamingContextStates.All, communicator));
using (MemoryStream mem = new MemoryStream())
{
diff --git a/csharp/test/Ice/serialize/Client.cs b/csharp/test/Ice/serialize/Client.cs
index 0fb56692d3e..3aed5564fe6 100644
--- a/csharp/test/Ice/serialize/Client.cs
+++ b/csharp/test/Ice/serialize/Client.cs
@@ -16,38 +16,16 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public static int Main(string[] args)
+ public override int run(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = AllTests.run(communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ return AllTests.run(this);
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/serialize/run.py b/csharp/test/Ice/serialize/run.py
deleted file mode 100755
index 5238b99164b..00000000000
--- a/csharp/test/Ice/serialize/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-TestUtil.simpleTest(client)
diff --git a/csharp/test/Ice/servantLocator/AllTests.cs b/csharp/test/Ice/servantLocator/AllTests.cs
index add7e4d99d5..87ab72a0f1e 100644
--- a/csharp/test/Ice/servantLocator/AllTests.cs
+++ b/csharp/test/Ice/servantLocator/AllTests.cs
@@ -11,7 +11,7 @@ using System;
using Test;
using Ice;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
public static void testExceptions(TestIntfPrx obj)
{
@@ -195,15 +195,16 @@ public class AllTests : TestCommon.TestApp
}
}
- public static TestIntfPrx allTests(Ice.Communicator communicator)
+ public static TestIntfPrx allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
- string @ref = "asm:default -p 12010";
+ string @ref = "asm:" + app.getTestEndpoint(0);
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
WriteLine("ok");
-
+
Write("testing checked cast... ");
Flush();
TestIntfPrx obj = TestIntfPrxHelper.checkedCast(@base);
@@ -215,7 +216,7 @@ public class AllTests : TestCommon.TestApp
Flush();
try
{
- Ice.ObjectPrx o = communicator.stringToProxy("category/locate:default -p 12010");
+ Ice.ObjectPrx o = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0));
o.ice_ids();
test(false);
}
@@ -230,7 +231,7 @@ public class AllTests : TestCommon.TestApp
try
{
- Ice.ObjectPrx o = communicator.stringToProxy("category/finished:default -p 12010");
+ Ice.ObjectPrx o = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0));
o.ice_ids();
test(false);
}
@@ -246,11 +247,11 @@ public class AllTests : TestCommon.TestApp
Write("testing servant locator...");
Flush();
- @base = communicator.stringToProxy("category/locate:default -p 12010");
+ @base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0));
obj = TestIntfPrxHelper.checkedCast(@base);
try
{
- TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010"));
+ TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:" + app.getTestEndpoint(0)));
}
catch(ObjectNotExistException)
{
@@ -259,20 +260,20 @@ public class AllTests : TestCommon.TestApp
Write("testing default servant locator...");
Flush();
- @base = communicator.stringToProxy("anothercat/locate:default -p 12010");
+ @base = communicator.stringToProxy("anothercat/locate:" + app.getTestEndpoint(0));
obj = TestIntfPrxHelper.checkedCast(@base);
- @base = communicator.stringToProxy("locate:default -p 12010");
+ @base = communicator.stringToProxy("locate:" + app.getTestEndpoint(0));
obj = TestIntfPrxHelper.checkedCast(@base);
try
{
- TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010"));
+ TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:" + app.getTestEndpoint(0)));
}
catch(ObjectNotExistException)
{
}
try
{
- TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010"));
+ TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:" + app.getTestEndpoint(0)));
}
catch(ObjectNotExistException)
{
@@ -281,14 +282,14 @@ public class AllTests : TestCommon.TestApp
Write("testing locate exceptions... ");
Flush();
- @base = communicator.stringToProxy("category/locate:default -p 12010");
+ @base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0));
obj = TestIntfPrxHelper.checkedCast(@base);
testExceptions(obj);
WriteLine("ok");
Write("testing finished exceptions... ");
Flush();
- @base = communicator.stringToProxy("category/finished:default -p 12010");
+ @base = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0));
obj = TestIntfPrxHelper.checkedCast(@base);
testExceptions(obj);
@@ -332,7 +333,7 @@ public class AllTests : TestCommon.TestApp
Write("testing servant locator removal... ");
Flush();
- @base = communicator.stringToProxy("test/activation:default -p 12010");
+ @base = communicator.stringToProxy("test/activation:" + app.getTestEndpoint(0));
TestActivationPrx activation = TestActivationPrxHelper.checkedCast(@base);
activation.activateServantLocator(false);
try
diff --git a/csharp/test/Ice/servantLocator/Client.cs b/csharp/test/Ice/servantLocator/Client.cs
index b6de8d4f0fc..b7de5b2bb15 100644
--- a/csharp/test/Ice/servantLocator/Client.cs
+++ b/csharp/test/Ice/servantLocator/Client.cs
@@ -17,22 +17,18 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- internal class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
- {
- TestIntfPrx obj = AllTests.allTests(communicator());
- obj.shutdown();
- return 0;
- }
+ TestIntfPrx obj = AllTests.allTests(this);
+ obj.shutdown();
+ return 0;
}
public static int Main(string[] args)
{
- Ice.InitializationData data = new Ice.InitializationData();
- App app = new App();
- return app.main(args, data);
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/servantLocator/Collocated.cs b/csharp/test/Ice/servantLocator/Collocated.cs
index b3acd7dfb99..4885035d001 100644
--- a/csharp/test/Ice/servantLocator/Collocated.cs
+++ b/csharp/test/Ice/servantLocator/Collocated.cs
@@ -16,31 +16,27 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Collocated
+public class Collocated : TestCommon.Application
{
- internal class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
- {
- communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.addServantLocator(new ServantLocatorI("category"), "category");
- adapter.addServantLocator(new ServantLocatorI(""), "");
- adapter.add(new TestI(), Ice.Util.stringToIdentity("asm"));
- adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation"));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.addServantLocator(new ServantLocatorI("category"), "category");
+ adapter.addServantLocator(new ServantLocatorI(""), "");
+ adapter.add(new TestI(), Ice.Util.stringToIdentity("asm"));
+ adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation"));
- AllTests.allTests(communicator());
+ AllTests.allTests(this);
- return 0;
- }
+ return 0;
}
public static int Main(string[] args)
{
- Ice.InitializationData data = new Ice.InitializationData();
- App app = new App();
- return app.main(args, data);
+ Collocated app = new Collocated();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/servantLocator/Server.cs b/csharp/test/Ice/servantLocator/Server.cs
index 59d8df36ccd..8529bfabcdc 100644
--- a/csharp/test/Ice/servantLocator/Server.cs
+++ b/csharp/test/Ice/servantLocator/Server.cs
@@ -16,29 +16,26 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- internal class App : Ice.Application
+ public override int run(string[] args)
{
- public override int run(string[] args)
- {
- communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0");
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
- adapter.addServantLocator(new ServantLocatorI("category"), "category");
- adapter.addServantLocator(new ServantLocatorI(""), "");
- adapter.add(new TestI(), Ice.Util.stringToIdentity("asm"));
- adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation"));
- adapter.activate();
- adapter.waitForDeactivate();
- return 0;
- }
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
+ adapter.addServantLocator(new ServantLocatorI("category"), "category");
+ adapter.addServantLocator(new ServantLocatorI(""), "");
+ adapter.add(new TestI(), Ice.Util.stringToIdentity("asm"));
+ adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation"));
+ adapter.activate();
+ adapter.waitForDeactivate();
+ return 0;
}
public static int Main(string[] args)
{
- App app = new App();
- return app.main(args);
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/servantLocator/msbuild/server/server.csproj b/csharp/test/Ice/servantLocator/msbuild/server/server.csproj
index e5878336e00..e836b397563 100644
--- a/csharp/test/Ice/servantLocator/msbuild/server/server.csproj
+++ b/csharp/test/Ice/servantLocator/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\CookieI.cs">
<Link>CookieI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj
index 88c0fd99836..58b6734fecf 100644
--- a/csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/servantLocator/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\CookieI.cs">
<Link>CookieI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/servantLocator/run.py b/csharp/test/Ice/servantLocator/run.py
deleted file mode 100755
index ad593fdaf7e..00000000000
--- a/csharp/test/Ice/servantLocator/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server="serveramd")
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/slicing/exceptions/AllTests.cs b/csharp/test/Ice/slicing/exceptions/AllTests.cs
index eaa88d04e6b..bbd1ee04413 100644
--- a/csharp/test/Ice/slicing/exceptions/AllTests.cs
+++ b/csharp/test/Ice/slicing/exceptions/AllTests.cs
@@ -12,7 +12,7 @@ using System.Diagnostics;
using System.Threading;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Callback
{
@@ -90,11 +90,12 @@ public class AllTests : TestCommon.TestApp
}
}
- public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated)
+ public static TestIntfPrx allTests(TestCommon.Application app, bool collocated)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
- String @ref = "Test:default -p 12010 -t 2000";
+ String @ref = "Test:" + app.getTestEndpoint(0) + " -t 2000";
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
WriteLine("ok");
diff --git a/csharp/test/Ice/slicing/exceptions/Client.cs b/csharp/test/Ice/slicing/exceptions/Client.cs
index a89ce7c02e1..bbbedc65880 100644
--- a/csharp/test/Ice/slicing/exceptions/Client.cs
+++ b/csharp/test/Ice/slicing/exceptions/Client.cs
@@ -10,45 +10,18 @@
using Test;
using System;
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- TestIntfPrx test = AllTests.allTests(communicator, false);
+ TestIntfPrx test = AllTests.allTests(this, false);
test.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/slicing/exceptions/Server.cs b/csharp/test/Ice/slicing/exceptions/Server.cs
index 56bf9f925fb..6d6ed3e3845 100644
--- a/csharp/test/Ice/slicing/exceptions/Server.cs
+++ b/csharp/test/Ice/slicing/exceptions/Server.cs
@@ -9,51 +9,24 @@
using System;
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.Properties properties = communicator.getProperties();
+ Ice.Properties properties = communicator().getProperties();
properties.setProperty("Ice.Warn.Dispatch", "0");
- properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object @object = new TestI();
adapter.add(@object, Ice.Util.stringToIdentity("Test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/slicing/exceptions/ServerAMD.cs b/csharp/test/Ice/slicing/exceptions/ServerAMD.cs
index 56bf9f925fb..6d6ed3e3845 100644
--- a/csharp/test/Ice/slicing/exceptions/ServerAMD.cs
+++ b/csharp/test/Ice/slicing/exceptions/ServerAMD.cs
@@ -9,51 +9,24 @@
using System;
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.Properties properties = communicator.getProperties();
+ Ice.Properties properties = communicator().getProperties();
properties.setProperty("Ice.Warn.Dispatch", "0");
- properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object @object = new TestI();
adapter.add(@object, Ice.Util.stringToIdentity("Test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj b/csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj
index 324fac5a6f3..6993e7fc04d 100644
--- a/csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj
+++ b/csharp/test/Ice/slicing/exceptions/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj
index 3a457f7ec61..51a973707d4 100644
--- a/csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/slicing/exceptions/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\ServerAMD.cs">
<Link>ServerAMD.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/slicing/exceptions/run.py b/csharp/test/Ice/slicing/exceptions/run.py
deleted file mode 100755
index 47575b29694..00000000000
--- a/csharp/test/Ice/slicing/exceptions/run.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.")
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
- message = "Running test with sliced format and AMD server.", server="serveramd")
-
-TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
- message = "Running test with 1.0 encoding and AMD server.", server="serveramd",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/slicing/objects/AllTests.cs b/csharp/test/Ice/slicing/objects/AllTests.cs
index edb42e7270a..dc4bfac1b67 100644
--- a/csharp/test/Ice/slicing/objects/AllTests.cs
+++ b/csharp/test/Ice/slicing/objects/AllTests.cs
@@ -12,7 +12,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Callback
{
@@ -76,11 +76,12 @@ public class AllTests : TestCommon.TestApp
return null;
}
- public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated)
+ public static TestIntfPrx allTests(TestCommon.Application app, bool collocated)
{
+ Ice.Communicator communicator = app.communicator();
Write("testing stringToProxy... ");
Flush();
- Ice.ObjectPrx basePrx = communicator.stringToProxy("Test:default -p 12010 -t 2000");
+ Ice.ObjectPrx basePrx = communicator.stringToProxy("Test:" + app.getTestEndpoint(0) + " -t 2000");
test(basePrx != null);
WriteLine("ok");
diff --git a/csharp/test/Ice/slicing/objects/Client.cs b/csharp/test/Ice/slicing/objects/Client.cs
index a89ce7c02e1..bbbedc65880 100644
--- a/csharp/test/Ice/slicing/objects/Client.cs
+++ b/csharp/test/Ice/slicing/objects/Client.cs
@@ -10,45 +10,18 @@
using Test;
using System;
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- TestIntfPrx test = AllTests.allTests(communicator, false);
+ TestIntfPrx test = AllTests.allTests(this, false);
test.shutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/slicing/objects/Server.cs b/csharp/test/Ice/slicing/objects/Server.cs
index 89cca96fb72..f43055c1aa2 100644
--- a/csharp/test/Ice/slicing/objects/Server.cs
+++ b/csharp/test/Ice/slicing/objects/Server.cs
@@ -9,51 +9,24 @@
using System;
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.Properties properties = communicator.getProperties();
+ Ice.Properties properties = communicator().getProperties();
properties.setProperty("Ice.Warn.Dispatch", "0");
- properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object obj = new TestI();
adapter.add(obj, Ice.Util.stringToIdentity("Test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/slicing/objects/ServerAMD.cs b/csharp/test/Ice/slicing/objects/ServerAMD.cs
index 89cca96fb72..f43055c1aa2 100644
--- a/csharp/test/Ice/slicing/objects/ServerAMD.cs
+++ b/csharp/test/Ice/slicing/objects/ServerAMD.cs
@@ -9,51 +9,24 @@
using System;
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.Properties properties = communicator.getProperties();
+ Ice.Properties properties = communicator().getProperties();
properties.setProperty("Ice.Warn.Dispatch", "0");
- properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 2000");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Object obj = new TestI();
adapter.add(obj, Ice.Util.stringToIdentity("Test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/slicing/objects/msbuild/server/server.csproj b/csharp/test/Ice/slicing/objects/msbuild/server/server.csproj
index 7536fa51b6a..50b4c4450c4 100644
--- a/csharp/test/Ice/slicing/objects/msbuild/server/server.csproj
+++ b/csharp/test/Ice/slicing/objects/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj b/csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj
index 347e0ba8644..12cbda4a4d2 100644
--- a/csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj
+++ b/csharp/test/Ice/slicing/objects/msbuild/serveramd/serveramd.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\ServerAMD.cs">
<Link>ServerAMD.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/slicing/objects/run.py b/csharp/test/Ice/slicing/objects/run.py
deleted file mode 100755
index 47575b29694..00000000000
--- a/csharp/test/Ice/slicing/objects/run.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.")
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
- message = "Running test with sliced format and AMD server.", server="serveramd")
-
-TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
- message = "Running test with 1.0 encoding and AMD server.", server="serveramd",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/stream/AllTests.cs b/csharp/test/Ice/stream/AllTests.cs
index ddc16de2ae9..80198284ae0 100644
--- a/csharp/test/Ice/stream/AllTests.cs
+++ b/csharp/test/Ice/stream/AllTests.cs
@@ -12,7 +12,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using Test;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
//
// There does not appear to be any way to compare collections
@@ -130,8 +130,9 @@ public class AllTests : TestCommon.TestApp
private Ice.ValueFactory _factory;
}
- static public int run(Ice.Communicator communicator)
+ static public int allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper();
communicator.getValueFactoryManager().add(factoryWrapper.create, MyClass.ice_staticId());
diff --git a/csharp/test/Ice/stream/Client.cs b/csharp/test/Ice/stream/Client.cs
index 0fb56692d3e..0ee62467b26 100644
--- a/csharp/test/Ice/stream/Client.cs
+++ b/csharp/test/Ice/stream/Client.cs
@@ -16,38 +16,16 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public static int Main(string[] args)
+ public override int run(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData data = new Ice.InitializationData();
- communicator = Ice.Util.initialize(ref args, data);
- status = AllTests.run(communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ return AllTests.allTests(this);
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/stream/run.py b/csharp/test/Ice/stream/run.py
deleted file mode 100755
index 43a477cc2e5..00000000000
--- a/csharp/test/Ice/stream/run.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-print("Running test with default encoding...")
-TestUtil.simpleTest(client)
-
-print("Running test with 1.0 encoding...")
-TestUtil.simpleTest(client, "--Ice.Default.EncodingVersion=1.0")
diff --git a/csharp/test/Ice/threadPoolPriority/Client.cs b/csharp/test/Ice/threadPoolPriority/Client.cs
index eb4f911ac78..f2c37ad7ecb 100644
--- a/csharp/test/Ice/threadPoolPriority/Client.cs
+++ b/csharp/test/Ice/threadPoolPriority/Client.cs
@@ -16,21 +16,13 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static void test(bool b)
- {
- if(!b)
- {
- throw new Exception();
- }
- }
-
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
Console.Out.Write("testing server priority... ");
Console.Out.Flush();
- Ice.ObjectPrx obj = communicator.stringToProxy("test:default -p 12010 -t 10000");
+ Ice.ObjectPrx obj = communicator().stringToProxy("test:" + getTestEndpoint(0) + " -t 10000");
Test.PriorityPrx priority = Test.PriorityPrxHelper.checkedCast(obj);
try
@@ -50,34 +42,8 @@ public class Client
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/threadPoolPriority/Server.cs b/csharp/test/Ice/threadPoolPriority/Server.cs
index fd2118c8587..7bc22c199bd 100644
--- a/csharp/test/Ice/threadPoolPriority/Server.cs
+++ b/csharp/test/Ice/threadPoolPriority/Server.cs
@@ -16,51 +16,29 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new PriorityI(), Ice.Util.stringToIdentity("test"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "AboveNormal");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "AboveNormal");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj b/csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj
index d3c9a79e44f..2de69ff4de9 100644
--- a/csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj
+++ b/csharp/test/Ice/threadPoolPriority/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\PriorityI.cs">
<Link>PriorityI.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/threadPoolPriority/run.py b/csharp/test/Ice/threadPoolPriority/run.py
deleted file mode 100644
index bfec815018d..00000000000
--- a/csharp/test/Ice/threadPoolPriority/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/timeout/AllTests.cs b/csharp/test/Ice/timeout/AllTests.cs
index 58f0ee07aa5..d82a600b4e9 100644
--- a/csharp/test/Ice/timeout/AllTests.cs
+++ b/csharp/test/Ice/timeout/AllTests.cs
@@ -10,7 +10,7 @@
using System.Diagnostics;
using System.Threading;
-public class AllTests : TestCommon.TestApp
+public class AllTests : TestCommon.AllTests
{
private class Callback
{
@@ -45,9 +45,10 @@ public class AllTests : TestCommon.TestApp
private bool _called;
}
- public static Test.TimeoutPrx allTests(Ice.Communicator communicator)
+ public static Test.TimeoutPrx allTests(TestCommon.Application app)
{
- string sref = "timeout:default -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string sref = "timeout:" + app.getTestEndpoint(0);
Ice.ObjectPrx obj = communicator.stringToProxy(sref);
test(obj != null);
diff --git a/csharp/test/Ice/timeout/Client.cs b/csharp/test/Ice/timeout/Client.cs
index 4a2d31b5607..6a61ab30a10 100644
--- a/csharp/test/Ice/timeout/Client.cs
+++ b/csharp/test/Ice/timeout/Client.cs
@@ -16,69 +16,45 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Test.TimeoutPrx timeout = AllTests.allTests(communicator);
+ Test.TimeoutPrx timeout = AllTests.allTests(this);
timeout.shutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
-
- //
- // We need to send messages large enough to cause the transport
- // buffers to fill up.
- //
- initData.properties.setProperty("Ice.MessageSizeMax", "20000");
-
- //
- // For this test, we want to disable retries.
- //
- initData.properties.setProperty("Ice.RetryIntervals", "-1");
-
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties.setProperty("Ice.Warn.Connections", "0");
-
- //
- // Limit the send buffer size, this test relies on the socket
- // send() blocking after sending a given amount of data.
- //
- initData.properties.setProperty("Ice.TCP.SndSize", "50000");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ //
+ // We need to send messages large enough to cause the transport
+ // buffers to fill up.
+ //
+ initData.properties.setProperty("Ice.MessageSizeMax", "20000");
+
+ //
+ // For this test, we want to disable retries.
+ //
+ initData.properties.setProperty("Ice.RetryIntervals", "-1");
+
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+
+ //
+ // Limit the send buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.SndSize", "50000");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/timeout/Server.cs b/csharp/test/Ice/timeout/Server.cs
index 1acfd29bd16..a9ecbe38a9d 100644
--- a/csharp/test/Ice/timeout/Server.cs
+++ b/csharp/test/Ice/timeout/Server.cs
@@ -16,62 +16,38 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- public static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
adapter.add(new TimeoutI(), Ice.Util.stringToIdentity("timeout"));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
-
- //
- // This test kills connections, so we don't want warnings.
- //
- initData.properties.setProperty("Ice.Warn.Connections", "0");
-
- //
- // Limit the recv buffer size, this test relies on the socket
- // send() blocking after sending a given amount of data.
- //
- initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+
+ //
+ // Limit the recv buffer size, this test relies on the socket
+ // send() blocking after sending a given amount of data.
+ //
+ initData.properties.setProperty("Ice.TCP.RcvSize", "50000");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/timeout/msbuild/server/server.csproj b/csharp/test/Ice/timeout/msbuild/server/server.csproj
index c085f48929c..1f89df20e40 100644
--- a/csharp/test/Ice/timeout/msbuild/server/server.csproj
+++ b/csharp/test/Ice/timeout/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/timeout/run.py b/csharp/test/Ice/timeout/run.py
deleted file mode 100755
index bfec815018d..00000000000
--- a/csharp/test/Ice/timeout/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/csharp/test/Ice/udp/AllTests.cs b/csharp/test/Ice/udp/AllTests.cs
index c4cf0b1af7a..266acfc3266 100644
--- a/csharp/test/Ice/udp/AllTests.cs
+++ b/csharp/test/Ice/udp/AllTests.cs
@@ -64,9 +64,10 @@ public class AllTests
private int _replies = 0;
}
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
- communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030");
+ Ice.Communicator communicator = app.communicator();
+ communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter");
PingReplyI replyI = new PingReplyI();
Test.PingReplyPrx reply =
@@ -75,7 +76,7 @@ public class AllTests
Console.Out.Write("testing udp... ");
Console.Out.Flush();
- Ice.ObjectPrx @base = communicator.stringToProxy("test:udp -p 12010").ice_datagram();
+ Ice.ObjectPrx @base = communicator.stringToProxy("test:" + app.getTestEndpoint(0, "udp")).ice_datagram();
Test.TestIntfPrx obj = Test.TestIntfPrxHelper.uncheckedCast(@base);
int nRetry = 5;
@@ -122,7 +123,7 @@ public class AllTests
//
// The server's Ice.UDP.RcvSize property is set to 16384, which means that DatagramLimitException
// will be throw when try to send a packet bigger than that. However, Mono 2.10 bug in setting Socket
- // options could cause the RcvSize/SndSize to contain an arbitrary value so the test might fail
+ // options could cause the RcvSize/SndSize to contain an arbitrary value so the test might fail
// with smaller message sizes.
//
test(seq.Length > 16384 || IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono);
@@ -138,8 +139,8 @@ public class AllTests
bool b = replyI.waitReply(1, 500);
//
// The server's Ice.UDP.RcvSize property is set to 16384, which means this packet
- // should not be delivered. However, Mono 2.10 bug in setting Socket options could
- // cause the RcvSize/SndSize to contain an arbitrary value so the packet might
+ // should not be delivered. However, Mono 2.10 bug in setting Socket options could
+ // cause the RcvSize/SndSize to contain an arbitrary value so the packet might
// be delivered successfully.
//
test(!b || IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono);
@@ -148,7 +149,7 @@ public class AllTests
{
//
// Mono 2.10 bug in setting Socket options could cause the RcvSize/SndSize to contain
- // an arbitrary value so the message send might fail if the effetive SndSize is minor
+ // an arbitrary value so the message send might fail if the effetive SndSize is minor
// than expected.
//
test(IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono);
diff --git a/csharp/test/Ice/udp/Client.cs b/csharp/test/Ice/udp/Client.cs
index 00f7b56c55e..b8fecf113cf 100644
--- a/csharp/test/Ice/udp/Client.cs
+++ b/csharp/test/Ice/udp/Client.cs
@@ -17,11 +17,11 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
int num;
try
@@ -34,46 +34,23 @@ public class Client
}
for(int i = 0; i < num; ++i)
{
- TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("control:tcp -p " + (12010 + i))).shutdown();
+ string endpoint = getTestEndpoint(i, "tcp");
+ TestIntfPrxHelper.uncheckedCast(communicator().stringToProxy("control:" + endpoint)).shutdown();
}
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
-
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.UDP.SndSize", "16384");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.UDP.SndSize", "16384");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/udp/Server.cs b/csharp/test/Ice/udp/Server.cs
index e43620fcaee..54537ecb19b 100644
--- a/csharp/test/Ice/udp/Server.cs
+++ b/csharp/test/Ice/udp/Server.cs
@@ -16,29 +16,29 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.Properties properties = communicator.getProperties();
+ Ice.Properties properties = communicator().getProperties();
- int port = 12010;
+ int num = 0;
try
{
- port += args.Length == 1 ? Int32.Parse(args[0]) : 0;
+ num = args.Length == 1 ? Int32.Parse(args[0]) : 0;
}
catch(FormatException)
{
}
- properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port);
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ControlAdapter");
+ properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num, "tcp"));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control"));
adapter.activate();
- if(port == 12010)
+ if(num == 0)
{
- properties.setProperty("TestAdapter.Endpoints", "udp -p 12010");
- Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter");
+ properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(num, "udp"));
+ Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter");
adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
adapter2.activate();
}
@@ -60,49 +60,25 @@ public class Server
endpoint = "udp -h 239.255.1.1 -p 12020";
}
properties.setProperty("McastTestAdapter.Endpoints", endpoint);
- Ice.ObjectAdapter mcastAdapter = communicator.createObjectAdapter("McastTestAdapter");
+ Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter");
mcastAdapter.add(new TestIntfI(), Ice.Util.stringToIdentity("test"));
mcastAdapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
-
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
-
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/Ice/udp/msbuild/server/server.csproj b/csharp/test/Ice/udp/msbuild/server/server.csproj
index 53a78d76bee..4bfc1113fa9 100644
--- a/csharp/test/Ice/udp/msbuild/server/server.csproj
+++ b/csharp/test/Ice/udp/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/Ice/udp/run.py b/csharp/test/Ice/udp/run.py
deleted file mode 100755
index e4d29398a74..00000000000
--- a/csharp/test/Ice/udp/run.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-server = os.path.join(os.getcwd(), "server")
-client = os.path.join(os.getcwd(), "client")
-
-num = 5
-
-serverProc = []
-for i in range(0, num):
- sys.stdout.write("starting server #%d... " % (i + 1))
- sys.stdout.flush()
- serverProc.append(TestUtil.startServer(server, "%d" % i, adapter="McastTestAdapter"))
- print("ok")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, "%d" % num, startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
-for p in serverProc:
- p.waitTestSuccess()
diff --git a/csharp/test/IceBox/admin/AllTests.cs b/csharp/test/IceBox/admin/AllTests.cs
index fc0938892ae..1c870fd203f 100644
--- a/csharp/test/IceBox/admin/AllTests.cs
+++ b/csharp/test/IceBox/admin/AllTests.cs
@@ -23,8 +23,9 @@ public class AllTests
}
}
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
string @ref = "DemoIceBox/admin:default -p 9996 -t 10000";
Ice.ObjectPrx admin = communicator.stringToProxy(@ref);
@@ -98,7 +99,7 @@ public class AllTests
Console.Out.Write("testing metrics admin facet... ");
Console.Out.Flush();
{
- IceMX.MetricsAdminPrx ma =
+ IceMX.MetricsAdminPrx ma =
IceMX.MetricsAdminPrxHelper.checkedCast(admin, "IceBox.Service.TestService.Metrics");
Ice.PropertiesAdminPrx pa =
@@ -118,9 +119,9 @@ public class AllTests
views = ma.getMetricsViewNames(out disabledViews);
test(views.Length == 3);
-
+
// Make sure that the IceBox communicator metrics admin is a separate instance.
- test(IceMX.MetricsAdminPrxHelper.checkedCast(admin,
+ test(IceMX.MetricsAdminPrxHelper.checkedCast(admin,
"Metrics").getMetricsViewNames(out disabledViews).Length == 0);
}
Console.Out.WriteLine("ok");
diff --git a/csharp/test/IceBox/admin/Client.cs b/csharp/test/IceBox/admin/Client.cs
index 1d0a221becb..12b1c953f63 100644
--- a/csharp/test/IceBox/admin/Client.cs
+++ b/csharp/test/IceBox/admin/Client.cs
@@ -17,54 +17,31 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
//
// Shutdown the IceBox server.
//
Ice.ProcessPrxHelper.uncheckedCast(
- communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown();
+ communicator().stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
- Debug.Listeners.Add(new ConsoleTraceListener());
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/IceBox/admin/config.admin b/csharp/test/IceBox/admin/config.admin
new file mode 100644
index 00000000000..1baad8bea86
--- /dev/null
+++ b/csharp/test/IceBox/admin/config.admin
@@ -0,0 +1,4 @@
+#
+# Proxy to the IceBox ServiceManager:
+#
+IceBoxAdmin.ServiceManager.Proxy=DemoIceBox/admin -f IceBox.ServiceManager:default -p 9996
diff --git a/csharp/test/IceBox/admin/msbuild/client/client.csproj b/csharp/test/IceBox/admin/msbuild/client/client.csproj
index 206bea0d598..f407c8b22cb 100644
--- a/csharp/test/IceBox/admin/msbuild/client/client.csproj
+++ b/csharp/test/IceBox/admin/msbuild/client/client.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\AllTests.cs">
<Link>AllTests.cs</Link>
</Compile>
diff --git a/csharp/test/IceBox/admin/run.py b/csharp/test/IceBox/admin/run.py
deleted file mode 100755
index a92ce6141c2..00000000000
--- a/csharp/test/IceBox/admin/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"),
- server=TestUtil.getIceBox())
diff --git a/csharp/test/IceBox/configuration/AllTests.cs b/csharp/test/IceBox/configuration/AllTests.cs
index d8345ced05b..5d791a960ad 100644
--- a/csharp/test/IceBox/configuration/AllTests.cs
+++ b/csharp/test/IceBox/configuration/AllTests.cs
@@ -10,23 +10,19 @@
using System;
using Test;
-public class AllTests
+public class AllTests : TestCommon.AllTests
{
- private static void
- test(bool b)
+ public static void allTests(TestCommon.Application app)
{
- if(!b)
- {
- throw new Exception();
- }
- }
-
- public static void allTests(Ice.Communicator communicator)
- {
- TestIntfPrx service1 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010"));
- TestIntfPrx service2 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011"));
- TestIntfPrx service3 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12012"));
- TestIntfPrx service4 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12013"));
+ Ice.Communicator communicator = app.communicator();
+ TestIntfPrx service1 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" +
+ app.getTestEndpoint(0)));
+ TestIntfPrx service2 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" +
+ app.getTestEndpoint(1)));
+ TestIntfPrx service3 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" +
+ app.getTestEndpoint(2)));
+ TestIntfPrx service4 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:" +
+ app.getTestEndpoint(3)));
if(service1.getProperty("IceBox.InheritProperties").Equals(""))
{
diff --git a/csharp/test/IceBox/configuration/Client.cs b/csharp/test/IceBox/configuration/Client.cs
index f66be79fed2..46d84a403b2 100644
--- a/csharp/test/IceBox/configuration/Client.cs
+++ b/csharp/test/IceBox/configuration/Client.cs
@@ -16,52 +16,30 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
//
// Shutdown the IceBox server.
//
Ice.ProcessPrxHelper.uncheckedCast(
- communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown();
+ communicator().stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown();
return 0;
}
- public static int Main(string[] args)
+ protected override Ice.InitializationData getInitData(ref string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(ref args);
- initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
- communicator = Ice.Util.initialize(ref args, initData);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch (Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
+ Ice.InitializationData initData = base.getInitData(ref args);
+ initData.properties.setProperty("Ice.Default.Host", "127.0.0.1");
+ return initData;
+ }
- return status;
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/IceBox/configuration/config.service1 b/csharp/test/IceBox/configuration/config.service1
index 6028e615ff5..3e38245a5d0 100644
--- a/csharp/test/IceBox/configuration/config.service1
+++ b/csharp/test/IceBox/configuration/config.service1
@@ -1,4 +1,4 @@
-Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1
+Service1OA.Endpoints=default -p 12010 -h 127.0.0.1
#Ice.ProgramName
Service=1
diff --git a/csharp/test/IceBox/configuration/config.service1-2 b/csharp/test/IceBox/configuration/config.service1-2
index c173914db2a..835acbadfc9 100644
--- a/csharp/test/IceBox/configuration/config.service1-2
+++ b/csharp/test/IceBox/configuration/config.service1-2
@@ -1,4 +1,4 @@
-Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1
+Service1OA.Endpoints=default -p 12010 -h 127.0.0.1
#Ice.ProgramName
Service1.Prop=1
diff --git a/csharp/test/IceBox/configuration/config.service2 b/csharp/test/IceBox/configuration/config.service2
index 78e08aadba6..95d33831a14 100644
--- a/csharp/test/IceBox/configuration/config.service2
+++ b/csharp/test/IceBox/configuration/config.service2
@@ -1,4 +1,4 @@
-Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1
+Service2OA.Endpoints=default -p 12011 -h 127.0.0.1
Ice.ProgramName=Test
Service=2
diff --git a/csharp/test/IceBox/configuration/config.service2-2 b/csharp/test/IceBox/configuration/config.service2-2
index 36c8d0812cb..6ed8dc9df49 100644
--- a/csharp/test/IceBox/configuration/config.service2-2
+++ b/csharp/test/IceBox/configuration/config.service2-2
@@ -1,4 +1,4 @@
-Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1
+Service2OA.Endpoints=default -p 12011 -h 127.0.0.1
#Ice.ProgramName
Service2.Prop=1
diff --git a/csharp/test/IceBox/configuration/config.service3 b/csharp/test/IceBox/configuration/config.service3
index c93ed144701..6cba4b351b0 100644
--- a/csharp/test/IceBox/configuration/config.service3
+++ b/csharp/test/IceBox/configuration/config.service3
@@ -1,4 +1,4 @@
-Service3OA.Endpoints=tcp -p 12012 -h 127.0.0.1
+Service3OA.Endpoints=default -p 12012 -h 127.0.0.1
#Ice.ProgramName
Service=3
diff --git a/csharp/test/IceBox/configuration/config.service4 b/csharp/test/IceBox/configuration/config.service4
index 182fb3a7289..a70120dd192 100644
--- a/csharp/test/IceBox/configuration/config.service4
+++ b/csharp/test/IceBox/configuration/config.service4
@@ -1,4 +1,4 @@
-Service4OA.Endpoints=tcp -p 12013 -h 127.0.0.1
+Service4OA.Endpoints=default -p 12013 -h 127.0.0.1
#Ice.ProgramName
Service=4
diff --git a/csharp/test/IceBox/configuration/msbuild/client/client.csproj b/csharp/test/IceBox/configuration/msbuild/client/client.csproj
index 821ab47f501..77e552819ee 100644
--- a/csharp/test/IceBox/configuration/msbuild/client/client.csproj
+++ b/csharp/test/IceBox/configuration/msbuild/client/client.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\AllTests.cs">
<Link>AllTests.cs</Link>
</Compile>
diff --git a/csharp/test/IceBox/configuration/run.py b/csharp/test/IceBox/configuration/run.py
deleted file mode 100755
index 470c36fd810..00000000000
--- a/csharp/test/IceBox/configuration/run.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-icebox = TestUtil.getIceBox()
-
-TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"),
- server=icebox)
-TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox2"),
- server=icebox)
diff --git a/csharp/test/IceDiscovery/simple/AllTests.cs b/csharp/test/IceDiscovery/simple/AllTests.cs
index 64e6836e09e..2038f9a3d47 100644
--- a/csharp/test/IceDiscovery/simple/AllTests.cs
+++ b/csharp/test/IceDiscovery/simple/AllTests.cs
@@ -11,19 +11,12 @@ using Test;
using System;
using System.Collections.Generic;
-public class AllTests
+public class AllTests : TestCommon.AllTests
{
- private static void test(bool b)
- {
- if(!b)
- {
- throw new Exception();
- }
- }
-
public static void
- allTests(Ice.Communicator communicator, int num)
+ allTests(TestCommon.Application app, int num)
{
+ Ice.Communicator communicator = app.communicator();
List<ControllerPrx> proxies = new List<ControllerPrx>();
List<ControllerPrx> indirectProxies = new List<ControllerPrx>();
for(int i = 0; i < num; ++i)
@@ -33,28 +26,28 @@ public class AllTests
indirectProxies.Add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id + "@control" + i)));
}
- Console.Out.Write("testing indirect proxies... ");
- Console.Out.Flush();
+ Write("testing indirect proxies... ");
+ Flush();
{
foreach(ControllerPrx prx in indirectProxies)
{
prx.ice_ping();
}
}
- Console.Out.WriteLine("ok");
+ WriteLine("ok");
- Console.Out.Write("testing well-known proxies... ");
- Console.Out.Flush();
+ Write("testing well-known proxies... ");
+ Flush();
{
foreach(ControllerPrx prx in proxies)
{
prx.ice_ping();
}
}
- Console.Out.WriteLine("ok");
+ WriteLine("ok");
- Console.Out.Write("testing object adapter registration... ");
- Console.Out.Flush();
+ Write("testing object adapter registration... ");
+ Flush();
{
try
{
@@ -84,10 +77,10 @@ public class AllTests
{
}
}
- Console.Out.WriteLine("ok");
-
- Console.Out.Write("testing object adapter migration...");
- Console.Out.Flush();
+ WriteLine("ok");
+
+ Write("testing object adapter migration...");
+ Flush();
{
proxies[0].activateObjectAdapter("oa", "oa1", "");
proxies[0].addObject("oa", "object");
@@ -101,10 +94,10 @@ public class AllTests
proxies[1].removeObject("oa", "object");
proxies[1].deactivateObjectAdapter("oa");
}
- Console.Out.WriteLine("ok");
+ WriteLine("ok");
- Console.Out.Write("testing object migration...");
- Console.Out.Flush();
+ Write("testing object migration...");
+ Flush();
{
proxies[0].activateObjectAdapter("oa", "oa1", "");
proxies[1].activateObjectAdapter("oa", "oa2", "");
@@ -137,10 +130,10 @@ public class AllTests
proxies[0].deactivateObjectAdapter("oa");
proxies[1].deactivateObjectAdapter("oa");
}
- Console.Out.WriteLine("ok");
+ WriteLine("ok");
- Console.Out.Write("testing replica groups...");
- Console.Out.Flush();
+ Write("testing replica groups...");
+ Flush();
{
proxies[0].activateObjectAdapter("oa", "oa1", "rg");
proxies[1].activateObjectAdapter("oa", "oa2", "rg");
@@ -200,14 +193,14 @@ public class AllTests
communicator.stringToProxy("object @ rg")).getAdapterId().Equals("oa1"));
proxies[0].deactivateObjectAdapter("oa");
}
- Console.Out.WriteLine("ok");
+ WriteLine("ok");
- Console.Out.Write("shutting down... ");
- Console.Out.Flush();
+ Write("shutting down... ");
+ Flush();
foreach(ControllerPrx prx in proxies)
{
prx.shutdown();
}
- Console.Out.WriteLine("ok");
+ WriteLine("ok");
}
}
diff --git a/csharp/test/IceDiscovery/simple/Client.cs b/csharp/test/IceDiscovery/simple/Client.cs
index 36e5224e7fc..2606c7ffb65 100644
--- a/csharp/test/IceDiscovery/simple/Client.cs
+++ b/csharp/test/IceDiscovery/simple/Client.cs
@@ -16,12 +16,12 @@ using System.Reflection;
[assembly: AssemblyDescription("IceDiscovery test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
int num;
- try
+ try
{
num = args.Length == 1 ? Int32.Parse(args[0]) : 0;
}
@@ -29,39 +29,13 @@ public class Client
{
num = 0;
}
- AllTests.allTests(communicator, num);
+ AllTests.allTests(this, num);
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/IceDiscovery/simple/Server.cs b/csharp/test/IceDiscovery/simple/Server.cs
index 4f423af28e8..140e70a970b 100644
--- a/csharp/test/IceDiscovery/simple/Server.cs
+++ b/csharp/test/IceDiscovery/simple/Server.cs
@@ -16,11 +16,11 @@ using System.Reflection;
[assembly: AssemblyDescription("IceDiscovery test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- Ice.Properties properties = communicator.getProperties();
+ Ice.Properties properties = communicator().getProperties();
int num = 0;
try
@@ -31,47 +31,21 @@ public class Server
{
}
- properties.setProperty("ControlAdapter.Endpoints", "default -p " + (12010 + num));
+ properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num));
properties.setProperty("ControlAdapter.AdapterId", "control" + num);
properties.setProperty("ControlAdapter.ThreadPool.Size", "1");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ControlAdapter");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter");
adapter.add(new ControllerI(), Ice.Util.stringToIdentity("controller" + num));
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/IceDiscovery/simple/msbuild/client/client.csproj b/csharp/test/IceDiscovery/simple/msbuild/client/client.csproj
index 1448936c5a2..04b38871502 100644
--- a/csharp/test/IceDiscovery/simple/msbuild/client/client.csproj
+++ b/csharp/test/IceDiscovery/simple/msbuild/client/client.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\AllTests.cs">
<Link>AllTests.cs</Link>
</Compile>
diff --git a/csharp/test/IceDiscovery/simple/msbuild/server/server.csproj b/csharp/test/IceDiscovery/simple/msbuild/server/server.csproj
index 5f1c3b2e769..12d254b1f75 100644
--- a/csharp/test/IceDiscovery/simple/msbuild/server/server.csproj
+++ b/csharp/test/IceDiscovery/simple/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/IceDiscovery/simple/run.py b/csharp/test/IceDiscovery/simple/run.py
deleted file mode 100755
index f9f3eb51536..00000000000
--- a/csharp/test/IceDiscovery/simple/run.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-server = os.path.join(os.getcwd(), "server")
-client = os.path.join(os.getcwd(), "client")
-
-num = 3
-
-args = " --Ice.Plugin.IceDiscovery=IceDiscovery:IceDiscovery.PluginFactory"
-args += " --IceDiscovery.Timeout=50"
-args += " --IceDiscovery.RetryCount=5"
-
-if TestUtil.isDarwin() and TestUtil.ipv6:
- print("test not supported on OS X with IPv6")
- sys.exit(0)
-
-if not TestUtil.ipv6:
- args += " --IceDiscovery.Interface=127.0.0.1"
-
-serverProc = []
-for i in range(0, num):
- sys.stdout.write("starting server #%d... " % (i + 1))
- sys.stdout.flush()
- serverProc.append(TestUtil.startServer(server, "%d %s" % (i, args), count = 4))
- print("ok")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, "%d %s" % (num, args), startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
-for p in serverProc:
- p.waitTestSuccess()
diff --git a/csharp/test/IceGrid/simple/AllTests.cs b/csharp/test/IceGrid/simple/AllTests.cs
index f1c781d6b7d..ba40dcf9f15 100644
--- a/csharp/test/IceGrid/simple/AllTests.cs
+++ b/csharp/test/IceGrid/simple/AllTests.cs
@@ -10,19 +10,11 @@
using System;
using Test;
-public class AllTests
+public class AllTests : TestCommon.AllTests
{
- private static void
- test(bool b)
- {
- if(!b)
- {
- throw new Exception();
- }
- }
-
- public static void allTests(Ice.Communicator communicator)
+ public static void allTests(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Console.Out.Write("testing stringToProxy... ");
Console.Out.Flush();
String rf = "test @ TestAdapter";
@@ -62,7 +54,7 @@ public class AllTests
IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast(
communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry"));
test(registry != null);
-
+
try
{
IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar");
@@ -81,16 +73,17 @@ public class AllTests
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = communicator.getProperties().ice_clone_();
initData.properties.setProperty("Ice.Default.Locator", "");
- initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery",
+ initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery",
"IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory");
- if(IceInternal.AssemblyUtil.osx_ &&
+ if(IceInternal.AssemblyUtil.osx_ &&
initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0)
{
initData.properties.setProperty("IceLocatorDiscovery.Interface", "::1");
}
+ initData.properties.setProperty("IceLocatorDiscovery.Port", app.getTestPort(99).ToString());
initData.properties.setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter");
initData.properties.setProperty("AdapterForDiscoveryTest.Endpoints", "default");
-
+
Ice.Communicator com = Ice.Util.initialize(initData);
test(com.getDefaultLocator() != null);
com.stringToProxy("test @ TestAdapter").ice_ping();
@@ -108,7 +101,7 @@ public class AllTests
//
// Now, ensure that the IceGrid discovery locator correctly
// handles failure to find a locator.
- //
+ //
initData.properties.setProperty("IceLocatorDiscovery.InstanceName", "unknown");
initData.properties.setProperty("IceLocatorDiscovery.RetryCount", "1");
initData.properties.setProperty("IceLocatorDiscovery.Timeout", "100");
@@ -153,8 +146,9 @@ public class AllTests
}
public static void
- allTestsWithDeploy(Ice.Communicator communicator)
+ allTestsWithDeploy(TestCommon.Application app)
{
+ Ice.Communicator communicator = app.communicator();
Console.Out.Write("testing stringToProxy... ");
Console.Out.Flush();
Ice.ObjectPrx @base = communicator.stringToProxy("test @ TestAdapter");
diff --git a/csharp/test/IceGrid/simple/Client.cs b/csharp/test/IceGrid/simple/Client.cs
index 21eca6fe720..2fd1dab9105 100644
--- a/csharp/test/IceGrid/simple/Client.cs
+++ b/csharp/test/IceGrid/simple/Client.cs
@@ -16,9 +16,9 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
bool withDeploy = false;
for(int i = 0; i < args.Length; i++)
@@ -32,11 +32,11 @@ public class Client
if(!withDeploy)
{
- AllTests.allTests(communicator);
+ AllTests.allTests(this);
}
else
{
- AllTests.allTestsWithDeploy(communicator);
+ AllTests.allTestsWithDeploy(this);
}
return 0;
@@ -44,33 +44,7 @@ public class Client
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch (Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if (communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch (Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/IceGrid/simple/simple_server.xml b/csharp/test/IceGrid/simple/application.xml
index 8029cabe95f..8029cabe95f 100644
--- a/csharp/test/IceGrid/simple/simple_server.xml
+++ b/csharp/test/IceGrid/simple/application.xml
diff --git a/csharp/test/IceGrid/simple/msbuild/client/client.csproj b/csharp/test/IceGrid/simple/msbuild/client/client.csproj
index 74aed1eea64..2488c9ffb96 100644
--- a/csharp/test/IceGrid/simple/msbuild/client/client.csproj
+++ b/csharp/test/IceGrid/simple/msbuild/client/client.csproj
@@ -44,6 +44,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\AllTests.cs">
<Link>AllTests.cs</Link>
</Compile>
diff --git a/csharp/test/IceGrid/simple/msbuild/server/server.csproj b/csharp/test/IceGrid/simple/msbuild/server/server.csproj
index 3c663d9995e..26f99c778d0 100644
--- a/csharp/test/IceGrid/simple/msbuild/server/server.csproj
+++ b/csharp/test/IceGrid/simple/msbuild/server/server.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/IceGrid/simple/run.py b/csharp/test/IceGrid/simple/run.py
deleted file mode 100755
index b7c2ffa799f..00000000000
--- a/csharp/test/IceGrid/simple/run.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-# Test IceGrid discovery with multiple replicas
-IceGridAdmin.nreplicas=2
-
-#
-# Test client/server without on demand activation.
-#
-IceGridAdmin.iceGridClientServerTest("", "--TestAdapter.Endpoints=default --TestAdapter.AdapterId=TestAdapter")
-
-#
-# Test client/server with on demand activation.
-#
-if TestUtil.mono:
- IceGridAdmin.iceGridTest("simple_mono_server.xml", "--with-deploy")
-else:
- IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy")
diff --git a/csharp/test/IceGrid/simple/simple_mono_server.xml b/csharp/test/IceGrid/simple/simple_mono_server.xml
deleted file mode 100644
index 2dbea99b9a1..00000000000
--- a/csharp/test/IceGrid/simple/simple_mono_server.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<icegrid>
- <application name="Test">
- <node name="localnode">
- <server id="server" exe="mono" pwd="." activation="on-demand">
- <option>--debug</option>
- <option>${test.dir}/server.exe</option>
- <adapter name="TestAdapter" id="TestAdapter" endpoints="default">
- <object identity="test" type="Test"/>
- </adapter>
- </server>
-
- <server id="server10" exe="mono" pwd="." activation="on-demand">
- <option>--debug</option>
- <option>${test.dir}/server.exe</option>
- <adapter name="TestAdapter" endpoints="default" id="TestAdapter10">
- <object identity="test10" type="Test" property="Identity"/>
- </adapter>
- <property name="Ice.Default.EncodingVersion" value="1.0"/>
- </server>
- </node>
- </application>
-</icegrid>
diff --git a/csharp/test/IceSSL/configuration/AllTests.cs b/csharp/test/IceSSL/configuration/AllTests.cs
index f9b3522a211..17356526a63 100644
--- a/csharp/test/IceSSL/configuration/AllTests.cs
+++ b/csharp/test/IceSSL/configuration/AllTests.cs
@@ -103,9 +103,10 @@ public class AllTests
return initData;
}
- public static Test.ServerFactoryPrx allTests(Ice.Communicator communicator, string testDir)
+ public static Test.ServerFactoryPrx allTests(TestCommon.Application app, string testDir)
{
- string factoryRef = "factory:tcp -p 12010";
+ Ice.Communicator communicator = app.communicator();
+ string factoryRef = "factory:" + app.getTestEndpoint(0);
Ice.ObjectPrx b = communicator.stringToProxy(factoryRef);
test(b != null);
Test.ServerFactoryPrx factory = Test.ServerFactoryPrxHelper.checkedCast(b);
diff --git a/csharp/test/IceSSL/configuration/Client.cs b/csharp/test/IceSSL/configuration/Client.cs
index 6154fd3dc5d..3d64e6c7b1b 100644
--- a/csharp/test/IceSSL/configuration/Client.cs
+++ b/csharp/test/IceSSL/configuration/Client.cs
@@ -16,9 +16,9 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Client
+public class Client : TestCommon.Application
{
- private static int run(String[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
if(args.Length < 1)
{
@@ -27,41 +27,15 @@ public class Client
}
Test.ServerFactoryPrx factory;
- factory = AllTests.allTests(communicator, args[0]);
+ factory = AllTests.allTests(this, args[0]);
factory.shutdown();
-
+
return 0;
}
-
+
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/IceSSL/configuration/Server.cs b/csharp/test/IceSSL/configuration/Server.cs
index 636c41a8188..908a2aa5b12 100644
--- a/csharp/test/IceSSL/configuration/Server.cs
+++ b/csharp/test/IceSSL/configuration/Server.cs
@@ -16,49 +16,23 @@ using System.Reflection;
[assembly: AssemblyDescription("Ice test")]
[assembly: AssemblyCompany("ZeroC, Inc.")]
-public class Server
+public class Server : TestCommon.Application
{
- private static int run(string[] args, Ice.Communicator communicator)
+ public override int run(string[] args)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter");
Ice.Identity id = Ice.Util.stringToIdentity("factory");
adapter.add(new ServerFactoryI(), id);
adapter.activate();
- communicator.waitForShutdown();
+ communicator().waitForShutdown();
return 0;
}
-
+
public static int Main(string[] args)
{
- int status = 0;
- Ice.Communicator communicator = null;
-
- try
- {
- communicator = Ice.Util.initialize(ref args);
- status = run(args, communicator);
- }
- catch(Exception ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
-
- if(communicator != null)
- {
- try
- {
- communicator.destroy();
- }
- catch(Ice.LocalException ex)
- {
- Console.Error.WriteLine(ex);
- status = 1;
- }
- }
-
- return status;
+ Server app = new Server();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/IceSSL/configuration/msbuild/client/client.csproj b/csharp/test/IceSSL/configuration/msbuild/client/client.csproj
index bfbf2e8ead2..3c3f882b2d1 100644
--- a/csharp/test/IceSSL/configuration/msbuild/client/client.csproj
+++ b/csharp/test/IceSSL/configuration/msbuild/client/client.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\AllTests.cs">
<Link>AllTests.cs</Link>
</Compile>
diff --git a/csharp/test/IceSSL/configuration/msbuild/server/server.csproj b/csharp/test/IceSSL/configuration/msbuild/server/server.csproj
index f7dad3bce7b..626838dac24 100644
--- a/csharp/test/IceSSL/configuration/msbuild/server/server.csproj
+++ b/csharp/test/IceSSL/configuration/msbuild/server/server.csproj
@@ -39,6 +39,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Server.cs">
<Link>Server.cs</Link>
</Compile>
diff --git a/csharp/test/IceSSL/configuration/run.py b/csharp/test/IceSSL/configuration/run.py
deleted file mode 100755
index ad1e1601ec1..00000000000
--- a/csharp/test/IceSSL/configuration/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt, re
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-# Filter-out the deprecated property warnings
-TestUtil.clientTraceFilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.FindCert.*\n", "", x) ]
-TestUtil.serverTraceFilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.FindCert.*\n", "", x) ]
-#
-# The drive letter needs to be removed on Windows or loading the SSL
-# plug-in will not work.
-#
-TestUtil.clientServerTest(additionalClientOptions = '"%s"' % os.path.splitdrive(os.getcwd())[1])
diff --git a/csharp/test/IceUtil/inputUtil/Client.cs b/csharp/test/IceUtil/inputUtil/Client.cs
index eda4b88b917..b3439a20736 100644
--- a/csharp/test/IceUtil/inputUtil/Client.cs
+++ b/csharp/test/IceUtil/inputUtil/Client.cs
@@ -9,17 +9,9 @@
using System;
-public class Client
+public class Client : TestCommon.Application
{
- private static void test(bool b)
- {
- if (!b)
- {
- throw new Exception();
- }
- }
-
- public static void Main(string[] argvs)
+ public override int run(string[] argvs)
{
Console.Out.Write("testing string to command line arguments... ");
Console.Out.Flush();
@@ -28,7 +20,7 @@ public class Client
try
{
test(IceUtilInternal.Options.split("").Length == 0);
-
+
args = IceUtilInternal.Options.split("\"\"");
test(args.Length == 1 && args[0].Equals(""));
args = IceUtilInternal.Options.split("''");
@@ -128,7 +120,7 @@ public class Client
test(arr.Length == 2 && arr[0].Equals("a") && arr[1].Equals("b"));
arr = IceUtilInternal.StringUtil.splitString(":a:b:", ":");
test(arr.Length == 2 && arr[0].Equals("a") && arr[1].Equals("b"));
-
+
arr = IceUtilInternal.StringUtil.splitString("\"a\"", ":");
test(arr.Length == 1 && arr[0].Equals("a"));
arr = IceUtilInternal.StringUtil.splitString("\"a\":b", ":");
@@ -146,7 +138,7 @@ public class Client
test(arr.Length == 1 && arr[0].Equals("\"a"));
arr = IceUtilInternal.StringUtil.splitString("\"'a\"", ":");
test(arr.Length == 1 && arr[0].Equals("'a"));
-
+
arr = IceUtilInternal.StringUtil.splitString("a\\'b", ":");
test(arr.Length == 1 && arr[0].Equals("a'b"));
arr = IceUtilInternal.StringUtil.splitString("'a:b\\'c'", ":");
@@ -163,5 +155,12 @@ public class Client
test(IceUtilInternal.StringUtil.splitString("a\"b", ":") == null);
}
Console.Out.WriteLine("ok");
+ return 0;
+ }
+
+ public static int Main(string[] args)
+ {
+ Client app = new Client();
+ return app.runmain(args);
}
}
diff --git a/csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj b/csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj
index 44707cd68d2..1f17bf97bca 100644
--- a/csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj
+++ b/csharp/test/IceUtil/inputUtil/msbuild/client/client.csproj
@@ -34,6 +34,9 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\..\TestCommon\TestApp.cs">
+ <Link>TestApp.cs</Link>
+ </Compile>
<Compile Include="..\..\Client.cs">
<Link>Client.cs</Link>
</Compile>
diff --git a/csharp/test/IceUtil/inputUtil/run.py b/csharp/test/IceUtil/inputUtil/run.py
deleted file mode 100755
index 7dca8ec8ecc..00000000000
--- a/csharp/test/IceUtil/inputUtil/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, "", startReader = False)
-print("ok")
-clientProc.startReader()
-clientProc.waitTestSuccess()
diff --git a/csharp/test/Slice/keyword/Client.cs b/csharp/test/Slice/keyword/Client.cs
index 79cef005fb7..6c0d00d12c1 100644
--- a/csharp/test/Slice/keyword/Client.cs
+++ b/csharp/test/Slice/keyword/Client.cs
@@ -144,7 +144,7 @@ public class Client
private static int run(string[] args, Ice.Communicator communicator)
{
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new decimalI(), Ice.Util.stringToIdentity("test"));
adapter.add(new Test1I(), Ice.Util.stringToIdentity("test1"));
diff --git a/csharp/test/Slice/keyword/run.py b/csharp/test/Slice/keyword/run.py
deleted file mode 100755
index f1d296052a4..00000000000
--- a/csharp/test/Slice/keyword/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, startReader = False)
-print("ok")
-clientProc.startReader()
-clientProc.waitTestSuccess()
diff --git a/csharp/test/Slice/macros/run.py b/csharp/test/Slice/macros/run.py
deleted file mode 100755
index f1d296052a4..00000000000
--- a/csharp/test/Slice/macros/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, startReader = False)
-print("ok")
-clientProc.startReader()
-clientProc.waitTestSuccess()
diff --git a/csharp/test/Slice/structure/run.py b/csharp/test/Slice/structure/run.py
deleted file mode 100755
index f1d296052a4..00000000000
--- a/csharp/test/Slice/structure/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, getopt
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), "client")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, startReader = False)
-print("ok")
-clientProc.startReader()
-clientProc.waitTestSuccess()
diff --git a/csharp/test/TestCommon/TestApp.cs b/csharp/test/TestCommon/TestApp.cs
index cf4b394db6e..330223ca25d 100644
--- a/csharp/test/TestCommon/TestApp.cs
+++ b/csharp/test/TestCommon/TestApp.cs
@@ -12,8 +12,185 @@ using System.Diagnostics;
namespace TestCommon
{
- public abstract class TestApp
+ public abstract class Application
{
+ public
+ Application()
+ {
+ }
+
+ //
+ // This runmain() must be called by the global main(). runmain()
+ // initializes the Communicator, calls run(), and destroys
+ // the Communicator upon return from run(). It thereby handles
+ // all exceptions properly, i.e., error messages are printed
+ // if exceptions propagate to main(), and the Communicator is
+ // always destroyed, regardless of exceptions.
+ //
+ public int runmain(string[] args)
+ {
+ Ice.InitializationData initData = getInitData(ref args);
+ return runmain(args, initData);
+ }
+
+ public int runmain(string[] args, Ice.InitializationData initializationData)
+ {
+ _testName = AppDomain.CurrentDomain.FriendlyName;
+
+ if(_communicator != null)
+ {
+ Console.Out.WriteLine(_testName + ": only one instance of the Application class can be used");
+ return 1;
+ }
+
+ //
+ // We parse the properties here to extract Ice.ProgramName.
+ //
+ if(initializationData == null)
+ {
+ initializationData = getInitData(ref args);
+ }
+
+ Ice.InitializationData initData;
+ if(initializationData != null)
+ {
+ initData = (Ice.InitializationData)initializationData.Clone();
+ }
+ else
+ {
+ initData = new Ice.InitializationData();
+ }
+ initData.properties = Ice.Util.createProperties(ref args, initData.properties);
+
+ //
+ // If the process logger is the default logger, we replace it with a
+ // a logger that uses the program name as the prefix.
+ //
+ if(Ice.Util.getProcessLogger() is Ice.LoggerI)
+ {
+ Ice.Util.setProcessLogger(new Ice.ConsoleLoggerI(initData.properties.getProperty("Ice.ProgramName")));
+ }
+
+ int status = 0;
+ try
+ {
+ _communicator = Ice.Util.initialize(ref args, initData);
+ status = run(args);
+ }
+ catch(Exception ex)
+ {
+ Console.Out.WriteLine(_testName + ": " + ex);
+ status = 1;
+ }
+
+ if(_communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ }
+ catch(Exception ex)
+ {
+ Console.Out.WriteLine(_testName + ": " + ex);
+ status = 1;
+ }
+ _communicator = null;
+ }
+ return status;
+ }
+
+ public void stop()
+ {
+ if(_communicator != null)
+ {
+ _communicator.shutdown();
+ }
+ }
+
+ public abstract int run(string[] args);
+
+ //
+ // Hook to override the initialization data. This hook is
+ // necessary because some properties must be set prior to
+ // communicator initialization.
+ //
+ protected virtual Ice.InitializationData getInitData(ref string[] args)
+ {
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(ref args);
+ args = initData.properties.parseCommandLineOptions("Test", args);
+ return initData;
+ }
+
+ //
+ // Return the application name, i.e., argv[0].
+ //
+ public string appName()
+ {
+ return _testName;
+ }
+
+ public Ice.Communicator communicator()
+ {
+ return _communicator;
+ }
+
+ public string getTestEndpoint(int num)
+ {
+ return getTestEndpoint(num, "");
+ }
+
+ public string getTestEndpoint(int num, string prot)
+ {
+ return getTestEndpoint(_communicator.getProperties(), num, prot);
+ }
+
+ static public string getTestEndpoint(Ice.Properties properties, int num)
+ {
+ return getTestEndpoint(properties, num, "");
+ }
+
+ static public string getTestEndpoint(Ice.Properties properties, int num, string prot)
+ {
+ string protocol = prot;
+ if(protocol == "")
+ {
+ protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "default");
+ }
+ int basePort = properties.getPropertyAsIntWithDefault("Test.BasePort", 12010);
+ return protocol + " -p " + (basePort + num);
+ }
+
+ public string getTestHost()
+ {
+ return getTestHost(_communicator.getProperties());
+ }
+
+ static public string getTestHost(Ice.Properties properties)
+ {
+ return properties.getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");
+ }
+
+ public string getTestProtocol()
+ {
+ return getTestProtocol(_communicator.getProperties());
+ }
+
+ static public string getTestProtocol(Ice.Properties properties)
+ {
+ return properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ }
+
+ public int getTestPort(int num)
+ {
+ return getTestPort(_communicator.getProperties(), num);
+ }
+
+ static public int getTestPort(Ice.Properties properties, int num)
+ {
+ return properties.getPropertyAsIntWithDefault("Test.BasePort", 12010) + num;
+ }
+
protected static void test(bool b)
{
if(!b)
@@ -23,6 +200,20 @@ namespace TestCommon
}
}
+ private string _testName;
+ private Ice.Communicator _communicator;
+ }
+
+ public abstract class AllTests
+ {
+ protected static void test(bool b)
+ {
+ if(!b)
+ {
+ Debug.Assert(false);
+ throw new Exception();
+ }
+ }
public static void Write(string msg)
{
@@ -35,7 +226,7 @@ namespace TestCommon
}
public static void Flush()
- {
+ {
Console.Out.Flush();
}
}