diff options
-rw-r--r-- | cpp/test/Ice/timeout/AllTests.cpp | 28 | ||||
-rw-r--r-- | csharp/test/Ice/timeout/AllTests.cs | 25 | ||||
-rw-r--r-- | java-compat/test/src/main/java/test/Ice/timeout/AllTests.java | 24 | ||||
-rw-r--r-- | java/test/src/main/java/test/Ice/timeout/AllTests.java | 23 | ||||
-rw-r--r-- | js/test/Ice/timeout/Client.js | 22 | ||||
-rw-r--r-- | js/test/typescript/Ice/timeout/Client.ts | 18 | ||||
-rw-r--r-- | matlab/test/Ice/timeout/AllTests.m | 17 | ||||
-rw-r--r-- | objective-c/test/Ice/timeout/AllTests.m | 25 | ||||
-rw-r--r-- | php/test/Ice/timeout/Client.php | 22 | ||||
-rw-r--r-- | python/test/Ice/timeout/AllTests.py | 17 | ||||
-rw-r--r-- | ruby/test/Ice/timeout/AllTests.rb | 18 | ||||
-rw-r--r-- | swift/test/Ice/timeout/AllTests.swift | 17 |
12 files changed, 211 insertions, 45 deletions
diff --git a/cpp/test/Ice/timeout/AllTests.cpp b/cpp/test/Ice/timeout/AllTests.cpp index 2bc0146470b..b7fd8643344 100644 --- a/cpp/test/Ice/timeout/AllTests.cpp +++ b/cpp/test/Ice/timeout/AllTests.cpp @@ -106,20 +106,17 @@ connect(const Ice::ObjectPrxPtr& prx) } void -allTests(Test::TestHelper* helper) +allTestsWithController(Test::TestHelper* helper, const ControllerPrxPtr& controller) { Ice::CommunicatorPtr communicator = helper->communicator(); string sref = "timeout:" + helper->getTestEndpoint(); + Ice::ObjectPrxPtr obj = communicator->stringToProxy(sref); test(obj); TimeoutPrxPtr timeout = ICE_CHECKED_CAST(TimeoutPrx, obj); test(timeout); - ControllerPrxPtr controller = - ICE_CHECKED_CAST(ControllerPrx, communicator->stringToProxy("controller:" + helper->getTestEndpoint(1))); - test(controller); - cout << "testing connect timeout... " << flush; { // @@ -567,3 +564,24 @@ allTests(Test::TestHelper* helper) controller->shutdown(); } + +void +allTests(Test::TestHelper* helper) +{ + ControllerPrxPtr controller = + ICE_CHECKED_CAST(ControllerPrx, + helper->communicator()->stringToProxy("controller:" + helper->getTestEndpoint(1))); + test(controller); + + try + { + allTestsWithController(helper, controller); + } + catch(const Ice::Exception&) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent the test + // from hanging on exit in case a connection which disables timeouts is still opened. + controller->resumeAdapter(); + throw; + } +} diff --git a/csharp/test/Ice/timeout/AllTests.cs b/csharp/test/Ice/timeout/AllTests.cs index cf4d36cb167..3aa37e59f92 100644 --- a/csharp/test/Ice/timeout/AllTests.cs +++ b/csharp/test/Ice/timeout/AllTests.cs @@ -64,6 +64,27 @@ namespace Ice public static void allTests(global::Test.TestHelper helper) { + Test.ControllerPrx controller = + Test.ControllerPrxHelper.checkedCast( + helper.communicator().stringToProxy("controller:" + helper.getTestEndpoint(1))); + test(controller != null); + + try + { + allTestsWithController(helper, controller); + } + catch(Exception) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent + // the test from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter(); + throw; + } + + } + + public static void allTestsWithController(global::Test.TestHelper helper, Test.ControllerPrx controller) + { var communicator = helper.communicator(); string sref = "timeout:" + helper.getTestEndpoint(0); var obj = communicator.stringToProxy(sref); @@ -72,10 +93,6 @@ namespace Ice Test.TimeoutPrx timeout = Test.TimeoutPrxHelper.checkedCast(obj); test(timeout != null); - Test.ControllerPrx controller = - Test.ControllerPrxHelper.checkedCast(communicator.stringToProxy("controller:" + helper.getTestEndpoint(1))); - test(controller != null); - var output = helper.getWriter(); output.Write("testing connect timeout... "); output.Flush(); diff --git a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java index eb0abb6b9e1..569281cabf5 100644 --- a/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/timeout/AllTests.java @@ -151,6 +151,26 @@ public class AllTests public static void allTests(test.TestHelper helper) { + ControllerPrx controller = ControllerPrxHelper.checkedCast( + helper.communicator().stringToProxy("controller:" + helper.getTestEndpoint(1))); + test(controller != null); + + try + { + allTestsWithController(helper, controller); + } + catch(Exception ex) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent the test + // from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter(); + throw ex; + } + } + + public static void + allTestsWithController(test.TestHelper helper, ControllerPrx controller) + { Ice.Communicator communicator = helper.communicator(); PrintWriter out = helper.getWriter(); @@ -168,10 +188,6 @@ public class AllTests TimeoutPrx timeout = TimeoutPrxHelper.checkedCast(obj); test(timeout != null); - ControllerPrx controller = ControllerPrxHelper.checkedCast( - communicator.stringToProxy("controller:" + helper.getTestEndpoint(1))); - test(controller != null); - out.print("testing connect timeout... "); out.flush(); { 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 8b5e2fbe11f..80f99bc89c8 100644 --- a/java/test/src/main/java/test/Ice/timeout/AllTests.java +++ b/java/test/src/main/java/test/Ice/timeout/AllTests.java @@ -73,6 +73,25 @@ public class AllTests public static void allTests(test.TestHelper helper) { + ControllerPrx controller = ControllerPrx.checkedCast( + helper.communicator().stringToProxy("controller:" + helper.getTestEndpoint(1))); + test(controller != null); + + try + { + allTestsWithController(helper, controller); + } + catch(Exception ex) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent the test + // from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter(); + throw ex; + } + } + + public static void allTestsWithController(test.TestHelper helper, ControllerPrx controller) + { com.zeroc.Ice.Communicator communicator = helper.communicator(); PrintWriter out = helper.getWriter(); @@ -90,10 +109,6 @@ public class AllTests TimeoutPrx timeout = TimeoutPrx.checkedCast(obj); test(timeout != null); - ControllerPrx controller = ControllerPrx.checkedCast( - communicator.stringToProxy("controller:" + helper.getTestEndpoint(1))); - test(controller != null); - out.print("testing connect timeout... "); out.flush(); { diff --git a/js/test/Ice/timeout/Client.js b/js/test/Ice/timeout/Client.js index 295405aa809..74b1a89e844 100644 --- a/js/test/Ice/timeout/Client.js +++ b/js/test/Ice/timeout/Client.js @@ -13,6 +13,24 @@ { async allTests() { + const controller = Test.ControllerPrx.uncheckedCast( + this.communicator().stringToProxy("controller:" + this.getTestEndpoint(1))); + test(controller !== null); + try + { + await this.allTestsWithController(controller); + } + catch(ex) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent the test + // from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter(); + throw ex; + } + } + + async allTestsWithController(controller) + { async function connect(prx) { let nRetry = 10; @@ -51,10 +69,6 @@ const timeout = await Test.TimeoutPrx.checkedCast(obj); test(timeout !== null); - const controller = Test.ControllerPrx.uncheckedCast( - communicator.stringToProxy("controller:" + this.getTestEndpoint(1))); - test(controller !== null); - out.write("testing connect timeout... "); { const to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(100 * mult)); diff --git a/js/test/typescript/Ice/timeout/Client.ts b/js/test/typescript/Ice/timeout/Client.ts index 1d19ea8b771..1234cce4147 100644 --- a/js/test/typescript/Ice/timeout/Client.ts +++ b/js/test/typescript/Ice/timeout/Client.ts @@ -12,6 +12,24 @@ export class Client extends TestHelper { async allTests() { + const controller = Test.ControllerPrx.uncheckedCast( + this.communicator().stringToProxy("controller:" + this.getTestEndpoint(1))); + test(controller !== null); + try + { + await this.allTestsWithController(controller); + } + catch(ex) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent the test + // from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter(); + throw ex; + } + } + + async allTestsWithController(controller:Test.ControllerPrx) + { async function connect(prx:Test.TimeoutPrx) { let nRetry = 10; diff --git a/matlab/test/Ice/timeout/AllTests.m b/matlab/test/Ice/timeout/AllTests.m index 71e0eb17a25..52187379ce6 100644 --- a/matlab/test/Ice/timeout/AllTests.m +++ b/matlab/test/Ice/timeout/AllTests.m @@ -22,6 +22,19 @@ classdef AllTests r = prx.ice_getConnection(); % Establish connection end function allTests(helper) + controller = ControllerPrx.checkedCast(... + helper.communicator().stringToProxy(['controller:', helper.getTestEndpoint(1)])); + assert(~isempty(controller)); + try + allTestsWithController(helper); + catch ex + % Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent + % the test from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter(); + rethrow(ex); + end + end + function allTestsWithController(helper, controller) import Test.*; communicator = helper.communicator(); @@ -33,10 +46,6 @@ classdef AllTests timeout = TimeoutPrx.checkedCast(obj); assert(~isempty(timeout)); - controller = ControllerPrx.checkedCast(... - communicator.stringToProxy(['controller:', helper.getTestEndpoint(1)])); - assert(~isempty(controller)); - fprintf('testing connect timeout... '); % diff --git a/objective-c/test/Ice/timeout/AllTests.m b/objective-c/test/Ice/timeout/AllTests.m index 64be1128004..9b45ec69efe 100644 --- a/objective-c/test/Ice/timeout/AllTests.m +++ b/objective-c/test/Ice/timeout/AllTests.m @@ -98,7 +98,7 @@ connectPrx(id<TestTimeoutTimeoutPrx> prx) } void -timeoutAllTests(id<ICECommunicator> communicator) +timeoutAllTestsWithController(id<ICECommunicator> communicator, id<TestTimeoutControllerPrx> controller) { NSString* sref = @"timeout:default -p 12010"; id<ICEObjectPrx> obj = [communicator stringToProxy:sref]; @@ -107,10 +107,6 @@ timeoutAllTests(id<ICECommunicator> communicator) id<TestTimeoutTimeoutPrx> timeout = [TestTimeoutTimeoutPrx checkedCast:obj]; test(timeout); - id<TestTimeoutControllerPrx> controller = - [TestTimeoutControllerPrx checkedCast:[communicator stringToProxy:@"controller:default -p 12011"]]; - test(controller); - tprintf("testing connect timeout... "); { // @@ -387,3 +383,22 @@ timeoutAllTests(id<ICECommunicator> communicator) [controller shutdown]; } + +void +timeoutAllTests(id<ICECommunicator> communicator) +{ + id<TestTimeoutControllerPrx> controller = + [TestTimeoutControllerPrx checkedCast:[communicator stringToProxy:@"controller:default -p 12011"]]; + test(controller); + @try + { + timeoutAllTestsWithController(communicator, controller); + } + @catch(ICEException*) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent + // the test from hanging on exit in case a connection which disables timeouts is still opened. + [controller resumeAdapter]; + @throw; + } +} diff --git a/php/test/Ice/timeout/Client.php b/php/test/Ice/timeout/Client.php index c422d71f5d0..e7fc19d14e2 100644 --- a/php/test/Ice/timeout/Client.php +++ b/php/test/Ice/timeout/Client.php @@ -37,6 +37,24 @@ function connect($prx) function allTests($helper) { + $controller = $helper->communicator()->stringToProxy(sprintf("controller:%s", $helper->getTestEndpoint(1))); + $controller = $controller->ice_checkedCast("::Test::Controller"); + test($controller); + try + { + allTestsWithController($helper, $controller); + } + catch(Exception $ex) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent the test + // from hanging on exit in case a connection which disables timeouts is still opened. + $controller->resumeAdapter(); + throw $ex; + } +} + +function allTestsWithController($helper, $controller) +{ global $NS; $ConnectTimeoutException = $NS ? "Ice\\ConnectTimeoutException" : "Ice_ConnectTimeoutException"; $TimeoutException = $NS ? "Ice\\TimeoutException" : "Ice_TimeoutException"; @@ -53,10 +71,6 @@ function allTests($helper) $timeout = $timeout->ice_checkedCast("::Test::Timeout"); test($timeout); - $controller = $communicator->stringToProxy(sprintf("controller:%s", $helper->getTestEndpoint(1))); - $controller = $controller->ice_checkedCast("::Test::Controller"); - test($controller); - echo("testing connect timeout... "); flush(); diff --git a/python/test/Ice/timeout/AllTests.py b/python/test/Ice/timeout/AllTests.py index 2a15d4c0fc0..e676e05dac6 100644 --- a/python/test/Ice/timeout/AllTests.py +++ b/python/test/Ice/timeout/AllTests.py @@ -55,6 +55,19 @@ def connect(prx): return prx.ice_getConnection(); # Establish connection def allTests(helper, communicator): + controller = Test.ControllerPrx.checkedCast( + communicator.stringToProxy("controller:{0}".format(helper.getTestEndpoint(num=1)))) + test(controller != None) + + try: + allTestsWithController(helper, communicator, controller) + except Exception: + # Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent + # the test from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter() + raise + +def allTestsWithController(helper, communicator, controller): sref = "timeout:{0}".format(helper.getTestEndpoint()) obj = communicator.stringToProxy(sref) @@ -63,10 +76,6 @@ def allTests(helper, communicator): timeout = Test.TimeoutPrx.checkedCast(obj) test(timeout != None) - controller = Test.ControllerPrx.checkedCast( - communicator.stringToProxy("controller:{0}".format(helper.getTestEndpoint(num=1)))) - test(controller != None) - sys.stdout.write("testing connect timeout... ") sys.stdout.flush() # diff --git a/ruby/test/Ice/timeout/AllTests.rb b/ruby/test/Ice/timeout/AllTests.rb index 37898d0c7ff..24636c98ded 100644 --- a/ruby/test/Ice/timeout/AllTests.rb +++ b/ruby/test/Ice/timeout/AllTests.rb @@ -17,6 +17,20 @@ def connect(prx) end def allTests(helper, communicator) + controller = Test::ControllerPrx::checkedCast( + communicator.stringToProxy("controller:#{helper.getTestEndpoint(num:1)}")) + test(controller) + begin + allTestsWithController(helper, communicator, controller) + rescue + # Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent + # the test from hanging on exit in case a connection which disables timeouts is still opened. + controller.holdAdapter() + raise + end +end + +def allTestsWithController(helper, communicator, controller) sref = "timeout:#{helper.getTestEndpoint()}" obj = communicator.stringToProxy(sref) test(obj) @@ -24,10 +38,6 @@ def allTests(helper, communicator) timeout = Test::TimeoutPrx::checkedCast(obj) test(timeout) - controller = Test::ControllerPrx::checkedCast( - communicator.stringToProxy("controller:#{helper.getTestEndpoint(num:1)}")) - test(controller) - print "testing connect timeout... " STDOUT.flush # diff --git a/swift/test/Ice/timeout/AllTests.swift b/swift/test/Ice/timeout/AllTests.swift index 6087c84a4e2..996fee0536d 100644 --- a/swift/test/Ice/timeout/AllTests.swift +++ b/swift/test/Ice/timeout/AllTests.swift @@ -19,6 +19,20 @@ func connect(_ prx: Ice.ObjectPrx) throws -> Ice.Connection { } public func allTests(helper: TestHelper) throws { + let controller = try checkedCast( + prx: helper.communicator().stringToProxy("controller:\(helper.getTestEndpoint(num: 1))")!, + type: ControllerPrx.self)! + do { + try allTestsWithController(helper:helper, controller:controller) + } catch { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent + // the test from hanging on exit in case a connection which disables timeouts is still opened. + try controller.resumeAdapter() + throw error + } +} + +public func allTestsWithController(helper: TestHelper, controller: ControllerPrx) throws { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -29,9 +43,6 @@ public func allTests(helper: TestHelper) throws { let timeout = try checkedCast(prx: obj, type: TimeoutPrx.self)! - let controller = try checkedCast(prx: communicator.stringToProxy("controller:\(helper.getTestEndpoint(num: 1))")!, - type: ControllerPrx.self)! - let output = helper.getWriter() output.write("testing connect timeout... ") do { |