diff options
author | Michal Duda <michal.duda@sonarsource.com> | 2019-11-13 14:16:48 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-12-09 20:46:15 +0100 |
commit | 39f7a382198e93e0b818b34e1aa98da6c3a79f69 (patch) | |
tree | e4ec6274e2e04b348770699c21fac0a583c0ff80 /server/sonar-db-dao | |
parent | 4244d2ea76411f80d1ce9da40eefe2781c404327 (diff) | |
download | sonarqube-39f7a382198e93e0b818b34e1aa98da6c3a79f69.tar.gz sonarqube-39f7a382198e93e0b818b34e1aa98da6c3a79f69.zip |
SONAR-12636 set `excludeFromPurge` on branch creation based on global settings
Diffstat (limited to 'server/sonar-db-dao')
3 files changed, 4 insertions, 2 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java index dd5cb0d599d..7ca59766678 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java @@ -177,8 +177,9 @@ public class BranchDto { return excludeFromPurge; } - public void setExcludeFromPurge(boolean excludeFromPurge) { + public BranchDto setExcludeFromPurge(boolean excludeFromPurge) { this.excludeFromPurge = excludeFromPurge; + return this; } private static byte[] encodePullRequestData(DbProjectBranches.PullRequestData pullRequestData) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeConfiguration.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeConfiguration.java index c707615368f..0cb95299a38 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeConfiguration.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeConfiguration.java @@ -55,7 +55,7 @@ public class PurgeConfiguration { public static PurgeConfiguration newDefaultPurgeConfiguration(Configuration config, String rootUuid, String projectUuid, Set<String> disabledComponentUuids) { return new PurgeConfiguration(rootUuid, projectUuid, Arrays.asList(Scopes.DIRECTORY, Scopes.FILE), config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES).get(), - config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_INACTIVE_BRANCHES), System2.INSTANCE, disabledComponentUuids); + config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_INACTIVE_BRANCHES_AND_PRS), System2.INSTANCE, disabledComponentUuids); } /** diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java index ac8ee748a01..7c1f79e5701 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/component/ComponentDbTester.java @@ -253,6 +253,7 @@ public class ComponentDbTester { public final ComponentDto insertMainBranch(ComponentDto project) { BranchDto branchDto = ComponentTesting.newBranchDto(project, BRANCH); + branchDto.setExcludeFromPurge(true); insertComponent(project); dbClient.branchDao().insert(dbSession, branchDto); db.commit(); |