@Test public void testReconfigureMessaging_noKarafEtc_noMessagingTypeSpecified() throws IOException { this.userDataHelper.reconfigureMessaging( "this_is_a_wrong_path", new HashMap<String,String>( 0 )); }
public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } }
UserDataHelper { public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } } }
UserDataHelper { public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } }  }
UserDataHelper { public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } }  AgentProperties findParametersForAmazonOrOpenStack( Logger logger ); AgentProperties findParametersForAzure( Logger logger ); AgentProperties findParametersForVmware( Logger logger ); AgentProperties findParametersFromUrl( String url, Logger logger ); void reconfigureMessaging( String etcDir, Map<String,String> msgData ); }
UserDataHelper { public void reconfigureMessaging( String etcDir, Map<String,String> msgData ) throws IOException { String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType ); if( ! Utils.isEmptyOrWhitespaces( etcDir ) && ! Utils.isEmptyOrWhitespaces( messagingType )) { File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" ); Logger logger = Logger.getLogger( getClass().getName()); Properties props = Utils.readPropertiesFileQuietly( f, logger ); props.putAll( msgData ); props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY ); Utils.writePropertiesFile( props, f ); f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT ); props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName())); if( messagingType != null ) { props.put( Constants.MESSAGING_TYPE, messagingType ); Utils.writePropertiesFile( props, f ); } } }  AgentProperties findParametersForAmazonOrOpenStack( Logger logger ); AgentProperties findParametersForAzure( Logger logger ); AgentProperties findParametersForVmware( Logger logger ); AgentProperties findParametersFromUrl( String url, Logger logger ); void reconfigureMessaging( String etcDir, Map<String,String> msgData );  }