]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7453 Rename rules remediation function fields in DB
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 8 Mar 2016 18:10:08 +0000 (19:10 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 10 Mar 2016 14:20:12 +0000 (15:20 +0100)
"effort_to_fix_description" becomes "gap_description"
"remediation_coeff" becomes "remediation_gap_mult"
"default_remediation_coeff" becomes "default_remediation_gap_mult"
"remediation_offset" becomes "remediation_base_effort"
"default_remediation_offset" becomes "default_remediation_base_effort"

30 files changed:
server/sonar-server/src/main/java/org/sonar/server/computation/issue/RuleImpl.java
server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java
server/sonar-server/src/main/java/org/sonar/server/rule/RegisterRules.java
server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java
server/sonar-server/src/main/java/org/sonar/server/rule/RuleOperations.java
server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java
server/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleMapper.java
server/sonar-server/src/main/java/org/sonar/server/startup/ClearRulesOverloadedDebt.java
server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RegisterRulesTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RuleCreatorMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RuleOperationsTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/RuleUpdaterMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/ws/SearchActionMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/ws/ShowActionMediumTest.java
server/sonar-server/src/test/java/org/sonar/server/startup/ClearRulesOverloadedDebtTest.java
server/sonar-server/src/test/resources/org/sonar/server/computation/step/PersistIssuesStepTest/shared.xml
server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupMediumTest/shared.xml
server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1117_rename_rules_columns.rb [new file with mode: 0644]
sonar-db/src/main/java/org/sonar/db/rule/RuleDto.java
sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java
sonar-db/src/main/resources/org/sonar/db/rule/RuleMapper.xml
sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql
sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl
sonar-db/src/test/java/org/sonar/db/rule/RuleDaoTest.java
sonar-db/src/test/java/org/sonar/db/rule/RuleTesting.java
sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter-result.xml
sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/insert_parameter.xml
sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabledAndNonManual.xml

index a094a4c00e112dd5e65b618b5a9ccf0930f41186..b7c91f3e5c517371c07d9dfcfb444b19a46f92de 100644 (file)
@@ -121,11 +121,11 @@ public class RuleImpl implements Rule {
   private static DebtRemediationFunction effectiveRemediationFunction(RuleDto dto) {
     String fn = dto.getRemediationFunction();
     if (fn != null) {
-      return new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.valueOf(fn), dto.getRemediationCoefficient(), dto.getRemediationOffset());
+      return new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.valueOf(fn), dto.getRemediationGapMultiplier(), dto.getRemediationBaseEffort());
     }
     String defaultFn = dto.getDefaultRemediationFunction();
     if (defaultFn != null) {
-      return new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.valueOf(defaultFn), dto.getDefaultRemediationCoefficient(), dto.getDefaultRemediationOffset());
+      return new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.valueOf(defaultFn), dto.getDefaultRemediationGapMultiplier(), dto.getDefaultRemediationBaseEffort());
     }
     return null;
   }
index ad69b0639a4078ae57c1b223b223d6cfdd5f1d68..abb8f896c03f2af45854716ed4e02417c4a702b9 100644 (file)
@@ -150,14 +150,14 @@ public class DebtModelBackup {
         boolean hasDebtDefinition = remediationFunction != null;
 
         rule.setDefaultRemediationFunction(hasDebtDefinition ? remediationFunction.type().name() : null);
-        rule.setDefaultRemediationCoefficient(hasDebtDefinition ? remediationFunction.coefficient() : null);
-        rule.setDefaultRemediationOffset(hasDebtDefinition ? remediationFunction.offset() : null);
+        rule.setDefaultRemediationGapMultiplier(hasDebtDefinition ? remediationFunction.coefficient() : null);
+        rule.setDefaultRemediationBaseEffort(hasDebtDefinition ? remediationFunction.offset() : null);
       }
 
       // Reset overridden debt definitions
       rule.setRemediationFunction(null);
-      rule.setRemediationCoefficient(null);
-      rule.setRemediationOffset(null);
+      rule.setRemediationGapMultiplier(null);
+      rule.setRemediationBaseEffort(null);
       rule.setUpdatedAt(updateDate);
       dbClient.ruleDao().update(session, rule);
     }
