@Test
public void testValidate() {

	AgentProperties ad = new AgentProperties();
	ad.setApplicationName( "my app" );
	ad.setScopedInstancePath( "/root" );
	ad.setDomain( "d1" );
	ad.setIpAddress( "whatever" );
	Assert.assertNotNull( ad.validate());
	ad.setMessagingConfiguration( new HashMap<String,String>( 0 ));
	Assert.assertNotNull( ad.validate());
	ad.setMessagingConfiguration(rabbitMqMessagingConfiguration("192.168.1.18", "personne", "azerty (;))"));
	Assert.assertNull( ad.validate());
	ad.setIpAddress( null );
	Assert.assertNull( ad.validate());
	ad.setApplicationName( null );
	Assert.assertNotNull( ad.validate());
	ad.setApplicationName( "my app" );
	ad.setScopedInstancePath( "" );
	Assert.assertNotNull( ad.validate());
	ad.setScopedInstancePath( "root" );
	ad.setMessagingConfiguration(rabbitMqMessagingConfiguration(null, "personne", "azerty (;))"));
	Assert.assertNull(ad.validate());
	ad.setMessagingConfiguration(rabbitMqMessagingConfiguration("192.168.1.18", "personne", "azerty (;))"));
	ad.setMessagingConfiguration(rabbitMqMessagingConfiguration("192.168.1.18", "personne", "   "));
	Assert.assertNull(ad.validate());
	ad.setMessagingConfiguration(rabbitMqMessagingConfiguration("192.168.1.18", "personne", "azerty (;))"));
	ad.setMessagingConfiguration(rabbitMqMessagingConfiguration("192.168.1.18", "", "azerty (;))"));
	Assert.assertNull(ad.validate());
	ad.setMessagingConfiguration(rabbitMqMessagingConfiguration("192.168.1.18", "personne", "azerty (;))"));
	// Test with no factory type.
	final Map<String, String> msgCfg = new LinkedHashMap<>(rabbitMqMessagingConfiguration("192.168.1.18", "personne", "azerty (;))"));
	msgCfg.remove(MessagingConstants.MESSAGING_TYPE_PROPERTY);
	ad.setMessagingConfiguration(msgCfg);
	Assert.assertNotNull( ad.validate());
	ad.setMessagingConfiguration(rabbitMqMessagingConfiguration("192.168.1.18", "personne", "azerty (;))"));
}