PropertiesFileConfigurationProvider extends
    AbstractFileConfigurationProvider { @Override protected void load() { File propertiesFile = getFile(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(propertiesFile)); Properties properties = new Properties(); properties.load(reader); NodeConfiguration conf = new SimpleNodeConfiguration(); FlumeConfiguration fconfig = new FlumeConfiguration(properties); AgentConfiguration agentConf = fconfig.getConfigurationFor(getNodeName()); if (agentConf != null) { getConfigurationAware().stopAllComponents(); loadChannels(agentConf, conf); loadSources(agentConf, conf); loadSinks(agentConf, conf); getConfigurationAware().startAllComponents(conf); } else { LOGGER.warn("No configuration found for this host:{}", getNodeName()); } } catch (IOException ex) { LOGGER.error("Unable to load file:" + propertiesFile + " (I/O failure) - Exception follows.", ex); } catch (InstantiationException ex) { LOGGER.error("Unable to load file:" + propertiesFile + " (failed to instantiate component) - Exception follows.", ex); } finally { if (reader != null) { try { reader.close(); } catch (IOException ex) { LOGGER.warn( "Unable to close file reader for file: " + propertiesFile, ex); } } } }    }
@Test public void testPropertyRead() throws Exception { PropertiesFileConfigurationProvider provider = new PropertiesFileConfigurationProvider(); provider.setNodeName("host1"); provider.setConfigurationAware(new DummyNodeConfigurationAware()); provider.setChannelFactory(new DefaultChannelFactory()); provider.setSourceFactory(new DefaultSourceFactory()); provider.setSinkFactory(new DefaultSinkFactory()); provider.setFile(TESTFILE); provider.load(); }