diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2017-10-17 18:16:28 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk@users.noreply.github.com> | 2017-10-19 12:12:11 +0200 |
commit | 8cbb514261e2af99b4ee7f79a5c1210e1cee3714 (patch) | |
tree | 021da2b2a022f581649e37f71f281231a8e0a6f8 /sonar-core | |
parent | d9564eed6baf772c31d3ee2888dffc7d8c51fca2 (diff) | |
download | sonarqube-8cbb514261e2af99b4ee7f79a5c1210e1cee3714.tar.gz sonarqube-8cbb514261e2af99b4ee7f79a5c1210e1cee3714.zip |
SONAR-7309 DB Cleaner strategy to keep only analyses with a version
Diffstat (limited to 'sonar-core')
4 files changed, 14 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/config/PurgeConstants.java b/sonar-core/src/main/java/org/sonar/core/config/PurgeConstants.java index 01703c9f30a..966d3f9ab2d 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/PurgeConstants.java +++ b/sonar-core/src/main/java/org/sonar/core/config/PurgeConstants.java @@ -25,6 +25,7 @@ public interface PurgeConstants { String HOURS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_DAY = "sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay"; String WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_WEEK = "sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByWeek"; String WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH = "sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByMonth"; + String WEEKS_BEFORE_KEEPING_ONLY_ANALYSES_WITH_VERSION = "sonar.dbcleaner.weeksBeforeKeepingOnlyAnalysesWithVersion"; String WEEKS_BEFORE_DELETING_ALL_SNAPSHOTS = "sonar.dbcleaner.weeksBeforeDeletingAllSnapshots"; String DAYS_BEFORE_DELETING_CLOSED_ISSUES = "sonar.dbcleaner.daysBeforeDeletingClosedIssues"; String DAYS_BEFORE_DELETING_INACTIVE_SHORT_LIVING_BRANCHES = "sonar.dbcleaner.daysBeforeDeletingInactiveShortLivingBranches"; diff --git a/sonar-core/src/main/java/org/sonar/core/config/PurgeProperties.java b/sonar-core/src/main/java/org/sonar/core/config/PurgeProperties.java index 89a210879e1..35f5bccca3d 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/PurgeProperties.java +++ b/sonar-core/src/main/java/org/sonar/core/config/PurgeProperties.java @@ -101,6 +101,17 @@ public final class PurgeProperties { .category(CoreProperties.CATEGORY_GENERAL) .subCategory(CoreProperties.SUBCATEGORY_DATABASE_CLEANER) .index(6) + .build(), + + PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_KEEPING_ONLY_ANALYSES_WITH_VERSION) + .defaultValue("104") + .name("Keep only analyses with a version event after") + .description("After this number of weeks, the DbCleaner keeps only analyses with a version event associated.") + .type(PropertyType.INTEGER) + .onQualifiers(Qualifiers.PROJECT) + .category(CoreProperties.CATEGORY_GENERAL) + .subCategory(CoreProperties.SUBCATEGORY_DATABASE_CLEANER) + .index(7) .build() ); } diff --git a/sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java b/sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java index aa7bcd07d0d..4144587b4be 100644 --- a/sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java @@ -33,7 +33,7 @@ public class CorePropertyDefinitionsTest { @Test public void all() { List<PropertyDefinition> defs = CorePropertyDefinitions.all(); - assertThat(defs).hasSize(66); + assertThat(defs).hasSize(67); } @Test diff --git a/sonar-core/src/test/java/org/sonar/core/config/PurgePropertiesTest.java b/sonar-core/src/test/java/org/sonar/core/config/PurgePropertiesTest.java index 1bbff174768..32e1eb02ae3 100644 --- a/sonar-core/src/test/java/org/sonar/core/config/PurgePropertiesTest.java +++ b/sonar-core/src/test/java/org/sonar/core/config/PurgePropertiesTest.java @@ -27,6 +27,6 @@ public class PurgePropertiesTest { @Test public void shouldGetExtensions() { - assertThat(PurgeProperties.all()).hasSize(6); + assertThat(PurgeProperties.all()).hasSize(7); } } |