|
|
|
@ -100,6 +100,8 @@ class RabbitAutoConfigurationTests {
|
|
|
|
|
assertThat(messagingTemplate.getRabbitTemplate()).isEqualTo(rabbitTemplate);
|
|
|
|
|
assertThat(amqpAdmin).isNotNull();
|
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("localhost");
|
|
|
|
|
assertThat(getTargetConnectionFactory(context).getRequestedChannelMax())
|
|
|
|
|
.isEqualTo(com.rabbitmq.client.ConnectionFactory.DEFAULT_CHANNEL_MAX);
|
|
|
|
|
assertThat(connectionFactory.isPublisherConfirms()).isFalse();
|
|
|
|
|
assertThat(connectionFactory.isPublisherReturns()).isFalse();
|
|
|
|
|
assertThat(context.containsBean("rabbitListenerContainerFactory"))
|
|
|
|
@ -601,6 +603,15 @@ class RabbitAutoConfigurationTests {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void customizeRequestedChannelMax() {
|
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
|
.withPropertyValues("spring.rabbitmq.requestedChannelMax:12").run((context) -> {
|
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context);
|
|
|
|
|
assertThat(rabbitConnectionFactory.getRequestedChannelMax()).isEqualTo(12);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void noSslByDefault() {
|
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> {
|
|
|
|
@ -716,24 +727,6 @@ class RabbitAutoConfigurationTests {
|
|
|
|
|
return (TrustManager) trustManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void testChangeDefaultRequestedChannelMax() throws Exception {
|
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
|
.withPropertyValues("spring.rabbitmq.requestedChannelMax:12").run((context) -> {
|
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context);
|
|
|
|
|
assertThat(rabbitConnectionFactory.getRequestedChannelMax()).isEqualTo(12);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void testKeepDefaultRequestedChannelMax() throws Exception {
|
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> {
|
|
|
|
|
com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context);
|
|
|
|
|
assertThat(rabbitConnectionFactory.getRequestedChannelMax())
|
|
|
|
|
.isEqualTo(com.rabbitmq.client.ConnectionFactory.DEFAULT_CHANNEL_MAX);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private com.rabbitmq.client.ConnectionFactory getTargetConnectionFactory(AssertableApplicationContext context) {
|
|
|
|
|
CachingConnectionFactory connectionFactory = context.getBean(CachingConnectionFactory.class);
|
|
|
|
|
return connectionFactory.getRabbitConnectionFactory();
|
|
|
|
|