aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>2013-01-29 17:37:57 +0100
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>2013-01-29 18:01:15 +0100
commit8d9eb9edf1ea931aabd94a4e6fe1cbe5343e93a3 (patch)
treeee90db58acf7dda6be3772d1845d954b31122dea /sonar-server
parent6d28b25606431eef5b911c4900a7ea4fd764b3df (diff)
downloadsonarqube-8d9eb9edf1ea931aabd94a4e6fe1cbe5343e93a3.tar.gz
sonarqube-8d9eb9edf1ea931aabd94a4e6fe1cbe5343e93a3.zip
SONAR-3959 Update NotifDispatchers to use new NotifManager method
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/notifications/reviews/ReviewsNotificationManager.java10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/review.rb1
-rw-r--r--sonar-server/src/test/java/org/sonar/server/notifications/reviews/ReviewsNotificationManagerTest.java21
3 files changed, 17 insertions, 15 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/notifications/reviews/ReviewsNotificationManager.java b/sonar-server/src/main/java/org/sonar/server/notifications/reviews/ReviewsNotificationManager.java
index f40c92c05df..fc3e898ce8a 100644
--- a/sonar-server/src/main/java/org/sonar/server/notifications/reviews/ReviewsNotificationManager.java
+++ b/sonar-server/src/main/java/org/sonar/server/notifications/reviews/ReviewsNotificationManager.java
@@ -19,15 +19,14 @@
*/
package org.sonar.server.notifications.reviews;
-import java.util.Map;
-import java.util.Set;
-
+import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.ServerComponent;
import org.sonar.api.notifications.Notification;
import org.sonar.api.notifications.NotificationManager;
-import com.google.common.collect.Sets;
+import java.util.Map;
+import java.util.Set;
/**
* @since 2.10
@@ -50,6 +49,7 @@ public class ReviewsNotificationManager implements ServerComponent {
Notification notification = new Notification("review-changed")
.setFieldValue("reviewId", String.valueOf(reviewId))
.setFieldValue("project", newValues.get("project"))
+ .setFieldValue("projectId", newValues.get("projectId"))
.setFieldValue("resource", newValues.get("resource"))
.setFieldValue("title", newValues.get("title"))
.setFieldValue("author", author)
@@ -62,7 +62,7 @@ public class ReviewsNotificationManager implements ServerComponent {
for (String field : fields) {
String oldValue = oldValues.get(field);
String newValue = newValues.get(field);
- if ( !StringUtils.equals(oldValue, newValue)) {
+ if (!StringUtils.equals(oldValue, newValue)) {
notification.setFieldValue("new." + field, newValue);
notification.setFieldValue("old." + field, oldValue);
}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
index 20e38d3010f..26df00de9f6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
@@ -127,6 +127,7 @@ class Review < ActiveRecord::Base
java.util.HashMap.new(
{
"project" => project.long_name.to_java,
+ "projectId" => project.id.to_s.to_java,
"resource" => resource.long_name.to_java,
"title" => title.to_java,
"creator" => user == nil ? nil : user.login.to_java,
diff --git a/sonar-server/src/test/java/org/sonar/server/notifications/reviews/ReviewsNotificationManagerTest.java b/sonar-server/src/test/java/org/sonar/server/notifications/reviews/ReviewsNotificationManagerTest.java
index f2b2cc8a5e3..45918e78826 100644
--- a/sonar-server/src/test/java/org/sonar/server/notifications/reviews/ReviewsNotificationManagerTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/notifications/reviews/ReviewsNotificationManagerTest.java
@@ -19,15 +19,7 @@
*/
package org.sonar.server.notifications.reviews;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.mock;
-
-import java.util.Map;
-
+import com.google.common.collect.Maps;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
@@ -35,7 +27,14 @@ import org.mockito.stubbing.Answer;
import org.sonar.api.notifications.Notification;
import org.sonar.api.notifications.NotificationManager;
-import com.google.common.collect.Maps;
+import java.util.Map;
+
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
public class ReviewsNotificationManagerTest {
@@ -59,6 +58,7 @@ public class ReviewsNotificationManagerTest {
Map<String, String> oldValues = Maps.newHashMap();
Map<String, String> newValues = Maps.newHashMap();
newValues.put("project", "Sonar");
+ newValues.put("projectId", "42");
newValues.put("resource", "org.sonar.server.ui.DefaultPages");
newValues.put("title", "Utility classes should not have a public or default constructor.");
newValues.put("creator", "olivier");
@@ -70,6 +70,7 @@ public class ReviewsNotificationManagerTest {
assertThat(notification.getFieldValue("reviewId"), is("1"));
assertThat(notification.getFieldValue("author"), is("freddy"));
assertThat(notification.getFieldValue("project"), is("Sonar"));
+ assertThat(notification.getFieldValue("projectId"), is("42"));
assertThat(notification.getFieldValue("resource"), is("org.sonar.server.ui.DefaultPages"));
assertThat(notification.getFieldValue("title"), is("Utility classes should not have a public or default constructor."));
assertThat(notification.getFieldValue("creator"), is("olivier"));