use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class EnricherParserTests3 method testSourceBeanResolver.
@Test
public void testSourceBeanResolver() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(this.getClass().getSimpleName() + "-context.xml", this.getClass());
MessageChannel beanResolveIn = context.getBean("beanResolveIn", MessageChannel.class);
PollableChannel beanResolveOut = context.getBean("beanResolveOut", PollableChannel.class);
SomeBean payload = new SomeBean("foo");
assertEquals("foo", payload.getNested().getValue());
beanResolveIn.send(new GenericMessage<SomeBean>(payload));
@SuppressWarnings("unchecked") Message<SomeBean> out = (Message<SomeBean>) beanResolveOut.receive();
assertSame(payload, out.getPayload());
assertEquals("bar", out.getPayload().getNested().getValue());
context.close();
}
use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class ControlBusRecipientListRouterTests method testAddRecipientWithNullExpression.
@Test
public void testAddRecipientWithNullExpression() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.addRecipient('channel3')");
Message<?> message = new GenericMessage<Integer>(1);
channel.send(message);
PollableChannel chanel3 = (PollableChannel) context.getBean("channel3");
assertTrue(chanel3.receive(0).getPayload().equals(1));
}
use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class ControlBusRecipientListRouterTests method testGetRecipients.
@Test
@SuppressWarnings("unchecked")
public void testGetRecipients() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.addRecipient('channel1')");
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.getRecipients()");
PollableChannel channel1 = (PollableChannel) context.getBean("channel1");
Message<?> result = this.output.receive(0);
Collection<Recipient> mappings = (Collection<Recipient>) result.getPayload();
assertEquals(channel1, mappings.iterator().next().getChannel());
}
use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class ControlBusRecipientListRouterTests method testRemoveRecipient.
@Test
public void testRemoveRecipient() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.addRecipient('channel1')");
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.addRecipient('channel4')");
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.removeRecipient('channel4')");
Message<?> message = new GenericMessage<Integer>(1);
channel.send(message);
PollableChannel chanel1 = (PollableChannel) context.getBean("channel1");
PollableChannel chanel4 = (PollableChannel) context.getBean("channel4");
assertTrue(chanel1.receive(0).getPayload().equals(1));
assertNull(chanel4.receive(0));
}
use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class ControlBusRecipientListRouterTests method testReplaceRecipients.
@Test
public void testReplaceRecipients() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
messagingTemplate.setReceiveTimeout(1000);
messagingTemplate.convertAndSend(input, "@'simpleRouter.handler'.replaceRecipients('channel7=true')");
Message<?> message = new GenericMessage<Integer>(1);
channel.send(message);
PollableChannel chanel7 = (PollableChannel) context.getBean("channel7");
assertTrue(chanel7.receive(0).getPayload().equals(1));
}
Aggregations