Search in sources :

Example 26 with MapSettings

use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.

the class FileExclusionsTest method ignore_inclusion_of_world.

@Test
public void ignore_inclusion_of_world() {
    Settings settings = new MapSettings();
    settings.setProperty(CoreProperties.PROJECT_INCLUSIONS_PROPERTY, "**/*");
    settings.setProperty(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY, "**/*");
    assertThat(new FileExclusions(settings).sourceInclusions()).isEmpty();
    assertThat(new FileExclusions(settings).testInclusions()).isEmpty();
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 27 with MapSettings

use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.

the class FileExclusionsTest method load_exclusions.

@Test
public void load_exclusions() {
    Settings settings = new MapSettings();
    settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/*Foo.java");
    settings.setProperty(CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY, "**/*FooTest.java");
    FileExclusions moduleExclusions = new FileExclusions(settings);
    assertThat(moduleExclusions.sourceInclusions()).isEmpty();
    assertThat(moduleExclusions.sourceExclusions()).containsOnly("**/*Foo.java");
    assertThat(moduleExclusions.testInclusions()).isEmpty();
    assertThat(moduleExclusions.testExclusions()).containsOnly("**/*FooTest.java");
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 28 with MapSettings

use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.

the class DefaultCpdBlockIndexerTest method init.

@Before
public void init() {
    settings = new MapSettings();
    engine = new DefaultCpdBlockIndexer(null, null, settings, null);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Before(org.junit.Before)

Example 29 with MapSettings

use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.

the class JavaCpdBlockIndexerTest method languageSupported.

@Test
public void languageSupported() {
    JavaCpdBlockIndexer engine = new JavaCpdBlockIndexer(mock(FileSystem.class), new MapSettings(), index);
    assertThat(engine.isLanguageSupported(JAVA)).isTrue();
    assertThat(engine.isLanguageSupported("php")).isFalse();
}
Also used : MapSettings(org.sonar.api.config.MapSettings) DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) FileSystem(org.sonar.api.batch.fs.FileSystem) Test(org.junit.Test)

Example 30 with MapSettings

use of org.sonar.api.config.MapSettings in project sonarqube by SonarSource.

the class FileCacheProviderTest method honor_sonarUserHome.

@Test
public void honor_sonarUserHome() throws IOException {
    FileCacheProvider provider = new FileCacheProvider();
    Settings settings = new MapSettings();
    File f = temp.newFolder();
    settings.appendProperty("sonar.userHome", f.getAbsolutePath());
    FileCache cache = provider.provide(settings);
    assertThat(cache.getDir()).isEqualTo(new File(f, "cache"));
}
Also used : MapSettings(org.sonar.api.config.MapSettings) File(java.io.File) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings) FileCache(org.sonar.home.cache.FileCache) Test(org.junit.Test)

Aggregations

MapSettings (org.sonar.api.config.MapSettings)98 Test (org.junit.Test)75 Settings (org.sonar.api.config.Settings)36 Before (org.junit.Before)20 URI (java.net.URI)13 Languages (org.sonar.api.resources.Languages)9 DefaultLanguagesRepository (org.sonar.scanner.repository.language.DefaultLanguagesRepository)9 LanguagesRepository (org.sonar.scanner.repository.language.LanguagesRepository)8 File (java.io.File)7 SensorStorage (org.sonar.api.batch.sensor.internal.SensorStorage)7 FileExclusions (org.sonar.api.scan.filesystem.FileExclusions)6 Properties (java.util.Properties)5 IndexedFile (org.sonar.api.batch.fs.IndexedFile)5 DefaultFileSystem (org.sonar.api.batch.fs.internal.DefaultFileSystem)5 DefaultIndexedFile (org.sonar.api.batch.fs.internal.DefaultIndexedFile)5 PropertyDefinitions (org.sonar.api.config.PropertyDefinitions)5 InputFile (org.sonar.api.batch.fs.InputFile)4 InputStream (java.io.InputStream)3 Description (org.hamcrest.Description)3 CoreProperties (org.sonar.api.CoreProperties)3