diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-11-25 13:13:22 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-11-25 13:13:22 +0100 |
commit | dcdc32af1fced49d80a8ccd93230e15d91ab45d8 (patch) | |
tree | eb69e2555fbd54496fce8a33f4dd610e1473ff51 /csharp/test/IceBox/configuration | |
parent | C# IceSSL/configuration log expired certificate exceptions. (diff) | |
download | ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.tar.bz2 ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.tar.xz ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.zip |
Refactored test scripts
Diffstat (limited to 'csharp/test/IceBox/configuration')
-rw-r--r-- | csharp/test/IceBox/configuration/AllTests.cs | 26 | ||||
-rw-r--r-- | csharp/test/IceBox/configuration/Client.cs | 48 | ||||
-rw-r--r-- | csharp/test/IceBox/configuration/config.service1 | 2 | ||||
-rw-r--r-- | csharp/test/IceBox/configuration/config.service1-2 | 2 | ||||
-rw-r--r-- | csharp/test/IceBox/configuration/config.service2 | 2 | ||||
-rw-r--r-- | csharp/test/IceBox/configuration/config.service2-2 | 2 | ||||
-rw-r--r-- | csharp/test/IceBox/configuration/config.service3 | 2 | ||||
-rw-r--r-- | csharp/test/IceBox/configuration/config.service4 | 2 | ||||
-rw-r--r-- | csharp/test/IceBox/configuration/msbuild/client/client.csproj | 3 | ||||
-rwxr-xr-x | csharp/test/IceBox/configuration/run.py | 28 |
10 files changed, 33 insertions, 84 deletions
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) |