|
|
|
@ -103,6 +103,19 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testDefaultRabbitTemplateConfiguration() {
|
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
|
.run((context) -> {
|
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
|
RabbitTemplate defaultRabbitTemplate = new RabbitTemplate();
|
|
|
|
|
assertThat(rabbitTemplate.getRoutingKey())
|
|
|
|
|
.isEqualTo(defaultRabbitTemplate.getRoutingKey());
|
|
|
|
|
assertThat(rabbitTemplate.getExchange())
|
|
|
|
|
.isEqualTo(defaultRabbitTemplate.getExchange());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testConnectionFactoryWithOverrides() {
|
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
@ -224,6 +237,18 @@ public class RabbitAutoConfigurationTests {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testRabbitTemplateExchangeAndRoutingKey() {
|
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
|
.withPropertyValues("spring.rabbitmq.template.exchange:my-exchange",
|
|
|
|
|
"spring.rabbitmq.template.routing-key:my-routing-key")
|
|
|
|
|
.run((context) -> {
|
|
|
|
|
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
|
|
|
|
assertThat(rabbitTemplate.getExchange()).isEqualTo("my-exchange");
|
|
|
|
|
assertThat(rabbitTemplate.getRoutingKey()).isEqualTo("my-routing-key");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testRabbitTemplateMandatory() {
|
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
|
|
|
|