assertNotNull(serviceFlow);
OutboundRouterCollection outboundRouter = (OutboundRouterCollection) ((Service) serviceFlow).getOutboundMessageProcessor();
assertNotNull(outboundRouter);
assertEquals(2, outboundRouter.getRoutes().size());
// first Router
OutboundRouter router1 = (OutboundRouter) outboundRouter.getRoutes().get(0);
assertEquals(1, router1.getRoutes().size());
ImmutableEndpoint endpoint = (ImmutableEndpoint) router1.getRoutes().get(0);
assertEquals("tcp", endpoint.getConnector().getProtocol().toLowerCase());
assertEquals("tcp://localhost:60201", endpoint.getEndpointURI().getAddress());
assertTrue(endpoint instanceof OutboundEndpoint);
// second Router
OutboundRouter router2 = (OutboundRouter) outboundRouter.getRoutes().get(1);
assertEquals(2, router2.getRoutes().size());
endpoint = (ImmutableEndpoint) router2.getRoutes().get(0);
assertEquals("udp", endpoint.getConnector().getProtocol().toLowerCase());
assertEquals("udp://localhost:56731", endpoint.getEndpointURI().getAddress());
assertTrue(endpoint instanceof OutboundEndpoint);
endpoint = (ImmutableEndpoint) router2.getRoutes().get(1);
assertEquals("test", endpoint.getConnector().getProtocol().toLowerCase());
assertEquals("test.queue2", endpoint.getEndpointURI().getAddress());
assertTrue(endpoint instanceof OutboundEndpoint);
}
else if (serviceFlow instanceof Flow)
{
assertNotNull(serviceFlow);
List<MessageProcessor> messageProcessors = ((Flow) serviceFlow).getMessageProcessors();
assertNotNull(messageProcessors);
assertEquals(2, messageProcessors.size());
// <all> Router
OutboundRouter allRouter = (OutboundRouter) messageProcessors.get(1);
assertEquals(3, allRouter.getRoutes().size());
ImmutableEndpoint endpoint = (ImmutableEndpoint) allRouter.getRoutes().get(0);
assertEquals("tcp", endpoint.getConnector().getProtocol().toLowerCase());
assertEquals("tcp://localhost:60201", endpoint.getEndpointURI().getAddress());
assertTrue(endpoint instanceof OutboundEndpoint);
endpoint = (ImmutableEndpoint) allRouter.getRoutes().get(1);
assertEquals("udp", endpoint.getConnector().getProtocol().toLowerCase());
assertEquals("udp://localhost:56731", endpoint.getEndpointURI().getAddress());
assertTrue(endpoint instanceof OutboundEndpoint);
endpoint = (ImmutableEndpoint) allRouter.getRoutes().get(2);
assertEquals("test", endpoint.getConnector().getProtocol().toLowerCase());
assertEquals("test.queue2", endpoint.getEndpointURI().getAddress());
assertTrue(endpoint instanceof OutboundEndpoint);
}