aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin/src
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-12-19 18:02:12 +0100
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-12-19 18:02:12 +0100
commita9ffa9b075c9015b9725a7aa5442c1cff78c6146 (patch)
tree4ef34e6ba689bd3e8594d08294d9794994a72dec /plugins/sonar-core-plugin/src
parent90b37b0a075a6d85f28d1534e67aff947b619b5a (diff)
downloadsonarqube-a9ffa9b075c9015b9725a7aa5442c1cff78c6146.tar.gz
sonarqube-a9ffa9b075c9015b9725a7aa5442c1cff78c6146.zip
SONAR-5970 Have tag changes appear in email notification
Diffstat (limited to 'plugins/sonar-core-plugin/src')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplate.java9
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java3
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt1
3 files changed, 12 insertions, 1 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplate.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplate.java
index 7f008ba3cca..c7f136a52a6 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplate.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplate.java
@@ -82,6 +82,15 @@ public class IssueChangesEmailTemplate extends EmailTemplate {
appendField(sb, "Message", notif.getFieldValue("old.message"), notif.getFieldValue("new.message"));
appendField(sb, "Author", notif.getFieldValue("old.author"), notif.getFieldValue("new.author"));
appendFieldWithoutHistory(sb, "Action Plan", notif.getFieldValue("old.actionPlan"), notif.getFieldValue("new.actionPlan"));
+ appendField(sb, "Tags", formatTagChange(notif.getFieldValue("old.tags")), formatTagChange(notif.getFieldValue("new.tags")));
+ }
+
+ private static String formatTagChange(String tags) {
+ if (tags == null) {
+ return null;
+ } else {
+ return "[" + tags + "]";
+ }
}
private void appendHeader(Notification notif, StringBuilder sb) {
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java
index 77a5f382533..2e317cbcef0 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest.java
@@ -124,7 +124,8 @@ public class IssueChangesEmailTemplateTest {
.setFieldValue("old.assignee", "simon")
.setFieldValue("new.assignee", "louis")
.setFieldValue("new.resolution", "FALSE-POSITIVE")
- .setFieldValue("new.status", "RESOLVED");
+ .setFieldValue("new.status", "RESOLVED")
+ .setFieldValue("new.tags", "bug performance");
EmailMessage email = template.format(notification);
assertThat(email.getMessageId()).isEqualTo("issue-changes/ABCDE");
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt
index 6462b448895..6f4b09018ea 100644
--- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt
+++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt
@@ -6,5 +6,6 @@ Comment: How to fix it?
Assignee changed to louis
Resolution: FALSE-POSITIVE
Status: RESOLVED
+Tags: [bug performance]
See it in SonarQube: http://nemo.sonarsource.org/issues/search#issues=ABCDE