use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
the class AsyncEmailTaskTest method testSimpleTextMailSendTask.
// copied from org.activiti.engine.test.bpmn.mail.EmailSendTaskTest
@Deployment
public void testSimpleTextMailSendTask() throws Exception {
runtimeService.startProcessInstanceByKey("simpleTextOnly");
List<WiserMessage> messages = wiser.getMessages();
assertEquals(0, messages.size());
waitForJobExecutorToProcessAllJobs(5000L, 25L);
messages = wiser.getMessages();
assertEquals(1, messages.size());
WiserMessage message = messages.get(0);
EmailServiceTaskTest.assertEmailSend(message, false, "Hello Kermit!", "This a text only e-mail.", "activiti@localhost", Arrays.asList("kermit@activiti.org"), null);
}
use of org.subethamail.wiser.WiserMessage in project kernel by exoplatform.
the class TestMailService method isEmailMessageSent.
/**
* Utility method to check if you really sent message
* to dummy mail server. Basically it simply checks if
* there is an email with defined 'subject' header.
* @param subject
* @return
* @throws MessagingException
*/
private boolean isEmailMessageSent(String subject) throws MessagingException {
if (mailServer.getMessages().size() > 0) {
Iterator<WiserMessage> it = new ArrayList<WiserMessage>(mailServer.getMessages()).iterator();
WiserMessage message;
while (it.hasNext()) {
message = it.next();
if (message.getMimeMessage().getSubject() != null && message.getMimeMessage().getSubject().equals(subject)) {
return true;
}
}
}
return false;
}
use of org.subethamail.wiser.WiserMessage in project sonarqube by SonarSource.
the class EmailNotificationChannelTest method shouldSendNonThreadedEmail.
@Test
public void shouldSendNonThreadedEmail() throws Exception {
configure();
EmailMessage emailMessage = new EmailMessage().setTo("user@nowhere").setSubject("Foo").setMessage("Bar");
underTest.deliver(emailMessage);
List<WiserMessage> messages = smtpServer.getMessages();
assertThat(messages).hasSize(1);
MimeMessage email = messages.get(0).getMimeMessage();
assertThat(email.getHeader("Content-Type", null)).isEqualTo("text/plain; charset=UTF-8");
assertThat(email.getHeader("In-Reply-To", null)).isNull();
assertThat(email.getHeader("References", null)).isNull();
assertThat(email.getHeader("List-ID", null)).isEqualTo("SonarQube <sonar.nemo.sonarsource.org>");
assertThat(email.getHeader("List-Archive", null)).isEqualTo("http://nemo.sonarsource.org");
assertThat(email.getHeader("From", null)).isEqualTo("SonarQube <server@nowhere>");
assertThat(email.getHeader("To", null)).isEqualTo("<user@nowhere>");
assertThat(email.getHeader("Subject", null)).isEqualTo("[SONARQUBE] Foo");
assertThat((String) email.getContent()).startsWith("Bar");
}
use of org.subethamail.wiser.WiserMessage in project sonarqube by SonarSource.
the class EmailNotificationChannelTest method shouldSendThreadedEmail.
@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.");
underTest.deliver(emailMessage);
List<WiserMessage> messages = smtpServer.getMessages();
assertThat(messages).hasSize(1);
MimeMessage email = messages.get(0).getMimeMessage();
assertThat(email.getHeader("Content-Type", null)).isEqualTo("text/plain; charset=UTF-8");
assertThat(email.getHeader("In-Reply-To", null)).isEqualTo("<reviews/view/1@nemo.sonarsource.org>");
assertThat(email.getHeader("References", null)).isEqualTo("<reviews/view/1@nemo.sonarsource.org>");
assertThat(email.getHeader("List-ID", null)).isEqualTo("SonarQube <sonar.nemo.sonarsource.org>");
assertThat(email.getHeader("List-Archive", null)).isEqualTo("http://nemo.sonarsource.org");
assertThat(email.getHeader("From", ",")).isEqualTo("\"Full Username (SonarQube)\" <server@nowhere>");
assertThat(email.getHeader("To", null)).isEqualTo("<user@nowhere>");
assertThat(email.getHeader("Subject", null)).isEqualTo("[SONARQUBE] Review #3");
assertThat((String) email.getContent()).startsWith("I'll take care of this violation.");
}
use of org.subethamail.wiser.WiserMessage in project sonarqube by SonarSource.
the class EmailNotificationChannelTest method shouldSendTestEmail.
@Test
public void shouldSendTestEmail() throws Exception {
configure();
underTest.sendTestEmail("user@nowhere", "Test Message from SonarQube", "This is a test message from SonarQube.");
List<WiserMessage> messages = smtpServer.getMessages();
assertThat(messages).hasSize(1);
MimeMessage email = messages.get(0).getMimeMessage();
assertThat(email.getHeader("Content-Type", null)).isEqualTo("text/plain; charset=UTF-8");
assertThat(email.getHeader("From", ",")).isEqualTo("SonarQube <server@nowhere>");
assertThat(email.getHeader("To", null)).isEqualTo("<user@nowhere>");
assertThat(email.getHeader("Subject", null)).isEqualTo("[SONARQUBE] Test Message from SonarQube");
assertThat((String) email.getContent()).startsWith("This is a test message from SonarQube.");
}
Aggregations