use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
the class EmailServiceTaskTest method testSimpleTextMailForNonExistentTenant.
public void testSimpleTextMailForNonExistentTenant() throws Exception {
String tenantId = "nonExistentTenant";
org.activiti.engine.repository.Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/engine/test/bpmn/mail/EmailSendTaskTest.testSimpleTextMail.bpmn20.xml").tenantId(tenantId).deploy();
String procId = runtimeService.startProcessInstanceByKeyAndTenantId("simpleTextOnly", tenantId).getId();
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.", "activiti@localhost", Arrays.asList("kermit@activiti.org"), null);
assertProcessEnded(procId);
repositoryService.deleteDeployment(deployment.getId(), true);
}
use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
the class EmailServiceTaskTest method testSimpleTextMail.
@Deployment
public void testSimpleTextMail() throws Exception {
String procId = runtimeService.startProcessInstanceByKey("simpleTextOnly").getId();
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.", "activiti@localhost", Arrays.asList("kermit@activiti.org"), null);
assertProcessEnded(procId);
}
use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
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);
}
use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
the class EmailServiceTaskTest method testTextMailWithDataSourceAttachment.
@Deployment
public void testTextMailWithDataSourceAttachment() throws Exception {
String fileName = "file-name-to-be-displayed";
String fileContent = "This is the file content";
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("attachmentsBean", new AttachmentsBean());
vars.put("fileContent", fileContent);
vars.put("fileName", fileName);
runtimeService.startProcessInstanceByKey("textMailWithDataSourceAttachment", vars);
List<WiserMessage> messages = wiser.getMessages();
assertEquals(1, messages.size());
WiserMessage message = messages.get(0);
MimeMultipart mm = (MimeMultipart) message.getMimeMessage().getContent();
assertEquals(2, mm.getCount());
String attachmentFileName = mm.getBodyPart(1).getDataHandler().getName();
assertEquals(fileName, attachmentFileName);
}
use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
the class EmailSendTaskTest method testTextMailWithNotExistingFileAttachment.
@Deployment
public void testTextMailWithNotExistingFileAttachment() throws Exception {
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("attachmentsBean", new AttachmentsBean());
runtimeService.startProcessInstanceByKey("textMailWithNotExistingFileAttachment", vars);
List<WiserMessage> messages = wiser.getMessages();
assertEquals(1, messages.size());
WiserMessage message = messages.get(0);
assertFalse(message.getMimeMessage().getContent() instanceof MimeMultipart);
}
Aggregations