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