Search in sources :

Example 1 with AmqpChannelFactoryBean

use of org.springframework.integration.amqp.config.AmqpChannelFactoryBean in project spring-integration by spring-projects.

the class ChannelTests method testAmqpChannelFactoryBean.

@Test
public void testAmqpChannelFactoryBean() throws Exception {
    AmqpChannelFactoryBean channelFactoryBean = new AmqpChannelFactoryBean();
    channelFactoryBean.setBeanFactory(mock(BeanFactory.class));
    channelFactoryBean.setConnectionFactory(this.connectionFactory);
    channelFactoryBean.setBeanName("testChannel");
    channelFactoryBean.afterPropertiesSet();
    AbstractAmqpChannel channel = channelFactoryBean.getObject();
    assertThat(channel, instanceOf(PointToPointSubscribableAmqpChannel.class));
    channelFactoryBean = new AmqpChannelFactoryBean();
    channelFactoryBean.setBeanFactory(mock(BeanFactory.class));
    channelFactoryBean.setConnectionFactory(this.connectionFactory);
    channelFactoryBean.setBeanName("testChannel");
    channelFactoryBean.setPubSub(true);
    channelFactoryBean.afterPropertiesSet();
    channel = channelFactoryBean.getObject();
    assertThat(channel, instanceOf(PublishSubscribeAmqpChannel.class));
    RabbitAdmin rabbitAdmin = new RabbitAdmin(this.connectionFactory);
    rabbitAdmin.deleteQueue("testChannel");
    rabbitAdmin.deleteExchange("si.fanout.testChannel");
}
Also used : BeanFactory(org.springframework.beans.factory.BeanFactory) RabbitAdmin(org.springframework.amqp.rabbit.core.RabbitAdmin) AmqpChannelFactoryBean(org.springframework.integration.amqp.config.AmqpChannelFactoryBean) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 RabbitAdmin (org.springframework.amqp.rabbit.core.RabbitAdmin)1 BeanFactory (org.springframework.beans.factory.BeanFactory)1 AmqpChannelFactoryBean (org.springframework.integration.amqp.config.AmqpChannelFactoryBean)1