|
23 | 23 | import java.util.HashMap;
|
24 | 24 | import java.util.List;
|
25 | 25 | import java.util.Map;
|
| 26 | +import java.util.Properties; |
26 | 27 | import java.util.concurrent.CountDownLatch;
|
27 | 28 | import java.util.concurrent.TimeUnit;
|
28 | 29 | import java.util.concurrent.atomic.AtomicBoolean;
|
|
42 | 43 | import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
43 | 44 | import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
44 | 45 | import org.springframework.amqp.rabbit.junit.RabbitAvailable;
|
| 46 | +import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry; |
45 | 47 | import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
46 | 48 | import org.springframework.amqp.support.converter.MessageConverter;
|
| 49 | +import org.springframework.amqp.utils.test.TestUtils; |
47 | 50 | import org.springframework.beans.factory.annotation.Autowired;
|
48 | 51 | import org.springframework.context.annotation.Bean;
|
49 | 52 | import org.springframework.context.annotation.Configuration;
|
@@ -98,6 +101,9 @@ public class AsyncListenerTests {
|
98 | 101 | @Autowired
|
99 | 102 | private Listener listener;
|
100 | 103 |
|
| 104 | + @Autowired |
| 105 | + private RabbitListenerEndpointRegistry registry; |
| 106 | + |
101 | 107 | @Test
|
102 | 108 | public void testAsyncListener() throws Exception {
|
103 | 109 | assertThat(this.rabbitTemplate.convertSendAndReceive(this.queue1.getName(), "foo")).isEqualTo("FOO");
|
@@ -128,6 +134,12 @@ public void testOverrideDontRequeue() throws Exception {
|
128 | 134 | assertThat(this.rabbitTemplate.convertSendAndReceive(this.queue7.getName(), "foo")).isEqualTo("listen7");
|
129 | 135 | }
|
130 | 136 |
|
| 137 | + @Test |
| 138 | + public void testAuthByProps() { |
| 139 | + assertThat(TestUtils.getPropertyValue(this.registry.getListenerContainer("foo"), |
| 140 | + "possibleAuthenticationFailureFatal", Boolean.class)).isFalse(); |
| 141 | + } |
| 142 | + |
131 | 143 | @Configuration
|
132 | 144 | @EnableRabbit
|
133 | 145 | public static class EnableRabbitConfig {
|
@@ -247,6 +259,13 @@ public Listener listener() {
|
247 | 259 | return new Listener();
|
248 | 260 | }
|
249 | 261 |
|
| 262 | + @Bean("spring.amqp.global.properties") |
| 263 | + public Properties properties() { |
| 264 | + Properties props = new Properties(); |
| 265 | + props.setProperty("mlc.possible.authentication.failure.fatal", "false"); |
| 266 | + return props; |
| 267 | + } |
| 268 | + |
250 | 269 | }
|
251 | 270 |
|
252 | 271 | @Component
|
|
0 commit comments