From f49602ab2261ba05e9395557958eb23ce563978f Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 14 Mar 2014 14:02:28 +0100 Subject: [PATCH] Remove useless old debt model synchronization and renamed some debt classes --- ...va => DebtCharacteristicsXMLImporter.java} | 4 +- ...onizer.java => DebtModelSynchronizer.java} | 8 +-- ...mporter.java => DebtRulesXMLImporter.java} | 4 +- ...> DebtCharacteristicsXMLImporterTest.java} | 8 +-- ...st.java => DebtModelSynchronizerTest.java} | 8 +-- ...est.java => DebtRulesXMLImporterTest.java} | 42 +++++++-------- .../import_badly_formatted_xml.xml | 0 .../import_characteristics.xml | 0 ..._threshold_function_by_linear_function.xml | 0 ..._deprecated_constant_per_file_function.xml | 0 .../ignore_invalid_value.xml | 0 .../ignore_rule_on_root_characteristics.xml | 0 .../import_badly_formatted_xml.xml | 0 .../import_constant_issue.xml | 0 .../import_linear.xml | 0 .../import_linear_with_offset.xml | 0 .../import_rules.xml | 0 .../replace_mn_by_min.xml | 0 .../use_default_unit_when_no_unit.xml | 0 .../org/sonar/server/platform/Platform.java | 9 ++-- .../rule/DeprecatedRuleDefinitions.java | 26 ++++----- .../sonar/server/rule/RuleRegistration.java | 4 +- ...isticModel.java => RegisterDebtModel.java} | 12 ++--- .../startup/RegisterTechnicalDebtModel.java | 53 ------------------- .../rule/DeprecatedRuleDefinitionsTest.java | 8 +-- .../server/rule/RuleRegistrationTest.java | 8 +-- ...elTest.java => RegisterDebtModelTest.java} | 8 +-- .../RegisterTechnicalDebtModelTest.java | 43 --------------- 28 files changed, 74 insertions(+), 171 deletions(-) rename sonar-core/src/main/java/org/sonar/core/technicaldebt/{CharacteristicsDebtModelXMLImporter.java => DebtCharacteristicsXMLImporter.java} (96%) rename sonar-core/src/main/java/org/sonar/core/technicaldebt/{CharacteristicsDebtModelSynchronizer.java => DebtModelSynchronizer.java} (90%) rename sonar-core/src/main/java/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporter.java => DebtRulesXMLImporter.java} (98%) rename sonar-core/src/test/java/org/sonar/core/technicaldebt/{CharacteristicsDebtModelXMLImporterTest.java => DebtCharacteristicsXMLImporterTest.java} (89%) rename sonar-core/src/test/java/org/sonar/core/technicaldebt/{CharacteristicsDebtModelSynchronizerTest.java => DebtModelSynchronizerTest.java} (94%) rename sonar-core/src/test/java/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest.java => DebtRulesXMLImporterTest.java} (76%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{CharacteristicsDebtModelXMLImporterTest => DebtCharacteristicsXMLImporterTest}/import_badly_formatted_xml.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{CharacteristicsDebtModelXMLImporterTest => DebtCharacteristicsXMLImporterTest}/import_characteristics.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/convert_deprecated_linear_with_threshold_function_by_linear_function.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/ignore_deprecated_constant_per_file_function.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/ignore_invalid_value.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/ignore_rule_on_root_characteristics.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/import_badly_formatted_xml.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/import_constant_issue.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/import_linear.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/import_linear_with_offset.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/import_rules.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/replace_mn_by_min.xml (100%) rename sonar-core/src/test/resources/org/sonar/core/technicaldebt/{RulesDebtModelXMLImporterTest => DebtRulesXMLImporterTest}/use_default_unit_when_no_unit.xml (100%) rename sonar-server/src/main/java/org/sonar/server/startup/{RegisterDebtCharacteristicModel.java => RegisterDebtModel.java} (79%) delete mode 100644 sonar-server/src/main/java/org/sonar/server/startup/RegisterTechnicalDebtModel.java rename sonar-server/src/test/java/org/sonar/server/startup/{RegisterDebtCharacteristicModelTest.java => RegisterDebtModelTest.java} (78%) delete mode 100644 sonar-server/src/test/java/org/sonar/server/startup/RegisterTechnicalDebtModelTest.java diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporter.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporter.java similarity index 96% rename from sonar-core/src/main/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporter.java rename to sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporter.java index 24c6876d3ae..5b35bdf02db 100644 --- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporter.java +++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporter.java @@ -37,9 +37,9 @@ import javax.xml.stream.XMLStreamException; import java.io.Reader; import java.io.StringReader; -public class CharacteristicsDebtModelXMLImporter implements ServerExtension { +public class DebtCharacteristicsXMLImporter implements ServerExtension { - private static final Logger LOG = LoggerFactory.getLogger(CharacteristicsDebtModelXMLImporter.class); + private static final Logger LOG = LoggerFactory.getLogger(DebtCharacteristicsXMLImporter.class); public static final String CHARACTERISTIC = "chc"; public static final String CHARACTERISTIC_KEY = "key"; diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelSynchronizer.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtModelSynchronizer.java similarity index 90% rename from sonar-core/src/main/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelSynchronizer.java rename to sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtModelSynchronizer.java index 2caec82d248..7437d4d3885 100644 --- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelSynchronizer.java +++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtModelSynchronizer.java @@ -36,16 +36,16 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class CharacteristicsDebtModelSynchronizer implements ServerExtension { +public class DebtModelSynchronizer implements ServerExtension { - private static final Logger LOG = LoggerFactory.getLogger(CharacteristicsDebtModelSynchronizer.class); + private static final Logger LOG = LoggerFactory.getLogger(DebtModelSynchronizer.class); private final MyBatis mybatis; private final CharacteristicDao dao; private final TechnicalDebtModelRepository languageModelFinder; - private final CharacteristicsDebtModelXMLImporter importer; + private final DebtCharacteristicsXMLImporter importer; - public CharacteristicsDebtModelSynchronizer(MyBatis mybatis, CharacteristicDao dao, TechnicalDebtModelRepository modelRepository, CharacteristicsDebtModelXMLImporter importer) { + public DebtModelSynchronizer(MyBatis mybatis, CharacteristicDao dao, TechnicalDebtModelRepository modelRepository, DebtCharacteristicsXMLImporter importer) { this.mybatis = mybatis; this.dao = dao; this.languageModelFinder = modelRepository; diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/RulesDebtModelXMLImporter.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtRulesXMLImporter.java similarity index 98% rename from sonar-core/src/main/java/org/sonar/core/technicaldebt/RulesDebtModelXMLImporter.java rename to sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtRulesXMLImporter.java index f63c1cc6a8f..f0a43c34c06 100644 --- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/RulesDebtModelXMLImporter.java +++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/DebtRulesXMLImporter.java @@ -47,9 +47,9 @@ import java.util.List; import static com.google.common.collect.Lists.newArrayList; -public class RulesDebtModelXMLImporter implements ServerExtension { +public class DebtRulesXMLImporter implements ServerExtension { - private static final Logger LOG = LoggerFactory.getLogger(RulesDebtModelXMLImporter.class); + private static final Logger LOG = LoggerFactory.getLogger(DebtRulesXMLImporter.class); public static final String CHARACTERISTIC = "chc"; public static final String CHARACTERISTIC_KEY = "key"; diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporterTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporterTest.java similarity index 89% rename from sonar-core/src/test/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporterTest.java rename to sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporterTest.java index 4e2f75e5ff7..d1a924636a3 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporterTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporterTest.java @@ -30,14 +30,14 @@ import java.io.IOException; import static org.fest.assertions.Assertions.assertThat; -public class CharacteristicsDebtModelXMLImporterTest { +public class DebtCharacteristicsXMLImporterTest { @Test public void import_characteristics() { String xml = getFileContent("import_characteristics.xml"); ValidationMessages messages = ValidationMessages.create(); - DefaultTechnicalDebtModel debtModel = new CharacteristicsDebtModelXMLImporter().importXML(xml, messages); + DefaultTechnicalDebtModel debtModel = new DebtCharacteristicsXMLImporter().importXML(xml, messages); assertThat(debtModel.rootCharacteristics()).hasSize(2); assertThat(debtModel.rootCharacteristics().get(0).key()).isEqualTo("PORTABILITY"); @@ -63,7 +63,7 @@ public class CharacteristicsDebtModelXMLImporterTest { String xml = getFileContent("import_badly_formatted_xml.xml"); ValidationMessages messages = ValidationMessages.create(); - DefaultTechnicalDebtModel debtModel = new CharacteristicsDebtModelXMLImporter().importXML(xml, messages); + DefaultTechnicalDebtModel debtModel = new DebtCharacteristicsXMLImporter().importXML(xml, messages); checkXmlCorrectlyImported(debtModel, messages); } @@ -84,7 +84,7 @@ public class CharacteristicsDebtModelXMLImporterTest { private String getFileContent(String file) { try { - return Resources.toString(Resources.getResource(CharacteristicsDebtModelXMLImporterTest.class, "CharacteristicsDebtModelXMLImporterTest/" + file), Charsets.UTF_8); + return Resources.toString(Resources.getResource(DebtCharacteristicsXMLImporterTest.class, "DebtCharacteristicsXMLImporterTest/" + file), Charsets.UTF_8); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelSynchronizerTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtModelSynchronizerTest.java similarity index 94% rename from sonar-core/src/test/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelSynchronizerTest.java rename to sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtModelSynchronizerTest.java index bdcd88db979..64525b009d9 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/CharacteristicsDebtModelSynchronizerTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtModelSynchronizerTest.java @@ -46,7 +46,7 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) -public class CharacteristicsDebtModelSynchronizerTest { +public class DebtModelSynchronizerTest { @Mock MyBatis myBatis; @@ -61,13 +61,13 @@ public class CharacteristicsDebtModelSynchronizerTest { CharacteristicDao dao; @Mock - CharacteristicsDebtModelXMLImporter xmlImporter; + DebtCharacteristicsXMLImporter xmlImporter; Integer currentId = 1; private DefaultTechnicalDebtModel defaultModel; - private CharacteristicsDebtModelSynchronizer manager; + private DebtModelSynchronizer manager; @Before public void initAndMerge() throws Exception { @@ -88,7 +88,7 @@ public class CharacteristicsDebtModelSynchronizerTest { }).when(dao).insert(any(CharacteristicDto.class), any(SqlSession.class)); - manager = new CharacteristicsDebtModelSynchronizer(myBatis, dao, technicalDebtModelRepository, xmlImporter); + manager = new DebtModelSynchronizer(myBatis, dao, technicalDebtModelRepository, xmlImporter); } @Test diff --git a/sonar-core/src/test/java/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest.java b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest.java similarity index 76% rename from sonar-core/src/test/java/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest.java rename to sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest.java index bdd72eb7736..5fd8081867b 100644 --- a/sonar-core/src/test/java/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest.java +++ b/sonar-core/src/test/java/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest.java @@ -31,15 +31,15 @@ import java.util.List; import static org.fest.assertions.Assertions.assertThat; -public class RulesDebtModelXMLImporterTest { +public class DebtRulesXMLImporterTest { - RulesDebtModelXMLImporter importer = new RulesDebtModelXMLImporter(); + DebtRulesXMLImporter importer = new DebtRulesXMLImporter(); @Test public void import_rules() { String xml = getFileContent("import_rules.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).hasSize(2); } @@ -47,10 +47,10 @@ public class RulesDebtModelXMLImporterTest { public void import_linear() { String xml = getFileContent("import_linear.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).hasSize(1); - RulesDebtModelXMLImporter.RuleDebt ruleDebt = results.get(0); + DebtRulesXMLImporter.RuleDebt ruleDebt = results.get(0); assertThat(ruleDebt.characteristicKey()).isEqualTo("MEMORY_EFFICIENCY"); assertThat(ruleDebt.ruleKey()).isEqualTo(RuleKey.of("checkstyle", "Regexp")); assertThat(ruleDebt.function()).isEqualTo(RemediationFunction.LINEAR); @@ -62,10 +62,10 @@ public class RulesDebtModelXMLImporterTest { public void import_linear_with_offset() { String xml = getFileContent("import_linear_with_offset.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).hasSize(1); - RulesDebtModelXMLImporter.RuleDebt ruleDebt = results.get(0); + DebtRulesXMLImporter.RuleDebt ruleDebt = results.get(0); assertThat(ruleDebt.characteristicKey()).isEqualTo("MEMORY_EFFICIENCY"); assertThat(ruleDebt.function()).isEqualTo(RemediationFunction.LINEAR_OFFSET); assertThat(ruleDebt.factor()).isEqualTo("3h"); @@ -76,10 +76,10 @@ public class RulesDebtModelXMLImporterTest { public void import_constant_issue() { String xml = getFileContent("import_constant_issue.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).hasSize(1); - RulesDebtModelXMLImporter.RuleDebt ruleDebt = results.get(0); + DebtRulesXMLImporter.RuleDebt ruleDebt = results.get(0); assertThat(ruleDebt.characteristicKey()).isEqualTo("MEMORY_EFFICIENCY"); assertThat(ruleDebt.function()).isEqualTo(RemediationFunction.CONSTANT_ISSUE); assertThat(ruleDebt.factor()).isEqualTo("0d"); @@ -90,10 +90,10 @@ public class RulesDebtModelXMLImporterTest { public void use_default_unit_when_no_unit() { String xml = getFileContent("use_default_unit_when_no_unit.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).hasSize(1); - RulesDebtModelXMLImporter.RuleDebt ruleDebt = results.get(0); + DebtRulesXMLImporter.RuleDebt ruleDebt = results.get(0); assertThat(ruleDebt.characteristicKey()).isEqualTo("MEMORY_EFFICIENCY"); assertThat(ruleDebt.function()).isEqualTo(RemediationFunction.LINEAR); assertThat(ruleDebt.factor()).isEqualTo("3d"); @@ -104,10 +104,10 @@ public class RulesDebtModelXMLImporterTest { public void replace_mn_by_min() { String xml = getFileContent("replace_mn_by_min.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).hasSize(1); - RulesDebtModelXMLImporter.RuleDebt ruleDebt = results.get(0); + DebtRulesXMLImporter.RuleDebt ruleDebt = results.get(0); assertThat(ruleDebt.characteristicKey()).isEqualTo("MEMORY_EFFICIENCY"); assertThat(ruleDebt.function()).isEqualTo(RemediationFunction.LINEAR); assertThat(ruleDebt.factor()).isEqualTo("3min"); @@ -118,10 +118,10 @@ public class RulesDebtModelXMLImporterTest { public void convert_deprecated_linear_with_threshold_function_by_linear_function() { String xml = getFileContent("convert_deprecated_linear_with_threshold_function_by_linear_function.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).hasSize(1); - RulesDebtModelXMLImporter.RuleDebt ruleDebt = results.get(0); + DebtRulesXMLImporter.RuleDebt ruleDebt = results.get(0); assertThat(ruleDebt.characteristicKey()).isEqualTo("MEMORY_EFFICIENCY"); assertThat(ruleDebt.function()).isEqualTo(RemediationFunction.LINEAR); assertThat(ruleDebt.factor()).isEqualTo("3h"); @@ -132,7 +132,7 @@ public class RulesDebtModelXMLImporterTest { public void ignore_deprecated_constant_per_file_function() { String xml = getFileContent("ignore_deprecated_constant_per_file_function.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).isEmpty(); } @@ -140,7 +140,7 @@ public class RulesDebtModelXMLImporterTest { public void ignore_rule_on_root_characteristics() { String xml = getFileContent("ignore_rule_on_root_characteristics.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).isEmpty(); } @@ -148,10 +148,10 @@ public class RulesDebtModelXMLImporterTest { public void import_badly_formatted_xml() { String xml = getFileContent("import_badly_formatted_xml.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).hasSize(1); - RulesDebtModelXMLImporter.RuleDebt ruleDebt = results.get(0); + DebtRulesXMLImporter.RuleDebt ruleDebt = results.get(0); assertThat(ruleDebt.characteristicKey()).isEqualTo("MEMORY_EFFICIENCY"); assertThat(ruleDebt.ruleKey()).isEqualTo(RuleKey.of("checkstyle", "Regexp")); assertThat(ruleDebt.function()).isEqualTo(RemediationFunction.LINEAR); @@ -162,13 +162,13 @@ public class RulesDebtModelXMLImporterTest { @Test public void ignore_invalid_value() throws Exception { String xml = getFileContent("ignore_invalid_value.xml"); - List results = importer.importXML(xml); + List results = importer.importXML(xml); assertThat(results).isEmpty(); } private String getFileContent(String file) { try { - return Resources.toString(Resources.getResource(RulesDebtModelXMLImporterTest.class, "RulesDebtModelXMLImporterTest/" + file), Charsets.UTF_8); + return Resources.toString(Resources.getResource(DebtRulesXMLImporterTest.class, "DebtRulesXMLImporterTest/" + file), Charsets.UTF_8); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporterTest/import_badly_formatted_xml.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporterTest/import_badly_formatted_xml.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporterTest/import_badly_formatted_xml.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporterTest/import_badly_formatted_xml.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporterTest/import_characteristics.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporterTest/import_characteristics.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/CharacteristicsDebtModelXMLImporterTest/import_characteristics.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtCharacteristicsXMLImporterTest/import_characteristics.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/convert_deprecated_linear_with_threshold_function_by_linear_function.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/convert_deprecated_linear_with_threshold_function_by_linear_function.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/convert_deprecated_linear_with_threshold_function_by_linear_function.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/convert_deprecated_linear_with_threshold_function_by_linear_function.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/ignore_deprecated_constant_per_file_function.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/ignore_deprecated_constant_per_file_function.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/ignore_deprecated_constant_per_file_function.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/ignore_deprecated_constant_per_file_function.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/ignore_invalid_value.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/ignore_invalid_value.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/ignore_invalid_value.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/ignore_invalid_value.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/ignore_rule_on_root_characteristics.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/ignore_rule_on_root_characteristics.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/ignore_rule_on_root_characteristics.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/ignore_rule_on_root_characteristics.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_badly_formatted_xml.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_badly_formatted_xml.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_badly_formatted_xml.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_badly_formatted_xml.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_constant_issue.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_constant_issue.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_constant_issue.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_constant_issue.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_linear.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_linear.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_linear.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_linear.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_linear_with_offset.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_linear_with_offset.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_linear_with_offset.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_linear_with_offset.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_rules.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_rules.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/import_rules.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/import_rules.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/replace_mn_by_min.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/replace_mn_by_min.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/replace_mn_by_min.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/replace_mn_by_min.xml diff --git a/sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/use_default_unit_when_no_unit.xml b/sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/use_default_unit_when_no_unit.xml similarity index 100% rename from sonar-core/src/test/resources/org/sonar/core/technicaldebt/RulesDebtModelXMLImporterTest/use_default_unit_when_no_unit.xml rename to sonar-core/src/test/resources/org/sonar/core/technicaldebt/DebtRulesXMLImporterTest/use_default_unit_when_no_unit.xml diff --git a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java index 556a357015c..b72c019dc07 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java @@ -384,11 +384,11 @@ public final class Platform { // technical debt servicesContainer.addSingleton(DebtService.class); servicesContainer.addSingleton(TechnicalDebtModelSynchronizer.class); - servicesContainer.addSingleton(CharacteristicsDebtModelSynchronizer.class); + servicesContainer.addSingleton(DebtModelSynchronizer.class); servicesContainer.addSingleton(TechnicalDebtModelRepository.class); servicesContainer.addSingleton(TechnicalDebtXMLImporter.class); - servicesContainer.addSingleton(RulesDebtModelXMLImporter.class); - servicesContainer.addSingleton(CharacteristicsDebtModelXMLImporter.class); + servicesContainer.addSingleton(DebtRulesXMLImporter.class); + servicesContainer.addSingleton(DebtCharacteristicsXMLImporter.class); servicesContainer.addSingleton(DefaultTechnicalDebtManager.class); // source @@ -437,8 +437,7 @@ public final class Platform { startupContainer.addSingleton(RuleRegistration.class); startupContainer.addSingleton(RegisterNewProfiles.class); startupContainer.addSingleton(JdbcDriverDeployer.class); - startupContainer.addSingleton(RegisterDebtCharacteristicModel.class); - startupContainer.addSingleton(RegisterTechnicalDebtModel.class); + startupContainer.addSingleton(RegisterDebtModel.class); startupContainer.addSingleton(GeneratePluginIndex.class); startupContainer.addSingleton(GenerateBootstrapIndex.class); startupContainer.addSingleton(RegisterNewMeasureFilters.class); diff --git a/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRuleDefinitions.java b/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRuleDefinitions.java index 571d4af77ce..42171caef46 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRuleDefinitions.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/DeprecatedRuleDefinitions.java @@ -31,7 +31,7 @@ import org.sonar.api.server.rule.RuleDefinitions; import org.sonar.api.server.rule.RuleParamType; import org.sonar.check.Cardinality; import org.sonar.core.i18n.RuleI18nManager; -import org.sonar.core.technicaldebt.RulesDebtModelXMLImporter; +import org.sonar.core.technicaldebt.DebtRulesXMLImporter; import org.sonar.core.technicaldebt.TechnicalDebtModelRepository; import javax.annotation.CheckForNull; @@ -53,23 +53,23 @@ public class DeprecatedRuleDefinitions implements RuleDefinitions { private final RuleRepository[] repositories; private final TechnicalDebtModelRepository languageModelFinder; - private final RulesDebtModelXMLImporter importer; + private final DebtRulesXMLImporter importer; - public DeprecatedRuleDefinitions(RuleI18nManager i18n, RuleRepository[] repositories, TechnicalDebtModelRepository languageModelFinder, RulesDebtModelXMLImporter importer) { + public DeprecatedRuleDefinitions(RuleI18nManager i18n, RuleRepository[] repositories, TechnicalDebtModelRepository languageModelFinder, DebtRulesXMLImporter importer) { this.i18n = i18n; this.repositories = repositories; this.languageModelFinder = languageModelFinder; this.importer = importer; } - public DeprecatedRuleDefinitions(RuleI18nManager i18n, TechnicalDebtModelRepository languageModelFinder, RulesDebtModelXMLImporter importer) { + public DeprecatedRuleDefinitions(RuleI18nManager i18n, TechnicalDebtModelRepository languageModelFinder, DebtRulesXMLImporter importer) { this(i18n, new RuleRepository[0], languageModelFinder, importer); } @Override public void define(Context context) { // Load rule debt definitions from xml files provided by plugin - List ruleDebts = loadRuleDebtList(); + List ruleDebts = loadRuleDebtList(); for (RuleRepository repository : repositories) { // RuleRepository API does not handle difference between new and extended repositories, @@ -101,8 +101,8 @@ public class DeprecatedRuleDefinitions implements RuleDefinitions { } } - private void updateRuleDebtDefinitions(NewRule newRule, String repoKey, String ruleKey, List ruleDebts){ - RulesDebtModelXMLImporter.RuleDebt ruleDebt = findRequirement(ruleDebts, repoKey, ruleKey); + private void updateRuleDebtDefinitions(NewRule newRule, String repoKey, String ruleKey, List ruleDebts){ + DebtRulesXMLImporter.RuleDebt ruleDebt = findRequirement(ruleDebts, repoKey, ruleKey); if (ruleDebt != null) { newRule.setCharacteristicKey(ruleDebt.characteristicKey()); newRule.setRemediationFunction(ruleDebt.function()); @@ -138,15 +138,15 @@ public class DeprecatedRuleDefinitions implements RuleDefinitions { return StringUtils.defaultIfBlank(desc, null); } - public List loadRuleDebtList() { - List ruleDebtList = newArrayList(); + public List loadRuleDebtList() { + List ruleDebtList = newArrayList(); for (String pluginKey : getContributingPluginListWithoutSqale()) { ruleDebtList.addAll(loadRuleDebtsFromXml(pluginKey)); } return ruleDebtList; } - public List loadRuleDebtsFromXml(String pluginKey) { + public List loadRuleDebtsFromXml(String pluginKey) { Reader xmlFileReader = null; try { xmlFileReader = languageModelFinder.createReaderForXMLFile(pluginKey); @@ -163,10 +163,10 @@ public class DeprecatedRuleDefinitions implements RuleDefinitions { } @CheckForNull - private RulesDebtModelXMLImporter.RuleDebt findRequirement(List requirements, final String repoKey, final String ruleKey) { - return Iterables.find(requirements, new Predicate() { + private DebtRulesXMLImporter.RuleDebt findRequirement(List requirements, final String repoKey, final String ruleKey) { + return Iterables.find(requirements, new Predicate() { @Override - public boolean apply(RulesDebtModelXMLImporter.RuleDebt input) { + public boolean apply(DebtRulesXMLImporter.RuleDebt input) { return input.ruleKey().equals(RuleKey.of(repoKey, ruleKey)); } }, null); diff --git a/sonar-server/src/main/java/org/sonar/server/rule/RuleRegistration.java b/sonar-server/src/main/java/org/sonar/server/rule/RuleRegistration.java index afaa1b7d0fe..f3e699dba4e 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule/RuleRegistration.java +++ b/sonar-server/src/main/java/org/sonar/server/rule/RuleRegistration.java @@ -42,7 +42,7 @@ import org.sonar.core.rule.*; import org.sonar.core.technicaldebt.db.CharacteristicDao; import org.sonar.core.technicaldebt.db.CharacteristicDto; import org.sonar.server.qualityprofile.ProfilesManager; -import org.sonar.server.startup.RegisterDebtCharacteristicModel; +import org.sonar.server.startup.RegisterDebtModel; import javax.annotation.CheckForNull; @@ -77,7 +77,7 @@ public class RuleRegistration implements Startable { public RuleRegistration(RuleDefinitionsLoader defLoader, ProfilesManager profilesManager, RuleRegistry ruleRegistry, ESRuleTags esRuleTags, RuleTagOperations ruleTagOperations, MyBatis myBatis, RuleDao ruleDao, RuleTagDao ruleTagDao, ActiveRuleDao activeRuleDao, CharacteristicDao characteristicDao, - RegisterDebtCharacteristicModel registerTechnicalDebtModel) { + RegisterDebtModel registerTechnicalDebtModel) { this.defLoader = defLoader; this.profilesManager = profilesManager; this.ruleRegistry = ruleRegistry; diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterDebtCharacteristicModel.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterDebtModel.java similarity index 79% rename from sonar-server/src/main/java/org/sonar/server/startup/RegisterDebtCharacteristicModel.java rename to sonar-server/src/main/java/org/sonar/server/startup/RegisterDebtModel.java index fcd9f8bd27e..7006a1f8926 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterDebtCharacteristicModel.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterDebtModel.java @@ -24,20 +24,20 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.utils.TimeProfiler; import org.sonar.api.utils.ValidationMessages; -import org.sonar.core.technicaldebt.CharacteristicsDebtModelSynchronizer; +import org.sonar.core.technicaldebt.DebtModelSynchronizer; -public class RegisterDebtCharacteristicModel { +public class RegisterDebtModel { - private static final Logger LOGGER = LoggerFactory.getLogger(RegisterDebtCharacteristicModel.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RegisterDebtModel.class); - private final CharacteristicsDebtModelSynchronizer manager; + private final DebtModelSynchronizer manager; - public RegisterDebtCharacteristicModel(CharacteristicsDebtModelSynchronizer manager) { + public RegisterDebtModel(DebtModelSynchronizer manager) { this.manager = manager; } public void start() { - TimeProfiler profiler = new TimeProfiler(LOGGER).start("Register Debt Characteristics Model"); + TimeProfiler profiler = new TimeProfiler(LOGGER).start("Register technical debt model"); manager.synchronize(ValidationMessages.create()); profiler.stop(); } diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterTechnicalDebtModel.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterTechnicalDebtModel.java deleted file mode 100644 index d533dd7cf28..00000000000 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterTechnicalDebtModel.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -package org.sonar.server.startup; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.utils.TimeProfiler; -import org.sonar.api.utils.ValidationMessages; -import org.sonar.core.technicaldebt.TechnicalDebtModelSynchronizer; -import org.sonar.core.technicaldebt.TechnicalDebtRuleCache; -import org.sonar.server.rule.RuleRegistration; - -public final class RegisterTechnicalDebtModel { - - private static final Logger LOGGER = LoggerFactory.getLogger(RegisterTechnicalDebtModel.class); - - private final TechnicalDebtModelSynchronizer manager; - private final RuleFinder ruleFinder; - - /** - * @param registerRulesBeforeModels used only to be started after the creation of check templates - */ - public RegisterTechnicalDebtModel(TechnicalDebtModelSynchronizer manager, RuleFinder ruleFinder, RuleRegistration registerRulesBeforeModels) { - this.manager = manager; - this.ruleFinder = ruleFinder; - } - - public void start() { - TimeProfiler profiler = new TimeProfiler(LOGGER).start("Register Technical Debt Model"); - TechnicalDebtRuleCache technicalDebtRuleCache = new TechnicalDebtRuleCache(ruleFinder); - manager.synchronize(ValidationMessages.create(), technicalDebtRuleCache); - profiler.stop(); - } - -} diff --git a/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRuleDefinitionsTest.java b/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRuleDefinitionsTest.java index a34677da554..d03dcefd2d6 100644 --- a/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRuleDefinitionsTest.java +++ b/sonar-server/src/test/java/org/sonar/server/rule/DeprecatedRuleDefinitionsTest.java @@ -32,7 +32,7 @@ import org.sonar.api.rules.RulePriority; import org.sonar.api.rules.RuleRepository; import org.sonar.api.server.rule.RuleDefinitions; import org.sonar.core.i18n.RuleI18nManager; -import org.sonar.core.technicaldebt.RulesDebtModelXMLImporter; +import org.sonar.core.technicaldebt.DebtRulesXMLImporter; import org.sonar.core.technicaldebt.TechnicalDebtModelRepository; import java.io.Reader; @@ -55,7 +55,7 @@ public class DeprecatedRuleDefinitionsTest { TechnicalDebtModelRepository debtModelRepository; @Mock - RulesDebtModelXMLImporter importer; + DebtRulesXMLImporter importer; static class CheckstyleRules extends RuleRepository { public CheckstyleRules() { @@ -154,8 +154,8 @@ public class DeprecatedRuleDefinitionsTest { public void define_rule_debt() throws Exception { RuleDefinitions.Context context = new RuleDefinitions.Context(); - List ruleDebts = newArrayList( - new RulesDebtModelXMLImporter.RuleDebt() + List ruleDebts = newArrayList( + new DebtRulesXMLImporter.RuleDebt() .setCharacteristicKey("MEMORY_EFFICIENCY") .setRuleKey(RuleKey.of("checkstyle", "ConstantName")) .setFunction(RemediationFunction.LINEAR_OFFSET) diff --git a/sonar-server/src/test/java/org/sonar/server/rule/RuleRegistrationTest.java b/sonar-server/src/test/java/org/sonar/server/rule/RuleRegistrationTest.java index 90f691f353f..5c07b56addd 100644 --- a/sonar-server/src/test/java/org/sonar/server/rule/RuleRegistrationTest.java +++ b/sonar-server/src/test/java/org/sonar/server/rule/RuleRegistrationTest.java @@ -34,7 +34,7 @@ import org.sonar.core.rule.RuleDao; import org.sonar.core.rule.RuleTagDao; import org.sonar.core.technicaldebt.db.CharacteristicDao; import org.sonar.server.qualityprofile.ProfilesManager; -import org.sonar.server.startup.RegisterDebtCharacteristicModel; +import org.sonar.server.startup.RegisterDebtModel; import static org.fest.assertions.Assertions.assertThat; import static org.fest.assertions.Fail.fail; @@ -68,7 +68,7 @@ public class RuleRegistrationTest extends AbstractDaoTestCase { ruleTagOperations = new RuleTagOperations(ruleTagDao, esRuleTags); characteristicDao = new CharacteristicDao(myBatis); task = new RuleRegistration(new RuleDefinitionsLoader(mock(RuleRepositories.class), new RuleDefinitions[]{new FakeRepository()}), - profilesManager, ruleRegistry, esRuleTags, ruleTagOperations, myBatis, ruleDao, ruleTagDao, activeRuleDao, characteristicDao, mock(RegisterDebtCharacteristicModel.class)); + profilesManager, ruleRegistry, esRuleTags, ruleTagOperations, myBatis, ruleDao, ruleTagDao, activeRuleDao, characteristicDao, mock(RegisterDebtModel.class)); } @Test @@ -215,7 +215,7 @@ public class RuleRegistrationTest extends AbstractDaoTestCase { @Test public void test_high_number_of_rules() { task = new RuleRegistration(new RuleDefinitionsLoader(mock(RuleRepositories.class), new RuleDefinitions[]{new BigRepository()}), - profilesManager, ruleRegistry, esRuleTags, ruleTagOperations, myBatis, ruleDao, ruleTagDao, activeRuleDao, characteristicDao, mock(RegisterDebtCharacteristicModel.class)); + profilesManager, ruleRegistry, esRuleTags, ruleTagOperations, myBatis, ruleDao, ruleTagDao, activeRuleDao, characteristicDao, mock(RegisterDebtModel.class)); setupData("shared"); task.start(); @@ -230,7 +230,7 @@ public class RuleRegistrationTest extends AbstractDaoTestCase { public void insert_extended_repositories() { task = new RuleRegistration(new RuleDefinitionsLoader(mock(RuleRepositories.class), new RuleDefinitions[]{ new FindbugsRepository(), new FbContribRepository()}), - profilesManager, ruleRegistry, esRuleTags, ruleTagOperations, myBatis, ruleDao, ruleTagDao, activeRuleDao, characteristicDao, mock(RegisterDebtCharacteristicModel.class)); + profilesManager, ruleRegistry, esRuleTags, ruleTagOperations, myBatis, ruleDao, ruleTagDao, activeRuleDao, characteristicDao, mock(RegisterDebtModel.class)); setupData("empty"); task.start(); diff --git a/sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtCharacteristicModelTest.java b/sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtModelTest.java similarity index 78% rename from sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtCharacteristicModelTest.java rename to sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtModelTest.java index 52607362d49..be235f4a8f6 100644 --- a/sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtCharacteristicModelTest.java +++ b/sonar-server/src/test/java/org/sonar/server/startup/RegisterDebtModelTest.java @@ -22,17 +22,17 @@ package org.sonar.server.startup; import org.junit.Test; import org.sonar.api.utils.ValidationMessages; -import org.sonar.core.technicaldebt.CharacteristicsDebtModelSynchronizer; +import org.sonar.core.technicaldebt.DebtModelSynchronizer; import static org.mockito.Matchers.any; import static org.mockito.Mockito.*; -public class RegisterDebtCharacteristicModelTest { +public class RegisterDebtModelTest { @Test public void create_model() throws Exception { - CharacteristicsDebtModelSynchronizer synchronizer = mock(CharacteristicsDebtModelSynchronizer.class); - RegisterDebtCharacteristicModel sqaleDefinition = new RegisterDebtCharacteristicModel(synchronizer); + DebtModelSynchronizer synchronizer = mock(DebtModelSynchronizer.class); + RegisterDebtModel sqaleDefinition = new RegisterDebtModel(synchronizer); sqaleDefinition.start(); diff --git a/sonar-server/src/test/java/org/sonar/server/startup/RegisterTechnicalDebtModelTest.java b/sonar-server/src/test/java/org/sonar/server/startup/RegisterTechnicalDebtModelTest.java deleted file mode 100644 index 21015edad8d..00000000000 --- a/sonar-server/src/test/java/org/sonar/server/startup/RegisterTechnicalDebtModelTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - */ -package org.sonar.server.startup; - -import org.junit.Test; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.utils.ValidationMessages; -import org.sonar.core.technicaldebt.TechnicalDebtModelSynchronizer; -import org.sonar.core.technicaldebt.TechnicalDebtRuleCache; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.*; - -public class RegisterTechnicalDebtModelTest { - - @Test - public void create_model() throws Exception { - TechnicalDebtModelSynchronizer manger = mock(TechnicalDebtModelSynchronizer.class); - RuleFinder ruleFinder = mock(RuleFinder.class); - RegisterTechnicalDebtModel sqaleDefinition = new RegisterTechnicalDebtModel(manger, ruleFinder, null); - - sqaleDefinition.start(); - - verify(manger, times(1)).synchronize(any(ValidationMessages.class), any(TechnicalDebtRuleCache.class)); - } -} -- 2.39.5