use of org.springframework.integration.core.MessagingTemplate 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.core.MessagingTemplate 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());
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class ControlBusRecipientListRouterTests method testRemoveRecipientWithExpression.
@Test
public void testRemoveRecipientWithExpression() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.addRecipient('channel1','true')");
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.addRecipient('channel5','true')");
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.removeRecipient('channel5','true')");
Message<?> message = new GenericMessage<Integer>(1);
channel.send(message);
PollableChannel chanel1 = (PollableChannel) context.getBean("channel1");
PollableChannel chanel5 = (PollableChannel) context.getBean("channel5");
assertTrue(chanel1.receive(0).getPayload().equals(1));
assertNull(chanel5.receive(0));
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class ControlBusRecipientListRouterTests method testSetRecipients.
@Test
public void testSetRecipients() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
Map<String, String> map = new HashMap<String, String>();
map.put("channel6", "true");
Message<?> message = MessageBuilder.withPayload("@'simpleRouter.handler'.setRecipientMappings(headers.recipientMap)").setHeader("recipientMap", map).build();
this.input.send(message);
message = new GenericMessage<Integer>(1);
channel.send(message);
PollableChannel chanel6 = (PollableChannel) context.getBean("channel6");
assertTrue(chanel6.receive(0).getPayload().equals(1));
}
use of org.springframework.integration.core.MessagingTemplate in project spring-integration by spring-projects.
the class ControlBusRecipientListRouterTests method testAddRecipient.
@Test
public void testAddRecipient() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.addRecipient('channel2','true')");
Message<?> message = new GenericMessage<Integer>(1);
channel.send(message);
PollableChannel chanel2 = (PollableChannel) context.getBean("channel2");
assertTrue(chanel2.receive(0).getPayload().equals(1));
}
Aggregations