|
|
|
@ -101,12 +101,17 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
|
public void testConnectionFactoryWithOverrides() {
|
|
|
|
|
load(TestConfiguration.class, "spring.rabbitmq.host:remote-server",
|
|
|
|
|
"spring.rabbitmq.port:9000", "spring.rabbitmq.username:alice",
|
|
|
|
|
"spring.rabbitmq.password:secret", "spring.rabbitmq.virtual_host:/vhost");
|
|
|
|
|
"spring.rabbitmq.password:secret", "spring.rabbitmq.virtual_host:/vhost",
|
|
|
|
|
"spring.rabbitmq.connection-timeout:123");
|
|
|
|
|
CachingConnectionFactory connectionFactory = this.context
|
|
|
|
|
.getBean(CachingConnectionFactory.class);
|
|
|
|
|
assertThat(connectionFactory.getHost()).isEqualTo("remote-server");
|
|
|
|
|
assertThat(connectionFactory.getPort()).isEqualTo(9000);
|
|
|
|
|
assertThat(connectionFactory.getVirtualHost()).isEqualTo("/vhost");
|
|
|
|
|
DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
|
|
|
|
|
com.rabbitmq.client.ConnectionFactory rcf = (com.rabbitmq.client.ConnectionFactory) dfa
|
|
|
|
|
.getPropertyValue("rabbitConnectionFactory");
|
|
|
|
|
assertThat(rcf.getConnectionTimeout()).isEqualTo(123);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|