@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 (;))")); 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 (;))")); }
public String validate() { String result = null; if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty()) result = "The message configuration cannot be null or empty."; else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null) result = "The message configuration does not contain the messaging type."; else if( Utils.isEmptyOrWhitespaces( this.applicationName )) result = "The application name cannot be null or empty."; else if( Utils.isEmptyOrWhitespaces( this.scopedInstancePath )) result = "The scoped instance's path cannot be null or empty."; return result; }
AgentProperties { public String validate() { String result = null; if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty()) result = "The message configuration cannot be null or empty."; else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null) result = "The message configuration does not contain the messaging type."; else if( Utils.isEmptyOrWhitespaces( this.applicationName )) result = "The application name cannot be null or empty."; else if( Utils.isEmptyOrWhitespaces( this.scopedInstancePath )) result = "The scoped instance's path cannot be null or empty."; return result; } }
AgentProperties { public String validate() { String result = null; if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty()) result = "The message configuration cannot be null or empty."; else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null) result = "The message configuration does not contain the messaging type."; else if( Utils.isEmptyOrWhitespaces( this.applicationName )) result = "The application name cannot be null or empty."; else if( Utils.isEmptyOrWhitespaces( this.scopedInstancePath )) result = "The scoped instance's path cannot be null or empty."; return result; } AgentProperties(); }
AgentProperties { public String validate() { String result = null; if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty()) result = "The message configuration cannot be null or empty."; else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null) result = "The message configuration does not contain the messaging type."; else if( Utils.isEmptyOrWhitespaces( this.applicationName )) result = "The application name cannot be null or empty."; else if( Utils.isEmptyOrWhitespaces( this.scopedInstancePath )) result = "The scoped instance's path cannot be null or empty."; return result; } AgentProperties(); String getApplicationName(); void setApplicationName( String applicationName ); String getDomain(); void setDomain( String domain ); String getScopedInstancePath(); void setScopedInstancePath( String scopedInstancePath ); String getIpAddress(); void setIpAddress( String ipAddress ); Map<String, String> getMessagingConfiguration(); void setMessagingConfiguration( Map<String, String> messagingConfiguration ); String validate(); static AgentProperties readIaasProperties( String rawProperties, Logger logger ); static AgentProperties readIaasProperties( Properties props ); }
AgentProperties { public String validate() { String result = null; if( this.messagingConfiguration == null || this.messagingConfiguration.isEmpty()) result = "The message configuration cannot be null or empty."; else if( this.messagingConfiguration.get(MessagingConstants.MESSAGING_TYPE_PROPERTY) == null) result = "The message configuration does not contain the messaging type."; else if( Utils.isEmptyOrWhitespaces( this.applicationName )) result = "The application name cannot be null or empty."; else if( Utils.isEmptyOrWhitespaces( this.scopedInstancePath )) result = "The scoped instance's path cannot be null or empty."; return result; } AgentProperties(); String getApplicationName(); void setApplicationName( String applicationName ); String getDomain(); void setDomain( String domain ); String getScopedInstancePath(); void setScopedInstancePath( String scopedInstancePath ); String getIpAddress(); void setIpAddress( String ipAddress ); Map<String, String> getMessagingConfiguration(); void setMessagingConfiguration( Map<String, String> messagingConfiguration ); String validate(); static AgentProperties readIaasProperties( String rawProperties, Logger logger ); static AgentProperties readIaasProperties( Properties props );  }