Examples of EmailMessage


Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

   *
   * @throws EmailException when unable to send
   */
  public void sendTestEmail(String toAddress, String subject, String message) throws EmailException {
    try {
      EmailMessage emailMessage = new EmailMessage();
      emailMessage.setTo(toAddress);
      emailMessage.setSubject(subject);
      emailMessage.setMessage(message);
      send(emailMessage);
    } catch (EmailException e) {
      LOG.error("Fail to send test email to: " + toAddress, e);
      throw e;
    }
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

  }

  @Test
  public void shouldNotFormatIfNotCorrectNotification() {
    Notification notification = new Notification("other-notif");
    EmailMessage message = template.format(notification);
    assertThat(message, nullValue());
  }
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

  @Test
  public void shouldFormatAlertWithSeveralMessages() {
    Notification notification = createNotification("Orange (was Red)", "violations > 4, coverage < 75%", "WARN", "false");

    EmailMessage message = template.format(notification);
    assertThat(message.getMessageId(), is("alerts/45"));
    assertThat(message.getSubject(), is("Quality gate status changed on \"Foo\""));
    assertThat(message.getMessage(), is("" +
      "Project: Foo\n" +
      "Quality gate status: Orange (was Red)\n" +
      "\n" +
      "Quality gate thresholds:\n" +
      "  - violations > 4\n" +
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

  @Test
  public void shouldFormatNewAlertWithSeveralMessages() {
    Notification notification = createNotification("Orange (was Red)", "violations > 4, coverage < 75%", "WARN", "true");

    EmailMessage message = template.format(notification);
    assertThat(message.getMessageId(), is("alerts/45"));
    assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo\""));
    assertThat(message.getMessage(), is("" +
      "Project: Foo\n" +
      "Quality gate status: Orange (was Red)\n" +
      "\n" +
      "New quality gate thresholds:\n" +
      "  - violations > 4\n" +
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

  @Test
  public void shouldFormatNewAlertWithOneMessage() {
    Notification notification = createNotification("Orange (was Red)", "violations > 4", "WARN", "true");

    EmailMessage message = template.format(notification);
    assertThat(message.getMessageId(), is("alerts/45"));
    assertThat(message.getSubject(), is("New quality gate threshold reached on \"Foo\""));
    assertThat(message.getMessage(), is("" +
      "Project: Foo\n" +
      "Quality gate status: Orange (was Red)\n" +
      "\n" +
      "New quality gate threshold: violations > 4\n" +
      "\n" +
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

  @Test
  public void shouldFormatBackToGreenMessage() {
    Notification notification = createNotification("Green (was Red)", "", "OK", "false");

    EmailMessage message = template.format(notification);
    assertThat(message.getMessageId(), is("alerts/45"));
    assertThat(message.getSubject(), is("\"Foo\" is back to green"));
    assertThat(message.getMessage(), is("" +
      "Project: Foo\n" +
      "Quality gate status: Green (was Red)\n" +
      "\n" +
      "\n" +
      "See it in SonarQube: http://nemo.sonarsource.org/dashboard/index/org.sonar.foo:foo"));
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

    }
  }

  @Test
  public void shouldNotSendEmailWhenHostnameNotConfigured() throws Exception {
    EmailMessage emailMessage = new EmailMessage()
      .setTo("user@nowhere")
      .setSubject("Foo")
      .setMessage("Bar");
    channel.deliver(emailMessage);
    assertThat(server.getMessages()).isEmpty();
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

  }

  @Test
  public void shouldSendThreadedEmail() throws Exception {
    configure();
    EmailMessage emailMessage = new EmailMessage()
      .setMessageId("reviews/view/1")
      .setFrom("Full Username")
      .setTo("user@nowhere")
      .setSubject("Review #3")
      .setMessage("I'll take care of this violation.");
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

  }

  @Test
  public void shouldSendNonThreadedEmail() throws Exception {
    configure();
    EmailMessage emailMessage = new EmailMessage()
      .setTo("user@nowhere")
      .setSubject("Foo")
      .setMessage("Bar");
    channel.deliver(emailMessage);
View Full Code Here

Examples of org.sonar.plugins.emailnotifications.api.EmailMessage

  @Test
  public void shouldNotThrowAnExceptionWhenUnableToSendEmail() throws Exception {
    configure();
    server.stop();

    EmailMessage emailMessage = new EmailMessage()
      .setTo("user@nowhere")
      .setSubject("Foo")
      .setMessage("Bar");
    channel.deliver(emailMessage);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.