use of org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter in project spring-integration by spring-projects.
the class AmqpInboundChannelAdapterParserTests method withHeaderMapperOnlyCustomHeaders.
@Test
public void withHeaderMapperOnlyCustomHeaders() throws Exception {
AmqpInboundChannelAdapter adapter = context.getBean("withHeaderMapperOnlyCustomHeaders", AmqpInboundChannelAdapter.class);
AbstractMessageListenerContainer mlc = TestUtils.getPropertyValue(adapter, "messageListenerContainer", AbstractMessageListenerContainer.class);
ChannelAwareMessageListener listener = TestUtils.getPropertyValue(mlc, "messageListener", ChannelAwareMessageListener.class);
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setClusterId("test.clusterId");
amqpProperties.setContentEncoding("test.contentEncoding");
amqpProperties.setContentLength(99L);
amqpProperties.setContentType("test.contentType");
amqpProperties.setHeader("foo", "foo");
amqpProperties.setHeader("bar", "bar");
Message amqpMessage = new Message("hello".getBytes(), amqpProperties);
listener.onMessage(amqpMessage, null);
QueueChannel requestChannel = context.getBean("requestChannel", QueueChannel.class);
org.springframework.messaging.Message<?> siMessage = requestChannel.receive(0);
assertEquals("foo", siMessage.getHeaders().get("foo"));
assertNull(siMessage.getHeaders().get("bar"));
assertNull(siMessage.getHeaders().get(AmqpHeaders.CONTENT_ENCODING));
assertNull(siMessage.getHeaders().get(AmqpHeaders.CLUSTER_ID));
assertNull(siMessage.getHeaders().get(AmqpHeaders.APP_ID));
assertNull(siMessage.getHeaders().get(AmqpHeaders.CONTENT_TYPE));
}
use of org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter in project spring-integration by spring-projects.
the class AmqpInboundChannelAdapterParserTests method withHeaderMapperStandardAndCustomHeaders.
@Test
public void withHeaderMapperStandardAndCustomHeaders() throws Exception {
AmqpInboundChannelAdapter adapter = context.getBean("withHeaderMapperStandardAndCustomHeaders", AmqpInboundChannelAdapter.class);
AbstractMessageListenerContainer mlc = TestUtils.getPropertyValue(adapter, "messageListenerContainer", AbstractMessageListenerContainer.class);
ChannelAwareMessageListener listener = TestUtils.getPropertyValue(mlc, "messageListener", ChannelAwareMessageListener.class);
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setClusterId("test.clusterId");
amqpProperties.setContentEncoding("test.contentEncoding");
amqpProperties.setContentLength(99L);
amqpProperties.setContentType("test.contentType");
amqpProperties.setHeader("foo", "foo");
amqpProperties.setHeader("bar", "bar");
Message amqpMessage = new Message("hello".getBytes(), amqpProperties);
listener.onMessage(amqpMessage, null);
QueueChannel requestChannel = context.getBean("requestChannel", QueueChannel.class);
org.springframework.messaging.Message<?> siMessage = requestChannel.receive(0);
assertEquals("foo", siMessage.getHeaders().get("foo"));
assertNull(siMessage.getHeaders().get("bar"));
assertNotNull(siMessage.getHeaders().get(AmqpHeaders.CONTENT_ENCODING));
assertNotNull(siMessage.getHeaders().get(AmqpHeaders.CLUSTER_ID));
assertNotNull(siMessage.getHeaders().get(AmqpHeaders.APP_ID));
assertNotNull(siMessage.getHeaders().get(AmqpHeaders.CONTENT_TYPE));
}
use of org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter in project spring-integration by spring-projects.
the class AmqpInboundChannelAdapterParserTests method withHeaderMapperNothingToMap.
@Test
public void withHeaderMapperNothingToMap() throws Exception {
AmqpInboundChannelAdapter adapter = context.getBean("withHeaderMapperNothingToMap", AmqpInboundChannelAdapter.class);
AbstractMessageListenerContainer mlc = TestUtils.getPropertyValue(adapter, "messageListenerContainer", AbstractMessageListenerContainer.class);
ChannelAwareMessageListener listener = TestUtils.getPropertyValue(mlc, "messageListener", ChannelAwareMessageListener.class);
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setClusterId("test.clusterId");
amqpProperties.setContentEncoding("test.contentEncoding");
amqpProperties.setContentLength(99L);
amqpProperties.setContentType("test.contentType");
amqpProperties.setHeader("foo", "foo");
amqpProperties.setHeader("bar", "bar");
Message amqpMessage = new Message("hello".getBytes(), amqpProperties);
listener.onMessage(amqpMessage, null);
QueueChannel requestChannel = context.getBean("requestChannel", QueueChannel.class);
org.springframework.messaging.Message<?> siMessage = requestChannel.receive(0);
assertNull(siMessage.getHeaders().get("foo"));
assertNull(siMessage.getHeaders().get("bar"));
assertNull(siMessage.getHeaders().get(AmqpHeaders.CONTENT_ENCODING));
assertNull(siMessage.getHeaders().get(AmqpHeaders.CLUSTER_ID));
assertNull(siMessage.getHeaders().get(AmqpHeaders.APP_ID));
assertNull(siMessage.getHeaders().get(AmqpHeaders.CONTENT_TYPE));
}
use of org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter in project spring-integration by spring-projects.
the class AmqpInboundChannelAdapterParserTests method withHeaderMapperDefaultMapping.
@Test
public void withHeaderMapperDefaultMapping() throws Exception {
AmqpInboundChannelAdapter adapter = context.getBean("withHeaderMapperDefaultMapping", AmqpInboundChannelAdapter.class);
AbstractMessageListenerContainer mlc = TestUtils.getPropertyValue(adapter, "messageListenerContainer", AbstractMessageListenerContainer.class);
ChannelAwareMessageListener listener = TestUtils.getPropertyValue(mlc, "messageListener", ChannelAwareMessageListener.class);
MessageProperties amqpProperties = new MessageProperties();
amqpProperties.setAppId("test.appId");
amqpProperties.setClusterId("test.clusterId");
amqpProperties.setContentEncoding("test.contentEncoding");
amqpProperties.setContentLength(99L);
amqpProperties.setContentType("test.contentType");
amqpProperties.setHeader("foo", "foo");
amqpProperties.setHeader("bar", "bar");
Message amqpMessage = new Message("hello".getBytes(), amqpProperties);
listener.onMessage(amqpMessage, null);
QueueChannel requestChannel = context.getBean("requestChannel", QueueChannel.class);
org.springframework.messaging.Message<?> siMessage = requestChannel.receive(0);
assertNotNull(siMessage.getHeaders().get("bar"));
assertNotNull(siMessage.getHeaders().get("foo"));
assertNotNull(siMessage.getHeaders().get(AmqpHeaders.CONTENT_ENCODING));
assertNotNull(siMessage.getHeaders().get(AmqpHeaders.CLUSTER_ID));
assertNotNull(siMessage.getHeaders().get(AmqpHeaders.APP_ID));
assertNotNull(siMessage.getHeaders().get(AmqpHeaders.CONTENT_TYPE));
}
Aggregations