@@ -246,13 +246,13 @@ public class DebtModelBackup {
     String defaultFunction = rule.getDefaultRemediationFunction();
     if (overriddenFunction != null) {
       ruleDebt.setFunction(overriddenFunction);
-      ruleDebt.setCoefficient(rule.getRemediationCoefficient());
-      ruleDebt.setOffset(rule.getRemediationOffset());
+      ruleDebt.setCoefficient(rule.getRemediationGapMultiplier());
+      ruleDebt.setOffset(rule.getRemediationBaseEffort());
       return ruleDebt;
     } else if (defaultFunction != null) {
       ruleDebt.setFunction(defaultFunction);
-      ruleDebt.setCoefficient(rule.getDefaultRemediationCoefficient());
-      ruleDebt.setOffset(rule.getDefaultRemediationOffset());
+      ruleDebt.setCoefficient(rule.getDefaultRemediationGapMultiplier());
+      ruleDebt.setOffset(rule.getDefaultRemediationBaseEffort());
       return ruleDebt;
     }
     return null;
index 0240aaf7af8edc2e4fce80217f8a374bb107a87c..e9dd263c302a5357075efa72aa1c98c15148347d 100644 (file)
@@ -176,7 +176,7 @@ public class RegisterRules implements Startable {
       .setName(ruleDef.name())
       .setSeverity(ruleDef.severity())
       .setStatus(ruleDef.status())
-      .setEffortToFixDescription(ruleDef.effortToFixDescription())
+      .setGapDescription(ruleDef.effortToFixDescription())
       .setSystemTags(ruleDef.tags())
       .setType(RuleType.valueOf(ruleDef.type().name()))
       .setCreatedAt(system2.now())
@@ -272,16 +272,16 @@ public class RegisterRules implements Startable {
       dto.setDefaultRemediationFunction(remediationFunction);
       changed = true;
     }
-    if (!StringUtils.equals(dto.getDefaultRemediationCoefficient(), remediationCoefficient)) {
-      dto.setDefaultRemediationCoefficient(remediationCoefficient);
+    if (!StringUtils.equals(dto.getDefaultRemediationGapMultiplier(), remediationCoefficient)) {
+      dto.setDefaultRemediationGapMultiplier(remediationCoefficient);
       changed = true;
     }
-    if (!StringUtils.equals(dto.getDefaultRemediationOffset(), remediationOffset)) {
-      dto.setDefaultRemediationOffset(remediationOffset);
+    if (!StringUtils.equals(dto.getDefaultRemediationBaseEffort(), remediationOffset)) {
+      dto.setDefaultRemediationBaseEffort(remediationOffset);
       changed = true;
     }
-    if (!StringUtils.equals(dto.getEffortToFixDescription(), effortToFixDescription)) {
-      dto.setEffortToFixDescription(effortToFixDescription);
+    if (!StringUtils.equals(dto.getGapDescription(), effortToFixDescription)) {
+      dto.setGapDescription(effortToFixDescription);
       changed = true;
     }
     return changed;
@@ -414,16 +414,16 @@ public class RegisterRules implements Startable {
       customRule.setDefaultRemediationFunction(templateRule.getDefaultRemediationFunction());
       changed = true;
     }
-    if (!StringUtils.equals(customRule.getDefaultRemediationCoefficient(), templateRule.getDefaultRemediationCoefficient())) {
-      customRule.setDefaultRemediationCoefficient(templateRule.getDefaultRemediationCoefficient());
+    if (!StringUtils.equals(customRule.getDefaultRemediationGapMultiplier(), templateRule.getDefaultRemediationGapMultiplier())) {
+      customRule.setDefaultRemediationGapMultiplier(templateRule.getDefaultRemediationGapMultiplier());
       changed = true;
     }
-    if (!StringUtils.equals(customRule.getDefaultRemediationOffset(), templateRule.getDefaultRemediationOffset())) {
-      customRule.setDefaultRemediationOffset(templateRule.getDefaultRemediationOffset());
+    if (!StringUtils.equals(customRule.getDefaultRemediationBaseEffort(), templateRule.getDefaultRemediationBaseEffort())) {
+      customRule.setDefaultRemediationBaseEffort(templateRule.getDefaultRemediationBaseEffort());
       changed = true;
     }
-    if (!StringUtils.equals(customRule.getEffortToFixDescription(), templateRule.getEffortToFixDescription())) {
-      customRule.setEffortToFixDescription(templateRule.getEffortToFixDescription());
+    if (!StringUtils.equals(customRule.getGapDescription(), templateRule.getGapDescription())) {
+      customRule.setGapDescription(templateRule.getGapDescription());
       changed = true;
     }
     if (customRule.getStatus() != templateRule.getStatus()) {
index d4f3fa32fcb18bd0b557f3120924395970e9913f..26affc8228b5caedfeef7a0765178ce4e085e57e 100644 (file)
@@ -211,9 +211,9 @@ public class RuleCreator {
       .setStatus(newRule.status())
       .setLanguage(templateRuleDto.getLanguage())
       .setDefaultRemediationFunction(templateRuleDto.getDefaultRemediationFunction())
-      .setDefaultRemediationCoefficient(templateRuleDto.getDefaultRemediationCoefficient())
-      .setDefaultRemediationOffset(templateRuleDto.getDefaultRemediationOffset())
-      .setEffortToFixDescription(templateRuleDto.getEffortToFixDescription())
+      .setDefaultRemediationGapMultiplier(templateRuleDto.getDefaultRemediationGapMultiplier())
+      .setDefaultRemediationBaseEffort(templateRuleDto.getDefaultRemediationBaseEffort())
+      .setGapDescription(templateRuleDto.getGapDescription())
       .setTags(templateRuleDto.getTags())
       .setSystemTags(templateRuleDto.getSystemTags())
       .setType(templateRuleDto.getType())
index 22849e982440733ea49f9b64522c6973422f5611..60846a424d28e8abb373c1b5cfc5ba4cdf03fa57 100644 (file)
@@ -78,16 +78,16 @@ public class RuleOperations {
       // New values are the same as the default values -> set overridden values to null
       if (isRuleDebtSameAsDefaultValues(ruleDto, newFunction, newCoefficient, newOffset)) {
         ruleDto.setRemediationFunction(null);
-        ruleDto.setRemediationCoefficient(null);
-        ruleDto.setRemediationOffset(null);
+        ruleDto.setRemediationGapMultiplier(null);
+        ruleDto.setRemediationBaseEffort(null);
         needUpdate = true;
 
         // New values are not the same as the overridden values -> update overridden values with new values
       } else if (!isRuleDebtSameAsOverriddenValues(ruleDto, newFunction, newCoefficient, newOffset)) {
         DefaultDebtRemediationFunction debtRemediationFunction = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.valueOf(newFunction), newCoefficient, newOffset);
         ruleDto.setRemediationFunction(debtRemediationFunction.type().name());
-        ruleDto.setRemediationCoefficient(debtRemediationFunction.coefficient());
-        ruleDto.setRemediationOffset(debtRemediationFunction.offset());
+        ruleDto.setRemediationGapMultiplier(debtRemediationFunction.coefficient());
+        ruleDto.setRemediationBaseEffort(debtRemediationFunction.offset());
         needUpdate = true;
       }
 
@@ -95,8 +95,8 @@ public class RuleOperations {
     } else {
       // Rule characteristic is not already disabled -> update it
       ruleDto.setRemediationFunction(null);
-      ruleDto.setRemediationCoefficient(null);
-      ruleDto.setRemediationOffset(null);
+      ruleDto.setRemediationGapMultiplier(null);
+      ruleDto.setRemediationBaseEffort(null);
       needUpdate = true;
     }
 
@@ -108,13 +108,13 @@ public class RuleOperations {
 
   private static boolean isRuleDebtSameAsDefaultValues(RuleDto ruleDto, @Nullable String newFunction,
     @Nullable String newCoefficient, @Nullable String newOffset) {
-    return isSameRemediationFunction(newFunction, newCoefficient, newOffset, ruleDto.getDefaultRemediationFunction(), ruleDto.getDefaultRemediationCoefficient(),
-      ruleDto.getDefaultRemediationOffset());
+    return isSameRemediationFunction(newFunction, newCoefficient, newOffset, ruleDto.getDefaultRemediationFunction(), ruleDto.getDefaultRemediationGapMultiplier(),
+      ruleDto.getDefaultRemediationBaseEffort());
   }
 
   private static boolean isRuleDebtSameAsOverriddenValues(RuleDto ruleDto, @Nullable String newFunction,
     @Nullable String newCoefficient, @Nullable String newOffset) {
-    return isSameRemediationFunction(newFunction, newCoefficient, newOffset, ruleDto.getRemediationFunction(), ruleDto.getRemediationCoefficient(), ruleDto.getRemediationOffset());
+    return isSameRemediationFunction(newFunction, newCoefficient, newOffset, ruleDto.getRemediationFunction(), ruleDto.getRemediationGapMultiplier(), ruleDto.getRemediationBaseEffort());
   }
 
   private static boolean isSameRemediationFunction(@Nullable String newFunction, @Nullable String newCoefficient, @Nullable String newOffset,
index 16facc8c0118ace74cfe4e523536e48583009e50..ad350b9ecf0bd4585f25a008bb7c1f8fef1a9fa9 100644 (file)
@@ -186,18 +186,18 @@ public class RuleUpdater {
     DebtRemediationFunction function = update.getDebtRemediationFunction();
     if (function == null) {
       context.rule.setRemediationFunction(null);
-      context.rule.setRemediationCoefficient(null);
-      context.rule.setRemediationOffset(null);
+      context.rule.setRemediationGapMultiplier(null);
+      context.rule.setRemediationBaseEffort(null);
     } else {
       if (isSameAsDefaultFunction(function, context.rule)) {
         // reset to default
         context.rule.setRemediationFunction(null);
-        context.rule.setRemediationCoefficient(null);
-        context.rule.setRemediationOffset(null);
+        context.rule.setRemediationGapMultiplier(null);
+        context.rule.setRemediationBaseEffort(null);
       } else {
         context.rule.setRemediationFunction(function.type().name());
-        context.rule.setRemediationCoefficient(function.coefficient());
-        context.rule.setRemediationOffset(function.offset());
+        context.rule.setRemediationGapMultiplier(function.coefficient());
+        context.rule.setRemediationBaseEffort(function.offset());
       }
     }
   }
@@ -220,8 +220,8 @@ public class RuleUpdater {
   private static boolean isSameAsDefaultFunction(DebtRemediationFunction fn, RuleDto rule) {
     return new EqualsBuilder()
       .append(fn.type().name(), rule.getDefaultRemediationFunction())
-      .append(fn.coefficient(), rule.getDefaultRemediationCoefficient())
-      .append(fn.offset(), rule.getDefaultRemediationOffset())
+      .append(fn.coefficient(), rule.getDefaultRemediationGapMultiplier())
+      .append(fn.offset(), rule.getDefaultRemediationBaseEffort())
       .isEquals();
   }
 
index 5da852ecf80a5539bb653aedf950dd8c6dad76e3..46cec77119a7bf273a5460a8f72f740a1da31748 100644 (file)
@@ -114,8 +114,8 @@ public class RuleMapper {
   }
 
   private static void setEffortToFixDescription(Rules.Rule.Builder ruleResponse, RuleDto ruleDto, Set<String> fieldsToReturn) {
-    if (shouldReturnField(fieldsToReturn, FIELD_EFFORT_TO_FIX_DESCRIPTION) && ruleDto.getEffortToFixDescription() != null) {
-      ruleResponse.setEffortToFixDescription(ruleDto.getEffortToFixDescription());
+    if (shouldReturnField(fieldsToReturn, FIELD_EFFORT_TO_FIX_DESCRIPTION) && ruleDto.getGapDescription() != null) {
+      ruleResponse.setEffortToFixDescription(ruleDto.getGapDescription());
     }
   }
 
@@ -294,12 +294,12 @@ public class RuleMapper {
 
         @Override
         public String coefficient() {
-          return ruleDto.getDefaultRemediationCoefficient();
+          return ruleDto.getDefaultRemediationGapMultiplier();
         }
 
         @Override
         public String offset() {
-          return ruleDto.getDefaultRemediationOffset();
+          return ruleDto.getDefaultRemediationBaseEffort();
         }
       };
     }
@@ -318,12 +318,12 @@ public class RuleMapper {
 
         @Override
         public String coefficient() {
-          return ruleDto.getRemediationCoefficient();
+          return ruleDto.getRemediationGapMultiplier();
         }
 
         @Override
         public String offset() {
-          return ruleDto.getRemediationOffset();
+          return ruleDto.getRemediationBaseEffort();
         }
       };
     }
index 87e9e944d5c16f0eb9c6fa48a129c2aced804df8..7e4e4b2ea1b4f4944ffc721bcd7fe565d1eb2b0e 100644 (file)
@@ -82,8 +82,8 @@ public class ClearRulesOverloadedDebt implements Startable {
     for (RuleDto rule : dbClient.ruleDao().selectAll(session)) {
       if (isDebtOverridden(rule)) {
         rule.setRemediationFunction(null);
-        rule.setRemediationCoefficient(null);
-        rule.setRemediationOffset(null);
+        rule.setRemediationGapMultiplier(null);
+        rule.setRemediationBaseEffort(null);
         rule.setUpdatedAt(system2.now());
         dbClient.ruleDao().update(session, rule);
         countClearedRules++;
@@ -96,8 +96,8 @@ public class ClearRulesOverloadedDebt implements Startable {
   }
 
   private static boolean isDebtOverridden(RuleDto ruleDto) {
-    return ruleDto.getRemediationFunction() != null || ruleDto.getRemediationCoefficient() != null
-      || ruleDto.getRemediationOffset() != null;
+    return ruleDto.getRemediationFunction() != null || ruleDto.getRemediationGapMultiplier() != null
+      || ruleDto.getRemediationBaseEffort() != null;
   }
 
   private boolean isSqalePluginInstalled(DbSession session) {
index 5219db120d3d5000f9293bd24f5b54bc4eb65eee..8059f475f049cec31ad6ca5b0129e92c4a04ae47 100644 (file)
@@ -119,12 +119,12 @@ public class DebtModelBackupTest {
         // Rule with overridden debt values
         new RuleDto().setRepositoryKey("squid").setRuleKey("UselessImportCheck")
           .setRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString())
-          .setRemediationCoefficient("2h")
-          .setRemediationOffset("15min"),
+          .setRemediationGapMultiplier("2h")
+          .setRemediationBaseEffort("15min"),
 
         // Rule with default debt values
         new RuleDto().setRepositoryKey("squid").setRuleKey("AvoidNPE")
-          .setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h")
+          .setDefaultRemediationFunction("LINEAR").setDefaultRemediationGapMultiplier("2h")
       ));
 
     underTest.backup();
@@ -173,9 +173,9 @@ public class DebtModelBackupTest {
       // -> Ony offset should be set
       new RuleDto().setRepositoryKey("squid").setRuleKey("AvoidNPE")
         .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR.toString())
-        .setDefaultRemediationCoefficient("2h")
+        .setDefaultRemediationGapMultiplier("2h")
         .setRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE.toString())
-        .setRemediationOffset("15min")
+        .setRemediationBaseEffort("15min")
       ));
 
     underTest.backup();
@@ -198,12 +198,12 @@ public class DebtModelBackupTest {
     when(ruleDao.selectEnabledAndNonManual(session)).thenReturn(newArrayList(
       new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck").setLanguage("java")
         .setRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE.toString())
-        .setRemediationOffset("15min"),
+        .setRemediationBaseEffort("15min"),
       // Should be ignored
       new RuleDto().setId(2).setRepositoryKey("checkstyle")
         .setLanguage("java2")
         .setRemediationFunction(DebtRemediationFunction.Type.LINEAR.toString())
-        .setRemediationCoefficient("2h")
+        .setRemediationGapMultiplier("2h")
       ));
 
     underTest.backup("java");
@@ -226,10 +226,10 @@ public class DebtModelBackupTest {
     when(ruleDao.selectEnabledAndNonManual(session)).thenReturn(newArrayList(
       new RuleDto().setRepositoryKey("squid").setRuleKey("NPE")
         .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR.toString())
-        .setDefaultRemediationCoefficient("2h")
+        .setDefaultRemediationGapMultiplier("2h")
         .setRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString())
-        .setRemediationCoefficient("2h")
-        .setRemediationOffset("15min")
+        .setRemediationGapMultiplier("2h")
+        .setRemediationBaseEffort("15min")
       ));
 
     RulesDefinition.Context context = new RulesDefinition.Context();
@@ -255,13 +255,13 @@ public class DebtModelBackupTest {
     RuleDto rule = ruleCaptor.getValue();
 
     assertThat(rule.getDefaultRemediationFunction()).isEqualTo("LINEAR_OFFSET");
-    assertThat(rule.getDefaultRemediationCoefficient()).isEqualTo("4h");
-    assertThat(rule.getDefaultRemediationOffset()).isEqualTo("20min");
+    assertThat(rule.getDefaultRemediationGapMultiplier()).isEqualTo("4h");
+    assertThat(rule.getDefaultRemediationBaseEffort()).isEqualTo("20min");
     assertThat(rule.getUpdatedAt()).isEqualTo(now.getTime());
 
     assertThat(rule.getRemediationFunction()).isNull();
-    assertThat(rule.getRemediationCoefficient()).isNull();
-    assertThat(rule.getRemediationOffset()).isNull();
+    assertThat(rule.getRemediationGapMultiplier()).isNull();
+    assertThat(rule.getRemediationBaseEffort()).isNull();
     assertThat(rule.getUpdatedAt()).isEqualTo(now.getTime());
   }
 
@@ -270,10 +270,10 @@ public class DebtModelBackupTest {
     when(ruleDao.selectEnabledAndNonManual(session)).thenReturn(newArrayList(
       new RuleDto().setRepositoryKey("squid").setRuleKey("NPE")
         .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR.toString())
-        .setDefaultRemediationCoefficient("2h")
+        .setDefaultRemediationGapMultiplier("2h")
         .setRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString())
-        .setRemediationCoefficient("2h")
-        .setRemediationOffset("15min")
+        .setRemediationGapMultiplier("2h")
+        .setRemediationBaseEffort("15min")
       ));
 
     RulesDefinition.Context context = new RulesDefinition.Context();
@@ -297,8 +297,8 @@ public class DebtModelBackupTest {
 
     RuleDto rule = ruleCaptor.getValue();
     assertThat(rule.getDefaultRemediationFunction()).isNull();
-    assertThat(rule.getDefaultRemediationCoefficient()).isNull();
-    assertThat(rule.getDefaultRemediationOffset()).isNull();
+    assertThat(rule.getDefaultRemediationGapMultiplier()).isNull();
+    assertThat(rule.getDefaultRemediationBaseEffort()).isNull();
     assertThat(rule.getUpdatedAt()).isEqualTo(now.getTime());
   }
 
@@ -308,13 +308,13 @@ public class DebtModelBackupTest {
       // Template rule
       new RuleDto().setId(5).setRepositoryKey("squid").setRuleKey("XPath")
         .setRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString())
-        .setRemediationCoefficient("2h")
-        .setRemediationOffset("15min"),
+        .setRemediationGapMultiplier("2h")
+        .setRemediationBaseEffort("15min"),
       // Custom rule
       new RuleDto().setId(6).setRepositoryKey("squid").setRuleKey("XPath_1369910135").setTemplateId(5)
         .setRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString())
-        .setRemediationCoefficient("2h")
-        .setRemediationOffset("15min")
+        .setRemediationGapMultiplier("2h")
+        .setRemediationBaseEffort("15min")
       ));
 
     RulesDefinition.Context context = new RulesDefinition.Context();
@@ -341,13 +341,13 @@ public class DebtModelBackupTest {
 
     assertThat(rule.getId()).isEqualTo(6);
     assertThat(rule.getDefaultRemediationFunction()).isEqualTo("LINEAR_OFFSET");
-    assertThat(rule.getDefaultRemediationCoefficient()).isEqualTo("4h");
-    assertThat(rule.getDefaultRemediationOffset()).isEqualTo("20min");
+    assertThat(rule.getDefaultRemediationGapMultiplier()).isEqualTo("4h");
+    assertThat(rule.getDefaultRemediationBaseEffort()).isEqualTo("20min");
     assertThat(rule.getUpdatedAt()).isEqualTo(now.getTime());
 
     assertThat(rule.getRemediationFunction()).isNull();
-    assertThat(rule.getRemediationCoefficient()).isNull();
-    assertThat(rule.getRemediationOffset()).isNull();
+    assertThat(rule.getRemediationGapMultiplier()).isNull();
+    assertThat(rule.getRemediationBaseEffort()).isNull();
     assertThat(rule.getUpdatedAt()).isEqualTo(now.getTime());
   }
 
@@ -373,7 +373,7 @@ public class DebtModelBackupTest {
 
     when(ruleDao.selectEnabledAndNonManual(session)).thenReturn(newArrayList(
       new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-        .setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h")
+        .setDefaultRemediationFunction("LINEAR").setDefaultRemediationGapMultiplier("2h")
       ));
 
     underTest.restoreFromXml("<xml/>");
@@ -389,7 +389,7 @@ public class DebtModelBackupTest {
   public void restore_from_xml_disable_rule_debt_when_not_in_xml_and_rule_have_default_debt_values() {
     when(ruleDao.selectEnabledAndNonManual(session)).thenReturn(newArrayList(
       new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-        .setDefaultRemediationFunction("LINEAR_OFFSET").setDefaultRemediationCoefficient("2h").setDefaultRemediationOffset("15min")
+        .setDefaultRemediationFunction("LINEAR_OFFSET").setDefaultRemediationGapMultiplier("2h").setDefaultRemediationBaseEffort("15min")
       ));
 
     underTest.restoreFromXml("<xml/>");
@@ -409,11 +409,11 @@ public class DebtModelBackupTest {
     when(ruleDao.selectEnabledAndNonManual(session)).thenReturn(newArrayList(
       new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck").setLanguage("java")
         .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR.toString())
-        .setDefaultRemediationCoefficient("2h"),
+        .setDefaultRemediationGapMultiplier("2h"),
       // Should be ignored
       new RuleDto().setId(2).setRepositoryKey("checkstyle").setLanguage("java2")
         .setRemediationFunction(DebtRemediationFunction.Type.LINEAR.toString())
-        .setRemediationCoefficient("2h")
+        .setRemediationGapMultiplier("2h")
       ));
 
     underTest.restoreFromXml("<xml/>", "java");
@@ -431,10 +431,10 @@ public class DebtModelBackupTest {
     when(ruleDao.selectEnabledAndNonManual(session)).thenReturn(newArrayList(
       // Rule does not exits in XML -> debt will be disabled
       new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck").setLanguage("java")
-        .setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h")
+        .setDefaultRemediationFunction("LINEAR").setDefaultRemediationGapMultiplier("2h")
         .setRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString())
-        .setRemediationCoefficient("2h")
-        .setRemediationOffset("15min")
+        .setRemediationGapMultiplier("2h")
+        .setRemediationBaseEffort("15min")
       ));
 
     underTest.restoreFromXml("<xml/>", "java");
@@ -469,7 +469,7 @@ public class DebtModelBackupTest {
 
     when(ruleDao.selectEnabledAndNonManual(session)).thenReturn(newArrayList(
       new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-        .setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h")
+        .setDefaultRemediationFunction("LINEAR").setDefaultRemediationGapMultiplier("2h")
       ));
 
     when(ruleOperations.updateRule(any(RuleDto.class), anyString(), anyString(), anyString(), eq(session))).thenThrow(IllegalArgumentException.class);
index 4fb4f5d0b036c1995136b68102141c430da6d463..db7037386bbb20544932e39a0e2e7fd43493fef1 100644 (file)
@@ -298,7 +298,7 @@ public class RegisterRulesMediumTest {
     assertThat(customRule.getSeverityString()).isEqualTo(Severity.BLOCKER);
     assertThat(customRule.getStatus()).isEqualTo(RuleStatus.BETA);
     assertThat(customRule.getDefaultRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name());
-    assertThat(customRule.getEffortToFixDescription()).isEqualTo("Effort");
+    assertThat(customRule.getGapDescription()).isEqualTo("Effort");
 
     assertThat(ruleIndex.search(new RuleQuery().setKey(customRuleKey.toString()), new SearchOptions()).getTotal()).isEqualTo(1);
   }
index 4c7ae491e2873038717ca1297ac7c8f16666de5b..6f46e1d31e8f9193962a81d7bf825faba0caa62c 100644 (file)
@@ -109,8 +109,8 @@ public class RegisterRulesTest {
     assertThat(rule1.getCreatedAt()).isEqualTo(DATE1.getTime());
     assertThat(rule1.getUpdatedAt()).isEqualTo(DATE1.getTime());
     assertThat(rule1.getDefaultRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name());
-    assertThat(rule1.getDefaultRemediationCoefficient()).isEqualTo("5d");
-    assertThat(rule1.getDefaultRemediationOffset()).isEqualTo("10h");
+    assertThat(rule1.getDefaultRemediationGapMultiplier()).isEqualTo("5d");
+    assertThat(rule1.getDefaultRemediationBaseEffort()).isEqualTo("10h");
     assertThat(rule1.getType()).isEqualTo(RuleType.CODE_SMELL.getDbConstant());
 
     List<RuleParamDto> params = dbClient.ruleDao().selectRuleParamsByRuleKey(dbTester.getSession(), RULE_KEY1);
index 47530bb8ddb385daf8031519112c809dbf228fbc..e3b6ee242205655f35ac4a8262636e3de9cdeeb3 100644 (file)
@@ -107,9 +107,9 @@ public class RuleCreatorMediumTest {
     assertThat(rule.getLanguage()).isEqualTo("java");
     assertThat(rule.getConfigKey()).isEqualTo("S001");
     assertThat(rule.getDefaultRemediationFunction()).isEqualTo("LINEAR_OFFSET");
-    assertThat(rule.getDefaultRemediationCoefficient()).isEqualTo("1h");
-    assertThat(rule.getDefaultRemediationOffset()).isEqualTo("5min");
-    assertThat(rule.getEffortToFixDescription()).isEqualTo("desc");
+    assertThat(rule.getDefaultRemediationGapMultiplier()).isEqualTo("1h");
+    assertThat(rule.getDefaultRemediationBaseEffort()).isEqualTo("5min");
+    assertThat(rule.getGapDescription()).isEqualTo("desc");
     assertThat(rule.getTags()).containsOnly("usertag1", "usertag2");
     assertThat(rule.getSystemTags()).containsOnly("tag1", "tag4");
 
@@ -514,7 +514,7 @@ public class RuleCreatorMediumTest {
     assertThat(rule.getStatus()).isEqualTo(RuleStatus.READY);
     assertThat(rule.getLanguage()).isNull();
     assertThat(rule.getConfigKey()).isNull();
-    assertThat(rule.getDefaultRemediationOffset()).isNull();
+    assertThat(rule.getDefaultRemediationBaseEffort()).isNull();
     assertThat(rule.getTags()).isEmpty();
     assertThat(rule.getSystemTags()).isEmpty();
 
@@ -685,9 +685,9 @@ public class RuleCreatorMediumTest {
       .setLanguage("java")
       .setConfigKey("S001")
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setDefaultRemediationCoefficient("1h")
-      .setDefaultRemediationOffset("5min")
-      .setEffortToFixDescription("desc")
+      .setDefaultRemediationGapMultiplier("1h")
+      .setDefaultRemediationBaseEffort("5min")
+      .setGapDescription("desc")
       .setTags(Sets.newHashSet("usertag1", "usertag2"))
       .setSystemTags(Sets.newHashSet("tag1", "tag4"))
       .setCreatedAt(new Date().getTime())
@@ -706,9 +706,9 @@ public class RuleCreatorMediumTest {
       .setLanguage("java")
       .setConfigKey("S002")
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setDefaultRemediationCoefficient("1h")
-      .setDefaultRemediationOffset("5min")
-      .setEffortToFixDescription("desc")
+      .setDefaultRemediationGapMultiplier("1h")
+      .setDefaultRemediationBaseEffort("5min")
+      .setGapDescription("desc")
       .setCreatedAt(new Date().getTime())
       .setUpdatedAt(new Date().getTime());
     dao.insert(dbSession, templateRule);
@@ -726,9 +726,9 @@ public class RuleCreatorMediumTest {
       .setLanguage("java")
       .setConfigKey("S003")
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setDefaultRemediationCoefficient("1h")
-      .setDefaultRemediationOffset("5min")
-      .setEffortToFixDescription("desc")
+      .setDefaultRemediationGapMultiplier("1h")
+      .setDefaultRemediationBaseEffort("5min")
+      .setGapDescription("desc")
       .setCreatedAt(new Date().getTime())
       .setUpdatedAt(new Date().getTime());
     dao.insert(dbSession, templateRule);
index ece0b19f3f5d839cc72e84a469a193a72c7ae29e..51de3cee65fa9d591fafbb03e845928e9b908acb 100644 (file)
@@ -33,7 +33,6 @@ import org.sonar.db.DbSession;
 import org.sonar.db.rule.RuleDao;
 import org.sonar.db.rule.RuleDto;
 import org.sonar.server.exceptions.BadRequestException;
-import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.rule.RuleOperations.RuleChange;
 import org.sonar.server.rule.index.RuleIndexer;
 import org.sonar.server.tester.MockUserSession;
@@ -77,7 +76,7 @@ public class RuleOperationsTest {
   @Test
   public void update_rule() {
     RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-      .setRemediationFunction("CONSTANT_ISSUE").setRemediationOffset("10min");
+      .setRemediationFunction("CONSTANT_ISSUE").setRemediationBaseEffort("10min");
     RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck");
 
     when(ruleDao.selectOrFailByKey(session, ruleKey)).thenReturn(dto);
@@ -95,8 +94,8 @@ public class RuleOperationsTest {
 
     assertThat(result.getId()).isEqualTo(1);
     assertThat(result.getRemediationFunction()).isEqualTo("LINEAR_OFFSET");
-    assertThat(result.getRemediationCoefficient()).isEqualTo("2h");
-    assertThat(result.getRemediationOffset()).isEqualTo("20min");
+    assertThat(result.getRemediationGapMultiplier()).isEqualTo("2h");
+    assertThat(result.getRemediationBaseEffort()).isEqualTo("20min");
 
     verify(ruleIndexer).index();
   }
@@ -104,8 +103,8 @@ public class RuleOperationsTest {
   @Test
   public void update_rule_set_overridden_values_to_null_when_new_values_are_equals_to_default_values() {
     RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-      .setRemediationFunction("CONSTANT_ISSUE").setRemediationOffset("10min")
-      .setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationOffset("10min");
+      .setRemediationFunction("CONSTANT_ISSUE").setRemediationBaseEffort("10min")
+      .setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationBaseEffort("10min");
     RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck");
 
     when(ruleDao.selectOrFailByKey(session, ruleKey)).thenReturn(dto);
@@ -124,14 +123,14 @@ public class RuleOperationsTest {
 
     assertThat(result.getId()).isEqualTo(1);
     assertThat(result.getRemediationFunction()).isNull();
-    assertThat(result.getRemediationCoefficient()).isNull();
-    assertThat(result.getRemediationOffset()).isNull();
+    assertThat(result.getRemediationGapMultiplier()).isNull();
+    assertThat(result.getRemediationBaseEffort()).isNull();
   }
 
   @Test
   public void not_update_rule_if_same_function() {
     RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-      .setRemediationFunction("CONSTANT_ISSUE").setRemediationOffset("10min");
+      .setRemediationFunction("CONSTANT_ISSUE").setRemediationBaseEffort("10min");
     RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck");
 
     when(ruleDao.selectOrFailByKey(session, ruleKey)).thenReturn(dto);
@@ -150,7 +149,7 @@ public class RuleOperationsTest {
   @Test
   public void update_rule_set_remediation_function_if_different_from_default_one() {
     RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-      .setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationOffset("10min");
+      .setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationBaseEffort("10min");
     RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck");
 
     when(ruleDao.selectOrFailByKey(session, ruleKey)).thenReturn(dto);
@@ -169,14 +168,14 @@ public class RuleOperationsTest {
 
     assertThat(result.getId()).isEqualTo(1);
     assertThat(result.getRemediationFunction()).isEqualTo("LINEAR");
-    assertThat(result.getRemediationOffset()).isNull();
-    assertThat(result.getRemediationCoefficient()).isEqualTo("10min");
+    assertThat(result.getRemediationBaseEffort()).isNull();
+    assertThat(result.getRemediationGapMultiplier()).isEqualTo("10min");
   }
 
   @Test
   public void disable_rule_debt_when_update_rule_with_no_function() {
     RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-      .setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationOffset("10min");
+      .setDefaultRemediationFunction("CONSTANT_ISSUE").setDefaultRemediationBaseEffort("10min");
     RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck");
 
     when(ruleDao.selectOrFailByKey(session, ruleKey)).thenReturn(dto);
@@ -190,14 +189,14 @@ public class RuleOperationsTest {
 
     assertThat(result.getId()).isEqualTo(1);
     assertThat(result.getRemediationFunction()).isNull();
-    assertThat(result.getRemediationCoefficient()).isNull();
-    assertThat(result.getRemediationOffset()).isNull();
+    assertThat(result.getRemediationGapMultiplier()).isNull();
+    assertThat(result.getRemediationBaseEffort()).isNull();
   }
 
   @Test
   public void fail_to_update_rule_on_invalid_coefficient() {
     RuleDto dto = new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck")
-      .setRemediationFunction("LINEAR").setRemediationCoefficient("1h");
+      .setRemediationFunction("LINEAR").setRemediationGapMultiplier("1h");
     RuleKey ruleKey = RuleKey.of("squid", "UselessImportCheck");
 
     when(ruleDao.selectOrFailByKey(session, ruleKey)).thenReturn(dto);
index ad97535d0496055794a4afd0c2d4acdd189c713b..19f30e7692d71dd839c66f9ed03d9f6ea354ea75 100644 (file)
@@ -110,8 +110,8 @@ public class RuleUpdaterMediumTest {
       .setNoteUserLogin("me")
       .setTags(ImmutableSet.of("tag1"))
       .setRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE.name())
-      .setRemediationCoefficient("1d")
-      .setRemediationOffset("5min"));
+      .setRemediationGapMultiplier("1d")
+      .setRemediationBaseEffort("5min"));
     dbSession.commit();
 
     RuleUpdate update = RuleUpdate.createForPluginRule(RULE_KEY);
@@ -124,8 +124,8 @@ public class RuleUpdaterMediumTest {
     assertThat(rule.getNoteUserLogin()).isEqualTo("me");
     assertThat(rule.getTags()).containsOnly("tag1");
     assertThat(rule.getRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE.name());
-    assertThat(rule.getRemediationCoefficient()).isEqualTo("1d");
-    assertThat(rule.getRemediationOffset()).isEqualTo("5min");
+    assertThat(rule.getRemediationGapMultiplier()).isEqualTo("1d");
+    assertThat(rule.getRemediationBaseEffort()).isEqualTo("5min");
   }
 
   @Test
@@ -139,8 +139,8 @@ public class RuleUpdaterMediumTest {
       // the following fields are not supposed to be updated
       .setTags(ImmutableSet.of("tag1"))
       .setRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE.name())
-      .setRemediationCoefficient("1d")
-      .setRemediationOffset("5min"));
+      .setRemediationGapMultiplier("1d")
+      .setRemediationBaseEffort("5min"));
     dbSession.commit();
 
     RuleUpdate update = RuleUpdate.createForPluginRule(RULE_KEY);
@@ -156,8 +156,8 @@ public class RuleUpdaterMediumTest {
     // no other changes
     assertThat(rule.getTags()).containsOnly("tag1");
     assertThat(rule.getRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE.name());
-    assertThat(rule.getRemediationCoefficient()).isEqualTo("1d");
-    assertThat(rule.getRemediationOffset()).isEqualTo("5min");
+    assertThat(rule.getRemediationGapMultiplier()).isEqualTo("1d");
+    assertThat(rule.getRemediationBaseEffort()).isEqualTo("5min");
   }
 
   @Test
@@ -224,11 +224,11 @@ public class RuleUpdaterMediumTest {
   public void override_debt() {
     ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY)
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setDefaultRemediationCoefficient("1d")
-      .setDefaultRemediationOffset("5min")
+      .setDefaultRemediationGapMultiplier("1d")
+      .setDefaultRemediationBaseEffort("5min")
       .setRemediationFunction(null)
-      .setRemediationCoefficient(null)
-      .setRemediationOffset(null));
+      .setRemediationGapMultiplier(null)
+      .setRemediationBaseEffort(null));
     dbSession.commit();
 
     DefaultDebtRemediationFunction fn = new DefaultDebtRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE, null, "1min");
@@ -240,23 +240,23 @@ public class RuleUpdaterMediumTest {
     // verify debt is overridden
     RuleDto rule = ruleDao.selectOrFailByKey(dbSession, RULE_KEY);
     assertThat(rule.getRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE.name());
-    assertThat(rule.getRemediationCoefficient()).isNull();
-    assertThat(rule.getRemediationOffset()).isEqualTo("1min");
+    assertThat(rule.getRemediationGapMultiplier()).isNull();
+    assertThat(rule.getRemediationBaseEffort()).isEqualTo("1min");
 
     assertThat(rule.getDefaultRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name());
-    assertThat(rule.getDefaultRemediationCoefficient()).isEqualTo("1d");
-    assertThat(rule.getDefaultRemediationOffset()).isEqualTo("5min");
+    assertThat(rule.getDefaultRemediationGapMultiplier()).isEqualTo("1d");
+    assertThat(rule.getDefaultRemediationBaseEffort()).isEqualTo("5min");
   }
 
   @Test
   public void override_debt_only_offset() {
     ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY)
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR.name())
-      .setDefaultRemediationCoefficient("1d")
-      .setDefaultRemediationOffset(null)
+      .setDefaultRemediationGapMultiplier("1d")
+      .setDefaultRemediationBaseEffort(null)
       .setRemediationFunction(null)
-      .setRemediationCoefficient(null)
-      .setRemediationOffset(null));
+      .setRemediationGapMultiplier(null)
+      .setRemediationBaseEffort(null));
     dbSession.commit();
 
     RuleUpdate update = RuleUpdate.createForPluginRule(RULE_KEY)
@@ -267,23 +267,23 @@ public class RuleUpdaterMediumTest {
     // verify debt is overridden
     RuleDto rule = ruleDao.selectOrFailByKey(dbSession, RULE_KEY);
     assertThat(rule.getRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.LINEAR.name());
-    assertThat(rule.getRemediationCoefficient()).isEqualTo("2d");
-    assertThat(rule.getRemediationOffset()).isNull();
+    assertThat(rule.getRemediationGapMultiplier()).isEqualTo("2d");
+    assertThat(rule.getRemediationBaseEffort()).isNull();
 
     assertThat(rule.getDefaultRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.LINEAR.name());
-    assertThat(rule.getDefaultRemediationCoefficient()).isEqualTo("1d");
-    assertThat(rule.getDefaultRemediationOffset()).isNull();
+    assertThat(rule.getDefaultRemediationGapMultiplier()).isEqualTo("1d");
+    assertThat(rule.getDefaultRemediationBaseEffort()).isNull();
   }
 
   @Test
   public void override_debt_from_linear_with_offset_to_constant() {
     ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY)
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setDefaultRemediationCoefficient("1d")
-      .setDefaultRemediationOffset("5min")
+      .setDefaultRemediationGapMultiplier("1d")
+      .setDefaultRemediationBaseEffort("5min")
       .setRemediationFunction(null)
-      .setRemediationCoefficient(null)
-      .setRemediationOffset(null));
+      .setRemediationGapMultiplier(null)
+      .setRemediationBaseEffort(null));
     dbSession.commit();
 
     RuleUpdate update = RuleUpdate.createForPluginRule(RULE_KEY)
@@ -294,23 +294,23 @@ public class RuleUpdaterMediumTest {
     // verify debt is overridden
     RuleDto rule = ruleDao.selectOrFailByKey(dbSession, RULE_KEY);
     assertThat(rule.getRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE.name());
-    assertThat(rule.getRemediationCoefficient()).isNull();
-    assertThat(rule.getRemediationOffset()).isEqualTo("10min");
+    assertThat(rule.getRemediationGapMultiplier()).isNull();
+    assertThat(rule.getRemediationBaseEffort()).isEqualTo("10min");
 
     assertThat(rule.getDefaultRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name());
-    assertThat(rule.getDefaultRemediationCoefficient()).isEqualTo("1d");
-    assertThat(rule.getDefaultRemediationOffset()).isEqualTo("5min");
+    assertThat(rule.getDefaultRemediationGapMultiplier()).isEqualTo("1d");
+    assertThat(rule.getDefaultRemediationBaseEffort()).isEqualTo("5min");
   }
 
   @Test
   public void reset_remediation_function() {
     ruleDao.insert(dbSession, RuleTesting.newDto(RULE_KEY)
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR.name())
-      .setDefaultRemediationCoefficient("1d")
-      .setDefaultRemediationOffset("5min")
+      .setDefaultRemediationGapMultiplier("1d")
+      .setDefaultRemediationBaseEffort("5min")
       .setRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE.name())
-      .setRemediationCoefficient(null)
-      .setRemediationOffset("1min"));
+      .setRemediationGapMultiplier(null)
+      .setRemediationBaseEffort("1min"));
     dbSession.commit();
 
     RuleUpdate update = RuleUpdate.createForPluginRule(RULE_KEY).setDebtRemediationFunction(null);
@@ -320,12 +320,12 @@ public class RuleUpdaterMediumTest {
     // verify debt is coming from default values
     RuleDto rule = ruleDao.selectOrFailByKey(dbSession, RULE_KEY);
     assertThat(rule.getDefaultRemediationFunction()).isEqualTo(DebtRemediationFunction.Type.LINEAR.name());
-    assertThat(rule.getDefaultRemediationCoefficient()).isEqualTo("1d");
-    assertThat(rule.getDefaultRemediationOffset()).isEqualTo("5min");
+    assertThat(rule.getDefaultRemediationGapMultiplier()).isEqualTo("1d");
+    assertThat(rule.getDefaultRemediationBaseEffort()).isEqualTo("5min");
 
     assertThat(rule.getRemediationFunction()).isNull();
-    assertThat(rule.getRemediationCoefficient()).isNull();
-    assertThat(rule.getRemediationOffset()).isNull();
+    assertThat(rule.getRemediationGapMultiplier()).isNull();
+    assertThat(rule.getRemediationBaseEffort()).isNull();
   }
 
   @Test
index 7293c78c61502e2f6f83d84535268146f1fe1f31..a52e8ba57cd046e13353c5d2e64628b49cf34c96 100644 (file)
@@ -224,11 +224,11 @@ public class SearchActionMediumTest {
   public void search_debt_rules_with_default_and_overridden_debt_values() throws Exception {
     ruleDao.insert(dbSession, RuleTesting.newXooX1()
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setDefaultRemediationCoefficient("1h")
-      .setDefaultRemediationOffset("15min")
+      .setDefaultRemediationGapMultiplier("1h")
+      .setDefaultRemediationBaseEffort("15min")
       .setRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setRemediationCoefficient("2h")
-      .setRemediationOffset("25min"));
+      .setRemediationGapMultiplier("2h")
+      .setRemediationBaseEffort("25min"));
     dbSession.commit();
     ruleIndexer.index();
 
@@ -242,11 +242,11 @@ public class SearchActionMediumTest {
   public void search_debt_rules_with_default_linear_offset_and_overridden_constant_debt() throws Exception {
     ruleDao.insert(dbSession, RuleTesting.newXooX1()
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setDefaultRemediationCoefficient("1h")
-      .setDefaultRemediationOffset("15min")
+      .setDefaultRemediationGapMultiplier("1h")
+      .setDefaultRemediationBaseEffort("15min")
       .setRemediationFunction(DebtRemediationFunction.Type.CONSTANT_ISSUE.name())
-      .setRemediationCoefficient(null)
-      .setRemediationOffset("5min"));
+      .setRemediationGapMultiplier(null)
+      .setRemediationBaseEffort("5min"));
     dbSession.commit();
     ruleIndexer.index();
 
@@ -260,11 +260,11 @@ public class SearchActionMediumTest {
   public void search_debt_rules_with_default_linear_offset_and_overridden_linear_debt() throws Exception {
     ruleDao.insert(dbSession, RuleTesting.newXooX1()
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.name())
-      .setDefaultRemediationCoefficient("1h")
-      .setDefaultRemediationOffset("15min")
+      .setDefaultRemediationGapMultiplier("1h")
+      .setDefaultRemediationBaseEffort("15min")
       .setRemediationFunction(DebtRemediationFunction.Type.LINEAR.name())
-      .setRemediationCoefficient("1h")
-      .setRemediationOffset(null));
+      .setRemediationGapMultiplier("1h")
+      .setRemediationBaseEffort(null));
     dbSession.commit();
     ruleIndexer.index();
 
index a74fa6044403181f4d4b40c09928749be82b6a4b..538fb438be8ed3b59411221f5b516a200d326f40 100644 (file)
@@ -107,11 +107,11 @@ public class ShowActionMediumTest {
       .setConfigKey("InternalKeyS001")
       .setLanguage("xoo")
       .setDefaultRemediationFunction("LINEAR_OFFSET")
-      .setDefaultRemediationCoefficient("5d")
-      .setDefaultRemediationOffset("10h")
+      .setDefaultRemediationGapMultiplier("5d")
+      .setDefaultRemediationBaseEffort("10h")
       .setRemediationFunction(null)
-      .setRemediationCoefficient(null)
-      .setRemediationOffset(null);
+      .setRemediationGapMultiplier(null)
+      .setRemediationBaseEffort(null);
     ruleDao.insert(session, ruleDto);
     session.commit();
     session.clearCache();
@@ -134,11 +134,11 @@ public class ShowActionMediumTest {
         .setConfigKey("InternalKeyS001")
         .setLanguage("xoo")
         .setDefaultRemediationFunction(null)
-        .setDefaultRemediationCoefficient(null)
-        .setDefaultRemediationOffset(null)
+        .setDefaultRemediationGapMultiplier(null)
+        .setDefaultRemediationBaseEffort(null)
         .setRemediationFunction("LINEAR_OFFSET")
-        .setRemediationCoefficient("5d")
-        .setRemediationOffset("10h");
+        .setRemediationGapMultiplier("5d")
+        .setRemediationBaseEffort("10h");
     ruleDao.insert(session, ruleDto);
     session.commit();
     session.clearCache();
@@ -158,11 +158,11 @@ public class ShowActionMediumTest {
       .setConfigKey("InternalKeyS001")
       .setLanguage("xoo")
       .setDefaultRemediationFunction("LINEAR")
-      .setDefaultRemediationCoefficient("5min")
-      .setDefaultRemediationOffset(null)
+      .setDefaultRemediationGapMultiplier("5min")
+      .setDefaultRemediationBaseEffort(null)
       .setRemediationFunction("LINEAR_OFFSET")
-      .setRemediationCoefficient("5d")
-      .setRemediationOffset("10h");
+      .setRemediationGapMultiplier("5d")
+      .setRemediationBaseEffort("10h");
     ruleDao.insert(session, ruleDto);
     session.commit();
     session.clearCache();
@@ -183,11 +183,11 @@ public class ShowActionMediumTest {
       .setConfigKey("InternalKeyS001")
       .setLanguage("xoo")
       .setDefaultRemediationFunction(null)
-      .setDefaultRemediationCoefficient(null)
-      .setDefaultRemediationOffset(null)
+      .setDefaultRemediationGapMultiplier(null)
+      .setDefaultRemediationBaseEffort(null)
       .setRemediationFunction(null)
-      .setRemediationCoefficient(null)
-      .setRemediationOffset(null);
+      .setRemediationGapMultiplier(null)
+      .setRemediationBaseEffort(null);
     ruleDao.insert(session, ruleDto);
     session.commit();
     session.clearCache();
index ffb53b623752faf22b8f663475d5ac77a670bc73..cd31054a11fbaa5d3c4857043cf8cc24282becc4 100644 (file)
@@ -134,12 +134,12 @@ public class ClearRulesOverloadedDebtTest {
 
     RuleDto ruleDto = ruleDao.selectOrFailByKey(dbSession, ruleKey);
     assertThat(ruleDto.getRemediationFunction()).isNull();
-    assertThat(ruleDto.getRemediationCoefficient()).isNull();
-    assertThat(ruleDto.getRemediationOffset()).isNull();
+    assertThat(ruleDto.getRemediationGapMultiplier()).isNull();
+    assertThat(ruleDto.getRemediationBaseEffort()).isNull();
   }
 
   private RuleDto insertRuleDto(RuleKey ruleKey, @Nullable String function, @Nullable String coeff, @Nullable String offset) {
-    RuleDto ruleDto = RuleTesting.newDto(ruleKey).setRemediationFunction(function).setRemediationOffset(offset).setRemediationCoefficient(coeff);
+    RuleDto ruleDto = RuleTesting.newDto(ruleKey).setRemediationFunction(function).setRemediationBaseEffort(offset).setRemediationGapMultiplier(coeff);
     ruleDao.insert(dbSession,
       ruleDto
       );
index 450f750caf092ed6d43a694392f164a33904dae7..5dba31fbc1015f9b5bab4ae1b75b21d9f6cc68cd 100644 (file)
@@ -4,9 +4,9 @@
          plugin_config_key="[null]" priority="0" is_template="[true]" language="xoo"  template_id="[null]"
          note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]"
          remediation_function="LINEAR" default_remediation_function="LINEAR_OFFSET"
-         remediation_coeff="1h" default_remediation_coeff="5d"
-         remediation_offset="5min" default_remediation_offset="10h"
-         effort_to_fix_description="[null]" description_format="MARKDOWN"
+         remediation_gap_mult="1h" default_remediation_gap_mult="5d"
+         remediation_base_effort="5min" default_remediation_base_effort="10h"
+         gap_description="[null]" description_format="MARKDOWN"
          tags="[null]" system_tags="[null]"
          created_at="1500000000000" updated_at="1500000000000"
       />
index f43e773b86e12476bc6a861bb0cf898357c9ce49..f6cdc7f6fb4062d7b6b273b639b071a8bdc91ffb 100644 (file)
@@ -12,9 +12,9 @@
          plugin_config_key="NewConfigKey" priority="0" is_template="[true]" language="dart" template_id="3"
          note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]"
          remediation_function="LINEAR" default_remediation_function="LINEAR_OFFSET"
-         remediation_coeff="1h" default_remediation_coeff="5d"
-         remediation_offset="5min" default_remediation_offset="10h"
-         effort_to_fix_description="squid.S115.effortToFix" description_format="MARKDOWN"
+         remediation_gap_mult="1h" default_remediation_gap_mult="5d"
+         remediation_base_effort="5min" default_remediation_base_effort="10h"
+         gap_description="squid.S115.effortToFix" description_format="MARKDOWN"
          created_at="150000" updated_at="150000"
   />
 
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1117_rename_rules_columns.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1117_rename_rules_columns.rb
new file mode 100644 (file)
index 0000000..f8471b7
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# SonarQube is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+#
+
+#
+# SonarQube 5.5
+# SONAR-7453
+#
+class RenameRulesColumns < ActiveRecord::Migration
+
+  def self.up
+    rename_column 'rules', 'effort_to_fix_description', 'gap_description'
+    rename_column 'rules', 'remediation_coeff', 'remediation_gap_mult'
+    rename_column 'rules', 'default_remediation_coeff', 'default_remediation_gap_mult'
+    rename_column 'rules', 'remediation_offset', 'remediation_base_effort'
+    rename_column 'rules', 'default_remediation_offset', 'default_remediation_base_effort'
+  end
+
+end
index 6f8bca7fd5e96d46f66821a80d72f9387a8f5bc6..41115748c706584d62cd918b62b2e022ac034424 100644 (file)
@@ -61,11 +61,11 @@ public class RuleDto {
   private Date noteUpdatedAt;
   private String remediationFunction;
   private String defaultRemediationFunction;
-  private String remediationCoefficient;
-  private String defaultRemediationCoefficient;
-  private String remediationOffset;
-  private String defaultRemediationOffset;
-  private String effortToFixDescription;
+  private String remediationGapMultiplier;
+  private String defaultRemediationGapMultiplier;
+  private String remediationBaseEffort;
+  private String defaultRemediationBaseEffort;
+  private String gapDescription;
   private String tags;
   private String systemTags;
   private int type;
@@ -262,52 +262,52 @@ public class RuleDto {
   }
 
   @CheckForNull
-  public String getRemediationCoefficient() {
-    return remediationCoefficient;
+  public String getRemediationGapMultiplier() {
+    return remediationGapMultiplier;
   }
 
-  public RuleDto setRemediationCoefficient(@Nullable String remediationCoefficient) {
-    this.remediationCoefficient = remediationCoefficient;
+  public RuleDto setRemediationGapMultiplier(@Nullable String remediationGapMultiplier) {
+    this.remediationGapMultiplier = remediationGapMultiplier;
     return this;
   }
 
   @CheckForNull
-  public String getDefaultRemediationCoefficient() {
-    return defaultRemediationCoefficient;
+  public String getDefaultRemediationGapMultiplier() {
+    return defaultRemediationGapMultiplier;
   }
 
-  public RuleDto setDefaultRemediationCoefficient(@Nullable String defaultRemediationCoefficient) {
-    this.defaultRemediationCoefficient = defaultRemediationCoefficient;
+  public RuleDto setDefaultRemediationGapMultiplier(@Nullable String defaultRemediationGapMultiplier) {
+    this.defaultRemediationGapMultiplier = defaultRemediationGapMultiplier;
     return this;
   }
 
   @CheckForNull
-  public String getRemediationOffset() {
-    return remediationOffset;
+  public String getRemediationBaseEffort() {
+    return remediationBaseEffort;
   }
 
-  public RuleDto setRemediationOffset(@Nullable String remediationOffset) {
-    this.remediationOffset = remediationOffset;
+  public RuleDto setRemediationBaseEffort(@Nullable String remediationBaseEffort) {
+    this.remediationBaseEffort = remediationBaseEffort;
     return this;
   }
 
   @CheckForNull
-  public String getDefaultRemediationOffset() {
-    return defaultRemediationOffset;
+  public String getDefaultRemediationBaseEffort() {
+    return defaultRemediationBaseEffort;
   }
 
-  public RuleDto setDefaultRemediationOffset(@Nullable String defaultRemediationOffset) {
-    this.defaultRemediationOffset = defaultRemediationOffset;
+  public RuleDto setDefaultRemediationBaseEffort(@Nullable String defaultRemediationBaseEffort) {
+    this.defaultRemediationBaseEffort = defaultRemediationBaseEffort;
     return this;
   }
 
   @CheckForNull
-  public String getEffortToFixDescription() {
-    return effortToFixDescription;
+  public String getGapDescription() {
+    return gapDescription;
   }
 
-  public RuleDto setEffortToFixDescription(@Nullable String s) {
-    this.effortToFixDescription = s;
+  public RuleDto setGapDescription(@Nullable String s) {
+    this.gapDescription = s;
     return this;
   }
 
index 8cdd6772ce2de9bbedb855e9cfced00de976316b..83e52658375be4c44251942918060e2078810187 100644 (file)
@@ -29,7 +29,7 @@ import org.sonar.db.MyBatis;
 
 public class DatabaseVersion {
 
-  public static final int LAST_VERSION = 1116;
+  public static final int LAST_VERSION = 1117;
 
   /**
    * The minimum supported version which can be upgraded. Lower
index 3f4aec95f3d9eeea46e3eb249bcd80ece4b23862..00924617ab7ea91085cff0cc7ae37bc09bfdadd1 100644 (file)
     r.note_updated_at as "noteUpdatedAt",
     r.remediation_function as "remediationFunction",
     r.default_remediation_function as "defaultRemediationFunction",
-    r.remediation_coeff as "remediationCoefficient",
-    r.default_remediation_coeff as "defaultRemediationCoefficient",
-    r.remediation_offset as "remediationOffset",
-    r.default_remediation_offset as "defaultRemediationOffset",
-    r.effort_to_fix_description as "effortToFixDescription",
+    r.remediation_gap_mult as "remediationGapMultiplier",
+    r.default_remediation_gap_mult as "defaultRemediationGapMultiplier",
+    r.remediation_base_effort as "remediationBaseEffort",
+    r.default_remediation_base_effort as "defaultRemediationBaseEffort",
+    r.gap_description as "gapDescription",
     r.tags as "tagsField",
     r.system_tags as "systemTagsField",
     r.rule_type as "type",
     note_updated_at=#{noteUpdatedAt},
     remediation_function=#{remediationFunction},
     default_remediation_function=#{defaultRemediationFunction},
-    remediation_coeff=#{remediationCoefficient},
-    default_remediation_coeff=#{defaultRemediationCoefficient},
-    remediation_offset=#{remediationOffset},
-    default_remediation_offset=#{defaultRemediationOffset},
-    effort_to_fix_description=#{effortToFixDescription},
+    remediation_gap_mult=#{remediationGapMultiplier},
+    default_remediation_gap_mult=#{defaultRemediationGapMultiplier},
+    remediation_base_effort=#{remediationBaseEffort},
+    default_remediation_base_effort=#{defaultRemediationBaseEffort},
+    gap_description=#{gapDescription},
     tags=#{tagsField},
     system_tags=#{systemTagsField},
     rule_type=#{type},
     (plugin_rule_key, plugin_name, description, description_format, status, name, plugin_config_key, priority,
     is_template, language, template_id,
     remediation_function, default_remediation_function,
-    remediation_coeff, default_remediation_coeff, remediation_offset, default_remediation_offset,
-    effort_to_fix_description, tags, system_tags, rule_type, note_data, note_user_login, note_created_at, note_updated_at,
+    remediation_gap_mult, default_remediation_gap_mult, remediation_base_effort, default_remediation_base_effort,
+    gap_description, tags, system_tags, rule_type, note_data, note_user_login, note_created_at, note_updated_at,
     created_at, updated_at)
   </sql>
 
     values (#{ruleKey}, #{repositoryKey}, #{description}, #{descriptionFormat}, #{status}, #{name}, #{configKey},
     #{severity}, #{isTemplate}, #{language}, #{templateId},
     #{remediationFunction}, #{defaultRemediationFunction},
-    #{remediationCoefficient}, #{defaultRemediationCoefficient}, #{remediationOffset}, #{defaultRemediationOffset},
-    #{effortToFixDescription}, #{tagsField}, #{systemTagsField}, #{type,jdbcType=INTEGER}, #{noteData}, #{noteUserLogin}, #{noteCreatedAt},
+    #{remediationGapMultiplier}, #{defaultRemediationGapMultiplier}, #{remediationBaseEffort}, #{defaultRemediationBaseEffort},
+    #{gapDescription}, #{tagsField}, #{systemTagsField}, #{type,jdbcType=INTEGER}, #{noteData}, #{noteUserLogin}, #{noteCreatedAt},
     #{noteUpdatedAt}, #{createdAt}, #{updatedAt})
   </insert>
 
index 99f1f1b0bd7b0c4d226b9c0773de6d810dbb2d8e..cc1d19832fa87a9890d767de651faefcd8fe68eb 100644 (file)
@@ -394,6 +394,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1113');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1114');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1115');
 INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1116');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1117');
 
 INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, EXTERNAL_IDENTITY, EXTERNAL_IDENTITY_PROVIDER, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'admin', 'sonarqube', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null);
 ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
index 8a8677eb8ada308416fca5d29150965509d32408..a7111f6dad0699b4320065b4a083ce18f6e9b22e 100644 (file)
@@ -115,11 +115,11 @@ CREATE TABLE "RULES" (
   "NOTE_UPDATED_AT" TIMESTAMP,
   "REMEDIATION_FUNCTION" VARCHAR(20),
   "DEFAULT_REMEDIATION_FUNCTION" VARCHAR(20),
-  "REMEDIATION_COEFF" VARCHAR(20),
-  "DEFAULT_REMEDIATION_COEFF" VARCHAR(20),
-  "REMEDIATION_OFFSET" VARCHAR(20),
-  "DEFAULT_REMEDIATION_OFFSET" VARCHAR(20),
-  "EFFORT_TO_FIX_DESCRIPTION" VARCHAR(4000),
+  "REMEDIATION_GAP_MULT" VARCHAR(20),
+  "DEFAULT_REMEDIATION_GAP_MULT" VARCHAR(20),
+  "REMEDIATION_BASE_EFFORT" VARCHAR(20),
+  "DEFAULT_REMEDIATION_BASE_EFFORT" VARCHAR(20),
+  "GAP_DESCRIPTION" VARCHAR(4000),
   "TAGS" VARCHAR(4000),
   "SYSTEM_TAGS" VARCHAR(4000),
   "RULE_TYPE" TINYINT,
index a563b721ea5624e6bb852c4db5acde3baf14754f..cf40b8abf747e8f8fd3f62b8de2a47e955a9d105 100644 (file)
@@ -136,11 +136,11 @@ public class RuleDaoTest {
     assertThat(ruleDto.getNoteData()).isEqualTo("Rule note with accents \u00e9\u00e8\u00e0");
     assertThat(ruleDto.getRemediationFunction()).isEqualTo("LINEAR");
     assertThat(ruleDto.getDefaultRemediationFunction()).isEqualTo("LINEAR_OFFSET");
-    assertThat(ruleDto.getRemediationCoefficient()).isEqualTo("1h");
-    assertThat(ruleDto.getDefaultRemediationCoefficient()).isEqualTo("5d");
-    assertThat(ruleDto.getRemediationOffset()).isEqualTo("5min");
-    assertThat(ruleDto.getDefaultRemediationOffset()).isEqualTo("10h");
-    assertThat(ruleDto.getEffortToFixDescription()).isEqualTo("squid.S115.effortToFix");
+    assertThat(ruleDto.getRemediationGapMultiplier()).isEqualTo("1h");
+    assertThat(ruleDto.getDefaultRemediationGapMultiplier()).isEqualTo("5d");
+    assertThat(ruleDto.getRemediationBaseEffort()).isEqualTo("5min");
+    assertThat(ruleDto.getDefaultRemediationBaseEffort()).isEqualTo("10h");
+    assertThat(ruleDto.getGapDescription()).isEqualTo("squid.S115.effortToFix");
   }
 
   @Test
@@ -218,11 +218,11 @@ public class RuleDaoTest {
       .setNoteUpdatedAt(DateUtils.parseDate("2013-12-20"))
       .setRemediationFunction(DebtRemediationFunction.Type.LINEAR.toString())
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString())
-      .setRemediationCoefficient("1h")
-      .setDefaultRemediationCoefficient("5d")
-      .setRemediationOffset("5min")
-      .setDefaultRemediationOffset("10h")
-      .setEffortToFixDescription("squid.S115.effortToFix")
+      .setRemediationGapMultiplier("1h")
+      .setDefaultRemediationGapMultiplier("5d")
+      .setRemediationBaseEffort("5min")
+      .setDefaultRemediationBaseEffort("10h")
+      .setGapDescription("squid.S115.effortToFix")
       .setTags(newHashSet("tag1", "tag2"))
       .setSystemTags(newHashSet("systag1", "systag2"))
       .setType(RuleType.BUG)
@@ -250,11 +250,11 @@ public class RuleDaoTest {
     assertThat(ruleDto.getNoteUpdatedAt()).isNotNull();
     assertThat(ruleDto.getRemediationFunction()).isEqualTo("LINEAR");
     assertThat(ruleDto.getDefaultRemediationFunction()).isEqualTo("LINEAR_OFFSET");
-    assertThat(ruleDto.getRemediationCoefficient()).isEqualTo("1h");
-    assertThat(ruleDto.getDefaultRemediationCoefficient()).isEqualTo("5d");
-    assertThat(ruleDto.getRemediationOffset()).isEqualTo("5min");
-    assertThat(ruleDto.getDefaultRemediationOffset()).isEqualTo("10h");
-    assertThat(ruleDto.getEffortToFixDescription()).isEqualTo("squid.S115.effortToFix");
+    assertThat(ruleDto.getRemediationGapMultiplier()).isEqualTo("1h");
+    assertThat(ruleDto.getDefaultRemediationGapMultiplier()).isEqualTo("5d");
+    assertThat(ruleDto.getRemediationBaseEffort()).isEqualTo("5min");
+    assertThat(ruleDto.getDefaultRemediationBaseEffort()).isEqualTo("10h");
+    assertThat(ruleDto.getGapDescription()).isEqualTo("squid.S115.effortToFix");
     assertThat(ruleDto.getTags()).containsOnly("tag1", "tag2");
     assertThat(ruleDto.getSystemTags()).containsOnly("systag1", "systag2");
     assertThat(ruleDto.getType()).isEqualTo(RuleType.BUG.getDbConstant());
@@ -285,11 +285,11 @@ public class RuleDaoTest {
       .setNoteUpdatedAt(DateUtils.parseDate("2013-12-20"))
       .setRemediationFunction(DebtRemediationFunction.Type.LINEAR.toString())
       .setDefaultRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString())
-      .setRemediationCoefficient("1h")
-      .setDefaultRemediationCoefficient("5d")
-      .setRemediationOffset("5min")
-      .setDefaultRemediationOffset("10h")
-      .setEffortToFixDescription("squid.S115.effortToFix")
+      .setRemediationGapMultiplier("1h")
+      .setDefaultRemediationGapMultiplier("5d")
+      .setRemediationBaseEffort("5min")
+      .setDefaultRemediationBaseEffort("10h")
+      .setGapDescription("squid.S115.effortToFix")
       .setTags(newHashSet("tag1", "tag2"))
       .setSystemTags(newHashSet("systag1", "systag2"))
       .setType(RuleType.BUG)
@@ -316,11 +316,11 @@ public class RuleDaoTest {
     assertThat(ruleDto.getNoteUpdatedAt()).isNotNull();
     assertThat(ruleDto.getRemediationFunction()).isEqualTo("LINEAR");
     assertThat(ruleDto.getDefaultRemediationFunction()).isEqualTo("LINEAR_OFFSET");
-    assertThat(ruleDto.getRemediationCoefficient()).isEqualTo("1h");
-    assertThat(ruleDto.getDefaultRemediationCoefficient()).isEqualTo("5d");
-    assertThat(ruleDto.getRemediationOffset()).isEqualTo("5min");
-    assertThat(ruleDto.getDefaultRemediationOffset()).isEqualTo("10h");
-    assertThat(ruleDto.getEffortToFixDescription()).isEqualTo("squid.S115.effortToFix");
+    assertThat(ruleDto.getRemediationGapMultiplier()).isEqualTo("1h");
+    assertThat(ruleDto.getDefaultRemediationGapMultiplier()).isEqualTo("5d");
+    assertThat(ruleDto.getRemediationBaseEffort()).isEqualTo("5min");
+    assertThat(ruleDto.getDefaultRemediationBaseEffort()).isEqualTo("10h");
+    assertThat(ruleDto.getGapDescription()).isEqualTo("squid.S115.effortToFix");
     assertThat(ruleDto.getTags()).containsOnly("tag1", "tag2");
     assertThat(ruleDto.getSystemTags()).containsOnly("systag1", "systag2");
     assertThat(ruleDto.getType()).isEqualTo(RuleType.BUG.getDbConstant());
index efc99594c9f3fab9a3d9d60befb3da536c8ab04f..ba4bb76b3e8f94d2109f22bd2abecd2d387580fc 100644 (file)
@@ -76,10 +76,10 @@ public class RuleTesting {
       .setLanguage("js")
       .setRemediationFunction("LINEAR")
       .setDefaultRemediationFunction("LINEAR_OFFSET")
-      .setRemediationCoefficient("1h")
-      .setDefaultRemediationCoefficient("5d")
-      .setDefaultRemediationOffset("10h")
-      .setEffortToFixDescription(ruleKey.repository() + "." + ruleKey.rule() + ".effortToFix")
+      .setRemediationGapMultiplier("1h")
+      .setDefaultRemediationGapMultiplier("5d")
+      .setDefaultRemediationBaseEffort("10h")
+      .setGapDescription(ruleKey.repository() + "." + ruleKey.rule() + ".effortToFix")
       .setType(RuleType.CODE_SMELL);
   }
 
index 97c6a59f3f722e065cf8bee9eed46278165df44a..6ce3b6763dae04b93d533306152466e0101b4672 100644 (file)
@@ -3,9 +3,9 @@
            plugin_config_key="NewConfigKey" priority="0" is_template="[true]" language="dart" template_id="3"
            note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]"
            remediation_function="linear" default_remediation_function="linear_offset"
-           remediation_coeff="1h" default_remediation_coeff="5d"
-           remediation_offset="5min" default_remediation_offset="10h"
-           effort_to_fix_description="squid.S115.effortToFix"
+           remediation_gap_mult="1h" default_remediation_gap_mult="5d"
+           remediation_base_effort="5min" default_remediation_base_effort="10h"
+           gap_description="squid.S115.effortToFix"
            created_at="[null]" updated_at="[null]"
             />
   <rules_parameters id="1" rule_id="1" name="max" param_type="INTEGER" default_value="30" description="My Parameter"/>
index df6a143c5d3c81d3a463f2e61acf9f368ef5d712..71bd1477503ed7820a7ec33c538dc993dd9fc21f 100644 (file)
@@ -3,9 +3,9 @@
            plugin_config_key="NewConfigKey" priority="0" is_template="[true]" language="dart" template_id="3"
            note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]"
            remediation_function="linear" default_remediation_function="linear_offset"
-           remediation_coeff="1h" default_remediation_coeff="5d"
-           remediation_offset="5min" default_remediation_offset="10h"
-           effort_to_fix_description="squid.S115.effortToFix"
+           remediation_gap_mult="1h" default_remediation_gap_mult="5d"
+           remediation_base_effort="5min" default_remediation_base_effort="10h"
+           gap_description="squid.S115.effortToFix"
            created_at="[null]" updated_at="[null]"
             />
 </dataset>
index 92cd6f505ba83b5a79306969933e50b6af1ac024..38512c1508ff15142fca9f0b50add6cc859b0caf 100644 (file)
@@ -3,27 +3,27 @@
   <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="AvoidNull" plugin_name="checkstyle" name="Avoid Null" description="Should avoid NULL" status="READY"
          note_data="Rule note with accents éèà" note_user_login="polop.palap" note_created_at="2013-12-25" description_format="HTML"
          remediation_function="LINEAR" default_remediation_function="LINEAR_OFFSET"
-         remediation_coeff="1h" default_remediation_coeff="5d"
-         remediation_offset="5min" default_remediation_offset="10h"
-         effort_to_fix_description="squid.S115.effortToFix"
+         remediation_gap_mult="1h" default_remediation_gap_mult="5d"
+         remediation_base_effort="5min" default_remediation_base_effort="10h"
+         gap_description="squid.S115.effortToFix"
          created_at="1500000000000" updated_at="1600000000000"
   />
 
   <rules tags="[null]" system_tags="[null]" id="2" plugin_rule_key="AvoidNull" plugin_name="squid" name="Avoid Null" description="Should avoid NULL" status="REMOVED"
          note_data="[null]" note_user_login="[null]" note_created_at="[null]" description_format="HTML"
          remediation_function="[null]" default_remediation_function="[null]"
-         remediation_coeff="[null]" default_remediation_coeff="[null]"
-         remediation_offset="[null]" default_remediation_offset="[null]"
-         effort_to_fix_description="[null]"
+         remediation_gap_mult="[null]" default_remediation_gap_mult="[null]"
+         remediation_base_effort="[null]" default_remediation_base_effort="[null]"
+         gap_description="[null]"
          created_at="1500000000000" updated_at="1600000000000"
   />
 
   <rules tags="[null]" system_tags="[null]" id="3" plugin_rule_key="AvoidNull" plugin_name="manual" name="Manual Rule" description="Should not appear" status="READY"
          note_data="[null]" note_user_login="[null]" note_created_at="[null]" description_format="HTML"
          remediation_function="[null]" default_remediation_function="[null]"
-         remediation_coeff="[null]" default_remediation_coeff="[null]"
-         remediation_offset="[null]" default_remediation_offset="[null]"
-         effort_to_fix_description="[null]"
+         remediation_gap_mult="[null]" default_remediation_gap_mult="[null]"
+         remediation_base_effort="[null]" default_remediation_base_effort="[null]"
+         gap_description="[null]"
          created_at="1500000000000" updated_at="1600000000000"
   />