use of org.springframework.integration.IntegrationMessageHeaderAccessor in project spring-integration by spring-projects.
the class HeaderEnricherOverwriteTests method priorityExplicitOverwriteFalse.
@Test
public void priorityExplicitOverwriteFalse() {
MessageChannel input = context.getBean("priorityExplicitOverwriteFalseInput", MessageChannel.class);
QueueChannel replyChannel = new QueueChannel();
Message<?> message = MessageBuilder.withPayload("test").setReplyChannel(replyChannel).setPriority(77).build();
input.send(message);
Message<?> result = replyChannel.receive(0);
assertNotNull(result);
assertEquals(new Integer(77), new IntegrationMessageHeaderAccessor(result).getPriority());
}
use of org.springframework.integration.IntegrationMessageHeaderAccessor in project spring-integration by spring-projects.
the class HeaderEnricherTests method testRoutingSlip.
@Test
public void testRoutingSlip() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("routingSlipInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
Object routingSlip = new IntegrationMessageHeaderAccessor(result).getHeader(IntegrationMessageHeaderAccessor.ROUTING_SLIP);
assertNotNull(routingSlip);
assertThat(routingSlip, instanceOf(Map.class));
@SuppressWarnings("unchecked") List<Object> routingSlipPath = (List<Object>) ((Map<?, ?>) routingSlip).keySet().iterator().next();
assertEquals("fooChannel", routingSlipPath.get(0));
assertThat(routingSlipPath.get(1), instanceOf(ExpressionEvaluatingRoutingSlipRouteStrategy.class));
assertEquals("bazRoutingSlip", routingSlipPath.get(2));
}
use of org.springframework.integration.IntegrationMessageHeaderAccessor in project spring-integration by spring-projects.
the class HeaderEnricherTests method correlationIdValueWithType.
@Test
public void correlationIdValueWithType() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("correlationIdValueWithTypeInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
Object correlationId = new IntegrationMessageHeaderAccessor(result).getCorrelationId();
assertEquals(Long.class, correlationId.getClass());
assertEquals(123L, correlationId);
}
use of org.springframework.integration.IntegrationMessageHeaderAccessor in project spring-integration by spring-projects.
the class HeaderEnricherTests method correlationIdRef.
@Test
public void correlationIdRef() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("correlationIdRefInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(123, new IntegrationMessageHeaderAccessor(result).getCorrelationId());
}
use of org.springframework.integration.IntegrationMessageHeaderAccessor in project spring-integration by spring-projects.
the class HeaderEnricherTests method priorityExpression.
@Test
public void priorityExpression() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("priorityExpressionInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<Map<String, String>>(Collections.singletonMap("priority", "-10")));
assertNotNull(result);
assertEquals(new Integer(-10), new IntegrationMessageHeaderAccessor(result).getPriority());
}
Aggregations