@Test
public void testMsgNotifHeartbeat_mustSendStoredMessages() throws Exception {

	this.managerWrapper.configureMessagingForTest();
	this.manager.reconfigure();
	TestClient msgClient = (TestClient) this.managerWrapper.getInternalMessagingClient();
	ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( this.app.getName());
	Assert.assertNotNull( ma );
	Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, this.app.getMySqlVm().getStatus());
	Assert.assertNull( ma.getScopedInstanceToAwaitingMessages().get( this.app.getMySqlVm()));
	Assert.assertEquals( 0, msgClient.allSentMessages.size());
	// Store messages
	this.manager.messagingMngr().sendMessageSafely( ma, this.app.getMySqlVm(), new MsgCmdGatherLogs());
	this.manager.messagingMngr().sendMessageSafely( ma, this.app.getMySqlVm(), new MsgCmdGatherLogs());
	this.manager.messagingMngr().sendMessageSafely( ma, this.app.getMySqlVm(), new MsgCmdGatherLogs());
	Assert.assertEquals( 3, ma.getScopedInstanceToAwaitingMessages().get( this.app.getMySqlVm()).size());
	Assert.assertEquals( 0, msgClient.allSentMessages.size());
	// The ACK should send them
	MsgNotifHeartbeat msg = new MsgNotifHeartbeat( this.app.getName(), this.app.getMySqlVm(), "192.168.1.45" );
	this.processor.processMessage( msg );
	Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, this.app.getMySqlVm().getStatus());
	Assert.assertNull( ma.getScopedInstanceToAwaitingMessages().get( this.app.getMySqlVm()));
	Assert.assertEquals( 3, msgClient.allSentMessages.size());
}