if (variant.equals(ConfigVariant.SERVICE))
{
//((Lifecycle)getFlowConstruct("RollbackTransactionAndSendEmail")).stop(); is not working as expected
return;
}
FixedPortGreenMailSupport greenMailSupport = new FixedPortGreenMailSupport(dynamicPort2.getNumber());
List<Integer> ports = new ArrayList<Integer>(6);
ports.add(dynamicPort1.getNumber());
ports.add(dynamicPort2.getNumber());
ports.add(dynamicPort3.getNumber());
ports.add(dynamicPort4.getNumber());
ports.add(dynamicPort5.getNumber());
ports.add(dynamicPort6.getNumber());
greenMailSupport.startServers(ports);
LocalMuleClient client = muleContext.getClient();
client.dispatch("jms://in6?connector=jmsConnectorNoRedelivery", MESSAGE_TO_SEND, null);
endMessageProcessorExecuted.await(TIMEOUT, TimeUnit.MILLISECONDS);
((Lifecycle) getFlowConstruct("RollbackTransactionAndSendEmail")).stop();
MuleMessage response = client.request("jms://in6?connector=jmsConnectorNoRedelivery", TIMEOUT);
assertThat(response, IsNull.<Object>notNullValue());
assertThat(response.getPayloadAsString(), is(MESSAGE_TO_SEND));
greenMailSupport.getServers().waitForIncomingEmail(AbstractEmailFunctionalTestCase.DELIVERY_DELAY_MS, 1);
MimeMessage[] messages = greenMailSupport.getServers().getReceivedMessages();
assertNotNull("did not receive any messages", messages);
assertEquals("did not receive 1 mail", 1, messages.length);
}