|
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;
|
|
44 | 45 | import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
45 | 46 | import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
46 | 47 | import org.springframework.amqp.rabbit.junit.BrokerRunning;
|
| 48 | +import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry; |
47 | 49 | import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
48 | 50 | import org.springframework.amqp.support.converter.MessageConverter;
|
| 51 | +import org.springframework.amqp.utils.test.TestUtils; |
49 | 52 | import org.springframework.beans.factory.annotation.Autowired;
|
50 | 53 | import org.springframework.context.annotation.Bean;
|
51 | 54 | import org.springframework.context.annotation.Configuration;
|
@@ -104,6 +107,9 @@ public class AsyncListenerTests {
|
104 | 107 | @Autowired
|
105 | 108 | private Listener listener;
|
106 | 109 |
|
| 110 | + @Autowired |
| 111 | + private RabbitListenerEndpointRegistry registry; |
| 112 | + |
107 | 113 | @Test
|
108 | 114 | public void testAsyncListener() throws Exception {
|
109 | 115 | assertThat(this.rabbitTemplate.convertSendAndReceive(this.queue1.getName(), "foo")).isEqualTo("FOO");
|
@@ -134,6 +140,12 @@ public void testOverrideDontRequeue() throws Exception {
|
134 | 140 | assertThat(this.rabbitTemplate.convertSendAndReceive(this.queue7.getName(), "foo")).isEqualTo("listen7");
|
135 | 141 | }
|
136 | 142 |
|
| 143 | + @Test |
| 144 | + public void testAuthByProps() { |
| 145 | + assertThat(TestUtils.getPropertyValue(this.registry.getListenerContainer("foo"), |
| 146 | + "possibleAuthenticationFailureFatal", Boolean.class)).isFalse(); |
| 147 | + } |
| 148 | + |
137 | 149 | @Configuration
|
138 | 150 | @EnableRabbit
|
139 | 151 | public static class EnableRabbitConfig {
|
@@ -253,6 +265,13 @@ public Listener listener() {
|
253 | 265 | return new Listener();
|
254 | 266 | }
|
255 | 267 |
|
| 268 | + @Bean("spring.amqp.global.properties") |
| 269 | + public Properties properties() { |
| 270 | + Properties props = new Properties(); |
| 271 | + props.setProperty("mlc.possible.authentication.failure.fatal", "false"); |
| 272 | + return props; |
| 273 | + } |
| 274 | + |
256 | 275 | }
|
257 | 276 |
|
258 | 277 | @Component
|
|
0 commit comments