You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/09/10 19:00:51 UTC
(camel) branch main updated: CAMEL-23677: Fix SjmsConnectionRecoveryTest to run on s390x (#26275)
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
The following commit(s) were added to refs/heads/main by this push:
new e9db23be8f12 CAMEL-23677: Fix SjmsConnectionRecoveryTest to run on s390x (#26275)
e9db23be8f12 is described below
commit e9db23be8f1247bdbacf40d8fac47b9dc2b37e4c
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Sep 10 21:00:43 2026 +0200
CAMEL-23677: Fix SjmsConnectionRecoveryTest to run on s390x (#26275)
Replace ArtemisContainer (Testcontainers pulling a Docker image) with
ArtemisServiceFactory.createTCPAllProtocolsService(), which starts an embedded
Artemis broker that accepts real TCP connections on a random port. The embedded
service is architecture-agnostic — no container image is fetched — so the test
now runs on s390x and all other platforms without any @DisabledOnOs guard.
An earlier attempt (670620c04a0d) removed only the annotation while keeping the
container, and was reverted in 4b99a3660d50. This fixes the underlying cause and
brings the test in line with the 21 other camel-sjms tests already using
ArtemisService.
The fix preserves the full test semantics: a real TCP connection is still used,
so connection.close() genuinely kills sessions and consumer subscriptions,
exercising the same recovery path as the original bug.
Co-authored-by: Guillaume Nodet <gn...@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <no...@anthropic.com>
---
.../component/sjms/SjmsConnectionRecoveryTest.java | 41 ++++++++--------------
1 file changed, 14 insertions(+), 27 deletions(-)
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java
index 470325a90aa0..9093440cdccc 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java
@@ -30,12 +30,11 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.infra.artemis.services.ArtemisContainer;
+import org.apache.camel.test.infra.artemis.services.ArtemisService;
+import org.apache.camel.test.infra.artemis.services.ArtemisServiceFactory;
import org.apache.camel.test.junit6.CamelTestSupport;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.extension.RegisterExtension;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -51,40 +50,28 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
* {@code initConsumers()} skips re-creation (because {@code consumers != null}), leaving consumers attached to closed
* sessions.
* <p>
- * Uses a real Artemis broker over TCP (via Testcontainers) so that connection close truly kills sessions and consumers,
- * matching the behavior of Oracle AQ and other remote JMS providers.
+ * Uses an embedded Artemis broker with a real TCP acceptor (via
+ * {@link ArtemisServiceFactory#createTCPAllProtocolsService()}) so that connection close truly kills sessions and
+ * consumers, matching the behavior of Oracle AQ and other remote JMS providers. This approach works on all
+ * architectures including s390x, unlike the previous container-based approach which required a platform-specific Docker
+ * image.
*/
-@DisabledOnOs(architectures = { "s390x" },
- disabledReason = "The container image cannot be started for this test. Maybe because it is using the ArtemisContainer instead fo the service.")
-public class SjmsConnectionRecoveryTest extends CamelTestSupport {
+class SjmsConnectionRecoveryTest extends CamelTestSupport {
private static final String SJMS_QUEUE_NAME = "sjms:queue:SjmsConnectionRecoveryTest";
private static final String MOCK_RESULT = "mock:result";
private static final int RECOVERY_INTERVAL_MS = 1000;
- private static ArtemisContainer broker;
- private CountingConnectionFactory countingFactory;
-
- @BeforeAll
- static void startBroker() {
- broker = new ArtemisContainer();
- broker.start();
- }
+ @RegisterExtension
+ static ArtemisService service = ArtemisServiceFactory.createTCPAllProtocolsService();
- @AfterAll
- static void stopBroker() {
- if (broker != null) {
- broker.stop();
- }
- }
+ private CountingConnectionFactory countingFactory;
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
- ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
- "tcp://" + broker.getHost() + ":" + broker.defaultAcceptorPort(),
- broker.username(), broker.password());
+ ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(service.serviceAddress());
connectionFactory.setReconnectAttempts(0);
countingFactory = new CountingConnectionFactory(connectionFactory);
@@ -127,7 +114,7 @@ public class SjmsConnectionRecoveryTest extends CamelTestSupport {
* are consumed normally.
*/
@Test
- public void testRecoveryStopsAfterSuccessfulReconnection() throws Exception {
+ void testRecoveryStopsAfterSuccessfulReconnection() throws Exception {
MockEndpoint mock = getMockEndpoint(MOCK_RESULT);
// Phase 1: verify normal consumption (also confirms consumer is fully started).