public void testFlowAndServiceUseProperExceptionStrategy()
{
Set<MessagingExceptionHandler> usedExceptionStrategies = new HashSet<MessagingExceptionHandler>();
Service serviceNoExceptionStrategy = muleContext.getRegistry().lookupService("serviceNoExceptionStrategy");
MessagingExceptionHandler serviceNoExceptionStrategyExceptionListener = serviceNoExceptionStrategy.getExceptionListener();
assertThat(serviceNoExceptionStrategyExceptionListener, instanceOf(CatchMessagingExceptionStrategy.class));
usedExceptionStrategies.add(serviceNoExceptionStrategyExceptionListener);
Service serviceExceptionStrategy = muleContext.getRegistry().lookupService("serviceExceptionStrategy");
MessagingExceptionHandler serviceExceptionStrategyExceptionListener = serviceExceptionStrategy.getExceptionListener();
assertThat(serviceExceptionStrategyExceptionListener, instanceOf(DefaultMessagingExceptionStrategy.class));
assertThat(usedExceptionStrategies.add(serviceExceptionStrategyExceptionListener), is(true));
Service serviceNoExceptionStrategyInModel = muleContext.getRegistry().lookupService("serviceNoExceptionStrategyInModel");
MessagingExceptionHandler serviceNoExceptionStrategyInModelExceptionListener = serviceNoExceptionStrategyInModel.getExceptionListener();
assertThat(serviceNoExceptionStrategyInModelExceptionListener, instanceOf(CustomExceptionStrategy.class));
assertThat(usedExceptionStrategies.add(serviceNoExceptionStrategyInModelExceptionListener),is(true));
FlowConstruct flowNoExceptionStrategy = muleContext.getRegistry().lookupFlowConstruct("flowNoExceptionStrategy");
MessagingExceptionHandler flowNoExceptionStrategyExceptionListener = flowNoExceptionStrategy.getExceptionListener();
assertThat(flowNoExceptionStrategyExceptionListener, instanceOf(CustomExceptionStrategy.class));
assertThat(usedExceptionStrategies.add(flowNoExceptionStrategyExceptionListener),is(true));
FlowConstruct flowExceptionStrategy = muleContext.getRegistry().lookupFlowConstruct("flowExceptionStrategy");
MessagingExceptionHandler flowExceptionStrategyExceptionListener = flowExceptionStrategy.getExceptionListener();
assertThat(flowExceptionStrategyExceptionListener, instanceOf(CatchMessagingExceptionStrategy.class));
assertThat(usedExceptionStrategies.add(flowExceptionStrategyExceptionListener),is(true));
}