use of org.sonar.api.config.internal.Settings in project sonarqube by SonarSource.
the class CreateDb method main.
public static void main(String[] args) {
createDb(configuration -> {
Settings settings = new MapSettings();
configuration.asMap().forEach(settings::setProperty);
logJdbcSettings(settings);
SQDatabase.newDatabase(settings, true).start();
});
}
use of org.sonar.api.config.internal.Settings in project sonarqube by SonarSource.
the class ValidateActionTest method github_validation_checks.
@Test
public void github_validation_checks() {
AlmSettingDto almSetting = insertAlmSetting(db.almSettings().insertGitHubAlmSetting(settings -> settings.setClientId("clientId").setClientSecret("clientSecret")));
when(encryption.isEncrypted(any())).thenReturn(false);
ws.newRequest().setParam("key", almSetting.getKey()).execute();
ArgumentCaptor<AlmSettingDto> almSettingDtoArgumentCaptor = ArgumentCaptor.forClass(AlmSettingDto.class);
verify(githubGlobalSettingsValidator).validate(almSettingDtoArgumentCaptor.capture());
assertThat(almSettingDtoArgumentCaptor.getAllValues()).hasSize(1);
assertThat(almSettingDtoArgumentCaptor.getValue().getClientId()).isEqualTo(almSetting.getClientId());
assertThat(almSettingDtoArgumentCaptor.getValue().getDecryptedClientSecret(encryption)).isEqualTo(almSetting.getDecryptedClientSecret(encryption));
assertThat(almSettingDtoArgumentCaptor.getValue().getAlm()).isEqualTo(almSetting.getAlm());
assertThat(almSettingDtoArgumentCaptor.getValue().getAppId()).isEqualTo(almSetting.getAppId());
}
use of org.sonar.api.config.internal.Settings in project sonarqube by SonarSource.
the class ValidateActionTest method github_validation_checks_with_encrypted_secret.
@Test
public void github_validation_checks_with_encrypted_secret() {
String secret = "encrypted-secret";
String decryptedSecret = "decrypted-secret";
AlmSettingDto almSetting = insertAlmSetting(db.almSettings().insertGitHubAlmSetting(settings -> settings.setClientId("clientId").setClientSecret(secret)));
when(encryption.isEncrypted(secret)).thenReturn(true);
when(encryption.decrypt(secret)).thenReturn(decryptedSecret);
ws.newRequest().setParam("key", almSetting.getKey()).execute();
ArgumentCaptor<AlmSettingDto> almSettingDtoArgumentCaptor = ArgumentCaptor.forClass(AlmSettingDto.class);
verify(githubGlobalSettingsValidator).validate(almSettingDtoArgumentCaptor.capture());
assertThat(almSettingDtoArgumentCaptor.getAllValues()).hasSize(1);
assertThat(almSettingDtoArgumentCaptor.getValue().getClientId()).isEqualTo(almSetting.getClientId());
assertThat(almSettingDtoArgumentCaptor.getValue().getDecryptedClientSecret(encryption)).isEqualTo(decryptedSecret);
assertThat(almSettingDtoArgumentCaptor.getValue().getAlm()).isEqualTo(almSetting.getAlm());
assertThat(almSettingDtoArgumentCaptor.getValue().getAppId()).isEqualTo(almSetting.getAppId());
}
use of org.sonar.api.config.internal.Settings in project sonarqube by SonarSource.
the class NotificationMediumTest method getDispatchers_empty.
@Test
public void getDispatchers_empty() {
Settings settings = new MapSettings().setProperty("sonar.notifications.delay", 1L);
service = new NotificationService(dbClient);
assertThat(service.getDispatchers()).isEmpty();
}
use of org.sonar.api.config.internal.Settings in project sonarqube by SonarSource.
the class ProjectConfigurationFactory method newProjectConfiguration.
public Configuration newProjectConfiguration(String projectKey, Branch branch) {
Settings projectSettings = new ChildSettings(globalSettings);
addSettings(projectSettings, projectKey);
if (branch.getType() == BranchType.PULL_REQUEST) {
addSettings(projectSettings, generatePullRequestKey(projectKey, branch.getPullRequestKey()));
} else {
addSettings(projectSettings, generateBranchKey(projectKey, branch.getName()));
}
return new ConfigurationBridge(projectSettings);
}
Aggregations