use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class HeaderEnricherTests method innerBean.
@Test
public void innerBean() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("innerBean", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(TestBean.class, result.getHeaders().get("testHeader").getClass());
TestBean testBeanForInnerBean = new TestBean("testBeanForInnerBean");
assertEquals(testBeanForInnerBean, result.getHeaders().get("testHeader"));
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class HeaderEnricherTests method expirationDateRef.
@Test
public void expirationDateRef() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("expirationDateRefInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(new Long(9999), new IntegrationMessageHeaderAccessor(result).getExpirationDate());
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class HeaderEnricherTests method expressionWithDateType.
@Test
public void expressionWithDateType() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("expressionWithDateTypeInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
Object headerValue = result.getHeaders().get("currentDate");
assertEquals(Date.class, headerValue.getClass());
Date date = (Date) headerValue;
assertTrue(new Date().getTime() - date.getTime() < 1000);
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class HeaderEnricherTests method expirationDateValue.
@Test
public void expirationDateValue() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("expirationDateValueInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(new Long(1111), new IntegrationMessageHeaderAccessor(result).getExpirationDate());
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class HeaderEnricherTests method expressionUsingPayload.
@Test
public void expressionUsingPayload() {
MessagingTemplate template = new MessagingTemplate();
MessageChannel channel = context.getBean("payloadExpressionInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<TestBean>(new TestBean("foo")));
assertNotNull(result);
assertEquals("foobar", result.getHeaders().get("testHeader"));
}
Aggregations