From 4272e03ade1e6e448ec19702eba27d6f09d1ffcc Mon Sep 17 00:00:00 2001 From: Claus Ibsen Date: Tue, 27 Oct 2026 11:22:42 +0100 Subject: [PATCH] chore: camel-plc4x - run Plc4XRepeatedFailureRouteTest isolated LogCapture sets the level of a logger for the whole JVM and MockDriver is programmed statically, so the test must not run in parallel with other test classes when JUnit parallel execution is turned on. Follow-up of the review of #28556. Co-Authored-By: Claude Opus 5.5 (1M context) Signed-off-by: Claus Ibsen --- .../java/org/apache/camel/component/plc4x/LogCapture.java | 3 ++- .../camel/component/plc4x/Plc4XRepeatedFailureRouteTest.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/camel-plc4x/src/test/java/org/apache/camel/component/plc4x/LogCapture.java b/components/camel-plc4x/src/test/java/org/apache/camel/component/plc4x/LogCapture.java index d195ec71c720b..8adf45ae1345d 100644 --- a/components/camel-plc4x/src/test/java/org/apache/camel/component/plc4x/LogCapture.java +++ b/components/camel-plc4x/src/test/java/org/apache/camel/component/plc4x/LogCapture.java @@ -28,7 +28,8 @@ /** * Captures the log events of one logger, down to DEBUG, while it is open. Only one capture is open at a time: opening - * another one resets the level of the loggers. + * another one resets the level of the loggers. The level is set for the whole JVM, so a test class that uses it is + * {@code @Isolated} and does not run in parallel with other test classes. */ final class LogCapture extends AbstractAppender implements AutoCloseable { diff --git a/components/camel-plc4x/src/test/java/org/apache/camel/component/plc4x/Plc4XRepeatedFailureRouteTest.java b/components/camel-plc4x/src/test/java/org/apache/camel/component/plc4x/Plc4XRepeatedFailureRouteTest.java index 4e897e9762a3f..29af2b5239c1d 100644 --- a/components/camel-plc4x/src/test/java/org/apache/camel/component/plc4x/Plc4XRepeatedFailureRouteTest.java +++ b/components/camel-plc4x/src/test/java/org/apache/camel/component/plc4x/Plc4XRepeatedFailureRouteTest.java @@ -32,6 +32,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Isolated; import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -46,7 +47,11 @@ * at WARN and the end of the run at INFO, instead of a WARN with a stack trace on every poll, while * {@code bridgeErrorHandler} still gets every failure. Without {@code autoReconnect}, a lost connection shuts the * endpoint down once, and the triggered consumer stops polling until the route is restarted. + *

+ * Isolated because {@link LogCapture} changes the level of a logger of the JVM and {@link MockDriver} is programmed + * statically, so another test class must not run at the same time. */ +@Isolated public class Plc4XRepeatedFailureRouteTest extends CamelTestSupport { private static final String PLC = "plc4x:mock:10.10.10.1/1/1?trigger=TRIG&period=50&tag.temperature=TEMP";