use of org.sonar.api.scan.filesystem.PathResolver in project sonarqube by SonarSource.
the class ModuleIndexerTest method setUp.
@Before
public void setUp() {
reactor = mock(ImmutableProjectReactor.class);
componentStore = new InputComponentStore(new PathResolver());
tree = new DefaultComponentTree();
moduleHierarchy = new DefaultInputModuleHierarchy();
indexer = new ModuleIndexer(reactor, tree, componentStore, new BatchIdGenerator(), moduleHierarchy);
}
use of org.sonar.api.scan.filesystem.PathResolver in project sonar-java by SonarSource.
the class SurefireUtilsTest method should_get_reports_path_from_deprecated_property.
@Test
public void should_get_reports_path_from_deprecated_property() {
MapSettings settings = new MapSettings();
settings.setProperty("sonar.junit.reportsPath", "target/surefire");
DefaultFileSystem fs = new DefaultFileSystem(new File("src/test/resources/org/sonar/plugins/surefire/api/SurefireUtilsTest/shouldGetReportsPathFromDeprecatedProperty"));
PathResolver pathResolver = new PathResolver();
assertThat(logTester.logs(LoggerLevel.INFO)).isEmpty();
List<File> directories = SurefireUtils.getReportsDirectories(settings.asConfig(), fs, pathResolver);
assertThat(directories).hasSize(1);
File directory = directories.get(0);
assertThat(directory.exists()).isTrue();
assertThat(directory.isDirectory()).isTrue();
assertThat(logTester.logs(LoggerLevel.INFO)).contains("Property 'sonar.junit.reportsPath' is deprecated. Use property 'sonar.junit.reportPaths' instead.");
}
use of org.sonar.api.scan.filesystem.PathResolver in project sonarqube by SonarSource.
the class GitScmProviderTest method returnImplem.
@Test
public void returnImplem() {
JGitBlameCommand jblameCommand = new JGitBlameCommand(new PathResolver(), analysisWarnings);
GitScmProvider gitScmProvider = new GitScmProvider(jblameCommand, analysisWarnings, gitIgnoreCommand, system2);
assertThat(gitScmProvider.blameCommand()).isEqualTo(jblameCommand);
}
use of org.sonar.api.scan.filesystem.PathResolver in project sonarqube by SonarSource.
the class JGitBlameCommandTest method return_early_when_shallow_clone_detected.
@Test
public void return_early_when_shallow_clone_detected() throws IOException {
File projectDir = temp.newFolder();
javaUnzip("shallow-git.zip", projectDir);
File baseDir = new File(projectDir, "shallow-git");
DefaultFileSystem fs = new DefaultFileSystem(baseDir);
when(input.fileSystem()).thenReturn(fs);
DefaultInputFile inputFile = new TestInputFileBuilder("foo", DUMMY_JAVA).build();
when(input.filesToBlame()).thenReturn(Collections.singleton(inputFile));
// register warning with default wrapper
AnalysisWarnings analysisWarnings = mock(AnalysisWarnings.class);
JGitBlameCommand jGitBlameCommand = new JGitBlameCommand(new PathResolver(), analysisWarnings);
BlameOutput output = mock(BlameOutput.class);
jGitBlameCommand.blame(input, output);
assertThat(logTester.logs()).first().matches(s -> s.contains("Shallow clone detected, no blame information will be provided."));
verifyZeroInteractions(output);
verify(analysisWarnings).addUnique(startsWith("Shallow clone detected"));
}
Aggregations