|
|
@ -100,6 +100,8 @@ class RabbitAutoConfigurationTests {
|
|
|
|
assertThat(messagingTemplate.getRabbitTemplate()).isEqualTo(rabbitTemplate);
|
|
|
|
assertThat(messagingTemplate.getRabbitTemplate()).isEqualTo(rabbitTemplate);
|
|
|
|
assertThat(amqpAdmin).isNotNull();
|
|
|
|
assertThat(amqpAdmin).isNotNull();
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("localhost");
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("localhost");
|
|
|
|
|
|
|
|
assertThat(getTargetConnectionFactory(context).getRequestedChannelMax())
|
|
|
|
|
|
|
|
.isEqualTo(com.rabbitmq.client.ConnectionFactory.DEFAULT_CHANNEL_MAX);
|
|
|
|
assertThat(connectionFactory.isPublisherConfirms()).isFalse();
|
|
|
|
assertThat(connectionFactory.isPublisherConfirms()).isFalse();
|
|
|
|
assertThat(connectionFactory.isPublisherReturns()).isFalse();
|
|
|
|
assertThat(connectionFactory.isPublisherReturns()).isFalse();
|
|
|
|
assertThat(context.containsBean("rabbitListenerContainerFactory"))
|
|
|
|
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
|
|
|
|
@Test
|
|
|
|
void noSslByDefault() {
|
|
|
|
void noSslByDefault() {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> {
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> {
|
|
|
@ -716,24 +727,6 @@ class RabbitAutoConfigurationTests {
|
|
|
|
return (TrustManager) trustManager;
|
|
|
|
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) {
|
|
|
|
private com.rabbitmq.client.ConnectionFactory getTargetConnectionFactory(AssertableApplicationContext context) {
|
|
|
|
CachingConnectionFactory connectionFactory = context.getBean(CachingConnectionFactory.class);
|
|
|
|
CachingConnectionFactory connectionFactory = context.getBean(CachingConnectionFactory.class);
|
|
|
|
return connectionFactory.getRabbitConnectionFactory();
|
|
|
|
return connectionFactory.getRabbitConnectionFactory();
|
|
|
|