diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-07-23 20:55:46 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-07-23 20:56:27 +0200 |
commit | e4fdef49e36d269ef5365a3056af67c8c3d5aceb (patch) | |
tree | dcec45821e3d24e946eb13c1f80f8bebcf17804f /sonar-batch-protocol/src | |
parent | 0a123014a0781a516b580d4fa9ce76532f23071f (diff) | |
download | sonarqube-e4fdef49e36d269ef5365a3056af67c8c3d5aceb.tar.gz sonarqube-e4fdef49e36d269ef5365a3056af67c8c3d5aceb.zip |
SONAR-5417 Add rule name to active rule
Diffstat (limited to 'sonar-batch-protocol/src')
-rw-r--r-- | sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java | 9 | ||||
-rw-r--r-- | sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java index 144a34b292b..6c1992ac1e2 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java @@ -26,12 +26,13 @@ import java.util.Map; public class ActiveRule { private final String repositoryKey, ruleKey; - private final String severity, internalKey, language; + private final String name, severity, internalKey, language; private final Map<String, String> params = new HashMap<String, String>(); - public ActiveRule(String repositoryKey, String ruleKey, String severity, String internalKey, String language) { + public ActiveRule(String repositoryKey, String ruleKey, String name, String severity, String internalKey, String language) { this.repositoryKey = repositoryKey; this.ruleKey = ruleKey; + this.name = name; this.severity = severity; this.internalKey = internalKey; this.language = language; @@ -45,6 +46,10 @@ public class ActiveRule { return ruleKey; } + public String name() { + return name; + } + public String severity() { return severity; } diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java index 831f5e12cef..328939ca23d 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java @@ -38,7 +38,7 @@ public class ProjectReferentialsTest { ref.addQProfile(new QProfile("squid-java", "Java", "java", new SimpleDateFormat("dd/MM/yyyy").parse("14/03/1984"))); ref.addSettings("foo", new HashMap<String, String>()); ref.settings("foo").put("prop", "value"); - ref.addActiveRule(new ActiveRule("repo", "rule", "MAJOR", "rule", "java")); + ref.addActiveRule(new ActiveRule("repo", "rule", "Rule", "MAJOR", "rule", "java")); ref.setTimestamp(10); System.out.println(ref.toJson()); @@ -46,7 +46,7 @@ public class ProjectReferentialsTest { .assertEquals( "{timestamp:10," + "qprofilesByLanguage:{java:{key:\"squid-java\",name:Java,language:java,rulesUpdatedAt:\"Mar 14, 1984 12:00:00 AM\"}}," - + "activeRules:[{repositoryKey:repo,ruleKey:rule,severity:MAJOR,internalKey:rule,language:java,params:{}}]," + + "activeRules:[{repositoryKey:repo,ruleKey:rule,name:Rule,severity:MAJOR,internalKey:rule,language:java,params:{}}]," + "settingsByModule:{foo:{prop:value}}}", ref.toJson(), true); } |