@Test public void getTestConfigsTest() throws IOException { File config1 = new File(munitFolder, CONFIG_1); File config2 = new File(munitFolder, CONFIG_2); File config3Folder = new File(munitFolder, CONFIG_3_LOCATION); File config3 = new File(config3Folder, CONFIG_3); File commonFile = new File(munitFolder, COMMON_FILE); config1.createNewFile(); FileUtils.writeStringToFile(config1, DEFAULT_MULE_CONFIG_CONTENT, Charset.defaultCharset()); config2.createNewFile(); FileUtils.writeStringToFile(config2, DEFAULT_MULE_CONFIG_CONTENT, Charset.defaultCharset()); config3Folder.mkdirs(); config3.createNewFile(); FileUtils.writeStringToFile(config3, DEFAULT_MULE_CONFIG_CONTENT, Charset.defaultCharset()); commonFile.createNewFile(); resolver = newResolver(new ProjectStructure(temporaryFolder.getRoot().toPath(), true), mock(Pom.class), new ArrayList<>()); List<String> actualConfigs = resolver.getTestConfigs(); assertThat("Configs does not contain all expected elements", actualConfigs, containsInAnyOrder(CONFIG_1, CONFIG_2, CONFIG_3_LOCATION + separator + CONFIG_3)); assertThat("Configs contain an unexpected elements", actualConfigs.contains(COMMON_FILE), is(false)); assertThat("Configs contains more elements than expected", actualConfigs.size(), equalTo(3)); }
public List<String> getConfigs() throws IOException { if (configs == null) { List<String> candidateConfigs = getResources(projectStructure.getConfigsPath(), new SuffixFileFilter(CONFIG_FILE_EXTENSION)); configs = candidateConfigs.stream() .filter(config -> hasMuleAsRootElement(projectStructure.getConfigsPath().resolve(config))).collect(toList()); } return configs; }
MuleArtifactContentResolver { public List<String> getConfigs() throws IOException { if (configs == null) { List<String> candidateConfigs = getResources(projectStructure.getConfigsPath(), new SuffixFileFilter(CONFIG_FILE_EXTENSION)); configs = candidateConfigs.stream() .filter(config -> hasMuleAsRootElement(projectStructure.getConfigsPath().resolve(config))).collect(toList()); } return configs; } }
MuleArtifactContentResolver { public List<String> getConfigs() throws IOException { if (configs == null) { List<String> candidateConfigs = getResources(projectStructure.getConfigsPath(), new SuffixFileFilter(CONFIG_FILE_EXTENSION)); configs = candidateConfigs.stream() .filter(config -> hasMuleAsRootElement(projectStructure.getConfigsPath().resolve(config))).collect(toList()); } return configs; } MuleArtifactContentResolver(ProjectStructure projectStructure, Pom pom, List<BundleDependency> bundleDependencies); }
MuleArtifactContentResolver { public List<String> getConfigs() throws IOException { if (configs == null) { List<String> candidateConfigs = getResources(projectStructure.getConfigsPath(), new SuffixFileFilter(CONFIG_FILE_EXTENSION)); configs = candidateConfigs.stream() .filter(config -> hasMuleAsRootElement(projectStructure.getConfigsPath().resolve(config))).collect(toList()); } return configs; } MuleArtifactContentResolver(ProjectStructure projectStructure, Pom pom, List<BundleDependency> bundleDependencies); ProjectStructure getProjectStructure(); List<String> getExportedPackages(); List<String> getExportedResources(); List<String> getTestExportedResources(); List<String> getConfigs(); List<String> getTestConfigs(); static String escapeSlashes(String p); List<BundleDependency> getBundleDependencies(); Pom getPom(); }
MuleArtifactContentResolver { public List<String> getConfigs() throws IOException { if (configs == null) { List<String> candidateConfigs = getResources(projectStructure.getConfigsPath(), new SuffixFileFilter(CONFIG_FILE_EXTENSION)); configs = candidateConfigs.stream() .filter(config -> hasMuleAsRootElement(projectStructure.getConfigsPath().resolve(config))).collect(toList()); } return configs; } MuleArtifactContentResolver(ProjectStructure projectStructure, Pom pom, List<BundleDependency> bundleDependencies); ProjectStructure getProjectStructure(); List<String> getExportedPackages(); List<String> getExportedResources(); List<String> getTestExportedResources(); List<String> getConfigs(); List<String> getTestConfigs(); static String escapeSlashes(String p); List<BundleDependency> getBundleDependencies(); Pom getPom(); static final String CLASS_PATH_SEPARATOR; }