|
31 | 31 | import java.util.concurrent.TimeUnit;
|
32 | 32 |
|
33 | 33 | import org.apache.commons.logging.Log;
|
34 |
| -import org.junit.AfterClass; |
35 |
| -import org.junit.ClassRule; |
36 |
| -import org.junit.Rule; |
37 |
| -import org.junit.Test; |
| 34 | +import org.junit.jupiter.api.Test; |
38 | 35 |
|
39 | 36 | import org.springframework.amqp.core.AmqpReplyTimeoutException;
|
40 | 37 | import org.springframework.amqp.rabbit.AsyncRabbitTemplate;
|
41 | 38 | import org.springframework.amqp.rabbit.AsyncRabbitTemplate.RabbitMessageFuture;
|
42 | 39 | import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
43 | 40 | import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
44 |
| -import org.springframework.amqp.rabbit.junit.BrokerRunning; |
| 41 | +import org.springframework.amqp.rabbit.junit.RabbitAvailable; |
45 | 42 | import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
46 | 43 | import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
|
47 | 44 | import org.springframework.amqp.rabbit.listener.adapter.ReplyingMessageListener;
|
|
54 | 51 | import org.springframework.integration.channel.DirectChannel;
|
55 | 52 | import org.springframework.integration.channel.QueueChannel;
|
56 | 53 | import org.springframework.integration.support.MessageBuilder;
|
57 |
| -import org.springframework.integration.test.rule.Log4j2LevelAdjuster; |
| 54 | +import org.springframework.integration.test.condition.LogLevels; |
58 | 55 | import org.springframework.messaging.Message;
|
59 | 56 | import org.springframework.messaging.MessagingException;
|
60 | 57 | import org.springframework.messaging.support.ErrorMessage;
|
|
67 | 64 | * @since 4.3
|
68 | 65 | *
|
69 | 66 | */
|
70 |
| -public class AsyncAmqpGatewayTests { |
71 |
| - |
72 |
| - @ClassRule |
73 |
| - public static BrokerRunning brokerRunning = BrokerRunning.isRunningWithEmptyQueues("asyncQ1", "asyncRQ1"); |
74 |
| - |
75 |
| - @Rule |
76 |
| - public Log4j2LevelAdjuster adjuster = |
77 |
| - Log4j2LevelAdjuster.trace() |
78 |
| - .categories(true, "org.springframework.amqp"); |
79 |
| - |
80 |
| - @AfterClass |
81 |
| - public static void tearDown() { |
82 |
| - brokerRunning.removeTestQueues(); |
83 |
| - } |
| 67 | +@RabbitAvailable(queues = { "asyncQ1", "asyncRQ1" }) |
| 68 | +@LogLevels(categories = "org.springframework.amqp", level = "trace") |
| 69 | +class AsyncAmqpGatewayTests { |
84 | 70 |
|
85 | 71 | @Test
|
86 |
| - public void testConfirmsAndReturns() throws Exception { |
| 72 | + void testConfirmsAndReturns() throws Exception { |
87 | 73 | CachingConnectionFactory ccf = new CachingConnectionFactory("localhost");
|
88 |
| - ccf.setPublisherConfirms(true); |
| 74 | + ccf.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.CORRELATED); |
89 | 75 | ccf.setPublisherReturns(true);
|
90 | 76 | RabbitTemplate template = new RabbitTemplate(ccf);
|
91 | 77 | SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(ccf);
|
@@ -213,7 +199,7 @@ public void testConfirmsAndReturns() throws Exception {
|
213 | 199 | any(org.springframework.amqp.core.Message.class));
|
214 | 200 | DirectFieldAccessor dfa = new DirectFieldAccessor(future);
|
215 | 201 | dfa.setPropertyValue("nackCause", "nacknack");
|
216 |
| - SettableListenableFuture<Boolean> confirmFuture = new SettableListenableFuture<Boolean>(); |
| 202 | + SettableListenableFuture<Boolean> confirmFuture = new SettableListenableFuture<>(); |
217 | 203 | confirmFuture.set(false);
|
218 | 204 | dfa.setPropertyValue("confirm", confirmFuture);
|
219 | 205 | new DirectFieldAccessor(gateway).setPropertyValue("template", asyncTemplate);
|
|
0 commit comments