public void testOutboundRouterConfig2()
{
// test outbound message router
Service service = muleContext.getRegistry().lookupService("appleComponent");
assertNotNull(service.getOutboundMessageProcessor());
OutboundRouterCollection router = (OutboundRouterCollection) service.getOutboundMessageProcessor();
assertNotNull(router.getCatchAllStrategy());
assertEquals(2, router.getRoutes().size());
// check first Router
OutboundRouter route1 = (OutboundRouter) router.getRoutes().get(0);
assertTrue(route1 instanceof FilteringOutboundRouter);
assertEquals(1, route1.getRoutes().size());
ImmutableEndpoint ep = (ImmutableEndpoint) route1.getRoutes().get(0);
assertNotNull(ep.getTransformers());
assertTrue(TransformerUtils.firstOrNull(ep.getTransformers()) instanceof TestCompressionTransformer);
Filter filter = ((FilteringOutboundRouter) route1).getFilter();
assertNotNull(filter);
assertTrue(filter instanceof PayloadTypeFilter);
assertEquals(String.class, ((PayloadTypeFilter) filter).getExpectedType());
// check second Router
OutboundRouter route2 = (OutboundRouter) router.getRoutes().get(1);
assertTrue(route2 instanceof FilteringOutboundRouter);
Filter filter2 = ((FilteringOutboundRouter) route2).getFilter();
assertNotNull(filter2);
assertTrue(filter2 instanceof AndFilter);
assertEquals(2, ((AndFilter) filter2).getFilters().size());
Filter left = ((AndFilter) filter2).getFilters().get(0);
Filter right = ((AndFilter) filter2).getFilters().get(1);
assertNotNull(left);
assertTrue(left instanceof RegExFilter);
assertEquals("the quick brown (.*)", ((RegExFilter) left).getPattern());
assertNotNull(right);
assertTrue(right instanceof RegExFilter);
assertEquals("(.*) brown (.*)", ((RegExFilter) right).getPattern());
assertTrue(router.getCatchAllStrategy() instanceof TestCatchAllStrategy);
}