Package org.subethamail.wiser

Examples of org.subethamail.wiser.WiserMessage


    * @param expectedMessageContents
    */
   private void checkDelivered(String[] expectedMessageContents)
   {
      assertFalse("Expected a message", wiser.getMessages().isEmpty());
      WiserMessage message = wiser.getMessages().get(0); // although "send plain text" example sends 3 mails (To:, CC:, Bcc:) Wiser cannot distinquish between them so we just check the first mail.
      assertEquals(ADDRESS, message.getEnvelopeReceiver());
      assertTrue("Envelope sender (" + message.getEnvelopeSender() + ") doesn't match expected one (" + ENVELOPE_SENDER + ")", message.getEnvelopeSender().matches(ENVELOPE_SENDER));
     
      for (String expectedMessageContent: expectedMessageContents) {
         assertTrue("Didn't find expected text (" + expectedMessageContent + ") in the received email.", new String(message.getData()).contains(expectedMessageContent));
      }
   }
View Full Code Here


        "success@subethamail.org")});
    t.close();
    started = System.currentTimeMillis() - started;
    log.info("Elapsed ms = "+started);

    WiserMessage msg = this.server.getMessages().get(0);

    assertEquals(1, this.server.getMessages().size());
    assertEquals("success@subethamail.org", msg.getEnvelopeReceiver());

    File compareFile = File.createTempFile("attached", ".tmp");
    log.debug("Writing received attachment ...");

    FileOutputStream fos = new FileOutputStream(compareFile);
    ((MimeMultipart) msg.getMimeMessage().getContent()).getBodyPart(1).getDataHandler().writeTo(fos);
    fos.close();
    log.debug("Checking integrity ...");
    assertTrue(this.checkIntegrity(new File(BIGFILE_PATH), compareFile));
    log.debug("Checking integrity DONE");
    compareFile.delete();
View Full Code Here

    this.sendDataEnd();
    this.sendQuit();

    assertEquals(1, this.server.getMessages().size());
    Iterator<WiserMessage> emailIter = this.server.getMessages().iterator();
    WiserMessage email = emailIter.next();
    assertEquals("Body" + "\r\n", email.getMimeMessage().getContent().toString());
  }
View Full Code Here

    this.sendDataEnd();
    this.sendQuit();

    assertEquals(1, this.server.getMessages().size());
    Iterator<WiserMessage> emailIter = this.server.getMessages().iterator();
    WiserMessage email = emailIter.next();
    assertEquals("Body" + "\r\n", email.getMimeMessage().getContent().toString());
  }
View Full Code Here

      fail("Unexpected exception: " + e);
    }

    assertEquals(1, this.server.getMessages().size());
    Iterator<WiserMessage> emailIter = this.server.getMessages().iterator();
    WiserMessage email = emailIter.next();
    assertEquals(body + "\r\n", email.getMimeMessage().getContent().toString());
  }
View Full Code Here

      fail("Unexpected exception: " + e);
    }

    assertEquals(1, this.server.getMessages().size());
    Iterator<WiserMessage> emailIter = this.server.getMessages().iterator();
    WiserMessage email = emailIter.next();
    assertEquals(email.getMimeMessage().getContent().toString(), bodyWithCR);
  }
View Full Code Here

    {
      e.printStackTrace();
    }

    Iterator<WiserMessage> emailIter = this.server.getMessages().iterator();
    WiserMessage email = emailIter.next();
    MimeMessage mime = email.getMimeMessage();
    assertEquals("Test", mime.getHeader("Subject")[0]);
    assertEquals("Test Body" + "\r\n", mime.getContent().toString());
  }
View Full Code Here

    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 + "\" <" +from.toString() + ">" , mimeMessage.getHeader("From", null));
    assertTrue(mimeMessage.getHeader("To", null).contains(recipient));
  }
View Full Code Here

    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 + "\" <" +from.toString() + ">" , mimeMessage.getHeader("From", null));
    assertTrue(mimeMessage.getHeader("To", null).contains(recipient));
  }
View Full Code Here

    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 + "\" <" +from.toString() + ">" , mimeMessage.getHeader("From", null));
    assertTrue(mimeMessage.getHeader("To", null).contains(recipient));
  }
View Full Code Here

TOP

Related Classes of org.subethamail.wiser.WiserMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.