]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7309 Reorder DB Cleaner settings and replace snapshot by analysis
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 18 Oct 2017 14:40:46 +0000 (16:40 +0200)
committerTeryk Bellahsene <teryk@users.noreply.github.com>
Thu, 19 Oct 2017 10:12:11 +0000 (12:12 +0200)
sonar-core/src/main/java/org/sonar/core/config/PurgeProperties.java
tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectAdministrationTest.java

index 35f5bccca3da769468b182e1c80c87681f87f8c6..c0ae43a6641bab83bcdbabe0e600c4d7acca1e37 100644 (file)
@@ -34,21 +34,23 @@ public final class PurgeProperties {
 
   public static List<PropertyDefinition> all() {
     return asList(
-      PropertyDefinition.builder(PurgeConstants.PROPERTY_CLEAN_DIRECTORY)
-        .defaultValue("true")
-        .name("Clean directory/package history")
-        .description("If set to true, no history is kept at directory/package level. Setting this to false can cause database bloat.")
-        .type(PropertyType.BOOLEAN)
+      PropertyDefinition.builder(PurgeConstants.HOURS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_DAY)
+        .defaultValue("24")
+        .name("Keep only one analysis a day after")
+        .description("After this number of hours, if there are several analyses during the same day, "
+          + "the DbCleaner keeps the most recent one and fully deletes the other ones.")
+        .type(PropertyType.INTEGER)
         .onQualifiers(Qualifiers.PROJECT)
         .category(CoreProperties.CATEGORY_GENERAL)
         .subCategory(CoreProperties.SUBCATEGORY_DATABASE_CLEANER)
         .index(1)
         .build(),
 
-      PropertyDefinition.builder(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES)
-        .defaultValue("30")
-        .name("Delete closed issues after")
-        .description("Issues that have been closed for more than this number of days will be deleted.")
+      PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_WEEK)
+        .defaultValue("4")
+        .name("Keep only one analysis a week after")
+        .description("After this number of weeks, if there are several analyses during the same week, "
+          + "the DbCleaner keeps the most recent one and fully deletes the other ones")
         .type(PropertyType.INTEGER)
         .onQualifiers(Qualifiers.PROJECT)
         .category(CoreProperties.CATEGORY_GENERAL)
@@ -56,10 +58,10 @@ public final class PurgeProperties {
         .index(2)
         .build(),
 
-      PropertyDefinition.builder(PurgeConstants.HOURS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_DAY)
-        .defaultValue("24")
-        .name("Keep only one snapshot a day after")
-        .description("After this number of hours, if there are several snapshots during the same day, "
+      PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH)
+        .defaultValue("52")
+        .name("Keep only one analysis a month after")
+        .description("After this number of weeks, if there are several analyses during the same month, "
           + "the DbCleaner keeps the most recent one and fully deletes the other ones.")
         .type(PropertyType.INTEGER)
         .onQualifiers(Qualifiers.PROJECT)
@@ -68,11 +70,11 @@ public final class PurgeProperties {
         .index(3)
         .build(),
 
-      PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_WEEK)
-        .defaultValue("4")
-        .name("Keep only one snapshot a week after")
-        .description("After this number of weeks, if there are several snapshots during the same week, "
-          + "the DbCleaner keeps the most recent one and fully deletes the other ones")
+
+      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)
@@ -80,11 +82,10 @@ public final class PurgeProperties {
         .index(4)
         .build(),
 
-      PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_KEEPING_ONLY_ONE_SNAPSHOT_BY_MONTH)
-        .defaultValue("52")
-        .name("Keep only one snapshot a month after")
-        .description("After this number of weeks, if there are several snapshots during the same month, "
-          + "the DbCleaner keeps the most recent one and fully deletes the other ones.")
+      PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_DELETING_ALL_SNAPSHOTS)
+        .defaultValue("260")
+        .name("Delete all analyses after")
+        .description("After this number of weeks, all analyses are fully deleted.")
         .type(PropertyType.INTEGER)
         .onQualifiers(Qualifiers.PROJECT)
         .category(CoreProperties.CATEGORY_GENERAL)
@@ -92,10 +93,10 @@ public final class PurgeProperties {
         .index(5)
         .build(),
 
-      PropertyDefinition.builder(PurgeConstants.WEEKS_BEFORE_DELETING_ALL_SNAPSHOTS)
-        .defaultValue("260")
-        .name("Delete all snapshots after")
-        .description("After this number of weeks, all snapshots are fully deleted.")
+      PropertyDefinition.builder(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES)
+        .defaultValue("30")
+        .name("Delete closed issues after")
+        .description("Issues that have been closed for more than this number of days will be deleted.")
         .type(PropertyType.INTEGER)
         .onQualifiers(Qualifiers.PROJECT)
         .category(CoreProperties.CATEGORY_GENERAL)
@@ -103,11 +104,11 @@ public final class PurgeProperties {
         .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)
+      PropertyDefinition.builder(PurgeConstants.PROPERTY_CLEAN_DIRECTORY)
+        .defaultValue("true")
+        .name("Clean directory/package history")
+        .description("If set to true, no history is kept at directory/package level. Setting this to false can cause database bloat.")
+        .type(PropertyType.BOOLEAN)
         .onQualifiers(Qualifiers.PROJECT)
         .category(CoreProperties.CATEGORY_GENERAL)
         .subCategory(CoreProperties.SUBCATEGORY_DATABASE_CLEANER)
index b001176c914e4dba116384701b4c9f89cd6c8561..b2f72b1017c152b118f5045e84328983e13326fa 100644 (file)
@@ -184,7 +184,7 @@ public class ProjectAdministrationTest {
       .assertMenuContains("DEV")
       .assertMenuContains("project-only")
       .assertMenuContains("Xoo")
-      .assertSettingDisplayed("sonar.dbcleaner.daysBeforeDeletingClosedIssues");
+      .assertSettingDisplayed("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay");
 
     page.openCategory("project-only")
       .assertSettingDisplayed("prop_only_on_project");
@@ -193,8 +193,8 @@ public class ProjectAdministrationTest {
       .assertStringSettingValue("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "30")
       .assertStringSettingValue("sonar.leak.period", "previous_version")
       .assertBooleanSettingValue("sonar.dbcleaner.cleanDirectory", true)
-      .setStringValue("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "1")
-      .assertStringSettingValue("sonar.dbcleaner.daysBeforeDeletingClosedIssues", "1");
+      .setStringValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48")
+      .assertStringSettingValue("sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "48");
   }
 
   @Test