From 00a4a9c77601ff6a1ea9516b7edc77b20f8a17c0 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Thu, 28 Jan 2021 10:20:38 -0600 Subject: SONAR-14393 Add configuration for Bitbucket Cloud settings --- .../java/org/sonar/db/almsettings/AlmSettingsDbTester.java | 6 ++++++ .../java/org/sonar/db/almsettings/AlmSettingsTesting.java | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'server/sonar-db-dao/src/testFixtures/java/org') diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsDbTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsDbTester.java index 8b27ec27dea..29d2bbc718b 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsDbTester.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsDbTester.java @@ -30,6 +30,7 @@ import static org.sonar.db.almsettings.AlmSettingsTesting.newAzureAlmSettingDto; import static org.sonar.db.almsettings.AlmSettingsTesting.newAzureProjectAlmSettingDto; import static org.sonar.db.almsettings.AlmSettingsTesting.newBitbucketAlmSettingDto; import static org.sonar.db.almsettings.AlmSettingsTesting.newBitbucketCloudAlmSettingDto; +import static org.sonar.db.almsettings.AlmSettingsTesting.newBitbucketCloudProjectAlmSettingDto; import static org.sonar.db.almsettings.AlmSettingsTesting.newBitbucketProjectAlmSettingDto; import static org.sonar.db.almsettings.AlmSettingsTesting.newGithubAlmSettingDto; import static org.sonar.db.almsettings.AlmSettingsTesting.newGithubProjectAlmSettingDto; @@ -96,6 +97,11 @@ public class AlmSettingsDbTester { return insertProjectAlmSetting(newGitlabProjectAlmSettingDto(gitlabAlmSetting, project), populators); } + @SafeVarargs + public final ProjectAlmSettingDto insertBitbucketCloudProjectAlmSetting(AlmSettingDto bbCloudAlmSetting, ProjectDto project, Consumer... populators) { + return insertProjectAlmSetting(newBitbucketCloudProjectAlmSettingDto(bbCloudAlmSetting, project), populators); + } + @SafeVarargs public final ProjectAlmSettingDto insertBitbucketProjectAlmSetting(AlmSettingDto bitbucketAlmSetting, ProjectDto project, Consumer... populators) { return insertProjectAlmSetting(newBitbucketProjectAlmSettingDto(bitbucketAlmSetting, project), populators); diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsTesting.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsTesting.java index bb3ce347d9a..02ea532af16 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsTesting.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/almsettings/AlmSettingsTesting.java @@ -66,6 +66,7 @@ public class AlmSettingsTesting { return new AlmSettingDto() .setKey(randomAlphanumeric(200)) .setClientId(randomAlphanumeric(50)) + .setAppId(randomAlphanumeric(80)) .setClientSecret(randomAlphanumeric(50)) .setAlm(ALM.BITBUCKET_CLOUD); } @@ -95,12 +96,20 @@ public class AlmSettingsTesting { .setMonorepo(false); } - public static ProjectAlmSettingDto newBitbucketProjectAlmSettingDto(AlmSettingDto githubAlmSetting, ProjectDto project) { + public static ProjectAlmSettingDto newBitbucketProjectAlmSettingDto(AlmSettingDto bitbucketAlmSetting, ProjectDto project) { return new ProjectAlmSettingDto() - .setAlmSettingUuid(githubAlmSetting.getUuid()) + .setAlmSettingUuid(bitbucketAlmSetting.getUuid()) .setProjectUuid(project.getUuid()) .setAlmRepo(randomAlphanumeric(256)) .setAlmSlug(randomAlphanumeric(256)) .setMonorepo(false); } + + public static ProjectAlmSettingDto newBitbucketCloudProjectAlmSettingDto(AlmSettingDto bitbucketCloudAlmSetting, ProjectDto project) { + return new ProjectAlmSettingDto() + .setAlmSettingUuid(bitbucketCloudAlmSetting.getUuid()) + .setProjectUuid(project.getUuid()) + .setAlmRepo(randomAlphanumeric(256)) + .setMonorepo(false); + } } -- cgit v1.2.3