|
|
@ -77,25 +77,29 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testDefaultRabbitConfiguration() {
|
|
|
|
public void testDefaultRabbitConfiguration() {
|
|
|
|
this.contextRunner
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withUserConfiguration(TestConfiguration.class).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
RabbitMessagingTemplate messagingTemplate = context
|
|
|
|
RabbitMessagingTemplate messagingTemplate = context
|
|
|
|
.getBean(RabbitMessagingTemplate.class);
|
|
|
|
.getBean(RabbitMessagingTemplate.class);
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
RabbitAdmin amqpAdmin = context.getBean(RabbitAdmin.class);
|
|
|
|
RabbitAdmin amqpAdmin = context.getBean(RabbitAdmin.class);
|
|
|
|
assertThat(rabbitTemplate.getConnectionFactory()).isEqualTo(connectionFactory);
|
|
|
|
assertThat(rabbitTemplate.getConnectionFactory())
|
|
|
|
assertThat(getMandatory(rabbitTemplate)).isFalse();
|
|
|
|
.isEqualTo(connectionFactory);
|
|
|
|
assertThat(messagingTemplate.getRabbitTemplate()).isEqualTo(rabbitTemplate);
|
|
|
|
assertThat(getMandatory(rabbitTemplate)).isFalse();
|
|
|
|
assertThat(amqpAdmin).isNotNull();
|
|
|
|
assertThat(messagingTemplate.getRabbitTemplate())
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("localhost");
|
|
|
|
.isEqualTo(rabbitTemplate);
|
|
|
|
assertThat(dfa.getPropertyValue("publisherConfirms")).isEqualTo(false);
|
|
|
|
assertThat(amqpAdmin).isNotNull();
|
|
|
|
assertThat(dfa.getPropertyValue("publisherReturns")).isEqualTo(false);
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("localhost");
|
|
|
|
assertThat(context.containsBean("rabbitListenerContainerFactory"))
|
|
|
|
assertThat(dfa.getPropertyValue("publisherConfirms"))
|
|
|
|
.as("Listener container factory should be created by default").isTrue();
|
|
|
|
.isEqualTo(false);
|
|
|
|
});
|
|
|
|
assertThat(dfa.getPropertyValue("publisherReturns")).isEqualTo(false);
|
|
|
|
|
|
|
|
assertThat(context.containsBean("rabbitListenerContainerFactory"))
|
|
|
|
|
|
|
|
.as("Listener container factory should be created by default")
|
|
|
|
|
|
|
|
.isTrue();
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -105,38 +109,39 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
"spring.rabbitmq.port:9000", "spring.rabbitmq.username:alice",
|
|
|
|
"spring.rabbitmq.port:9000", "spring.rabbitmq.username:alice",
|
|
|
|
"spring.rabbitmq.password:secret",
|
|
|
|
"spring.rabbitmq.password:secret",
|
|
|
|
"spring.rabbitmq.virtual_host:/vhost",
|
|
|
|
"spring.rabbitmq.virtual_host:/vhost",
|
|
|
|
"spring.rabbitmq.connection-timeout:123").run((context) -> {
|
|
|
|
"spring.rabbitmq.connection-timeout:123")
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
.run((context) -> {
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("remote-server");
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
assertThat(connectionFactory.getPort()).isEqualTo(9000);
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("remote-server");
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("/vhost");
|
|
|
|
assertThat(connectionFactory.getPort()).isEqualTo(9000);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("/vhost");
|
|
|
|
com.rabbitmq.client.ConnectionFactory rcf = (com.rabbitmq.client.ConnectionFactory) dfa
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
.getPropertyValue("rabbitConnectionFactory");
|
|
|
|
com.rabbitmq.client.ConnectionFactory rcf = (com.rabbitmq.client.ConnectionFactory) dfa
|
|
|
|
assertThat(rcf.getConnectionTimeout()).isEqualTo(123);
|
|
|
|
.getPropertyValue("rabbitConnectionFactory");
|
|
|
|
assertThat((Address[]) dfa.getPropertyValue("addresses")).hasSize(1);
|
|
|
|
assertThat(rcf.getConnectionTimeout()).isEqualTo(123);
|
|
|
|
});
|
|
|
|
assertThat((Address[]) dfa.getPropertyValue("addresses")).hasSize(1);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testConnectionFactoryEmptyVirtualHost() {
|
|
|
|
public void testConnectionFactoryEmptyVirtualHost() {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withPropertyValues("spring.rabbitmq.virtual_host:").run((context) -> {
|
|
|
|
.withPropertyValues("spring.rabbitmq.virtual_host:").run((context) -> {
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("/");
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("/");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testConnectionFactoryVirtualHostNoLeadingSlash() {
|
|
|
|
public void testConnectionFactoryVirtualHostNoLeadingSlash() {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withPropertyValues("spring.rabbitmq.virtual_host:foo").run((context) -> {
|
|
|
|
.withPropertyValues("spring.rabbitmq.virtual_host:foo").run((context) -> {
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("foo");
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("foo");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -154,37 +159,38 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
public void testConnectionFactoryDefaultVirtualHost() {
|
|
|
|
public void testConnectionFactoryDefaultVirtualHost() {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withPropertyValues("spring.rabbitmq.virtual_host:/").run((context) -> {
|
|
|
|
.withPropertyValues("spring.rabbitmq.virtual_host:/").run((context) -> {
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("/");
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("/");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testConnectionFactoryPublisherSettings() {
|
|
|
|
public void testConnectionFactoryPublisherSettings() {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withPropertyValues("spring.rabbitmq.publisher-confirms=true",
|
|
|
|
.withPropertyValues("spring.rabbitmq.publisher-confirms=true",
|
|
|
|
"spring.rabbitmq.publisher-returns=true").run(context -> {
|
|
|
|
"spring.rabbitmq.publisher-returns=true")
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
.run(context -> {
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
assertThat(dfa.getPropertyValue("publisherConfirms")).isEqualTo(true);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
assertThat(dfa.getPropertyValue("publisherReturns")).isEqualTo(true);
|
|
|
|
assertThat(dfa.getPropertyValue("publisherConfirms")).isEqualTo(true);
|
|
|
|
assertThat(getMandatory(rabbitTemplate)).isTrue();
|
|
|
|
assertThat(dfa.getPropertyValue("publisherReturns")).isEqualTo(true);
|
|
|
|
});
|
|
|
|
assertThat(getMandatory(rabbitTemplate)).isTrue();
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testRabbitTemplateMessageConverters() {
|
|
|
|
public void testRabbitTemplateMessageConverters() {
|
|
|
|
this.contextRunner.withUserConfiguration(
|
|
|
|
this.contextRunner.withUserConfiguration(MessageConvertersConfiguration.class)
|
|
|
|
MessageConvertersConfiguration.class).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
assertThat(rabbitTemplate.getMessageConverter())
|
|
|
|
assertThat(rabbitTemplate.getMessageConverter())
|
|
|
|
.isSameAs(context.getBean("myMessageConverter"));
|
|
|
|
.isSameAs(context.getBean("myMessageConverter"));
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitTemplate);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitTemplate);
|
|
|
|
assertThat(dfa.getPropertyValue("retryTemplate")).isNull();
|
|
|
|
assertThat(dfa.getPropertyValue("retryTemplate")).isNull();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -196,25 +202,25 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
"spring.rabbitmq.template.retry.multiplier:1.5",
|
|
|
|
"spring.rabbitmq.template.retry.multiplier:1.5",
|
|
|
|
"spring.rabbitmq.template.retry.maxInterval:5000",
|
|
|
|
"spring.rabbitmq.template.retry.maxInterval:5000",
|
|
|
|
"spring.rabbitmq.template.receiveTimeout:123",
|
|
|
|
"spring.rabbitmq.template.receiveTimeout:123",
|
|
|
|
"spring.rabbitmq.template.replyTimeout:456"
|
|
|
|
"spring.rabbitmq.template.replyTimeout:456")
|
|
|
|
).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitTemplate);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitTemplate);
|
|
|
|
assertThat(dfa.getPropertyValue("receiveTimeout")).isEqualTo(123L);
|
|
|
|
assertThat(dfa.getPropertyValue("receiveTimeout")).isEqualTo(123L);
|
|
|
|
assertThat(dfa.getPropertyValue("replyTimeout")).isEqualTo(456L);
|
|
|
|
assertThat(dfa.getPropertyValue("replyTimeout")).isEqualTo(456L);
|
|
|
|
RetryTemplate retryTemplate = (RetryTemplate) dfa
|
|
|
|
RetryTemplate retryTemplate = (RetryTemplate) dfa
|
|
|
|
.getPropertyValue("retryTemplate");
|
|
|
|
.getPropertyValue("retryTemplate");
|
|
|
|
assertThat(retryTemplate).isNotNull();
|
|
|
|
assertThat(retryTemplate).isNotNull();
|
|
|
|
dfa = new DirectFieldAccessor(retryTemplate);
|
|
|
|
dfa = new DirectFieldAccessor(retryTemplate);
|
|
|
|
SimpleRetryPolicy retryPolicy = (SimpleRetryPolicy) dfa
|
|
|
|
SimpleRetryPolicy retryPolicy = (SimpleRetryPolicy) dfa
|
|
|
|
.getPropertyValue("retryPolicy");
|
|
|
|
.getPropertyValue("retryPolicy");
|
|
|
|
ExponentialBackOffPolicy backOffPolicy = (ExponentialBackOffPolicy) dfa
|
|
|
|
ExponentialBackOffPolicy backOffPolicy = (ExponentialBackOffPolicy) dfa
|
|
|
|
.getPropertyValue("backOffPolicy");
|
|
|
|
.getPropertyValue("backOffPolicy");
|
|
|
|
assertThat(retryPolicy.getMaxAttempts()).isEqualTo(4);
|
|
|
|
assertThat(retryPolicy.getMaxAttempts()).isEqualTo(4);
|
|
|
|
assertThat(backOffPolicy.getInitialInterval()).isEqualTo(2000);
|
|
|
|
assertThat(backOffPolicy.getInitialInterval()).isEqualTo(2000);
|
|
|
|
assertThat(backOffPolicy.getMultiplier()).isEqualTo(1.5);
|
|
|
|
assertThat(backOffPolicy.getMultiplier()).isEqualTo(1.5);
|
|
|
|
assertThat(backOffPolicy.getMaxInterval()).isEqualTo(5000);
|
|
|
|
assertThat(backOffPolicy.getMaxInterval()).isEqualTo(5000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -240,15 +246,16 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testConnectionFactoryBackOff() {
|
|
|
|
public void testConnectionFactoryBackOff() {
|
|
|
|
this.contextRunner.withUserConfiguration(
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration2.class)
|
|
|
|
TestConfiguration2.class).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
assertThat(connectionFactory).isEqualTo(rabbitTemplate.getConnectionFactory());
|
|
|
|
assertThat(connectionFactory)
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("otherserver");
|
|
|
|
.isEqualTo(rabbitTemplate.getConnectionFactory());
|
|
|
|
assertThat(connectionFactory.getPort()).isEqualTo(8001);
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("otherserver");
|
|
|
|
});
|
|
|
|
assertThat(connectionFactory.getPort()).isEqualTo(8001);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -257,15 +264,18 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
.withPropertyValues("spring.rabbitmq.cache.channel.size=23",
|
|
|
|
.withPropertyValues("spring.rabbitmq.cache.channel.size=23",
|
|
|
|
"spring.rabbitmq.cache.channel.checkoutTimeout=1000",
|
|
|
|
"spring.rabbitmq.cache.channel.checkoutTimeout=1000",
|
|
|
|
"spring.rabbitmq.cache.connection.mode=CONNECTION",
|
|
|
|
"spring.rabbitmq.cache.connection.mode=CONNECTION",
|
|
|
|
"spring.rabbitmq.cache.connection.size=2").run((context) -> {
|
|
|
|
"spring.rabbitmq.cache.connection.size=2")
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
.run((context) -> {
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
CachingConnectionFactory connectionFactory = context
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
assertThat(dfa.getPropertyValue("channelCacheSize")).isEqualTo(23);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
assertThat(dfa.getPropertyValue("cacheMode")).isEqualTo(CacheMode.CONNECTION);
|
|
|
|
assertThat(dfa.getPropertyValue("channelCacheSize")).isEqualTo(23);
|
|
|
|
assertThat(dfa.getPropertyValue("connectionCacheSize")).isEqualTo(2);
|
|
|
|
assertThat(dfa.getPropertyValue("cacheMode"))
|
|
|
|
assertThat(dfa.getPropertyValue("channelCheckoutTimeout")).isEqualTo(1000L);
|
|
|
|
.isEqualTo(CacheMode.CONNECTION);
|
|
|
|
});
|
|
|
|
assertThat(dfa.getPropertyValue("connectionCacheSize")).isEqualTo(2);
|
|
|
|
|
|
|
|
assertThat(dfa.getPropertyValue("channelCheckoutTimeout"))
|
|
|
|
|
|
|
|
.isEqualTo(1000L);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -280,104 +290,114 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testRabbitMessagingTemplateBackOff() {
|
|
|
|
public void testRabbitMessagingTemplateBackOff() {
|
|
|
|
this.contextRunner.withUserConfiguration(
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration4.class)
|
|
|
|
TestConfiguration4.class).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
RabbitMessagingTemplate messagingTemplate = context
|
|
|
|
RabbitMessagingTemplate messagingTemplate = context
|
|
|
|
.getBean(RabbitMessagingTemplate.class);
|
|
|
|
.getBean(RabbitMessagingTemplate.class);
|
|
|
|
assertThat(messagingTemplate.getDefaultDestination()).isEqualTo("fooBar");
|
|
|
|
assertThat(messagingTemplate.getDefaultDestination())
|
|
|
|
});
|
|
|
|
.isEqualTo("fooBar");
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testStaticQueues() {
|
|
|
|
public void testStaticQueues() {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withPropertyValues("spring.rabbitmq.dynamic:false").run((context) -> {
|
|
|
|
.withPropertyValues("spring.rabbitmq.dynamic:false").run((context) -> {
|
|
|
|
// There should NOT be an AmqpAdmin bean when dynamic is switch to false
|
|
|
|
// There should NOT be an AmqpAdmin bean when dynamic is switch to
|
|
|
|
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
|
|
|
// false
|
|
|
|
this.thrown.expectMessage("No qualifying bean of type");
|
|
|
|
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
|
|
|
this.thrown.expectMessage(AmqpAdmin.class.getName());
|
|
|
|
this.thrown.expectMessage("No qualifying bean of type");
|
|
|
|
context.getBean(AmqpAdmin.class);
|
|
|
|
this.thrown.expectMessage(AmqpAdmin.class.getName());
|
|
|
|
});
|
|
|
|
context.getBean(AmqpAdmin.class);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testEnableRabbitCreateDefaultContainerFactory() {
|
|
|
|
public void testEnableRabbitCreateDefaultContainerFactory() {
|
|
|
|
this.contextRunner.withUserConfiguration(
|
|
|
|
this.contextRunner.withUserConfiguration(EnableRabbitConfiguration.class)
|
|
|
|
EnableRabbitConfiguration.class).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
RabbitListenerContainerFactory<?> rabbitListenerContainerFactory = context
|
|
|
|
RabbitListenerContainerFactory<?> rabbitListenerContainerFactory = context
|
|
|
|
.getBean("rabbitListenerContainerFactory",
|
|
|
|
.getBean("rabbitListenerContainerFactory",
|
|
|
|
RabbitListenerContainerFactory.class);
|
|
|
|
RabbitListenerContainerFactory.class);
|
|
|
|
assertThat(rabbitListenerContainerFactory.getClass())
|
|
|
|
assertThat(rabbitListenerContainerFactory.getClass())
|
|
|
|
.isEqualTo(SimpleRabbitListenerContainerFactory.class);
|
|
|
|
.isEqualTo(SimpleRabbitListenerContainerFactory.class);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testRabbitListenerContainerFactoryBackOff() {
|
|
|
|
public void testRabbitListenerContainerFactoryBackOff() {
|
|
|
|
this.contextRunner.withUserConfiguration(
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration5.class)
|
|
|
|
TestConfiguration5.class).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = context
|
|
|
|
SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = context
|
|
|
|
.getBean("rabbitListenerContainerFactory",
|
|
|
|
.getBean("rabbitListenerContainerFactory",
|
|
|
|
SimpleRabbitListenerContainerFactory.class);
|
|
|
|
SimpleRabbitListenerContainerFactory.class);
|
|
|
|
rabbitListenerContainerFactory.setTxSize(10);
|
|
|
|
rabbitListenerContainerFactory.setTxSize(10);
|
|
|
|
verify(rabbitListenerContainerFactory).setTxSize(10);
|
|
|
|
verify(rabbitListenerContainerFactory).setTxSize(10);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitListenerContainerFactory);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(
|
|
|
|
Advice[] adviceChain = (Advice[]) dfa.getPropertyValue("adviceChain");
|
|
|
|
rabbitListenerContainerFactory);
|
|
|
|
assertThat(adviceChain).isNull();
|
|
|
|
Advice[] adviceChain = (Advice[]) dfa.getPropertyValue("adviceChain");
|
|
|
|
});
|
|
|
|
assertThat(adviceChain).isNull();
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testSimpleRabbitListenerContainerFactoryWithCustomSettings() {
|
|
|
|
public void testSimpleRabbitListenerContainerFactoryWithCustomSettings() {
|
|
|
|
this.contextRunner.withUserConfiguration(MessageConvertersConfiguration.class,
|
|
|
|
this.contextRunner
|
|
|
|
MessageRecoverersConfiguration.class).withPropertyValues(
|
|
|
|
.withUserConfiguration(MessageConvertersConfiguration.class,
|
|
|
|
"spring.rabbitmq.listener.simple.retry.enabled:true",
|
|
|
|
MessageRecoverersConfiguration.class)
|
|
|
|
"spring.rabbitmq.listener.simple.retry.maxAttempts:4",
|
|
|
|
.withPropertyValues("spring.rabbitmq.listener.simple.retry.enabled:true",
|
|
|
|
"spring.rabbitmq.listener.simple.retry.initialInterval:2000",
|
|
|
|
"spring.rabbitmq.listener.simple.retry.maxAttempts:4",
|
|
|
|
"spring.rabbitmq.listener.simple.retry.multiplier:1.5",
|
|
|
|
"spring.rabbitmq.listener.simple.retry.initialInterval:2000",
|
|
|
|
"spring.rabbitmq.listener.simple.retry.maxInterval:5000",
|
|
|
|
"spring.rabbitmq.listener.simple.retry.multiplier:1.5",
|
|
|
|
"spring.rabbitmq.listener.simple.autoStartup:false",
|
|
|
|
"spring.rabbitmq.listener.simple.retry.maxInterval:5000",
|
|
|
|
"spring.rabbitmq.listener.simple.acknowledgeMode:manual",
|
|
|
|
"spring.rabbitmq.listener.simple.autoStartup:false",
|
|
|
|
"spring.rabbitmq.listener.simple.concurrency:5",
|
|
|
|
"spring.rabbitmq.listener.simple.acknowledgeMode:manual",
|
|
|
|
"spring.rabbitmq.listener.simple.maxConcurrency:10",
|
|
|
|
"spring.rabbitmq.listener.simple.concurrency:5",
|
|
|
|
"spring.rabbitmq.listener.simple.prefetch:40",
|
|
|
|
"spring.rabbitmq.listener.simple.maxConcurrency:10",
|
|
|
|
"spring.rabbitmq.listener.simple.defaultRequeueRejected:false",
|
|
|
|
"spring.rabbitmq.listener.simple.prefetch:40",
|
|
|
|
"spring.rabbitmq.listener.simple.idleEventInterval:5",
|
|
|
|
"spring.rabbitmq.listener.simple.defaultRequeueRejected:false",
|
|
|
|
"spring.rabbitmq.listener.simple.transactionSize:20").run((context) -> {
|
|
|
|
"spring.rabbitmq.listener.simple.idleEventInterval:5",
|
|
|
|
SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = context
|
|
|
|
"spring.rabbitmq.listener.simple.transactionSize:20")
|
|
|
|
.getBean("rabbitListenerContainerFactory",
|
|
|
|
.run((context) -> {
|
|
|
|
SimpleRabbitListenerContainerFactory.class);
|
|
|
|
SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = context
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitListenerContainerFactory);
|
|
|
|
.getBean("rabbitListenerContainerFactory",
|
|
|
|
assertThat(dfa.getPropertyValue("concurrentConsumers")).isEqualTo(5);
|
|
|
|
SimpleRabbitListenerContainerFactory.class);
|
|
|
|
assertThat(dfa.getPropertyValue("maxConcurrentConsumers")).isEqualTo(10);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(
|
|
|
|
assertThat(dfa.getPropertyValue("txSize")).isEqualTo(20);
|
|
|
|
rabbitListenerContainerFactory);
|
|
|
|
checkCommonProps(context, dfa);
|
|
|
|
assertThat(dfa.getPropertyValue("concurrentConsumers")).isEqualTo(5);
|
|
|
|
});
|
|
|
|
assertThat(dfa.getPropertyValue("maxConcurrentConsumers"))
|
|
|
|
|
|
|
|
.isEqualTo(10);
|
|
|
|
|
|
|
|
assertThat(dfa.getPropertyValue("txSize")).isEqualTo(20);
|
|
|
|
|
|
|
|
checkCommonProps(context, dfa);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testDirectRabbitListenerContainerFactoryWithCustomSettings() {
|
|
|
|
public void testDirectRabbitListenerContainerFactoryWithCustomSettings() {
|
|
|
|
this.contextRunner.withUserConfiguration(MessageConvertersConfiguration.class,
|
|
|
|
this.contextRunner
|
|
|
|
MessageRecoverersConfiguration.class).withPropertyValues(
|
|
|
|
.withUserConfiguration(MessageConvertersConfiguration.class,
|
|
|
|
"spring.rabbitmq.listener.type:direct",
|
|
|
|
MessageRecoverersConfiguration.class)
|
|
|
|
"spring.rabbitmq.listener.direct.retry.enabled:true",
|
|
|
|
.withPropertyValues("spring.rabbitmq.listener.type:direct",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.maxAttempts:4",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.enabled:true",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.initialInterval:2000",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.maxAttempts:4",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.multiplier:1.5",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.initialInterval:2000",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.maxInterval:5000",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.multiplier:1.5",
|
|
|
|
"spring.rabbitmq.listener.direct.autoStartup:false",
|
|
|
|
"spring.rabbitmq.listener.direct.retry.maxInterval:5000",
|
|
|
|
"spring.rabbitmq.listener.direct.acknowledgeMode:manual",
|
|
|
|
"spring.rabbitmq.listener.direct.autoStartup:false",
|
|
|
|
"spring.rabbitmq.listener.direct.consumers-per-queue:5",
|
|
|
|
"spring.rabbitmq.listener.direct.acknowledgeMode:manual",
|
|
|
|
"spring.rabbitmq.listener.direct.prefetch:40",
|
|
|
|
"spring.rabbitmq.listener.direct.consumers-per-queue:5",
|
|
|
|
"spring.rabbitmq.listener.direct.defaultRequeueRejected:false",
|
|
|
|
"spring.rabbitmq.listener.direct.prefetch:40",
|
|
|
|
"spring.rabbitmq.listener.direct.idleEventInterval:5").run((context) -> {
|
|
|
|
"spring.rabbitmq.listener.direct.defaultRequeueRejected:false",
|
|
|
|
DirectRabbitListenerContainerFactory rabbitListenerContainerFactory = context
|
|
|
|
"spring.rabbitmq.listener.direct.idleEventInterval:5")
|
|
|
|
.getBean("rabbitListenerContainerFactory",
|
|
|
|
.run((context) -> {
|
|
|
|
DirectRabbitListenerContainerFactory.class);
|
|
|
|
DirectRabbitListenerContainerFactory rabbitListenerContainerFactory = context
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitListenerContainerFactory);
|
|
|
|
.getBean("rabbitListenerContainerFactory",
|
|
|
|
assertThat(dfa.getPropertyValue("consumersPerQueue")).isEqualTo(5);
|
|
|
|
DirectRabbitListenerContainerFactory.class);
|
|
|
|
checkCommonProps(context, dfa);
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(
|
|
|
|
});
|
|
|
|
rabbitListenerContainerFactory);
|
|
|
|
|
|
|
|
assertThat(dfa.getPropertyValue("consumersPerQueue")).isEqualTo(5);
|
|
|
|
|
|
|
|
checkCommonProps(context, dfa);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -387,12 +407,13 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
"spring.rabbitmq.listener.simple.maxConcurrency:10",
|
|
|
|
"spring.rabbitmq.listener.simple.maxConcurrency:10",
|
|
|
|
"spring.rabbitmq.listener.simple.prefetch:40",
|
|
|
|
"spring.rabbitmq.listener.simple.prefetch:40",
|
|
|
|
"spring.rabbitmq.listener.direct.consumers-per-queue:5",
|
|
|
|
"spring.rabbitmq.listener.direct.consumers-per-queue:5",
|
|
|
|
"spring.rabbitmq.listener.direct.prefetch:40").run((context) -> {
|
|
|
|
"spring.rabbitmq.listener.direct.prefetch:40")
|
|
|
|
assertThat(context).hasSingleBean(
|
|
|
|
.run((context) -> {
|
|
|
|
SimpleRabbitListenerContainerFactoryConfigurer.class);
|
|
|
|
assertThat(context).hasSingleBean(
|
|
|
|
assertThat(context).hasSingleBean(
|
|
|
|
SimpleRabbitListenerContainerFactoryConfigurer.class);
|
|
|
|
DirectRabbitListenerContainerFactoryConfigurer.class);
|
|
|
|
assertThat(context).hasSingleBean(
|
|
|
|
});
|
|
|
|
DirectRabbitListenerContainerFactoryConfigurer.class);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -401,16 +422,18 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
.withPropertyValues("spring.rabbitmq.listener.type:direct",
|
|
|
|
.withPropertyValues("spring.rabbitmq.listener.type:direct",
|
|
|
|
"spring.rabbitmq.listener.simple.concurrency:5",
|
|
|
|
"spring.rabbitmq.listener.simple.concurrency:5",
|
|
|
|
"spring.rabbitmq.listener.simple.maxConcurrency:10",
|
|
|
|
"spring.rabbitmq.listener.simple.maxConcurrency:10",
|
|
|
|
"spring.rabbitmq.listener.simple.prefetch:40").run((context) -> {
|
|
|
|
"spring.rabbitmq.listener.simple.prefetch:40")
|
|
|
|
SimpleRabbitListenerContainerFactoryConfigurer configurer = context
|
|
|
|
.run((context) -> {
|
|
|
|
.getBean(SimpleRabbitListenerContainerFactoryConfigurer.class);
|
|
|
|
SimpleRabbitListenerContainerFactoryConfigurer configurer = context
|
|
|
|
SimpleRabbitListenerContainerFactory factory = mock(
|
|
|
|
.getBean(
|
|
|
|
SimpleRabbitListenerContainerFactory.class);
|
|
|
|
SimpleRabbitListenerContainerFactoryConfigurer.class);
|
|
|
|
configurer.configure(factory, mock(ConnectionFactory.class));
|
|
|
|
SimpleRabbitListenerContainerFactory factory = mock(
|
|
|
|
verify(factory).setConcurrentConsumers(5);
|
|
|
|
SimpleRabbitListenerContainerFactory.class);
|
|
|
|
verify(factory).setMaxConcurrentConsumers(10);
|
|
|
|
configurer.configure(factory, mock(ConnectionFactory.class));
|
|
|
|
verify(factory).setPrefetchCount(40);
|
|
|
|
verify(factory).setConcurrentConsumers(5);
|
|
|
|
});
|
|
|
|
verify(factory).setMaxConcurrentConsumers(10);
|
|
|
|
|
|
|
|
verify(factory).setPrefetchCount(40);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -418,15 +441,17 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withPropertyValues("spring.rabbitmq.listener.type:simple",
|
|
|
|
.withPropertyValues("spring.rabbitmq.listener.type:simple",
|
|
|
|
"spring.rabbitmq.listener.direct.consumers-per-queue:5",
|
|
|
|
"spring.rabbitmq.listener.direct.consumers-per-queue:5",
|
|
|
|
"spring.rabbitmq.listener.direct.prefetch:40").run((context) -> {
|
|
|
|
"spring.rabbitmq.listener.direct.prefetch:40")
|
|
|
|
DirectRabbitListenerContainerFactoryConfigurer configurer = context
|
|
|
|
.run((context) -> {
|
|
|
|
.getBean(DirectRabbitListenerContainerFactoryConfigurer.class);
|
|
|
|
DirectRabbitListenerContainerFactoryConfigurer configurer = context
|
|
|
|
DirectRabbitListenerContainerFactory factory = mock(
|
|
|
|
.getBean(
|
|
|
|
DirectRabbitListenerContainerFactory.class);
|
|
|
|
DirectRabbitListenerContainerFactoryConfigurer.class);
|
|
|
|
configurer.configure(factory, mock(ConnectionFactory.class));
|
|
|
|
DirectRabbitListenerContainerFactory factory = mock(
|
|
|
|
verify(factory).setConsumersPerQueue(5);
|
|
|
|
DirectRabbitListenerContainerFactory.class);
|
|
|
|
verify(factory).setPrefetchCount(40);
|
|
|
|
configurer.configure(factory, mock(ConnectionFactory.class));
|
|
|
|
});
|
|
|
|
verify(factory).setConsumersPerQueue(5);
|
|
|
|
|
|
|
|
verify(factory).setPrefetchCount(40);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void checkCommonProps(AssertableApplicationContext context,
|
|
|
|
private void checkCommonProps(AssertableApplicationContext context,
|
|
|
@ -468,13 +493,13 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void enableRabbitAutomatically() throws Exception {
|
|
|
|
public void enableRabbitAutomatically() throws Exception {
|
|
|
|
this.contextRunner.withUserConfiguration(
|
|
|
|
this.contextRunner.withUserConfiguration(NoEnableRabbitConfiguration.class)
|
|
|
|
NoEnableRabbitConfiguration.class).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
assertThat(context).hasBean(
|
|
|
|
assertThat(context).hasBean(
|
|
|
|
RabbitListenerConfigUtils.RABBIT_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME);
|
|
|
|
RabbitListenerConfigUtils.RABBIT_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME);
|
|
|
|
assertThat(context).hasBean(
|
|
|
|
assertThat(context).hasBean(
|
|
|
|
RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME);
|
|
|
|
RabbitListenerConfigUtils.RABBIT_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -482,7 +507,8 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withPropertyValues("spring.rabbitmq.requestedHeartbeat:20")
|
|
|
|
.withPropertyValues("spring.rabbitmq.requestedHeartbeat:20")
|
|
|
|
.run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context);
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(
|
|
|
|
|
|
|
|
context);
|
|
|
|
assertThat(rabbitConnectionFactory.getRequestedHeartbeat())
|
|
|
|
assertThat(rabbitConnectionFactory.getRequestedHeartbeat())
|
|
|
|
.isEqualTo(20);
|
|
|
|
.isEqualTo(20);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -490,23 +516,26 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void noSslByDefault() {
|
|
|
|
public void noSslByDefault() {
|
|
|
|
this.contextRunner.withUserConfiguration(
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
TestConfiguration.class).run((context) -> {
|
|
|
|
.run((context) -> {
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context);
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(
|
|
|
|
assertThat(rabbitConnectionFactory.getSocketFactory())
|
|
|
|
context);
|
|
|
|
.as("Must use default SocketFactory")
|
|
|
|
assertThat(rabbitConnectionFactory.getSocketFactory())
|
|
|
|
.isEqualTo(SocketFactory.getDefault());
|
|
|
|
.as("Must use default SocketFactory")
|
|
|
|
});
|
|
|
|
.isEqualTo(SocketFactory.getDefault());
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void enableSsl() {
|
|
|
|
public void enableSsl() {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
.withPropertyValues("spring.rabbitmq.ssl.enabled:true").run((context) -> {
|
|
|
|
.withPropertyValues("spring.rabbitmq.ssl.enabled:true").run((context) -> {
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context);
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(
|
|
|
|
assertThat(rabbitConnectionFactory.getSocketFactory())
|
|
|
|
context);
|
|
|
|
.as("SocketFactory must use SSL").isInstanceOf(SSLSocketFactory.class);
|
|
|
|
assertThat(rabbitConnectionFactory.getSocketFactory())
|
|
|
|
});
|
|
|
|
.as("SocketFactory must use SSL")
|
|
|
|
|
|
|
|
.isInstanceOf(SSLSocketFactory.class);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
@ -517,11 +546,13 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
"spring.rabbitmq.ssl.keyStore=foo",
|
|
|
|
"spring.rabbitmq.ssl.keyStore=foo",
|
|
|
|
"spring.rabbitmq.ssl.keyStorePassword=secret",
|
|
|
|
"spring.rabbitmq.ssl.keyStorePassword=secret",
|
|
|
|
"spring.rabbitmq.ssl.trustStore=bar",
|
|
|
|
"spring.rabbitmq.ssl.trustStore=bar",
|
|
|
|
"spring.rabbitmq.ssl.trustStorePassword=secret").run((context) -> {
|
|
|
|
"spring.rabbitmq.ssl.trustStorePassword=secret")
|
|
|
|
assertThat(context).hasFailed();
|
|
|
|
.run((context) -> {
|
|
|
|
assertThat(context).getFailure().hasMessageContaining("foo");
|
|
|
|
assertThat(context).hasFailed();
|
|
|
|
assertThat(context).getFailure().hasMessageContaining("does not exist");
|
|
|
|
assertThat(context).getFailure().hasMessageContaining("foo");
|
|
|
|
});
|
|
|
|
assertThat(context).getFailure()
|
|
|
|
|
|
|
|
.hasMessageContaining("does not exist");
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private com.rabbitmq.client.ConnectionFactory getTargetConnectionFactory(
|
|
|
|
private com.rabbitmq.client.ConnectionFactory getTargetConnectionFactory(
|
|
|
|