]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11916 Drop unused Java API EmailTemplate
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 5 Apr 2019 12:00:49 +0000 (14:00 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 23 Apr 2019 08:37:55 +0000 (10:37 +0200)
17 files changed:
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/notification/ReportAnalysisFailureNotificationEmailTemplate.java
server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/EmailMessage.java [new file with mode: 0644]
server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/EmailTemplate.java [new file with mode: 0644]
server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/IssueChangesEmailTemplate.java
server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java
server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/notification/QGChangeEmailTemplate.java
server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/IssueChangesEmailTemplateTest.java
server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java
server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java
server/sonar-server-common/src/test/java/org/sonar/server/qualitygate/notification/QGChangeEmailTemplateTest.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/BuiltInQPChangeNotificationTemplate.java
server/sonar-server/src/test/java/org/sonar/server/notification/email/EmailNotificationChannelTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/BuiltInQPChangeNotificationTemplateTest.java
sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailMessage.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/package-info.java [deleted file]

index bf2967aba5950019585178d3d402dbdef344fef7..b6a1ffd62efc54cd5e391cb4a076336e4544649a 100644 (file)
@@ -23,8 +23,8 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import org.sonar.api.config.EmailSettings;
 import org.sonar.api.notifications.Notification;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
-import org.sonar.plugins.emailnotifications.api.EmailTemplate;
+import org.sonar.server.issue.notification.EmailMessage;
+import org.sonar.server.issue.notification.EmailTemplate;
 
 import static org.sonar.api.utils.DateUtils.formatDateTime;
 
index 65580d20ca0d3b15592ba9b03a5d2bdb1d6a8a07..1aa2f5cd9d85025abf06667e698ce5f78fa9638f 100644 (file)
@@ -31,8 +31,6 @@ import org.sonar.api.i18n.I18n;
 import org.sonar.api.notifications.Notification;
 import org.sonar.api.rules.RuleType;
 import org.sonar.api.utils.DateUtils;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
-import org.sonar.plugins.emailnotifications.api.EmailTemplate;
 import org.sonar.server.issue.notification.NewIssuesStatistics.Metric;
 
 import static com.google.common.base.Preconditions.checkNotNull;
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/EmailMessage.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/EmailMessage.java
new file mode 100644 (file)
index 0000000..2bbc4f5
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.issue.notification;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class EmailMessage {
+
+  private String from;
+  private String to;
+  private String subject;
+  private String message;
+  private String messageId;
+
+  /**
+   * @param from full name of user, who initiated this message or null, if message was initiated by Sonar
+   */
+  public EmailMessage setFrom(String from) {
+    this.from = from;
+    return this;
+  }
+
+  /**
+   * @see #setFrom(String)
+   */
+  public String getFrom() {
+    return from;
+  }
+
+  /**
+   * @param to email address where to send this message
+   */
+  public EmailMessage setTo(String to) {
+    this.to = to;
+    return this;
+  }
+
+  /**
+   * @see #setTo(String)
+   */
+  public String getTo() {
+    return to;
+  }
+
+  /**
+   * @param subject message subject
+   */
+  public EmailMessage setSubject(String subject) {
+    this.subject = subject;
+    return this;
+  }
+
+  /**
+   * @see #setSubject(String)
+   */
+  public String getSubject() {
+    return subject;
+  }
+
+  /**
+   * @param message message body
+   */
+  public EmailMessage setMessage(String message) {
+    this.message = message;
+    return this;
+  }
+
+  /**
+   * @see #setMessage(String)
+   */
+  public String getMessage() {
+    return message;
+  }
+
+  /**
+   * @param messageId id of message for threading
+   */
+  public EmailMessage setMessageId(String messageId) {
+    this.messageId = messageId;
+    return this;
+  }
+
+  /**
+   * @see #setMessageId(String)
+   */
+  public String getMessageId() {
+    return messageId;
+  }
+
+  @Override
+  public String toString() {
+    return ToStringBuilder.reflectionToString(this);
+  }
+
+}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/EmailTemplate.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/EmailTemplate.java
new file mode 100644 (file)
index 0000000..7c1e2f1
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.issue.notification;
+
+import org.sonar.api.ExtensionPoint;
+import org.sonar.api.server.ServerSide;
+import org.sonar.api.notifications.Notification;
+
+@ServerSide
+@ExtensionPoint
+public abstract class EmailTemplate {
+
+  public abstract EmailMessage format(Notification notification);
+
+}
index 9c58194fc8949a4b2e047a1b877a3956f72ca5e1..d5a3b590fd1c41d86f0ac34e44ef8c069c7fd60c 100644 (file)
@@ -29,8 +29,6 @@ import org.sonar.api.notifications.Notification;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
 import org.sonar.db.user.UserDto;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
-import org.sonar.plugins.emailnotifications.api.EmailTemplate;
 
 import static java.net.URLEncoder.encode;
 import static org.sonar.server.issue.notification.AbstractNewIssuesEmailTemplate.FIELD_BRANCH;
index 549a0650967ba1dede576a5d49c914ff86ff354c..896cca90e7897967f3c6d570956c4b1c5ce8c958 100644 (file)
@@ -38,8 +38,8 @@ import org.sonar.api.utils.log.Loggers;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
 import org.sonar.db.user.UserDto;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
-import org.sonar.plugins.emailnotifications.api.EmailTemplate;
+import org.sonar.server.issue.notification.EmailMessage;
+import org.sonar.server.issue.notification.EmailTemplate;
 
 import static java.util.Objects.requireNonNull;
 
index 284658af2db83760b4f0c6a0a8eb7ca0e8ceb06c..c196299957e9c46ce467883c20384e27d1e1ff0e 100644 (file)
@@ -24,8 +24,8 @@ import org.apache.commons.lang.StringUtils;
 import org.sonar.api.config.EmailSettings;
 import org.sonar.api.measures.Metric;
 import org.sonar.api.notifications.Notification;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
-import org.sonar.plugins.emailnotifications.api.EmailTemplate;
+import org.sonar.server.issue.notification.EmailMessage;
+import org.sonar.server.issue.notification.EmailTemplate;
 
 /**
  * Creates email message for notification "alerts".
index 152bc78b87e90effee5e6ba62d0eaaea7770aa90..da6ed26a45364658678100aeb6a69ec39fea28fe 100644 (file)
@@ -29,7 +29,6 @@ import org.sonar.api.config.internal.MapSettings;
 import org.sonar.api.notifications.Notification;
 import org.sonar.db.DbTester;
 import org.sonar.db.user.UserDto;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.CoreProperties.SERVER_BASE_URL;
index 633799f7c2aa986e3112f6ebba05d59389508568..6f86f8efe6d16bbebcc8a4b5d563b649cc770ec3 100644 (file)
@@ -27,7 +27,6 @@ import org.junit.Test;
 import org.sonar.api.config.EmailSettings;
 import org.sonar.api.config.internal.MapSettings;
 import org.sonar.api.notifications.Notification;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
 import org.sonar.server.l18n.I18nRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
index 6a78053a360aa5f76ac15bcf6a10a8a17d26cb9c..c32757630869043d402d913fcc1e71711cc74b86 100644 (file)
@@ -27,7 +27,6 @@ import org.junit.Test;
 import org.sonar.api.config.EmailSettings;
 import org.sonar.api.config.internal.MapSettings;
 import org.sonar.api.notifications.Notification;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
 import org.sonar.server.l18n.I18nRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
index c6ca1b64d4c95bce53d3629a800b0654b70f227c..212f49b36991245ecb41aa7eaf032da340b142c6 100644 (file)
@@ -23,7 +23,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.sonar.api.config.EmailSettings;
 import org.sonar.api.notifications.Notification;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
+import org.sonar.server.issue.notification.EmailMessage;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
index 81af3837185d2c7df7d92c252f98dc3fb829d8cd..3f58c44920b32c99ea9b90f3b7925f3895dcfd22 100644 (file)
@@ -25,8 +25,8 @@ import java.util.Comparator;
 import java.util.Date;
 import org.sonar.api.notifications.Notification;
 import org.sonar.api.platform.Server;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
-import org.sonar.plugins.emailnotifications.api.EmailTemplate;
+import org.sonar.server.issue.notification.EmailMessage;
+import org.sonar.server.issue.notification.EmailTemplate;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.sonar.api.utils.DateUtils.formatDate;
index b99733031151bba6b1da90df40893f55e684e167..d1cecb1d1bac4e60bb9bc122223aa04d6e1fd06d 100644 (file)
@@ -28,7 +28,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.sonar.api.config.EmailSettings;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
+import org.sonar.server.issue.notification.EmailMessage;
 import org.subethamail.wiser.Wiser;
 import org.subethamail.wiser.WiserMessage;
 
index 8e9c0e9eb3898729e48c206bc39f7c50fd3f5424..3324486882bd953cf5b93de92d7531fc62c7dc62 100644 (file)
@@ -23,7 +23,7 @@ import java.util.Date;
 import org.junit.Before;
 import org.junit.Test;
 import org.sonar.api.platform.Server;
-import org.sonar.plugins.emailnotifications.api.EmailMessage;
+import org.sonar.server.issue.notification.EmailMessage;
 import org.sonar.server.qualityprofile.BuiltInQPChangeNotificationBuilder.Profile;
 
 import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailMessage.java b/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailMessage.java
deleted file mode 100644 (file)
index bff5faf..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.plugins.emailnotifications.api;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-/**
- * @since 2.10
- */
-public class EmailMessage {
-
-  private String from;
-  private String to;
-  private String subject;
-  private String message;
-  private String messageId;
-
-  /**
-   * @param from full name of user, who initiated this message or null, if message was initiated by Sonar
-   */
-  public EmailMessage setFrom(String from) {
-    this.from = from;
-    return this;
-  }
-
-  /**
-   * @see #setFrom(String)
-   */
-  public String getFrom() {
-    return from;
-  }
-
-  /**
-   * @param to email address where to send this message
-   */
-  public EmailMessage setTo(String to) {
-    this.to = to;
-    return this;
-  }
-
-  /**
-   * @see #setTo(String)
-   */
-  public String getTo() {
-    return to;
-  }
-
-  /**
-   * @param subject message subject
-   */
-  public EmailMessage setSubject(String subject) {
-    this.subject = subject;
-    return this;
-  }
-
-  /**
-   * @see #setSubject(String)
-   */
-  public String getSubject() {
-    return subject;
-  }
-
-  /**
-   * @param message message body
-   */
-  public EmailMessage setMessage(String message) {
-    this.message = message;
-    return this;
-  }
-
-  /**
-   * @see #setMessage(String)
-   */
-  public String getMessage() {
-    return message;
-  }
-
-  /**
-   * @param messageId id of message for threading
-   */
-  public EmailMessage setMessageId(String messageId) {
-    this.messageId = messageId;
-    return this;
-  }
-
-  /**
-   * @see #setMessageId(String)
-   */
-  public String getMessageId() {
-    return messageId;
-  }
-
-  @Override
-  public String toString() {
-    return ToStringBuilder.reflectionToString(this);
-  }
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java b/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/EmailTemplate.java
deleted file mode 100644 (file)
index 39cde5b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.plugins.emailnotifications.api;
-
-import org.sonar.api.ExtensionPoint;
-import org.sonar.api.server.ServerSide;
-import org.sonar.api.notifications.Notification;
-
-/**
- * @since 2.10
- */
-@ServerSide
-@ExtensionPoint
-public abstract class EmailTemplate {
-
-  public abstract EmailMessage format(Notification notification);
-
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/plugins/emailnotifications/api/package-info.java
deleted file mode 100644 (file)
index f7a0b21..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.plugins.emailnotifications.api;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-