use of org.sonar.api.batch.fs.InputFile in project sonarqube by SonarSource.
the class ModuleInputComponentStoreTest method should_cache_files_by_filename.
@Test
public void should_cache_files_by_filename() throws IOException {
ModuleInputComponentStore store = newModuleInputComponentStore();
String filename = "some name";
InputFile inputFile1 = new TestInputFileBuilder(moduleKey, "some/path/" + filename).build();
store.doAdd(inputFile1);
InputFile inputFile2 = new TestInputFileBuilder(moduleKey, "other/path/" + filename).build();
store.doAdd(inputFile2);
InputFile dummyInputFile = new TestInputFileBuilder(moduleKey, "some/path/Dummy.java").build();
store.doAdd(dummyInputFile);
assertThat(store.getFilesByName(filename)).containsExactlyInAnyOrder(inputFile1, inputFile2);
}
use of org.sonar.api.batch.fs.InputFile in project sonarqube by SonarSource.
the class ModuleInputComponentStoreTest method should_not_cache_duplicates.
@Test
public void should_not_cache_duplicates() throws IOException {
ModuleInputComponentStore store = newModuleInputComponentStore();
String ext = "java";
String filename = "Program." + ext;
InputFile inputFile = new TestInputFileBuilder(moduleKey, "some/path/" + filename).build();
store.doAdd(inputFile);
store.doAdd(inputFile);
store.doAdd(inputFile);
assertThat(store.getFilesByName(filename)).containsExactly(inputFile);
assertThat(store.getFilesByExtension(ext)).containsExactly(inputFile);
}
use of org.sonar.api.batch.fs.InputFile in project sonarqube by SonarSource.
the class ModuleInputComponentStoreTest method should_cache_files_by_extension.
@Test
public void should_cache_files_by_extension() throws IOException {
ModuleInputComponentStore store = newModuleInputComponentStore();
InputFile inputFile1 = new TestInputFileBuilder(moduleKey, "some/path/Program.java").build();
store.doAdd(inputFile1);
InputFile inputFile2 = new TestInputFileBuilder(moduleKey, "other/path/Utils.java").build();
store.doAdd(inputFile2);
InputFile dummyInputFile = new TestInputFileBuilder(moduleKey, "some/path/NotJava.cpp").build();
store.doAdd(dummyInputFile);
assertThat(store.getFilesByExtension("java")).containsExactlyInAnyOrder(inputFile1, inputFile2);
}
Aggregations