DistributedConfigurationManager extends ConfigurationManager { @Override public synchronized void loadConfiguration() throws Exception { logger.debug("Loading properties for : {}", component); loadProperties(); logger.info("Properties loaded for : {}", component); logger.debug("Saving configuration files for : {}", component); saveConfigFiles(); logger.info("Configuration files saved for : {}", component); } DistributedConfigurationManager(Component component); @Override synchronized void loadConfiguration(); @Override synchronized void clearConfiguration(); Component getComponent(); @Override List<String> getSavedFiles(); ZNodePaths getzNodePaths();  }
@Test public void loadConfigurationTest() throws Exception { for (DistributedConfigurationPublisher publisher : publishers) { ConfigurationManager configurationManager = configurationManagers.get(publisher.getComponent()); configurationManager.loadConfiguration(); 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()); } 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()); } } }