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