This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3d9eb4bce3f8972e497f7fd4a40d1bbe2614ccb9 Author: Claus Ibsen <[email protected]> AuthorDate: Sun Sep 6 10:51:38 2026 +0200 chore: fix TahuDefaultComponent static endpoint cache leaking across tests The endpoints map was static, meaning it was never cleared and was shared across all component instances for the lifetime of the JVM. Two tests using the same groupId/edgeNode path but different options would collide, with the second test getting the first test's cached endpoint. Make the map instance-level and clear it in doStop() so each CamelContext gets its own cache that is cleaned up on shutdown. Also use a distinct edgeNode name in checkBasicEdgeNodeOptionsMultipleDevices to avoid colliding with checkBasicEdgeNodeOptions in the shared per-class CamelContext. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../org/apache/camel/component/tahu/TahuDefaultComponent.java | 8 +++++++- .../org/apache/camel/component/tahu/TahuConfigurationTest.java | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultComponent.java b/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultComponent.java index f35aa0e065eb..2b3991ae0f0d 100644 --- a/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultComponent.java +++ b/components/camel-tahu/src/main/java/org/apache/camel/component/tahu/TahuDefaultComponent.java @@ -31,7 +31,7 @@ import org.apache.camel.util.ObjectHelper; public abstract class TahuDefaultComponent extends DefaultComponent implements SSLContextParametersAware { - protected static final ConcurrentMap<String, TahuDefaultEndpoint> endpoints = new ConcurrentHashMap<>(); + protected final ConcurrentMap<String, TahuDefaultEndpoint> endpoints = new ConcurrentHashMap<>(); @Metadata(label = "advanced") TahuConfiguration configuration; @@ -114,6 +114,12 @@ public abstract class TahuDefaultComponent extends DefaultComponent implements S return new TahuConfiguration(); } + @Override + protected void doStop() throws Exception { + endpoints.clear(); + super.doStop(); + } + @Override public boolean isUseGlobalSslContextParameters() { return this.useGlobalSslContextParameters; diff --git a/components/camel-tahu/src/test/java/org/apache/camel/component/tahu/TahuConfigurationTest.java b/components/camel-tahu/src/test/java/org/apache/camel/component/tahu/TahuConfigurationTest.java index 03d728885fa4..40cb2dc900c8 100644 --- a/components/camel-tahu/src/test/java/org/apache/camel/component/tahu/TahuConfigurationTest.java +++ b/components/camel-tahu/src/test/java/org/apache/camel/component/tahu/TahuConfigurationTest.java @@ -74,14 +74,14 @@ public class TahuConfigurationTest extends CamelTestSupport { @Test public void checkBasicEdgeNodeOptionsMultipleDevices() throws Exception { String uri - = TahuConstants.EDGE_NODE_SCHEME + "://Basic/EdgeNode?clientId=client1&primaryHostId=app1&deviceIds=D2,D3,D4"; + = TahuConstants.EDGE_NODE_SCHEME + "://Basic/EdgeNodeMulti?clientId=client1&primaryHostId=app1&deviceIds=D2,D3,D4"; try (TahuDefaultEndpoint endpoint = TestSupport.resolveMandatoryEndpoint(context, uri, TahuDefaultEndpoint.class)) { assertThat(endpoint, is(notNullValue())); assertThat(endpoint, allOf(hasProperty("groupId", is("Basic")), - hasProperty("edgeNode", is("EdgeNode")), + hasProperty("edgeNode", is("EdgeNodeMulti")), hasProperty("deviceIds", is("D2,D3,D4")), hasProperty("deviceIdList", hasItems("D2", "D3", "D4")), hasProperty("primaryHostId", is("app1")),
