Search in sources :

Example 36 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 37 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 38 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 39 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 40 with MapSettings

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

the class PurgeDatastoresStepTest method verify_call_purge_method_of_the_purge_task.

private void verify_call_purge_method_of_the_purge_task(Component project) {
    treeRootHolder.setRoot(project);
    when(settingsRepository.getSettings(project)).thenReturn(new MapSettings());
    dbIdsRepository.setComponentId(project, PROJECT_ID);
    underTest.execute();
    ArgumentCaptor<IdUuidPair> argumentCaptor = ArgumentCaptor.forClass(IdUuidPair.class);
    verify(projectCleaner).purge(any(DbSession.class), argumentCaptor.capture(), any(Settings.class), anyList());
    assertThat(argumentCaptor.getValue().getId()).isEqualTo(PROJECT_ID);
    assertThat(argumentCaptor.getValue().getUuid()).isEqualTo(PROJECT_UUID);
}
Also used : DbSession(org.sonar.db.DbSession) MapSettings(org.sonar.api.config.MapSettings) IdUuidPair(org.sonar.db.purge.IdUuidPair) Settings(org.sonar.api.config.Settings) MapSettings(org.sonar.api.config.MapSettings)

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