Search in sources :

Example 6 with DefaultFileSystem

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);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) Before(org.junit.Before)

Example 7 with DefaultFileSystem

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);
}
Also used : DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) Test(org.junit.Test)

Example 8 with DefaultFileSystem

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);
}
Also used : TestInputFileBuilder(org.sonar.api.batch.fs.internal.TestInputFileBuilder) MapSettings(org.sonar.api.config.MapSettings) InputFile(org.sonar.api.batch.fs.InputFile) File(java.io.File) DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) Before(org.junit.Before)

Example 9 with DefaultFileSystem

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);
}
Also used : DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) Before(org.junit.Before)

Example 10 with DefaultFileSystem

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);
}
Also used : ActiveRulesBuilder(org.sonar.api.batch.rule.internal.ActiveRulesBuilder) MapSettings(org.sonar.api.config.MapSettings) MetricFinder(org.sonar.api.batch.measure.MetricFinder) AnalysisMode(org.sonar.api.batch.AnalysisMode) DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) SensorStorage(org.sonar.api.batch.sensor.internal.SensorStorage) Before(org.junit.Before)

Aggregations

DefaultFileSystem (org.sonar.api.batch.fs.internal.DefaultFileSystem)10 Before (org.junit.Before)9 MapSettings (org.sonar.api.config.MapSettings)4 File (java.io.File)2 InputFile (org.sonar.api.batch.fs.InputFile)2 TestInputFileBuilder (org.sonar.api.batch.fs.internal.TestInputFileBuilder)2 ActiveRulesBuilder (org.sonar.api.batch.rule.internal.ActiveRulesBuilder)2 Test (org.junit.Test)1 AnalysisMode (org.sonar.api.batch.AnalysisMode)1 DefaultInputDir (org.sonar.api.batch.fs.internal.DefaultInputDir)1 DefaultInputFile (org.sonar.api.batch.fs.internal.DefaultInputFile)1 DefaultInputModule (org.sonar.api.batch.fs.internal.DefaultInputModule)1 InputModuleHierarchy (org.sonar.api.batch.fs.internal.InputModuleHierarchy)1 MetricFinder (org.sonar.api.batch.measure.MetricFinder)1 RulesBuilder (org.sonar.api.batch.rule.internal.RulesBuilder)1 BlameInput (org.sonar.api.batch.scm.BlameCommand.BlameInput)1 SensorStorage (org.sonar.api.batch.sensor.internal.SensorStorage)1 ResourcePerspectives (org.sonar.api.component.ResourcePerspectives)1 PathResolver (org.sonar.api.scan.filesystem.PathResolver)1 UserRepositoryLoader (org.sonar.scanner.repository.user.UserRepositoryLoader)1