use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class ListDefinitionsActionTest method list_is_ordered_by_create_date.
@Test
public void list_is_ordered_by_create_date() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
when(system2.now()).thenReturn(10_000_000_000L);
AlmSettingDto almSetting1 = db.almSettings().insertGitHubAlmSetting();
when(system2.now()).thenReturn(30_000_000_000L);
AlmSettingDto almSetting2 = db.almSettings().insertGitHubAlmSetting();
when(system2.now()).thenReturn(20_000_000_000L);
AlmSettingDto almSetting3 = db.almSettings().insertGitHubAlmSetting();
ListDefinitionsWsResponse wsResponse = ws.newRequest().executeProtobuf(ListDefinitionsWsResponse.class);
assertThat(wsResponse.getGithubList()).extracting(AlmSettingGithub::getKey).containsExactly(almSetting1.getKey(), almSetting3.getKey(), almSetting2.getKey());
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class ListDefinitionsActionTest method list_bitbucket_cloud_settings.
@Test
public void list_bitbucket_cloud_settings() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSetting1 = db.almSettings().insertBitbucketCloudAlmSetting(alm -> alm.setClientId("1").setClientSecret("2"));
AlmSettingDto almSetting2 = db.almSettings().insertBitbucketCloudAlmSetting(alm -> alm.setClientId("client_id").setClientSecret("client_secret"));
ListDefinitionsWsResponse wsResponse = ws.newRequest().executeProtobuf(ListDefinitionsWsResponse.class);
assertThat(wsResponse.getBitbucketcloudList()).extracting(AlmSettings.AlmSettingBitbucketCloud::getKey, AlmSettings.AlmSettingBitbucketCloud::getClientId).containsExactlyInAnyOrder(tuple(almSetting1.getKey(), "1"), tuple(almSetting2.getKey(), "client_id"));
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class UpdateBitbucketActionTest method update_with_new_key.
@Test
public void update_with_new_key() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertBitbucketAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("newKey", "Bitbucket Server - Infra Team").setParam("url", "https://bitbucket.enterprise-unicorn.com").setParam("personalAccessToken", "0123456789").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getUrl, s -> s.getDecryptedPersonalAccessToken(encryption)).containsOnly(tuple("Bitbucket Server - Infra Team", "https://bitbucket.enterprise-unicorn.com", "0123456789"));
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class UpdateBitbucketActionTest method update_without_pat.
@Test
public void update_without_pat() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertBitbucketAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("url", "https://bitbucket.enterprise-unicorn.com").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getUrl, s -> s.getDecryptedPersonalAccessToken(encryption)).containsOnly(tuple(almSettingDto.getKey(), "https://bitbucket.enterprise-unicorn.com", almSettingDto.getDecryptedPersonalAccessToken(encryption)));
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class UpdateBitbucketActionTest method update.
@Test
public void update() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertBitbucketAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("url", "https://bitbucket.enterprise-unicorn.com").setParam("personalAccessToken", "10987654321").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getUrl, s -> s.getDecryptedPersonalAccessToken(encryption)).containsOnly(tuple(almSettingDto.getKey(), "https://bitbucket.enterprise-unicorn.com", "10987654321"));
}
Aggregations