Search in sources :

Example 31 with WiserMessage

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);
    }
}
Also used : HashMap(java.util.HashMap) MimeMultipart(javax.mail.internet.MimeMultipart) WiserMessage(org.subethamail.wiser.WiserMessage) File(java.io.File) Deployment(org.activiti.engine.test.Deployment)

Example 32 with WiserMessage

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);
}
Also used : HashMap(java.util.HashMap) MimeMultipart(javax.mail.internet.MimeMultipart) WiserMessage(org.subethamail.wiser.WiserMessage) Deployment(org.activiti.engine.test.Deployment)

Example 33 with WiserMessage

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);
}
Also used : HashMap(java.util.HashMap) MimeMultipart(javax.mail.internet.MimeMultipart) WiserMessage(org.subethamail.wiser.WiserMessage) Deployment(org.activiti.engine.test.Deployment)

Example 34 with WiserMessage

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);
}
Also used : HashMap(java.util.HashMap) MimeMultipart(javax.mail.internet.MimeMultipart) WiserMessage(org.subethamail.wiser.WiserMessage) Deployment(org.activiti.engine.test.Deployment)

Aggregations

WiserMessage (org.subethamail.wiser.WiserMessage)34 Deployment (org.activiti.engine.test.Deployment)22 HashMap (java.util.HashMap)16 MimeMultipart (javax.mail.internet.MimeMultipart)12 MimeMessage (javax.mail.internet.MimeMessage)11 Test (org.junit.Test)8 File (java.io.File)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 EmailMessage (org.sonar.plugins.emailnotifications.api.EmailMessage)2 Issue (org.sonar.wsclient.issue.Issue)2 Issues (org.sonar.wsclient.issue.Issues)2 PostRequest (org.sonarqube.ws.client.PostRequest)2 SonarScanner (com.sonar.orchestrator.build.SonarScanner)1 BeforeClass (org.junit.BeforeClass)1 QualityGate (org.sonar.wsclient.qualitygate.QualityGate)1 WsClient (org.sonarqube.ws.client.WsClient)1 Wiser (org.subethamail.wiser.Wiser)1 ItUtils.newAdminWsClient (util.ItUtils.newAdminWsClient)1 ItUtils.newUserWsClient (util.ItUtils.newUserWsClient)1