|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.icegreen.greenmail.util.GreenMail
public class GreenMail
Constructor Summary | |
---|---|
GreenMail()
Creates a SMTP, SMTPS, POP3, POP3S, IMAP, and IMAPS server binding onto non-default ports. |
|
GreenMail(ServerSetup config)
Call this constructor if you want to run one of the email servers only |
|
GreenMail(ServerSetup[] config)
Call this constructor if you want to run more than one of the email servers |
Method Summary | |
---|---|
ImapServer |
getImap()
|
ImapServer |
getImaps()
|
Managers |
getManagers()
|
Pop3Server |
getPop3()
|
Pop3Server |
getPop3s()
|
MimeMessage[] |
getReceivedMessages()
|
MimeMessage[] |
getReceviedMessagesForDomain(String domain)
This method can be used as an easy 'catch-all' mechanism. |
SmtpServer |
getSmtp()
|
SmtpServer |
getSmtps()
|
GreenMailUser |
setUser(String email,
String password)
Sets the password for the account linked to email. |
GreenMailUser |
setUser(String email,
String login,
String password)
|
void |
setUsers(Properties users)
Sets up accounts with password based on a properties map where the key is the email and the value the password |
void |
start()
|
void |
stop()
|
GreenMailUtil |
util()
|
boolean |
waitForIncomingEmail(int emailCount)
Does the same thing as Object.wait(long, int) but with a timeout of 5000ms |
boolean |
waitForIncomingEmail(long timeout,
int emailCount)
Use this method if you are sending email in a different thread from the one you're testing from. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GreenMail()
ServerSetupTest
public GreenMail(ServerSetup config)
config
- public GreenMail(ServerSetup[] config)
config
- Method Detail |
---|
public void start()
public void stop()
public SmtpServer getSmtp()
public ImapServer getImap()
public Pop3Server getPop3()
public SmtpServer getSmtps()
public ImapServer getImaps()
public Pop3Server getPop3s()
public Managers getManagers()
public boolean waitForIncomingEmail(long timeout, int emailCount) throws InterruptedException
timeout
- maximum time in ms to wait for emailCount of messages to arrive before giving up and returning falseemailCount
- waits for these many emails to arrive before returning
InterruptedException
public boolean waitForIncomingEmail(int emailCount) throws InterruptedException
Object.wait(long, int)
but with a timeout of 5000ms
emailCount
-
InterruptedException
public MimeMessage[] getReceivedMessages()
GreenMailUtil
has a bunch of static helper methods to extract body text etc.public MimeMessage[] getReceviedMessagesForDomain(String domain)
domain
- returns all receved messages arrived to domain.public GreenMailUser setUser(String email, String password)
email
- password
- public GreenMailUser setUser(String email, String login, String password)
public void setUsers(Properties users)
users
- public GreenMailUtil util()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |