@Test public void testConfigHelperLoadConfig() throws Exception { Config testConfig = TestConfigUtil.createTestLocalConfig(); Config loadedConfig = ConfigHelper.loadConfig(testConfig.getLocalDir()); assertNotNull(loadedConfig); assertEquals(testConfig.getAppDir(), loadedConfig.getAppDir()); assertEquals(testConfig.getCacheDir(), loadedConfig.getCacheDir()); assertNotNull(loadedConfig.getChunker()); assertEquals(testConfig.getChunker().toString(), loadedConfig.getChunker().toString()); assertNotNull(loadedConfig.getCache()); assertNotNull(loadedConfig.getConnection()); assertEquals(testConfig.getDatabaseDir(), loadedConfig.getDatabaseDir()); assertEquals(testConfig.getDatabaseFile(), loadedConfig.getDatabaseFile()); assertEquals(testConfig.getDisplayName(), loadedConfig.getDisplayName()); assertEquals(testConfig.getLocalDir(), loadedConfig.getLocalDir()); assertEquals(testConfig.getLogDir(), loadedConfig.getLogDir()); assertEquals(testConfig.getMachineName(), loadedConfig.getMachineName()); assertEquals(testConfig.getMasterKey(), loadedConfig.getMasterKey()); assertNotNull(loadedConfig.getMultiChunker()); assertNotNull(loadedConfig.getRepoId()); assertNotNull(loadedConfig.getTransformer()); TestConfigUtil.deleteTestLocalConfigAndData(testConfig); }
public static Config loadConfig(File localDir) throws ConfigException { if (localDir == null) { throw new ConfigException("Argument localDir cannot be null."); } File appDir = new File(localDir, Config.DIR_APPLICATION); if (appDir.exists()) { logger.log(Level.INFO, "Loading config from {0} ...", localDir); ConfigTO configTO = ConfigHelper.loadConfigTO(localDir); RepoTO repoTO = ConfigHelper.loadRepoTO(localDir, configTO); String pluginId = (configTO.getTransferSettings() != null) ? configTO.getTransferSettings().getType() : null; TransferPlugin plugin = Plugins.get(pluginId, TransferPlugin.class); if (plugin == null) { logger.log(Level.WARNING, "Not loading config! Plugin with id '{0}' does not exist.", pluginId); throw new ConfigException("Plugin with id '" + pluginId + "' does not exist. Try 'sy plugin install " + pluginId + "'."); } logger.log(Level.INFO, "Initializing Config instance ..."); return new Config(localDir, configTO, repoTO); } else { logger.log(Level.INFO, "Not loading config, app dir does not exist: {0}", appDir); return null; } }
ConfigHelper { public static Config loadConfig(File localDir) throws ConfigException { if (localDir == null) { throw new ConfigException("Argument localDir cannot be null."); } File appDir = new File(localDir, Config.DIR_APPLICATION); if (appDir.exists()) { logger.log(Level.INFO, "Loading config from {0} ...", localDir); ConfigTO configTO = ConfigHelper.loadConfigTO(localDir); RepoTO repoTO = ConfigHelper.loadRepoTO(localDir, configTO); String pluginId = (configTO.getTransferSettings() != null) ? configTO.getTransferSettings().getType() : null; TransferPlugin plugin = Plugins.get(pluginId, TransferPlugin.class); if (plugin == null) { logger.log(Level.WARNING, "Not loading config! Plugin with id '{0}' does not exist.", pluginId); throw new ConfigException("Plugin with id '" + pluginId + "' does not exist. Try 'sy plugin install " + pluginId + "'."); } logger.log(Level.INFO, "Initializing Config instance ..."); return new Config(localDir, configTO, repoTO); } else { logger.log(Level.INFO, "Not loading config, app dir does not exist: {0}", appDir); return null; } } }
ConfigHelper { public static Config loadConfig(File localDir) throws ConfigException { if (localDir == null) { throw new ConfigException("Argument localDir cannot be null."); } File appDir = new File(localDir, Config.DIR_APPLICATION); if (appDir.exists()) { logger.log(Level.INFO, "Loading config from {0} ...", localDir); ConfigTO configTO = ConfigHelper.loadConfigTO(localDir); RepoTO repoTO = ConfigHelper.loadRepoTO(localDir, configTO); String pluginId = (configTO.getTransferSettings() != null) ? configTO.getTransferSettings().getType() : null; TransferPlugin plugin = Plugins.get(pluginId, TransferPlugin.class); if (plugin == null) { logger.log(Level.WARNING, "Not loading config! Plugin with id '{0}' does not exist.", pluginId); throw new ConfigException("Plugin with id '" + pluginId + "' does not exist. Try 'sy plugin install " + pluginId + "'."); } logger.log(Level.INFO, "Initializing Config instance ..."); return new Config(localDir, configTO, repoTO); } else { logger.log(Level.INFO, "Not loading config, app dir does not exist: {0}", appDir); return null; } }  }
ConfigHelper { public static Config loadConfig(File localDir) throws ConfigException { if (localDir == null) { throw new ConfigException("Argument localDir cannot be null."); } File appDir = new File(localDir, Config.DIR_APPLICATION); if (appDir.exists()) { logger.log(Level.INFO, "Loading config from {0} ...", localDir); ConfigTO configTO = ConfigHelper.loadConfigTO(localDir); RepoTO repoTO = ConfigHelper.loadRepoTO(localDir, configTO); String pluginId = (configTO.getTransferSettings() != null) ? configTO.getTransferSettings().getType() : null; TransferPlugin plugin = Plugins.get(pluginId, TransferPlugin.class); if (plugin == null) { logger.log(Level.WARNING, "Not loading config! Plugin with id '{0}' does not exist.", pluginId); throw new ConfigException("Plugin with id '" + pluginId + "' does not exist. Try 'sy plugin install " + pluginId + "'."); } logger.log(Level.INFO, "Initializing Config instance ..."); return new Config(localDir, configTO, repoTO); } else { logger.log(Level.INFO, "Not loading config, app dir does not exist: {0}", appDir); return null; } }  static Config loadConfig(File localDir); static boolean configExists(File localDir); static ConfigTO loadConfigTO(File localDir); static RepoTO loadRepoTO(File localDir, ConfigTO configTO); static File findLocalDirInPath(File startingPath); }
ConfigHelper { public static Config loadConfig(File localDir) throws ConfigException { if (localDir == null) { throw new ConfigException("Argument localDir cannot be null."); } File appDir = new File(localDir, Config.DIR_APPLICATION); if (appDir.exists()) { logger.log(Level.INFO, "Loading config from {0} ...", localDir); ConfigTO configTO = ConfigHelper.loadConfigTO(localDir); RepoTO repoTO = ConfigHelper.loadRepoTO(localDir, configTO); String pluginId = (configTO.getTransferSettings() != null) ? configTO.getTransferSettings().getType() : null; TransferPlugin plugin = Plugins.get(pluginId, TransferPlugin.class); if (plugin == null) { logger.log(Level.WARNING, "Not loading config! Plugin with id '{0}' does not exist.", pluginId); throw new ConfigException("Plugin with id '" + pluginId + "' does not exist. Try 'sy plugin install " + pluginId + "'."); } logger.log(Level.INFO, "Initializing Config instance ..."); return new Config(localDir, configTO, repoTO); } else { logger.log(Level.INFO, "Not loading config, app dir does not exist: {0}", appDir); return null; } }  static Config loadConfig(File localDir); static boolean configExists(File localDir); static ConfigTO loadConfigTO(File localDir); static RepoTO loadRepoTO(File localDir, ConfigTO configTO); static File findLocalDirInPath(File startingPath);  }