diff options
author | Guillaume Jambet <guillaume.jambet@sonarsource.com> | 2018-04-10 09:33:09 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-04-26 20:20:50 +0200 |
commit | 99044b2859e0867684a6f5bb72129fdbd341cc4a (patch) | |
tree | 1ef5143113b781344374811838f1949a9c6dab20 /server/sonar-db-dao | |
parent | e75191dffd58fe63583c5da60eca9b5febf823b0 (diff) | |
download | sonarqube-99044b2859e0867684a6f5bb72129fdbd341cc4a.tar.gz sonarqube-99044b2859e0867684a6f5bb72129fdbd341cc4a.zip |
SONAR-10544 add IS_EXTERNAL and DESCRIPTION_URL column to RULES table
Diffstat (limited to 'server/sonar-db-dao')
3 files changed, 37 insertions, 0 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDefinitionDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDefinitionDto.java index c291d134b97..1b072c46594 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDefinitionDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDefinitionDto.java @@ -42,11 +42,13 @@ public class RuleDefinitionDto { private String ruleKey; private String description; private RuleDto.Format descriptionFormat; + private String descriptionURL; private RuleStatus status; private String name; private String configKey; private Integer severity; private boolean isTemplate; + private boolean isExternal; private String language; private Integer templateId; private String defRemediationFunction; @@ -120,6 +122,15 @@ public class RuleDefinitionDto { return this; } + public String getDescriptionURL() { + return descriptionURL; + } + + public RuleDefinitionDto setDescriptionURL(String descriptionURL) { + this.descriptionURL = descriptionURL; + return this; + } + public RuleDto.Format getDescriptionFormat() { return descriptionFormat; } @@ -185,6 +196,16 @@ public class RuleDefinitionDto { return this; } + + public boolean isExternal() { + return isExternal; + } + + public RuleDefinitionDto setIsExternal(boolean isExternal) { + this.isExternal = isExternal; + return this; + } + @CheckForNull public String getLanguage() { return language; diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml index 44b4ecf66a5..0d5acbf4bba 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml @@ -9,11 +9,13 @@ r.plugin_name as "repositoryKey", r.description, r.description_format as "descriptionFormat", + r.description_url as "descriptionURL", r.status, r.name, r.plugin_config_key as "configKey", r.priority as "severity", r.is_template as "isTemplate", + r.is_external as "isExternal", r.language as "language", r.template_id as "templateId", r.def_remediation_function as "defRemediationFunction", @@ -290,11 +292,13 @@ plugin_name, description, description_format, + description_url, status, name, plugin_config_key, priority, is_template, + is_external, language, template_id, def_remediation_function, @@ -313,11 +317,13 @@ #{repositoryKey,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{descriptionFormat,jdbcType=VARCHAR}, + #{descriptionURL,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{configKey,jdbcType=VARCHAR}, #{severity,jdbcType=INTEGER}, #{isTemplate,jdbcType=BOOLEAN}, + #{isExternal,jdbcType=BOOLEAN}, #{language,jdbcType=VARCHAR}, #{templateId,jdbcType=INTEGER}, #{defRemediationFunction,jdbcType=VARCHAR}, @@ -339,11 +345,13 @@ plugin_name=#{repositoryKey,jdbcType=VARCHAR}, description=#{description,jdbcType=VARCHAR}, description_format=#{descriptionFormat,jdbcType=VARCHAR}, + description_url=#{descriptionURL,jdbcType=VARCHAR}, status=#{status,jdbcType=VARCHAR}, name=#{name,jdbcType=VARCHAR}, plugin_config_key=#{configKey,jdbcType=VARCHAR}, priority=#{severity,jdbcType=INTEGER}, is_template=#{isTemplate,jdbcType=BOOLEAN}, + is_external=#{isExternal,jdbcType=BOOLEAN}, language=#{language,jdbcType=VARCHAR}, template_id=#{templateId,jdbcType=INTEGER}, def_remediation_function=#{defRemediationFunction,jdbcType=VARCHAR}, diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java index b585954a785..44e469219f9 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java @@ -476,10 +476,12 @@ public class RuleDaoTest { .setName("new name") .setDescription("new description") .setDescriptionFormat(RuleDto.Format.MARKDOWN) + .setDescriptionURL("https://eslint.org/docs/rules/no-cond-assign") .setStatus(RuleStatus.DEPRECATED) .setConfigKey("NewConfigKey") .setSeverity(Severity.INFO) .setIsTemplate(true) + .setIsExternal(true) .setLanguage("dart") .setTemplateId(3) .setDefRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString()) @@ -499,6 +501,7 @@ public class RuleDaoTest { assertThat(ruleDto.getName()).isEqualTo("new name"); assertThat(ruleDto.getDescription()).isEqualTo("new description"); assertThat(ruleDto.getDescriptionFormat()).isEqualTo(RuleDto.Format.MARKDOWN); + assertThat(ruleDto.getDescriptionURL()).isEqualTo("https://eslint.org/docs/rules/no-cond-assign"); assertThat(ruleDto.getStatus()).isEqualTo(RuleStatus.DEPRECATED); assertThat(ruleDto.getRuleKey()).isEqualTo("NewRuleKey"); assertThat(ruleDto.getRepositoryKey()).isEqualTo("plugin"); @@ -506,6 +509,7 @@ public class RuleDaoTest { assertThat(ruleDto.getSeverity()).isEqualTo(0); assertThat(ruleDto.getLanguage()).isEqualTo("dart"); assertThat(ruleDto.isTemplate()).isTrue(); + assertThat(ruleDto.isExternal()).isTrue(); assertThat(ruleDto.getTemplateId()).isEqualTo(3); assertThat(ruleDto.getDefRemediationFunction()).isEqualTo("LINEAR_OFFSET"); assertThat(ruleDto.getDefRemediationGapMultiplier()).isEqualTo("5d"); @@ -529,10 +533,12 @@ public class RuleDaoTest { .setName("new name") .setDescription("new description") .setDescriptionFormat(RuleDto.Format.MARKDOWN) + .setDescriptionURL("https://eslint.org/docs/rules/no-cond-assign") .setStatus(RuleStatus.DEPRECATED) .setConfigKey("NewConfigKey") .setSeverity(Severity.INFO) .setIsTemplate(true) + .setIsExternal(true) .setLanguage("dart") .setTemplateId(3) .setDefRemediationFunction(DebtRemediationFunction.Type.LINEAR_OFFSET.toString()) @@ -551,6 +557,7 @@ public class RuleDaoTest { assertThat(ruleDto.getName()).isEqualTo("new name"); assertThat(ruleDto.getDescription()).isEqualTo("new description"); assertThat(ruleDto.getDescriptionFormat()).isEqualTo(RuleDto.Format.MARKDOWN); + assertThat(ruleDto.getDescriptionURL()).isEqualTo("https://eslint.org/docs/rules/no-cond-assign"); assertThat(ruleDto.getStatus()).isEqualTo(RuleStatus.DEPRECATED); assertThat(ruleDto.getRuleKey()).isEqualTo("NewRuleKey"); assertThat(ruleDto.getRepositoryKey()).isEqualTo("plugin"); @@ -558,6 +565,7 @@ public class RuleDaoTest { assertThat(ruleDto.getSeverity()).isEqualTo(0); assertThat(ruleDto.getLanguage()).isEqualTo("dart"); assertThat(ruleDto.isTemplate()).isTrue(); + assertThat(ruleDto.isExternal()).isTrue(); assertThat(ruleDto.getTemplateId()).isEqualTo(3); assertThat(ruleDto.getDefRemediationFunction()).isEqualTo("LINEAR_OFFSET"); assertThat(ruleDto.getDefRemediationGapMultiplier()).isEqualTo("5d"); |