use of org.sonar.api.config.internal.Encryption 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"));
}
use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class UpdateGithubActionTest 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().insertGitHubAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("newKey", "GitHub Server - Infra Team").setParam("url", "https://github.enterprise-unicorn.com").setParam("appId", "54321").setParam("privateKey", "10987654321").setParam("clientId", "client_1234").setParam("clientSecret", "client_so_secret").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getUrl, AlmSettingDto::getAppId, s -> s.getDecryptedPrivateKey(encryption), AlmSettingDto::getClientId, s -> s.getDecryptedClientSecret(encryption)).containsOnly(tuple("GitHub Server - Infra Team", "https://github.enterprise-unicorn.com", "54321", "10987654321", "client_1234", "client_so_secret"));
}
use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class UpdateGithubActionTest method update_url_with_trailing_slash.
@Test
public void update_url_with_trailing_slash() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertGitHubAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("url", "https://github.enterprise-unicorn.com/").setParam("appId", "54321").setParam("privateKey", "10987654321").setParam("clientId", "client_1234").setParam("clientSecret", "client_so_secret").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getUrl, AlmSettingDto::getAppId, s -> s.getDecryptedPrivateKey(encryption), AlmSettingDto::getClientId, s -> s.getDecryptedClientSecret(encryption)).containsOnly(tuple(almSettingDto.getKey(), "https://github.enterprise-unicorn.com", "54321", "10987654321", "client_1234", "client_so_secret"));
}
use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class UpdateGithubActionTest method update.
@Test
public void update() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
AlmSettingDto almSettingDto = db.almSettings().insertGitHubAlmSetting();
ws.newRequest().setParam("key", almSettingDto.getKey()).setParam("url", "https://github.enterprise-unicorn.com").setParam("appId", "54321").setParam("privateKey", "10987654321").setParam("clientId", "client_1234").setParam("clientSecret", "client_so_secret").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getUrl, AlmSettingDto::getAppId, s -> s.getDecryptedPrivateKey(encryption), AlmSettingDto::getClientId, s -> s.getDecryptedClientSecret(encryption)).containsOnly(tuple(almSettingDto.getKey(), "https://github.enterprise-unicorn.com", "54321", "10987654321", "client_1234", "client_so_secret"));
}
use of org.sonar.api.config.internal.Encryption in project sonarqube by SonarSource.
the class CreateGitlabActionTest method create_with_url.
@Test
public void create_with_url() {
UserDto user = db.users().insertUser();
userSession.logIn(user).setSystemAdministrator();
ws.newRequest().setParam("key", "Gitlab - Dev Team").setParam("url", GITLAB_URL).setParam("personalAccessToken", "98765432100").execute();
assertThat(db.getDbClient().almSettingDao().selectAll(db.getSession())).extracting(AlmSettingDto::getKey, AlmSettingDto::getUrl, s -> s.getDecryptedPersonalAccessToken(encryption)).containsOnly(tuple("Gitlab - Dev Team", GITLAB_URL, "98765432100"));
}
Aggregations