diff options
Diffstat (limited to 'java')
222 files changed, 592 insertions, 2375 deletions
diff --git a/java/allTests.py b/java/allTests.py index 7ca52f7db4c..e4360c465d3 100755 --- a/java/allTests.py +++ b/java/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/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java index bdf3aceed54..437d0f360e8 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java @@ -31,7 +31,7 @@ class EndpointHostResolver } } - synchronized void resolve(final String host, final int port, final com.zeroc.Ice.EndpointSelectionType selType, + synchronized void resolve(final String host, final int port, final com.zeroc.Ice.EndpointSelectionType selType, final IPEndpointI endpoint, final EndpointI_connectors callback) { // @@ -88,6 +88,7 @@ class EndpointHostResolver com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther); } + com.zeroc.Ice.Instrumentation.Observer obsv = observer; try { int protocol = _protocol; @@ -101,19 +102,23 @@ 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(com.zeroc.Ice.LocalException ex) { - if(observer != null) + if(obsv != null) { - observer.failed(ex.ice_id()); + obsv.failed(ex.ice_id()); + obsv.detach(); } callback.exception(ex); } @@ -125,10 +130,6 @@ class EndpointHostResolver com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle); } - if(observer != null) - { - observer.detach(); - } } } }); diff --git a/java/test/src/main/java/test/Glacier2/router/Client.java b/java/test/src/main/java/test/Glacier2/router/Client.java index c8fe174ee29..88026b6338e 100644 --- a/java/test/src/main/java/test/Glacier2/router/Client.java +++ b/java/test/src/main/java/test/Glacier2/router/Client.java @@ -33,7 +33,7 @@ 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"); } @@ -51,7 +51,7 @@ public class Client extends test.Util.Application out.print("testing router finder... "); out.flush(); com.zeroc.Ice.RouterFinderPrx finder = com.zeroc.Ice.RouterFinderPrx.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"); } @@ -76,7 +76,7 @@ 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"); } @@ -335,6 +335,7 @@ public class Client extends test.Util.Application out.println("ok"); } + if(args.length >= 1 && args[0].equals("--shutdown")) { out.print("testing server shutdown... "); out.flush(); @@ -418,7 +419,7 @@ public class Client extends test.Util.Application { 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"); } diff --git a/java/test/src/main/java/test/Glacier2/router/Server.java b/java/test/src/main/java/test/Glacier2/router/Server.java index 210ff1e4348..b872c6a87a8 100644 --- a/java/test/src/main/java/test/Glacier2/router/Server.java +++ b/java/test/src/main/java/test/Glacier2/router/Server.java @@ -13,7 +13,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)); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); adapter.add(new CallbackI(), com.zeroc.Ice.Util.stringToIdentity("c1/callback")); // The test allows "c1" as category. diff --git a/java/test/src/main/java/test/Glacier2/router/run.py b/java/test/src/main/java/test/Glacier2/router/run.py deleted file mode 100755 index dc815f8eed0..00000000000 --- a/java/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/test/src/main/java/test/Glacier2/sessionHelper/Client.java b/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java index b7c9010785b..9dd2c5062a0 100644 --- a/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java +++ b/java/test/src/main/java/test/Glacier2/sessionHelper/Client.java @@ -34,7 +34,8 @@ public class Client extends test.Util.Application { GetInitDataResult r = super.getInitData(args); _initData = r.initData; - _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347"); + _initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:" + + getTestEndpoint(_initData.properties, 10)); _initData.dispatcher = new com.zeroc.Ice.Dispatcher() { @Override @@ -49,8 +50,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 com.zeroc.Glacier2.SessionFactoryHelper(_initData, new com.zeroc.Glacier2.SessionCallback() { @@ -167,7 +168,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"); @@ -238,7 +239,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) @@ -281,7 +282,7 @@ public class Client extends test.Util.Application out.print("testing stringToProxy for server object... "); out.flush(); - com.zeroc.Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:default -p 12010"); + com.zeroc.Ice.ObjectPrx base = _session.communicator().stringToProxy("callback:" + getTestEndpoint(0)); out.println("ok"); out.print("pinging server after session creation... "); @@ -366,8 +367,7 @@ public class Client extends test.Util.Application com.zeroc.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"); } @@ -456,7 +456,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/test/src/main/java/test/Glacier2/sessionHelper/Server.java b/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java index e7bb210aaf2..2bca2c09829 100644 --- a/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java +++ b/java/test/src/main/java/test/Glacier2/sessionHelper/Server.java @@ -13,10 +13,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)); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); adapter.add(new CallbackI(), com.zeroc.Ice.Util.stringToIdentity("callback")); adapter.activate(); diff --git a/java/test/src/main/java/test/Glacier2/sessionHelper/run.py b/java/test/src/main/java/test/Glacier2/sessionHelper/run.py deleted file mode 100755 index 6ce3382b360..00000000000 --- a/java/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/test/src/main/java/test/Ice/acm/AllTests.java b/java/test/src/main/java/test/Ice/acm/AllTests.java index 9611da859aa..8208748c069 100644 --- a/java/test/src/main/java/test/Ice/acm/AllTests.java +++ b/java/test/src/main/java/test/Ice/acm/AllTests.java @@ -605,10 +605,12 @@ public class AllTests } public static void - allTests(test.Util.Application app, PrintWriter out) + allTests(test.Util.Application app) { com.zeroc.Ice.Communicator communicator = app.communicator(); - String ref = "communicator:default -p 12010"; + PrintWriter out = app.getWriter(); + + String ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx com = RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref)); java.util.List<TestCase> tests = new java.util.ArrayList<>(); diff --git a/java/test/src/main/java/test/Ice/acm/Client.java b/java/test/src/main/java/test/Ice/acm/Client.java index 9378ec7a8c9..6b909a0ae33 100644 --- a/java/test/src/main/java/test/Ice/acm/Client.java +++ b/java/test/src/main/java/test/Ice/acm/Client.java @@ -13,7 +13,7 @@ public class Client extends test.Util.Application { public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/acm/Server.java b/java/test/src/main/java/test/Ice/acm/Server.java index e80a0b6f359..bef22c5b62c 100644 --- a/java/test/src/main/java/test/Ice/acm/Server.java +++ b/java/test/src/main/java/test/Ice/acm/Server.java @@ -29,7 +29,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.acm"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.ACM.Timeout", "1"); return r; diff --git a/java/test/src/main/java/test/Ice/acm/run.py b/java/test/src/main/java/test/Ice/acm/run.py deleted file mode 100755 index 0b375fb252f..00000000000 --- a/java/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/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java b/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java index a70c46dfb02..73f41165ede 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java @@ -21,12 +21,14 @@ public class AllTests } } - public static TestIntfPrx allTests(test.Util.Application app, java.io.PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app) { com.zeroc.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); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -74,7 +76,7 @@ public class AllTests com.zeroc.Ice.InitializationData initData = app.createInitializationData(); initData.properties = communicator.getProperties()._clone(); com.zeroc.Ice.Communicator comm = app.initialize(initData); - comm.stringToProxy("test:default -p 12010").ice_pingAsync(); + comm.stringToProxy("test:" + app.getTestEndpoint(0)).ice_pingAsync(); comm.destroy(); } out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java index 11d93d4fd6e..d88b62068e5 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Client.java @@ -13,7 +13,7 @@ public class Client extends test.Util.Application { public int run(String[] args) { - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java index 6fd0e950cf8..1509ba6f36b 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Collocated.java @@ -17,7 +17,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.ServantLocator locator = new ServantLocatorI(); adapter.addServantLocator(locator, ""); - AllTests.allTests(this, getWriter()); + AllTests.allTests(this); adapter.waitForDeactivate(); return 0; @@ -33,7 +33,7 @@ public class Collocated extends test.Util.Application r.initData.properties.setProperty("TestAdapter.ThreadPool.Size", "2"); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java b/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java index 60aab57c2a1..9d4a0710324 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/Server.java @@ -27,10 +27,10 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); return r; } - + public static void main(String[] args) { Server app = new Server(); diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java b/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java index 7b630a3f5b1..3eb09cd5ea6 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/TestI.java @@ -18,7 +18,7 @@ public final class TestI implements TestIntf com.zeroc.Ice.Communicator communicator = current.adapter.getCommunicator(); com.zeroc.Ice.ObjectAdapter adapter = - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); adapter.activate(); adapter.destroy(); } diff --git a/java/test/src/main/java/test/Ice/adapterDeactivation/run.py b/java/test/src/main/java/test/Ice/adapterDeactivation/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/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/test/src/main/java/test/Ice/admin/AllTests.java b/java/test/src/main/java/test/Ice/admin/AllTests.java index 1d430d7f59e..ee267ed743c 100644 --- a/java/test/src/main/java/test/Ice/admin/AllTests.java +++ b/java/test/src/main/java/test/Ice/admin/AllTests.java @@ -101,8 +101,10 @@ public class AllTests } } - public static void allTests(test.Util.Application app, PrintWriter out) + public static void allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); + out.print("testing communicator operations... "); out.flush(); { @@ -181,7 +183,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 = RemoteCommunicatorFactoryPrx.uncheckedCast(app.communicator().stringToProxy(ref)); diff --git a/java/test/src/main/java/test/Ice/admin/Client.java b/java/test/src/main/java/test/Ice/admin/Client.java index e3d4bbe677b..c39a3d587a2 100644 --- a/java/test/src/main/java/test/Ice/admin/Client.java +++ b/java/test/src/main/java/test/Ice/admin/Client.java @@ -14,8 +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/test/src/main/java/test/Ice/admin/Server.java b/java/test/src/main/java/test/Ice/admin/Server.java index 3f358ab5624..3c4ed0005d5 100644 --- a/java/test/src/main/java/test/Ice/admin/Server.java +++ b/java/test/src/main/java/test/Ice/admin/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.admin"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/admin/run.py b/java/test/src/main/java/test/Ice/admin/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/ami/AllTests.java b/java/test/src/main/java/test/Ice/ami/AllTests.java index 7ba6494dedf..d10e554a9b9 100644 --- a/java/test/src/main/java/test/Ice/ami/AllTests.java +++ b/java/test/src/main/java/test/Ice/ami/AllTests.java @@ -30,13 +30,13 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); TestIntfPrx p = TestIntfPrx.uncheckedCast(obj); - sref = "testController:default -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java/test/src/main/java/test/Ice/ami/Collocated.java b/java/test/src/main/java/test/Ice/ami/Collocated.java index 950ff2e2c08..f224423aa33 100644 --- a/java/test/src/main/java/test/Ice/ami/Collocated.java +++ b/java/test/src/main/java/test/Ice/ami/Collocated.java @@ -31,8 +31,8 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); r.initData.properties.setProperty("Ice.Warn.AMICallback", "0"); return r; diff --git a/java/test/src/main/java/test/Ice/ami/Server.java b/java/test/src/main/java/test/Ice/ami/Server.java index 6c009fb4b0b..90a41a5eaf5 100644 --- a/java/test/src/main/java/test/Ice/ami/Server.java +++ b/java/test/src/main/java/test/Ice/ami/Server.java @@ -30,8 +30,8 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.ami"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java/test/src/main/java/test/Ice/ami/run.py b/java/test/src/main/java/test/Ice/ami/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/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/test/src/main/java/test/Ice/background/AllTests.java b/java/test/src/main/java/test/Ice/background/AllTests.java index 4eb1ba9fe78..ca465338b01 100644 --- a/java/test/src/main/java/test/Ice/background/AllTests.java +++ b/java/test/src/main/java/test/Ice/background/AllTests.java @@ -161,16 +161,18 @@ public class AllTests private BackgroundPrx _background = null; } - public static BackgroundPrx allTests(Configuration configuration, com.zeroc.Ice.Communicator communicator, - PrintWriter out) + public static BackgroundPrx allTests(Configuration configuration, test.Util.Application app) { - String sref = "background:default -p 12010"; + com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String sref = "background:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); BackgroundPrx background = BackgroundPrx.uncheckedCast(obj); - sref = "backgroundController:tcp -p 12011"; + sref = "backgroundController:" + app.getTestEndpoint(1, "tcp"); obj = communicator.stringToProxy(sref); test(obj != null); @@ -208,7 +210,7 @@ public class AllTests out.flush(); { com.zeroc.Ice.LocatorPrx locator; - obj = communicator.stringToProxy("locator:default -p 12010").ice_invocationTimeout(250); + obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)).ice_invocationTimeout(250); locator = com.zeroc.Ice.LocatorPrx.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway(); @@ -223,7 +225,7 @@ public class AllTests } backgroundController.resumeCall("findAdapterById"); - obj = communicator.stringToProxy("locator:default -p 12010"); + obj = communicator.stringToProxy("locator:" + app.getTestEndpoint(0)); locator = com.zeroc.Ice.LocatorPrx.uncheckedCast(obj); obj = obj.ice_locator(locator); obj.ice_ping(); @@ -249,7 +251,7 @@ public class AllTests { com.zeroc.Ice.RouterPrx router; - obj = communicator.stringToProxy("router:default -p 12010").ice_invocationTimeout(250); + obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)).ice_invocationTimeout(250); router = com.zeroc.Ice.RouterPrx.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway(); @@ -264,7 +266,7 @@ public class AllTests } backgroundController.resumeCall("getClientProxy"); - obj = communicator.stringToProxy("router:default -p 12010"); + obj = communicator.stringToProxy("router:" + app.getTestEndpoint(0)); router = com.zeroc.Ice.RouterPrx.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router); BackgroundPrx bg = BackgroundPrx.uncheckedCast(obj); diff --git a/java/test/src/main/java/test/Ice/background/Client.java b/java/test/src/main/java/test/Ice/background/Client.java index 6f01077c2be..1f806864d29 100644 --- a/java/test/src/main/java/test/Ice/background/Client.java +++ b/java/test/src/main/java/test/Ice/background/Client.java @@ -17,12 +17,8 @@ public class Client extends test.Util.Application @Override 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(plugin.getConfiguration(), this); background.shutdown(); return 0; } @@ -55,9 +51,6 @@ public class Client extends test.Util.Application r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - // Don't initialize the plugin until I've set the configuration. - r.initData.properties.setProperty("Ice.InitPlugins", "0"); - return r; } diff --git a/java/test/src/main/java/test/Ice/background/Collocated.java b/java/test/src/main/java/test/Ice/background/Collocated.java deleted file mode 100644 index 53d1312a999..00000000000 --- a/java/test/src/main/java/test/Ice/background/Collocated.java +++ /dev/null @@ -1,100 +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/test/src/main/java/test/Ice/background/PluginFactory.java b/java/test/src/main/java/test/Ice/background/PluginFactory.java index 881b6c877ab..015d9890fbf 100644 --- a/java/test/src/main/java/test/Ice/background/PluginFactory.java +++ b/java/test/src/main/java/test/Ice/background/PluginFactory.java @@ -21,7 +21,6 @@ public class PluginFactory implements com.zeroc.Ice.PluginFactory @Override public void initialize() { - assert _configuration != null; com.zeroc.IceInternal.ProtocolPluginFacade facade = com.zeroc.IceInternal.Util.getProtocolPluginFacade(_communicator); for(short s = 0; s < 100; ++s) @@ -39,13 +38,13 @@ public class PluginFactory implements com.zeroc.Ice.PluginFactory { } - public void setConfiguration(Configuration configuration) + public Configuration getConfiguration() { - _configuration = configuration; + return _configuration; } private final com.zeroc.Ice.Communicator _communicator; - private Configuration _configuration; + private Configuration _configuration = new Configuration(); } @Override diff --git a/java/test/src/main/java/test/Ice/background/Server.java b/java/test/src/main/java/test/Ice/background/Server.java index 5e78f5aa171..24c26410b2f 100644 --- a/java/test/src/main/java/test/Ice/background/Server.java +++ b/java/test/src/main/java/test/Ice/background/Server.java @@ -83,10 +83,8 @@ public class Server extends test.Util.Application @Override 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(); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); @@ -128,13 +126,11 @@ public class Server extends test.Util.Application r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 1, "tcp")); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); - // Don't initialize the plugin until I've set the configuration. - r.initData.properties.setProperty("Ice.InitPlugins", "0"); - return r; } diff --git a/java/test/src/main/java/test/Ice/background/run.py b/java/test/src/main/java/test/Ice/background/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/binding/AllTests.java b/java/test/src/main/java/test/Ice/binding/AllTests.java index d2242539593..77c93127f7d 100644 --- a/java/test/src/main/java/test/Ice/binding/AllTests.java +++ b/java/test/src/main/java/test/Ice/binding/AllTests.java @@ -60,7 +60,7 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String ref = "communicator:default -p 12010"; + String ref = "communicator:" + app.getTestEndpoint(0); RemoteCommunicatorPrx rcom = RemoteCommunicatorPrx.uncheckedCast(communicator.stringToProxy(ref)); out.print("testing binding with single endpoint... "); @@ -833,19 +833,21 @@ public class AllTests clientProps.add(bothPreferIPv4); clientProps.add(bothPreferIPv6); + String endpoint = "tcp -p " + app.getTestPort(2); + com.zeroc.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"); com.zeroc.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\""); com.zeroc.Ice.Properties anyboth = com.zeroc.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"); com.zeroc.Ice.Properties localipv4 = ipv4._clone(); localipv4.setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1"); diff --git a/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java b/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java index 88560cd77c8..a6146a1dc85 100644 --- a/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java +++ b/java/test/src/main/java/test/Ice/binding/RemoteCommunicatorI.java @@ -14,17 +14,19 @@ import test.Ice.binding.Test.RemoteCommunicator; public class RemoteCommunicatorI implements RemoteCommunicator { + public + RemoteCommunicatorI(test.Util.Application app) + { + _app = app; + } + @Override public RemoteObjectAdapterPrx createObjectAdapter(String name, String endpts, com.zeroc.Ice.Current current) { 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); } com.zeroc.Ice.Communicator com = current.adapter.getCommunicator(); @@ -45,5 +47,6 @@ public class RemoteCommunicatorI implements RemoteCommunicator current.adapter.getCommunicator().shutdown(); } - private int _nextPort = 10001; + private final test.Util.Application _app; + private int _nextPort = 10; } diff --git a/java/test/src/main/java/test/Ice/binding/Server.java b/java/test/src/main/java/test/Ice/binding/Server.java index 1e950456eb9..8a76192e5f0 100644 --- a/java/test/src/main/java/test/Ice/binding/Server.java +++ b/java/test/src/main/java/test/Ice/binding/Server.java @@ -17,7 +17,7 @@ public class Server extends test.Util.Application com.zeroc.Ice.Communicator communicator = communicator(); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("communicator"); - adapter.add(new RemoteCommunicatorI(), id); + adapter.add(new RemoteCommunicatorI(this), id); adapter.activate(); return WAIT; @@ -28,7 +28,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); return r; } diff --git a/java/test/src/main/java/test/Ice/binding/run.py b/java/test/src/main/java/test/Ice/binding/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/checksum/AllTests.java b/java/test/src/main/java/test/Ice/checksum/AllTests.java index 67980ce1e85..d861125dfa4 100644 --- a/java/test/src/main/java/test/Ice/checksum/AllTests.java +++ b/java/test/src/main/java/test/Ice/checksum/AllTests.java @@ -22,9 +22,12 @@ public class AllTests } } - public static ChecksumPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out) + public static ChecksumPrx allTests(test.Util.Application app, boolean collocated) { - String ref = "test:default -p 12010"; + com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); diff --git a/java/test/src/main/java/test/Ice/checksum/Client.java b/java/test/src/main/java/test/Ice/checksum/Client.java index 335fc5f2265..3df98772922 100644 --- a/java/test/src/main/java/test/Ice/checksum/Client.java +++ b/java/test/src/main/java/test/Ice/checksum/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter()); + ChecksumPrx checksum = AllTests.allTests(this, false); checksum.shutdown(); return 0; } @@ -34,7 +33,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/test/src/main/java/test/Ice/checksum/Server.java b/java/test/src/main/java/test/Ice/checksum/Server.java index bc8b0437b80..b5adcbd032b 100644 --- a/java/test/src/main/java/test/Ice/checksum/Server.java +++ b/java/test/src/main/java/test/Ice/checksum/Server.java @@ -15,14 +15,14 @@ public class Server extends test.Util.Application public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Object object = new ChecksumI(); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test")); adapter.activate(); return WAIT; } - + @Override protected GetInitDataResult getInitData(String[] args) { @@ -35,7 +35,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/test/src/main/java/test/Ice/checksum/run.py b/java/test/src/main/java/test/Ice/checksum/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/classLoader/AllTests.java b/java/test/src/main/java/test/Ice/classLoader/AllTests.java index bb40bf214d3..798ca80049c 100644 --- a/java/test/src/main/java/test/Ice/classLoader/AllTests.java +++ b/java/test/src/main/java/test/Ice/classLoader/AllTests.java @@ -138,7 +138,7 @@ public class AllTests initData.classLoader = classLoader; com.zeroc.Ice.Communicator ic = app.initialize(initData); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = ic.stringToProxy(ref); test(base != null); diff --git a/java/test/src/main/java/test/Ice/classLoader/Server.java b/java/test/src/main/java/test/Ice/classLoader/Server.java index ba93de5f20a..ceea2fe9299 100644 --- a/java/test/src/main/java/test/Ice/classLoader/Server.java +++ b/java/test/src/main/java/test/Ice/classLoader/Server.java @@ -28,7 +28,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.classLoader"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Default.SlicedFormat", "1"); return r; } diff --git a/java/test/src/main/java/test/Ice/classLoader/run.py b/java/test/src/main/java/test/Ice/classLoader/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/custom/AllTests.java b/java/test/src/main/java/test/Ice/custom/AllTests.java index 4087569b91d..2364cdc8eb2 100644 --- a/java/test/src/main/java/test/Ice/custom/AllTests.java +++ b/java/test/src/main/java/test/Ice/custom/AllTests.java @@ -39,11 +39,13 @@ public class AllTests } } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app) { + com.zeroc.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); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/custom/Client.java b/java/test/src/main/java/test/Ice/custom/Client.java index 59a214bd855..578a7bd401c 100644 --- a/java/test/src/main/java/test/Ice/custom/Client.java +++ b/java/test/src/main/java/test/Ice/custom/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + TestIntfPrx test = AllTests.allTests(this); test.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/custom/Collocated.java b/java/test/src/main/java/test/Ice/custom/Collocated.java index 35c9013250d..3c1931ffbf2 100644 --- a/java/test/src/main/java/test/Ice/custom/Collocated.java +++ b/java/test/src/main/java/test/Ice/custom/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.Object test = new TestI(communicator); adapter.add(test, com.zeroc.Ice.Util.stringToIdentity("test")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -29,7 +29,7 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/custom/Server.java b/java/test/src/main/java/test/Ice/custom/Server.java index 2d73b389827..d962f6c3dee 100644 --- a/java/test/src/main/java/test/Ice/custom/Server.java +++ b/java/test/src/main/java/test/Ice/custom/Server.java @@ -29,7 +29,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.CacheMessageBuffers", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/custom/run.py b/java/test/src/main/java/test/Ice/custom/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/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/test/src/main/java/test/Ice/defaultServant/AllTests.java b/java/test/src/main/java/test/Ice/defaultServant/AllTests.java index 3e22df248de..54f9a72d551 100644 --- a/java/test/src/main/java/test/Ice/defaultServant/AllTests.java +++ b/java/test/src/main/java/test/Ice/defaultServant/AllTests.java @@ -22,9 +22,11 @@ public class AllTests } } - public static void allTests(test.Util.Application app, PrintWriter out) + public static void allTests(test.Util.Application app) { com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + com.zeroc.Ice.ObjectAdapter oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost"); oa.activate(); diff --git a/java/test/src/main/java/test/Ice/defaultServant/Client.java b/java/test/src/main/java/test/Ice/defaultServant/Client.java index f5956bead6b..f0cdcbeece8 100644 --- a/java/test/src/main/java/test/Ice/defaultServant/Client.java +++ b/java/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/test/src/main/java/test/Ice/defaultServant/run.py b/java/test/src/main/java/test/Ice/defaultServant/run.py deleted file mode 100755 index 86b25876539..00000000000 --- a/java/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/test/src/main/java/test/Ice/defaultValue/AllTests.java b/java/test/src/main/java/test/Ice/defaultValue/AllTests.java index 397f8213d5f..30e7ce1dfd8 100644 --- a/java/test/src/main/java/test/Ice/defaultValue/AllTests.java +++ b/java/test/src/main/java/test/Ice/defaultValue/AllTests.java @@ -22,8 +22,10 @@ public class AllTests } } - public static void allTests(test.Util.Application app, PrintWriter out) + public static void allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); + out.print("testing default values... "); out.flush(); diff --git a/java/test/src/main/java/test/Ice/defaultValue/Client.java b/java/test/src/main/java/test/Ice/defaultValue/Client.java index 7d13b0c7645..ec2c3d21842 100644 --- a/java/test/src/main/java/test/Ice/defaultValue/Client.java +++ b/java/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/test/src/main/java/test/Ice/defaultValue/run.py b/java/test/src/main/java/test/Ice/defaultValue/run.py deleted file mode 100755 index 06a587612d9..00000000000 --- a/java/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/test/src/main/java/test/Ice/dispatcher/AllTests.java b/java/test/src/main/java/test/Ice/dispatcher/AllTests.java index 52d89c483f4..886ba779dda 100644 --- a/java/test/src/main/java/test/Ice/dispatcher/AllTests.java +++ b/java/test/src/main/java/test/Ice/dispatcher/AllTests.java @@ -60,9 +60,12 @@ public class AllTests } } - public static void allTests(com.zeroc.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"; + com.zeroc.Ice.Communicator communicator = app.communicator(); + PrintWriter out = app.getWriter(); + + String sref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); @@ -74,7 +77,7 @@ public class AllTests TestIntfPrx p = TestIntfPrx.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1, "tcp"); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java/test/src/main/java/test/Ice/dispatcher/Client.java b/java/test/src/main/java/test/Ice/dispatcher/Client.java index f3de9eb86ed..f5b8fcaf772 100644 --- a/java/test/src/main/java/test/Ice/dispatcher/Client.java +++ b/java/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; } diff --git a/java/test/src/main/java/test/Ice/dispatcher/Collocated.java b/java/test/src/main/java/test/Ice/dispatcher/Collocated.java index 5d9e2eeda34..390e834bcfb 100644 --- a/java/test/src/main/java/test/Ice/dispatcher/Collocated.java +++ b/java/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), com.zeroc.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; } @@ -34,8 +34,9 @@ public class Collocated extends test.Util.Application assert(_dispatcher == null); _dispatcher = new Dispatcher(); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 1, "tcp")); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); r.initData.dispatcher = _dispatcher; return r; diff --git a/java/test/src/main/java/test/Ice/dispatcher/Server.java b/java/test/src/main/java/test/Ice/dispatcher/Server.java index 79cc2a615e9..f1204fff135 100644 --- a/java/test/src/main/java/test/Ice/dispatcher/Server.java +++ b/java/test/src/main/java/test/Ice/dispatcher/Server.java @@ -33,8 +33,9 @@ public class Server extends test.Util.Application assert(_dispatcher == null); _dispatcher = new Dispatcher(); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.dispatcher"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 1, "tcp")); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java/test/src/main/java/test/Ice/dispatcher/run.py b/java/test/src/main/java/test/Ice/dispatcher/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/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/test/src/main/java/test/Ice/echo/Server.java b/java/test/src/main/java/test/Ice/echo/Server.java index d53b8092bc8..d27979ffdf6 100644 --- a/java/test/src/main/java/test/Ice/echo/Server.java +++ b/java/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(com.zeroc.Ice.Current current) { _blob.startBatch(); } - + @Override public void flushBatch(com.zeroc.Ice.Current current) { _blob.flushBatch(); } - + @Override public void shutdown(com.zeroc.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)); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); BlobjectI blob = new BlobjectI(); adapter.addDefaultServant(blob, ""); diff --git a/java/test/src/main/java/test/Ice/echo/run.py b/java/test/src/main/java/test/Ice/echo/run.py deleted file mode 100755 index 3f861533410..00000000000 --- a/java/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/test/src/main/java/test/Ice/enums/AllTests.java b/java/test/src/main/java/test/Ice/enums/AllTests.java index ede32b99d90..74a4493f107 100644 --- a/java/test/src/main/java/test/Ice/enums/AllTests.java +++ b/java/test/src/main/java/test/Ice/enums/AllTests.java @@ -22,9 +22,11 @@ public class AllTests } } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); TestIntfPrx proxy = TestIntfPrx.checkedCast(obj); diff --git a/java/test/src/main/java/test/Ice/enums/Client.java b/java/test/src/main/java/test/Ice/enums/Client.java index a1bb85c7c7a..90c335f5025 100644 --- a/java/test/src/main/java/test/Ice/enums/Client.java +++ b/java/test/src/main/java/test/Ice/enums/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + TestIntfPrx test = AllTests.allTests(this); test.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/enums/Server.java b/java/test/src/main/java/test/Ice/enums/Server.java index f79e37caf20..126be74279c 100644 --- a/java/test/src/main/java/test/Ice/enums/Server.java +++ b/java/test/src/main/java/test/Ice/enums/Server.java @@ -29,7 +29,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.enums"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/enums/run.py b/java/test/src/main/java/test/Ice/enums/run.py deleted file mode 100755 index 1b234c88804..00000000000 --- a/java/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/test/src/main/java/test/Ice/exceptions/AMDServer.java b/java/test/src/main/java/test/Ice/exceptions/AMDServer.java index db7a4589500..59fce2ddc6b 100644 --- a/java/test/src/main/java/test/Ice/exceptions/AMDServer.java +++ b/java/test/src/main/java/test/Ice/exceptions/AMDServer.java @@ -42,11 +42,11 @@ public class AMDServer extends test.Util.Application r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); + r.initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - r.initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); + r.initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(r.initData.properties, 2)); r.initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); return r; diff --git a/java/test/src/main/java/test/Ice/exceptions/AllTests.java b/java/test/src/main/java/test/Ice/exceptions/AllTests.java index 3d4be1c4ed2..1cce083ca40 100644 --- a/java/test/src/main/java/test/Ice/exceptions/AllTests.java +++ b/java/test/src/main/java/test/Ice/exceptions/AllTests.java @@ -28,8 +28,10 @@ public class AllTests } } - public static ThrowerPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static ThrowerPrx allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); { out.print("testing object adapter registration exceptions... "); com.zeroc.Ice.ObjectAdapter first; @@ -149,7 +151,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "thrower:default -p 12010"; + String ref = "thrower:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -446,7 +448,8 @@ public class AllTests test(false); } - ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:default -p 12011")); + ThrowerPrx thrower2 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:" + + app.getTestEndpoint(1))); try { thrower2.throwMemoryLimitException(new byte[2 * 1024 * 1024]); // 2MB (no limits) @@ -454,7 +457,8 @@ public class AllTests catch(com.zeroc.Ice.MemoryLimitException ex) { } - ThrowerPrx thrower3 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:default -p 12012")); + ThrowerPrx thrower3 = ThrowerPrx.uncheckedCast(communicator.stringToProxy("thrower:" + + app.getTestEndpoint(2))); try { thrower3.throwMemoryLimitException(new byte[1024]); // 1KB limit diff --git a/java/test/src/main/java/test/Ice/exceptions/Client.java b/java/test/src/main/java/test/Ice/exceptions/Client.java index 250f94e580b..0c574a021fa 100644 --- a/java/test/src/main/java/test/Ice/exceptions/Client.java +++ b/java/test/src/main/java/test/Ice/exceptions/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - ThrowerPrx thrower = AllTests.allTests(communicator, getWriter()); + ThrowerPrx thrower = AllTests.allTests(this); thrower.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/exceptions/Collocated.java b/java/test/src/main/java/test/Ice/exceptions/Collocated.java index 79b3920ff97..89311554cf0 100644 --- a/java/test/src/main/java/test/Ice/exceptions/Collocated.java +++ b/java/test/src/main/java/test/Ice/exceptions/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.Object object = new ThrowerI(); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("thrower")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -38,7 +38,7 @@ public class Collocated extends test.Util.Application r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/exceptions/Server.java b/java/test/src/main/java/test/Ice/exceptions/Server.java index 188e3f5c809..5897c150355 100644 --- a/java/test/src/main/java/test/Ice/exceptions/Server.java +++ b/java/test/src/main/java/test/Ice/exceptions/Server.java @@ -41,11 +41,11 @@ public class Server extends test.Util.Application r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011"); + r.initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("TestAdapter2.MessageSizeMax", "0"); - r.initData.properties.setProperty("TestAdapter3.Endpoints", "default -p 12012"); + r.initData.properties.setProperty("TestAdapter3.Endpoints", getTestEndpoint(r.initData.properties, 2)); r.initData.properties.setProperty("TestAdapter3.MessageSizeMax", "1"); return r; diff --git a/java/test/src/main/java/test/Ice/exceptions/run.py b/java/test/src/main/java/test/Ice/exceptions/run.py deleted file mode 100755 index 65b4b4d0e93..00000000000 --- a/java/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/test/src/main/java/test/Ice/facets/AllTests.java b/java/test/src/main/java/test/Ice/facets/AllTests.java index f59389cd945..f6495ff5725 100644 --- a/java/test/src/main/java/test/Ice/facets/AllTests.java +++ b/java/test/src/main/java/test/Ice/facets/AllTests.java @@ -28,8 +28,10 @@ public class AllTests } } - public static GPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static GPrx allTests(test.Util.Application app) { + com.zeroc.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"); @@ -109,7 +111,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "d:default -p 12010"; + String ref = "d:" + app.getTestEndpoint(0); ObjectPrx db = communicator.stringToProxy(ref); test(db != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/facets/Client.java b/java/test/src/main/java/test/Ice/facets/Client.java index 0706f029849..152f01ed5ba 100644 --- a/java/test/src/main/java/test/Ice/facets/Client.java +++ b/java/test/src/main/java/test/Ice/facets/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - GPrx g = AllTests.allTests(communicator, getWriter()); + GPrx g = AllTests.allTests(this); g.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/facets/Collocated.java b/java/test/src/main/java/test/Ice/facets/Collocated.java index bbd89715144..8efbd5253e4 100644 --- a/java/test/src/main/java/test/Ice/facets/Collocated.java +++ b/java/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) { com.zeroc.Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Object d = new DI(); adapter.add(d, com.zeroc.Ice.Util.stringToIdentity("d")); @@ -25,7 +25,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.Object h = new HI(communicator); adapter.addFacet(h, com.zeroc.Ice.Util.stringToIdentity("d"), "facetGH"); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/facets/Server.java b/java/test/src/main/java/test/Ice/facets/Server.java index fa7361b69e4..19e44faba90 100644 --- a/java/test/src/main/java/test/Ice/facets/Server.java +++ b/java/test/src/main/java/test/Ice/facets/Server.java @@ -34,7 +34,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/facets/run.py b/java/test/src/main/java/test/Ice/facets/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/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/test/src/main/java/test/Ice/faultTolerance/AllTests.java b/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java index a5beb3fffb1..2767f3773ce 100644 --- a/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java +++ b/java/test/src/main/java/test/Ice/faultTolerance/AllTests.java @@ -97,14 +97,17 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator, int[] ports, PrintWriter out) + public static void allTests(test.Util.Application app, int[] ports) { + com.zeroc.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); } com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); diff --git a/java/test/src/main/java/test/Ice/faultTolerance/Client.java b/java/test/src/main/java/test/Ice/faultTolerance/Client.java index 0ddd58774e1..17af85f2598 100644 --- a/java/test/src/main/java/test/Ice/faultTolerance/Client.java +++ b/java/test/src/main/java/test/Ice/faultTolerance/Client.java @@ -68,7 +68,7 @@ public class Client extends test.Util.Application try { - AllTests.allTests(communicator(), arr, out); + AllTests.allTests(this, arr); } catch(com.zeroc.Ice.LocalException ex) { diff --git a/java/test/src/main/java/test/Ice/faultTolerance/Server.java b/java/test/src/main/java/test/Ice/faultTolerance/Server.java index f856e8d6f4a..0a19794900a 100644 --- a/java/test/src/main/java/test/Ice/faultTolerance/Server.java +++ b/java/test/src/main/java/test/Ice/faultTolerance/Server.java @@ -61,7 +61,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) + ":udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Object object = new TestI(port); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("test")); diff --git a/java/test/src/main/java/test/Ice/faultTolerance/run.py b/java/test/src/main/java/test/Ice/faultTolerance/run.py deleted file mode 100755 index f3e808802b0..00000000000 --- a/java/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/test/src/main/java/test/Ice/hash/run.py b/java/test/src/main/java/test/Ice/hash/run.py deleted file mode 100755 index 5175a3d1877..00000000000 --- a/java/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/test/src/main/java/test/Ice/hold/AllTests.java b/java/test/src/main/java/test/Ice/hold/AllTests.java index 33e4f97d994..31db0c827da 100644 --- a/java/test/src/main/java/test/Ice/hold/AllTests.java +++ b/java/test/src/main/java/test/Ice/hold/AllTests.java @@ -32,7 +32,7 @@ public class AllTests { _value = value; } - + synchronized public void set(boolean value) { _value = value; @@ -42,7 +42,7 @@ public class AllTests { return _value; } - + private boolean _value; } @@ -66,19 +66,20 @@ public class AllTests private int _expected; } - public static void allTests(test.Util.Application app, PrintWriter out) + public static void allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); com.zeroc.Ice.Communicator communicator = app.communicator(); out.print("testing stringToProxy... "); out.flush(); - String ref = "hold:default -p 12010"; + String ref = "hold:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - String refSerialized = "hold:default -p 12011"; + String refSerialized = "hold:" + app.getTestEndpoint(1); com.zeroc.Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized); test(baseSerialized != null); out.println("ok"); - + out.print("testing checked cast... "); out.flush(); HoldPrx hold = HoldPrx.checkedCast(base); @@ -90,7 +91,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) @@ -110,7 +111,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 +228,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/test/src/main/java/test/Ice/hold/Client.java b/java/test/src/main/java/test/Ice/hold/Client.java index 6ac9c4c10e1..e117003f8f6 100644 --- a/java/test/src/main/java/test/Ice/hold/Client.java +++ b/java/test/src/main/java/test/Ice/hold/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/test/src/main/java/test/Ice/hold/Server.java b/java/test/src/main/java/test/Ice/hold/Server.java index 0167c743125..750dcf0fdbb 100644 --- a/java/test/src/main/java/test/Ice/hold/Server.java +++ b/java/test/src/main/java/test/Ice/hold/Server.java @@ -39,13 +39,13 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold"); - r.initData.properties.setProperty("TestAdapter1.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter1.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("TestAdapter1.ThreadPool.Size", "5"); r.initData.properties.setProperty("TestAdapter1.ThreadPool.SizeMax", "5"); r.initData.properties.setProperty("TestAdapter1.ThreadPool.SizeWarn", "0"); r.initData.properties.setProperty("TestAdapter1.ThreadPool.Serialize", "0"); - r.initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011:udp"); + r.initData.properties.setProperty("TestAdapter2.Endpoints", getTestEndpoint(r.initData.properties, 1) + ":udp"); r.initData.properties.setProperty("TestAdapter2.ThreadPool.Size", "5"); r.initData.properties.setProperty("TestAdapter2.ThreadPool.SizeMax", "5"); r.initData.properties.setProperty("TestAdapter2.ThreadPool.SizeWarn", "0"); diff --git a/java/test/src/main/java/test/Ice/hold/run.py b/java/test/src/main/java/test/Ice/hold/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/info/AllTests.java b/java/test/src/main/java/test/Ice/info/AllTests.java index 23594b9548b..9123be0a685 100644 --- a/java/test/src/main/java/test/Ice/info/AllTests.java +++ b/java/test/src/main/java/test/Ice/info/AllTests.java @@ -64,8 +64,10 @@ public class AllTests return null; } - public static void allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static void allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); out.print("testing proxy endpoint information... "); out.flush(); { @@ -136,8 +138,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(); @@ -148,26 +151,30 @@ public class AllTests for(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"); - com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test:default -p 12010:udp -p 12010"); + com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test:" + + app.getTestEndpoint(0) + ":" + + app.getTestEndpoint(0, "udp")); TestIntfPrx testIntf = TestIntfPrx.checkedCast(base); + int endpointPort = app.getTestPort(0); + out.print("test connection endpoint information... "); out.flush(); { EndpointInfo info = base.ice_getConnection().getEndpoint().getInfo(); TCPEndpointInfo tcpinfo = getTCPEndpointInfo(info); - test(tcpinfo.port == 12010); + test(tcpinfo.port == endpointPort); test(!tcpinfo.compress); test(tcpinfo.host.equals(defaultHost)); @@ -179,7 +186,7 @@ public class AllTests info = base.ice_datagram().ice_getConnection().getEndpoint().getInfo(); UDPEndpointInfo udp = (UDPEndpointInfo)info; - test(udp.port == 12010); + test(udp.port == endpointPort); test(udp.host.equals(defaultHost)); } out.println("ok"); @@ -194,7 +201,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)); @@ -233,7 +240,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/test/src/main/java/test/Ice/info/Client.java b/java/test/src/main/java/test/Ice/info/Client.java index 165bb7e8b2d..37aa8a2d368 100644 --- a/java/test/src/main/java/test/Ice/info/Client.java +++ b/java/test/src/main/java/test/Ice/info/Client.java @@ -14,7 +14,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - AllTests.allTests(communicator(), getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/info/Server.java b/java/test/src/main/java/test/Ice/info/Server.java index c262bfab160..b45d1d3e921 100644 --- a/java/test/src/main/java/test/Ice/info/Server.java +++ b/java/test/src/main/java/test/Ice/info/Server.java @@ -26,7 +26,9 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + ":" + + getTestEndpoint(r.initData.properties, 0, "udp")); return r; } diff --git a/java/test/src/main/java/test/Ice/info/run.py b/java/test/src/main/java/test/Ice/info/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/inheritance/AllTests.java b/java/test/src/main/java/test/Ice/inheritance/AllTests.java index c9b7515c3c0..e2c61c3bbc7 100644 --- a/java/test/src/main/java/test/Ice/inheritance/AllTests.java +++ b/java/test/src/main/java/test/Ice/inheritance/AllTests.java @@ -31,11 +31,13 @@ public class AllTests } } - public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app) { + com.zeroc.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); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -79,7 +81,7 @@ public class AllTests CAPrx cao; CBPrx cbo; CCPrx cco; - + cao = ca.caop(ca); test(cao.equals(ca)); cao = ca.caop(cb); @@ -98,7 +100,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/test/src/main/java/test/Ice/inheritance/Client.java b/java/test/src/main/java/test/Ice/inheritance/Client.java index 0094eac4df3..76b917f0649 100644 --- a/java/test/src/main/java/test/Ice/inheritance/Client.java +++ b/java/test/src/main/java/test/Ice/inheritance/Client.java @@ -16,8 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - InitialPrx initial = AllTests.allTests(communicator, getWriter()); + InitialPrx initial = AllTests.allTests(this); initial.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/inheritance/Collocated.java b/java/test/src/main/java/test/Ice/inheritance/Collocated.java index db86f22a5a0..c2e0c49b503 100644 --- a/java/test/src/main/java/test/Ice/inheritance/Collocated.java +++ b/java/test/src/main/java/test/Ice/inheritance/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application com.zeroc.Ice.Object object = new InitialI(adapter); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("initial")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } @@ -29,7 +29,7 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/inheritance/Server.java b/java/test/src/main/java/test/Ice/inheritance/Server.java index 65ebc89e913..a3a10cd21e1 100644 --- a/java/test/src/main/java/test/Ice/inheritance/Server.java +++ b/java/test/src/main/java/test/Ice/inheritance/Server.java @@ -27,7 +27,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/inheritance/run.py b/java/test/src/main/java/test/Ice/inheritance/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/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/test/src/main/java/test/Ice/interceptor/Client.java b/java/test/src/main/java/test/Ice/interceptor/Client.java index f2492fa2757..4e1515ee14c 100644 --- a/java/test/src/main/java/test/Ice/interceptor/Client.java +++ b/java/test/src/main/java/test/Ice/interceptor/Client.java @@ -231,6 +231,7 @@ public class Client extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.interceptor"); + r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/interceptor/run.py b/java/test/src/main/java/test/Ice/interceptor/run.py deleted file mode 100755 index 99d35706c32..00000000000 --- a/java/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/test/src/main/java/test/Ice/interrupt/AllTests.java b/java/test/src/main/java/test/Ice/interrupt/AllTests.java index 44a58339065..ac7efacb3df 100644 --- a/java/test/src/main/java/test/Ice/interrupt/AllTests.java +++ b/java/test/src/main/java/test/Ice/interrupt/AllTests.java @@ -86,13 +86,13 @@ public class AllTests { com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); final TestIntfPrx p = TestIntfPrx.uncheckedCast(obj); - sref = "testController:tcp -p 12011"; + sref = "testController:" + app.getTestEndpoint(1); obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java/test/src/main/java/test/Ice/interrupt/Collocated.java b/java/test/src/main/java/test/Ice/interrupt/Collocated.java index f770c46515c..0d4baa68925 100644 --- a/java/test/src/main/java/test/Ice/interrupt/Collocated.java +++ b/java/test/src/main/java/test/Ice/interrupt/Collocated.java @@ -56,8 +56,8 @@ public class Collocated extends test.Util.Application // r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); return r; diff --git a/java/test/src/main/java/test/Ice/interrupt/Server.java b/java/test/src/main/java/test/Ice/interrupt/Server.java index 0ed3bbcd2c1..a0723e9bc2c 100644 --- a/java/test/src/main/java/test/Ice/interrupt/Server.java +++ b/java/test/src/main/java/test/Ice/interrupt/Server.java @@ -47,8 +47,8 @@ public class Server extends test.Util.Application // r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - r.initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); + r.initData.properties.setProperty("ControllerAdapter.Endpoints", getTestEndpoint(r.initData.properties, 1)); r.initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); // // Limit the recv buffer size, this test relies on the socket diff --git a/java/test/src/main/java/test/Ice/interrupt/run.py b/java/test/src/main/java/test/Ice/interrupt/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/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/test/src/main/java/test/Ice/invoke/AllTests.java b/java/test/src/main/java/test/Ice/invoke/AllTests.java index 79e1d88761b..ad641cadc46 100644 --- a/java/test/src/main/java/test/Ice/invoke/AllTests.java +++ b/java/test/src/main/java/test/Ice/invoke/AllTests.java @@ -31,9 +31,11 @@ public class AllTests } } - public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static MyClassPrx allTests(test.Util.Application app) { - String ref = "test:default -p 12010"; + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrx.checkedCast(base); MyClassPrx oneway = cl.ice_oneway(); diff --git a/java/test/src/main/java/test/Ice/invoke/Client.java b/java/test/src/main/java/test/Ice/invoke/Client.java index e123ae57359..c7a95f442cf 100644 --- a/java/test/src/main/java/test/Ice/invoke/Client.java +++ b/java/test/src/main/java/test/Ice/invoke/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - MyClassPrx myClass = AllTests.allTests(communicator(), getWriter()); + MyClassPrx myClass = AllTests.allTests(this); myClass.shutdown(); diff --git a/java/test/src/main/java/test/Ice/invoke/Server.java b/java/test/src/main/java/test/Ice/invoke/Server.java index daf97fe4c25..45ffbab0051 100644 --- a/java/test/src/main/java/test/Ice/invoke/Server.java +++ b/java/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"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.addServantLocator(new ServantLocatorI(async), ""); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/invoke/run.py b/java/test/src/main/java/test/Ice/invoke/run.py deleted file mode 100755 index cc257835523..00000000000 --- a/java/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/test/src/main/java/test/Ice/location/AllTests.java b/java/test/src/main/java/test/Ice/location/AllTests.java index e3fee0edb51..60bcd506d8f 100644 --- a/java/test/src/main/java/test/Ice/location/AllTests.java +++ b/java/test/src/main/java/test/Ice/location/AllTests.java @@ -40,7 +40,7 @@ public class AllTests PrintWriter out = app.getWriter(); ServerManagerPrx manager = ServerManagerPrx.checkedCast( - communicator.stringToProxy("ServerManager :default -p 12010")); + communicator.stringToProxy("ServerManager:" + app.getTestEndpoint(0))); test(manager != null); TestLocatorPrx locator = TestLocatorPrx.uncheckedCast(communicator.getDefaultLocator()); diff --git a/java/test/src/main/java/test/Ice/location/Client.java b/java/test/src/main/java/test/Ice/location/Client.java index 696b59f99cd..7bec57529f9 100644 --- a/java/test/src/main/java/test/Ice/location/Client.java +++ b/java/test/src/main/java/test/Ice/location/Client.java @@ -42,7 +42,7 @@ public class Client extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); - r.initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); + r.initData.properties.setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/location/Server.java b/java/test/src/main/java/test/Ice/location/Server.java index 0b702aedae1..3b7e36b72cf 100644 --- a/java/test/src/main/java/test/Ice/location/Server.java +++ b/java/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) { com.zeroc.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 @@ -54,7 +54,8 @@ public class Server extends test.Util.Application r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); r.initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2"); r.initData.properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0"); - r.initData.properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("ServerManagerAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + ":udp"); _initData = r.initData; return r; diff --git a/java/test/src/main/java/test/Ice/location/ServerManagerI.java b/java/test/src/main/java/test/Ice/location/ServerManagerI.java index b84c2a31df8..060e062aa19 100644 --- a/java/test/src/main/java/test/Ice/location/ServerManagerI.java +++ b/java/test/src/main/java/test/Ice/location/ServerManagerI.java @@ -18,10 +18,10 @@ public class ServerManagerI implements ServerManager { _registry = registry; _communicators = new java.util.ArrayList<com.zeroc.Ice.Communicator>(); - + _app = app; _initData = initData; - + _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter"); _initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); _initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2"); @@ -52,13 +52,13 @@ public class ServerManagerI implements ServerManager // 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++)); com.zeroc.Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2"); - com.zeroc.Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010"); + com.zeroc.Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:" + _app.getTestEndpoint(0)); adapter.setLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator)); adapter2.setLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator)); @@ -85,5 +85,5 @@ public class ServerManagerI implements ServerManager private java.util.List<com.zeroc.Ice.Communicator> _communicators; private com.zeroc.Ice.InitializationData _initData; private test.Util.Application _app; - private int _nextPort = 12011; + private int _nextPort = 1; } diff --git a/java/test/src/main/java/test/Ice/location/run.py b/java/test/src/main/java/test/Ice/location/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/metrics/AMDServer.java b/java/test/src/main/java/test/Ice/metrics/AMDServer.java index ab1dd0d83a0..2b99d9e0e1a 100644 --- a/java/test/src/main/java/test/Ice/metrics/AMDServer.java +++ b/java/test/src/main/java/test/Ice/metrics/AMDServer.java @@ -18,8 +18,8 @@ public class AMDServer extends test.Util.Application com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new AMDMetricsI(), com.zeroc.Ice.Util.stringToIdentity("metrics")); adapter.activate(); - - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); @@ -32,7 +32,7 @@ public class AMDServer extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); r.initData.properties.setProperty("Ice.Admin.InstanceName", "server"); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); diff --git a/java/test/src/main/java/test/Ice/metrics/AllTests.java b/java/test/src/main/java/test/Ice/metrics/AllTests.java index 154de71dfd7..3212f79c07d 100644 --- a/java/test/src/main/java/test/Ice/metrics/AllTests.java +++ b/java/test/src/main/java/test/Ice/metrics/AllTests.java @@ -28,6 +28,11 @@ public class AllTests } } + static String getPort(com.zeroc.Ice.PropertiesAdminPrx p) + { + return Integer.toString(test.Util.Application.getTestPort(p.ice_getCommunicator().getProperties(), 0)); + } + static ConnectionMetrics getServerConnectionMetrics(MetricsAdminPrx metrics, long expected) { try @@ -113,8 +118,8 @@ public class AllTests private boolean _wait; } - static private Map<String, String> getClientProps(com.zeroc.Ice.PropertiesAdminPrx p, Map<String, String> orig, - String m) + static private Map<String, String> getClientProps(com.zeroc.Ice.PropertiesAdminPrx p, + Map<String, String> orig, String m) { Map<String, String> props = p.getPropertiesForPrefix("IceMX.Metrics"); for(Map.Entry<String, String> e : props.entrySet()) @@ -131,13 +136,13 @@ 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; } - static private Map<String, String> getServerProps(com.zeroc.Ice.PropertiesAdminPrx p, Map<String, String> orig, - String m) + static private Map<String, String> getServerProps(com.zeroc.Ice.PropertiesAdminPrx p, + Map<String, String> orig, String m) { Map<String, String> props = p.getPropertiesForPrefix("IceMX.Metrics"); for(Map.Entry<String, String> e : props.entrySet()) @@ -154,7 +159,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; } @@ -372,10 +377,19 @@ public class AllTests return m; } - static MetricsPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out, CommunicatorObserverI obsv) + static MetricsPrx allTests(test.Util.Application app, CommunicatorObserverI obsv) throws UnknownMetricsView { - MetricsPrx metrics = MetricsPrx.checkedCast(communicator.stringToProxy("metrics:default -p 12010")); + PrintWriter out = app.getWriter(); + com.zeroc.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 = MetricsPrx.checkedCast(communicator.stringToProxy("metrics:" + endpoint)); boolean collocated = metrics.ice_getConnection() == null; int threadCount = 4; @@ -413,7 +427,7 @@ public class AllTests test(r.returnValue.get("Connection").length == 1 && r.returnValue.get("Connection")[0].current == 1 && r.returnValue.get("Connection")[0].total == 1); } - test(r.returnValue.get("Thread").length == 1 && r.returnValue.get("Thread")[0].current == threadCount && + test(r.returnValue.get("Thread").length == 1 && r.returnValue.get("Thread")[0].current == threadCount && r.returnValue.get("Thread")[0].total == threadCount); out.println("ok"); @@ -474,8 +488,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) @@ -562,7 +574,7 @@ public class AllTests test(map.get("active").current == 1); ControllerPrx controller = ControllerPrx.checkedCast( - communicator.stringToProxy("controller:default -p 12011")); + communicator.stringToProxy("controller:" + app.getTestEndpoint(1))); controller.hold(); map = toMap(clientMetrics.getMetricsView("View").returnValue.get("Connection")); @@ -634,16 +646,16 @@ public class AllTests testAttribute(clientMetrics, clientProps, "Connection", "endpointIsSecure", isSecure, out); testAttribute(clientMetrics, clientProps, "Connection", "endpointTimeout", "500", out); testAttribute(clientMetrics, clientProps, "Connection", "endpointCompress", "false", out); - testAttribute(clientMetrics, clientProps, "Connection", "endpointHost", "127.0.0.1", out); - testAttribute(clientMetrics, clientProps, "Connection", "endpointPort", "12010", out); + testAttribute(clientMetrics, clientProps, "Connection", "endpointHost", host, out); + testAttribute(clientMetrics, clientProps, "Connection", "endpointPort", port, out); testAttribute(clientMetrics, clientProps, "Connection", "incoming", "false", out); testAttribute(clientMetrics, clientProps, "Connection", "adapterName", "", out); testAttribute(clientMetrics, clientProps, "Connection", "connectionId", "Con1", out); - testAttribute(clientMetrics, clientProps, "Connection", "localHost", "127.0.0.1", out); + testAttribute(clientMetrics, clientProps, "Connection", "localHost", host, out); //testAttribute(clientMetrics, clientProps, "Connection", "localPort", "", out); - testAttribute(clientMetrics, clientProps, "Connection", "remoteHost", "127.0.0.1", out); - testAttribute(clientMetrics, clientProps, "Connection", "remotePort", "12010", out); + testAttribute(clientMetrics, clientProps, "Connection", "remoteHost", host, out); + testAttribute(clientMetrics, clientProps, "Connection", "remotePort", port, out); testAttribute(clientMetrics, clientProps, "Connection", "mcastHost", "", out); testAttribute(clientMetrics, clientProps, "Connection", "mcastPort", "", out); @@ -666,13 +678,13 @@ public class AllTests test(clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment").length == 1); com.zeroc.IceMX.Metrics m1 = clientMetrics.getMetricsView("View").returnValue.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(com.zeroc.Ice.ConnectTimeoutException ex) @@ -685,14 +697,14 @@ public class AllTests controller.resume(); test(clientMetrics.getMetricsView("View").returnValue.get("ConnectionEstablishment").length == 1); m1 = clientMetrics.getMetricsView("View").returnValue.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, "ConnectionEstablishment", "parent", "Communicator", c, out); - testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "id", "127.0.0.1:12010", c, + testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "id", hostAndPort, c, out); testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpoint", endpoint + " -t 60000", c, out); @@ -706,9 +718,9 @@ public class AllTests out); testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointCompress", "false", c, out); - testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointHost", "127.0.0.1", c, + testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointHost", host, c, out); - testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointPort", "12010", c, + testAttribute(clientMetrics, clientProps, "ConnectionEstablishment", "endpointPort", port, c, out); out.println("ok"); @@ -716,24 +728,29 @@ public class AllTests out.print("testing endpoint lookup metrics... "); out.flush(); - props.put("IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy", "id"); + props.put("IceMX.Metrics.View.Map.EndpointLookup.GroupBy", "id"); updateProps(clientProps, serverProps, props, "EndpointLookup"); test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 0); com.zeroc.Ice.ObjectPrx prx = - communicator.stringToProxy("metrics:default -p 12010 -h localhost -t infinite"); - prx.ice_ping(); + communicator.stringToProxy("metrics:" + protocol + " -p " + port + " -h localhost -t 500"); + try + { + prx.ice_ping(); + prx.ice_getConnection().close(false); + } + catch(com.zeroc.Ice.LocalException ex) + { + } test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 1); m1 = clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup")[0]; - test(m1.current <= 1 && m1.total == 1 && m1.id.equals(prx.ice_getConnection().getEndpoint().toString())); - - prx.ice_getConnection().close(false); + test(m1.current <= 1 && m1.total == 1); 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(com.zeroc.Ice.DNSException ex) @@ -746,11 +763,11 @@ public class AllTests } test(clientMetrics.getMetricsView("View").returnValue.get("EndpointLookup").length == 2); m1 = clientMetrics.getMetricsView("View").returnValue.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").returnValue.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) { @@ -768,10 +785,10 @@ public class AllTests testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointType", type, c, out); testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointIsDatagram", "false", c, out); testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointIsSecure", isSecure, c, out); - testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointTimeout", "-1", c, out); + testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointTimeout", "500", c, out); testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointCompress", "false", c, out); testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointHost", "localhost", c, out); - testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointPort", "12010", c, out); + testAttribute(clientMetrics, clientProps, "EndpointLookup", "endpointPort", port, c, out); out.println("ok"); } @@ -868,16 +885,16 @@ public class AllTests testAttribute(serverMetrics, serverProps, "Dispatch", "endpointIsSecure", isSecure, op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "endpointTimeout", "60000", op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "endpointCompress", "false", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "endpointHost", "127.0.0.1", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "endpointPort", "12010", op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "endpointHost", host, op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "endpointPort", port, op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "incoming", "true", op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "adapterName", "TestAdapter", op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "connectionId", "", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "localHost", "127.0.0.1", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "localPort", "12010", op, out); - testAttribute(serverMetrics, serverProps, "Dispatch", "remoteHost", "127.0.0.1", op, out); - //testAttribute(serverMetrics, serverProps, "Dispatch", "remotePort", "12010", op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "localHost", host, op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "localPort", port, op, out); + testAttribute(serverMetrics, serverProps, "Dispatch", "remoteHost", host, op, out); + //testAttribute(serverMetrics, serverProps, "Dispatch", "remotePort", port, op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "mcastHost", "", op, out); testAttribute(serverMetrics, serverProps, "Dispatch", "mcastPort", "", op, out); } diff --git a/java/test/src/main/java/test/Ice/metrics/Client.java b/java/test/src/main/java/test/Ice/metrics/Client.java index d5bb7488b19..cb5624f219a 100644 --- a/java/test/src/main/java/test/Ice/metrics/Client.java +++ b/java/test/src/main/java/test/Ice/metrics/Client.java @@ -16,10 +16,9 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); try { - MetricsPrx metrics = AllTests.allTests(communicator, getWriter(), _observer); + MetricsPrx metrics = AllTests.allTests(this, _observer); metrics.shutdown(); } catch(com.zeroc.Ice.UserException ex) diff --git a/java/test/src/main/java/test/Ice/metrics/Collocated.java b/java/test/src/main/java/test/Ice/metrics/Collocated.java index 2b6775aa029..8a00546b309 100644 --- a/java/test/src/main/java/test/Ice/metrics/Collocated.java +++ b/java/test/src/main/java/test/Ice/metrics/Collocated.java @@ -22,14 +22,14 @@ public class Collocated extends test.Util.Application adapter.add(new MetricsI(), com.zeroc.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)); com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), com.zeroc.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(com.zeroc.Ice.UserException ex) @@ -56,7 +56,7 @@ public class Collocated extends test.Util.Application r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); r.initData.properties.setProperty("Ice.Admin.InstanceName", "client"); r.initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); r.initData.properties.setProperty("Ice.MessageSizeMax", "50000"); diff --git a/java/test/src/main/java/test/Ice/metrics/Server.java b/java/test/src/main/java/test/Ice/metrics/Server.java index 45e77982a4d..5d4e4a35a0c 100644 --- a/java/test/src/main/java/test/Ice/metrics/Server.java +++ b/java/test/src/main/java/test/Ice/metrics/Server.java @@ -19,7 +19,7 @@ public class Server extends test.Util.Application adapter.add(new MetricsI(), com.zeroc.Ice.Util.stringToIdentity("metrics")); adapter.activate(); - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "default -p 12011"); + communicator.getProperties().setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1)); com.zeroc.Ice.ObjectAdapter controllerAdapter = communicator.createObjectAdapter("ControllerAdapter"); controllerAdapter.add(new ControllerI(adapter), com.zeroc.Ice.Util.stringToIdentity("controller")); controllerAdapter.activate(); @@ -32,7 +32,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Admin.Endpoints", "tcp"); r.initData.properties.setProperty("Ice.Admin.InstanceName", "server"); r.initData.properties.setProperty("Ice.Warn.Connections", "0"); diff --git a/java/test/src/main/java/test/Ice/metrics/run.py b/java/test/src/main/java/test/Ice/metrics/run.py deleted file mode 100755 index 88b29abdfd1..00000000000 --- a/java/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/test/src/main/java/test/Ice/networkProxy/AllTests.java b/java/test/src/main/java/test/Ice/networkProxy/AllTests.java index 021047d3d62..7ac437e2053 100644 --- a/java/test/src/main/java/test/Ice/networkProxy/AllTests.java +++ b/java/test/src/main/java/test/Ice/networkProxy/AllTests.java @@ -28,10 +28,16 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "test:default -p 12010"; + String sref = "test:" + app.getTestEndpoint(0); com.zeroc.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 = TestIntfPrx.checkedCast(obj); test(test != null); @@ -53,7 +59,7 @@ public class AllTests info = (com.zeroc.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/test/src/main/java/test/Ice/networkProxy/Server.java b/java/test/src/main/java/test/Ice/networkProxy/Server.java index 43b77f86a4e..7928810bb32 100644 --- a/java/test/src/main/java/test/Ice/networkProxy/Server.java +++ b/java/test/src/main/java/test/Ice/networkProxy/Server.java @@ -36,7 +36,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.networkProxy"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/networkProxy/run.py b/java/test/src/main/java/test/Ice/networkProxy/run.py deleted file mode 100755 index fa8d2fcbb15..00000000000 --- a/java/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/test/src/main/java/test/Ice/objects/AllTests.java b/java/test/src/main/java/test/Ice/objects/AllTests.java index 13a5f07a647..a9dbe1745e1 100644 --- a/java/test/src/main/java/test/Ice/objects/AllTests.java +++ b/java/test/src/main/java/test/Ice/objects/AllTests.java @@ -40,11 +40,13 @@ public class AllTests } @SuppressWarnings("deprecation") - public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app) { + com.zeroc.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); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -260,7 +262,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 = UnexpectedObjectExceptionTestPrx.uncheckedCast(base); diff --git a/java/test/src/main/java/test/Ice/objects/Client.java b/java/test/src/main/java/test/Ice/objects/Client.java index d428856cb6e..7b19cc1e875 100644 --- a/java/test/src/main/java/test/Ice/objects/Client.java +++ b/java/test/src/main/java/test/Ice/objects/Client.java @@ -89,7 +89,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; } diff --git a/java/test/src/main/java/test/Ice/objects/Collocated.java b/java/test/src/main/java/test/Ice/objects/Collocated.java index 2f4a639d471..3739290ebff 100644 --- a/java/test/src/main/java/test/Ice/objects/Collocated.java +++ b/java/test/src/main/java/test/Ice/objects/Collocated.java @@ -89,13 +89,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)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); _InitialDisp initial = new InitialI(adapter); adapter.add(initial, com.zeroc.Ice.Util.stringToIdentity("initial")); UnexpectedObjectExceptionTestI object = new UnexpectedObjectExceptionTestI(); adapter.add(object, com.zeroc.Ice.Util.stringToIdentity("uoet")); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); // // We must call shutdown even in the collocated case for cyclic dependency cleanup. // diff --git a/java/test/src/main/java/test/Ice/objects/Server.java b/java/test/src/main/java/test/Ice/objects/Server.java index cfdd15f1690..a84526ae86b 100644 --- a/java/test/src/main/java/test/Ice/objects/Server.java +++ b/java/test/src/main/java/test/Ice/objects/Server.java @@ -58,7 +58,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/objects/run.py b/java/test/src/main/java/test/Ice/objects/run.py deleted file mode 100755 index c0e22437de7..00000000000 --- a/java/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/test/src/main/java/test/Ice/operations/AMDServer.java b/java/test/src/main/java/test/Ice/operations/AMDServer.java index 6a098dc5aa0..9d808248198 100644 --- a/java/test/src/main/java/test/Ice/operations/AMDServer.java +++ b/java/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"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDMyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/operations/AllTests.java b/java/test/src/main/java/test/Ice/operations/AllTests.java index 9a9fbbe6d8c..07fdc236abe 100644 --- a/java/test/src/main/java/test/Ice/operations/AllTests.java +++ b/java/test/src/main/java/test/Ice/operations/AllTests.java @@ -16,10 +16,11 @@ import test.Ice.operations.Test.MyDerivedClassPrx; public class AllTests { - public static MyClassPrx allTests(test.Util.Application app, PrintWriter out) + public static MyClassPrx allTests(test.Util.Application app) { + PrintWriter out = app.getWriter(); com.zeroc.Ice.Communicator communicator = app.communicator(); - String ref = "test:default -p 12010"; + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrx.checkedCast(base); MyDerivedClassPrx derived = MyDerivedClassPrx.checkedCast(cl); diff --git a/java/test/src/main/java/test/Ice/operations/Client.java b/java/test/src/main/java/test/Ice/operations/Client.java index 2679071afb6..afad24e1b63 100644 --- a/java/test/src/main/java/test/Ice/operations/Client.java +++ b/java/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(); diff --git a/java/test/src/main/java/test/Ice/operations/Collocated.java b/java/test/src/main/java/test/Ice/operations/Collocated.java index 63b26e2cadd..8061bb73595 100644 --- a/java/test/src/main/java/test/Ice/operations/Collocated.java +++ b/java/test/src/main/java/test/Ice/operations/Collocated.java @@ -14,7 +14,7 @@ public class Collocated 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"); java.io.PrintWriter out = getWriter(); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); com.zeroc.Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); @@ -25,7 +25,7 @@ public class Collocated extends test.Util.Application throw new RuntimeException(); } - AllTests.allTests(this, out); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/operations/Server.java b/java/test/src/main/java/test/Ice/operations/Server.java index bad17efba6b..c49cd7c3032 100644 --- a/java/test/src/main/java/test/Ice/operations/Server.java +++ b/java/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"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/operations/Twoways.java b/java/test/src/main/java/test/Ice/operations/Twoways.java index 2847261d507..b575811ba25 100644 --- a/java/test/src/main/java/test/Ice/operations/Twoways.java +++ b/java/test/src/main/java/test/Ice/operations/Twoways.java @@ -1412,7 +1412,7 @@ class Twoways ctx.put("two", "TWO"); ctx.put("three", "THREE"); - MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:default -p 12010")); + MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); diff --git a/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java b/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java index 4d81286b720..f5bcdcd4dd2 100644 --- a/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java +++ b/java/test/src/main/java/test/Ice/operations/TwowaysAMI.java @@ -1575,7 +1575,7 @@ class TwowaysAMI ctx.put("two", "TWO"); ctx.put("three", "THREE"); - MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:default -p 12010")); + MyClassPrx p3 = MyClassPrx.uncheckedCast(ic.stringToProxy("test:" + app.getTestEndpoint(0))); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); diff --git a/java/test/src/main/java/test/Ice/operations/run.py b/java/test/src/main/java/test/Ice/operations/run.py deleted file mode 100755 index 3b3b470f074..00000000000 --- a/java/test/src/main/java/test/Ice/operations/run.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../..", - "../../../../../../..", "../../../../../../../..", "../../../../../../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -TestUtil.queueClientServerTest(additionalClientOptions = "--Ice.Warn.AMICallback=0") - -TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.", - additionalClientOptions = "--Ice.Warn.AMICallback=0", - server="test.Ice.operations.AMDServer") - -TestUtil.queueCollocatedTest() -TestUtil.runQueuedTests() diff --git a/java/test/src/main/java/test/Ice/optional/AMDServer.java b/java/test/src/main/java/test/Ice/optional/AMDServer.java index 98f9e74760c..517a5c69c9f 100644 --- a/java/test/src/main/java/test/Ice/optional/AMDServer.java +++ b/java/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"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new AMDInitialI(), com.zeroc.Ice.Util.stringToIdentity("initial")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/optional/AllTests.java b/java/test/src/main/java/test/Ice/optional/AllTests.java index 069f1d113dd..ce80d92f6ad 100644 --- a/java/test/src/main/java/test/Ice/optional/AllTests.java +++ b/java/test/src/main/java/test/Ice/optional/AllTests.java @@ -37,8 +37,9 @@ public class AllTests T value; } - public static InitialPrx allTests(test.Util.Application app, boolean collocated, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app, boolean collocated) { + PrintWriter out = app.getWriter(); com.zeroc.Ice.Communicator communicator = app.communicator(); FactoryI factory = new FactoryI(); @@ -46,7 +47,7 @@ public class AllTests out.print("testing stringToProxy... "); out.flush(); - String ref = "initial:default -p 12010"; + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/optional/Client.java b/java/test/src/main/java/test/Ice/optional/Client.java index 41e0b2c0f66..6cb2d026894 100644 --- a/java/test/src/main/java/test/Ice/optional/Client.java +++ b/java/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; } diff --git a/java/test/src/main/java/test/Ice/optional/Server.java b/java/test/src/main/java/test/Ice/optional/Server.java index f036c674d5e..3a932f327eb 100644 --- a/java/test/src/main/java/test/Ice/optional/Server.java +++ b/java/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"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new InitialI(), com.zeroc.Ice.Util.stringToIdentity("initial")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/optional/run.py b/java/test/src/main/java/test/Ice/optional/run.py deleted file mode 100755 index 6c82786dc7f..00000000000 --- a/java/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/test/src/main/java/test/Ice/packagemd/AllTests.java b/java/test/src/main/java/test/Ice/packagemd/AllTests.java index 026eb8970f9..28a8501c0b7 100644 --- a/java/test/src/main/java/test/Ice/packagemd/AllTests.java +++ b/java/test/src/main/java/test/Ice/packagemd/AllTests.java @@ -28,11 +28,13 @@ public class AllTests } } - public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app) { + com.zeroc.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); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/packagemd/Client.java b/java/test/src/main/java/test/Ice/packagemd/Client.java index cd11c053f38..d61aee98702 100644 --- a/java/test/src/main/java/test/Ice/packagemd/Client.java +++ b/java/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; } diff --git a/java/test/src/main/java/test/Ice/packagemd/Server.java b/java/test/src/main/java/test/Ice/packagemd/Server.java index 8b3a2326d24..0708eee15ec 100644 --- a/java/test/src/main/java/test/Ice/packagemd/Server.java +++ b/java/test/src/main/java/test/Ice/packagemd/Server.java @@ -28,7 +28,7 @@ public class Server extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); r.initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/packagemd/run.py b/java/test/src/main/java/test/Ice/packagemd/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/plugin/run.py b/java/test/src/main/java/test/Ice/plugin/run.py deleted file mode 100755 index 7f28bf562d9..00000000000 --- a/java/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/test/src/main/java/test/Ice/properties/run.py b/java/test/src/main/java/test/Ice/properties/run.py deleted file mode 100755 index 8779d076462..00000000000 --- a/java/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/test/src/main/java/test/Ice/proxy/AMDServer.java b/java/test/src/main/java/test/Ice/proxy/AMDServer.java index 7b656360223..a8269702cd5 100644 --- a/java/test/src/main/java/test/Ice/proxy/AMDServer.java +++ b/java/test/src/main/java/test/Ice/proxy/AMDServer.java @@ -27,7 +27,7 @@ public class AMDServer extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy.AMD"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/proxy/AllTests.java b/java/test/src/main/java/test/Ice/proxy/AllTests.java index 7ae04ce7b88..be50024641a 100644 --- a/java/test/src/main/java/test/Ice/proxy/AllTests.java +++ b/java/test/src/main/java/test/Ice/proxy/AllTests.java @@ -29,11 +29,13 @@ public class AllTests } } - public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static MyClassPrx allTests(test.Util.Application app) { + com.zeroc.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); ObjectPrx base = communicator.stringToProxy(ref); test(base != null); @@ -356,7 +358,7 @@ public class AllTests out.flush(); com.zeroc.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); @@ -400,7 +402,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); @@ -768,7 +770,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 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -780,7 +782,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 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref10)); cl10.ice_ping(); cl10.ice_encodingVersion(Util.Encoding_1_0).ice_ping(); @@ -788,7 +790,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 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.ice_pingAsync().join(); @@ -835,7 +837,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 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref20)); try { @@ -847,13 +849,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 = MyClassPrx.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 = MyClassPrx.uncheckedCast(communicator.stringToProxy(ref13)); cl13.ice_ping(); cl13.ice_pingAsync().join(); @@ -986,10 +988,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(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=="); @@ -1012,23 +1010,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(Util.Encoding_1_0).ice_ping(); - test(false); - } - catch(com.zeroc.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/test/src/main/java/test/Ice/proxy/Client.java b/java/test/src/main/java/test/Ice/proxy/Client.java index 916231a58fe..7c4605a94d3 100644 --- a/java/test/src/main/java/test/Ice/proxy/Client.java +++ b/java/test/src/main/java/test/Ice/proxy/Client.java @@ -16,7 +16,7 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - MyClassPrx myClass = AllTests.allTests(communicator(), getWriter()); + MyClassPrx myClass = AllTests.allTests(this); myClass.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/proxy/Collocated.java b/java/test/src/main/java/test/Ice/proxy/Collocated.java index 8d1ce1cfb95..ddb3f371c13 100644 --- a/java/test/src/main/java/test/Ice/proxy/Collocated.java +++ b/java/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) { com.zeroc.Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); //adapter.activate(); // Don't activate OA to ensure collocation is used. - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); return 0; } diff --git a/java/test/src/main/java/test/Ice/proxy/Server.java b/java/test/src/main/java/test/Ice/proxy/Server.java index 3c936989a70..f9af6271905 100644 --- a/java/test/src/main/java/test/Ice/proxy/Server.java +++ b/java/test/src/main/java/test/Ice/proxy/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/proxy/run.py b/java/test/src/main/java/test/Ice/proxy/run.py deleted file mode 100755 index 0d0598cb160..00000000000 --- a/java/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/test/src/main/java/test/Ice/retry/AllTests.java b/java/test/src/main/java/test/Ice/retry/AllTests.java index 1c878aacf9a..d6f17b58220 100644 --- a/java/test/src/main/java/test/Ice/retry/AllTests.java +++ b/java/test/src/main/java/test/Ice/retry/AllTests.java @@ -56,9 +56,13 @@ public class AllTests private boolean _called; } - public static RetryPrx allTests(com.zeroc.Ice.Communicator communicator, com.zeroc.Ice.Communicator communicator2, - PrintWriter out, Instrumentation instrumentation, String ref) + public static RetryPrx allTests(test.Util.Application app, + com.zeroc.Ice.Communicator communicator, + com.zeroc.Ice.Communicator communicator2, + Instrumentation instrumentation, + String ref) { + PrintWriter out = app.getWriter(); out.print("testing stringToProxy... "); out.flush(); com.zeroc.Ice.ObjectPrx base1 = communicator.stringToProxy(ref); @@ -102,7 +106,7 @@ public class AllTests instrumentation.testFailureCount(1); instrumentation.testRetryCount(0); out.println("ok"); - + out.print("calling regular operation with first proxy again... "); out.flush(); retry1.op(false); diff --git a/java/test/src/main/java/test/Ice/retry/Client.java b/java/test/src/main/java/test/Ice/retry/Client.java index 93d3b604483..da9d437875e 100644 --- a/java/test/src/main/java/test/Ice/retry/Client.java +++ b/java/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(this, communicator, communicator2, instrumentation, + "retry:" + getTestEndpoint(0)); retry.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/retry/Collocated.java b/java/test/src/main/java/test/Ice/retry/Collocated.java index cf0c420a96e..b98ab9c34f4 100644 --- a/java/test/src/main/java/test/Ice/retry/Collocated.java +++ b/java/test/src/main/java/test/Ice/retry/Collocated.java @@ -43,7 +43,7 @@ public class Collocated extends test.Util.Application try { - RetryPrx retry = AllTests.allTests(communicator, communicator2, getWriter(), instrumentation, "retry"); + RetryPrx retry = AllTests.allTests(this, communicator, communicator2, instrumentation, "retry"); retry.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/retry/Server.java b/java/test/src/main/java/test/Ice/retry/Server.java index 5321ac7e0e2..63cd123627a 100644 --- a/java/test/src/main/java/test/Ice/retry/Server.java +++ b/java/test/src/main/java/test/Ice/retry/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; } diff --git a/java/test/src/main/java/test/Ice/retry/run.py b/java/test/src/main/java/test/Ice/retry/run.py deleted file mode 100755 index 97eec95871b..00000000000 --- a/java/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/test/src/main/java/test/Ice/seqMapping/AMDServer.java b/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java index bea35e684a6..f3626aab9b7 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java +++ b/java/test/src/main/java/test/Ice/seqMapping/AMDServer.java @@ -26,7 +26,7 @@ public class AMDServer extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping.AMD"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); return r; } diff --git a/java/test/src/main/java/test/Ice/seqMapping/AllTests.java b/java/test/src/main/java/test/Ice/seqMapping/AllTests.java index d6e9b7cb391..ad503005f93 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/AllTests.java +++ b/java/test/src/main/java/test/Ice/seqMapping/AllTests.java @@ -15,9 +15,12 @@ import test.Ice.seqMapping.Test.*; public class AllTests { - public static MyClassPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out) + public static MyClassPrx allTests(test.Util.Application app, boolean collocated) { - String ref = "test:default -p 12010"; + PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + + String ref = "test:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref); MyClassPrx cl = MyClassPrx.checkedCast(baseProxy); diff --git a/java/test/src/main/java/test/Ice/seqMapping/Client.java b/java/test/src/main/java/test/Ice/seqMapping/Client.java index f4b9dfe02ac..ff07596efb6 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/Client.java +++ b/java/test/src/main/java/test/Ice/seqMapping/Client.java @@ -18,7 +18,7 @@ public class Client extends test.Util.Application { 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(); diff --git a/java/test/src/main/java/test/Ice/seqMapping/Collocated.java b/java/test/src/main/java/test/Ice/seqMapping/Collocated.java index 45f82daf413..087bac54f0d 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/Collocated.java +++ b/java/test/src/main/java/test/Ice/seqMapping/Collocated.java @@ -19,7 +19,7 @@ public class Collocated extends test.Util.Application adapter.add(new MyClassI(), com.zeroc.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; } @@ -29,7 +29,7 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/seqMapping/Server.java b/java/test/src/main/java/test/Ice/seqMapping/Server.java index a0030daa477..45cbc179e79 100644 --- a/java/test/src/main/java/test/Ice/seqMapping/Server.java +++ b/java/test/src/main/java/test/Ice/seqMapping/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0) + ":udp"); return r; } diff --git a/java/test/src/main/java/test/Ice/seqMapping/run.py b/java/test/src/main/java/test/Ice/seqMapping/run.py deleted file mode 100755 index 685319f3cae..00000000000 --- a/java/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/test/src/main/java/test/Ice/serialize/AllTests.java b/java/test/src/main/java/test/Ice/serialize/AllTests.java index b38ff97e156..bf731367dae 100644 --- a/java/test/src/main/java/test/Ice/serialize/AllTests.java +++ b/java/test/src/main/java/test/Ice/serialize/AllTests.java @@ -23,9 +23,12 @@ public class AllTests } } - public static InitialPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out) + public static InitialPrx allTests(test.Util.Application app, boolean collocated) { - String ref = "initial:default -p 12010"; + PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + + String ref = "initial:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); InitialPrx initial = InitialPrx.checkedCast(base); diff --git a/java/test/src/main/java/test/Ice/serialize/Client.java b/java/test/src/main/java/test/Ice/serialize/Client.java index 369362e0def..54c0da2f8ba 100644 --- a/java/test/src/main/java/test/Ice/serialize/Client.java +++ b/java/test/src/main/java/test/Ice/serialize/Client.java @@ -17,7 +17,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; } diff --git a/java/test/src/main/java/test/Ice/serialize/Server.java b/java/test/src/main/java/test/Ice/serialize/Server.java index e4c36995150..3a7138a63ab 100644 --- a/java/test/src/main/java/test/Ice/serialize/Server.java +++ b/java/test/src/main/java/test/Ice/serialize/Server.java @@ -28,7 +28,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); return r; } diff --git a/java/test/src/main/java/test/Ice/serialize/run.py b/java/test/src/main/java/test/Ice/serialize/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/servantLocator/AMDServer.java b/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java index 50bdf4d905c..3b2d99565da 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java +++ b/java/test/src/main/java/test/Ice/servantLocator/AMDServer.java @@ -29,7 +29,7 @@ public class AMDServer extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator.AMD"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; diff --git a/java/test/src/main/java/test/Ice/servantLocator/AllTests.java b/java/test/src/main/java/test/Ice/servantLocator/AllTests.java index b0fe10d68ce..961f4c5a8e7 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/AllTests.java +++ b/java/test/src/main/java/test/Ice/servantLocator/AllTests.java @@ -203,11 +203,13 @@ public class AllTests } } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app) { + com.zeroc.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); com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); @@ -223,7 +225,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); } @@ -238,7 +240,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); } @@ -254,11 +256,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 = TestIntfPrx.checkedCast(base); try { - TestIntfPrx.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010")); + TestIntfPrx.checkedCast(communicator.stringToProxy("category/unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { @@ -267,20 +269,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 = TestIntfPrx.checkedCast(base); - base = communicator.stringToProxy("locate:default -p 12010"); + base = communicator.stringToProxy("locate:" + app.getTestEndpoint(0)); obj = TestIntfPrx.checkedCast(base); try { - TestIntfPrx.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010")); + TestIntfPrx.checkedCast(communicator.stringToProxy("anothercat/unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { } try { - TestIntfPrx.checkedCast(communicator.stringToProxy("unknown:default -p 12010")); + TestIntfPrx.checkedCast(communicator.stringToProxy("unknown:" + app.getTestEndpoint(0))); } catch(ObjectNotExistException ex) { @@ -289,14 +291,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 = TestIntfPrx.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 = TestIntfPrx.checkedCast(base); testExceptions(obj); @@ -340,7 +342,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 = TestActivationPrx.checkedCast(base); activation.activateServantLocator(false); try diff --git a/java/test/src/main/java/test/Ice/servantLocator/Client.java b/java/test/src/main/java/test/Ice/servantLocator/Client.java index 99622d68ed3..61864035ee9 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/Client.java +++ b/java/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; } diff --git a/java/test/src/main/java/test/Ice/servantLocator/Collocated.java b/java/test/src/main/java/test/Ice/servantLocator/Collocated.java index d9455de1cf2..b45e1e2c631 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/Collocated.java +++ b/java/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(), com.zeroc.Ice.Util.stringToIdentity("asm")); adapter.add(new TestActivationI(), com.zeroc.Ice.Util.stringToIdentity("test/activation")); - AllTests.allTests(communicator(), getWriter()); + AllTests.allTests(this); return 0; } @@ -29,7 +29,7 @@ public class Collocated extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; diff --git a/java/test/src/main/java/test/Ice/servantLocator/Server.java b/java/test/src/main/java/test/Ice/servantLocator/Server.java index 6aa0b684d8d..82c88cb3002 100644 --- a/java/test/src/main/java/test/Ice/servantLocator/Server.java +++ b/java/test/src/main/java/test/Ice/servantLocator/Server.java @@ -28,7 +28,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.initData.properties, 0)); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); return r; diff --git a/java/test/src/main/java/test/Ice/servantLocator/run.py b/java/test/src/main/java/test/Ice/servantLocator/run.py deleted file mode 100755 index 205d37b5a05..00000000000 --- a/java/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/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java index e1aef24a5d0..5179443f130 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDServer.java @@ -27,7 +27,8 @@ public class AMDServer extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.serverAMD"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + " -t 2000"); return r; } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java index f7c1807962d..6d35a23797e 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java @@ -105,12 +105,14 @@ public class AllTests } } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, - java.io.PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app, boolean collocated) { + java.io.PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "Test:default -p 12010 -t 10000"; + String ref = "Test:" + app.getTestEndpoint(0) + " -t 10000"; com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java b/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java index 9c0aebde55f..f522b063d1b 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/Client.java @@ -16,7 +16,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/test/src/main/java/test/Ice/slicing/exceptions/Server.java b/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java index 2ff1ebd1c0c..39295b2aaea 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/Server.java @@ -27,7 +27,8 @@ public class Server extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.server"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + " -t 2000"); return r; } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/run.py b/java/test/src/main/java/test/Ice/slicing/exceptions/run.py deleted file mode 100755 index e796b96ceef..00000000000 --- a/java/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/test/src/main/java/test/Ice/slicing/objects/AMDServer.java b/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java index 13ec1d7438a..204215f8da2 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java +++ b/java/test/src/main/java/test/Ice/slicing/objects/AMDServer.java @@ -28,7 +28,8 @@ public class AMDServer extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.serverAMD"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + " -t 2000"); return r; } diff --git a/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java b/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java index 83813c2ecd2..01bb17c7bba 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java +++ b/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java @@ -109,11 +109,14 @@ public class AllTests public T v; } - public static TestIntfPrx allTests(com.zeroc.Ice.Communicator communicator, boolean collocated, PrintWriter out) + public static TestIntfPrx allTests(test.Util.Application app, boolean collocated) { + PrintWriter out = app.getWriter(); + com.zeroc.Ice.Communicator communicator = app.communicator(); + out.print("testing stringToProxy... "); out.flush(); - String ref = "Test:default -p 12010 -t 10000"; + String ref = "Test:" + app.getTestEndpoint(0) + " -t 10000"; com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); out.println("ok"); diff --git a/java/test/src/main/java/test/Ice/slicing/objects/Client.java b/java/test/src/main/java/test/Ice/slicing/objects/Client.java index bad24e2946e..6a53a72c057 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/Client.java +++ b/java/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) { com.zeroc.Ice.Communicator communicator = communicator(); - TestIntfPrx test = AllTests.allTests(communicator, false, getWriter()); + TestIntfPrx test = AllTests.allTests(this, false); test.shutdown(); return 0; } diff --git a/java/test/src/main/java/test/Ice/slicing/objects/Server.java b/java/test/src/main/java/test/Ice/slicing/objects/Server.java index b25d118840c..ac9710f38e8 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/Server.java +++ b/java/test/src/main/java/test/Ice/slicing/objects/Server.java @@ -28,7 +28,8 @@ public class Server extends test.Util.Application GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.server"); r.initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + r.initData.properties.setProperty("TestAdapter.Endpoints", + getTestEndpoint(r.initData.properties, 0) + " -t 2000"); return r; } diff --git a/java/test/src/main/java/test/Ice/slicing/objects/run.py b/java/test/src/main/java/test/Ice/slicing/objects/run.py deleted file mode 100755 index 89a4d8598ea..00000000000 --- a/java/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/test/src/main/java/test/Ice/stream/run.py b/java/test/src/main/java/test/Ice/stream/run.py deleted file mode 100755 index 66636d7a5c1..00000000000 --- a/java/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/test/src/main/java/test/Ice/threadPoolPriority/Client.java b/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java index 4befa3d5967..86ed41dcd58 100644 --- a/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java +++ b/java/test/src/main/java/test/Ice/threadPoolPriority/Client.java @@ -25,7 +25,7 @@ public class Client extends test.Util.Application public int run(String[] args) { java.io.PrintWriter out = getWriter(); - com.zeroc.Ice.ObjectPrx object = communicator().stringToProxy("test:default -p 12010 -t 10000"); + com.zeroc.Ice.ObjectPrx object = communicator().stringToProxy("test:" + getTestEndpoint(0) + " -t 10000"); PriorityPrx priority = PriorityPrx.checkedCast(object); out.print("testing thread priority... "); out.flush(); diff --git a/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java b/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java index 7fc77d818a6..2cc42c1145e 100644 --- a/java/test/src/main/java/test/Ice/threadPoolPriority/Server.java +++ b/java/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"); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); adapter.add(new PriorityI(), com.zeroc.Ice.Util.stringToIdentity("test")); adapter.activate(); diff --git a/java/test/src/main/java/test/Ice/threadPoolPriority/run.py b/java/test/src/main/java/test/Ice/threadPoolPriority/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/throughput/test.py b/java/test/src/main/java/test/Ice/throughput/test.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/java/test/src/main/java/test/Ice/throughput/test.py diff --git a/java/test/src/main/java/test/Ice/timeout/AllTests.java b/java/test/src/main/java/test/Ice/timeout/AllTests.java index 6fd02201197..77370710887 100644 --- a/java/test/src/main/java/test/Ice/timeout/AllTests.java +++ b/java/test/src/main/java/test/Ice/timeout/AllTests.java @@ -62,7 +62,7 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - String sref = "timeout:default -p 12010"; + String sref = "timeout:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); diff --git a/java/test/src/main/java/test/Ice/timeout/Server.java b/java/test/src/main/java/test/Ice/timeout/Server.java index b2df019230f..be958c86bd5 100644 --- a/java/test/src/main/java/test/Ice/timeout/Server.java +++ b/java/test/src/main/java/test/Ice/timeout/Server.java @@ -26,7 +26,7 @@ public class Server extends test.Util.Application { GetInitDataResult r = super.getInitData(args); r.initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout"); - r.initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); + r.initData.properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(r.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/test/src/main/java/test/Ice/timeout/run.py b/java/test/src/main/java/test/Ice/timeout/run.py deleted file mode 100755 index 97f9acd4094..00000000000 --- a/java/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/test/src/main/java/test/Ice/udp/AllTests.java b/java/test/src/main/java/test/Ice/udp/AllTests.java index 012adc25c99..302f9849122 100644 --- a/java/test/src/main/java/test/Ice/udp/AllTests.java +++ b/java/test/src/main/java/test/Ice/udp/AllTests.java @@ -69,7 +69,7 @@ public class AllTests com.zeroc.Ice.Communicator communicator = app.communicator(); PrintWriter out = app.getWriter(); - communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030"); + communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp"); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter"); PingReplyI replyI = new PingReplyI(); @@ -78,7 +78,7 @@ public class AllTests out.print("testing udp... "); out.flush(); - com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test -d:udp -p 12010"); + com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("test -d:" + app.getTestEndpoint(0, "udp")); TestIntfPrx obj = TestIntfPrx.uncheckedCast(base); int nRetry = 5; diff --git a/java/test/src/main/java/test/Ice/udp/Client.java b/java/test/src/main/java/test/Ice/udp/Client.java index eb2e364b0eb..e6cfe1c6c3f 100644 --- a/java/test/src/main/java/test/Ice/udp/Client.java +++ b/java/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,7 @@ public class Client extends test.Util.Application } for(int i = 0; i < num; ++i) { - TestIntfPrx.uncheckedCast(communicator().stringToProxy("control:tcp -p " + (12010 + i))).shutdown(); + TestIntfPrx.uncheckedCast(communicator().stringToProxy("control:" + getTestEndpoint(i, "tcp"))).shutdown(); } return 0; } diff --git a/java/test/src/main/java/test/Ice/udp/Server.java b/java/test/src/main/java/test/Ice/udp/Server.java index e2d01cb84fd..1c9dba69857 100644 --- a/java/test/src/main/java/test/Ice/udp/Server.java +++ b/java/test/src/main/java/test/Ice/udp/Server.java @@ -16,22 +16,23 @@ public class Server extends test.Util.Application { com.zeroc.Ice.Properties properties = communicator().getProperties(); - int port = 12010; + int num = 0; try { - port += args.length == 1 ? Integer.parseInt(args[0]) : 0; + num = args.length == 1 ? Integer.parseInt(args[0]) : 0; } catch(NumberFormatException ex) { + assert(false); } - properties.setProperty("ControlAdapter.Endpoints", "tcp -p " + port); + properties.setProperty("ControlAdapter.Endpoints", getTestEndpoint(num, "tcp")); com.zeroc.Ice.ObjectAdapter adapter = communicator().createObjectAdapter("ControlAdapter"); adapter.add(new TestIntfI(), com.zeroc.Ice.Util.stringToIdentity("control")); adapter.activate(); - if(port == 12010) + if(num == 0) { - properties.setProperty("TestAdapter.Endpoints", "udp -p 12010"); + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(num, "udp")); com.zeroc.Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("TestAdapter"); adapter2.add(new TestIntfI(), com.zeroc.Ice.Util.stringToIdentity("test")); adapter2.activate(); diff --git a/java/test/src/main/java/test/Ice/udp/run.py b/java/test/src/main/java/test/Ice/udp/run.py deleted file mode 100755 index 4b3a05010e2..00000000000 --- a/java/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/test/src/main/java/test/IceBox/admin/AllTests.java b/java/test/src/main/java/test/IceBox/admin/AllTests.java index 5d018dee240..46e5f582ff9 100644 --- a/java/test/src/main/java/test/IceBox/admin/AllTests.java +++ b/java/test/src/main/java/test/IceBox/admin/AllTests.java @@ -21,8 +21,10 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator) + public static void allTests(test.Util.Application app) { + com.zeroc.Ice.Communicator communicator = app.communicator(); + String ref = "DemoIceBox/admin:default -p 9996 -t 10000"; com.zeroc.Ice.ObjectPrx admin = communicator.stringToProxy(ref); @@ -96,7 +98,7 @@ public class AllTests System.out.print("testing metrics admin facet... "); System.out.flush(); { - com.zeroc.IceMX.MetricsAdminPrx ma = + com.zeroc.IceMX.MetricsAdminPrx ma = com.zeroc.IceMX.MetricsAdminPrx.checkedCast(admin, "IceBox.Service.TestService.Metrics"); com.zeroc.Ice.PropertiesAdminPrx pa = @@ -114,7 +116,7 @@ public class AllTests r = ma.getMetricsViewNames(); test(r.returnValue.length == 3); - + // Make sure that the IceBox communicator metrics admin is a separate instance. test(com.zeroc.IceMX.MetricsAdminPrx.checkedCast(admin, "Metrics"). getMetricsViewNames().returnValue.length == 0); diff --git a/java/test/src/main/java/test/IceBox/admin/Client.java b/java/test/src/main/java/test/IceBox/admin/Client.java index a3bed564dce..4810cc8abf0 100644 --- a/java/test/src/main/java/test/IceBox/admin/Client.java +++ b/java/test/src/main/java/test/IceBox/admin/Client.java @@ -14,14 +14,13 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - AllTests.allTests(communicator); + AllTests.allTests(this); // // Shutdown the IceBox server. // com.zeroc.Ice.ProcessPrx.uncheckedCast( - communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); + communicator().stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); return 0; } diff --git a/java/test/src/main/java/test/IceBox/admin/run.py b/java/test/src/main/java/test/IceBox/admin/run.py deleted file mode 100755 index 6ebb72ea3f2..00000000000 --- a/java/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/test/src/main/java/test/IceBox/configuration/AllTests.java b/java/test/src/main/java/test/IceBox/configuration/AllTests.java index 7d59f13d022..7bf517cc084 100644 --- a/java/test/src/main/java/test/IceBox/configuration/AllTests.java +++ b/java/test/src/main/java/test/IceBox/configuration/AllTests.java @@ -23,12 +23,14 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator, PrintWriter out) + public static void allTests(test.Util.Application app) { - TestIntfPrx service1 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010")); - TestIntfPrx service2 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011")); - TestIntfPrx service3 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12012")); - TestIntfPrx service4 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:tcp -p 12013")); + com.zeroc.Ice.Communicator communicator=app.communicator(); + PrintWriter out = app.getWriter(); + TestIntfPrx service1 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(0))); + TestIntfPrx service2 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(1))); + TestIntfPrx service3 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(2))); + TestIntfPrx service4 = TestIntfPrx.uncheckedCast(communicator.stringToProxy("test:" + app.getTestEndpoint(3))); if(service1.getProperty("IceBox.InheritProperties").equals("")) { diff --git a/java/test/src/main/java/test/IceBox/configuration/Client.java b/java/test/src/main/java/test/IceBox/configuration/Client.java index 66fa9582cab..9e1ef8d89c4 100644 --- a/java/test/src/main/java/test/IceBox/configuration/Client.java +++ b/java/test/src/main/java/test/IceBox/configuration/Client.java @@ -14,14 +14,13 @@ public class Client extends test.Util.Application @Override public int run(String[] args) { - com.zeroc.Ice.Communicator communicator = communicator(); - AllTests.allTests(communicator, getWriter()); + AllTests.allTests(this); // // Shutdown the IceBox server. // com.zeroc.Ice.ProcessPrx.uncheckedCast( - communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); + communicator().stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); return 0; } diff --git a/java/test/src/main/java/test/IceBox/configuration/config.service1 b/java/test/src/main/java/test/IceBox/configuration/config.service1 index 6028e615ff5..3e38245a5d0 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service1 +++ b/java/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/test/src/main/java/test/IceBox/configuration/config.service1-2 b/java/test/src/main/java/test/IceBox/configuration/config.service1-2 index c173914db2a..835acbadfc9 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service1-2 +++ b/java/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/test/src/main/java/test/IceBox/configuration/config.service2 b/java/test/src/main/java/test/IceBox/configuration/config.service2 index 78e08aadba6..95d33831a14 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service2 +++ b/java/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/test/src/main/java/test/IceBox/configuration/config.service2-2 b/java/test/src/main/java/test/IceBox/configuration/config.service2-2 index 36c8d0812cb..6ed8dc9df49 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service2-2 +++ b/java/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/test/src/main/java/test/IceBox/configuration/config.service3 b/java/test/src/main/java/test/IceBox/configuration/config.service3 index c93ed144701..6cba4b351b0 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service3 +++ b/java/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/test/src/main/java/test/IceBox/configuration/config.service4 b/java/test/src/main/java/test/IceBox/configuration/config.service4 index 182fb3a7289..a70120dd192 100644 --- a/java/test/src/main/java/test/IceBox/configuration/config.service4 +++ b/java/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/test/src/main/java/test/IceBox/configuration/run.py b/java/test/src/main/java/test/IceBox/configuration/run.py deleted file mode 100755 index 077936ccbe5..00000000000 --- a/java/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/test/src/main/java/test/IceDiscovery/simple/AllTests.java b/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java index 5a653060fb3..d54959fab3b 100644 --- a/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java +++ b/java/test/src/main/java/test/IceDiscovery/simple/AllTests.java @@ -27,8 +27,10 @@ public class AllTests } } - public static void allTests(com.zeroc.Ice.Communicator communicator, int num) + public static void allTests(test.Util.Application app, int num) { + com.zeroc.Ice.Communicator communicator = app.communicator(); + List<ControllerPrx> proxies = new ArrayList<>(); List<ControllerPrx> indirectProxies = new ArrayList<>(); for(int i = 0; i < num; ++i) @@ -90,7 +92,7 @@ public class AllTests } } System.out.println("ok"); - + System.out.print("testing object adapter migration..."); System.out.flush(); { diff --git a/java/test/src/main/java/test/IceDiscovery/simple/Client.java b/java/test/src/main/java/test/IceDiscovery/simple/Client.java index de48e574ab2..7e823ec6b60 100644 --- a/java/test/src/main/java/test/IceDiscovery/simple/Client.java +++ b/java/test/src/main/java/test/IceDiscovery/simple/Client.java @@ -15,7 +15,7 @@ public class Client extends test.Util.Application public int run(String[] args) { int num; - try + try { num = args.length == 1 ? Integer.parseInt(args[0]) : 0; } @@ -23,7 +23,7 @@ public class Client extends test.Util.Application { num = 0; } - AllTests.allTests(communicator(), num); + AllTests.allTests(this, num); return 0; } diff --git a/java/test/src/main/java/test/IceDiscovery/simple/Server.java b/java/test/src/main/java/test/IceDiscovery/simple/Server.java index 21f5a2da128..4982bab8048 100644 --- a/java/test/src/main/java/test/IceDiscovery/simple/Server.java +++ b/java/test/src/main/java/test/IceDiscovery/simple/Server.java @@ -23,9 +23,10 @@ public class Server extends test.Util.Application } catch(NumberFormatException ex) { + assert(false); } - 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/test/src/main/java/test/IceDiscovery/simple/run.py b/java/test/src/main/java/test/IceDiscovery/simple/run.py deleted file mode 100755 index d9b4f000e9d..00000000000 --- a/java/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:com.zeroc.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/test/src/main/java/test/IceGrid/simple/AllTests.java b/java/test/src/main/java/test/IceGrid/simple/AllTests.java index c4897098935..19c549e487f 100644 --- a/java/test/src/main/java/test/IceGrid/simple/AllTests.java +++ b/java/test/src/main/java/test/IceGrid/simple/AllTests.java @@ -67,7 +67,7 @@ public class AllTests com.zeroc.IceGrid.RegistryPrx registry = com.zeroc.IceGrid.RegistryPrx.checkedCast( communicator.stringToProxy(communicator.getDefaultLocator().ice_getIdentity().category + "/Registry")); test(registry != null); - + try { com.zeroc.IceGrid.AdminSessionPrx session = registry.createAdminSession("foo", "bar"); @@ -86,16 +86,17 @@ public class AllTests com.zeroc.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:com.zeroc.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"); - + com.zeroc.Ice.Communicator comm = com.zeroc.Ice.Util.initialize(initData); test(comm.getDefaultLocator() != null); comm.stringToProxy("test @ TestAdapter").ice_ping(); @@ -113,7 +114,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"); diff --git a/java/test/src/main/java/test/IceGrid/simple/simple_server.xml b/java/test/src/main/java/test/IceGrid/simple/application.xml index 9ebc5d95a72..9ebc5d95a72 100644 --- a/java/test/src/main/java/test/IceGrid/simple/simple_server.xml +++ b/java/test/src/main/java/test/IceGrid/simple/application.xml diff --git a/java/test/src/main/java/test/IceGrid/simple/run.py b/java/test/src/main/java/test/IceGrid/simple/run.py deleted file mode 100755 index 7f13799be1e..00000000000 --- a/java/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/test/src/main/java/test/IceSSL/configuration/AllTests.java b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java index e8f09e2d47a..9a86e3db4ac 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/AllTests.java +++ b/java/test/src/main/java/test/IceSSL/configuration/AllTests.java @@ -118,10 +118,12 @@ public class AllTests return d; } - public static ServerFactoryPrx allTests(test.Util.Application app, String testDir, PrintWriter out) + public static ServerFactoryPrx allTests(test.Util.Application app, String testDir) { com.zeroc.Ice.Communicator communicator = app.communicator(); - final String factoryRef = "factory:tcp -p 12010"; + PrintWriter out = app.getWriter(); + + final String factoryRef = "factory:" + app.getTestEndpoint(0); com.zeroc.Ice.ObjectPrx b = communicator.stringToProxy(factoryRef); test(b != null); ServerFactoryPrx factory = ServerFactoryPrx.checkedCast(b); diff --git a/java/test/src/main/java/test/IceSSL/configuration/Client.java b/java/test/src/main/java/test/IceSSL/configuration/Client.java index 52a8c20befb..e03a7f14926 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/Client.java +++ b/java/test/src/main/java/test/IceSSL/configuration/Client.java @@ -24,10 +24,8 @@ public class Client extends test.Util.Application out.println("Usage: client testdir"); return 1; } - - ServerFactoryPrx factory = AllTests.allTests(this, args[0], out); + ServerFactoryPrx factory = AllTests.allTests(this, args[0]); factory.shutdown(); - return 0; } diff --git a/java/test/src/main/java/test/IceSSL/configuration/Server.java b/java/test/src/main/java/test/IceSSL/configuration/Server.java index 86d5ae85f3a..0cae0b6af36 100644 --- a/java/test/src/main/java/test/IceSSL/configuration/Server.java +++ b/java/test/src/main/java/test/IceSSL/configuration/Server.java @@ -15,7 +15,7 @@ public class Server extends test.Util.Application public int run(String[] args) { com.zeroc.Ice.Communicator communicator = communicator(); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010"); + communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity("factory"); adapter.add(new ServerFactoryI(), id); diff --git a/java/test/src/main/java/test/IceSSL/configuration/run.py b/java/test/src/main/java/test/IceSSL/configuration/run.py deleted file mode 100755 index 2d87a19bc40..00000000000 --- a/java/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/test/src/main/java/test/IceUtil/inputUtil/run.py b/java/test/src/main/java/test/IceUtil/inputUtil/run.py deleted file mode 100755 index 7f349d5cef0..00000000000 --- a/java/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/test/src/main/java/test/Slice/generation/run.py b/java/test/src/main/java/test/Slice/generation/run.py deleted file mode 100755 index fa69cc0ddb6..00000000000 --- a/java/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 + '" --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/test/src/main/java/test/Slice/generation/test.py b/java/test/src/main/java/test/Slice/generation/test.py new file mode 100644 index 00000000000..311626dea72 --- /dev/null +++ b/java/test/src/main/java/test/Slice/generation/test.py @@ -0,0 +1,31 @@ +class SliceGenerationTestCase(ClientTestCase): + + def runClientSide(self, current): + current.write("testing list-generated... ") + + slice2java = SliceTranslator("slice2java") + self.mkdirs("classes") + + slice2java.run(current, + args=["--list-generated", "--output-dir", "classes", "File1.ice", "File2.ice"]) + + lines1 = slice2java.getOutput().strip().split("\n") + lines2 = open(os.path.join(self.getPath(), "list-generated.out"), "r").readlines() + if len(lines1) != len(lines2): + raise RuntimeError("failed!") + + 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: + raise RuntimeError("failed!") + i = i + 1 + else: + current.writeln("ok") + +TestSuite(__name__, [ SliceGenerationTestCase() ]) diff --git a/java/test/src/main/java/test/Slice/keyword/Client.java b/java/test/src/main/java/test/Slice/keyword/Client.java index 938c4602398..8a48667cb83 100644 --- a/java/test/src/main/java/test/Slice/keyword/Client.java +++ b/java/test/src/main/java/test/Slice/keyword/Client.java @@ -32,7 +32,7 @@ public class Client public catchI() { } - + @Override public java.util.concurrent.CompletionStage<Integer> checkedCastAsync(int _clone, com.zeroc.Ice.Current current) { @@ -178,7 +178,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/test/src/main/java/test/Slice/keyword/run.py b/java/test/src/main/java/test/Slice/keyword/run.py deleted file mode 100755 index 851ddcd2d36..00000000000 --- a/java/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/test/src/main/java/test/Slice/macros/run.py b/java/test/src/main/java/test/Slice/macros/run.py deleted file mode 100755 index a8b0dad4496..00000000000 --- a/java/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/test/src/main/java/test/Slice/structure/run.py b/java/test/src/main/java/test/Slice/structure/run.py deleted file mode 100755 index ecb3cf4e54e..00000000000 --- a/java/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/test/src/main/java/test/Util/Application.java b/java/test/src/main/java/test/Util/Application.java index 3ccff95fb55..d9e7a56b31b 100644 --- a/java/test/src/main/java/test/Util/Application.java +++ b/java/test/src/main/java/test/Util/Application.java @@ -205,7 +205,7 @@ public abstract class Application r.initData = createInitializationData(); com.zeroc.Ice.Util.CreatePropertiesResult cpr = com.zeroc.Ice.Util.createProperties(args); r.initData.properties = cpr.properties; - r.args = cpr.args; + r.args = r.initData.properties.parseCommandLineOptions("Test", cpr.args); return r; } @@ -282,6 +282,62 @@ public abstract class Application return _classLoader; } + public String getTestEndpoint(int num) + { + return getTestEndpoint(num, ""); + } + + public String getTestEndpoint(com.zeroc.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(com.zeroc.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(com.zeroc.Ice.Properties properties) + { + return properties.getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"); + } + + public String getTestProtocol() + { + return getTestProtocol(_communicator.getProperties()); + } + + static public String getTestProtocol(com.zeroc.Ice.Properties properties) + { + return properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + } + + public int getTestPort(int num) + { + return getTestPort(_communicator.getProperties(), num); + } + + static public int getTestPort(com.zeroc.Ice.Properties properties, int num) + { + return properties.getPropertyAsIntWithDefault("Test.BasePort", 12010) + num; + } + private ClassLoader _classLoader; private String _testName; private Communicator _communicator; |