aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-06-12 11:58:29 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-06-12 11:58:29 +0200
commit5105c84b6310750a73e5ad46ac0fda03e35b0720 (patch)
tree5b45d6cf5caf0edf72d4d95b94d634895cc8a824 /sonar-batch
parent0ebe203200cd2ff3778a61887e5e552c4d542854 (diff)
downloadsonarqube-5105c84b6310750a73e5ad46ac0fda03e35b0720.tar.gz
sonarqube-5105c84b6310750a73e5ad46ac0fda03e35b0720.zip
SONAR-5351 Create a migration to replace rules.parent_id to rules.template_id
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java5
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml4
-rw-r--r--sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml2
3 files changed, 6 insertions, 5 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java b/sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java
index 75f58e07e26..95762afd79d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java
@@ -61,8 +61,9 @@ public class ActiveRulesProvider extends ProviderAdapter {
NewActiveRule newActiveRule = builder.activate(rule.ruleKey());
newActiveRule.setSeverity(activeDto.getSeverityString());
newActiveRule.setLanguage(rule.getLanguage());
- if (rule.getParent() != null) {
- newActiveRule.setInternalKey(rule.getParent().getConfigKey());
+ Rule template = rule.getTemplate();
+ if (template != null) {
+ newActiveRule.setInternalKey(template.getConfigKey());
} else {
newActiveRule.setInternalKey(rule.getConfigKey());
}
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml
index 4e8910eff80..cc8a95653fc 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml
@@ -8,11 +8,11 @@
<rules tags="[null]" system_tags="[null]" id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"
plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" status="READY"
- cardinality="SINGLE" parent_id="[null]"/>
+ cardinality="SINGLE" template_id="[null]"/>
<rules tags="[null]" system_tags="[null]" id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck"
plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" status="READY"
- cardinality="SINGLE" parent_id="[null]"/>
+ cardinality="SINGLE" template_id="[null]"/>
<!-- project -->
<projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project"
diff --git a/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml b/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml
index 1b5ba6a8e92..d0b7b281116 100644
--- a/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml
+++ b/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml
@@ -1,6 +1,6 @@
<dataset>
<rules tags="[null]" system_tags="[null]" id="1" name="foo" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1"
- plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" parent_id="[null]"/>
+ plugin_name="maven-checkstyle-plugin" description="description" cardinality="SINGLE" template_id="[null]"/>
<metrics delete_historical_data="[null]" id="1" name="ncloc" val_type="INT" description="[null]" domain="[null]"
short_name="" qualitative="false" user_managed="false" enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>