use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonar-python by SonarSource.
the class PythonXUnitSensorTest method setUp.
@Before
public void setUp() {
settings.clear();
fs = new DefaultFileSystem(baseDir);
sensor = new PythonXUnitSensor(new ConfigurationBridge(settings), fs, analysisWarnings);
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonar-openedge by Riverside-Software.
the class InputFileUtilsTest method testDifferentFileSystem.
@Test
public void testDifferentFileSystem() throws Exception {
// Only on Windows...
if (!System.getProperty("os.name").toLowerCase().startsWith("win"))
return;
SensorContextTester context = TestProjectSensorContext.createContext();
InputFile f1 = context.fileSystem().inputFile(context.fileSystem().predicates().hasFilename("test1.p"));
// Different file system, we just return the file name
// Will fail in the unexpected case when unit tests are executed on the X: drive
Assert.assertEquals(InputFileUtils.getRelativePath(f1, new DefaultFileSystem(new File("X:\\"))), "test1.p");
}
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 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 XooTokenizerTest method prepare.
@Before
public void prepare() throws IOException {
baseDir = temp.newFolder();
fileSystem = new DefaultFileSystem(baseDir.toPath());
when(context.fileSystem()).thenReturn(fileSystem);
settings = new MapSettings();
when(context.settings()).thenReturn(settings);
}
Aggregations