Search in sources :

Example 11 with MapSettings

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

the class EmbeddedDatabaseTest method start_fails_with_IAE_if_property_Data_Path_is_not_set.

@Test
public void start_fails_with_IAE_if_property_Data_Path_is_not_set() {
    EmbeddedDatabase underTest = new EmbeddedDatabase(new MapSettings());
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("Missing property " + PATH_DATA);
    underTest.start();
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 12 with MapSettings

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

the class EmbeddedDatabaseTest method start_fails_with_IAE_if_embedded_port_settings_is_not_set.

@Test
public void start_fails_with_IAE_if_embedded_port_settings_is_not_set() throws IOException {
    EmbeddedDatabase underTest = new EmbeddedDatabase(new MapSettings().setProperty(PATH_DATA, temporaryFolder.newFolder().getAbsolutePath()).setProperty(PROP_URL, "jdbc url"));
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("Missing property " + PROP_EMBEDDED_PORT);
    underTest.start();
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 13 with MapSettings

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

the class EmbeddedDatabaseTest method start_supports_in_memory_H2_JDBC_URL.

@Test
public void start_supports_in_memory_H2_JDBC_URL() throws IOException {
    int port = NetworkUtils.freePort();
    underTest = new EmbeddedDatabase(new MapSettings().setProperty(PATH_DATA, temporaryFolder.newFolder().getAbsolutePath()).setProperty(PROP_URL, "jdbc:h2:mem:sonar").setProperty(PROP_EMBEDDED_PORT, "" + port).setProperty(PROP_USER, "foo").setProperty(PROP_PASSWORD, "bar"));
    underTest.start();
    checkDbIsUp(port, "foo", "bar");
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 14 with MapSettings

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

the class EmbeddedDatabaseTest method start_ignores_URL_to_create_database_and_uses_default_username_and_password_when_then_are_not_set.

@Test
public void start_ignores_URL_to_create_database_and_uses_default_username_and_password_when_then_are_not_set() throws IOException {
    int port = NetworkUtils.freePort();
    underTest = new EmbeddedDatabase(new MapSettings().setProperty(PATH_DATA, temporaryFolder.newFolder().getAbsolutePath()).setProperty(PROP_URL, "jdbc url").setProperty(PROP_EMBEDDED_PORT, "" + port));
    underTest.start();
    checkDbIsUp(port, PROP_USER_DEFAULT_VALUE, PROP_PASSWORD_DEFAULT_VALUE);
}
Also used : MapSettings(org.sonar.api.config.MapSettings) Test(org.junit.Test)

Example 15 with MapSettings

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

the class UserIndexDefinitionTest method define.

@Test
public void define() {
    UserIndexDefinition def = new UserIndexDefinition(new MapSettings());
    def.define(underTest);
    assertThat(underTest.getIndices()).hasSize(1);
    NewIndex index = underTest.getIndices().get("users");
    assertThat(index).isNotNull();
    assertThat(index.getTypes().keySet()).containsOnly("user");
    // no cluster by default
    assertThat(index.getSettings().get("index.number_of_shards")).isEqualTo("1");
    assertThat(index.getSettings().get("index.number_of_replicas")).isEqualTo("0");
}
Also used : MapSettings(org.sonar.api.config.MapSettings) NewIndex(org.sonar.server.es.NewIndex) 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