static void loadHadoopClustersProps ( String filename ) { // read the property file // populate the map Properties prop = new Properties ( ) ; if ( StringUtils . isBlank ( filename ) ) { filename = Constants . HRAVEN_CLUSTER_PROPERTIES_FILENAME ; } try { //TODO : property file to be moved out from resources into config dir InputStream inp = Cluster . class . getResourceAsStream ( "/" + filename ) ; if ( inp == null ) { LOG . error ( filename + " for mapping clusters to cluster identifiers in hRaven does not exist" ) ; return ; } prop . load ( inp ) ; Set < String > hostnames = prop . stringPropertyNames ( ) ; for ( String h : hostnames ) { CLUSTERS_BY_HOST . put ( h , prop . getProperty ( h ) ) ; } } catch ( IOException e ) { // An ExceptionInInitializerError will be thrown to indicate that an // exception occurred during evaluation of a static initializer or the // initializer for a static variable. throw new ExceptionInInitializerError ( " Could not load properties file " + filename + " for mapping clusters to cluster identifiers in hRaven" ) ; } }
testing with different properties file names