diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-07-28 22:15:52 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-07-30 11:38:11 +0200 |
commit | ab244f2e1eaffb89aad3eb3659429c87249ab501 (patch) | |
tree | 10a63b79044a00159ae43a73b9dc15377c1b585d /server | |
parent | b54663f93281319dfed9f90a395c3dddd39665a3 (diff) | |
download | sonarqube-ab244f2e1eaffb89aad3eb3659429c87249ab501.tar.gz sonarqube-ab244f2e1eaffb89aad3eb3659429c87249ab501.zip |
Copy RuleDao#selectEnabledAndNonManual() from sonar-server to sonar-db
The source method in org.sonar.server.rule.db can not be dropped as it's still
used through DAOv2
Diffstat (limited to 'server')
3 files changed, 1 insertions, 57 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/db/RuleDao.java b/server/sonar-server/src/main/java/org/sonar/server/rule/db/RuleDao.java index 83db14f57f9..43ced3fc200 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/db/RuleDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/db/RuleDao.java @@ -92,10 +92,6 @@ public class RuleDao extends BaseDao<RuleMapper, RuleDto, RuleKey> { return mapper(session).selectAll(); } - public List<RuleDto> selectByEnabledAndNotManual(DbSession session) { - return mapper(session).selectEnablesAndNonManual(); - } - /** * Nested DTO RuleParams */ @@ -139,6 +135,6 @@ public class RuleDao extends BaseDao<RuleMapper, RuleDto, RuleKey> { } public List<RuleDto> selectEnabledAndNonManual(DbSession session) { - return mapper(session).selectEnablesAndNonManual(); + return mapper(session).selectEnabledAndNonManual(); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/db/RuleDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/db/RuleDaoTest.java index fbf5a7c9e8b..84237ad7ff8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/db/RuleDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/db/RuleDaoTest.java @@ -76,31 +76,6 @@ public class RuleDaoTest { } @Test - public void select_enables_and_non_manual() { - dbTester.prepareDbUnit(getClass(), "select_enables_and_non_manual.xml"); - List<RuleDto> ruleDtos = dao.selectByEnabledAndNotManual(dbTester.getSession()); - - assertThat(ruleDtos.size()).isEqualTo(1); - RuleDto ruleDto = ruleDtos.get(0); - assertThat(ruleDto.getId()).isEqualTo(1); - assertThat(ruleDto.getName()).isEqualTo("Avoid Null"); - assertThat(ruleDto.getDescription()).isEqualTo("Should avoid NULL"); - assertThat(ruleDto.getDescriptionFormat()).isEqualTo(Format.HTML); - assertThat(ruleDto.getStatus()).isEqualTo(RuleStatus.READY); - assertThat(ruleDto.getRepositoryKey()).isEqualTo("checkstyle"); - assertThat(ruleDto.getNoteData()).isEqualTo("Rule note with accents \u00e9\u00e8\u00e0"); - assertThat(ruleDto.getSubCharacteristicId()).isEqualTo(100); - assertThat(ruleDto.getDefaultSubCharacteristicId()).isEqualTo(101); - 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"); - } - - @Test public void select_by_id() { dbTester.prepareDbUnit(getClass(), "selectById.xml"); RuleDto ruleDto = dao.selectById(dbTester.getSession(), 2); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/rule/db/RuleDaoTest/select_enables_and_non_manual.xml b/server/sonar-server/src/test/resources/org/sonar/server/rule/db/RuleDaoTest/select_enables_and_non_manual.xml deleted file mode 100644 index fe85e591078..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/rule/db/RuleDaoTest/select_enables_and_non_manual.xml +++ /dev/null @@ -1,27 +0,0 @@ -<dataset> - - <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" - characteristic_id="100" default_characteristic_id="101" - 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"/> - - <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" - characteristic_id="[null]" default_characteristic_id="[null]" - 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]"/> - - <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" - characteristic_id="[null]" default_characteristic_id="[null]" - 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]"/> - -</dataset> |