@Override
    public FlumeConfiguration getFlumeConfiguration() {
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(file));
            String resolverClassName = System.getProperty("propertiesImplementation",
                    DEFAULT_PROPERTIES_IMPLEMENTATION);
            Class<? extends Properties> propsclass = Class.forName(resolverClassName)
                    .asSubclass(Properties.class);
            Properties properties = propsclass.getDeclaredConstructor().newInstance();
            properties.load(reader);
            return new FlumeConfiguration(toMap(properties));
        } catch (IOException ex) {
            LOGGER.error("Unable to load file:" + file
                    + " (I/O failure) - Exception follows.", ex);
        } catch (ClassNotFoundException | NoClassDefFoundError e) {
            LOGGER.error("Configuration resolver class not found", e);
        } catch (InstantiationException e) {
            LOGGER.error("Instantiation exception", e);
        } catch (IllegalAccessException e) {
            LOGGER.error("Illegal access exception", e);
        } catch (InvocationTargetException e) {
            LOGGER.error("Invocation target exception", e);
        } catch (NoSuchMethodException e) {
            LOGGER.error("No such method exception", e);
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException ex) {
                    LOGGER.warn(
                            "Unable to close file reader for file: " + file, ex);
                }
            }
        }
        return new FlumeConfiguration(new HashMap<String, String>());
    }
@Test
    public void testPropertyRead() {

        FlumeConfiguration configuration = provider.getFlumeConfiguration();
        assertNotNull(configuration);

    /*
     * Test the known errors in the file
     */
        List<String> expected = Lists.newArrayList();
        expected.add("host5 CONFIG_ERROR");
        expected.add("host5 INVALID_PROPERTY");
        expected.add("host4 CONFIG_ERROR");
        expected.add("host4 CONFIG_ERROR");
        expected.add("host4 PROPERTY_VALUE_NULL");
        expected.add("host4 PROPERTY_VALUE_NULL");
        expected.add("host4 PROPERTY_VALUE_NULL");
        expected.add("host4 AGENT_CONFIGURATION_INVALID");
        expected.add("ch2 ATTRS_MISSING");
        expected.add("host3 CONFIG_ERROR");
        expected.add("host3 PROPERTY_VALUE_NULL");
        expected.add("host3 AGENT_CONFIGURATION_INVALID");
        expected.add("host2 PROPERTY_VALUE_NULL");
        expected.add("host2 AGENT_CONFIGURATION_INVALID");
        List<String> actual = Lists.newArrayList();
        for (FlumeConfigurationError error : configuration.getConfigurationErrors()) {
            actual.add(error.getComponentName() + " " + error.getErrorType().toString());
        }
        Collections.sort(expected);
        Collections.sort(actual);
        assertEquals(actual, expected);

        AgentConfiguration agentConfiguration =
                configuration.getConfigurationFor("host1");
        assertNotNull(agentConfiguration);

        LOGGER.info(agentConfiguration.getPrevalidationConfig());
        LOGGER.info(agentConfiguration.getPostvalidationConfig());

        Set<String> sources = Sets.newHashSet("source1");
        Set<String> sinks = Sets.newHashSet("sink1");
        Set<String> channels = Sets.newHashSet("channel1");

        assertEquals(agentConfiguration.getSourceSet(), sources);
        assertEquals(agentConfiguration.getSinkSet(), sinks);
        assertEquals(agentConfiguration.getChannelSet(), channels);
    }