use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
the class EmailSendTaskTest method testTextMailWithFileAttachments.
@Deployment
public void testTextMailWithFileAttachments() throws Exception {
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("attachmentsBean", new AttachmentsBean());
runtimeService.startProcessInstanceByKey("textMailWithFileAttachments", vars);
List<WiserMessage> messages = wiser.getMessages();
assertEquals(1, messages.size());
WiserMessage message = messages.get(0);
MimeMultipart mm = (MimeMultipart) message.getMimeMessage().getContent();
File[] files = new AttachmentsBean().getFiles();
assertEquals(1 + files.length, mm.getCount());
for (int i = 0; i < files.length; i++) {
String attachmentFileName = mm.getBodyPart(1 + i).getDataHandler().getName();
assertEquals(files[i].getName(), attachmentFileName);
}
}
use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
the class EmailSendTaskTest method testTextMailWithFileAttachment.
@Deployment
public void testTextMailWithFileAttachment() throws Exception {
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("attachmentsBean", new AttachmentsBean());
runtimeService.startProcessInstanceByKey("textMailWithFileAttachment", 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(new AttachmentsBean().getFile().getName(), attachmentFileName);
}
use of org.subethamail.wiser.WiserMessage in project Activiti by Activiti.
the class EmailSendTaskTest 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 testHtmlMailWithFileAttachment.
@Deployment
public void testHtmlMailWithFileAttachment() throws Exception {
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("attachmentsBean", new AttachmentsBean());
vars.put("gender", "male");
runtimeService.startProcessInstanceByKey("htmlMailWithFileAttachment", 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(new AttachmentsBean().getFile().getName(), attachmentFileName);
}
Aggregations