Search in sources :

Example 1 with PublisherCallbackChannelImpl

use of org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl in project spring-integration by spring-projects.

the class AmqpOutboundChannelAdapterParserTests method testInt2773WithOverrideToDefaultAmqpTemplateExchangeAndRoutingLey.

@Test
public void testInt2773WithOverrideToDefaultAmqpTemplateExchangeAndRoutingLey() throws IOException {
    ConnectionFactory connectionFactory = context.getBean(ConnectionFactory.class);
    Connection mockConnection = mock(Connection.class);
    Channel mockChannel = mock(Channel.class);
    when(connectionFactory.createConnection()).thenReturn(mockConnection);
    PublisherCallbackChannelImpl publisherCallbackChannel = new PublisherCallbackChannelImpl(mockChannel);
    when(mockConnection.createChannel(false)).thenReturn(publisherCallbackChannel);
    MessageChannel requestChannel = context.getBean("overrideTemplateAttributesToEmpty", MessageChannel.class);
    requestChannel.send(MessageBuilder.withPayload("test").build());
    Mockito.verify(mockChannel, Mockito.times(1)).basicPublish(Mockito.eq(""), Mockito.eq(""), Mockito.anyBoolean(), Mockito.any(BasicProperties.class), Mockito.any(byte[].class));
}
Also used : ConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory) MessageChannel(org.springframework.messaging.MessageChannel) BasicProperties(com.rabbitmq.client.AMQP.BasicProperties) NullChannel(org.springframework.integration.channel.NullChannel) MessageChannel(org.springframework.messaging.MessageChannel) DirectChannel(org.springframework.integration.channel.DirectChannel) Channel(com.rabbitmq.client.Channel) Connection(org.springframework.amqp.rabbit.connection.Connection) PublisherCallbackChannelImpl(org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl) Test(org.junit.Test)

Example 2 with PublisherCallbackChannelImpl

use of org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl in project spring-integration by spring-projects.

the class AmqpOutboundChannelAdapterParserTests method testInt2773UseDefaultAmqpTemplateExchangeAndRoutingLey.

@Test
public void testInt2773UseDefaultAmqpTemplateExchangeAndRoutingLey() throws IOException {
    ConnectionFactory connectionFactory = context.getBean(ConnectionFactory.class);
    Connection mockConnection = mock(Connection.class);
    Channel mockChannel = mock(Channel.class);
    when(connectionFactory.createConnection()).thenReturn(mockConnection);
    PublisherCallbackChannelImpl publisherCallbackChannel = new PublisherCallbackChannelImpl(mockChannel);
    when(mockConnection.createChannel(false)).thenReturn(publisherCallbackChannel);
    MessageChannel requestChannel = context.getBean("toRabbitOnlyWithTemplateChannel", MessageChannel.class);
    requestChannel.send(MessageBuilder.withPayload("test").build());
    Mockito.verify(mockChannel, Mockito.times(1)).basicPublish(Mockito.eq("default.test.exchange"), Mockito.eq("default.routing.key"), Mockito.anyBoolean(), Mockito.any(BasicProperties.class), Mockito.any(byte[].class));
}
Also used : ConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory) MessageChannel(org.springframework.messaging.MessageChannel) BasicProperties(com.rabbitmq.client.AMQP.BasicProperties) NullChannel(org.springframework.integration.channel.NullChannel) MessageChannel(org.springframework.messaging.MessageChannel) DirectChannel(org.springframework.integration.channel.DirectChannel) Channel(com.rabbitmq.client.Channel) Connection(org.springframework.amqp.rabbit.connection.Connection) PublisherCallbackChannelImpl(org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl) Test(org.junit.Test)

Example 3 with PublisherCallbackChannelImpl

use of org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl in project spring-integration by spring-projects.

the class AmqpOutboundChannelAdapterParserTests method testInt2773WithDefaultAmqpTemplateExchangeAndRoutingKey.

@Test
public void testInt2773WithDefaultAmqpTemplateExchangeAndRoutingKey() throws IOException {
    ConnectionFactory connectionFactory = context.getBean(ConnectionFactory.class);
    Connection mockConnection = mock(Connection.class);
    Channel mockChannel = mock(Channel.class);
    when(connectionFactory.createConnection()).thenReturn(mockConnection);
    PublisherCallbackChannelImpl publisherCallbackChannel = new PublisherCallbackChannelImpl(mockChannel);
    when(mockConnection.createChannel(false)).thenReturn(publisherCallbackChannel);
    MessageChannel requestChannel = context.getBean("withDefaultAmqpTemplateExchangeAndRoutingKey", MessageChannel.class);
    requestChannel.send(MessageBuilder.withPayload("test").build());
    Mockito.verify(mockChannel, Mockito.times(1)).basicPublish(Mockito.eq(""), Mockito.eq(""), Mockito.anyBoolean(), Mockito.any(BasicProperties.class), Mockito.any(byte[].class));
}
Also used : ConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory) MessageChannel(org.springframework.messaging.MessageChannel) BasicProperties(com.rabbitmq.client.AMQP.BasicProperties) NullChannel(org.springframework.integration.channel.NullChannel) MessageChannel(org.springframework.messaging.MessageChannel) DirectChannel(org.springframework.integration.channel.DirectChannel) Channel(com.rabbitmq.client.Channel) Connection(org.springframework.amqp.rabbit.connection.Connection) PublisherCallbackChannelImpl(org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl) Test(org.junit.Test)

Aggregations

BasicProperties (com.rabbitmq.client.AMQP.BasicProperties)3 Channel (com.rabbitmq.client.Channel)3 Test (org.junit.Test)3 Connection (org.springframework.amqp.rabbit.connection.Connection)3 ConnectionFactory (org.springframework.amqp.rabbit.connection.ConnectionFactory)3 PublisherCallbackChannelImpl (org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl)3 DirectChannel (org.springframework.integration.channel.DirectChannel)3 NullChannel (org.springframework.integration.channel.NullChannel)3 MessageChannel (org.springframework.messaging.MessageChannel)3