@Test
public void loadConfigurationTest() throws Exception {

    for (DistributedConfigurationPublisher publisher : publishers) {
        ConfigurationManager configurationManager = configurationManagers.get(publisher.getComponent());
        configurationManager.loadConfiguration();
        // Checking for configuration files
        for (Map.Entry<String, String> entry : publisher.getPropertiesFiles().entrySet()) {
            File originalFile = new File(entry.getKey());
            Properties properties = new Properties();
            try (InputStream in = new FileInputStream(originalFile)) {
                properties.load(in);
            } catch (Exception e) {
                fail(e.getMessage());
            }
            for (String key : properties.stringPropertyNames()) {
                Assert.assertEquals(properties.getProperty(key), System.getProperty(key));
            }
            String fileName = entry.getValue();
            fileName = ConfigUtils.fixForComponentHome(publisher.getComponent(), fileName);
            File downloadedFile = new File(fileName);
            Assert.assertNotNull(downloadedFile);
            Assert.assertTrue(downloadedFile.exists());
        }
        // Checking for configuration files
        for (Map.Entry<String, String> entry : publisher.getConfigFiles().entrySet()) {
            String fileName = entry.getValue();
            fileName = ConfigUtils.fixForComponentHome(publisher.getComponent(), fileName);
            File file = new File(fileName);
            Assert.assertTrue(file.exists());
        }
        List<String> localFiles = configurationManager.getSavedFiles();
        configurationManager.clearConfiguration();
        for (String localFile : localFiles) {
            File file = new File(localFile);
            Assert.assertFalse(file.exists());
        }
    }
}