use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class DefaultDatabaseTest method shouldGuessDefaultDriver.
@Test
public void shouldGuessDefaultDriver() {
Settings settings = new MapSettings();
settings.setProperty("sonar.jdbc.url", "jdbc:postgresql://localhost/sonar");
DefaultDatabase database = new DefaultDatabase(logbackHelper, settings);
database.initSettings();
assertThat(database.getProperties().getProperty("sonar.jdbc.driverClassName")).isEqualTo("org.postgresql.Driver");
}
use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class DefaultDatabaseTest method shouldCompleteProperties.
@Test
public void shouldCompleteProperties() {
Settings settings = new MapSettings();
DefaultDatabase db = new DefaultDatabase(logbackHelper, settings) {
@Override
protected void doCompleteProperties(Properties properties) {
properties.setProperty("sonar.jdbc.maxActive", "2");
}
};
db.initSettings();
Properties props = db.getProperties();
assertThat(props.getProperty("sonar.jdbc.maxActive")).isEqualTo("2");
}
use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class SettingsRepositoryTest method get_project_settings_from_db.
@Test
public void get_project_settings_from_db() {
ComponentDto project = ComponentTesting.newProjectDto(dbTester.organizations().insert()).setKey(ROOT.getKey());
dbClient.componentDao().insert(session, project);
dbClient.propertiesDao().saveProperty(session, new PropertyDto().setResourceId(project.getId()).setKey("key").setValue("value"));
session.commit();
Settings settings = underTest.getSettings(ROOT);
assertThat(settings.getString("key")).isEqualTo("value");
}
use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class NotificationDaemonTest method setUpMocks.
private void setUpMocks() {
when(emailChannel.getKey()).thenReturn("email");
when(gtalkChannel.getKey()).thenReturn("gtalk");
when(commentOnIssueAssignedToMe.getKey()).thenReturn("CommentOnIssueAssignedToMe");
when(commentOnIssueAssignedToMe.getType()).thenReturn("issue-changes");
when(commentOnIssueCreatedByMe.getKey()).thenReturn("CommentOnIssueCreatedByMe");
when(commentOnIssueCreatedByMe.getType()).thenReturn("issue-changes");
when(qualityGateChange.getKey()).thenReturn("QGateChange");
when(qualityGateChange.getType()).thenReturn("qgate-changes");
when(manager.getFromQueue()).thenReturn(notification).thenReturn(null);
Settings settings = new MapSettings().setProperty("sonar.notifications.delay", 1L);
underTest = new NotificationDaemon(settings, manager, service);
}
use of org.sonar.api.config.Settings in project sonarqube by SonarSource.
the class NotificationDaemonTest method getDispatchers_empty.
@Test
public void getDispatchers_empty() {
Settings settings = new MapSettings().setProperty("sonar.notifications.delay", 1L);
service = new NotificationService(dbClient);
assertThat(service.getDispatchers()).hasSize(0);
}
Aggregations