aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangeNotification.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest.java13
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_should_display_resolution_change.txt2
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_action_plan_change.txt2
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_assignee_change.txt2
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt2
7 files changed, 16 insertions, 14 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangeNotification.java b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangeNotification.java
index 1d6155bace3..b208d50f55c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangeNotification.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangeNotification.java
@@ -68,6 +68,7 @@ public class IssueChangeNotification extends Notification {
public IssueChangeNotification setComponent(Component component) {
setFieldValue("componentName", component.longName());
+ setFieldValue("componentShortName", component.name());
return this;
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java
index 23914040db4..1984ec83f29 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java
@@ -20,6 +20,8 @@
package org.sonar.server.issue.notification;
import com.google.common.base.Strings;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.config.EmailSettings;
import org.sonar.api.notifications.Notification;
@@ -28,9 +30,6 @@ import org.sonar.api.user.UserFinder;
import org.sonar.plugins.emailnotifications.api.EmailMessage;
import org.sonar.plugins.emailnotifications.api.EmailTemplate;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
/**
* Creates email message for notification "issue-changes".
*/
@@ -59,12 +58,13 @@ public class IssueChangesEmailTemplate extends EmailTemplate {
appendFooter(sb, notif);
String projectName = notif.getFieldValue("projectName");
+ String componentShortName = notif.getFieldValue("componentShortName");
String issueKey = notif.getFieldValue("key");
String author = notif.getFieldValue("changeAuthor");
EmailMessage message = new EmailMessage()
.setMessageId("issue-changes/" + issueKey)
- .setSubject(projectName + ", change on issue #" + issueKey)
+ .setSubject(projectName + ", change on issue in " + componentShortName)
.setMessage(sb.toString());
if (author != null) {
message.setFrom(getUserFullName(author));
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest.java
index ee8789673c6..707b739ccf5 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest.java
@@ -68,7 +68,7 @@ public class IssueChangesEmailTemplateTest {
EmailMessage email = template.format(notification);
assertThat(email.getMessageId()).isEqualTo("issue-changes/ABCDE");
- assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
+ assertThat(email.getSubject()).isEqualTo("Struts, change on issue in Action.java");
String message = email.getMessage();
String expected = Resources.toString(Resources.getResource(
@@ -88,7 +88,7 @@ public class IssueChangesEmailTemplateTest {
EmailMessage email = template.format(notification);
assertThat(email.getMessageId()).isEqualTo("issue-changes/ABCDE");
- assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
+ assertThat(email.getSubject()).isEqualTo("Struts, change on issue in Action.java");
String message = email.getMessage();
String expected = Resources.toString(Resources.getResource(
@@ -108,7 +108,7 @@ public class IssueChangesEmailTemplateTest {
EmailMessage email = template.format(notification);
assertThat(email.getMessageId()).isEqualTo("issue-changes/ABCDE");
- assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
+ assertThat(email.getSubject()).isEqualTo("Struts, change on issue in Action.java");
String message = email.getMessage();
String expected = Resources.toString(Resources.getResource(
@@ -127,7 +127,7 @@ public class IssueChangesEmailTemplateTest {
EmailMessage email = template.format(notification);
assertThat(email.getMessageId()).isEqualTo("issue-changes/ABCDE");
- assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
+ assertThat(email.getSubject()).isEqualTo("Struts, change on issue in Action.java");
String message = email.getMessage();
String expected = Resources.toString(Resources.getResource(
@@ -150,7 +150,7 @@ public class IssueChangesEmailTemplateTest {
EmailMessage email = template.format(notification);
assertThat(email.getMessageId()).isEqualTo("issue-changes/ABCDE");
- assertThat(email.getSubject()).isEqualTo("Struts, change on issue #ABCDE");
+ assertThat(email.getSubject()).isEqualTo("Struts, change on issue in Action.java");
String message = email.getMessage();
String expected = Resources.toString(Resources.getResource(
@@ -178,7 +178,8 @@ public class IssueChangesEmailTemplateTest {
Notification notification = new IssueChangeNotification()
.setFieldValue("projectName", "Struts")
.setFieldValue("projectKey", "org.apache:struts")
- .setFieldValue("componentName", "Action")
+ .setFieldValue("componentName", "org/apache/struts/Action.java")
+ .setFieldValue("componentShortName", "Action.java")
.setFieldValue("componentKey", "org.apache.struts.Action")
.setFieldValue("key", "ABCDE")
.setFieldValue("ruleName", "Avoid Cycles")
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_should_display_resolution_change.txt b/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_should_display_resolution_change.txt
index 39a302e0f7f..e766a8644fc 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_should_display_resolution_change.txt
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_should_display_resolution_change.txt
@@ -1,4 +1,4 @@
-Action
+org/apache/struts/Action.java
Rule: Avoid Cycles
Message: Has 3 cycles
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_action_plan_change.txt b/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_action_plan_change.txt
index f9a4356907a..467238cc17e 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_action_plan_change.txt
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_action_plan_change.txt
@@ -1,4 +1,4 @@
-Action
+org/apache/struts/Action.java
Rule: Avoid Cycles
Message: Has 3 cycles
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_assignee_change.txt b/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_assignee_change.txt
index fd4c140e55e..181bac45aa2 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_assignee_change.txt
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_assignee_change.txt
@@ -1,4 +1,4 @@
-Action
+org/apache/struts/Action.java
Rule: Avoid Cycles
Message: Has 3 cycles
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt b/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt
index 6f4b09018ea..65bf3e19ed4 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest/email_with_multiple_changes.txt
@@ -1,4 +1,4 @@
-Action
+org/apache/struts/Action.java
Rule: Avoid Cycles
Message: Has 3 cycles