use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonar-java by SonarSource.
the class PostAnalysisIssueFilterTest method setUp.
@Before
public void setUp() {
File absoluteBaseDir = new File(MODULE_BASE_DIR).getAbsoluteFile();
DefaultFileSystem fileSystem = new DefaultFileSystem(absoluteBaseDir);
DefaultInputFile inputFile = new TestInputFileBuilder("", absoluteBaseDir, new File(absoluteBaseDir, FILE_KEY)).setLanguage("java").setType(InputFile.Type.MAIN).build();
fileSystem.add(inputFile);
postAnalysisIssueFilter = new PostAnalysisIssueFilter(fileSystem);
context = mock(JavaFileScannerContext.class);
when(context.getFile()).thenReturn(inputFile.file());
when(context.getFileKey()).thenReturn(inputFile.key());
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonarqube by SonarSource.
the class ModuleSensorOptimizerTest method prepare.
@Before
public void prepare() throws Exception {
fs = new DefaultFileSystem(temp.newFolder().toPath());
settings = new MapSettings();
optimizer = new ModuleSensorOptimizer(fs, new ActiveRulesBuilder().build(), settings.asConfig());
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonarqube by SonarSource.
the class ModuleSensorContextTest method prepare.
@Before
public void prepare() throws Exception {
activeRules = new ActiveRulesBuilder().build();
fs = new DefaultFileSystem(temp.newFolder().toPath());
MetricFinder metricFinder = mock(MetricFinder.class);
when(metricFinder.<Integer>findByKey(CoreMetrics.NCLOC_KEY)).thenReturn(CoreMetrics.NCLOC);
when(metricFinder.<String>findByKey(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION_KEY)).thenReturn(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION);
settings = new MapSettings();
sensorStorage = mock(SensorStorage.class);
branchConfiguration = mock(BranchConfiguration.class);
runtime = SonarRuntimeImpl.forSonarQube(Version.parse("5.5"), SonarQubeSide.SCANNER, SonarEdition.COMMUNITY);
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem 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"));
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonarqube by SonarSource.
the class SensorContextTesterTest method testFs.
@Test
public void testFs() throws Exception {
DefaultFileSystem fs = new DefaultFileSystem(temp.newFolder());
tester.setFileSystem(fs);
assertThat(tester.fileSystem().baseDir()).isNotEqualTo(baseDir);
}
Aggregations