aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-10-30 17:20:27 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-10-30 17:24:41 +0100
commitc740d465f1a7621d2a570acb579a9b637835205e (patch)
treef0cf7f438b6024a828bc69b3866ad07274d683d4 /plugins
parent9a0c2f02f830d3c21a6e9b3d7dd758937fc0eefc (diff)
downloadsonarqube-c740d465f1a7621d2a570acb579a9b637835205e.tar.gz
sonarqube-c740d465f1a7621d2a570acb579a9b637835205e.zip
Fix URL in notification email on issue changes
Replace request parameter componentRoot by componentRootUuid
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java8
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java9
2 files changed, 9 insertions, 8 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java
index d8e94277b2a..6f99c8b9a57 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplate.java
@@ -83,12 +83,12 @@ public class NewIssuesEmailTemplate extends EmailTemplate {
}
private void appendFooter(StringBuilder sb, Notification notification) {
- String projectKey = notification.getFieldValue(FIELD_PROJECT_KEY);
+ String projectUuid = notification.getFieldValue("projectUuid");
String dateString = notification.getFieldValue(FIELD_PROJECT_DATE);
- if (projectKey != null && dateString != null) {
+ if (projectUuid != null && dateString != null) {
Date date = DateUtils.parseDateTime(dateString);
- String url = String.format("%s/issues/search#componentRoots=%s|createdAt=%s",
- settings.getServerBaseURL(), encode(projectKey), encode(DateUtils.formatDateTime(date)));
+ String url = String.format("%s/issues/search#componentRootUUids=%s|createdAt=%s",
+ settings.getServerBaseURL(), encode(projectUuid), encode(DateUtils.formatDateTime(date)));
sb.append("\n").append("See it in SonarQube: ").append(url).append("\n");
}
}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java
index 58bd220a997..6b7a5d6c626 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/issue/notification/NewIssuesEmailTemplateTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.plugins.core.issue.notification;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -31,10 +30,11 @@ import org.sonar.core.i18n.DefaultI18n;
import org.sonar.plugins.emailnotifications.api.EmailMessage;
import java.util.Locale;
-import java.util.TimeZone;
import static org.fest.assertions.Assertions.assertThat;
-import static org.mockito.Matchers.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -82,6 +82,7 @@ public class NewIssuesEmailTemplateTest {
.setFieldValue("count-BLOCKER", "0")
.setFieldValue("projectName", "Struts")
.setFieldValue("projectKey", "org.apache:struts")
+ .setFieldValue("projectUuid", "ABCDE")
.setFieldValue("projectDate", "2010-05-18T14:50:45+0000");
when(i18n.message(any(Locale.class), eq("severity.BLOCKER"), anyString())).thenReturn("Blocker");
@@ -102,7 +103,7 @@ public class NewIssuesEmailTemplateTest {
"\n" +
" Blocker: 0 Critical: 5 Major: 10 Minor: 3 Info: 1\n" +
"\n" +
- "See it in SonarQube: http://nemo.sonarsource.org/issues/search#componentRoots=org.apache%3Astruts|createdAt=2010-05-1");
+ "See it in SonarQube: http://nemo.sonarsource.org/issues/search#componentRootUUids=ABCDE|createdAt=2010-05-1");
}
@Test