@Test public void testModuleRepository() throws IOException { try (BufferedWriter newBufferedWriter = Files.newBufferedWriter(fileSystem.getPath("/config.yml"))) { newBufferedWriter.write("foo:\n bar: baz"); } ModuleConfigRepository loadModuleRepository = ClassicPlatformConfigProvider .loadModuleRepository(new Path[] {fileSystem.getPath("/") }, "config"); assertEquals("baz", loadModuleRepository.getModuleConfig("foo").get().getStringProperty("bar")); }
static ModuleConfigRepository loadModuleRepository(Path[] configDirs, String configName) { List<ModuleConfigRepository> repositoriesFromPath = Arrays.stream(configDirs) .map(configDir -> PlatformConfig.loadModuleRepository(configDir, configName)) .collect(Collectors.toList()); List<ModuleConfigRepository> repositories = new ArrayList<>(); repositories.add(new EnvironmentModuleConfigRepository(System.getenv(), FileSystems.getDefault())); repositories.addAll(repositoriesFromPath); return new StackedModuleConfigRepository(repositories); }
ClassicPlatformConfigProvider implements PlatformConfigProvider { static ModuleConfigRepository loadModuleRepository(Path[] configDirs, String configName) { List<ModuleConfigRepository> repositoriesFromPath = Arrays.stream(configDirs) .map(configDir -> PlatformConfig.loadModuleRepository(configDir, configName)) .collect(Collectors.toList()); List<ModuleConfigRepository> repositories = new ArrayList<>(); repositories.add(new EnvironmentModuleConfigRepository(System.getenv(), FileSystems.getDefault())); repositories.addAll(repositoriesFromPath); return new StackedModuleConfigRepository(repositories); } }
ClassicPlatformConfigProvider implements PlatformConfigProvider { static ModuleConfigRepository loadModuleRepository(Path[] configDirs, String configName) { List<ModuleConfigRepository> repositoriesFromPath = Arrays.stream(configDirs) .map(configDir -> PlatformConfig.loadModuleRepository(configDir, configName)) .collect(Collectors.toList()); List<ModuleConfigRepository> repositories = new ArrayList<>(); repositories.add(new EnvironmentModuleConfigRepository(System.getenv(), FileSystems.getDefault())); repositories.addAll(repositoriesFromPath); return new StackedModuleConfigRepository(repositories); }  }
ClassicPlatformConfigProvider implements PlatformConfigProvider { static ModuleConfigRepository loadModuleRepository(Path[] configDirs, String configName) { List<ModuleConfigRepository> repositoriesFromPath = Arrays.stream(configDirs) .map(configDir -> PlatformConfig.loadModuleRepository(configDir, configName)) .collect(Collectors.toList()); List<ModuleConfigRepository> repositories = new ArrayList<>(); repositories.add(new EnvironmentModuleConfigRepository(System.getenv(), FileSystems.getDefault())); repositories.addAll(repositoriesFromPath); return new StackedModuleConfigRepository(repositories); }  @Override String getName(); static Path[] getDefaultConfigDirs(FileSystem fileSystem, String directories, String userHome, String pathSeparator); @Override PlatformConfig getPlatformConfig(); }
ClassicPlatformConfigProvider implements PlatformConfigProvider { static ModuleConfigRepository loadModuleRepository(Path[] configDirs, String configName) { List<ModuleConfigRepository> repositoriesFromPath = Arrays.stream(configDirs) .map(configDir -> PlatformConfig.loadModuleRepository(configDir, configName)) .collect(Collectors.toList()); List<ModuleConfigRepository> repositories = new ArrayList<>(); repositories.add(new EnvironmentModuleConfigRepository(System.getenv(), FileSystems.getDefault())); repositories.addAll(repositoriesFromPath); return new StackedModuleConfigRepository(repositories); }  @Override String getName(); static Path[] getDefaultConfigDirs(FileSystem fileSystem, String directories, String userHome, String pathSeparator); @Override PlatformConfig getPlatformConfig();  }