From 40af868c1380ab9e27390d9524b92e54ac033141 Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 14 Jan 2025 21:47:13 +0100 Subject: [PATCH] Additional test for default OA - Fix #3348 (#3356) --- cpp/test/Ice/adapterDeactivation/AllTests.cpp | 7 +++++++ csharp/test/Ice/adapterDeactivation/AllTests.cs | 7 +++++++ .../java/test/Ice/adapterDeactivation/AllTests.java | 9 ++++++++- js/test/Ice/adapterDeactivation/Client.ts | 11 +++++++++-- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/cpp/test/Ice/adapterDeactivation/AllTests.cpp b/cpp/test/Ice/adapterDeactivation/AllTests.cpp index 4b98f61f33a..8a609520959 100644 --- a/cpp/test/Ice/adapterDeactivation/AllTests.cpp +++ b/cpp/test/Ice/adapterDeactivation/AllTests.cpp @@ -224,12 +224,19 @@ allTests(Test::TestHelper* helper) obj->ice_ping(); test(obj->ice_getCachedConnection()->getAdapter() == adapter); + + // Ensure destroying the OA doesn't affect the ability to send outgoing requests. + adapter->destroy(); + obj->ice_getCachedConnection()->close().get(); + obj->ice_ping(); + communicator->setDefaultObjectAdapter(nullptr); // create new connection obj->ice_getCachedConnection()->close().get(); obj->ice_ping(); + adapter = communicator->createObjectAdapter(""); test(obj->ice_getCachedConnection()->getAdapter() == nullptr); obj->ice_getCachedConnection()->setAdapter(adapter); test(obj->ice_getCachedConnection()->getAdapter() == adapter); diff --git a/csharp/test/Ice/adapterDeactivation/AllTests.cs b/csharp/test/Ice/adapterDeactivation/AllTests.cs index 6ca0c1ae863..eb7948c87da 100644 --- a/csharp/test/Ice/adapterDeactivation/AllTests.cs +++ b/csharp/test/Ice/adapterDeactivation/AllTests.cs @@ -232,12 +232,19 @@ static EndpointInfo getUnderlying(EndpointInfo endpointInfo) => await obj.ice_pingAsync(); test(obj.ice_getCachedConnection().getAdapter() == adapter); + + // Ensure destroying the OA doesn't affect the ability to send outgoing requests. + adapter.destroy(); + await obj.ice_getCachedConnection().closeAsync(); + obj.ice_ping(); + communicator.setDefaultObjectAdapter(null); // create new connection await obj.ice_getCachedConnection().closeAsync(); await obj.ice_pingAsync(); + adapter = communicator.createObjectAdapter(""); test(obj.ice_getCachedConnection().getAdapter() is null); obj.ice_getCachedConnection().setAdapter(adapter); test(obj.ice_getCachedConnection().getAdapter() == adapter); 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 731017e5f45..f7aeb84b19c 100644 --- a/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java +++ b/java/test/src/main/java/test/Ice/adapterDeactivation/AllTests.java @@ -266,13 +266,20 @@ public static TestIntfPrx allTests(test.TestHelper helper) { obj.ice_ping(); test(obj.ice_getCachedConnection().getAdapter() == adapter); + + // Ensure destroying the OA doesn't affect the ability to send outgoing requests. + adapter.destroy(); + obj.ice_getCachedConnection().close(); + obj.ice_ping(); + communicator.setDefaultObjectAdapter(null); // create new connection obj.ice_getCachedConnection().close(); obj.ice_ping(); - test(obj.ice_getCachedConnection().getAdapter() == null); + + adapter = communicator.createObjectAdapter(""); obj.ice_getCachedConnection().setAdapter(adapter); test(obj.ice_getCachedConnection().getAdapter() == adapter); obj.ice_getCachedConnection().setAdapter(null); diff --git a/js/test/Ice/adapterDeactivation/Client.ts b/js/test/Ice/adapterDeactivation/Client.ts index dff3031c967..344fd30cbb7 100644 --- a/js/test/Ice/adapterDeactivation/Client.ts +++ b/js/test/Ice/adapterDeactivation/Client.ts @@ -72,7 +72,7 @@ export class Client extends TestHelper { test(communicator.getDefaultObjectAdapter() === null); test(obj.ice_getCachedConnection().getAdapter() === null); - const adapter = await communicator.createObjectAdapter(""); + let adapter = await communicator.createObjectAdapter(""); communicator.setDefaultObjectAdapter(adapter); test(communicator.getDefaultObjectAdapter() === adapter); @@ -82,13 +82,20 @@ export class Client extends TestHelper { await obj.ice_ping(); test(obj.ice_getCachedConnection().getAdapter() === adapter); + + // Ensure destroying the OA doesn't affect the ability to send outgoing requests. + adapter.destroy(); + await obj.ice_getCachedConnection().close(); + await obj.ice_ping(); + communicator.setDefaultObjectAdapter(null); // create new connection await obj.ice_getCachedConnection().close(); await obj.ice_ping(); - test(obj.ice_getCachedConnection().getAdapter() === null); + + adapter = await communicator.createObjectAdapter(""); obj.ice_getCachedConnection().setAdapter(adapter); test(obj.ice_getCachedConnection().getAdapter() === adapter); obj.ice_getCachedConnection().setAdapter(null);