use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class GithubGlobalSettingsValidatorTest method github_validation_checks_missing_clientSecret.
@Test
public void github_validation_checks_missing_clientSecret() {
AlmSettingDto almSettingDto = createNewGithubDto("clientId", null, EXAMPLE_APP_ID, null);
assertThatThrownBy(() -> underTest.validate(almSettingDto)).isInstanceOf(IllegalArgumentException.class).hasMessage("Missing Client Secret");
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class GitlabGlobalSettingsValidatorTest method validate_success_with_encrypted_token.
@Test
public void validate_success_with_encrypted_token() {
String encryptedToken = "personal-access-token";
String decryptedToken = "decrypted-token";
AlmSettingDto almSettingDto = new AlmSettingDto().setUrl("https://gitlab.com/api").setPersonalAccessToken(encryptedToken);
when(encryption.isEncrypted(encryptedToken)).thenReturn(true);
when(encryption.decrypt(encryptedToken)).thenReturn(decryptedToken);
underTest.validate(almSettingDto);
verify(gitlabHttpClient, times(1)).checkUrl(almSettingDto.getUrl());
verify(gitlabHttpClient, times(1)).checkToken(almSettingDto.getUrl(), decryptedToken);
verify(gitlabHttpClient, times(1)).checkReadPermission(almSettingDto.getUrl(), decryptedToken);
verify(gitlabHttpClient, times(1)).checkWritePermission(almSettingDto.getUrl(), decryptedToken);
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class GitlabGlobalSettingsValidatorTest method validate_fail_url_not_set.
@Test
public void validate_fail_url_not_set() {
AlmSettingDto almSettingDto = new AlmSettingDto().setUrl(null).setPersonalAccessToken("personal-access-token");
assertThatThrownBy(() -> underTest.validate(almSettingDto)).isInstanceOf(IllegalArgumentException.class).hasMessage("Your Gitlab global configuration is incomplete.");
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class GitlabGlobalSettingsValidatorTest method validate_fail_pat_not_set.
@Test
public void validate_fail_pat_not_set() {
AlmSettingDto almSettingDto = new AlmSettingDto().setUrl("https://gitlab.com/api").setPersonalAccessToken(null);
assertThatThrownBy(() -> underTest.validate(almSettingDto)).isInstanceOf(IllegalArgumentException.class).hasMessage("Your Gitlab global configuration is incomplete.");
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class AzureDevOpsValidatorTest method validate_givenHttpClientNotThrowingException_doesNotThrowException.
@Test(expected = Test.None.class)
public void validate_givenHttpClientNotThrowingException_doesNotThrowException() {
AlmSettingDto dto = createMockDto();
underTest.validate(dto);
}
Aggregations