aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-07-26 14:25:57 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-07-26 18:23:56 +0400
commitb508728dc8d993a5b4ad5839b9553228b3ef4b47 (patch)
tree3582bdc3962c5c10438cadde42849610e42214e3
parentfea2ef37ed0a1dfa73ebdd87799f5caa298aa2f2 (diff)
downloadsonarqube-b508728dc8d993a5b4ad5839b9553228b3ef4b47.tar.gz
sonarqube-b508728dc8d993a5b4ad5839b9553228b3ef4b47.zip
SONAR-2596,SONAR-2601 UI for email notifications
* Add email configuration to sidebar menu * I18n for email and notifications settings * Email configuration properties must be secured * Rename sonar-email-plugin to sonar-email-notifications-plugin
-rw-r--r--plugins/sonar-email-notifications-plugin/pom.xml (renamed from plugins/sonar-email-plugin/pom.xml)10
-rw-r--r--plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailConfiguration.java (renamed from plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailConfiguration.java)12
-rw-r--r--plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationChannel.java (renamed from plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailNotificationChannel.java)10
-rw-r--r--plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java (renamed from plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailPlugin.java)10
-rw-r--r--plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/api/EmailMessage.java (renamed from plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/api/EmailMessage.java)2
-rw-r--r--plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java (renamed from plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/api/EmailTemplate.java)2
-rw-r--r--plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMe.java (renamed from plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ChangesInReviewAssignedToMe.java)2
-rw-r--r--plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewCreatedByMe.java (renamed from plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ChangesInReviewCreatedByMe.java)2
-rw-r--r--plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java (renamed from plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ReviewEmailTemplate.java)8
-rw-r--r--plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailConfigurationTest.java (renamed from plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailConfigurationTest.java)2
-rw-r--r--plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationChannelTest.java (renamed from plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailNotificationChannelTest.java)4
-rw-r--r--plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java (renamed from plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailPluginTest.java)6
-rw-r--r--plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeTest.java (renamed from plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ChangesInReviewAssignedToMeTest.java)2
-rw-r--r--plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewCreatedByMeTest.java (renamed from plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ChangesInReviewCreatedByMeTest.java)2
-rw-r--r--plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java (renamed from plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ReviewEmailTemplateTest.java)13
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties28
-rw-r--r--pom.xml2
-rw-r--r--sonar-application/pom.xml2
-rw-r--r--sonar-server/pom.xml2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb26
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb36
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb1
23 files changed, 114 insertions, 77 deletions
diff --git a/plugins/sonar-email-plugin/pom.xml b/plugins/sonar-email-notifications-plugin/pom.xml
index 7a6fc713694..181e56b59e3 100644
--- a/plugins/sonar-email-plugin/pom.xml
+++ b/plugins/sonar-email-notifications-plugin/pom.xml
@@ -10,10 +10,11 @@
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
- <artifactId>sonar-email-plugin</artifactId>
+ <artifactId>sonar-email-notifications-plugin</artifactId>
<packaging>sonar-plugin</packaging>
- <name>Sonar :: Plugins :: Email</name>
+ <name>Sonar :: Plugins :: Email Notifications</name>
+ <description>Email Notifications</description>
<dependencies>
<dependency>
@@ -53,9 +54,8 @@
<artifactId>sonar-packaging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
- <pluginName>Email</pluginName>
- <pluginClass>org.sonar.plugins.email.EmailPlugin</pluginClass>
- <pluginDescription><![CDATA[TODO]]></pluginDescription>
+ <pluginName>Email notifications</pluginName>
+ <pluginClass>org.sonar.plugins.emailnotifications.EmailNotificationsPlugin</pluginClass>
</configuration>
</plugin>
</plugins>
diff --git a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailConfiguration.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailConfiguration.java
index 63b5f43cf19..907d9bf599c 100644
--- a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailConfiguration.java
+++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailConfiguration.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email;
+package org.sonar.plugins.emailnotifications;
import org.apache.commons.configuration.Configuration;
import org.sonar.api.CoreProperties;
@@ -30,15 +30,15 @@ import org.sonar.api.ServerExtension;
*/
public class EmailConfiguration implements ServerExtension {
- public static final String SMTP_HOST = "email.smtp_host";
+ public static final String SMTP_HOST = "email.smtp_host.secured";
public static final String SMTP_HOST_DEFAULT = "";
- public static final String SMTP_PORT = "email.smtp_port";
+ public static final String SMTP_PORT = "email.smtp_port.secured";
public static final String SMTP_PORT_DEFAULT = "25";
- public static final String SMTP_USE_TLS = "email.smtp_use_tls";
+ public static final String SMTP_USE_TLS = "email.smtp_use_tls.secured";
public static final boolean SMTP_USE_TLS_DEFAULT = false;
- public static final String SMTP_USERNAME = "email.smtp_username";
+ public static final String SMTP_USERNAME = "email.smtp_username.secured";
public static final String SMTP_USERNAME_DEFAULT = "";
- public static final String SMTP_PASSWORD = "email.smtp_password";
+ public static final String SMTP_PASSWORD = "email.smtp_password.secured";
public static final String SMTP_PASSWORD_DEFAULT = "";
public static final String FROM = "email.from";
public static final String FROM_DEFAULT = "noreply@nowhere";
diff --git a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailNotificationChannel.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationChannel.java
index b35aecd623f..74fb59d5d0e 100644
--- a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailNotificationChannel.java
+++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationChannel.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email;
+package org.sonar.plugins.emailnotifications;
import java.net.MalformedURLException;
import java.net.URL;
@@ -31,8 +31,8 @@ import org.sonar.api.database.model.User;
import org.sonar.api.notifications.Notification;
import org.sonar.api.notifications.NotificationChannel;
import org.sonar.api.security.UserFinder;
-import org.sonar.plugins.email.api.EmailMessage;
-import org.sonar.plugins.email.api.EmailTemplate;
+import org.sonar.plugins.emailnotifications.api.EmailMessage;
+import org.sonar.plugins.emailnotifications.api.EmailTemplate;
/**
* References:
@@ -98,14 +98,14 @@ public class EmailNotificationChannel extends NotificationChannel {
LOG.warn("Email not defined for user: " + username);
return;
}
- EmailMessage emailMessage = format(notification, username);
+ EmailMessage emailMessage = format(notification);
if (emailMessage != null) {
emailMessage.setTo(user.getEmail());
deliver(emailMessage);
}
}
- private EmailMessage format(Notification notification, String username) {
+ private EmailMessage format(Notification notification) {
for (EmailTemplate template : templates) {
EmailMessage email = template.format(notification);
if (email != null) {
diff --git a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailPlugin.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java
index edee6ea8044..c5cc4ccc7de 100644
--- a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/EmailPlugin.java
+++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/EmailNotificationsPlugin.java
@@ -17,17 +17,17 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email;
+package org.sonar.plugins.emailnotifications;
import org.sonar.api.SonarPlugin;
-import org.sonar.plugins.email.reviews.ChangesInReviewAssignedToMe;
-import org.sonar.plugins.email.reviews.ChangesInReviewCreatedByMe;
-import org.sonar.plugins.email.reviews.ReviewEmailTemplate;
+import org.sonar.plugins.emailnotifications.reviews.ChangesInReviewAssignedToMe;
+import org.sonar.plugins.emailnotifications.reviews.ChangesInReviewCreatedByMe;
+import org.sonar.plugins.emailnotifications.reviews.ReviewEmailTemplate;
import java.util.Arrays;
import java.util.List;
-public class EmailPlugin extends SonarPlugin {
+public class EmailNotificationsPlugin extends SonarPlugin {
public List getExtensions() {
return Arrays.asList(
diff --git a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/api/EmailMessage.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/api/EmailMessage.java
index 556c72bfd24..f03d90caea6 100644
--- a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/api/EmailMessage.java
+++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/api/EmailMessage.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email.api;
+package org.sonar.plugins.emailnotifications.api;
import org.apache.commons.lang.builder.ToStringBuilder;
diff --git a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/api/EmailTemplate.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java
index 283eaf950f7..fe638eada73 100644
--- a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/api/EmailTemplate.java
+++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email.api;
+package org.sonar.plugins.emailnotifications.api;
import org.sonar.api.ServerExtension;
import org.sonar.api.notifications.Notification;
diff --git a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ChangesInReviewAssignedToMe.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMe.java
index fc56412f31b..c5859ee13da 100644
--- a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ChangesInReviewAssignedToMe.java
+++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMe.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email.reviews;
+package org.sonar.plugins.emailnotifications.reviews;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.notifications.Notification;
diff --git a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ChangesInReviewCreatedByMe.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewCreatedByMe.java
index 30c99df3ad2..85f104637d0 100644
--- a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ChangesInReviewCreatedByMe.java
+++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewCreatedByMe.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email.reviews;
+package org.sonar.plugins.emailnotifications.reviews;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.notifications.Notification;
diff --git a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ReviewEmailTemplate.java b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java
index 94e6786f8a4..f09082a2d07 100644
--- a/plugins/sonar-email-plugin/src/main/java/org/sonar/plugins/email/reviews/ReviewEmailTemplate.java
+++ b/plugins/sonar-email-notifications-plugin/src/main/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplate.java
@@ -17,15 +17,15 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email.reviews;
+package org.sonar.plugins.emailnotifications.reviews;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.database.model.User;
import org.sonar.api.notifications.Notification;
import org.sonar.api.security.UserFinder;
-import org.sonar.plugins.email.EmailConfiguration;
-import org.sonar.plugins.email.api.EmailMessage;
-import org.sonar.plugins.email.api.EmailTemplate;
+import org.sonar.plugins.emailnotifications.EmailConfiguration;
+import org.sonar.plugins.emailnotifications.api.EmailMessage;
+import org.sonar.plugins.emailnotifications.api.EmailTemplate;
/**
* Creates email message for notification "review-changed".
diff --git a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailConfigurationTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailConfigurationTest.java
index a7ff4ff1814..92c3ab5c1df 100644
--- a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailConfigurationTest.java
+++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailConfigurationTest.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email;
+package org.sonar.plugins.emailnotifications;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
diff --git a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailNotificationChannelTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationChannelTest.java
index 1508dc676f8..18c1e238de5 100644
--- a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailNotificationChannelTest.java
+++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationChannelTest.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email;
+package org.sonar.plugins.emailnotifications;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
@@ -33,7 +33,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.sonar.plugins.email.api.EmailMessage;
+import org.sonar.plugins.emailnotifications.api.EmailMessage;
import com.dumbster.smtp.SimpleSmtpServer;
import com.dumbster.smtp.SmtpMessage;
diff --git a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailPluginTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java
index 8ffa68364f8..b6deef32eb8 100644
--- a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/EmailPluginTest.java
+++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/EmailNotificationsPluginTest.java
@@ -17,18 +17,18 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email;
+package org.sonar.plugins.emailnotifications;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertThat;
import org.junit.Test;
-public class EmailPluginTest {
+public class EmailNotificationsPluginTest {
@Test
public void testGetExtensions() {
- assertThat(new EmailPlugin().getExtensions().size(), greaterThan(1));
+ assertThat(new EmailNotificationsPlugin().getExtensions().size(), greaterThan(1));
}
}
diff --git a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ChangesInReviewAssignedToMeTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeTest.java
index c74ce6ba098..e9b169c6363 100644
--- a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ChangesInReviewAssignedToMeTest.java
+++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewAssignedToMeTest.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email.reviews;
+package org.sonar.plugins.emailnotifications.reviews;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ChangesInReviewCreatedByMeTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewCreatedByMeTest.java
index a3fd7aa03b0..3f3142ccced 100644
--- a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ChangesInReviewCreatedByMeTest.java
+++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ChangesInReviewCreatedByMeTest.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email.reviews;
+package org.sonar.plugins.emailnotifications.reviews;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ReviewEmailTemplateTest.java b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java
index 6b64545eb5a..70fca60f6b8 100644
--- a/plugins/sonar-email-plugin/src/test/java/org/sonar/plugins/email/reviews/ReviewEmailTemplateTest.java
+++ b/plugins/sonar-email-notifications-plugin/src/test/java/org/sonar/plugins/emailnotifications/reviews/ReviewEmailTemplateTest.java
@@ -17,7 +17,7 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.email.reviews;
+package org.sonar.plugins.emailnotifications.reviews;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
@@ -31,8 +31,8 @@ import org.junit.Test;
import org.sonar.api.database.model.User;
import org.sonar.api.notifications.Notification;
import org.sonar.api.security.UserFinder;
-import org.sonar.plugins.email.EmailConfiguration;
-import org.sonar.plugins.email.api.EmailMessage;
+import org.sonar.plugins.emailnotifications.EmailConfiguration;
+import org.sonar.plugins.emailnotifications.api.EmailMessage;
public class ReviewEmailTemplateTest {
@@ -290,6 +290,8 @@ public class ReviewEmailTemplateTest {
*
* Status: RESOLVED (was REOPENED)
* Resolution: FALSE-POSITIVE
+ * Comment:
+ * Because!
*
* --
* See it in Sonar: http://nemo.sonarsource.org/review/view/1
@@ -303,12 +305,13 @@ public class ReviewEmailTemplateTest {
.setFieldValue("old.status", "REOPENED")
.setFieldValue("old.resolution", null)
.setFieldValue("new.status", "RESOLVED")
- .setFieldValue("new.resolution", "FALSE-POSITIVE");
+ .setFieldValue("new.resolution", "FALSE-POSITIVE")
+ .setFieldValue("new.comment", "Because!");
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("review/1"));
assertThat(message.getSubject(), is("Review #1"));
assertThat(message.getFrom(), is("Freddy Mallet"));
- assertThat(message.getMessage(), is("Status: RESOLVED (was REOPENED)\nResolution: FALSE-POSITIVE\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n"));
+ assertThat(message.getMessage(), is("Status: RESOLVED (was REOPENED)\nResolution: FALSE-POSITIVE\nComment:\n Because!\n\n--\nSee it in Sonar: http://nemo.sonarsource.org/review/view/1\n"));
}
@Test
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties
index ecddbb9f9a1..cf1f4d0736d 100644
--- a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties
@@ -291,6 +291,7 @@ users.page=Users
violations.page=Violations
violations_drilldown.page=Violations drilldown
update_center.page=Update Center
+email_configuration.page=Email configuration
org.sonar.plugins.core.hotspots.GwtHotspots.page=Hotspots
org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer.page=Duplications
@@ -637,6 +638,33 @@ rules_configuration.x_rules_have_been_deactivated={0} rules have been deactivate
#------------------------------------------------------------------------------
#
+# EMAIL CONFIGURATION
+#
+#------------------------------------------------------------------------------
+email_configuration.smtp_host=SMTP host
+email_configuration.smtp_port=SMTP port
+email_configuration.use_tls=Use TLS
+email_configuration.smtp_username=SMTP username
+email_configuration.smtp_password=SMTP password
+email_configuration.from_address=From address
+email_configuration.email_prefix=Email prefix
+email_configuration.test.title=Send Test Email
+email_configuration.test.to_address=To
+email_configuration.test.to_address_required=You must provide address where to send test email
+email_configuration.test.subject=Subject
+email_configuration.test.subject_text=Test Message from Sonar
+email_configuration.test.message=Message
+email_configuration.test.message_text=This is a test message from Sonar
+email_configuration.test.send=Send
+email_configuration.test.email_was_sent_to_x=Email was sent to {0}
+
+notification.channel.EmailNotificationChannel=Email
+notification.dispatcher.ChangesInReviewAssignedToMe=Changes in review assigned to me
+notification.dispatcher.ChangesInReviewCreatedByMe=Changes in review created by me
+
+
+#------------------------------------------------------------------------------
+#
# ALERTS
#
#------------------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 857584c86a2..0c17b60efcf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
<module>plugins/sonar-squid-java-plugin</module>
<module>plugins/sonar-design-plugin</module>
<module>plugins/sonar-i18n-en-plugin</module>
- <module>plugins/sonar-email-plugin</module>
+ <module>plugins/sonar-email-notifications-plugin</module>
</modules>
<organization>
diff --git a/sonar-application/pom.xml b/sonar-application/pom.xml
index 407cb8aeefb..9e9876e467b 100644
--- a/sonar-application/pom.xml
+++ b/sonar-application/pom.xml
@@ -210,7 +210,7 @@
</dependency>
<dependency>
<groupId>org.codehaus.sonar.plugins</groupId>
- <artifactId>sonar-email-plugin</artifactId>
+ <artifactId>sonar-email-notifications-plugin</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
diff --git a/sonar-server/pom.xml b/sonar-server/pom.xml
index 6f6f74371af..43ffeae91d0 100644
--- a/sonar-server/pom.xml
+++ b/sonar-server/pom.xml
@@ -456,7 +456,7 @@
</dependency>
<dependency>
<groupId>org.codehaus.sonar.plugins</groupId>
- <artifactId>sonar-email-plugin</artifactId>
+ <artifactId>sonar-email-notifications-plugin</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb
index 163ece76c50..3d877da0921 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/email_configuration_controller.rb
@@ -48,10 +48,11 @@ class EmailConfigurationController < ApplicationController
subject = params[:subject]
message = params[:message]
if to_address.blank?
- flash[:notice] = 'You must provide address where to send test email'
+ flash[:notice] = message('email_configuration.test.to_address_required')
else
begin
- java_facade.getComponentByClassname('email', 'org.sonar.plugins.email.EmailNotificationChannel').sendTestEmail(to_address, subject, message)
+ java_facade.getComponentByClassname('emailnotifications', 'org.sonar.plugins.emailnotifications.EmailNotificationChannel').sendTestEmail(to_address, subject, message)
+ flash[:notice] = message('email_configuration.test.email_was_sent_to_x', :params => [to_address])
rescue Exception => e
flash[:error] = e.message
end
@@ -62,7 +63,7 @@ class EmailConfigurationController < ApplicationController
private
def configuration
- java_facade.getComponentByClassname('email', 'org.sonar.plugins.email.EmailConfiguration').class
+ java_facade.getComponentByClassname('emailnotifications', 'org.sonar.plugins.emailnotifications.EmailConfiguration').class
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb
index 1bf9a705b24..f91269107bf 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb
@@ -29,9 +29,9 @@
<h1>Change password</h1>
<br/>
<% form_tag( {:action => 'change_password' }, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%>
- <table>
- <tr>
- <td nowrap>
+ <table>
+ <tr>
+ <td nowrap>
<label for="old_password"><b>Old value:</b></label>
</td>
<td class="sep"> </td>
@@ -40,7 +40,7 @@
</td>
</tr>
<tr>
- <td nowrap>
+ <td nowrap>
<label for="password"><b>New value:</b></label>
</td>
<td class="sep"> </td>
@@ -49,7 +49,7 @@
</td>
</tr>
<tr>
- <td nowrap>
+ <td nowrap>
<label for="password_confirmation"><b>Confirm new value:</b></label>
</td>
<td class="sep"> </td>
@@ -58,15 +58,15 @@
</td>
</tr>
- </table>
- <br/>
- <%= submit_tag 'Change password' %>
+ </table>
+ <br/>
+ <%= submit_tag 'Change password' %>
<% end %>
- <script type="text/javascript">
- //<![CDATA[
+ <script type="text/javascript">
+ //<![CDATA[
$('pass_form_tag').focusFirstElement();
//]]>
- </script>
+ </script>
<% end -%>
<br/>
@@ -77,12 +77,12 @@
<tr>
<td></td>
<% for channel in @channels %>
- <td><%= channel.getKey() %></td>
+ <td><%= message('notification.channel.' + channel.getKey()) -%></td>
<% end %>
</tr>
<% for dispatcher in @dispatchers %>
<tr>
- <td><%= dispatcher.getKey() %></td>
+ <td><%= message('notification.dispatcher.' + dispatcher.getKey()) -%></td>
<td>
<%
for channel in @channels
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb
index d59ec3a089b..a0f53d63264 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/email_configuration/index.html.erb
@@ -1,9 +1,10 @@
-<h1>Email configuration</h1>
+<h1><%= message('email_configuration.page') -%></h1>
+<br/>
<% form_tag({:action => 'save'}) do -%>
<table>
<tr>
<td nowrap>
- <label for="smtp_host"><b>SMTP Host:</b></label>
+ <label for="smtp_host"><b><%= message('email_configuration.smtp_host') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -13,7 +14,7 @@
<tr>
<td nowrap>
- <label for="smtp_port"><b>SMTP Port:</b></label>
+ <label for="smtp_port"><b><%= message('email_configuration.smtp_port') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -23,7 +24,7 @@
<tr>
<td nowrap>
- <label for="smtp_port"><b>Use TLS:</b></label>
+ <label for="smtp_port"><b><%= message('email_configuration.use_tls') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -33,7 +34,7 @@
<tr>
<td nowrap>
- <label for="smtp_username"><b>SMTP Username:</b></label>
+ <label for="smtp_username"><b><%= message('email_configuration.smtp_username') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -43,7 +44,7 @@
<tr>
<td nowrap>
- <label for="smtp_password"><b>SMTP Password:</b></label>
+ <label for="smtp_password"><b><%= message('email_configuration.smtp_password') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -53,7 +54,7 @@
<tr>
<td nowrap>
- <label for="email_from"><b>From address:</b></label>
+ <label for="email_from"><b><%= message('email_configuration.from_address') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -63,7 +64,7 @@
<tr>
<td nowrap>
- <label for="email_prefix"><b>Email prefix:</b></label>
+ <label for="email_prefix"><b><%= message('email_configuration.email_prefix') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -71,16 +72,18 @@
</td>
</tr>
</table>
- <%= submit_tag %>
+ <br/>
+ <%= submit_tag message('save') %>
<% end -%>
<br/>
-<h1>Send Test Email</h1>
+<h1><%= message('email_configuration.test.title') -%></h1>
+<br/>
<% form_tag({:action => 'send_test_email'}) do -%>
<table>
<tr>
<td nowrap>
- <label for="to_address"><b>To:</b></label>
+ <label for="to_address"><b><%= message('email_configuration.test.to_address') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
@@ -89,22 +92,23 @@
</tr>
<tr>
<td nowrap>
- <label for="subject"><b>Subject:</b></label>
+ <label for="subject"><b><%= message('email_configuration.test.subject') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
- <%= text_field_tag 'subject', 'Test Message from Sonar' %>
+ <%= text_field_tag 'subject', message('email_configuration.test.subject_text') %>
</td>
</tr>
<tr>
<td nowrap>
- <label for="message"><b>Message:</b></label>
+ <label for="message"><b><%= message('email_configuration.test.message') -%></b></label>
</td>
<td class="sep"> </td>
<td align="left">
- <%= text_area_tag 'message', 'This is a test message from Sonar.' %>
+ <%= text_area_tag 'message', message('email_configuration.test.message_text') %>
</td>
</tr>
<table>
- <%= submit_tag 'Send' %>
+ <br/>
+ <%= submit_tag message('email_configuration.test.send') %>
<% end -%>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
index 1ac79bf85d8..fbc097c14a6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
@@ -86,6 +86,7 @@
if update_center_activated=='true' %>
<li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"><a href="<%= ApplicationController.root_context -%>/updatecenter"><%= message('update_center.page') -%></a></li>
<% end %>
+ <li class="<%= 'selected' if controller.controller_path=='email_configuration' -%>"><a href="<%= ApplicationController.root_context -%>/email_configuration"><%= message('email_configuration.page') -%></a></li>
<% end %>
<% end %>