diff --git a/deps/rabbit/test/amqp_jms_SUITE.erl b/deps/rabbit/test/amqp_jms_SUITE.erl
index 7a5462eda3b0..8a00be3d11dd 100644
--- a/deps/rabbit/test/amqp_jms_SUITE.erl
+++ b/deps/rabbit/test/amqp_jms_SUITE.erl
@@ -122,32 +122,24 @@ jms_temporary_queue(Config) ->
%% Send different message types from JMS client to JMS client.
message_types_jms_to_jms(Config) ->
- TestName = QName = atom_to_binary(?FUNCTION_NAME),
- ok = declare_queue(QName, <<"quorum">>, Config),
- ok = run_jms_test(TestName, [{"-Dqueue=~ts", [rabbitmq_amqp_address:queue(QName)]}], Config),
- ok = delete_queue(QName, Config).
+ ok = run_jms_test(?FUNCTION_NAME, Config).
%% Send different message types from JMS client to Erlang AMQP 1.0 client.
message_types_jms_to_amqp(Config) ->
- TestName = atom_to_binary(?FUNCTION_NAME),
- ok = run_jms_test(TestName, [], Config).
+ ok = run_jms_test(?FUNCTION_NAME, Config).
temporary_queue_rpc(Config) ->
- TestName = QName = atom_to_binary(?FUNCTION_NAME),
- ok = declare_queue(QName, <<"classic">>, Config),
- ok = run_jms_test(TestName, [{"-Dqueue=~ts", [rabbitmq_amqp_address:queue(QName)]}], Config),
- ok = delete_queue(QName, Config).
+ ok = run_jms_test(?FUNCTION_NAME, Config).
temporary_queue_delete(Config) ->
- TestName = atom_to_binary(?FUNCTION_NAME),
- ok = run_jms_test(TestName, [], Config).
+ ok = run_jms_test(?FUNCTION_NAME, Config).
%% -------------------------------------------------------------------
%% Helpers
%% -------------------------------------------------------------------
-run_jms_test(TestName, JavaProps, Config) ->
- run(TestName, [{"-Dtest=JmsTest#~ts", [TestName]} | JavaProps], Config).
+run_jms_test(TestName, Config) ->
+ run(TestName, [{"-Dtest=JmsTest#~ts", [TestName]}], Config).
run(TestName, JavaProps, Config) ->
TestProjectDir = ?config(data_dir, Config),
diff --git a/deps/rabbit/test/amqp_jms_SUITE_data/pom.xml b/deps/rabbit/test/amqp_jms_SUITE_data/pom.xml
index 4d3219578bfa..5583dc92a31a 100644
--- a/deps/rabbit/test/amqp_jms_SUITE_data/pom.xml
+++ b/deps/rabbit/test/amqp_jms_SUITE_data/pom.xml
@@ -50,6 +50,13 @@
${assertj.version}
test
+
+
+ com.google.googlejavaformat
+ google-java-format
+ ${google-java-format.version}
+ test
+
@@ -89,6 +96,26 @@
+ origin/main
+
+ // The contents of this file are subject to the Mozilla Public License
+ // Version 2.0 (the "License"); you may not use this file except in
+ // compliance with the License. You may obtain a copy of the License
+ // at https://www.mozilla.org/en-US/MPL/2.0/
+ //
+ // Software distributed under the License is distributed on an "AS IS"
+ // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ // the License for the specific language governing rights and
+ // limitations under the License.
+ //
+ // The Original Code is RabbitMQ.
+ //
+ // The Initial Developer of the Original Code is Pivotal Software, Inc.
+ // Copyright (c) $YEAR Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc.
+ // and/or its subsidiaries. All rights reserved.
+ //
+
+
diff --git a/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/Cli.java b/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/Cli.java
index 2dc08413eae4..2dea6c481f11 100644
--- a/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/Cli.java
+++ b/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/Cli.java
@@ -11,7 +11,8 @@
// The Original Code is RabbitMQ.
//
// The Initial Developer of the Original Code is Pivotal Software, Inc.
-// Copyright (c) 2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
+// Copyright (c) 2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc.
+// and/or its subsidiaries. All rights reserved.
//
package com.rabbitmq.amqp.tests.jms;
diff --git a/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsConnectionTest.java b/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsConnectionTest.java
index d526cbbee4ff..a02e6b6b54bd 100644
--- a/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsConnectionTest.java
+++ b/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsConnectionTest.java
@@ -14,16 +14,12 @@
// Copyright (c) 2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc.
// and/or its subsidiaries. All rights reserved.
//
-
package com.rabbitmq.amqp.tests.jms;
import static com.rabbitmq.amqp.tests.jms.Cli.startBroker;
import static com.rabbitmq.amqp.tests.jms.Cli.stopBroker;
import static com.rabbitmq.amqp.tests.jms.TestUtils.*;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.assertj.core.api.Assertions.*;
import jakarta.jms.*;
import java.util.concurrent.CountDownLatch;
@@ -41,34 +37,32 @@
@JmsTestInfrastructure
public class JmsConnectionTest {
- String destination;
+ ConnectionFactory factory;
@Test
@Timeout(30)
public void testCreateConnection() throws Exception {
- try (Connection connection = connection()) {
- assertNotNull(connection);
+ try (Connection connection = factory.createConnection()) {
+ assertThat(connection).isNotNull();
}
}
@Test
@Timeout(30)
public void testCreateConnectionAndStart() throws Exception {
- try (Connection connection = connection()) {
- assertNotNull(connection);
+ try (Connection connection = factory.createConnection()) {
+ assertThat(connection).isNotNull();
connection.start();
}
}
@Test
@Timeout(30)
- // Currently not supported by RabbitMQ.
- @Disabled
+ @Disabled("Client ID conflict detection is not supported by RabbitMQ")
public void testCreateWithDuplicateClientIdFails() throws Exception {
- JmsConnectionFactory factory = (JmsConnectionFactory) connectionFactory();
JmsConnection connection1 = (JmsConnection) factory.createConnection();
connection1.setClientID("Test");
- assertNotNull(connection1);
+ assertThat(connection1).isNotNull();
connection1.start();
JmsConnection connection2 = (JmsConnection) factory.createConnection();
try {
@@ -86,25 +80,26 @@ public void testCreateWithDuplicateClientIdFails() throws Exception {
@Test
public void testSetClientIdAfterStartedFails() {
- assertThrows(
- JMSException.class,
- () -> {
- try (Connection connection = connection()) {
- connection.setClientID("Test");
- connection.start();
- connection.setClientID("NewTest");
- }
- });
+ assertThatThrownBy(
+ () -> {
+ try (Connection connection = factory.createConnection()) {
+ connection.setClientID("Test");
+ connection.start();
+ connection.setClientID("NewTest");
+ }
+ })
+ .isInstanceOf(JMSException.class);
}
@Test
@Timeout(30)
public void testCreateConnectionAsSystemAdmin() throws Exception {
- JmsConnectionFactory factory = (JmsConnectionFactory) connectionFactory();
- factory.setUsername(adminUsername());
- factory.setPassword(adminPassword());
+ JmsConnectionFactory f = (JmsConnectionFactory) factory;
+
+ f.setUsername(adminUsername());
+ f.setPassword(adminPassword());
try (Connection connection = factory.createConnection()) {
- assertNotNull(connection);
+ assertThat(connection).isNotNull();
connection.start();
}
}
@@ -112,49 +107,47 @@ public void testCreateConnectionAsSystemAdmin() throws Exception {
@Test
@Timeout(30)
public void testCreateConnectionCallSystemAdmin() throws Exception {
- try (Connection connection =
- connectionFactory().createConnection(adminUsername(), adminPassword())) {
- assertNotNull(connection);
+ try (Connection connection = factory.createConnection(adminUsername(), adminPassword())) {
+ assertThat(connection).isNotNull();
connection.start();
}
}
@Test
@Timeout(30)
- public void testCreateConnectionAsUnknwonUser() {
- assertThrows(
- JMSSecurityException.class,
- () -> {
- JmsConnectionFactory factory = (JmsConnectionFactory) connectionFactory();
- factory.setUsername("unknown");
- factory.setPassword("unknown");
- try (Connection connection = factory.createConnection()) {
- assertNotNull(connection);
- connection.start();
- }
- });
+ public void testCreateConnectionAsUnknownUser() {
+ assertThatThrownBy(
+ () -> {
+ JmsConnectionFactory f = (JmsConnectionFactory) factory;
+ f.setUsername("unknown");
+ f.setPassword("unknown");
+ try (Connection connection = factory.createConnection()) {
+ assertThat(connection).isNotNull();
+ connection.start();
+ }
+ })
+ .isInstanceOf(JMSSecurityException.class);
}
@Test
@Timeout(30)
- public void testCreateConnectionCallUnknwonUser() {
- assertThrows(
- JMSSecurityException.class,
- () -> {
- try (Connection connection = connectionFactory().createConnection("unknown", "unknown")) {
- assertNotNull(connection);
- connection.start();
- }
- });
+ public void testCreateConnectionCallUnknownUser() {
+ assertThatThrownBy(
+ () -> {
+ try (Connection connection = factory.createConnection("unknown", "unknown")) {
+ assertThat(connection).isNotNull();
+ connection.start();
+ }
+ })
+ .isInstanceOf(JMSSecurityException.class);
}
@Test
@Timeout(30)
- public void testBrokerStopWontHangConnectionClose() throws Exception {
- Connection connection = connection();
+ public void testBrokerStopWontHangConnectionClose(Queue queue) throws Exception {
+ Connection connection = factory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Queue queue = queue(destination);
connection.start();
MessageProducer producer = session.createProducer(queue);
@@ -179,15 +172,15 @@ public void testBrokerStopWontHangConnectionClose() throws Exception {
@Timeout(60)
public void testConnectionExceptionBrokerStop() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
- try (Connection connection = connection()) {
+ try (Connection connection = factory.createConnection()) {
connection.setExceptionListener(exception -> latch.countDown());
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- assertNotNull(session);
+ assertThat(session).isNotNull();
try {
stopBroker();
- assertTrue(latch.await(10, TimeUnit.SECONDS));
+ assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
} finally {
startBroker();
}
diff --git a/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTemporaryQueueTest.java b/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTemporaryQueueTest.java
index ae60fa4b8a31..63a257ff86cb 100644
--- a/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTemporaryQueueTest.java
+++ b/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTemporaryQueueTest.java
@@ -14,13 +14,10 @@
// Copyright (c) 2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc.
// and/or its subsidiaries. All rights reserved.
//
-
package com.rabbitmq.amqp.tests.jms;
import static com.rabbitmq.amqp.tests.jms.TestUtils.brokerUri;
-import static com.rabbitmq.amqp.tests.jms.TestUtils.connection;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.assertj.core.api.Assertions.*;
import jakarta.jms.*;
import jakarta.jms.IllegalStateException;
@@ -35,13 +32,16 @@
* Based on
* https://github.com/apache/qpid-jms/tree/main/qpid-jms-interop-tests/qpid-jms-activemq-tests.
*/
+@JmsTestInfrastructure
public class JmsTemporaryQueueTest {
+ ConnectionFactory factory;
+
Connection connection;
@BeforeEach
void init() throws JMSException {
- connection = connection();
+ connection = factory.createConnection();
}
@AfterEach
@@ -55,14 +55,14 @@ public void testCreatePublishConsumeTemporaryQueue() throws Exception {
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- assertNotNull(session);
+ assertThat(session).isNotNull();
TemporaryQueue queue = session.createTemporaryQueue();
MessageConsumer consumer = session.createConsumer(queue);
MessageProducer producer = session.createProducer(queue);
String body = UUID.randomUUID().toString();
producer.send(session.createTextMessage(body));
- assertEquals(body, consumer.receive(60_000).getBody(String.class));
+ assertThat(consumer.receive(60_000).getBody(String.class)).isEqualTo(body);
}
@Test
diff --git a/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTest.java b/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTest.java
index 71e736a4e016..58b1f6a8a00c 100644
--- a/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTest.java
+++ b/deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTest.java
@@ -1,213 +1,196 @@
+// The contents of this file are subject to the Mozilla Public License
+// Version 2.0 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License
+// at https://www.mozilla.org/en-US/MPL/2.0/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+// the License for the specific language governing rights and
+// limitations under the License.
+//
+// The Original Code is RabbitMQ.
+//
+// The Initial Developer of the Original Code is Pivotal Software, Inc.
+// Copyright (c) 2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc.
+// and/or its subsidiaries. All rights reserved.
+//
package com.rabbitmq.amqp.tests.jms;
import static com.rabbitmq.amqp.tests.jms.TestUtils.protonClient;
import static com.rabbitmq.amqp.tests.jms.TestUtils.protonConnection;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.*;
-
-import jakarta.jms.*;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import javax.naming.Context;
+import static org.assertj.core.api.Assertions.fail;
+import com.rabbitmq.amqp.tests.jms.TestUtils.Classic;
import com.rabbitmq.qpid.protonj2.client.Client;
import com.rabbitmq.qpid.protonj2.client.Delivery;
import com.rabbitmq.qpid.protonj2.client.Receiver;
+import jakarta.jms.*;
import jakarta.jms.Queue;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Test;
@JmsTestInfrastructure
public class JmsTest {
- private javax.naming.Context getContext() throws Exception{
- // Configure a JNDI initial context, see
- // https://github.com/apache/qpid-jms/blob/main/qpid-jms-docs/Configuration.md#configuring-a-jndi-initialcontext
- Hashtable