Skip to content

Commit 7d8f83c

Browse files
committed
Control queue type with annotation in JMS tests
1 parent d574e66 commit 7d8f83c

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static org.assertj.core.api.Assertions.assertThat;
2222
import static org.assertj.core.api.Assertions.fail;
2323

24+
import com.rabbitmq.amqp.tests.jms.TestUtils.Classic;
2425
import com.rabbitmq.qpid.protonj2.client.Client;
2526
import com.rabbitmq.qpid.protonj2.client.Delivery;
2627
import com.rabbitmq.qpid.protonj2.client.Receiver;
@@ -150,7 +151,7 @@ public void message_types_jms_to_amqp(Queue queue) throws Exception {
150151
// Test that Request/reply pattern using a TemporaryQueue works.
151152
// https://jakarta.ee/specifications/messaging/3.1/jakarta-messaging-spec-3.1#requestreply-pattern-using-a-temporaryqueue-jakarta-ee
152153
@Test
153-
public void temporary_queue_rpc(Queue requestQueue) throws Exception {
154+
public void temporary_queue_rpc(@Classic Queue requestQueue) throws Exception {
154155
try (JMSContext clientContext = factory.createContext()) {
155156
Destination responseQueue = clientContext.createTemporaryQueue();
156157
JMSConsumer clientConsumer = clientContext.createConsumer(responseQueue);

deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/JmsTestInfrastructureExtension.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.rabbitmq.client.amqp.Connection;
2222
import com.rabbitmq.client.amqp.Environment;
23+
import com.rabbitmq.client.amqp.Management;
2324
import com.rabbitmq.client.amqp.impl.AmqpEnvironmentBuilder;
2425
import jakarta.jms.ConnectionFactory;
2526
import jakarta.jms.Queue;
@@ -55,6 +56,12 @@ private static boolean isQueue(Parameter parameter) {
5556
return Queue.class.isAssignableFrom(parameter.getType());
5657
}
5758

59+
private static Management.QueueType queueType(Parameter parameter) {
60+
return parameter.isAnnotationPresent(TestUtils.Classic.class)
61+
? Management.QueueType.CLASSIC
62+
: Management.QueueType.QUORUM;
63+
}
64+
5865
@Override
5966
public void beforeEach(ExtensionContext context) throws Exception {
6067
if (context.getTestMethod().isPresent()) {
@@ -66,7 +73,8 @@ public void beforeEach(ExtensionContext context) throws Exception {
6673
try (Environment environment = new AmqpEnvironmentBuilder().build();
6774
Connection connection =
6875
environment.connectionBuilder().uri(TestUtils.brokerUri()).build()) {
69-
connection.management().queue(queueName).declare();
76+
Management.QueueType type = queueType(parameter);
77+
connection.management().queue(queueName).type(type).declare();
7078
}
7179
store(context).put("queueName", queueName);
7280
Context jndiContext = TestUtils.context(singletonMap("queue." + queueName, queueAddress));

deps/rabbit/test/amqp_jms_SUITE_data/src/test/java/com/rabbitmq/amqp/tests/jms/TestUtils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.rabbitmq.qpid.protonj2.client.Client;
2222
import com.rabbitmq.qpid.protonj2.client.ConnectionOptions;
2323
import com.rabbitmq.qpid.protonj2.client.exceptions.ClientException;
24+
import java.lang.annotation.*;
2425
import java.lang.reflect.Method;
2526
import java.net.URI;
2627
import java.net.URISyntaxException;
@@ -126,4 +127,9 @@ private static String name(Class<?> testClass, String testMethod) {
126127
return format(
127128
"%s_%s%s", testClass.getSimpleName(), testMethod, uuid.substring(uuid.length() / 2));
128129
}
130+
131+
@Target(ElementType.PARAMETER)
132+
@Retention(RetentionPolicy.RUNTIME)
133+
@Documented
134+
@interface Classic {}
129135
}

0 commit comments

Comments
 (0)