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 /java-compat | |
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 'java-compat')
234 files changed, 981 insertions, 2929 deletions
diff --git a/java-compat/allTests.py b/java-compat/allTests.py index 7ca52f7db4c..e4360c465d3 100755 --- a/java-compat/allTests.py +++ b/java-compat/allTests.py @@ -8,79 +8,9 @@ # # ********************************************************************** -import os, sys, re, getopt +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) -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!") +from Util import runTestsWithPath -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -# -# List of all basic tests. -# -tests = [ - ("Slice/generation", ["once"]), - ("Slice/keyword", ["once"]), - ("Slice/macros", ["once"]), - ("Slice/structure", ["once"]), - ("IceUtil/inputUtil", ["once"]), - ("Ice/proxy", ["core"]), - ("Ice/operations", ["core"]), - ("Ice/seqMapping", ["core"]), - ("Ice/exceptions", ["core"]), - ("Ice/ami", ["core", "nocompress"]), - ("Ice/info", ["core", "noipv6", "nocompress", "nosocks"]), - ("Ice/inheritance", ["core"]), - ("Ice/facets", ["core"]), - ("Ice/objects", ["core"]), - ("Ice/binding", ["core"]), - ("Ice/faultTolerance", ["core"]), - ("Ice/location", ["core"]), - ("Ice/adapterDeactivation", ["core"]), - ("Ice/slicing/exceptions", ["core"]), - ("Ice/slicing/objects", ["core"]), - ("Ice/custom", ["core"]), - ("Ice/checksum", ["core"]), - ("Ice/dispatcher", ["core"]), - ("Ice/interrupt", ["core", "nocompress"]), - ("Ice/packagemd", ["core"]), - ("Ice/stream", ["core"]), - ("Ice/hold", ["core"]), - ("Ice/retry", ["core"]), - ("Ice/timeout", ["core", "nocompress"]), - ("Ice/acm", ["core"]), - ("Ice/background", ["core", "nosocks"]), - ("Ice/servantLocator", ["core"]), - ("Ice/interceptor", ["core"]), - ("Ice/udp", ["core"]), - ("Ice/serialize", ["core"]), - ("Ice/defaultServant", ["core"]), - ("Ice/defaultValue", ["core"]), - ("Ice/threadPoolPriority", ["core"]), - ("Ice/classLoader", ["core"]), - ("Ice/invoke", ["core"]), - ("Ice/properties", ["once"]), - ("Ice/plugin", ["core"]), - ("Ice/hash", ["once"]), - ("Ice/optional", ["once"]), - ("Ice/admin", ["core"]), - ("Ice/metrics", ["core", "nows", "noipv6", "nocompress", "nosocks"]), - ("Ice/enums", ["once"]), - ("Ice/networkProxy", ["core", "noipv6", "nosocks"]), - ("IceBox/admin", ["core", "noipv6", "nomx"]), - ("IceBox/configuration", ["core", "noipv6", "nomx"]), - ("Glacier2/router", ["service"]), - ("Glacier2/sessionHelper", ["core"]), - ("IceDiscovery/simple", ["service"]), - ("IceGrid/simple", ["service"]), - ("IceSSL/configuration", ["once"]) - ] - -if __name__ == "__main__": - TestUtil.run(tests) +runTestsWithPath(__file__)
\ No newline at end of file diff --git a/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java b/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java index 89cc00f4a3a..d3b88ed87a2 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java @@ -31,7 +31,7 @@ class EndpointHostResolver } } - synchronized void resolve(final String host, final int port, final Ice.EndpointSelectionType selType, + synchronized void resolve(final String host, final int port, final Ice.EndpointSelectionType selType, final IPEndpointI endpoint, final EndpointI_connectors callback) { // @@ -45,8 +45,8 @@ class EndpointHostResolver NetworkProxy networkProxy = _instance.networkProxy(); if(networkProxy == null) { - java.util.List<java.net.InetSocketAddress> addrs = Network.getAddresses(host, port, _protocol, selType, - _preferIPv6, false); + java.util.List<java.net.InetSocketAddress> addrs = + Network.getAddresses(host, port, _protocol, selType, _preferIPv6, false); if(addrs != null) { callback.connectors(endpoint.connectors(addrs, networkProxy)); @@ -87,6 +87,7 @@ class EndpointHostResolver Ice.Instrumentation.ThreadState.ThreadStateInUseForOther); } + Ice.Instrumentation.Observer obsv = observer; try { int protocol = _protocol; @@ -100,19 +101,22 @@ class EndpointHostResolver } } - callback.connectors(endpoint.connectors(Network.getAddresses(host, - port, - protocol, - selType, - _preferIPv6, - true), - networkProxy)); + java.util.List<java.net.InetSocketAddress> addresses = + Network.getAddresses(host, port, protocol, selType, _preferIPv6, true); + if(obsv != null) + { + obsv.detach(); + obsv = null; + } + + callback.connectors(endpoint.connectors(addresses, networkProxy)); } catch(Ice.LocalException ex) { - if(observer != null) + if(obsv != null) { - observer.failed(ex.ice_id()); + obsv.failed(ex.ice_id()); + obsv.detach(); } callback.exception(ex); } @@ -123,10 +127,6 @@ class EndpointHostResolver threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, Ice.Instrumentation.ThreadState.ThreadStateIdle); } - if(observer != null) - { - observer.detach(); - } } } }); diff --git a/java-compat/test/src/main/java/test/Glacier2/router/Client.java b/java-compat/test/src/main/java/test/Glacier2/router/Client.java index 5bec46a2cec..8694bb32899 100644 --- a/java-compat/test/src/main/java/test/Glacier2/router/Client.java +++ b/java-compat/test/src/main/java/test/Glacier2/router/Client.java @@ -38,10 +38,10 @@ public class Client extends test.Util.Application { out.print("testing stringToProxy for router... "); out.flush(); - routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347"); + routerBase = communicator().stringToProxy("Glacier2/router:" + getTestEndpoint(10)); out.println("ok"); } - + Glacier2.RouterPrx router; { @@ -56,7 +56,7 @@ public class Client extends test.Util.Application out.print("testing router finder... "); out.flush(); Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast( - communicator().stringToProxy("Ice/RouterFinder:default -p 12347")); + communicator().stringToProxy("Ice/RouterFinder:" + getTestEndpoint(10))); test(finder.getRouter().ice_getIdentity().equals(router.ice_getIdentity())); out.println("ok"); } @@ -81,10 +81,10 @@ public class Client extends test.Util.Application { out.print("testing stringToProxy for server object... "); out.flush(); - base = communicator().stringToProxy("c1/callback:tcp -p 12010"); + base = communicator().stringToProxy("c1/callback:" + getTestEndpoint(0)); out.println("ok"); } - + { out.print("trying to ping server before session creation... "); out.flush(); @@ -224,7 +224,7 @@ public class Client extends test.Util.Application Ice.Object callbackReceiver; CallbackReceiverPrx twowayR; CallbackReceiverPrx fakeTwowayR; - + { out.print("creating and adding callback receiver object... "); out.flush(); @@ -241,7 +241,7 @@ public class Client extends test.Util.Application adapter.add(callbackReceiver, fakeCallbackReceiverIdent)); out.println("ok"); } - + { out.print("testing oneway callback... "); out.flush(); @@ -310,7 +310,7 @@ public class Client extends test.Util.Application callbackReceiverImpl.callbackOK(); out.println("ok"); } - + { out.print("testing whether disallowed category gets rejected... "); out.flush(); @@ -328,7 +328,7 @@ public class Client extends test.Util.Application out.println("ok"); } } - + { out.print("testing whether user-id as category is accepted... "); out.flush(); @@ -340,7 +340,8 @@ public class Client extends test.Util.Application callbackReceiverImpl.callbackOK(); out.println("ok"); } - + + if(args.length >= 1 && args[0].equals("--shutdown")) { out.print("testing server shutdown... "); out.flush(); @@ -362,7 +363,7 @@ public class Client extends test.Util.Application } */ } - + { out.print("destroying session... "); out.flush(); @@ -380,7 +381,7 @@ public class Client extends test.Util.Application } out.println("ok"); } - + { out.print("trying to ping server after session destruction... "); out.flush(); @@ -410,7 +411,7 @@ public class Client extends test.Util.Application } } } - + if(args.length >= 1 && args[0].equals("--shutdown")) { { @@ -419,15 +420,15 @@ public class Client extends test.Util.Application communicator().setDefaultRouter(null); out.println("ok"); } - + Ice.ObjectPrx processBase; - + { out.print("testing stringToProxy for process object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348"); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp")); out.println("ok"); } - + /* { out.print("uninstalling router with process object... "); @@ -435,16 +436,16 @@ public class Client extends test.Util.Application out.println("ok"); } */ - + Ice.ProcessPrx process; - + { out.print("testing checked cast for admin object... "); process = Ice.ProcessPrxHelper.checkedCast(processBase); test(process != null); out.println("ok"); } - + out.print("testing Glacier2 shutdown... "); process.shutdown(); try @@ -457,14 +458,13 @@ public class Client extends test.Util.Application out.println("ok"); } } - + return 0; } - + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router"); @@ -477,7 +477,7 @@ public class Client extends test.Util.Application { Client c = new Client(); int status = c.main("Client", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/Glacier2/router/Server.java b/java-compat/test/src/main/java/test/Glacier2/router/Server.java index 562b8647b4e..1297bff6c22 100644 --- a/java-compat/test/src/main/java/test/Glacier2/router/Server.java +++ b/java-compat/test/src/main/java/test/Glacier2/router/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application public int run(String[] args) { - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010"); + 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. @@ -28,12 +28,11 @@ public class Server extends test.Util.Application communicator().waitForShutdown(); return 0; } - - + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router"); return initData; @@ -44,7 +43,7 @@ public class Server extends test.Util.Application { Server c = new Server(); int status = c.main("Server", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/Glacier2/router/run.py b/java-compat/test/src/main/java/test/Glacier2/router/run.py deleted file mode 100755 index dc815f8eed0..00000000000 --- a/java-compat/test/src/main/java/test/Glacier2/router/run.py +++ /dev/null @@ -1,53 +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 - -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() - -TestUtil.clientServerTest(additionalClientOptions=" --shutdown") - -starterProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java index 94325f9a9c7..91466d7fc21 100644 --- a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java +++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Client.java @@ -34,9 +34,9 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - _initData = createInitializationData(); - _initData.properties = Ice.Util.createProperties(argsH); - _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347"); + _initData = super.getInitData(argsH); + _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:" + + getTestEndpoint(_initData.properties, 10)); _initData.dispatcher = new Ice.Dispatcher() { @Override @@ -53,8 +53,8 @@ public class Client extends test.Util.Application @Override public 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"); + String protocol = getTestProtocol(); + String host = getTestHost(); _factory = new Glacier2.SessionFactoryHelper(_initData, new Glacier2.SessionCallback() { @@ -178,7 +178,7 @@ public class Client extends test.Util.Application out.print("testing SessionHelper connect interrupt... "); out.flush(); _factory.setRouterHost(host); - _factory.setPort(12011); + _factory.setPort(getTestPort(1)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); @@ -253,7 +253,7 @@ public class Client extends test.Util.Application out.print("testing SessionHelper connect... "); out.flush(); _factory.setRouterHost(host); - _factory.setPort(12347); + _factory.setPort(getTestPort(10)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); while(true) @@ -296,7 +296,7 @@ public class Client extends test.Util.Application out.print("testing stringToProxy for server object... "); out.flush(); - Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:default -p 12010"); + Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:" + getTestEndpoint(0)); out.println("ok"); out.print("pinging server after session creation... "); @@ -381,7 +381,7 @@ public class Client extends test.Util.Application Ice.ObjectPrx processBase; { out.print("testing stringToProxy for process object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:default -h \"" + host + "\" -p 12348"); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(11, "tcp")); out.println("ok"); } @@ -475,7 +475,7 @@ public class Client extends test.Util.Application out.flush(); _factory.setRouterHost(host); - _factory.setPort(12347); + _factory.setPort(getTestPort(10)); _factory.setProtocol(protocol); _session = _factory.connect("userid", "abc123"); while(true) diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java index 5e2108c78e0..ceff7b94dbf 100644 --- a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java +++ b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/Server.java @@ -14,10 +14,10 @@ public class Server extends test.Util.Application public int run(String[] args) { - communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", "default -p 12011"); + communicator().getProperties().setProperty("DeactivatedAdapter.Endpoints", getTestEndpoint(1)); communicator().createObjectAdapter("DeactivatedAdapter"); - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "default -p 12010"); + communicator().getProperties().setProperty("CallbackAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); adapter.add(new CallbackI(), Ice.Util.stringToIdentity("callback")); adapter.activate(); @@ -28,8 +28,7 @@ public class Server extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router"); return initData; diff --git a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py b/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py deleted file mode 100755 index 6ce3382b360..00000000000 --- a/java-compat/test/src/main/java/test/Glacier2/sessionHelper/run.py +++ /dev/null @@ -1,49 +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 - -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.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/java-compat/test/src/main/java/test/Ice/acm/AllTests.java b/java-compat/test/src/main/java/test/Ice/acm/AllTests.java index c68ba2166f5..a4369b684b8 100644 --- a/java-compat/test/src/main/java/test/Ice/acm/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/acm/AllTests.java @@ -612,10 +612,12 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); - String ref = "communicator:default -p 12010"; + PrintWriter out = app.getWriter(); + + String ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref)); java.util.List<TestCase> tests = new java.util.ArrayList<TestCase>(); diff --git a/java-compat/test/src/main/java/test/Ice/acm/Client.java b/java-compat/test/src/main/java/test/Ice/acm/Client.java index 0b77fa4ff82..7c2918d4b2a 100644 --- a/java-compat/test/src/main/java/test/Ice/acm/Client.java +++ b/java-compat/test/src/main/java/test/Ice/acm/Client.java @@ -13,14 +13,13 @@ public class Client extends test.Util.Application { public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm"); initData.properties.setProperty("Ice.Warn.Connections", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/acm/Server.java b/java-compat/test/src/main/java/test/Ice/acm/Server.java index 8df16e0f21a..f427f7cc5e8 100644 --- a/java-compat/test/src/main/java/test/Ice/acm/Server.java +++ b/java-compat/test/src/main/java/test/Ice/acm/Server.java @@ -28,10 +28,9 @@ public class Server extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.ACM.Timeout", "1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/acm/run.py b/java-compat/test/src/main/java/test/Ice/acm/run.py deleted file mode 100755 index 0b375fb252f..00000000000 --- a/java-compat/test/src/main/java/test/Ice/acm/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.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java index d198d02414e..57d34d6849a 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java @@ -24,12 +24,14 @@ public class AllTests } public static TestIntfPrx - allTests(test.Util.Application app, java.io.PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); + java.io.PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -77,7 +79,7 @@ public class AllTests Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); Ice.Communicator comm = app.initialize(initData); - comm.stringToProxy("test:default -p 12010").begin_ice_ping(); + comm.stringToProxy("test:" + app.getTestEndpoint(0)).begin_ice_ping(); comm.destroy(); } out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java index df01944e4e8..bea2f75c514 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Client.java @@ -14,14 +14,13 @@ public class Client extends test.Util.Application public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java index c5c800aab52..2d896f2f418 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java @@ -18,7 +18,7 @@ public class Collocated extends test.Util.Application Ice.ServantLocator locator = new ServantLocatorI(); adapter.addServantLocator(locator, ""); - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); adapter.waitForDeactivate(); return 0; @@ -26,8 +26,7 @@ public class Collocated extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // 2 threads are necessary to dispatch the collocated transient() call with AMI @@ -35,7 +34,7 @@ public class Collocated extends test.Util.Application initData.properties.setProperty("TestAdapter.ThreadPool.Size", "2"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java index 4edeea0c554..05bb57c2098 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/Server.java @@ -26,13 +26,12 @@ public class Server extends test.Util.Application protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); return initData; } - + public static void main(String[] args) { diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java index ad0f396c039..f878fe4de34 100644 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java +++ b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/TestI.java @@ -19,7 +19,7 @@ public final class TestI extends _TestIntfDisp Ice.Communicator communicator = current.adapter.getCommunicator(); Ice.ObjectAdapter adapter = - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); adapter.activate(); adapter.destroy(); } diff --git a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py b/java-compat/test/src/main/java/test/Ice/adapterDeactivation/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/adapterDeactivation/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() -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/admin/AllTests.java b/java-compat/test/src/main/java/test/Ice/admin/AllTests.java index b1e622947c8..96835f871c9 100644 --- a/java-compat/test/src/main/java/test/Ice/admin/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/admin/AllTests.java @@ -100,8 +100,10 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); + out.print("testing communicator operations... "); out.flush(); { @@ -180,7 +182,7 @@ public class AllTests } out.println("ok"); - String ref = "factory:default -p 12010 -t 10000"; + String ref = "factory:" + app.getTestEndpoint(0) + " -t 10000"; RemoteCommunicatorFactoryPrx factory = RemoteCommunicatorFactoryPrxHelper.uncheckedCast(app.communicator().stringToProxy(ref)); @@ -272,30 +274,30 @@ public class AllTests props.put("Ice.Admin.InstanceName", "Test"); props.put("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); - Ice.StringHolder prefix = new Ice.StringHolder(); - + Ice.StringHolder prefix = new Ice.StringHolder(); + // // Get all // Ice.LogMessage[] logMessages = logger.getLog(null, null, -1, prefix); - + test(logMessages.length == 4); test(prefix.value.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 // @@ -303,34 +305,34 @@ public class AllTests 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, prefix); test(logMessages.length == 4); test(prefix.value.equals("NullLogger")); - + for(Ice.LogMessage msg : java.util.Arrays.asList(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, prefix); test(logMessages.length == 5); test(prefix.value.equals("NullLogger")); - + for(Ice.LogMessage msg : java.util.Arrays.asList(logMessages)) - { - test(msg.type == Ice.LogMessageType.ErrorMessage || + { + test(msg.type == Ice.LogMessageType.ErrorMessage || (msg.type == Ice.LogMessageType.TraceMessage && msg.traceCategory.equals("testCat"))); } @@ -342,20 +344,20 @@ public class AllTests logMessages = logger.getLog(messageTypes, categories, 2, prefix); test(logMessages.length == 2); test(prefix.value.equals("NullLogger")); - + test(logMessages[0].message.equals("trace3")); test(logMessages[1].message.equals("error3")); - + // // Now, test RemoteLogger // - Ice.ObjectAdapter adapter = + Ice.ObjectAdapter adapter = app.communicator().createObjectAdapterWithEndpoints("RemoteLoggerAdapter", "tcp -h localhost"); - + RemoteLoggerI remoteLogger = new RemoteLoggerI(); - + Ice.RemoteLoggerPrx myProxy = Ice.RemoteLoggerPrxHelper.uncheckedCast(adapter.addWithUUID(remoteLogger)); - + adapter.activate(); // @@ -363,7 +365,7 @@ public class AllTests // logMessages = logger.getLog(null, null, -1, prefix); remoteLogger.checkNextInit(prefix.value, logMessages); - + try { logger.attachRemoteLogger(myProxy, null, null, -1); @@ -374,22 +376,22 @@ public class AllTests } 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 // @@ -407,10 +409,10 @@ public class AllTests } 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"); @@ -418,13 +420,13 @@ public class AllTests 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); } @@ -432,11 +434,11 @@ public class AllTests { // expected } - + com.destroy(); } out.println("ok"); - + out.print("testing custom facet... "); out.flush(); { diff --git a/java-compat/test/src/main/java/test/Ice/admin/Client.java b/java-compat/test/src/main/java/test/Ice/admin/Client.java index e3d4bbe677b..e769344efbe 100644 --- a/java-compat/test/src/main/java/test/Ice/admin/Client.java +++ b/java-compat/test/src/main/java/test/Ice/admin/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java-compat/test/src/main/java/test/Ice/admin/Server.java b/java-compat/test/src/main/java/test/Ice/admin/Server.java index f9ca817d7c0..bf88c2fa7ce 100644 --- a/java-compat/test/src/main/java/test/Ice/admin/Server.java +++ b/java-compat/test/src/main/java/test/Ice/admin/Server.java @@ -24,10 +24,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.admin"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/admin/run.py b/java-compat/test/src/main/java/test/Ice/admin/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/admin/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 - -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/java-compat/test/src/main/java/test/Ice/ami/AllTests.java b/java-compat/test/src/main/java/test/Ice/ami/AllTests.java index c7dbc15a539..5faf9640316 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/ami/AllTests.java @@ -34,13 +34,13 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj); - sref = "testController:default -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); @@ -61,9 +61,9 @@ public class AllTests "run", new Class<?>[] { - test.Util.Application.class, - Ice.Communicator.class, - boolean.class, + test.Util.Application.class, + Ice.Communicator.class, + boolean.class, TestIntfPrx.class, TestIntfControllerPrx.class }); diff --git a/java-compat/test/src/main/java/test/Ice/ami/Client.java b/java-compat/test/src/main/java/test/Ice/ami/Client.java index e08515e7d62..097bb922ce6 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/Client.java +++ b/java-compat/test/src/main/java/test/Ice/ami/Client.java @@ -21,8 +21,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); initData.properties.setProperty("Ice.Warn.AMICallback", "0"); diff --git a/java-compat/test/src/main/java/test/Ice/ami/Collocated.java b/java-compat/test/src/main/java/test/Ice/ami/Collocated.java index 429d4ed2dfd..e5c4aaf2dcb 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/ami/Collocated.java @@ -29,11 +29,10 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); initData.properties.setProperty("Ice.Warn.AMICallback", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/ami/Server.java b/java-compat/test/src/main/java/test/Ice/ami/Server.java index 92c745419dd..1b826ef52e9 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/Server.java +++ b/java-compat/test/src/main/java/test/Ice/ami/Server.java @@ -29,11 +29,10 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java-compat/test/src/main/java/test/Ice/ami/run.py b/java-compat/test/src/main/java/test/Ice/ami/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/ami/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() -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/background/AllTests.java b/java-compat/test/src/main/java/test/Ice/background/AllTests.java index 627b2346744..187c7bbf4f2 100644 --- a/java-compat/test/src/main/java/test/Ice/background/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/background/AllTests.java @@ -264,15 +264,18 @@ public class AllTests } public static BackgroundPrx - allTests(Configuration configuration, Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app, Configuration configuration) { - String sref = "background:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + 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); @@ -310,7 +313,7 @@ public class AllTests 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(); @@ -325,7 +328,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(); @@ -351,7 +354,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(); @@ -366,7 +369,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/java-compat/test/src/main/java/test/Ice/background/Client.java b/java-compat/test/src/main/java/test/Ice/background/Client.java index 2a4dde11aa5..528df026dba 100644 --- a/java-compat/test/src/main/java/test/Ice/background/Client.java +++ b/java-compat/test/src/main/java/test/Ice/background/Client.java @@ -17,21 +17,16 @@ public class Client extends test.Util.Application public int run(String[] args) { - Configuration configuration = new Configuration(); PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test"); - plugin.setConfiguration(configuration); - communicator().getPluginManager().initializePlugins(); - - BackgroundPrx background = AllTests.allTests(configuration, communicator(), getWriter()); + BackgroundPrx background = AllTests.allTests(this, plugin.getConfiguration()); background.shutdown(); return 0; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // For this test, we want to disable retries. // @@ -53,11 +48,8 @@ public class Client extends test.Util.Application initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory"); String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); - + initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - - // Don't initialize the plugin until I've set the configuration. - initData.properties.setProperty("Ice.InitPlugins", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/background/Collocated.java b/java-compat/test/src/main/java/test/Ice/background/Collocated.java deleted file mode 100644 index 6e4b5774ac9..00000000000 --- a/java-compat/test/src/main/java/test/Ice/background/Collocated.java +++ /dev/null @@ -1,99 +0,0 @@ -// ********************************************************************** -// -// 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. -// -// ********************************************************************** - -package test.Ice.background; - -public class Collocated extends test.Util.Application -{ - static Thread _clientThread; - static int result; - - public static void main(String[] args) - { - Collocated app = new Collocated(); - int result = app.main("Collocated", args); - System.gc(); - System.exit(result); - } - - @Override - public int - run(String[] args) - { - final Client client = new Client(); - client.setClassLoader(getClassLoader()); - client.setWriter(getWriter()); - final Server server = new Server(); - server.setClassLoader(getClassLoader()); - server.setWriter(getWriter()); - Thread t = new Thread(new Runnable() - { - @Override - public void run() - { - String[] args = - { - "--Ice.NullHandleAbort=1", - "--Ice.Warn.Connections=1", - "--Ice.ThreadPool.Server.Size=1", - "--Ice.ThreadPool.Server.SizeMax=3", - "--Ice.ThreadPool.Server.SizeWarn=0", - "--Ice.PrintAdapterReady=1", - "--Ice.ServerIdleTime=30", - "--Ice.Default.Host=127.0.0.1" - }; - server.setServerReadyListener(new test.Util.Application.ServerReadyListener() - { - @Override - public void serverReady() - { - _clientThread = new Thread(new Runnable() - { - @Override - public void run() - { - String[] args = - { - "--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1", "--Ice.Default.Host=127.0.0.1" - }; - client.main("Client", args); - } - }); - _clientThread.start(); - } - }); - - result = server.main("Server", args); - if(_clientThread != null) - { - while(_clientThread.isAlive()) - { - try - { - _clientThread.join(); - } - catch(InterruptedException e1) - { - } - } - } - } - }); - t.start(); - try - { - t.join(); - } - catch(InterruptedException ex) - { - } - - return 0; - } -} diff --git a/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java b/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java index 8a6b5022b00..311faa53a01 100644 --- a/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java +++ b/java-compat/test/src/main/java/test/Ice/background/PluginFactory.java @@ -18,12 +18,11 @@ public class PluginFactory implements Ice.PluginFactory { _communicator = communicator; } - + @Override public void initialize() { - assert _configuration != null; IceInternal.ProtocolPluginFacade facade = IceInternal.Util.getProtocolPluginFacade(_communicator); for(short s = 0; s < 100; ++s) { @@ -40,15 +39,15 @@ public class PluginFactory implements Ice.PluginFactory destroy() { } - - public void - setConfiguration(Configuration configuration) + + public Configuration + getConfiguration() { - _configuration = configuration; + return _configuration; } private final Ice.Communicator _communicator; - private Configuration _configuration; + private Configuration _configuration = new Configuration(); } @Override diff --git a/java-compat/test/src/main/java/test/Ice/background/Server.java b/java-compat/test/src/main/java/test/Ice/background/Server.java index d0e0d298506..b8be197084c 100644 --- a/java-compat/test/src/main/java/test/Ice/background/Server.java +++ b/java-compat/test/src/main/java/test/Ice/background/Server.java @@ -32,26 +32,26 @@ public class Server extends test.Util.Application _controller.checkCallPause(current); response.ice_response(current.adapter.createDirectProxy(id)); } - + @Override public Ice.LocatorRegistryPrx getRegistry(Ice.Current current) { return null; } - + LocatorI(BackgroundControllerI controller) { _controller = controller; } - + final private BackgroundControllerI _controller; } static public class RouterI extends Ice._RouterDisp { @Override - public Ice.ObjectPrx + public Ice.ObjectPrx getClientProxy(Ice.Current current) { _controller.checkCallPause(current); @@ -59,7 +59,7 @@ public class Server extends test.Util.Application } @Override - public Ice.ObjectPrx + public Ice.ObjectPrx getServerProxy(Ice.Current current) { _controller.checkCallPause(current); @@ -77,7 +77,7 @@ public class Server extends test.Util.Application { _controller = controller; } - + final private BackgroundControllerI _controller; } @@ -85,11 +85,9 @@ public class Server extends test.Util.Application public int run(String[] args) { - Configuration configuration = new Configuration(); PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test"); - plugin.setConfiguration(configuration); - communicator().getPluginManager().initializePlugins(); - + Configuration configuration = plugin.getConfiguration(); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); @@ -109,9 +107,8 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); - + Ice.InitializationData initData = super.getInitData(argsH); + // // This test kills connections, so we don't want warnings. // @@ -128,16 +125,13 @@ public class Server extends test.Util.Application initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory"); String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); - + initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1, "tcp")); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); - - // Don't initialize the plugin until I've set the configuration. - initData.properties.setProperty("Ice.InitPlugins", "0"); - + return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/background/run.py b/java-compat/test/src/main/java/test/Ice/background/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/background/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 - -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/java-compat/test/src/main/java/test/Ice/binding/AllTests.java b/java-compat/test/src/main/java/test/Ice/binding/AllTests.java index 8e5f3a1d8ff..4e13ddc9ad8 100644 --- a/java-compat/test/src/main/java/test/Ice/binding/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/binding/AllTests.java @@ -103,7 +103,7 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String ref = "communicator:default -p 12010"; + String ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref)); out.print("testing binding with single endpoint... "); @@ -880,19 +880,21 @@ public class AllTests clientProps.add(bothPreferIPv4); clientProps.add(bothPreferIPv6); + String endpoint = "tcp -p " + app.getTestPort(2); + Ice.Properties anyipv4 = ipv4._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._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._clone(); localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1"); @@ -973,7 +975,7 @@ public class AllTests } serverCommunicator.destroy(); } - + out.println("ok"); } diff --git a/java-compat/test/src/main/java/test/Ice/binding/Client.java b/java-compat/test/src/main/java/test/Ice/binding/Client.java index 0610017ff98..c8aaf91ed44 100644 --- a/java-compat/test/src/main/java/test/Ice/binding/Client.java +++ b/java-compat/test/src/main/java/test/Ice/binding/Client.java @@ -21,8 +21,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java b/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java index 5286442d092..66c5489f16b 100644 --- a/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java +++ b/java-compat/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java @@ -13,6 +13,12 @@ import test.Ice.binding.Test._RemoteCommunicatorDisp; public class RemoteCommunicatorI extends _RemoteCommunicatorDisp { + public + RemoteCommunicatorI(test.Util.Application app) + { + _app = app; + } + @Override public RemoteObjectAdapterPrx createObjectAdapter(String name, String endpts, Ice.Current current) @@ -20,11 +26,7 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp 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(); @@ -48,5 +50,6 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp current.adapter.getCommunicator().shutdown(); } - private int _nextPort = 10001; + private final test.Util.Application _app; + private int _nextPort = 10; } diff --git a/java-compat/test/src/main/java/test/Ice/binding/Server.java b/java-compat/test/src/main/java/test/Ice/binding/Server.java index 104b7e1eb03..88b1a1f26bc 100644 --- a/java-compat/test/src/main/java/test/Ice/binding/Server.java +++ b/java-compat/test/src/main/java/test/Ice/binding/Server.java @@ -18,7 +18,7 @@ public class Server extends test.Util.Application Ice.Communicator communicator = communicator(); 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(); return WAIT; @@ -27,10 +27,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/binding/run.py b/java-compat/test/src/main/java/test/Ice/binding/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/binding/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 - -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/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java b/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java index 5145912b376..e8a0327d593 100644 --- a/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/checksum/AllTests.java @@ -24,9 +24,12 @@ public class AllTests } public static ChecksumPrx - allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); diff --git a/java-compat/test/src/main/java/test/Ice/checksum/Client.java b/java-compat/test/src/main/java/test/Ice/checksum/Client.java index c98eacbdab3..bb3de61e0ec 100644 --- a/java-compat/test/src/main/java/test/Ice/checksum/Client.java +++ b/java-compat/test/src/main/java/test/Ice/checksum/Client.java @@ -18,7 +18,7 @@ public class Client extends test.Util.Application run(String[] args) { Ice.Communicator communicator = communicator(); - ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter()); + ChecksumPrx checksum = AllTests.allTests(this, false); checksum.shutdown(); return 0; } @@ -27,8 +27,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum"); return initData; } @@ -38,7 +37,7 @@ public class Client extends test.Util.Application { Client c = new Client(); int status = c.main("Client", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/Ice/checksum/Server.java b/java-compat/test/src/main/java/test/Ice/checksum/Server.java index dffecaff213..02eaad97f58 100644 --- a/java-compat/test/src/main/java/test/Ice/checksum/Server.java +++ b/java-compat/test/src/main/java/test/Ice/checksum/Server.java @@ -16,19 +16,18 @@ public class Server extends test.Util.Application run(String[] args) { Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new ChecksumI(); adapter.add(object, Ice.Util.stringToIdentity("test")); adapter.activate(); return WAIT; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum.server"); return initData; } @@ -38,7 +37,7 @@ public class Server extends test.Util.Application { Server c = new Server(); int status = c.main("Server", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/Ice/checksum/run.py b/java-compat/test/src/main/java/test/Ice/checksum/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/checksum/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 - -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/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java b/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java index f22fa4b816d..c540a6d5ae5 100644 --- a/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/classLoader/AllTests.java @@ -140,7 +140,7 @@ public class AllTests initData.classLoader = classLoader; Ice.Communicator ic = app.initialize(initData); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = ic.stringToProxy(ref); test(base != null); diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/Client.java b/java-compat/test/src/main/java/test/Ice/classLoader/Client.java index 6bf2e795ca7..5841767b82f 100644 --- a/java-compat/test/src/main/java/test/Ice/classLoader/Client.java +++ b/java-compat/test/src/main/java/test/Ice/classLoader/Client.java @@ -21,8 +21,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - _initData = createInitializationData(); - _initData.properties = Ice.Util.createProperties(argsH); + _initData = super.getInitData(argsH); _initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader"); return _initData; } diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/Server.java b/java-compat/test/src/main/java/test/Ice/classLoader/Server.java index aef65c14aa3..beb7f1afc00 100644 --- a/java-compat/test/src/main/java/test/Ice/classLoader/Server.java +++ b/java-compat/test/src/main/java/test/Ice/classLoader/Server.java @@ -26,10 +26,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Default.SlicedFormat", "1"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/classLoader/run.py b/java-compat/test/src/main/java/test/Ice/classLoader/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/classLoader/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 - -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/java-compat/test/src/main/java/test/Ice/custom/AllTests.java b/java-compat/test/src/main/java/test/Ice/custom/AllTests.java index a025deb4992..4a66d0ed598 100644 --- a/java-compat/test/src/main/java/test/Ice/custom/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/custom/AllTests.java @@ -56,11 +56,13 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/custom/Client.java b/java-compat/test/src/main/java/test/Ice/custom/Client.java index 90ec943086b..d2c043ca266 100644 --- a/java-compat/test/src/main/java/test/Ice/custom/Client.java +++ b/java-compat/test/src/main/java/test/Ice/custom/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + TestIntfPrx test = AllTests.allTests(this); test.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/custom/Collocated.java b/java-compat/test/src/main/java/test/Ice/custom/Collocated.java index 2c1e7b251f1..0710cd8ef81 100644 --- a/java-compat/test/src/main/java/test/Ice/custom/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/custom/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application Ice.Object test = new TestI(communicator); adapter.add(test, Ice.Util.stringToIdentity("test")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -27,10 +27,9 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/custom/Server.java b/java-compat/test/src/main/java/test/Ice/custom/Server.java index 8a4da565414..94f0ea206a7 100644 --- a/java-compat/test/src/main/java/test/Ice/custom/Server.java +++ b/java-compat/test/src/main/java/test/Ice/custom/Server.java @@ -27,10 +27,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/custom/run.py b/java-compat/test/src/main/java/test/Ice/custom/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/custom/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() -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java b/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java index d841881da63..0287f8dfa24 100644 --- a/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/defaultServant/AllTests.java @@ -24,9 +24,10 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost"); oa.activate(); diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java b/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java index f5956bead6b..f0cdcbeece8 100644 --- a/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java +++ b/java-compat/test/src/main/java/test/Ice/defaultServant/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java-compat/test/src/main/java/test/Ice/defaultServant/run.py b/java-compat/test/src/main/java/test/Ice/defaultServant/run.py deleted file mode 100755 index 86b25876539..00000000000 --- a/java-compat/test/src/main/java/test/Ice/defaultServant/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 client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.defaultServant.Client", "--Ice.Warn.Dispatch=0",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java b/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java index 3c669e17b5b..8a04766de10 100644 --- a/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/defaultValue/AllTests.java @@ -24,8 +24,9 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); out.print("testing default values... "); out.flush(); diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java b/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java index 7d13b0c7645..ec2c3d21842 100644 --- a/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java +++ b/java-compat/test/src/main/java/test/Ice/defaultValue/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java-compat/test/src/main/java/test/Ice/defaultValue/run.py b/java-compat/test/src/main/java/test/Ice/defaultValue/run.py deleted file mode 100755 index 06a587612d9..00000000000 --- a/java-compat/test/src/main/java/test/Ice/defaultValue/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.defaultValue.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java b/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java index 31116ccb013..dc6849215ac 100644 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/dispatcher/AllTests.java @@ -63,10 +63,12 @@ public class AllTests } } - public static void - allTests(Ice.Communicator communicator, PrintWriter out, final Dispatcher dispatcher) + public static void allTests(test.Util.Application app, final Dispatcher dispatcher) { - String sref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); @@ -78,7 +80,7 @@ public class AllTests TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1, "tcp"); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java index 3cfb7a56697..fec7ba74f57 100644 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java +++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(communicator(), getWriter(), _dispatcher); + AllTests.allTests(this, _dispatcher); return 0; } @@ -23,8 +23,7 @@ public class Client extends test.Util.Application { assert(_dispatcher == null); _dispatcher = new Dispatcher(); - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); // diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java index 230321ada51..f8dc464b4df 100644 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Collocated.java @@ -23,7 +23,7 @@ public class Collocated extends test.Util.Application adapter2.add(new TestControllerI(adapter), Ice.Util.stringToIdentity("testController")); //adapter2.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator(), getWriter(), _dispatcher); + AllTests.allTests(this, _dispatcher); return 0; } @@ -32,11 +32,10 @@ public class Collocated extends test.Util.Application { assert(_dispatcher == null); _dispatcher = new Dispatcher(); - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1, "tcp")); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); initData.dispatcher = _dispatcher; return initData; diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java b/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java index d962bbe1e28..29025ed9e0b 100644 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java +++ b/java-compat/test/src/main/java/test/Ice/dispatcher/Server.java @@ -32,11 +32,10 @@ public class Server extends test.Util.Application { assert(_dispatcher == null); _dispatcher = new Dispatcher(); - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1, "tcp")); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java-compat/test/src/main/java/test/Ice/dispatcher/run.py b/java-compat/test/src/main/java/test/Ice/dispatcher/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/dispatcher/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() -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/echo/Server.java b/java-compat/test/src/main/java/test/Ice/echo/Server.java index 07648551d38..f89ea79ffd5 100644 --- a/java-compat/test/src/main/java/test/Ice/echo/Server.java +++ b/java-compat/test/src/main/java/test/Ice/echo/Server.java @@ -17,19 +17,19 @@ public class Server extends test.Util.Application { _blob = blob; } - + @Override public void startBatch(Ice.Current current) { _blob.startBatch(); } - + @Override public void flushBatch(Ice.Current current) { _blob.flushBatch(); } - + @Override public void shutdown(Ice.Current current) { @@ -42,7 +42,7 @@ public class Server extends test.Util.Application @Override public 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"); BlobjectI blob = new BlobjectI(); adapter.addDefaultServant(blob, ""); @@ -54,8 +54,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.echo"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/echo/run.py b/java-compat/test/src/main/java/test/Ice/echo/run.py deleted file mode 100755 index 3f861533410..00000000000 --- a/java-compat/test/src/main/java/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() -p = TestUtil.startServer("test.Ice.echo.Server") -print("ok") -sys.stdout.flush() - -p.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/enums/AllTests.java b/java-compat/test/src/main/java/test/Ice/enums/AllTests.java index 9f2ad470db6..b47586aa254 100644 --- a/java-compat/test/src/main/java/test/Ice/enums/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/enums/AllTests.java @@ -24,9 +24,11 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); TestIntfPrx proxy = TestIntfPrxHelper.checkedCast(obj); diff --git a/java-compat/test/src/main/java/test/Ice/enums/Client.java b/java-compat/test/src/main/java/test/Ice/enums/Client.java index a27198b8b66..0f7d7d70599 100644 --- a/java-compat/test/src/main/java/test/Ice/enums/Client.java +++ b/java-compat/test/src/main/java/test/Ice/enums/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + TestIntfPrx test = AllTests.allTests(this); test.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/enums/Server.java b/java-compat/test/src/main/java/test/Ice/enums/Server.java index 69c4bf6459e..d48272c54af 100644 --- a/java-compat/test/src/main/java/test/Ice/enums/Server.java +++ b/java-compat/test/src/main/java/test/Ice/enums/Server.java @@ -27,10 +27,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/enums/run.py b/java-compat/test/src/main/java/test/Ice/enums/run.py deleted file mode 100755 index 1b234c88804..00000000000 --- a/java-compat/test/src/main/java/test/Ice/enums/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 = "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/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java b/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java index 42c57ad2209..82f8035da5f 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/AMDServer.java @@ -31,22 +31,20 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - // + Ice.InitializationData initData = super.getInitData(argsH); // For this test, we need a dummy logger, otherwise the // assertion test will print an error message. // initData.logger = new DummyLogger(); - initData.properties = Ice.Util.createProperties(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); + initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); + initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(initData.properties, 2)); initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java b/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java index b417b1a427d..d00bd7bef7c 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/AllTests.java @@ -721,8 +721,10 @@ public class AllTests } public static ThrowerPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); { out.print("testing object adapter registration exceptions... "); Ice.ObjectAdapter first; @@ -842,7 +844,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "thrower:default -p 12010"; + String ref = "thrower:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -1140,7 +1142,7 @@ public class AllTests } 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) @@ -1149,7 +1151,7 @@ public class AllTests { } 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/java-compat/test/src/main/java/test/Ice/exceptions/Client.java b/java-compat/test/src/main/java/test/Ice/exceptions/Client.java index 741de95a736..38e20cef122 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/Client.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - ThrowerPrx thrower = AllTests.allTests(communicator, getWriter()); + ThrowerPrx thrower = AllTests.allTests(this); thrower.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java b/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java index 87f9e730a2d..17372282644 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/Collocated.java @@ -20,7 +20,7 @@ public class Collocated extends test.Util.Application Ice.Object object = new ThrowerI(); adapter.add(object, Ice.Util.stringToIdentity("thrower")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -28,19 +28,17 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - // + Ice.InitializationData initData = super.getInitData(argsH); // For this test, we need a dummy logger, otherwise the // assertion test will print an error message. // initData.logger = new DummyLogger(); - initData.properties = Ice.Util.createProperties(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/Server.java b/java-compat/test/src/main/java/test/Ice/exceptions/Server.java index d510ac1216f..5bb040bfc79 100644 --- a/java-compat/test/src/main/java/test/Ice/exceptions/Server.java +++ b/java-compat/test/src/main/java/test/Ice/exceptions/Server.java @@ -31,22 +31,20 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - // + Ice.InitializationData initData = super.getInitData(argsH); // For this test, we need a dummy logger, otherwise the // assertion test will print an error message. // initData.logger = new DummyLogger(); - initData.properties = Ice.Util.createProperties(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); + initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); + initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(initData.properties, 2)); initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/exceptions/run.py b/java-compat/test/src/main/java/test/Ice/exceptions/run.py deleted file mode 100755 index 65b4b4d0e93..00000000000 --- a/java-compat/test/src/main/java/test/Ice/exceptions/run.py +++ /dev/null @@ -1,51 +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 = "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="test.Ice.exceptions.AMDServer") - -TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True, - message = "Running test with sliced format and AMD server.", - server="test.Ice.exceptions.AMDServer", - 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="test.Ice.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/facets/AllTests.java b/java-compat/test/src/main/java/test/Ice/facets/AllTests.java index 6292a77109f..bd3f25bb6b5 100644 --- a/java-compat/test/src/main/java/test/Ice/facets/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/facets/AllTests.java @@ -32,8 +32,10 @@ public class AllTests } public static GPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing Ice.Admin.Facets property... "); test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").length == 0); communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); @@ -112,7 +114,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "d:default -p 12010"; + String ref = "d:" + app.getTestEndpoint(0); Ice.ObjectPrx db = communicator.stringToProxy(ref); test(db != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/facets/Client.java b/java-compat/test/src/main/java/test/Ice/facets/Client.java index a67a11d734f..4ba98ba65ff 100644 --- a/java-compat/test/src/main/java/test/Ice/facets/Client.java +++ b/java-compat/test/src/main/java/test/Ice/facets/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - GPrx g = AllTests.allTests(communicator, getWriter()); + GPrx g = AllTests.allTests(this); g.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/facets/Collocated.java b/java-compat/test/src/main/java/test/Ice/facets/Collocated.java index 4d72172d030..51d798fc036 100644 --- a/java-compat/test/src/main/java/test/Ice/facets/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/facets/Collocated.java @@ -15,7 +15,7 @@ public class Collocated extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + 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")); @@ -25,7 +25,7 @@ public class Collocated extends test.Util.Application Ice.Object h = new HI(communicator); adapter.addFacet(h, Ice.Util.stringToIdentity("d"), "facetGH"); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -33,8 +33,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/facets/Server.java b/java-compat/test/src/main/java/test/Ice/facets/Server.java index 533db9e28e3..a19c23865c5 100644 --- a/java-compat/test/src/main/java/test/Ice/facets/Server.java +++ b/java-compat/test/src/main/java/test/Ice/facets/Server.java @@ -32,10 +32,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/facets/run.py b/java-compat/test/src/main/java/test/Ice/facets/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/facets/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() -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java index 30550745185..4bd0cbd424d 100644 --- a/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/AllTests.java @@ -47,10 +47,10 @@ public class AllTests { } } - + _called = false; } - + public synchronized void called() { @@ -71,20 +71,20 @@ public class AllTests _pid = pid; callback.called(); } - + @Override public void exception(Ice.LocalException ex) { test(false); } - + public int pid() { return _pid; } - + public void check() { @@ -92,10 +92,10 @@ public class AllTests } private int _pid; - + private Callback callback = new Callback(); } - + private static class Callback_TestIntf_shutdownI extends Callback_TestIntf_shutdown { @Override @@ -104,14 +104,14 @@ public class AllTests { callback.called(); } - + @Override public void exception(Ice.LocalException ex) { test(false); } - + public void check() { @@ -120,7 +120,7 @@ public class AllTests private Callback callback = new Callback(); } - + private static class AbortCallback extends Ice.Callback { @Override @@ -155,7 +155,7 @@ public class AllTests } callback.called(); } - + public void check() { @@ -164,16 +164,19 @@ public class AllTests private Callback callback = new Callback(); } - + public static void - allTests(Ice.Communicator communicator, int[] ports, PrintWriter out) + allTests(test.Util.Application app, int[] ports) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); String ref = "test"; for(int port : ports) { - ref += ":default -p " + port; + ref += ":" + app.getTestEndpoint(port); } Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java index 9a350872820..c4af1ebb5dd 100644 --- a/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java +++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/Client.java @@ -25,7 +25,7 @@ public class Client extends test.Util.Application run(String[] args) { PrintWriter out = getWriter(); - + Ice.Communicator communicator = communicator(); java.util.List<Integer> ports = new java.util.ArrayList<Integer>(args.length); for(String arg : args) @@ -70,7 +70,7 @@ public class Client extends test.Util.Application try { - AllTests.allTests(communicator, arr, out); + AllTests.allTests(this, arr); } catch(Ice.LocalException ex) { @@ -84,8 +84,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance"); // // This test aborts servers, so we don't want warnings. diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java b/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java index 56e4041a168..1fbda32e6f9 100644 --- a/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java +++ b/java-compat/test/src/main/java/test/Ice/faultTolerance/Server.java @@ -62,7 +62,7 @@ public class Server extends test.Util.Application } // Don't move this, it needs the port. - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(port)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new TestI(port); adapter.add(object, Ice.Util.stringToIdentity("test")); @@ -73,8 +73,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance"); // Two minutes. initData.properties.setProperty("Ice.ServerIdleTime", "120"); diff --git a/java-compat/test/src/main/java/test/Ice/faultTolerance/run.py b/java-compat/test/src/main/java/test/Ice/faultTolerance/run.py deleted file mode 100755 index f3e808802b0..00000000000 --- a/java-compat/test/src/main/java/test/Ice/faultTolerance/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 - -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("test.Ice.faultTolerance.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("test.Ice.faultTolerance.Client", ports, startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/hash/Client.java b/java-compat/test/src/main/java/test/Ice/hash/Client.java index 7859559f9ad..12d711fc51a 100644 --- a/java-compat/test/src/main/java/test/Ice/hash/Client.java +++ b/java-compat/test/src/main/java/test/Ice/hash/Client.java @@ -48,7 +48,7 @@ public class Client extends test.Util.Application int maxCollisions = 10; int maxIterations = 10000; - Ice.InitializationData initData = createInitializationData() ; + Ice.InitializationData initData = createInitializationData(); initData.properties = Ice.Util.createProperties(args); initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory"); Ice.Communicator communicator = Ice.Util.initialize(args, initData); @@ -57,8 +57,8 @@ public class Client extends test.Util.Application out.flush(); { java.util.Random rand = new java.util.Random(); - for(i = 0; proxyCollisions < maxCollisions && - endpointCollisions < maxCollisions && + for(i = 0; proxyCollisions < maxCollisions && + endpointCollisions < maxCollisions && i < maxIterations; ++i) { java.io.StringWriter sw = new java.io.StringWriter(); @@ -86,7 +86,7 @@ public class Client extends test.Util.Application { seenProxy.put(obj.hashCode(), obj); } - + java.util.Iterator<Ice.Endpoint> j = endpoints.iterator(); while(j.hasNext()) { @@ -118,8 +118,8 @@ public class Client extends test.Util.Application proxyCollisions = 0; seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>(); - for(i = 0; proxyCollisions < maxCollisions && - endpointCollisions < maxCollisions && + for(i = 0; proxyCollisions < maxCollisions && + endpointCollisions < maxCollisions && i < maxIterations; ++i) { java.io.StringWriter sw = new java.io.StringWriter(); @@ -151,8 +151,8 @@ public class Client extends test.Util.Application proxyCollisions = 0; seenProxy = new java.util.HashMap<Integer, Ice.ObjectPrx>(); - for(i = 0; proxyCollisions < maxCollisions && - endpointCollisions < maxCollisions && + for(i = 0; proxyCollisions < maxCollisions && + endpointCollisions < maxCollisions && i < maxIterations; ++i) { java.io.StringWriter sw = new java.io.StringWriter(); @@ -388,7 +388,7 @@ public class Client extends test.Util.Application test(c.hashCode() == c.hashCode()); } test(structCollisions < maxCollisions); - + structCollisions = 0; java.util.Map<Integer, Draw> seenDraw = new java.util.HashMap<Integer, Draw>(); structCollisions = 0; @@ -396,7 +396,7 @@ public class Client extends test.Util.Application { Draw draw = new Draw( new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)), - new Pen(rand.nextInt(10), + new Pen(rand.nextInt(10), new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255), rand.nextInt(255))), false); @@ -420,7 +420,7 @@ public class Client extends test.Util.Application test(structCollisions < maxCollisions); } out.println("ok"); - + if(communicator != null) { try diff --git a/java-compat/test/src/main/java/test/Ice/hash/run.py b/java-compat/test/src/main/java/test/Ice/hash/run.py deleted file mode 100755 index 5175a3d1877..00000000000 --- a/java-compat/test/src/main/java/test/Ice/hash/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.simpleTest("test.Ice.hash.Client") - diff --git a/java-compat/test/src/main/java/test/Ice/hold/AllTests.java b/java-compat/test/src/main/java/test/Ice/hold/AllTests.java index 1086e9a5875..b27fbaf331c 100644 --- a/java-compat/test/src/main/java/test/Ice/hold/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/hold/AllTests.java @@ -32,7 +32,7 @@ public class AllTests { _value = value; } - + synchronized public void set(boolean value) { @@ -44,7 +44,7 @@ public class AllTests { return _value; } - + private boolean _value; }; @@ -84,19 +84,21 @@ public class AllTests }; public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.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); out.println("ok"); - + out.print("testing checked cast... "); out.flush(); HoldPrx hold = HoldPrxHelper.checkedCast(base); @@ -108,7 +110,7 @@ public class AllTests test(holdSerialized != null); test(holdSerialized.equals(baseSerialized)); out.println("ok"); - + out.print("changing state between active and hold rapidly... "); out.flush(); for(int i = 0; i < 100; ++i) @@ -128,7 +130,7 @@ public class AllTests holdSerializedOneway.putOnHold(0); } out.println("ok"); - + out.print("testing without serialize mode... "); out.flush(); java.util.Random random = new java.util.Random(); @@ -227,7 +229,7 @@ public class AllTests hold.putOnHold(-1); hold.ice_ping(); hold.putOnHold(-1); - hold.ice_ping(); + hold.ice_ping(); } out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/hold/Client.java b/java-compat/test/src/main/java/test/Ice/hold/Client.java index 28c45f9aa08..d34f2bf89df 100644 --- a/java-compat/test/src/main/java/test/Ice/hold/Client.java +++ b/java-compat/test/src/main/java/test/Ice/hold/Client.java @@ -14,15 +14,14 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/hold/Server.java b/java-compat/test/src/main/java/test/Ice/hold/Server.java index 2d3a1cf9652..d398b6efc15 100644 --- a/java-compat/test/src/main/java/test/Ice/hold/Server.java +++ b/java-compat/test/src/main/java/test/Ice/hold/Server.java @@ -37,16 +37,15 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold"); - initData.properties.setProperty("TestAdapter1.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter1.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("TestAdapter1.ThreadPool.Size", "5"); initData.properties.setProperty("TestAdapter1.ThreadPool.SizeMax", "5"); initData.properties.setProperty("TestAdapter1.ThreadPool.SizeWarn", "0"); initData.properties.setProperty("TestAdapter1.ThreadPool.Serialize", "0"); - initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011:udp"); + initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(initData.properties, 1) + ":udp"); initData.properties.setProperty("TestAdapter2.ThreadPool.Size", "5"); initData.properties.setProperty("TestAdapter2.ThreadPool.SizeMax", "5"); initData.properties.setProperty("TestAdapter2.ThreadPool.SizeWarn", "0"); diff --git a/java-compat/test/src/main/java/test/Ice/hold/run.py b/java-compat/test/src/main/java/test/Ice/hold/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/hold/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 - -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/java-compat/test/src/main/java/test/Ice/info/AllTests.java b/java-compat/test/src/main/java/test/Ice/info/AllTests.java index c2e3b3022f2..4de2a87c2ff 100644 --- a/java-compat/test/src/main/java/test/Ice/info/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/info/AllTests.java @@ -51,9 +51,10 @@ public class AllTests return null; } - public static void - allTests(Ice.Communicator communicator, PrintWriter out) + public static void allTests(test.Util.Application app) { + Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing proxy endpoint information... "); out.flush(); { @@ -124,8 +125,9 @@ public class AllTests 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(); @@ -136,26 +138,29 @@ public class AllTests for(Ice.Endpoint endpoint : 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(); } out.println("ok"); - Ice.ObjectPrx base = communicator.stringToProxy("test:default -p 12010:udp -p 12010"); + Ice.ObjectPrx base = communicator.stringToProxy("test:" + + app.getTestEndpoint(0) + ":" + + app.getTestEndpoint(0, "udp")); TestIntfPrx testIntf = TestIntfPrxHelper.checkedCast(base); + int endpointPort = app.getTestPort(0); out.print("test connection endpoint information... "); out.flush(); { 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)); @@ -167,7 +172,7 @@ public class AllTests 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)); } out.println("ok"); @@ -182,7 +187,7 @@ public class AllTests test(!info.incoming); test(info.adapterName.length() == 0); test(info.localPort > 0); - test(info.remotePort == 12010); + test(info.remotePort == endpointPort); if(defaultHost.equals("127.0.0.1")) { test(info.remoteAddress.equals(defaultHost)); @@ -221,7 +226,7 @@ public class AllTests 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")) { test(udpinfo.remoteAddress.equals(defaultHost)); diff --git a/java-compat/test/src/main/java/test/Ice/info/Client.java b/java-compat/test/src/main/java/test/Ice/info/Client.java index 600b5008bd4..83cc5bfc748 100644 --- a/java-compat/test/src/main/java/test/Ice/info/Client.java +++ b/java-compat/test/src/main/java/test/Ice/info/Client.java @@ -14,15 +14,14 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(communicator(), getWriter()); + AllTests.allTests(this); return 0; } @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.info"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/info/Server.java b/java-compat/test/src/main/java/test/Ice/info/Server.java index 455e21046d0..e2d887c63d2 100644 --- a/java-compat/test/src/main/java/test/Ice/info/Server.java +++ b/java-compat/test/src/main/java/test/Ice/info/Server.java @@ -24,10 +24,11 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(initData.properties, 0) + ":" + + getTestEndpoint(initData.properties, 1, "udp")); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/info/run.py b/java-compat/test/src/main/java/test/Ice/info/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/info/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 - -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/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java b/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java index 360cc09b725..f07609ff95b 100644 --- a/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/inheritance/AllTests.java @@ -34,11 +34,13 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -82,7 +84,7 @@ public class AllTests CAPrx cao; CBPrx cbo; CCPrx cco; - + cao = ca.caop(ca); test(cao.equals(ca)); cao = ca.caop(cb); @@ -101,7 +103,7 @@ public class AllTests test(cao.equals(cb)); cao = cc.caop(cc); test(cao.equals(cc)); - + cao = cb.cbop(cb); test(cao.equals(cb)); cbo = cb.cbop(cb); diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Client.java b/java-compat/test/src/main/java/test/Ice/inheritance/Client.java index 704cf503752..95259642bb4 100644 --- a/java-compat/test/src/main/java/test/Ice/inheritance/Client.java +++ b/java-compat/test/src/main/java/test/Ice/inheritance/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - InitialPrx initial = AllTests.allTests(communicator, getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java b/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java index ac600d8f32c..0841800b3ea 100644 --- a/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/inheritance/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application Ice.Object object = new InitialI(adapter); adapter.add(object, Ice.Util.stringToIdentity("initial")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -27,10 +27,9 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/Server.java b/java-compat/test/src/main/java/test/Ice/inheritance/Server.java index a826ae1ec2f..591a55beabc 100644 --- a/java-compat/test/src/main/java/test/Ice/inheritance/Server.java +++ b/java-compat/test/src/main/java/test/Ice/inheritance/Server.java @@ -25,10 +25,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/inheritance/run.py b/java-compat/test/src/main/java/test/Ice/inheritance/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/inheritance/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() -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/Client.java b/java-compat/test/src/main/java/test/Ice/interceptor/Client.java index 4440dc5e889..dd719e5fb28 100644 --- a/java-compat/test/src/main/java/test/Ice/interceptor/Client.java +++ b/java-compat/test/src/main/java/test/Ice/interceptor/Client.java @@ -246,8 +246,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.interceptor"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/run.py b/java-compat/test/src/main/java/test/Ice/interceptor/run.py deleted file mode 100755 index 99d35706c32..00000000000 --- a/java-compat/test/src/main/java/test/Ice/interceptor/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 client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.interceptor.Client", "--Ice.Warn.Dispatch=0",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java b/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java index 0644cf92fef..8d954f051ec 100644 --- a/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/interrupt/AllTests.java @@ -62,7 +62,7 @@ public class AllTests private boolean _called = false; } - + private static void test(boolean b) { @@ -71,7 +71,7 @@ public class AllTests throw new RuntimeException(); } } - + private static void failIfNotInterrupted() { if(Thread.currentThread().isInterrupted()) @@ -90,13 +90,13 @@ public class AllTests { Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); final TestIntfPrx p = TestIntfPrxHelper.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); @@ -144,7 +144,7 @@ public class AllTests { cb.called(); } - + @Override public void exception(Ice.LocalException ex) { @@ -282,7 +282,7 @@ public class AllTests { // Expected } - + // end_ should still work. p.end_op(r); } @@ -305,7 +305,7 @@ public class AllTests { // Expected } - + // end_ should still work. p.end_op(r); } @@ -361,7 +361,7 @@ public class AllTests r.waitForCompleted(); p.end_opWithPayload(r); } - + // // The executor is all done. // @@ -372,16 +372,16 @@ public class AllTests } } out.println("ok"); - + if(p.ice_getCachedConnection() != null) { out.print("testing getConnection interrupt... "); out.flush(); { final Thread mainThread = Thread.currentThread(); - + p.ice_getConnection().close(false); - + AsyncResult r = p.begin_ice_getConnection(); mainThread.interrupt(); try @@ -393,9 +393,9 @@ public class AllTests { // Expected } - + p.ice_getConnection().close(false); - + final CallbackBase cb = new CallbackBase(); mainThread.interrupt(); p.begin_ice_getConnection(new Callback_Object_ice_getConnection() @@ -405,7 +405,7 @@ public class AllTests { test(false); } - + @Override public void response(Connection con) { @@ -427,7 +427,7 @@ public class AllTests p2.op(); p2.op(); p2.op(); - + AsyncResult r = p2.begin_ice_flushBatchRequests(); mainThread.interrupt(); try @@ -439,10 +439,10 @@ public class AllTests { // Expected } - + + p2.op(); p2.op(); p2.op(); - p2.op(); final CallbackBase cb = new CallbackBase(); mainThread.interrupt(); @@ -461,7 +461,7 @@ public class AllTests } }); test(Thread.interrupted()); - cb.check(); + cb.check(); } out.println("ok"); @@ -472,11 +472,11 @@ public class AllTests { final TestIntfPrx p2 = TestIntfPrxHelper.uncheckedCast(p.ice_batchOneway()); final Thread mainThread = Thread.currentThread(); - + p2.op(); p2.op(); p2.op(); - + AsyncResult r = p2.ice_getConnection().begin_flushBatchRequests(); mainThread.interrupt(); try @@ -488,11 +488,11 @@ public class AllTests { // Expected } - + + p2.op(); p2.op(); p2.op(); - p2.op(); - + final CallbackBase cb = new CallbackBase(); Ice.Connection con = p2.ice_getConnection(); mainThread.interrupt(); @@ -503,7 +503,7 @@ public class AllTests { cb.called(); } - + @Override public void exception(LocalException ex) { @@ -515,7 +515,7 @@ public class AllTests } out.println("ok"); } - + out.print("testing batch communicator flush interrupt... "); out.flush(); { @@ -525,7 +525,7 @@ public class AllTests p2.op(); p2.op(); p2.op(); - + AsyncResult r = communicator.begin_flushBatchRequests(); mainThread.interrupt(); try @@ -537,11 +537,11 @@ public class AllTests { // Expected } - + p2.op(); p2.op(); - p2.op(); - + p2.op(); + final CallbackBase cb = new CallbackBase(); mainThread.interrupt(); communicator.begin_flushBatchRequests(new Callback_Communicator_flushBatchRequests() @@ -573,8 +573,8 @@ public class AllTests Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); Ice.Communicator ic = app.initialize(initData); - - Thread.currentThread().interrupt(); + + Thread.currentThread().interrupt(); try { ic.destroy(); @@ -587,17 +587,17 @@ public class AllTests ic.destroy(); ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(2); - + ic = app.initialize(initData); Ice.ObjectPrx o = ic.stringToProxy(p.toString()); - + final Thread[] thread = new Thread[1]; final CallbackBase cb = new CallbackBase(); final TestIntfPrx p2 = TestIntfPrxHelper.checkedCast(o); final CountDownLatch waitSignal = new CountDownLatch(1); p2.begin_op(new Callback_TestIntf_op() - { + { @Override public void response() { @@ -622,12 +622,12 @@ public class AllTests } cb.called(); } - + @Override public void exception(Ice.LocalException ex) { test(false); - + } }); executor.submit(new Runnable() { @@ -645,7 +645,7 @@ public class AllTests thread[0].interrupt(); } }); - + try { waitSignal.await(); @@ -657,7 +657,7 @@ public class AllTests ic.destroy(); cb.check(); - + executor.shutdown(); while(!executor.isTerminated()) { @@ -677,10 +677,10 @@ public class AllTests { test(false); } - + @Override public void exception(Ice.LocalException ex) - { + { test(false); } @@ -718,7 +718,7 @@ public class AllTests ExecutorService executor = java.util.concurrent.Executors.newFixedThreadPool(1); Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); - initData.properties.setProperty("ClientTestAdapter.Endpoints", "default -p 12030"); + initData.properties.setProperty("ClientTestAdapter.Endpoints", "default"); Ice.Communicator ic = app.initialize(initData); final Ice.ObjectAdapter adapter = ic.createObjectAdapter("ClientTestAdapter"); adapter.activate(); @@ -769,7 +769,7 @@ public class AllTests test(false); } mainThread.interrupt(); - } + } }; executor.execute(interruptMainThread); @@ -806,7 +806,7 @@ public class AllTests } ic.destroy(); - + executor.shutdown(); while(!executor.isTerminated()) { @@ -814,7 +814,7 @@ public class AllTests } } out.println("ok"); - + p.shutdown(); } } diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Client.java b/java-compat/test/src/main/java/test/Ice/interrupt/Client.java index 371286e2b20..9ca60d0a905 100644 --- a/java-compat/test/src/main/java/test/Ice/interrupt/Client.java +++ b/java-compat/test/src/main/java/test/Ice/interrupt/Client.java @@ -29,8 +29,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt"); // // We need to enable the ThreadInterruptSafe property so that Ice is diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java b/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java index 61d24074a80..56ba300f47a 100644 --- a/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/interrupt/Collocated.java @@ -38,8 +38,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt"); // // We need to enable the ThreadInterruptSafe property so that Ice is @@ -51,11 +50,11 @@ public class Collocated extends test.Util.Application // buffers to fill up. // initData.properties.setProperty("Ice.MessageSizeMax", "20000"); - - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); - + return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/Server.java b/java-compat/test/src/main/java/test/Ice/interrupt/Server.java index 0ab16417b99..715004a1307 100644 --- a/java-compat/test/src/main/java/test/Ice/interrupt/Server.java +++ b/java-compat/test/src/main/java/test/Ice/interrupt/Server.java @@ -30,8 +30,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.interrupt"); // // We need to enable the ThreadInterruptSafe property so that Ice is @@ -49,8 +48,8 @@ public class Server extends test.Util.Application // initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); + initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(initData.properties, 1)); initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java-compat/test/src/main/java/test/Ice/interrupt/run.py b/java-compat/test/src/main/java/test/Ice/interrupt/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/interrupt/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() -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java b/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java index ab7a1a20cf1..d370d7afab3 100644 --- a/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/invoke/AllTests.java @@ -233,9 +233,11 @@ public class AllTests } public static MyClassPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrxHelper.checkedCast(base); MyClassPrx oneway = MyClassPrxHelper.uncheckedCast(cl.ice_oneway()); diff --git a/java-compat/test/src/main/java/test/Ice/invoke/Client.java b/java-compat/test/src/main/java/test/Ice/invoke/Client.java index dc376487ffe..7ccfebdbdf0 100644 --- a/java-compat/test/src/main/java/test/Ice/invoke/Client.java +++ b/java-compat/test/src/main/java/test/Ice/invoke/Client.java @@ -16,19 +16,19 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - MyClassPrx myClass = AllTests.allTests(communicator(), getWriter()); - + MyClassPrx myClass = AllTests.allTests(this); + // // Use reflection to load lambda.AllTests as that is only supported with Java >= 1.8 - // + // try { Class<?> cls = IceInternal.Util.findClass("test.Ice.invoke.lambda.AllTests", null); if(cls != null) { - java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests", - new Class<?>[]{Ice.Communicator.class, java.io.PrintWriter.class}); - allTests.invoke(null, communicator(), getWriter()); + java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests", + new Class<?>[]{test.Util.Application.class}); + allTests.invoke(null, this); } } catch(java.lang.NoSuchMethodException ex) @@ -43,7 +43,7 @@ public class Client extends test.Util.Application { throw new RuntimeException(ex); } - + myClass.shutdown(); return 0; @@ -52,8 +52,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/invoke/Server.java b/java-compat/test/src/main/java/test/Ice/invoke/Server.java index 9ce06acc55b..60c8d65791d 100644 --- a/java-compat/test/src/main/java/test/Ice/invoke/Server.java +++ b/java-compat/test/src/main/java/test/Ice/invoke/Server.java @@ -23,7 +23,7 @@ public class Server extends test.Util.Application } } - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.addServantLocator(new ServantLocatorI(async), ""); adapter.activate(); @@ -33,8 +33,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.invoke"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java b/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java index 49af565024c..c1bc1c8bc17 100644 --- a/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/invoke/lambda/AllTests.java @@ -26,7 +26,7 @@ public class AllTests throw new RuntimeException(); } } - + private static class Callback { Callback() @@ -156,9 +156,11 @@ public class AllTests } public static MyClassPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrxHelper.checkedCast(base); MyClassPrx oneway = MyClassPrxHelper.uncheckedCast(cl.ice_oneway()); @@ -172,7 +174,7 @@ public class AllTests outS.writeString(testString); outS.endEncapsulation(); byte[] inEncaps = outS.finished(); - + // begin_ice_invoke with Callback_Object_ice_invoke Callback_Object_opStringI cb2 = new Callback_Object_opStringI(communicator); cl.begin_ice_invoke("opString", Ice.OperationMode.Normal, inEncaps, diff --git a/java-compat/test/src/main/java/test/Ice/invoke/run.py b/java-compat/test/src/main/java/test/Ice/invoke/run.py deleted file mode 100755 index cc257835523..00000000000 --- a/java-compat/test/src/main/java/test/Ice/invoke/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(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/java-compat/test/src/main/java/test/Ice/location/AllTests.java b/java-compat/test/src/main/java/test/Ice/location/AllTests.java index 06eae325c60..8b6d3fb74ee 100644 --- a/java-compat/test/src/main/java/test/Ice/location/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/location/AllTests.java @@ -43,7 +43,7 @@ public class AllTests PrintWriter out = app.getWriter(); 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()); diff --git a/java-compat/test/src/main/java/test/Ice/location/Client.java b/java-compat/test/src/main/java/test/Ice/location/Client.java index e792640fb08..9f7d3464afa 100644 --- a/java-compat/test/src/main/java/test/Ice/location/Client.java +++ b/java-compat/test/src/main/java/test/Ice/location/Client.java @@ -40,10 +40,9 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); - initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); + initData.properties.setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/location/Server.java b/java-compat/test/src/main/java/test/Ice/location/Server.java index 1a3a98351be..ac03dd65434 100644 --- a/java-compat/test/src/main/java/test/Ice/location/Server.java +++ b/java-compat/test/src/main/java/test/Ice/location/Server.java @@ -17,7 +17,7 @@ public class Server extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - + // // Register the server manager. The server manager creates a new // 'server' (a server isn't a different process, it's just a new @@ -49,12 +49,11 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2"); initData.properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0"); - initData.properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("ServerManagerAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); _initData = initData; return initData; diff --git a/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java b/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java index 293b9dcfb97..bbd4fbcb1d3 100644 --- a/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java +++ b/java-compat/test/src/main/java/test/Ice/location/ServerManagerI.java @@ -19,10 +19,10 @@ public class ServerManagerI extends _ServerManagerDisp { _registry = registry; _communicators = new java.util.ArrayList<Ice.Communicator>(); - + _app = app; _initData = initData; - + _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter"); _initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); _initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2"); @@ -54,13 +54,13 @@ public class ServerManagerI extends _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)); @@ -68,7 +68,7 @@ public class ServerManagerI extends _ServerManagerDisp _registry.addObject(adapter.add(object, Ice.Util.stringToIdentity("test"))); _registry.addObject(adapter.add(object, Ice.Util.stringToIdentity("test2"))); adapter.add(object, Ice.Util.stringToIdentity("test3")); - + adapter.activate(); adapter2.activate(); } @@ -88,5 +88,5 @@ public class ServerManagerI extends _ServerManagerDisp private java.util.List<Ice.Communicator> _communicators; private Ice.InitializationData _initData; private test.Util.Application _app; - private int _nextPort = 12011; + private int _nextPort = 1; } diff --git a/java-compat/test/src/main/java/test/Ice/location/run.py b/java-compat/test/src/main/java/test/Ice/location/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/location/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 - -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/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java b/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java index c936ca8d989..b6dc5ba4099 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/AMDServer.java @@ -18,8 +18,8 @@ public class AMDServer extends test.Util.Application Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new AMDMetricsI(), Ice.Util.stringToIdentity("metrics")); adapter.activate(); - - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); @@ -30,10 +30,9 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + 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"); diff --git a/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java b/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java index 52f450eca64..654250f6a43 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/AllTests.java @@ -25,8 +25,12 @@ public class AllTests } } - static IceMX.ConnectionMetrics - getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected) + static String getPort(Ice.PropertiesAdminPrx p) + { + return Integer.toString(test.Util.Application.getTestPort(p.ice_getCommunicator().getProperties(), 0)); + } + + static IceMX.ConnectionMetrics getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected) { try { @@ -129,7 +133,7 @@ public class AllTests map += "Map." + m + '.'; } props.put("IceMX.Metrics.View." + map + "Reject.parent", "Ice\\.Admin"); - props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", "12010"); + props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", getPort(p)); props.put("IceMX.Metrics.View." + map + "Reject.identity", ".*/admin|controller"); return props; } @@ -152,7 +156,7 @@ public class AllTests map += "Map." + m + '.'; } props.put("IceMX.Metrics.View." + map + "Reject.parent", "Ice\\.Admin|Controller"); - props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", "12010"); + props.put("IceMX.Metrics.View." + map + "Accept.endpointPort", getPort(p)); return props; } @@ -438,11 +442,19 @@ public class AllTests return m; } - static MetricsPrx - allTests(Ice.Communicator communicator, PrintWriter out, CommunicatorObserverI obsv) + static MetricsPrx allTests(test.Util.Application app, CommunicatorObserverI obsv) throws IceMX.UnknownMetricsView { - MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:default -p 12010")); + PrintWriter out = app.getWriter(); + Ice.Communicator communicator = app.communicator(); + + String host = app.getTestHost(); + String port = Integer.toString(app.getTestPort(0)); + String hostAndPort = host + ":" + port; + String protocol = app.getTestProtocol(); + String endpoint = protocol + " -h " + host + " -p " + port; + + MetricsPrx metrics = MetricsPrxHelper.checkedCast(communicator.stringToProxy("metrics:" + app.getTestEndpoint(0))); boolean collocated = metrics.ice_getConnection() == null; int threadCount = 4; @@ -543,8 +555,6 @@ public class AllTests out.println("ok"); - String endpoint = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp") + - " -h 127.0.0.1 -p 12010"; String type = ""; String isSecure = ""; if(!collocated) @@ -631,7 +641,7 @@ public class AllTests test(map.get("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", timestamp).get("Connection")); @@ -703,16 +713,16 @@ public class AllTests testAttribute(clientMetrics, clientProps, update, "Connection", "endpointIsSecure", isSecure, out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointTimeout", "500", out); testAttribute(clientMetrics, clientProps, update, "Connection", "endpointCompress", "false", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", "127.0.0.1", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", "12010", out); + testAttribute(clientMetrics, clientProps, update, "Connection", "endpointHost", host, out); + testAttribute(clientMetrics, clientProps, update, "Connection", "endpointPort", port, out); testAttribute(clientMetrics, clientProps, update, "Connection", "incoming", "false", out); testAttribute(clientMetrics, clientProps, update, "Connection", "adapterName", "", out); testAttribute(clientMetrics, clientProps, update, "Connection", "connectionId", "Con1", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", "127.0.0.1", out); + testAttribute(clientMetrics, clientProps, update, "Connection", "localHost", host, out); //testAttribute(clientMetrics, clientProps, update, "Connection", "localPort", "", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", "127.0.0.1", out); - testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", "12010", out); + testAttribute(clientMetrics, clientProps, update, "Connection", "remoteHost", host, out); + testAttribute(clientMetrics, clientProps, update, "Connection", "remotePort", port, out); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastHost", "", out); testAttribute(clientMetrics, clientProps, update, "Connection", "mcastPort", "", out); @@ -734,13 +744,13 @@ public class AllTests test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1); IceMX.Metrics m1 = clientMetrics.getMetricsView("View", timestamp).get("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:" + endpoint).ice_timeout(10).ice_ping(); test(false); } catch(Ice.ConnectTimeoutException ex) @@ -753,14 +763,14 @@ public class AllTests controller.resume(); test(clientMetrics.getMetricsView("View", timestamp).get("ConnectionEstablishment").length == 1); m1 = clientMetrics.getMetricsView("View", timestamp).get("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, out); Connect c = new Connect(metrics); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "parent", "Communicator", c, out); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", "127.0.0.1:12010", c, + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "id", hostAndPort, c, out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpoint", endpoint + " -t 60000", c, out); @@ -774,9 +784,9 @@ public class AllTests out); testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointCompress", "false", c, out); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c, + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointHost", host, c, out); - testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", "12010", c, + testAttribute(clientMetrics, clientProps, update, "ConnectionEstablishment", "endpointPort", port, c, out); out.println("ok"); @@ -788,7 +798,8 @@ public class AllTests updateProps(clientProps, serverProps, update, props, "EndpointLookup"); test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 0); - Ice.ObjectPrx prx = communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite"); + Ice.ObjectPrx prx = + communicator.stringToProxy("metrics:" + protocol + " -p " + port + " -h localhost -t 500"); prx.ice_ping(); test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 1); @@ -800,7 +811,7 @@ public class AllTests boolean 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 ex) @@ -813,11 +824,11 @@ public class AllTests } test(clientMetrics.getMetricsView("View", timestamp).get("EndpointLookup").length == 2); m1 = clientMetrics.getMetricsView("View", timestamp).get("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", timestamp).get("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) { @@ -835,10 +846,10 @@ public class AllTests testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointType", type, c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsDatagram", "false", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointIsSecure", isSecure, c, out); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "-1", c, out); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointTimeout", "500", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointCompress", "false", c, out); testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointHost", "localhost", c, out); - testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", "12010", c, out); + testAttribute(clientMetrics, clientProps, update, "EndpointLookup", "endpointPort", port, c, out); out.println("ok"); } @@ -935,16 +946,16 @@ public class AllTests testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointIsSecure", isSecure, op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointTimeout", "60000", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointCompress", "false", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", "127.0.0.1", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", "12010", op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointHost", host, op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "endpointPort", port, op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "incoming", "true", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "adapterName", "TestAdapter", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "connectionId", "", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", "127.0.0.1", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", "12010", op, out); - testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", "127.0.0.1", op, out); - //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", "12010", op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "localHost", host, op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "localPort", port, op, out); + testAttribute(serverMetrics, serverProps, update, "Dispatch", "remoteHost", host, op, out); + //testAttribute(serverMetrics, serverProps, update, "Dispatch", "remotePort", port, op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastHost", "", op, out); testAttribute(serverMetrics, serverProps, update, "Dispatch", "mcastPort", "", op, out); } diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Client.java b/java-compat/test/src/main/java/test/Ice/metrics/Client.java index e2cc47bbdfc..fd5b6de6bfd 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/Client.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/Client.java @@ -19,7 +19,7 @@ public class Client extends test.Util.Application Ice.Communicator communicator = communicator(); try { - MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer); + MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); } catch(Ice.UserException ex) @@ -34,8 +34,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.metrics"); initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); initData.properties.setProperty("Ice.Admin.InstanceName", "client"); diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java b/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java index 98320001330..8820832f9b4 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/Collocated.java @@ -22,14 +22,14 @@ public class Collocated extends test.Util.Application 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"); + 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. try { - MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer); + MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); } catch(Ice.UserException ex) @@ -44,8 +44,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); if(initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0) { // With background IO, collocated invocations are @@ -57,7 +56,7 @@ public class Collocated extends test.Util.Application initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); initData.properties.setProperty("Ice.Admin.InstanceName", "client"); initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.MessageSizeMax", "50000"); diff --git a/java-compat/test/src/main/java/test/Ice/metrics/Server.java b/java-compat/test/src/main/java/test/Ice/metrics/Server.java index b4512bfdc4b..59cc91d0a75 100644 --- a/java-compat/test/src/main/java/test/Ice/metrics/Server.java +++ b/java-compat/test/src/main/java/test/Ice/metrics/Server.java @@ -19,7 +19,7 @@ public class Server extends test.Util.Application adapter.add(new MetricsI(), Ice.Util.stringToIdentity("metrics")); adapter.activate(); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); @@ -30,10 +30,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + 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"); diff --git a/java-compat/test/src/main/java/test/Ice/metrics/run.py b/java-compat/test/src/main/java/test/Ice/metrics/run.py deleted file mode 100755 index 88b29abdfd1..00000000000 --- a/java-compat/test/src/main/java/test/Ice/metrics/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() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.metrics.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java b/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java index 4ec21083e4a..a7fcda6f000 100644 --- a/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/networkProxy/AllTests.java @@ -31,10 +31,16 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + 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"); + } + TestIntfPrx test = TestIntfPrxHelper.checkedCast(obj); test(test != null); @@ -56,7 +62,7 @@ public class AllTests info = (Ice.IPConnectionInfo)p; } } - 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. } out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java b/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java index a3972a06b9b..74a860526f9 100644 --- a/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java +++ b/java-compat/test/src/main/java/test/Ice/networkProxy/Client.java @@ -23,8 +23,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java b/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java index 1c0838f37a3..d877161f9c9 100644 --- a/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java +++ b/java-compat/test/src/main/java/test/Ice/networkProxy/Server.java @@ -34,10 +34,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/networkProxy/run.py b/java-compat/test/src/main/java/test/Ice/networkProxy/run.py deleted file mode 100755 index fa8d2fcbb15..00000000000 --- a/java-compat/test/src/main/java/test/Ice/networkProxy/run.py +++ /dev/null @@ -1,46 +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/java-compat/test/src/main/java/test/Ice/objects/AllTests.java b/java-compat/test/src/main/java/test/Ice/objects/AllTests.java index c9808354927..6b4cd9e8726 100644 --- a/java-compat/test/src/main/java/test/Ice/objects/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/objects/AllTests.java @@ -46,11 +46,13 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -262,7 +264,7 @@ public class AllTests out.print("testing UnexpectedObjectException..."); out.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/java-compat/test/src/main/java/test/Ice/objects/Client.java b/java-compat/test/src/main/java/test/Ice/objects/Client.java index aa1039edb9f..db2b3f2114a 100644 --- a/java-compat/test/src/main/java/test/Ice/objects/Client.java +++ b/java-compat/test/src/main/java/test/Ice/objects/Client.java @@ -88,7 +88,7 @@ public class Client extends test.Util.Application communicator.addObjectFactory(new MyObjectFactory(), "TestOF"); - InitialPrx initial = AllTests.allTests(communicator, getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } @@ -96,8 +96,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/objects/Collocated.java b/java-compat/test/src/main/java/test/Ice/objects/Collocated.java index 3540ad70b0a..9298d7626da 100644 --- a/java-compat/test/src/main/java/test/Ice/objects/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/objects/Collocated.java @@ -87,13 +87,13 @@ public class Collocated extends test.Util.Application communicator.addObjectFactory(new MyObjectFactory(), "TestOF"); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Initial initial = new InitialI(adapter); adapter.add(initial, Ice.Util.stringToIdentity("initial")); UnexpectedObjectExceptionTestI object = new UnexpectedObjectExceptionTestI(); adapter.add(object, Ice.Util.stringToIdentity("uoet")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); // We must call shutdown even in the collocated case for cyclic // dependency cleanup initial.shutdown(); @@ -103,8 +103,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/objects/Server.java b/java-compat/test/src/main/java/test/Ice/objects/Server.java index 49a7c0fa174..04e8c2100ac 100644 --- a/java-compat/test/src/main/java/test/Ice/objects/Server.java +++ b/java-compat/test/src/main/java/test/Ice/objects/Server.java @@ -56,10 +56,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/objects/run.py b/java-compat/test/src/main/java/test/Ice/objects/run.py deleted file mode 100755 index c0e22437de7..00000000000 --- a/java-compat/test/src/main/java/test/Ice/objects/run.py +++ /dev/null @@ -1,35 +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 = "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/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java b/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java index 25437cbe39b..cdfff703aee 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java @@ -14,7 +14,7 @@ public class AMDServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDMyDerivedClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -24,8 +24,7 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // It's possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java b/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java index 1e18aa3fa0d..82373eba6c8 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java @@ -16,7 +16,7 @@ public class AMDTieServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new _MyDerivedClassTie(new AMDTieMyDerivedClassI()), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -26,8 +26,7 @@ public class AMDTieServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // It's possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread diff --git a/java-compat/test/src/main/java/test/Ice/operations/AllTests.java b/java-compat/test/src/main/java/test/Ice/operations/AllTests.java index 59e6e065ba1..b8eaba844a4 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/operations/AllTests.java @@ -18,10 +18,12 @@ import test.Ice.operations.Test.MyDerivedClassPrxHelper; public class AllTests { public static MyClassPrx - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); - String ref = "test:default -p 12010"; + PrintWriter out = app.getWriter(); + + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrxHelper.checkedCast(base); MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl); diff --git a/java-compat/test/src/main/java/test/Ice/operations/Client.java b/java-compat/test/src/main/java/test/Ice/operations/Client.java index d5f0d7713b5..4aa12f32507 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Client.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { java.io.PrintWriter out = getWriter(); - MyClassPrx myClass = AllTests.allTests(this, out); + MyClassPrx myClass = AllTests.allTests(this); out.print("testing server shutdown... "); out.flush(); @@ -38,8 +38,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations"); diff --git a/java-compat/test/src/main/java/test/Ice/operations/Collocated.java b/java-compat/test/src/main/java/test/Ice/operations/Collocated.java index b10f13a54e0..199b73e789d 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Collocated.java @@ -14,8 +14,7 @@ public class Collocated extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - java.io.PrintWriter out = getWriter(); + 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. @@ -25,7 +24,7 @@ public class Collocated extends test.Util.Application throw new RuntimeException(); } - AllTests.allTests(this, out); + AllTests.allTests(this); return 0; } @@ -33,8 +32,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); if(initData.properties.getPropertyAsInt("Ice.ThreadInterruptSafe") > 0 || isAndroid()) { initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2"); diff --git a/java-compat/test/src/main/java/test/Ice/operations/Server.java b/java-compat/test/src/main/java/test/Ice/operations/Server.java index ae7d1de57bd..d1e8ed39e05 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Server.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -24,8 +24,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // It's possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread diff --git a/java-compat/test/src/main/java/test/Ice/operations/TieServer.java b/java-compat/test/src/main/java/test/Ice/operations/TieServer.java index 189fe433be7..6c0047e57e5 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/TieServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/TieServer.java @@ -16,7 +16,7 @@ public class TieServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new _MyDerivedClassTie(new TieMyDerivedClassI()), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -26,8 +26,7 @@ public class TieServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // It's possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread diff --git a/java-compat/test/src/main/java/test/Ice/operations/Twoways.java b/java-compat/test/src/main/java/test/Ice/operations/Twoways.java index 7ca7d7e45c7..189c448d309 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Twoways.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Twoways.java @@ -55,9 +55,9 @@ class Twoways twoways(Application app, MyClassPrx p) { Communicator communicator = app.communicator(); - + String[] literals = p.opStringLiterals(); - + test(s0.value.equals("\\") && s0.value.equals(sw0.value) && s0.value.equals(literals[0]) && @@ -72,8 +72,8 @@ class Twoways s2.value.equals(sw2.value) && s2.value.equals(literals[2]) && s2.value.equals(literals[13])); - - test(s3.value.equals("A21") && + + test(s3.value.equals("A21") && s3.value.equals(sw3.value) && s3.value.equals(literals[3]) && s3.value.equals(literals[14])); @@ -102,7 +102,7 @@ class Twoways s8.value.equals(sw8.value) && s8.value.equals(literals[8]) && s8.value.equals(literals[19])); - + test(s9.value.equals("\uD83C\uDF4C") && s9.value.equals(sw9.value) && s9.value.equals(literals[9]) && @@ -112,14 +112,14 @@ class Twoways s10.value.equals(sw10.value) && s10.value.equals(literals[10]) && s10.value.equals(literals[21])); - + test(ss0.value.equals("\'\"\u003f\\\u0007\b\f\n\r\t\u000b\6") && ss0.value.equals(ss1.value) && ss0.value.equals(ss2.value) && ss0.value.equals(literals[22]) && ss0.value.equals(literals[23]) && ss0.value.equals(literals[24])); - + test(ss3.value.equals("\\\\U\\u\\") && ss3.value.equals(literals[25])); @@ -128,7 +128,7 @@ class Twoways test(ss5.value.equals("\\u0041\\") && ss5.value.equals(literals[27])); - + test(su0.value.equals(su1.value) && su0.value.equals(su2.value) && su0.value.equals(literals[28]) && @@ -1507,7 +1507,7 @@ class Twoways ctx.put("two", "TWO"); ctx.put("three", "THREE"); - MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:default -p 12010")); + MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); @@ -1571,7 +1571,7 @@ class Twoways p.opIdempotent(); p.opNonmutating(); - + test(p.opByte1((byte)0xFF) == (byte)0xFF); test(p.opShort1((short)0x7FFF) == (short)0x7FFF); test(p.opInt1(0x7FFFFFFF) == 0x7FFFFFFF); @@ -1583,8 +1583,8 @@ class Twoways test(p.opByteBoolD1(null).size() == 0); test(p.opStringS2(null).length == 0); test(p.opByteBoolD2(null).size() == 0); - - + + MyDerivedClassPrx d = MyDerivedClassPrxHelper.uncheckedCast(p); MyStruct1 s = new MyStruct1(); s.tesT = "Test.MyStruct1.s"; diff --git a/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java b/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java index bd9701c27c5..7a0a441d27c 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java +++ b/java-compat/test/src/main/java/test/Ice/operations/TwowaysAMI.java @@ -120,38 +120,38 @@ class TwowaysAMI private boolean _called; } - + private static class GenericCallback<T> extends Callback { public GenericCallback(T value) { _value = value; } - + public void response(T value) { _value = value; _succeeded = true; called(); } - + public void exception(Ice.LocalException ex) { _succeeded = false; called(); } - + public boolean succeeded() { check(); return _succeeded; } - + public T value() { return _value; } - + private T _value; private boolean _succeeded = false; } @@ -2692,7 +2692,7 @@ class TwowaysAMI ctx.put("two", "TWO"); ctx.put("three", "THREE"); - MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:default -p 12010")); + MyClassPrx p3 = MyClassPrxHelper.uncheckedCast(ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); @@ -2770,7 +2770,7 @@ class TwowaysAMI derived.begin_opDerived(cb); cb.check(); } - + { final GenericCallback<Byte> cb = new GenericCallback<Byte>((byte)0); p.begin_opByte1((byte)0xFF, @@ -2780,7 +2780,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2788,7 +2788,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == (byte)0xFF); } - + { final GenericCallback<Short> cb = new GenericCallback<Short>((short)0); p.begin_opShort1((short)0x7FFF, @@ -2798,7 +2798,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2806,7 +2806,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 0x7FFF); } - + { final GenericCallback<Integer> cb = new GenericCallback<Integer>(0); p.begin_opInt1(0x7FFFFFFF, @@ -2816,7 +2816,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2824,7 +2824,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 0x7FFFFFFF); } - + { final GenericCallback<Long> cb = new GenericCallback<Long>((long)0); p.begin_opLong1(0x7FFFFFFF, @@ -2834,7 +2834,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2842,7 +2842,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 0x7FFFFFFF); } - + { final GenericCallback<Float> cb = new GenericCallback<Float>(0.0f); p.begin_opFloat1(1.0f, @@ -2852,7 +2852,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2860,7 +2860,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 1.0f); } - + { final GenericCallback<Double> cb = new GenericCallback<Double>(0.0); p.begin_opDouble1(1.0, @@ -2870,7 +2870,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2878,7 +2878,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value() == 1.0); } - + { final GenericCallback<String> cb = new GenericCallback<String>(""); p.begin_opString1("opString1", @@ -2888,7 +2888,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2896,7 +2896,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value().equals("opString1")); } - + { final GenericCallback<String[]> cb = new GenericCallback<String[]>(null); p.begin_opStringS1(null, @@ -2906,7 +2906,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); @@ -2914,7 +2914,7 @@ class TwowaysAMI }); test(cb.succeeded() && cb.value().length == 0); } - + { final GenericCallback<Map<Byte, Boolean>> cb = new GenericCallback<Map<Byte, Boolean>>(null); p.begin_opByteBoolD1(null, @@ -2924,7 +2924,7 @@ class TwowaysAMI { cb.response(value); } - + public void exception(Ice.LocalException ex) { cb.exception(ex); diff --git a/java-compat/test/src/main/java/test/Ice/operations/run.py b/java-compat/test/src/main/java/test/Ice/operations/run.py deleted file mode 100755 index 2049cd7eeb6..00000000000 --- a/java-compat/test/src/main/java/test/Ice/operations/run.py +++ /dev/null @@ -1,39 +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="test.Ice.operations.AMDServer") - -TestUtil.queueClientServerTest(configName = "tie", localOnly = True, message = "Running test with tie server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", - server="test.Ice.operations.TieServer") - -TestUtil.queueClientServerTest(configName = "amdTie", localOnly = True, message = "Running test with AMD tie server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", - server="test.Ice.operations.AMDTieServer") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java b/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java index 99cab219be1..c43bc740e7a 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/optional/AMDServer.java @@ -14,7 +14,7 @@ public class AMDServer extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDInitialI(), Ice.Util.stringToIdentity("initial")); adapter.activate(); @@ -24,8 +24,7 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional.AMD"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/optional/AllTests.java b/java-compat/test/src/main/java/test/Ice/optional/AllTests.java index 5680234d11d..0e66fb1c8fb 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/optional/AllTests.java @@ -24,8 +24,9 @@ public class AllTests } public static InitialPrx - allTests(test.Util.Application app, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { + PrintWriter out = app.getWriter(); Ice.Communicator communicator = app.communicator(); FactoryI factory = new FactoryI(); @@ -33,7 +34,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -2349,8 +2350,8 @@ public class AllTests if(cls != null) { java.lang.reflect.Method allTests = cls.getDeclaredMethod("allTests", - new Class<?>[]{test.Util.Application.class, java.io.PrintWriter.class}); - allTests.invoke(null, app, out); + new Class<?>[]{test.Util.Application.class}); + allTests.invoke(null, app); } } catch(java.lang.NoSuchMethodException ex) diff --git a/java-compat/test/src/main/java/test/Ice/optional/Client.java b/java-compat/test/src/main/java/test/Ice/optional/Client.java index 8714a642be3..2c82fb72b60 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/Client.java +++ b/java-compat/test/src/main/java/test/Ice/optional/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - java.io.PrintWriter out = getWriter(); - InitialPrx initial = AllTests.allTests(this, false, out); + InitialPrx initial = AllTests.allTests(this, false); initial.shutdown(); return 0; } @@ -25,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/optional/Server.java b/java-compat/test/src/main/java/test/Ice/optional/Server.java index d4429d5a94d..39d8f4798da 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/Server.java +++ b/java-compat/test/src/main/java/test/Ice/optional/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + ":udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial")); adapter.activate(); @@ -24,8 +24,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.optional"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java b/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java index 19fa4e7b2a9..f41a1cb3a51 100644 --- a/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/optional/lambda/AllTests.java @@ -23,7 +23,7 @@ public class AllTests throw new RuntimeException(); } } - + private static class CallbackBase { CallbackBase() @@ -62,11 +62,12 @@ public class AllTests } public static InitialPrx - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); InitialPrx initial = InitialPrxHelper.uncheckedCast(base); @@ -74,7 +75,7 @@ public class AllTests out.print("testing optional parameters with async lambda callbacks... "); out.flush(); final boolean reqParams = initial.supportsRequiredParams(); - + final boolean supportsJavaSerializable = initial.supportsJavaSerializable(); { @@ -82,16 +83,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opByte(p1.get(), - (Ice.ByteOptional ret, Ice.ByteOptional p2) -> + (Ice.ByteOptional ret, Ice.ByteOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opByte(p1, - (Ice.ByteOptional ret, Ice.ByteOptional p2) -> + (Ice.ByteOptional ret, Ice.ByteOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -103,16 +104,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opBool(p1.get(), - (Ice.BooleanOptional ret, Ice.BooleanOptional p2) -> + (Ice.BooleanOptional ret, Ice.BooleanOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opBool(p1, - (Ice.BooleanOptional ret, Ice.BooleanOptional p2) -> + (Ice.BooleanOptional ret, Ice.BooleanOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -124,7 +125,7 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opShort(p1.get(), - (Ice.ShortOptional ret, Ice.ShortOptional p2) -> + (Ice.ShortOptional ret, Ice.ShortOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -132,7 +133,7 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opShort(p1, - (Ice.ShortOptional ret, Ice.ShortOptional p2) -> + (Ice.ShortOptional ret, Ice.ShortOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -144,16 +145,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opInt(p1.get(), - (Ice.IntOptional ret, Ice.IntOptional p2) -> + (Ice.IntOptional ret, Ice.IntOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opInt(p1, - (Ice.IntOptional ret, Ice.IntOptional p2) -> + (Ice.IntOptional ret, Ice.IntOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -165,16 +166,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opLong(p1.get(), - (Ice.LongOptional ret, Ice.LongOptional p2) -> + (Ice.LongOptional ret, Ice.LongOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opLong(p1, - (Ice.LongOptional ret, Ice.LongOptional p2) -> + (Ice.LongOptional ret, Ice.LongOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -186,16 +187,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opFloat(p1.get(), - (Ice.FloatOptional ret, Ice.FloatOptional p2) -> + (Ice.FloatOptional ret, Ice.FloatOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFloat(p1, - (Ice.FloatOptional ret, Ice.FloatOptional p2) -> + (Ice.FloatOptional ret, Ice.FloatOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -207,16 +208,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opDouble(p1.get(), - (Ice.DoubleOptional ret, Ice.DoubleOptional p2) -> + (Ice.DoubleOptional ret, Ice.DoubleOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opDouble(p1, - (Ice.DoubleOptional ret, Ice.DoubleOptional p2) -> + (Ice.DoubleOptional ret, Ice.DoubleOptional p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -228,16 +229,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opString(p1.get(), - (Ice.Optional<String> ret, Ice.Optional<String> p2) -> + (Ice.Optional<String> ret, Ice.Optional<String> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opString(p1, - (Ice.Optional<String> ret, Ice.Optional<String> p2) -> + (Ice.Optional<String> ret, Ice.Optional<String> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -249,16 +250,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opMyEnum(p1.get(), - (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) -> + (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opMyEnum(p1, - (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) -> + (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -270,16 +271,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStruct(p1.get(), - (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) -> + (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStruct(p1, - (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) -> + (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -291,16 +292,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStruct(p1.get(), - (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) -> + (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStruct(p1, - (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) -> + (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -312,16 +313,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opVarStruct(p1.get(), - (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) -> + (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opVarStruct(p1, - (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) -> + (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -333,18 +334,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opOneOptional(p1.get(), - (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) -> - cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() && + (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) -> + cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() && ret.get().getA() == p1.get().getA()), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opOneOptional(p1, - (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) -> - cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() && + (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) -> + cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() && ret.get().getA() == p1.get().getA()), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -357,16 +358,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opOneOptionalProxy(p1.get(), - (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) -> + (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opOneOptionalProxy(p1, - (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) -> + (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -376,22 +377,22 @@ public class AllTests { Ice.Optional<byte[]> p1 = new Ice.Optional<byte[]>(new byte[100]); java.util.Arrays.fill(p1.get(), (byte)56); - + { final CallbackBase cb = new CallbackBase(); initial.begin_opByteSeq(p1.get(), - (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opByteSeq(p1, - (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -404,18 +405,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opBoolSeq(p1.get(), - (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) -> + (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opBoolSeq(p1, - (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -428,18 +429,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opShortSeq(p1.get(), - (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) -> + (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opShortSeq(p1, - (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -452,18 +453,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opIntSeq(p1.get(), - (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) -> + (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opIntSeq(p1, - (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -476,18 +477,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opLongSeq(p1.get(), - (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) -> + (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opLongSeq(p1, - (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -500,18 +501,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opFloatSeq(p1.get(), - (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) -> + (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { CallbackBase cb = new CallbackBase(); initial.begin_opFloatSeq(p1, - (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -524,18 +525,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opDoubleSeq(p1.get(), - (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) -> + (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { CallbackBase cb = new CallbackBase(); initial.begin_opDoubleSeq(p1, - (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -548,18 +549,18 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opStringSeq(p1.get(), - (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) -> + (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opStringSeq(p1, - (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -573,28 +574,28 @@ public class AllTests { p1.get()[i] = new SmallStruct(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStructSeq(p1.get(), - (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) -> + (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStructSeq(p1, - (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } } - + { Ice.Optional<java.util.List<SmallStruct>> p1 = new Ice.Optional<java.util.List<SmallStruct>>(); p1.set(new java.util.ArrayList<SmallStruct>()); @@ -602,20 +603,20 @@ public class AllTests { p1.get().add(new SmallStruct()); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSmallStructList(p1.get(), - (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) -> + (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { CallbackBase cb = new CallbackBase(); initial.begin_opSmallStructList(p1, - (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) -> + (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -629,28 +630,28 @@ public class AllTests { p1.get()[i] = new FixedStruct(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStructSeq(p1.get(), - (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) -> + (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStructSeq(p1, - (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } } - + { Ice.Optional<java.util.List<FixedStruct>> p1 = new Ice.Optional<java.util.List<FixedStruct>>(); p1.set(new java.util.ArrayList<FixedStruct>()); @@ -658,20 +659,20 @@ public class AllTests { p1.get().add(new FixedStruct()); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStructList(p1.get(), - (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) -> + (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opFixedStructList(p1, - (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) -> + (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -685,22 +686,22 @@ public class AllTests { p1.get()[i] = new VarStruct(""); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opVarStructSeq(p1.get(), - (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) -> + (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) -> cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opVarStructSeq(p1, - (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) -> - cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && + (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) -> + cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) && java.util.Arrays.equals(ret.get(), p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -713,16 +714,16 @@ public class AllTests { final CallbackBase cb = new CallbackBase(); initial.begin_opSerializable(p1.get(), - (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) -> + (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opSerializable(p1, - (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) -> + (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -734,22 +735,22 @@ public class AllTests p1.set(new java.util.HashMap<Integer, Integer>()); p1.get().put(1, 2); p1.get().put(2, 3); - + { final CallbackBase cb = new CallbackBase(); initial.begin_opIntIntDict(p1.get(), - (Ice.Optional<java.util.Map<Integer, Integer>> ret, - Ice.Optional<java.util.Map<Integer, Integer>> p2) -> + (Ice.Optional<java.util.Map<Integer, Integer>> ret, + Ice.Optional<java.util.Map<Integer, Integer>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opIntIntDict(p1, - (Ice.Optional<java.util.Map<Integer, Integer>> ret, - Ice.Optional<java.util.Map<Integer, Integer>> p2) -> + (Ice.Optional<java.util.Map<Integer, Integer>> ret, + Ice.Optional<java.util.Map<Integer, Integer>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); @@ -761,22 +762,22 @@ public class AllTests p1.set(new java.util.HashMap<String, Integer>()); p1.get().put("1", 1); p1.get().put("2", 2); - + { final CallbackBase cb = new CallbackBase(); initial.begin_opStringIntDict(p1.get(), - (Ice.Optional<java.util.Map<String, Integer>> ret, - Ice.Optional<java.util.Map<String, Integer>> p2) -> + (Ice.Optional<java.util.Map<String, Integer>> ret, + Ice.Optional<java.util.Map<String, Integer>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); } - + { final CallbackBase cb = new CallbackBase(); initial.begin_opStringIntDict(p1, - (Ice.Optional<java.util.Map<String, Integer>> ret, - Ice.Optional<java.util.Map<String, Integer>> p2) -> + (Ice.Optional<java.util.Map<String, Integer>> ret, + Ice.Optional<java.util.Map<String, Integer>> p2) -> cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())), (Ice.Exception ex) -> cb.called(false)); cb.check(); diff --git a/java-compat/test/src/main/java/test/Ice/optional/run.py b/java-compat/test/src/main/java/test/Ice/optional/run.py deleted file mode 100755 index 6c82786dc7f..00000000000 --- a/java-compat/test/src/main/java/test/Ice/optional/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 - -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="test.Ice.optional.AMDServer") -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java b/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java index d2a9afed7b0..ecb1de12da8 100644 --- a/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/packagemd/AllTests.java @@ -31,11 +31,13 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/Client.java b/java-compat/test/src/main/java/test/Ice/packagemd/Client.java index bf5c86e5fb7..5f8fb6d66de 100644 --- a/java-compat/test/src/main/java/test/Ice/packagemd/Client.java +++ b/java-compat/test/src/main/java/test/Ice/packagemd/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - InitialPrx initial = AllTests.allTests(communicator(), getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } @@ -24,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/Server.java b/java-compat/test/src/main/java/test/Ice/packagemd/Server.java index 2f7abf04cf4..2f600913ca4 100644 --- a/java-compat/test/src/main/java/test/Ice/packagemd/Server.java +++ b/java-compat/test/src/main/java/test/Ice/packagemd/Server.java @@ -25,11 +25,10 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/packagemd/run.py b/java-compat/test/src/main/java/test/Ice/packagemd/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/packagemd/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 - -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/java-compat/test/src/main/java/test/Ice/plugin/Client.java b/java-compat/test/src/main/java/test/Ice/plugin/Client.java index 1cb30d326a1..a6dbea204cb 100644 --- a/java-compat/test/src/main/java/test/Ice/plugin/Client.java +++ b/java-compat/test/src/main/java/test/Ice/plugin/Client.java @@ -154,14 +154,6 @@ public class Client extends test.Util.Application return 0; } - @Override - protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) - { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); - return initData; - } - private Ice.InitializationData createInitData() { Ice.InitializationData initData = createInitializationData() ; diff --git a/java-compat/test/src/main/java/test/Ice/plugin/run.py b/java-compat/test/src/main/java/test/Ice/plugin/run.py deleted file mode 100755 index 7f28bf562d9..00000000000 --- a/java-compat/test/src/main/java/test/Ice/plugin/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 - -sys.stdout.write("starting test... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.plugin.Client",startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() - diff --git a/java-compat/test/src/main/java/test/Ice/properties/run.py b/java-compat/test/src/main/java/test/Ice/properties/run.py deleted file mode 100755 index 0a5cf0452e6..00000000000 --- a/java-compat/test/src/main/java/test/Ice/properties/run.py +++ /dev/null @@ -1,51 +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") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.properties.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() - -if os.path.exists(decodedPath): - os.remove(decodedPath) diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java b/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java index 82defd2909a..0e98e7bb319 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/AMDServer.java @@ -25,10 +25,9 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java index 305eb63914d..ed2561faf1b 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/AllTests.java @@ -27,11 +27,14 @@ public class AllTests } public static MyClassPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); @@ -353,7 +356,7 @@ public class AllTests out.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); @@ -397,7 +400,7 @@ public class AllTests //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); @@ -761,7 +764,7 @@ public class AllTests out.print("testing encoding versioning... "); out.flush(); - String ref20 = "test -e 2.0:default -p 12010"; + String ref20 = "test -e 2.0:" + app.getTestEndpoint(0); MyClassPrx cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -773,7 +776,7 @@ public class AllTests // 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); MyClassPrx cl10 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref10)); cl10.ice_ping(); cl10.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); @@ -781,7 +784,7 @@ public class AllTests // 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); MyClassPrx cl13 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.end_ice_ping(cl13.begin_ice_ping()); @@ -830,7 +833,7 @@ public class AllTests out.print("testing protocol versioning... "); out.flush(); - ref20 = "test -p 2.0:default -p 12010"; + ref20 = "test -p 2.0:" + app.getTestEndpoint(0); cl20 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -842,13 +845,13 @@ public class AllTests // 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 = 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 = MyClassPrxHelper.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.end_ice_ping(cl13.begin_ice_ping()); @@ -981,10 +984,6 @@ public class AllTests // Working? boolean ssl = communicator.getProperties().getProperty("Ice.Default.Protocol").equals("ssl"); boolean 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=="); @@ -1007,23 +1006,6 @@ public class AllTests } // - // Try to invoke on the SSL endpoint to verify that we get a - // NoEndpointException (or ConnectFailedException when - // running with SSL). - // - if(ssl) - { - try - { - p1.ice_encodingVersion(Ice.Util.Encoding_1_0).ice_ping(); - test(false); - } - catch(Ice.ConnectFailedException ex) - { - } - } - - // // Test that the proxy with an SSL endpoint and a nonsense // endpoint (which the server doesn't understand either) can // be sent over the wire and returned by the server without diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Client.java b/java-compat/test/src/main/java/test/Ice/proxy/Client.java index a3c40117591..ec338175b33 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/Client.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - MyClassPrx myClass = AllTests.allTests(communicator, getWriter()); + MyClassPrx myClass = AllTests.allTests(this); myClass.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java b/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java index 5823e8d25c5..16f2ca75bc4 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/Collocated.java @@ -15,12 +15,12 @@ public class Collocated extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + 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, getWriter()); + AllTests.allTests(this); return 0; } @@ -28,8 +28,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/proxy/Server.java b/java-compat/test/src/main/java/test/Ice/proxy/Server.java index fd6252a37d1..a957c153be8 100644 --- a/java-compat/test/src/main/java/test/Ice/proxy/Server.java +++ b/java-compat/test/src/main/java/test/Ice/proxy/Server.java @@ -24,10 +24,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/proxy/run.py b/java-compat/test/src/main/java/test/Ice/proxy/run.py deleted file mode 100755 index 0d0598cb160..00000000000 --- a/java-compat/test/src/main/java/test/Ice/proxy/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() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.proxy.AMDServer") -TestUtil.queueCollocatedTest(additionalOptions = "--Ice.ToStringMode=Compat") -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/retry/Client.java b/java-compat/test/src/main/java/test/Ice/retry/Client.java index 37048d507c3..6c68fcd77ca 100644 --- a/java-compat/test/src/main/java/test/Ice/retry/Client.java +++ b/java-compat/test/src/main/java/test/Ice/retry/Client.java @@ -33,8 +33,8 @@ public class Client extends test.Util.Application try { - RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation, - "retry:default -p 12010"); + RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation, + "retry:" + getTestEndpoint(0)); retry.shutdown(); return 0; } @@ -47,8 +47,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.observer = instrumentation.getObserver(); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); diff --git a/java-compat/test/src/main/java/test/Ice/retry/Collocated.java b/java-compat/test/src/main/java/test/Ice/retry/Collocated.java index 1faf02f0889..2fe2dcaa8d3 100644 --- a/java-compat/test/src/main/java/test/Ice/retry/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/retry/Collocated.java @@ -15,7 +15,7 @@ public class Collocated extends test.Util.Application { private Instrumentation instrumentation = new Instrumentation(); - private void + private void setupObjectAdapter(Ice.Communicator communicator) { Ice.ObjectAdapter adapter = communicator.createObjectAdapter(""); @@ -57,8 +57,7 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.observer = instrumentation.getObserver(); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); diff --git a/java-compat/test/src/main/java/test/Ice/retry/Server.java b/java-compat/test/src/main/java/test/Ice/retry/Server.java index 8d4a4f6209e..bbaa9a40c5d 100644 --- a/java-compat/test/src/main/java/test/Ice/retry/Server.java +++ b/java-compat/test/src/main/java/test/Ice/retry/Server.java @@ -24,10 +24,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/retry/run.py b/java-compat/test/src/main/java/test/Ice/retry/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java-compat/test/src/main/java/test/Ice/retry/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() -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java b/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java index e19857ff333..fa0a2953ba8 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/AMDServer.java @@ -25,10 +25,9 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java b/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java index dd47cd787d0..1eae6596303 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/AllTests.java @@ -16,9 +16,12 @@ import test.Ice.seqMapping.Test.*; public class AllTests { public static MyClassPrx - allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { - String ref = "test:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String ref = "test:" + app.getTestEndpoint(0); Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrxHelper.checkedCast(baseProxy); diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java index 293f3ea0b9d..02bb1ca1ba2 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Client.java @@ -18,8 +18,7 @@ public class Client extends test.Util.Application run(String[] args) { java.io.PrintWriter out = getWriter(); - - MyClassPrx myClass = AllTests.allTests(communicator(), false, out); + MyClassPrx myClass = AllTests.allTests(this, false); out.print("shutting down server... "); out.flush(); @@ -32,8 +31,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java index 755e0248197..708b51f3145 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Collocated.java @@ -15,12 +15,11 @@ public class Collocated extends test.Util.Application public int run(String[] args) { - java.io.PrintWriter out = getWriter(); 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, out); + AllTests.allTests(this, true); return 0; } @@ -28,10 +27,9 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java b/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java index 21eff24ab1c..a7e4668dcb6 100644 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java +++ b/java-compat/test/src/main/java/test/Ice/seqMapping/Server.java @@ -25,10 +25,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + ":udp"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/seqMapping/run.py b/java-compat/test/src/main/java/test/Ice/seqMapping/run.py deleted file mode 100755 index 685319f3cae..00000000000 --- a/java-compat/test/src/main/java/test/Ice/seqMapping/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() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.seqMapping.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java b/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java index 202de5696da..046729624f3 100644 --- a/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/serialize/AllTests.java @@ -23,9 +23,12 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { - String ref = "initial:default -p 12010"; + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String ref = "initial:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); InitialPrx initial = InitialPrxHelper.checkedCast(base); diff --git a/java-compat/test/src/main/java/test/Ice/serialize/Client.java b/java-compat/test/src/main/java/test/Ice/serialize/Client.java index ca504c66b15..ca15188d2ba 100644 --- a/java-compat/test/src/main/java/test/Ice/serialize/Client.java +++ b/java-compat/test/src/main/java/test/Ice/serialize/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application public int run(String[] args) { - java.io.PrintWriter out = getWriter(); - InitialPrx initial = AllTests.allTests(communicator(), false, out); + InitialPrx initial = AllTests.allTests(this, false); initial.shutdown(); return 0; } @@ -25,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/serialize/Server.java b/java-compat/test/src/main/java/test/Ice/serialize/Server.java index a0658f19668..86f178851c8 100644 --- a/java-compat/test/src/main/java/test/Ice/serialize/Server.java +++ b/java-compat/test/src/main/java/test/Ice/serialize/Server.java @@ -27,10 +27,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/serialize/run.py b/java-compat/test/src/main/java/test/Ice/serialize/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/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 - -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/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java index 77f66d39142..ee29901269c 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AMDServer.java @@ -27,10 +27,9 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java b/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java index de9b90ee2d9..82311d12880 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/AllTests.java @@ -208,11 +208,13 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); - String ref = "asm:default -p 12010"; + String ref = "asm:" + app.getTestEndpoint(0); Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -228,7 +230,7 @@ public class AllTests out.flush(); try { - ObjectPrx o = communicator.stringToProxy("category/locate:default -p 12010"); + ObjectPrx o = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); o.ice_ids(); test(false); } @@ -243,7 +245,7 @@ public class AllTests try { - ObjectPrx o = communicator.stringToProxy("category/finished:default -p 12010"); + ObjectPrx o = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0)); o.ice_ids(); test(false); } @@ -259,11 +261,11 @@ public class AllTests out.print("testing servant locator... "); out.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 ex) { @@ -272,20 +274,20 @@ public class AllTests out.print("testing default servant locator... "); out.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 ex) { } try { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010")); + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { @@ -294,14 +296,14 @@ public class AllTests out.print("testing locate exceptions... "); out.flush(); - base = communicator.stringToProxy("category/locate:default -p 12010"); + base = communicator.stringToProxy("category/locate:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(base); testExceptions(obj); out.println("ok"); out.print("testing finished exceptions... "); out.flush(); - base = communicator.stringToProxy("category/finished:default -p 12010"); + base = communicator.stringToProxy("category/finished:" + app.getTestEndpoint(0)); obj = TestIntfPrxHelper.checkedCast(base); testExceptions(obj); @@ -345,7 +347,7 @@ public class AllTests out.print("testing servant locator removal... "); out.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/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java index fa676eb383c..ab46dee3fd5 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - TestIntfPrx obj = AllTests.allTests(communicator(), getWriter()); + TestIntfPrx obj = AllTests.allTests(this); obj.shutdown(); return 0; } @@ -24,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java index 6e4fbf4e820..79bbb951f35 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application adapter.addServantLocator(new ServantLocatorI(""), ""); adapter.add(new TestI(), Ice.Util.stringToIdentity("asm")); adapter.add(new TestActivationI(), Ice.Util.stringToIdentity("test/activation")); - AllTests.allTests(communicator(), getWriter()); + AllTests.allTests(this); return 0; } @@ -27,10 +27,9 @@ public class Collocated extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java b/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java index 9559c24a7a4..ed0590ca113 100644 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java +++ b/java-compat/test/src/main/java/test/Ice/servantLocator/Server.java @@ -26,10 +26,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/servantLocator/run.py b/java-compat/test/src/main/java/test/Ice/servantLocator/run.py deleted file mode 100755 index 205d37b5a05..00000000000 --- a/java-compat/test/src/main/java/test/Ice/servantLocator/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() -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - server="test.Ice.servantLocator.AMDServer") -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java index 220b71f7e03..7db445c67a3 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java @@ -24,11 +24,10 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.serverAMD"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + " -t 2000"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java index 366afbe8f01..3e937c14bd0 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java @@ -714,11 +714,14 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, boolean collocated, java.io.PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { - out.print("testing stringToProxy... "); + Ice.Communicator communicator = app.communicator(); + java.io.PrintWriter out = app.getWriter(); + + out.print("testing stringToProxy... "); out.flush(); - String ref = "Test:default -p 12010 -t 10000"; + String ref = "Test:" + app.getTestEndpoint(0) + " -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java index bf5aa54559a..231b5514711 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.client"); return initData; } @@ -25,7 +24,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - TestIntfPrx test = AllTests.allTests(communicator(), false, getWriter()); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java index 183f1dd91d8..bd79812ef1e 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/Server.java @@ -24,11 +24,10 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.server"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + " -t 2000"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py b/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index e796b96ceef..00000000000 --- a/java-compat/test/src/main/java/test/Ice/slicing/exceptions/run.py +++ /dev/null @@ -1,40 +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 = "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="test.Ice.slicing.exceptions.AMDServer") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="test.Ice.slicing.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java index 529194081fe..fb293721927 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/AMDServer.java @@ -25,11 +25,10 @@ public class AMDServer extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.serverAMD"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + " -t 2000"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java index d8080a02248..b0bc6ccb3b5 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/AllTests.java @@ -1319,11 +1319,14 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) + allTests(test.Util.Application app, boolean collocated) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "Test:default -p 12010 -t 10000"; + String ref = "Test:" + app.getTestEndpoint(0) + " -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java index f6eb48a34f0..24b3fc53ec1 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/Client.java @@ -17,7 +17,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, false, getWriter()); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } @@ -25,8 +25,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.client"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java b/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java index 629716506f6..e9a326454fa 100644 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java +++ b/java-compat/test/src/main/java/test/Ice/slicing/objects/Server.java @@ -25,11 +25,10 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.server"); initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0) + " -t 2000"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py b/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py deleted file mode 100755 index 89a4d8598ea..00000000000 --- a/java-compat/test/src/main/java/test/Ice/slicing/objects/run.py +++ /dev/null @@ -1,40 +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 = "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="test.Ice.slicing.objects.AMDServer") - -TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True, - message = "Running test with 1.0 encoding and AMD server.", - server="test.Ice.slicing.objects.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -TestUtil.runQueuedTests() diff --git a/java-compat/test/src/main/java/test/Ice/stream/Client.java b/java-compat/test/src/main/java/test/Ice/stream/Client.java index 103222e8820..56ab0cb8d57 100644 --- a/java-compat/test/src/main/java/test/Ice/stream/Client.java +++ b/java-compat/test/src/main/java/test/Ice/stream/Client.java @@ -845,8 +845,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.stream"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/stream/run.py b/java-compat/test/src/main/java/test/Ice/stream/run.py deleted file mode 100755 index 66636d7a5c1..00000000000 --- a/java-compat/test/src/main/java/test/Ice/stream/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 - -print("Running test with default encoding...") -TestUtil.simpleTest("test.Ice.stream.Client") - -print("Running test with 1.0 encoding...") -TestUtil.simpleTest("test.Ice.stream.Client", "--Ice.Default.EncodingVersion=1.0") diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java index d9b17b4e55c..0dfee9822cc 100644 --- a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java +++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Client.java @@ -27,7 +27,7 @@ public class Client extends test.Util.Application public int run(String[] args) { java.io.PrintWriter out = getWriter(); - Ice.ObjectPrx object = communicator().stringToProxy("test:default -p 12010 -t 10000"); + Ice.ObjectPrx object = communicator().stringToProxy("test:" + getTestEndpoint(0) + " -t 10000"); PriorityPrx priority = PriorityPrxHelper.checkedCast(object); out.print("testing thread priority... "); out.flush(); diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java index 68ae4707319..220c455539f 100644 --- a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java +++ b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/Server.java @@ -14,7 +14,7 @@ public class Server extends test.Util.Application @Override public int run(String[] args) { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); + communicator().getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0) + " -t 10000:udp"); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new PriorityI(), Ice.Util.stringToIdentity("test")); adapter.activate(); @@ -25,8 +25,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.ThreadPool.Server.ThreadPriority", "10"); return initData; } diff --git a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py b/java-compat/test/src/main/java/test/Ice/threadPoolPriority/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/threadPoolPriority/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 - -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/java-compat/test/src/main/java/test/Ice/throughput/Client.java b/java-compat/test/src/main/java/test/Ice/throughput/Client.java index 22bfc5ce894..ea891ac0a0f 100644 --- a/java-compat/test/src/main/java/test/Ice/throughput/Client.java +++ b/java-compat/test/src/main/java/test/Ice/throughput/Client.java @@ -144,14 +144,14 @@ public class Client extends test.Util.Application throughput.recvStringSeq(); throughput.recvStructSeq(); throughput.recvFixedSeq(); - + throughput.echoByteSeq(emptyBytes); throughput.echoStringSeq(emptyStrings); throughput.echoStructSeq(emptyStructs); throughput.echoFixedSeq(emptyFixed); } throughput.endWarmup(); - + out.println(" ok"); } */ @@ -163,7 +163,7 @@ public class Client extends test.Util.Application // Initial ping to setup the connection. throughput.ice_ping(); - + String[] input = { "t", "o", "r", "e", "s", "x", null }; int inputIndex = 0; String line = null; @@ -223,20 +223,20 @@ public class Client extends test.Util.Application out.print("sending"); break; } - + case 'r': { out.print("receiving"); break; } - + case 'e': { out.print("sending and receiving"); break; } } - + out.print(" " + repetitions); switch(currentType) { @@ -264,17 +264,17 @@ public class Client extends test.Util.Application break; } } - + out.print(" sequences of size " + seqSize); - + if(c == 'o') { out.print(" as oneway"); } - + out.println("..."); out.flush(); - + for(int i = 0; i < repetitions; ++i) { switch(currentType) @@ -288,19 +288,19 @@ public class Client extends test.Util.Application throughput.sendByteSeq(byteSeq); break; } - + case 'o': { throughputOneway.sendByteSeq(byteSeq); break; } - + case 'r': { throughput.recvByteSeq(); break; } - + case 'e': { throughput.echoByteSeq(byteSeq); @@ -319,19 +319,19 @@ public class Client extends test.Util.Application throughput.sendStringSeq(stringSeq); break; } - + case 'o': { throughputOneway.sendStringSeq(stringSeq); break; } - + case 'r': { throughput.recvStringSeq(); break; } - + case 'e': { throughput.echoStringSeq(stringSeq); @@ -350,19 +350,19 @@ public class Client extends test.Util.Application throughput.sendStructSeq(structSeq); break; } - + case 'o': { throughputOneway.sendStructSeq(structSeq); break; } - + case 'r': { throughput.recvStructSeq(); break; } - + case 'e': { throughput.echoStructSeq(structSeq); @@ -381,19 +381,19 @@ public class Client extends test.Util.Application throughput.sendFixedSeq(fixedSeq); break; } - + case 'o': { throughputOneway.sendFixedSeq(fixedSeq); break; } - + case 'r': { throughput.recvFixedSeq(); break; } - + case 'e': { throughput.echoFixedSeq(fixedSeq); @@ -472,12 +472,11 @@ public class Client extends test.Util.Application return 0; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput"); initData.properties.setProperty("Throughput.Proxy", "throughput:default -p 10000 -h 127.0.0.1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/throughput/Server.java b/java-compat/test/src/main/java/test/Ice/throughput/Server.java index fb81f2fc963..824c4259cf3 100644 --- a/java-compat/test/src/main/java/test/Ice/throughput/Server.java +++ b/java-compat/test/src/main/java/test/Ice/throughput/Server.java @@ -20,12 +20,11 @@ public class Server extends test.Util.Application adapter.activate(); return WAIT; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput"); initData.properties.setProperty("Throughput.Endpoints", "default -p 10000 -h 127.0.0.1"); return initData; diff --git a/java-compat/test/src/main/java/test/Ice/throughput/test.py b/java-compat/test/src/main/java/test/Ice/throughput/test.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/java-compat/test/src/main/java/test/Ice/throughput/test.py diff --git a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java index 42b9040a932..09edf2bc28e 100644 --- a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java @@ -138,7 +138,7 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "timeout:default -p 12010"; + String sref = "timeout:" + app.getTestEndpoint(0); Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Client.java b/java-compat/test/src/main/java/test/Ice/timeout/Client.java index 1de8964d87b..6f33f6f0f74 100644 --- a/java-compat/test/src/main/java/test/Ice/timeout/Client.java +++ b/java-compat/test/src/main/java/test/Ice/timeout/Client.java @@ -24,8 +24,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout"); // diff --git a/java-compat/test/src/main/java/test/Ice/timeout/Server.java b/java-compat/test/src/main/java/test/Ice/timeout/Server.java index 3d4982f6305..bd940a0eb9d 100644 --- a/java-compat/test/src/main/java/test/Ice/timeout/Server.java +++ b/java-compat/test/src/main/java/test/Ice/timeout/Server.java @@ -24,10 +24,9 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(initData.properties, 0)); // // Limit the recv buffer size, this test relies on the socket // send() blocking after sending a given amount of data. diff --git a/java-compat/test/src/main/java/test/Ice/timeout/run.py b/java-compat/test/src/main/java/test/Ice/timeout/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java-compat/test/src/main/java/test/Ice/timeout/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 - -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/java-compat/test/src/main/java/test/Ice/udp/AllTests.java b/java-compat/test/src/main/java/test/Ice/udp/AllTests.java index 1e43756d12e..22e8c47e0ae 100644 --- a/java-compat/test/src/main/java/test/Ice/udp/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/udp/AllTests.java @@ -74,7 +74,7 @@ public class AllTests Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030"); + communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter"); PingReplyI replyI = new PingReplyI(); @@ -84,7 +84,7 @@ public class AllTests out.print("testing udp... "); out.flush(); - Ice.ObjectPrx base = communicator.stringToProxy("test -d:udp -p 12010"); + Ice.ObjectPrx base = communicator.stringToProxy("test -d:" + app.getTestEndpoint(0, "udp")); TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(base); int nRetry = 5; diff --git a/java-compat/test/src/main/java/test/Ice/udp/Client.java b/java-compat/test/src/main/java/test/Ice/udp/Client.java index 585531f0253..471917a159f 100644 --- a/java-compat/test/src/main/java/test/Ice/udp/Client.java +++ b/java-compat/test/src/main/java/test/Ice/udp/Client.java @@ -19,7 +19,7 @@ public class Client extends test.Util.Application AllTests.allTests(this); int num; - try + try { num = args.length == 1 ? Integer.parseInt(args[0]) : 1; } @@ -29,7 +29,8 @@ public class Client extends test.Util.Application } for(int i = 0; i < num; ++i) { - TestIntfPrxHelper.uncheckedCast(communicator().stringToProxy("control:tcp -p " + (12010 + i))).shutdown(); + TestIntfPrxHelper.uncheckedCast(communicator().stringToProxy("control:" + + getTestEndpoint(i, "tcp"))).shutdown(); } return 0; } @@ -37,8 +38,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); diff --git a/java-compat/test/src/main/java/test/Ice/udp/Server.java b/java-compat/test/src/main/java/test/Ice/udp/Server.java index 02b6fca4ab1..9c0288ed22c 100644 --- a/java-compat/test/src/main/java/test/Ice/udp/Server.java +++ b/java-compat/test/src/main/java/test/Ice/udp/Server.java @@ -16,7 +16,7 @@ public class Server extends test.Util.Application { Ice.Properties properties = communicator().getProperties(); - int port = 12010; + int port = 0; try { port += args.length == 1 ? Integer.parseInt(args[0]) : 0; @@ -24,14 +24,14 @@ public class Server extends test.Util.Application catch(NumberFormatException ex) { } - properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port); + properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(port, "tcp")); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter"); adapter.add(new TestIntfI(), Ice.Util.stringToIdentity("control")); adapter.activate(); - if(port == 12010) + if(port == 0) { - properties.setProperty("TestAdapter.Endpoints", "udp -p 12010"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(port, "udp")); Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter"); adapter2.add(new TestIntfI(), Ice.Util.stringToIdentity("test")); adapter2.activate(); @@ -50,8 +50,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp"); initData.properties.setProperty("Ice.Warn.Connections", "0"); initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); diff --git a/java-compat/test/src/main/java/test/Ice/udp/run.py b/java-compat/test/src/main/java/test/Ice/udp/run.py deleted file mode 100755 index 4b3a05010e2..00000000000 --- a/java-compat/test/src/main/java/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 - -TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) - -num = 5 - -serverProc = [] -for i in range(0, num): - sys.stdout.write("starting server #%d... " % (i + 1)) - sys.stdout.flush() - serverProc.append(TestUtil.startServer("test.Ice.udp.Server", "%d" % i , adapter="McastTestAdapter")) - print("ok") - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Ice.udp.Client", "%d" % num, startReader=False) -print("ok") -clientProc.startReader() - -clientProc.waitTestSuccess() -for p in serverProc: - p.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/IceBox/admin/Client.java b/java-compat/test/src/main/java/test/IceBox/admin/Client.java index 474c874e3e9..f14032e10ec 100644 --- a/java-compat/test/src/main/java/test/IceBox/admin/Client.java +++ b/java-compat/test/src/main/java/test/IceBox/admin/Client.java @@ -28,8 +28,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); return initData; } diff --git a/java-compat/test/src/main/java/test/IceBox/admin/run.py b/java-compat/test/src/main/java/test/IceBox/admin/run.py deleted file mode 100755 index 6ebb72ea3f2..00000000000 --- a/java-compat/test/src/main/java/test/IceBox/admin/run.py +++ /dev/null @@ -1,44 +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() -config = os.path.join(os.getcwd(), "config.icebox") - -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % config, server=icebox) - -sys.stdout.write("testing iceboxadmin... ") -sys.stdout.flush() - -admin = TestUtil.getIceBoxAdmin() -adminconfig = os.path.join(os.getcwd(), "config.admin") - -ib = TestUtil.startServer(icebox, args = '--Ice.Config=\"%s\"' % config) -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" stop TestService' % adminconfig) -iba.waitTestSuccess() -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" start TestService' % adminconfig) -iba.waitTestSuccess() -iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" shutdown' % adminconfig) -iba.waitTestSuccess() -ib.waitTestSuccess() - -print("ok") diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java b/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java index 8035fb508d1..1fed8dd4608 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java +++ b/java-compat/test/src/main/java/test/IceBox/configuration/AllTests.java @@ -26,12 +26,18 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator, PrintWriter out) + allTests(test.Util.Application app) { - 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(); + PrintWriter out = app.getWriter(); + 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/java-compat/test/src/main/java/test/IceBox/configuration/Client.java b/java-compat/test/src/main/java/test/IceBox/configuration/Client.java index 1417b0b37f8..b12cf385780 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/Client.java +++ b/java-compat/test/src/main/java/test/IceBox/configuration/Client.java @@ -15,7 +15,7 @@ public class Client extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); // // Shutdown the IceBox server. @@ -28,8 +28,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.IceBox.configuration"); initData.properties.setProperty("Ice.Default.Host", "127.0.0.1"); return initData; diff --git a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1 index 6028e615ff5..3e38245a5d0 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1 +++ b/java-compat/test/src/main/java/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/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2 index c173914db2a..835acbadfc9 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service1-2 +++ b/java-compat/test/src/main/java/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/java-compat/test/src/main/java/test/IceBox/configuration/config.service2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2 index 78e08aadba6..95d33831a14 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service2 +++ b/java-compat/test/src/main/java/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/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2 index 36c8d0812cb..6ed8dc9df49 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service2-2 +++ b/java-compat/test/src/main/java/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/java-compat/test/src/main/java/test/IceBox/configuration/config.service3 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service3 index c93ed144701..6cba4b351b0 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service3 +++ b/java-compat/test/src/main/java/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/java-compat/test/src/main/java/test/IceBox/configuration/config.service4 b/java-compat/test/src/main/java/test/IceBox/configuration/config.service4 index 182fb3a7289..a70120dd192 100644 --- a/java-compat/test/src/main/java/test/IceBox/configuration/config.service4 +++ b/java-compat/test/src/main/java/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/java-compat/test/src/main/java/test/IceBox/configuration/run.py b/java-compat/test/src/main/java/test/IceBox/configuration/run.py deleted file mode 100755 index 077936ccbe5..00000000000 --- a/java-compat/test/src/main/java/test/IceBox/configuration/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.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"), - server=TestUtil.getIceBox()) -TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox2"), - server=TestUtil.getIceBox()) diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java b/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java index 28db45ec264..886bcc69293 100644 --- a/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java +++ b/java-compat/test/src/main/java/test/IceDiscovery/simple/Server.java @@ -25,7 +25,7 @@ public class Server extends test.Util.Application { } - 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"); diff --git a/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py b/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py deleted file mode 100755 index 86f25ed9c16..00000000000 --- a/java-compat/test/src/main/java/test/IceDiscovery/simple/run.py +++ /dev/null @@ -1,52 +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 = "test.IceDiscovery.simple.Server" -client = "test.IceDiscovery.simple.Client" - -num = 3 - -args = " --Ice.Plugin.IceDiscovery=IceDiscovery:IceDiscovery.PluginFactory" -args += " --IceDiscovery.Timeout=50" -args += " --IceDiscovery.RetryCount=5" -if not TestUtil.ipv6: - args += " --IceDiscovery.Interface=127.0.0.1" -elif TestUtil.isDarwin(): - args += " --IceDiscovery.Interface=\"::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/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java b/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java index c18faeeefdf..27aee3c8f12 100644 --- a/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java +++ b/java-compat/test/src/main/java/test/IceGrid/simple/AllTests.java @@ -70,7 +70,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"); @@ -89,16 +89,17 @@ public class AllTests Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); initData.properties.setProperty("Ice.Default.Locator", ""); - initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", + initData.properties.setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory"); - if(System.getProperty("os.name").contains("OS X") && + if(System.getProperty("os.name").contains("OS X") && initData.properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0) { initData.properties.setProperty("IceLocatorDiscovery.Interface", "::1"); } + initData.properties.setProperty("IceLocatorDiscovery.Port", Integer.toString(app.getTestPort(99))); 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(); @@ -116,7 +117,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"); @@ -161,8 +162,11 @@ public class AllTests } public static void - allTestsWithDeploy(Ice.Communicator communicator, PrintWriter out) + allTestsWithDeploy(test.Util.Application app) { + Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + out.print("testing stringToProxy... "); out.flush(); Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter"); diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/Client.java b/java-compat/test/src/main/java/test/IceGrid/simple/Client.java index c843e477fc5..33678d610c4 100644 --- a/java-compat/test/src/main/java/test/IceGrid/simple/Client.java +++ b/java-compat/test/src/main/java/test/IceGrid/simple/Client.java @@ -31,7 +31,7 @@ public class Client extends test.Util.Application } else { - AllTests.allTestsWithDeploy(communicator, getWriter()); + AllTests.allTestsWithDeploy(this); } return 0; @@ -40,8 +40,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple"); return initData; } diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/Server.java b/java-compat/test/src/main/java/test/IceGrid/simple/Server.java index e1ea3916029..47eb34d8c54 100644 --- a/java-compat/test/src/main/java/test/IceGrid/simple/Server.java +++ b/java-compat/test/src/main/java/test/IceGrid/simple/Server.java @@ -34,12 +34,11 @@ public class Server extends test.Util.Application //defaultInterrupt(); return 0; } - + @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); // // Its possible to have batch oneway requests dispatched // after the adapter is deactivated due to thread @@ -55,7 +54,7 @@ public class Server extends test.Util.Application { Server c = new Server(); int status = c.main("test.IceGrid.simple.Server", args); - + System.gc(); System.exit(status); } diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/simple_server.xml b/java-compat/test/src/main/java/test/IceGrid/simple/application.xml index 9ebc5d95a72..9ebc5d95a72 100644 --- a/java-compat/test/src/main/java/test/IceGrid/simple/simple_server.xml +++ b/java-compat/test/src/main/java/test/IceGrid/simple/application.xml diff --git a/java-compat/test/src/main/java/test/IceGrid/simple/run.py b/java-compat/test/src/main/java/test/IceGrid/simple/run.py deleted file mode 100755 index 8831f0a03ec..00000000000 --- a/java-compat/test/src/main/java/test/IceGrid/simple/run.py +++ /dev/null @@ -1,35 +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, 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. -# -IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy") diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java index d4d89c9f61e..66b78395236 100644 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java +++ b/java-compat/test/src/main/java/test/IceSSL/configuration/AllTests.java @@ -116,10 +116,12 @@ public class AllTests } public static ServerFactoryPrx - allTests(test.Util.Application app, String testDir, PrintWriter out) + allTests(test.Util.Application app, String testDir) { Ice.Communicator communicator = app.communicator(); - final String factoryRef = "factory:tcp -p 12010"; + PrintWriter out = app.getWriter(); + + final String factoryRef = "factory:" + app.getTestEndpoint(0); Ice.ObjectPrx b = communicator.stringToProxy(factoryRef); test(b != null); ServerFactoryPrx factory = ServerFactoryPrxHelper.checkedCast(b); diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java b/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java index fb92b152d10..44c6a88d96a 100644 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java +++ b/java-compat/test/src/main/java/test/IceSSL/configuration/Client.java @@ -25,7 +25,7 @@ public class Client extends test.Util.Application return 1; } - ServerFactoryPrx factory = AllTests.allTests(this, args[0], out); + ServerFactoryPrx factory = AllTests.allTests(this, args[0]); factory.shutdown(); return 0; @@ -34,8 +34,7 @@ public class Client extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration"); return initData; } diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java b/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java index 54aeb9a9f0f..5b579becce6 100644 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java +++ b/java-compat/test/src/main/java/test/IceSSL/configuration/Server.java @@ -16,7 +16,7 @@ public class Server extends test.Util.Application public int run(String[] args) { Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010"); + 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); @@ -29,8 +29,7 @@ public class Server extends test.Util.Application @Override protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - Ice.InitializationData initData = createInitializationData() ; - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = super.getInitData(argsH); initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration"); return initData; } diff --git a/java-compat/test/src/main/java/test/IceSSL/configuration/run.py b/java-compat/test/src/main/java/test/IceSSL/configuration/run.py deleted file mode 100755 index 2d87a19bc40..00000000000 --- a/java-compat/test/src/main/java/test/IceSSL/configuration/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 - -testdir = '"%s"' % os.getcwd() - -TestUtil.clientServerTest(additionalClientOptions=testdir) diff --git a/java-compat/test/src/main/java/test/IceUtil/inputUtil/run.py b/java-compat/test/src/main/java/test/IceUtil/inputUtil/run.py deleted file mode 100755 index 7f349d5cef0..00000000000 --- a/java-compat/test/src/main/java/test/IceUtil/inputUtil/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.IceUtil.inputUtil.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Slice/generation/run.py b/java-compat/test/src/main/java/test/Slice/generation/run.py deleted file mode 100755 index 58c1f07b722..00000000000 --- a/java-compat/test/src/main/java/test/Slice/generation/run.py +++ /dev/null @@ -1,56 +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, 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 os.getcwd()!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -sys.stdout.write("testing list-generated... ") -sys.stdout.flush() - -slice2java = TestUtil.getSliceTranslator("java") -if not os.path.exists("classes"): - os.mkdir("classes") - -command = '"' + slice2java + '" --compat --list-generated --output-dir classes File1.ice File2.ice' -if TestUtil.debug: - sys.stdout.write("(%s) " % command) -p = TestUtil.runCommand(command) -lines1 = p.stdout.readlines() -lines2 = open(os.path.join(os.getcwd(), "list-generated.out"), "r").readlines() -if len(lines1) != len(lines2): - print("failed!") - sys.exit(1) - -i = 0 -while i < len(lines1): - if sys.version_info[0] == 2: - line1 = lines1[i].strip() - line2 = lines2[i].strip() - else: - line1 = lines1[i].decode("utf-8").strip() - line2 = lines2[i].strip() - if line1 != line2: - print("failed!") - sys.exit(1) - i = i + 1 -else: - print("ok") - -sys.exit(0) diff --git a/java-compat/test/src/main/java/test/Slice/keyword/Client.java b/java-compat/test/src/main/java/test/Slice/keyword/Client.java index 62f377f3fbe..240286789a0 100644 --- a/java-compat/test/src/main/java/test/Slice/keyword/Client.java +++ b/java-compat/test/src/main/java/test/Slice/keyword/Client.java @@ -37,7 +37,7 @@ public class Client catchI() { } - + @Override public void checkedCast_async(AMD_catch_checkedCast cb, int _clone, Ice.Current current) @@ -192,7 +192,7 @@ public class Client initData.properties.setProperty("Ice.Package._abstract", "test.Slice.keyword"); initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("TestAdapter.Endpoints", "default"); // // We must set MessageSizeMax to an explicit values, diff --git a/java-compat/test/src/main/java/test/Slice/keyword/run.py b/java-compat/test/src/main/java/test/Slice/keyword/run.py deleted file mode 100755 index 851ddcd2d36..00000000000 --- a/java-compat/test/src/main/java/test/Slice/keyword/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.keyword.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Slice/macros/run.py b/java-compat/test/src/main/java/test/Slice/macros/run.py deleted file mode 100755 index a8b0dad4496..00000000000 --- a/java-compat/test/src/main/java/test/Slice/macros/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.macros.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Slice/structure/run.py b/java-compat/test/src/main/java/test/Slice/structure/run.py deleted file mode 100755 index ecb3cf4e54e..00000000000 --- a/java-compat/test/src/main/java/test/Slice/structure/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 - -sys.stdout.write("starting client... ") -sys.stdout.flush() -clientProc = TestUtil.startClient("test.Slice.structure.Client",startReader=False) -print("ok") -clientProc.startReader() -clientProc.waitTestSuccess() diff --git a/java-compat/test/src/main/java/test/Util/Application.java b/java-compat/test/src/main/java/test/Util/Application.java index 5c072418482..7cc08508e3a 100644 --- a/java-compat/test/src/main/java/test/Util/Application.java +++ b/java-compat/test/src/main/java/test/Util/Application.java @@ -15,7 +15,7 @@ public abstract class Application { public final int WAIT = 2; - + public interface ServerReadyListener { @@ -198,7 +198,10 @@ public abstract class Application // protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - return createInitializationData(); + Ice.InitializationData initData = createInitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + argsH.value = initData.properties.parseCommandLineOptions("Test", argsH.value); + return initData; } public java.io.PrintWriter getWriter() @@ -274,6 +277,62 @@ public abstract class Application return _classLoader; } + public String getTestEndpoint(int num) + { + return getTestEndpoint(num, ""); + } + + public String getTestEndpoint(Ice.Properties properties, int num) + { + return getTestEndpoint(properties, num, ""); + } + + public String getTestEndpoint(int num, String prot) + { + return getTestEndpoint(_communicator.getProperties(), num, prot); + } + + static public String getTestEndpoint(Ice.Properties properties, int num, String prot) + { + String protocol = prot; + if(protocol.isEmpty()) + { + protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "default"); + } + int basePort = properties.getPropertyAsIntWithDefault("Test.BasePort", 12010); + return protocol + " -p " + Integer.toString(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; + } + private ClassLoader _classLoader; private String _testName; private Communicator _communicator; |