}
@Test
public void testLifecycle() throws Exception
{
FlowConstruct flowA = getFlowConstruct("flowA");
FlowConstruct flowB = getFlowConstruct("flowB");
TemplateMessagingExceptionStrategy flowAExceptionStrategy = (TemplateMessagingExceptionStrategy) flowA.getExceptionListener();
TemplateMessagingExceptionStrategy flowBExceptionStrategy = (TemplateMessagingExceptionStrategy) flowB.getExceptionListener();
LifecycleCheckerMessageProcessor lifecycleCheckerMessageProcessorFlowA = (LifecycleCheckerMessageProcessor) flowAExceptionStrategy.getMessageProcessors().get(0);
LifecycleCheckerMessageProcessor lifecycleCheckerMessageProcessorFlowB = (LifecycleCheckerMessageProcessor) flowBExceptionStrategy.getMessageProcessors().get(0);
assertThat(lifecycleCheckerMessageProcessorFlowA.isInitialized(), is(true));
assertThat(lifecycleCheckerMessageProcessorFlowB.isInitialized(), is(true));
assertThat(flowAExceptionStrategy.isInitialised(), is(true));
assertThat(flowBExceptionStrategy.isInitialised(), is(true));
((Lifecycle)flowA).stop();
assertThat(lifecycleCheckerMessageProcessorFlowA.isStopped(),is(true));
assertThat(lifecycleCheckerMessageProcessorFlowB.isStopped(),is(false));
FlowConstruct flowC = getFlowConstruct("flowC");
FlowConstruct flowD = getFlowConstruct("flowD");
TemplateMessagingExceptionStrategy flowCExceptionStrategy = (TemplateMessagingExceptionStrategy) flowC.getExceptionListener();
TemplateMessagingExceptionStrategy flowDExceptionStrategy = (TemplateMessagingExceptionStrategy) flowD.getExceptionListener();
LifecycleCheckerMessageProcessor lifecycleCheckerMessageProcessorFlowC = (LifecycleCheckerMessageProcessor) flowCExceptionStrategy.getMessageProcessors().get(0);
LifecycleCheckerMessageProcessor lifecycleCheckerMessageProcessorFlowD = (LifecycleCheckerMessageProcessor) flowDExceptionStrategy.getMessageProcessors().get(0);
assertThat(lifecycleCheckerMessageProcessorFlowC.isInitialized(), is(true));
assertThat(lifecycleCheckerMessageProcessorFlowD.isInitialized(), is(true));
assertThat(flowCExceptionStrategy.isInitialised(), is(true));