Search in sources :

Example 1 with RabbitMessagingTemplate

use of org.springframework.amqp.rabbit.core.RabbitMessagingTemplate in project spring-boot by spring-projects.

the class RabbitAutoConfigurationTests method testRabbitMessagingTemplateBackOff.

@Test
public void testRabbitMessagingTemplateBackOff() {
    load(TestConfiguration4.class);
    RabbitMessagingTemplate messagingTemplate = this.context.getBean(RabbitMessagingTemplate.class);
    assertThat(messagingTemplate.getDefaultDestination()).isEqualTo("fooBar");
}
Also used : RabbitMessagingTemplate(org.springframework.amqp.rabbit.core.RabbitMessagingTemplate) Test(org.junit.Test)

Example 2 with RabbitMessagingTemplate

use of org.springframework.amqp.rabbit.core.RabbitMessagingTemplate in project spring-boot by spring-projects.

the class RabbitAutoConfigurationTests method testDefaultRabbitConfiguration.

@Test
public void testDefaultRabbitConfiguration() {
    load(TestConfiguration.class);
    RabbitTemplate rabbitTemplate = this.context.getBean(RabbitTemplate.class);
    RabbitMessagingTemplate messagingTemplate = this.context.getBean(RabbitMessagingTemplate.class);
    CachingConnectionFactory connectionFactory = this.context.getBean(CachingConnectionFactory.class);
    DirectFieldAccessor dfa = new DirectFieldAccessor(connectionFactory);
    RabbitAdmin amqpAdmin = this.context.getBean(RabbitAdmin.class);
    assertThat(rabbitTemplate.getConnectionFactory()).isEqualTo(connectionFactory);
    assertThat(getMandatory(rabbitTemplate)).isFalse();
    assertThat(messagingTemplate.getRabbitTemplate()).isEqualTo(rabbitTemplate);
    assertThat(amqpAdmin).isNotNull();
    assertThat(connectionFactory.getHost()).isEqualTo("localhost");
    assertThat(dfa.getPropertyValue("publisherConfirms")).isEqualTo(false);
    assertThat(dfa.getPropertyValue("publisherReturns")).isEqualTo(false);
    assertThat(this.context.containsBean("rabbitListenerContainerFactory")).as("Listener container factory should be created by default").isTrue();
}
Also used : RabbitTemplate(org.springframework.amqp.rabbit.core.RabbitTemplate) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) RabbitMessagingTemplate(org.springframework.amqp.rabbit.core.RabbitMessagingTemplate) CachingConnectionFactory(org.springframework.amqp.rabbit.connection.CachingConnectionFactory) RabbitAdmin(org.springframework.amqp.rabbit.core.RabbitAdmin) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 RabbitMessagingTemplate (org.springframework.amqp.rabbit.core.RabbitMessagingTemplate)2 CachingConnectionFactory (org.springframework.amqp.rabbit.connection.CachingConnectionFactory)1 RabbitAdmin (org.springframework.amqp.rabbit.core.RabbitAdmin)1 RabbitTemplate (org.springframework.amqp.rabbit.core.RabbitTemplate)1 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)1