Package com.dumbster.smtp

Examples of com.dumbster.smtp.SmtpMessage


    } finally {
      mailServer.stop();
    }
    assertTrue(mailServer.getReceivedEmailSize() == 1);
    Iterator<SmtpMessage> emailIter = mailServer.getReceivedEmail();
    SmtpMessage email = (SmtpMessage) emailIter.next();
    assertTrue(email.getHeaderValue("Subject").equals("Email Verification"));
    assertNotNull(email.getBody());
    assertTrue(email.getBody().contains("Username(johnp)"));
    assertTrue(email.getBody().contains("URL(http://foo.com/gnizr/register/verifyEmail.action?username=johnp"));
   
    User user = userManager.getUser("johnp","poploop");
    assertEquals(AccountStatus.INACTIVE,user.getAccountStatus().intValue());
  }
View Full Code Here


    } finally {
      mailServer.stop();
    }
    assertTrue(mailServer.getReceivedEmailSize() == 1);
    Iterator<SmtpMessage> emailIter = mailServer.getReceivedEmail();
    SmtpMessage email = (SmtpMessage) emailIter.next();
    assertTrue(email.getHeaderValue("Subject").equals("Email Verification"));
    assertNotNull(email.getBody());
    assertTrue(email.getBody().contains("Username(hchen1)"));
    assertTrue(email.getBody().contains("URL(http://foo.com/gnizr/register/verifyEmail.action?username=hchen1"));
   
    User user = userManager.getUser("hchen1");
    assertEquals(AccountStatus.INACTIVE,user.getAccountStatus().intValue());
  }
View Full Code Here

    } finally {
      mailServer.stop();
    }
    assertTrue(mailServer.getReceivedEmailSize() == 2);
    Iterator<SmtpMessage> emailIter = mailServer.getReceivedEmail();
    SmtpMessage email = (SmtpMessage) emailIter.next();
    assertTrue(email.getHeaderValue("Subject").equals("Account Registration Pending"));
    assertNotNull(email.getBody());
    assertTrue(email.getBody().contains("NotifyEmail"));
    assertTrue(email.getBody().contains("Username(johnp)"));
    assertTrue(email.getBody().contains("URL(http://foo.com/gnizr/register/verifyEmail.action?username=johnp"));
   
    email = (SmtpMessage) emailIter.next();
    assertTrue(email.getHeaderValue("Subject").equals("Account Registration Approval"));
    assertNotNull(email.getBody());
    assertTrue(email.getBody().contains("ApprovalEmail"));
    assertTrue(email.getBody().contains("CreatedOn: "));
    assertTrue(email.getBody().contains("Email(johnp@example.com)"));
    assertTrue(email.getBody().contains("Username(johnp)"));
    assertTrue(email.getBody().contains("URL(http://foo.com/gnizr/register/verifyEmail.action?username=johnp"));
   
    User user = userManager.getUser("johnp","poploop");
    assertEquals(AccountStatus.INACTIVE,user.getAccountStatus().intValue());
  }
View Full Code Here

    } finally {
      mailServer.stop();
    }
    assertTrue(mailServer.getReceivedEmailSize() == 1);
    Iterator<SmtpMessage> emailIter = mailServer.getReceivedEmail();
    SmtpMessage email = (SmtpMessage) emailIter.next();
    assertTrue(email.getHeaderValue("Subject").equals("Reset Password"));
    assertNotNull(email.getBody());
    assertTrue(email.getBody().contains("Follow this URL to reset your password"));
  }
View Full Code Here

    assertEquals(AccountStatus.ACTIVE,user.getAccountStatus().intValue());   
    assertFalse(tokenManager.isValidResetToken(token, user));
   
    assertTrue(mailServer.getReceivedEmailSize() == 1);
    Iterator<SmtpMessage> emailIter = mailServer.getReceivedEmail();
    SmtpMessage email = (SmtpMessage) emailIter.next();
    assertTrue(email.getHeaderValue("Subject").equals("Welcome"));
    assertNotNull(email.getBody());
    assertTrue(email.getBody().contains("WelcomeEmail"));
    assertTrue(email.getBody().contains("Username(hchen1)"));
    assertTrue(email.getBody().contains("URL(http://foo.com/gnizr/register/verifyEmail.action?username=hchen1"));
  }
View Full Code Here

        model.put("sender", new Person("Daan", "daan@bla.com"));
        model.put("recipient", new Person("Lian", "lian@bla.com"));
        dispatcher.send("email.eml", model);

        assertEquals(1, server.getReceivedEmailSize());
        SmtpMessage message = (SmtpMessage)server.getReceivedEmail().next();
        assertEquals("Daan <daan@bla.com>", message.getHeaderValue("From"));
        assertEquals("Lian <lian@bla.com>", message.getHeaderValue("To"));
        assertEquals("subject", message.getHeaderValue("Subject"));
        assertEquals("No Reply <noreply@bla.org>", message.getHeaderValue("Reply-To"));
    }
View Full Code Here

        });
        try
        {
            Assert.assertTrue(ref.get() != null);

            SmtpMessage lastMessage = ref.get();
            String subject = lastMessage.getHeaderValue("Subject");
            Assert.assertTrue(subject.startsWith("[test] " + title));
            Assert.assertFalse(subject.contains("$"));
            String body = lastMessage.getBody();
            Assert.assertFalse(body.contains("$"));
            for (String toMatch : bodyStrings)
            {
                if (!body.contains(toMatch))
                {
                    Assert.fail("Couldn't match '" + toMatch + "' in:\n" + body);
                }
            }

            Assert.assertTrue(lastMessage.getHeaderValue("To").contains(to));
            return body;
        }
        catch (AssertionError error)
        {
            if (ref.get() != null)
View Full Code Here

      if (mailServer.getReceivedEmailSize() == 0) {
        Assert.fail("No SmtpNotification was sent");
      }
      @SuppressWarnings("rawtypes")
      Iterator emailIter = mailServer.getReceivedEmail();
      SmtpMessage email = (SmtpMessage)emailIter.next();
      System.out.println("Subject:" + email.getHeaderValue("Subject"));
      System.out.println("Body:" + email.getBody());
     
      if (!email.getBody().contains("Service One")) {
        Assert.fail("Notification does not contain the correct service");
      }
     
    } catch (Exception e) {
      logger.error("No exceptions please.");
View Full Code Here

        jizzEmailServices.confirmEmailAddress(mockDj);
        smtp.stop();
        verify(mockEmailRenderer);

        assertEquals(1, smtp.getReceivedEmailSize());
        SmtpMessage msg = (SmtpMessage) smtp.getReceivedEmail().next();

        logger.debug("Confirmation email: {}", msg.getBody());
    }
View Full Code Here

        sendEmail();

        // Then
        assertThat(emailServer.getReceivedEmailSize()).isEqualTo(1);

        SmtpMessage email = getEmail();
        assertThat(email.getBody()).contains(message);
        assertThat(email.getHeaderValue("Subject")).isEqualTo(subject);
        assertThat(email.getHeaderValue("To")).isEqualTo(to);
        assertThat(email.getHeaderValue("From")).isEqualTo(EMAIL_FROM);
        assertThat(email.getHeaderValue("Content-Type")).contains("UTF-8");
    }
View Full Code Here

TOP

Related Classes of com.dumbster.smtp.SmtpMessage

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.