use of org.springframework.integration.channel.TestChannelResolver in project spring-integration by spring-projects.
the class MethodInvokingRouterTests method multiChannelListResolutionByMessageConfiguredByMethodName.
@Test
public void multiChannelListResolutionByMessageConfiguredByMethodName() {
TestChannelResolver channelResolver = new TestChannelResolver();
MultiChannelInstanceRoutingTestBean testBean = new MultiChannelInstanceRoutingTestBean(channelResolver);
MethodInvokingRouter router = new MethodInvokingRouter(testBean, "routeMessage");
this.doTestMultiChannelListResolutionByMessage(router, channelResolver);
}
use of org.springframework.integration.channel.TestChannelResolver in project spring-integration by spring-projects.
the class MethodInvokingRouterTests method multiChannelNameResolutionByMessageConfiguredByMethodReference.
@Test
public void multiChannelNameResolutionByMessageConfiguredByMethodReference() throws Exception {
TestChannelResolver channelResolver = new TestChannelResolver();
MultiChannelNameRoutingTestBean testBean = new MultiChannelNameRoutingTestBean();
Method routingMethod = testBean.getClass().getMethod("routeMessage", Message.class);
MethodInvokingRouter router = new MethodInvokingRouter(testBean, routingMethod);
this.doTestMultiChannelNameResolutionByMessage(router, channelResolver);
}
use of org.springframework.integration.channel.TestChannelResolver in project spring-integration by spring-projects.
the class MethodInvokingRouterTests method channelInstanceResolutionByMessageConfiguredByMethodName.
@Test
public void channelInstanceResolutionByMessageConfiguredByMethodName() {
TestChannelResolver channelResolver = new TestChannelResolver();
SingleChannelInstanceRoutingTestBean testBean = new SingleChannelInstanceRoutingTestBean(channelResolver);
MethodInvokingRouter router = new MethodInvokingRouter(testBean, "routeMessage");
this.doTestChannelInstanceResolutionByMessage(router, channelResolver);
}
use of org.springframework.integration.channel.TestChannelResolver in project spring-integration by spring-projects.
the class MethodInvokingRouterTests method multiChannelNameResolutionByPayloadConfiguredByMethodReference.
@Test
public void multiChannelNameResolutionByPayloadConfiguredByMethodReference() throws Exception {
TestChannelResolver channelResolver = new TestChannelResolver();
MultiChannelNameRoutingTestBean testBean = new MultiChannelNameRoutingTestBean();
Method routingMethod = testBean.getClass().getMethod("routePayload", String.class);
MethodInvokingRouter router = new MethodInvokingRouter(testBean, routingMethod);
this.doTestMultiChannelNameResolutionByPayload(router, channelResolver);
}
use of org.springframework.integration.channel.TestChannelResolver in project spring-integration by spring-projects.
the class MethodInvokingRouterTests method channelNameResolutionByHeader.
@Test
public void channelNameResolutionByHeader() throws Exception {
QueueChannel fooChannel = new QueueChannel();
QueueChannel barChannel = new QueueChannel();
TestChannelResolver channelResolver = new TestChannelResolver();
channelResolver.addChannel("foo-channel", fooChannel);
channelResolver.addChannel("bar-channel", barChannel);
SingleChannelNameRoutingTestBean testBean = new SingleChannelNameRoutingTestBean();
Method routingMethod = testBean.getClass().getMethod("routeByHeader", String.class);
MethodInvokingRouter router = new MethodInvokingRouter(testBean, routingMethod);
router.setChannelResolver(channelResolver);
Message<String> message = MessageBuilder.withPayload("bar").setHeader("targetChannel", "foo").build();
router.handleMessage(message);
Message<?> fooReply = fooChannel.receive(0);
Message<?> barReply = barChannel.receive(0);
assertNotNull(fooReply);
assertNull(barReply);
assertEquals(message, fooReply);
}
Aggregations