Search in sources :

Example 51 with WiserMessage

use of org.subethamail.wiser.WiserMessage in project camunda-bpm-platform by camunda.

the class AsyncEmailTaskTest method testSimpleTextMailSendTask.

// copied from org.camunda.bpm.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);
    messages = wiser.getMessages();
    assertEquals(1, messages.size());
    WiserMessage message = messages.get(0);
    EmailServiceTaskTest.assertEmailSend(message, false, "Hello Kermit!", "This a text only e-mail.", "camunda@localhost", Arrays.asList("kermit@camunda.org"), null);
}
Also used : WiserMessage(org.subethamail.wiser.WiserMessage) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 52 with WiserMessage

use of org.subethamail.wiser.WiserMessage in project camunda-bpm-platform by camunda.

the class AsyncEmailTaskTest method testSimpleTextMail.

// copied from org.camunda.bpm.engine.test.bpmn.mail.EmailServiceTaskTest
@Deployment
public void testSimpleTextMail() throws Exception {
    String procId = runtimeService.startProcessInstanceByKey("simpleTextOnly").getId();
    List<WiserMessage> messages = wiser.getMessages();
    assertEquals(0, messages.size());
    waitForJobExecutorToProcessAllJobs(5000L);
    messages = wiser.getMessages();
    assertEquals(1, messages.size());
    WiserMessage message = messages.get(0);
    EmailServiceTaskTest.assertEmailSend(message, false, "Hello Kermit!", "This a text only e-mail.", "camunda@localhost", Arrays.asList("kermit@camunda.org"), null);
    assertProcessEnded(procId);
}
Also used : WiserMessage(org.subethamail.wiser.WiserMessage) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 53 with WiserMessage

use of org.subethamail.wiser.WiserMessage in project camunda-bpm-platform by camunda.

the class EmailServiceTaskTest method testTextMailExpressions.

@Deployment
public void testTextMailExpressions() throws Exception {
    String sender = "mispiggy@activiti.org";
    String recipient = "fozziebear@activiti.org";
    String recipientName = "Mr. Fozzie";
    String subject = "Fozzie, you should see this!";
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("sender", sender);
    vars.put("recipient", recipient);
    vars.put("recipientName", recipientName);
    vars.put("subject", subject);
    runtimeService.startProcessInstanceByKey("textMailExpressions", vars);
    List<WiserMessage> messages = wiser.getMessages();
    assertEquals(1, messages.size());
    WiserMessage message = messages.get(0);
    assertEmailSend(message, false, subject, "Hello " + recipientName + ", this is an e-mail", sender, Arrays.asList(recipient), null);
}
Also used : HashMap(java.util.HashMap) WiserMessage(org.subethamail.wiser.WiserMessage) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 54 with WiserMessage

use of org.subethamail.wiser.WiserMessage in project camunda-bpm-platform by camunda.

the class EmailSendTaskTest method testSendEmail.

@Deployment
public void testSendEmail() throws Exception {
    String from = "ordershipping@activiti.org";
    boolean male = true;
    String recipientName = "John Doe";
    String recipient = "johndoe@alfresco.com";
    Date now = new Date();
    String orderId = "123456";
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("sender", from);
    vars.put("recipient", recipient);
    vars.put("recipientName", recipientName);
    vars.put("male", male);
    vars.put("now", now);
    vars.put("orderId", orderId);
    runtimeService.startProcessInstanceByKey("sendMailExample", vars);
    List<WiserMessage> messages = wiser.getMessages();
    assertEquals(1, messages.size());
    WiserMessage message = messages.get(0);
    MimeMessage mimeMessage = message.getMimeMessage();
    assertEquals("Your order " + orderId + " has been shipped", mimeMessage.getHeader("Subject", null));
    assertEquals(from, mimeMessage.getHeader("From", null));
    assertTrue(mimeMessage.getHeader("To", null).contains(recipient));
}
Also used : HashMap(java.util.HashMap) MimeMessage(javax.mail.internet.MimeMessage) WiserMessage(org.subethamail.wiser.WiserMessage) Date(java.util.Date) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 55 with WiserMessage

use of org.subethamail.wiser.WiserMessage in project camunda-bpm-platform by camunda.

the class EmailSendTaskTest method testSimpleTextMail.

@Deployment
public void testSimpleTextMail() throws Exception {
    runtimeService.startProcessInstanceByKey("simpleTextOnly");
    List<WiserMessage> messages = wiser.getMessages();
    assertEquals(1, messages.size());
    WiserMessage message = messages.get(0);
    assertEmailSend(message, false, "Hello Kermit!", "This a text only e-mail.", "camunda@localhost", Arrays.asList("kermit@camunda.org"), null);
}
Also used : WiserMessage(org.subethamail.wiser.WiserMessage) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

WiserMessage (org.subethamail.wiser.WiserMessage)67 MimeMessage (javax.mail.internet.MimeMessage)34 Test (org.junit.Test)27 HashMap (java.util.HashMap)26 Deployment (org.activiti.engine.test.Deployment)22 ArrayList (java.util.ArrayList)12 MimeMultipart (javax.mail.internet.MimeMultipart)12 Deployment (org.camunda.bpm.engine.test.Deployment)10 Date (java.util.Date)9 WorkItemImpl (org.drools.core.process.instance.impl.WorkItemImpl)6 AbstractBaseTest (org.jbpm.test.AbstractBaseTest)6 InputStreamReader (java.io.InputStreamReader)5 Reader (java.io.Reader)5 DefaultWorkItemManager (org.drools.core.process.instance.impl.DefaultWorkItemManager)5 CountDownTaskEventListener (org.jbpm.services.task.util.CountDownTaskEventListener)5 WorkItemManager (org.kie.api.runtime.process.WorkItemManager)5 InternalTask (org.kie.internal.task.api.model.InternalTask)5 File (java.io.File)4 LinkedHashSet (java.util.LinkedHashSet)4 OrganizationalEntity (org.kie.api.task.model.OrganizationalEntity)4