Package org.sonar.api.config

Examples of org.sonar.api.config.Settings


    assertThat(commonsDbcpProps.getProperty("maxActive")).isEqualTo("5");
  }

  @Test
  public void shouldCompleteProperties() {
    Settings settings = new Settings();

    DefaultDatabase db = new DefaultDatabase(settings) {
      @Override
      protected void doCompleteProperties(Properties properties) {
        properties.setProperty("sonar.jdbc.maxActive", "2");
View Full Code Here


    assertThat(props.getProperty("sonar.jdbc.maxActive")).isEqualTo("2");
  }

  @Test
  public void shouldStart() {
    Settings settings = new Settings();
    settings.setProperty("sonar.jdbc.url", "jdbc:h2:mem:sonar");
    settings.setProperty("sonar.jdbc.driverClassName", "org.h2.Driver");
    settings.setProperty("sonar.jdbc.username", "sonar");
    settings.setProperty("sonar.jdbc.password", "sonar");
    settings.setProperty("sonar.jdbc.maxActive", "1");

    DefaultDatabase db = new DefaultDatabase(settings);
    db.start();
    db.stop();
View Full Code Here

    assertThat(((BasicDataSource) db.getDataSource()).getMaxActive()).isEqualTo(1);
  }

  @Test
  public void shouldGuessDialectFromUrl() {
    Settings settings = new Settings();
    settings.setProperty("sonar.jdbc.url", "jdbc:postgresql://localhost/sonar");

    DefaultDatabase database = new DefaultDatabase(settings);
    database.initSettings();

    assertThat(database.getDialect().getId()).isEqualTo(PostgreSql.ID);
View Full Code Here

    assertThat(database.getDialect().getId()).isEqualTo(PostgreSql.ID);
  }

  @Test
  public void shouldGuessDefaultDriver() {
    Settings settings = new Settings();
    settings.setProperty("sonar.jdbc.url", "jdbc:postgresql://localhost/sonar");

    DefaultDatabase database = new DefaultDatabase(settings);
    database.initSettings();

    assertThat(database.getProperties().getProperty("sonar.jdbc.driverClassName")).isEqualTo("org.postgresql.Driver");
View Full Code Here

    assertThat(database.getProperties().getProperty("sonar.jdbc.driverClassName")).isEqualTo("org.postgresql.Driver");
  }

  @Test
  public void shouldSetHibernateProperties() {
    Settings settings = new Settings();
    settings.setProperty("sonar.jdbc.url", "jdbc:postgresql://localhost/sonar");
    DefaultDatabase database = new DefaultDatabase(settings);
    database.initSettings();

    Properties hibernateProps = database.getHibernateProperties();
View Full Code Here

    when(gtalkChannel.getKey()).thenReturn("gtalk");
    when(commentOnReviewAssignedToMe.getKey()).thenReturn("comment on review assigned to me");
    when(commentOnReviewCreatedByMe.getKey()).thenReturn("comment on review created by me");
    when(manager.getFromQueue()).thenReturn(notification).thenReturn(null);

    Settings settings = new Settings().setProperty("sonar.notifications.delay", 1L);

    service = new NotificationService(settings, manager, mock(DatabaseSessionFactory.class),
      new NotificationDispatcher[] {commentOnReviewAssignedToMe, commentOnReviewCreatedByMe});
  }
View Full Code Here

    assertThat(service.getDispatchers()).containsOnly(commentOnReviewAssignedToMe, commentOnReviewCreatedByMe);
  }

  @Test
  public void shouldReturnNoDispatcher() {
    Settings settings = new Settings().setProperty("sonar.notifications.delay", 1L);

    service = new NotificationService(settings, manager, mock(DatabaseSessionFactory.class));
    assertThat(service.getDispatchers()).hasSize(0);
  }
View Full Code Here

  private IDatabaseTester databaseTester;

  @BeforeClass
  public static void startDatabase() throws Exception {
    if (database == null) {
      Settings settings = new Settings().setProperties(Maps.fromProperties(System.getProperties()));
      if (settings.hasKey("orchestrator.configUrl")) {
        loadOrchestratorSettings(settings);
      }
      for (String key : settings.getKeysStartingWith("sonar.jdbc")) {
        LOG.info(key + ": " + settings.getString(key));
      }
      boolean hasDialect = settings.hasKey("sonar.jdbc.dialect");
      if (hasDialect) {
        database = new DefaultDatabase(settings);
      } else {
        database = new H2Database("test", true);
      }
View Full Code Here

public class PersistenceProfilingTest {

  @Test
  public void should_be_transparent_when_profiling_less_than_full() {
    BasicDataSource datasource = mock(BasicDataSource.class);
    assertThat(PersistenceProfiling.addProfilingIfNeeded(datasource , new Settings())).isEqualTo(datasource);
  }
View Full Code Here

    Statement statement = mock(Statement.class);
    when(connection.createStatement()).thenReturn(statement);
    when(statement.execute(sql)).thenReturn(true);

    Settings settings = new Settings();
    settings.setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.FULL.toString());

    BasicDataSource resultDataSource = PersistenceProfiling.addProfilingIfNeeded(originDataSource , settings);

    assertThat(resultDataSource).isInstanceOf(ProfilingDataSource.class);
    assertThat(resultDataSource.getUrl()).isNull();
View Full Code Here

TOP

Related Classes of org.sonar.api.config.Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.