diff options
Diffstat (limited to 'sonar-server')
8 files changed, 49 insertions, 49 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java b/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java index 068294006f1..37d7ce8f44d 100644 --- a/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java +++ b/sonar-server/src/main/java/org/sonar/server/debt/DebtModelBackup.java @@ -29,8 +29,8 @@ import org.apache.ibatis.session.SqlSession; import org.sonar.api.ServerComponent; import org.sonar.api.rule.RuleKey; import org.sonar.api.server.debt.DebtCharacteristic; -import org.sonar.api.server.debt.internal.DefaultDebtCharacteristic; import org.sonar.api.server.debt.DebtRemediationFunction; +import org.sonar.api.server.debt.internal.DefaultDebtCharacteristic; import org.sonar.api.utils.System2; import org.sonar.api.utils.ValidationMessages; import org.sonar.core.permission.GlobalPermissions; @@ -229,7 +229,7 @@ public class DebtModelBackup implements ServerComponent { boolean isSameFunction = isSameRemediationFunction(ruleDebt, rule); rule.setCharacteristicId((!isSameCharacteristic ? characteristicDto.getId() : null)); rule.setRemediationFunction((!isSameFunction ? ruleDebt.function().name() : null)); - rule.setRemediationFactor((!isSameFunction ? ruleDebt.factor() : null)); + rule.setRemediationCoefficient((!isSameFunction ? ruleDebt.factor() : null)); rule.setRemediationOffset((!isSameFunction ? ruleDebt.offset() : null)); rule.setUpdatedAt(updateDate); ruleDao.update(rule, session); @@ -290,7 +290,7 @@ public class DebtModelBackup implements ServerComponent { private static boolean isSameRemediationFunction(RuleDebt ruleDebt, RuleDto rule) { return new EqualsBuilder() .append(ruleDebt.function().name(), rule.getDefaultRemediationFunction()) - .append(ruleDebt.factor(), rule.getDefaultRemediationFactor()) + .append(ruleDebt.factor(), rule.getDefaultRemediationCoefficient()) .append(ruleDebt.offset(), rule.getDefaultRemediationOffset()) .isEquals(); } @@ -298,7 +298,7 @@ public class DebtModelBackup implements ServerComponent { private void disabledRuleDebt(RuleDto rule, Date updateDate, SqlSession session){ rule.setCharacteristicId(rule.getDefaultCharacteristicId() != null ? RuleDto.DISABLED_CHARACTERISTIC_ID : null); rule.setRemediationFunction(null); - rule.setRemediationFactor(null); + rule.setRemediationCoefficient(null); rule.setRemediationOffset(null); rule.setUpdatedAt(updateDate); ruleDao.update(rule, session); @@ -349,7 +349,7 @@ public class DebtModelBackup implements ServerComponent { private static RuleDebt toRuleDebt(RuleDto rule, String characteristicKey) { RuleDebt ruleDebt = new RuleDebt().setRuleKey(RuleKey.of(rule.getRepositoryKey(), rule.getRuleKey())); String function = rule.getRemediationFunction() != null ? rule.getRemediationFunction() : rule.getDefaultRemediationFunction(); - String factor = rule.getRemediationFactor() != null ? rule.getRemediationFactor() : rule.getDefaultRemediationFactor(); + String factor = rule.getRemediationCoefficient() != null ? rule.getRemediationCoefficient() : rule.getDefaultRemediationCoefficient(); String offset = rule.getRemediationOffset() != null ? rule.getRemediationOffset() : rule.getDefaultRemediationOffset(); ruleDebt.setCharacteristicKey(characteristicKey); ruleDebt.setFunction(DebtRemediationFunction.Type.valueOf(function)); diff --git a/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java b/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java index 521322cc48c..0c4b0cd2db6 100644 --- a/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java +++ b/sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java @@ -170,7 +170,7 @@ public class DebtModelOperations implements ServerComponent { /** * Disable characteristic and its sub characteristics or only sub characteristic. - * Will also update every rules linked to sub characteristics by setting characteristic id to -1 and remove function, factor and offset. + * Will also update every rules linked to sub characteristics by setting characteristic id to -1 and remove function, coefficient and offset. */ public void delete(int characteristicId) { checkPermission(); @@ -205,7 +205,7 @@ public class DebtModelOperations implements ServerComponent { for (RuleDto ruleDto : ruleDtos) { ruleDto.setCharacteristicId(RuleDto.DISABLED_CHARACTERISTIC_ID); ruleDto.setRemediationFunction(null); - ruleDto.setRemediationFactor(null); + ruleDto.setRemediationCoefficient(null); ruleDto.setRemediationOffset(null); ruleDto.setUpdatedAt(updateDate); ruleDao.update(ruleDto, session); diff --git a/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java b/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java index 40b1e27f48f..040f8468917 100644 --- a/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java +++ b/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java @@ -76,7 +76,7 @@ public class DebtModelService implements DebtModel { /** * Disable characteristic and sub characteristic or only sub characteristic. - * Will also update every rules linked to sub characteristics by setting characteristic id to -1 and remove function, factor and offset. + * Will also update every rules linked to sub characteristics by setting characteristic id to -1 and remove function, coefficient and offset. */ public void delete(int characteristicId) { debtModelOperations.delete(characteristicId); diff --git a/sonar-server/src/main/java/org/sonar/server/rule/RegisterRules.java b/sonar-server/src/main/java/org/sonar/server/rule/RegisterRules.java index 9d0261e5eb9..93fd8571951 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/RegisterRules.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/RegisterRules.java @@ -193,7 +193,7 @@ public class RegisterRules implements Startable { if (characteristic != null && remediationFunction != null) { ruleDto.setDefaultCharacteristicId(characteristic.getId()) .setDefaultRemediationFunction(remediationFunction.type().name()) - .setDefaultRemediationFactor(remediationFunction.factor()) + .setDefaultRemediationCoefficient(remediationFunction.coefficient()) .setDefaultRemediationOffset(remediationFunction.offset()) .setEffortToFixDescription(ruleDef.effortToFixDescription()); } @@ -272,7 +272,7 @@ public class RegisterRules implements Startable { boolean hasCharacteristic = characteristic != null; DebtRemediationFunction debtRemediationFunction = characteristic != null ? def.debtRemediationFunction() : null; Integer characteristicId = characteristic != null ? characteristic.getId() : null; - String remediationFactor = hasCharacteristic ? debtRemediationFunction.factor() : null; + String remediationFactor = hasCharacteristic ? debtRemediationFunction.coefficient() : null; String remediationOffset = hasCharacteristic ? debtRemediationFunction.offset() : null; String effortToFixDescription = hasCharacteristic ? def.effortToFixDescription() : null; @@ -285,8 +285,8 @@ public class RegisterRules implements Startable { dto.setDefaultRemediationFunction(remediationFunctionString); changed = true; } - if (!StringUtils.equals(dto.getDefaultRemediationFactor(), remediationFactor)) { - dto.setDefaultRemediationFactor(remediationFactor); + if (!StringUtils.equals(dto.getDefaultRemediationCoefficient(), remediationFactor)) { + dto.setDefaultRemediationCoefficient(remediationFactor); changed = true; } if (!StringUtils.equals(dto.getDefaultRemediationOffset(), remediationOffset)) { @@ -418,7 +418,7 @@ public class RegisterRules implements Startable { ruleDto.setStatus(parent.getStatus()); ruleDto.setDefaultCharacteristicId(parent.getDefaultCharacteristicId()); ruleDto.setDefaultRemediationFunction(parent.getDefaultRemediationFunction()); - ruleDto.setDefaultRemediationFactor(parent.getDefaultRemediationFactor()); + ruleDto.setDefaultRemediationCoefficient(parent.getDefaultRemediationCoefficient()); ruleDto.setDefaultRemediationOffset(parent.getDefaultRemediationOffset()); ruleDto.setEffortToFixDescription(parent.getEffortToFixDescription()); ruleDto.setUpdatedAt(buffer.now()); diff --git a/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java b/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java index c7e99ffad16..351ffbc70e7 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/CopyRequirementsFromCharacteristicsToRules.java @@ -51,7 +51,7 @@ import java.util.List; /** * This script copy every requirements from characteristics table (every row where rule_id is not null) to the rules table. * - * This script need to be executed after rules registration because default debt columns (characteristics, function, factor and offset) has to be populated + * This script need to be executed after rules registration because default debt columns (characteristics, function, coefficient and offset) has to be populated * in order to be able to compare default values with overridden values. * * @since 4.3 this component could be removed after 4 or 5 releases. diff --git a/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java b/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java index f96bfdbfab1..f9def473ead 100644 --- a/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java +++ b/sonar-server/src/test/java/org/sonar/server/debt/DebtModelBackupTest.java @@ -31,8 +31,8 @@ import org.mockito.invocation.InvocationOnMock; import org.mockito.runners.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import org.sonar.api.rule.RuleKey; -import org.sonar.api.server.debt.internal.DefaultDebtCharacteristic; import org.sonar.api.server.debt.DebtRemediationFunction; +import org.sonar.api.server.debt.internal.DefaultDebtCharacteristic; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; import org.sonar.api.utils.ValidationMessages; @@ -148,10 +148,10 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( // Rule with overridden debt values - new RuleDto().setRepositoryKey("squid").setRuleKey("UselessImportCheck").setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationFactor("2h").setRemediationOffset("15min"), + new RuleDto().setRepositoryKey("squid").setRuleKey("UselessImportCheck").setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationCoefficient("2h").setRemediationOffset("15min"), // Rule with default debt values - new RuleDto().setRepositoryKey("squid").setRuleKey("AvoidNPE").setDefaultCharacteristicId(2).setDefaultRemediationFunction("LINEAR").setDefaultRemediationFactor("2h") + new RuleDto().setRepositoryKey("squid").setRuleKey("AvoidNPE").setDefaultCharacteristicId(2).setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h") )); debtModelBackup.backup(); @@ -216,7 +216,7 @@ public class DebtModelBackupTest { .setCreatedAt(oldDate).setUpdatedAt(oldDate), // Should be ignored new RuleDto().setId(2).setRepositoryKey("checkstyle").setLanguage("java2") - .setCharacteristicId(3).setRemediationFunction("LINEAR").setRemediationFactor("2h") + .setCharacteristicId(3).setRemediationFunction("LINEAR").setRemediationCoefficient("2h") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -330,7 +330,7 @@ public class DebtModelBackupTest { )); when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( - new RuleDto().setRepositoryKey("squid").setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationFactor("2h").setRemediationOffset("15min") + new RuleDto().setRepositoryKey("squid").setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationCoefficient("2h").setRemediationOffset("15min") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -347,7 +347,7 @@ public class DebtModelBackupTest { RuleDto rule = ruleArgument.getValue(); assertThat(rule.getCharacteristicId()).isNull(); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -358,11 +358,11 @@ public class DebtModelBackupTest { public void restore_from_language() throws Exception { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( new RuleDto().setId(1).setRepositoryKey("squid").setLanguage("java") - .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationFactor("2h").setRemediationOffset("15min") + .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationCoefficient("2h").setRemediationOffset("15min") .setCreatedAt(oldDate).setUpdatedAt(oldDate), // Should be ignored because linked on another language new RuleDto().setId(2).setRepositoryKey("checkstyle").setLanguage("java2") - .setCharacteristicId(2).setRemediationFunction("LINEAR").setRemediationFactor("2h") + .setCharacteristicId(2).setRemediationFunction("LINEAR").setRemediationCoefficient("2h") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -378,7 +378,7 @@ public class DebtModelBackupTest { assertThat(rule.getId()).isEqualTo(1); assertThat(rule.getCharacteristicId()).isNull(); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -395,8 +395,8 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( // Linked on a disabled default characteristic -> Rule debt should be disabled new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck").setLanguage("java") - .setDefaultCharacteristicId(3).setDefaultRemediationFunction("LINEAR").setDefaultRemediationFactor("2h") - .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationFactor("2h").setRemediationOffset("15min") + .setDefaultCharacteristicId(3).setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h") + .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationCoefficient("2h").setRemediationOffset("15min") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -410,7 +410,7 @@ public class DebtModelBackupTest { assertThat(rule.getId()).isEqualTo(1); assertThat(rule.getCharacteristicId()).isEqualTo(-1); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -432,7 +432,7 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") - .setDefaultCharacteristicId(10).setDefaultRemediationFunction("LINEAR").setDefaultRemediationFactor("2h") + .setDefaultCharacteristicId(10).setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -446,7 +446,7 @@ public class DebtModelBackupTest { assertThat(rule.getId()).isEqualTo(1); assertThat(rule.getCharacteristicId()).isEqualTo(2); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -468,7 +468,7 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") - .setDefaultCharacteristicId(2).setDefaultRemediationFunction("LINEAR").setDefaultRemediationFactor("2h") + .setDefaultCharacteristicId(2).setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -482,7 +482,7 @@ public class DebtModelBackupTest { assertThat(rule.getId()).isEqualTo(1); assertThat(rule.getCharacteristicId()).isNull(); assertThat(rule.getRemediationFunction()).isEqualTo("LINEAR_OFFSET"); - assertThat(rule.getRemediationFactor()).isEqualTo("12h"); + assertThat(rule.getRemediationCoefficient()).isEqualTo("12h"); assertThat(rule.getRemediationOffset()).isEqualTo("11min"); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -504,7 +504,7 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") - .setDefaultCharacteristicId(2).setDefaultRemediationFunction("LINEAR_OFFSET").setDefaultRemediationFactor("2h").setDefaultRemediationOffset("15min") + .setDefaultCharacteristicId(2).setDefaultRemediationFunction("LINEAR_OFFSET").setDefaultRemediationCoefficient("2h").setDefaultRemediationOffset("15min") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -518,7 +518,7 @@ public class DebtModelBackupTest { assertThat(rule.getId()).isEqualTo(1); assertThat(rule.getCharacteristicId()).isNull(); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -537,7 +537,7 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck") - .setDefaultCharacteristicId(2).setDefaultRemediationFunction("LINEAR_OFFSET").setDefaultRemediationFactor("2h").setDefaultRemediationOffset("15min") + .setDefaultCharacteristicId(2).setDefaultRemediationFunction("LINEAR_OFFSET").setDefaultRemediationCoefficient("2h").setDefaultRemediationOffset("15min") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -551,7 +551,7 @@ public class DebtModelBackupTest { assertThat(rule.getId()).isEqualTo(1); assertThat(rule.getCharacteristicId()).isEqualTo(-1); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -584,7 +584,7 @@ public class DebtModelBackupTest { // As rule has no debt value, characteristic is set to null assertThat(rule.getCharacteristicId()).isNull(); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -602,11 +602,11 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck").setLanguage("java") - .setDefaultCharacteristicId(10).setDefaultRemediationFunction("LINEAR").setDefaultRemediationFactor("2h") + .setDefaultCharacteristicId(10).setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h") .setCreatedAt(oldDate).setUpdatedAt(oldDate), // Should be ignored new RuleDto().setId(2).setRepositoryKey("checkstyle").setLanguage("java2") - .setCharacteristicId(3).setRemediationFunction("LINEAR").setRemediationFactor("2h") + .setCharacteristicId(3).setRemediationFunction("LINEAR").setRemediationCoefficient("2h") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -636,8 +636,8 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( // Linked on a default disabled characteristic -> Rule debt should be disabled new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck").setLanguage("java") - .setDefaultCharacteristicId(3).setDefaultRemediationFunction("LINEAR").setDefaultRemediationFactor("2h") - .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationFactor("2h").setRemediationOffset("15min") + .setDefaultCharacteristicId(3).setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h") + .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationCoefficient("2h").setRemediationOffset("15min") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -654,7 +654,7 @@ public class DebtModelBackupTest { assertThat(rule.getId()).isEqualTo(1); assertThat(rule.getCharacteristicId()).isEqualTo(-1); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); @@ -670,8 +670,8 @@ public class DebtModelBackupTest { when(ruleDao.selectEnablesAndNonManual(session)).thenReturn(newArrayList( new RuleDto().setId(1).setRepositoryKey("squid").setRuleKey("UselessImportCheck").setLanguage("java") - .setDefaultCharacteristicId(3).setDefaultRemediationFunction("LINEAR").setDefaultRemediationFactor("2h") - .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationFactor("2h").setRemediationOffset("15min") + .setDefaultCharacteristicId(3).setDefaultRemediationFunction("LINEAR").setDefaultRemediationCoefficient("2h") + .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationCoefficient("2h").setRemediationOffset("15min") .setCreatedAt(oldDate).setUpdatedAt(oldDate) )); @@ -692,7 +692,7 @@ public class DebtModelBackupTest { assertThat(rule.getId()).isEqualTo(1); assertThat(rule.getCharacteristicId()).isEqualTo(-1); assertThat(rule.getRemediationFunction()).isNull(); - assertThat(rule.getRemediationFactor()).isNull(); + assertThat(rule.getRemediationCoefficient()).isNull(); assertThat(rule.getRemediationOffset()).isNull(); assertThat(rule.getUpdatedAt()).isEqualTo(now); diff --git a/sonar-server/src/test/java/org/sonar/server/debt/DebtModelOperationsTest.java b/sonar-server/src/test/java/org/sonar/server/debt/DebtModelOperationsTest.java index 97570e977c3..02deb490d5f 100644 --- a/sonar-server/src/test/java/org/sonar/server/debt/DebtModelOperationsTest.java +++ b/sonar-server/src/test/java/org/sonar/server/debt/DebtModelOperationsTest.java @@ -305,8 +305,8 @@ public class DebtModelOperationsTest { when(ruleDao.selectBySubCharacteristicId(2, batchSession)).thenReturn(newArrayList( new RuleDto() - .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationFactor("2h").setRemediationOffset("5min") - .setDefaultCharacteristicId(10).setDefaultRemediationFunction("LINEAR_OFFSET").setDefaultRemediationFactor("4h").setDefaultRemediationOffset("15min") + .setCharacteristicId(2).setRemediationFunction("LINEAR_OFFSET").setRemediationCoefficient("2h").setRemediationOffset("5min") + .setDefaultCharacteristicId(10).setDefaultRemediationFunction("LINEAR_OFFSET").setDefaultRemediationCoefficient("4h").setDefaultRemediationOffset("15min") )); when(dao.selectById(2, batchSession)).thenReturn(subCharacteristicDto); @@ -319,14 +319,14 @@ public class DebtModelOperationsTest { // Overridden debt data are disabled assertThat(ruleDto.getCharacteristicId()).isEqualTo(-1); assertThat(ruleDto.getRemediationFunction()).isNull(); - assertThat(ruleDto.getRemediationFactor()).isNull(); + assertThat(ruleDto.getRemediationCoefficient()).isNull(); assertThat(ruleDto.getRemediationOffset()).isNull(); assertThat(ruleDto.getUpdatedAt()).isEqualTo(now); // Default debt data should not be touched assertThat(ruleDto.getDefaultCharacteristicId()).isEqualTo(10); assertThat(ruleDto.getDefaultRemediationFunction()).isEqualTo("LINEAR_OFFSET"); - assertThat(ruleDto.getDefaultRemediationFactor()).isEqualTo("4h"); + assertThat(ruleDto.getDefaultRemediationCoefficient()).isEqualTo("4h"); assertThat(ruleDto.getDefaultRemediationOffset()).isEqualTo("15min"); ArgumentCaptor<CharacteristicDto> characteristicArgument = ArgumentCaptor.forClass(CharacteristicDto.class); @@ -345,7 +345,7 @@ public class DebtModelOperationsTest { when(mybatis.openBatchSession()).thenReturn(batchSession); when(ruleDao.selectBySubCharacteristicId(subCharacteristicDto.getId(), batchSession)).thenReturn(newArrayList( - new RuleDto().setCharacteristicId(subCharacteristicDto.getId()).setRemediationFunction("LINEAR_OFFSET").setRemediationFactor("2h").setRemediationOffset("5min") + new RuleDto().setCharacteristicId(subCharacteristicDto.getId()).setRemediationFunction("LINEAR_OFFSET").setRemediationCoefficient("2h").setRemediationOffset("5min") )); when(dao.selectCharacteristicsByParentId(1, batchSession)).thenReturn(newArrayList( subCharacteristicDto diff --git a/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRulesDefinitionTest.java b/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRulesDefinitionTest.java index a69875ff4b5..9bdbcaf21c1 100644 --- a/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRulesDefinitionTest.java +++ b/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRulesDefinitionTest.java @@ -182,7 +182,7 @@ public class DeprecatedRulesDefinitionTest { assertThat(rule.key()).isEqualTo("ConstantName"); assertThat(rule.debtSubCharacteristic()).isEqualTo("MEMORY_EFFICIENCY"); assertThat(rule.debtRemediationFunction().type()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET); - assertThat(rule.debtRemediationFunction().factor()).isEqualTo("1d"); + assertThat(rule.debtRemediationFunction().coefficient()).isEqualTo("1d"); assertThat(rule.debtRemediationFunction().offset()).isEqualTo("10min"); } |