@Test
public void testCheckMessagingConnectionWithAgent_success() throws Exception {

	ManagedApplication ma = new ManagedApplication( this.app );
	this.managerWrapper.addManagedApplication( ma );
	Assert.assertEquals( 0, this.msgClient.allSentMessages.size());
	UUID uuid = UUID.randomUUID();
	String path = "/" + this.app.getMySqlVm().getName();
	InstanceStatus[] statuses = new InstanceStatus[] {
			InstanceStatus.DEPLOYED_STARTED,
			InstanceStatus.DEPLOYED_STOPPED,
			InstanceStatus.PROBLEM,
			InstanceStatus.DEPLOYING
	};
	for( InstanceStatus status : statuses ) {
		this.app.getMySqlVm().setStatus( status );
		Response resp = this.resource.checkMessagingConnectionWithAgent( this.app.getName(), path, uuid.toString());
		Assert.assertEquals( status.toString(), Status.OK.getStatusCode(), resp.getStatus());
		Assert.assertEquals( status.toString(), 1, this.msgClient.allSentMessages.size());
		Message msg = this.msgClient.allSentMessages.get( 0 );
		Assert.assertEquals( status.toString(), MsgEcho.class, msg.getClass());
		Assert.assertEquals( status.toString(), "PING:" + uuid.toString(), ((MsgEcho) msg).getContent());
		this.msgClient.allSentMessages.clear();
	}
}