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);
}
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);
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonarqube by SonarSource.
the class JavaCpdBlockIndexerTest method setUp.
@Before
public void setUp() throws IOException {
MockitoAnnotations.initMocks(this);
File baseDir = temp.newFolder();
DefaultFileSystem fs = new DefaultFileSystem(baseDir);
file = new TestInputFileBuilder("foo", "src/ManyStatements.java").setModuleBaseDir(baseDir.toPath()).setLanguage(JAVA).build();
fs.add(file);
File ioFile = file.file();
FileUtils.copyURLToFile(this.getClass().getResource("ManyStatements.java"), ioFile);
settings = new MapSettings();
engine = new JavaCpdBlockIndexer(fs, settings, index);
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonarqube by SonarSource.
the class QProfileVerifierTest method before.
@Before
public void before() throws Exception {
fs = new DefaultFileSystem(temp.newFolder().toPath());
profiles = mock(ModuleQProfiles.class);
QProfile javaProfile = new QProfile().setKey("p1").setName("My Java profile").setLanguage("java");
when(profiles.findByLanguage("java")).thenReturn(javaProfile);
QProfile cobolProfile = new QProfile().setKey("p2").setName("My Cobol profile").setLanguage("cobol");
when(profiles.findByLanguage("cobol")).thenReturn(cobolProfile);
}
use of org.sonar.api.batch.fs.internal.DefaultFileSystem in project sonarqube by SonarSource.
the class DefaultSensorContextTest 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);
analysisMode = mock(AnalysisMode.class);
runtime = SonarRuntimeImpl.forSonarQube(Version.parse("5.5"), SonarQubeSide.SCANNER);
adaptor = new DefaultSensorContext(mock(InputModule.class), settings, fs, activeRules, analysisMode, sensorStorage, runtime);
}
Aggregations