summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/exceptions
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/test/Ice/exceptions')
-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
7 files changed, 68 insertions, 176 deletions
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()