|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.it.mail.MailServices
public class MailServices
This class provides mail services like POP3 and SMTP for the acceptance tests. It will try to find free TCP/IP ports for the services within a given range.
| Constructor Summary | |
|---|---|
MailServices(int portRangeStart,
int portRangeEnd,
java.lang.String hostName)
|
|
| Method Summary | |
|---|---|
void |
addUser(java.lang.String email,
java.lang.String login,
java.lang.String password)
Adds a user to the mail service. |
java.lang.String |
getHostName()
|
int |
getPop3Port()
|
javax.mail.internet.MimeMessage |
getReceivedMessage()
Get the first message of all messages received until now. |
javax.mail.internet.MimeMessage[] |
getReceivedMessages()
Returns an array of all messages received until now. |
int |
getSmtpPort()
|
void |
removeAllReceivedMessages()
Removes all received mails. |
void |
sendTextMessage(java.lang.String to,
java.lang.String from,
java.lang.String subject,
java.lang.String body)
Sends an email with the content type "text/plain" and the given contents using the test SMTP server. |
void |
start()
Tries to start a SMTP and a POP3 server on any free port in the range given in the constructor. |
void |
stop()
Stops the SMTP and POP3 server. |
javax.mail.internet.MimeMessage |
waitAndGetReceivedMessage()
Does the same as getReceivedMessage() but waits until a message is received or until a timeout is reached. |
boolean |
waitForIncomingMessage(int numberOfMessages)
Wait until the specified number of mails is received or until a timeout is reached. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MailServices(int portRangeStart,
int portRangeEnd,
java.lang.String hostName)
| Method Detail |
|---|
public void start()
throws java.net.BindException
java.net.BindException - if there is no free port available in the given rangepublic void stop()
public void addUser(java.lang.String email,
java.lang.String login,
java.lang.String password)
email - email of the user to be createdlogin - login of the user to be createdpassword - password of the user to be createdpublic java.lang.String getHostName()
public int getPop3Port()
public int getSmtpPort()
public void sendTextMessage(java.lang.String to,
java.lang.String from,
java.lang.String subject,
java.lang.String body)
to - email address this mail should be sent tofrom - email address this mail should appear to be sent fromsubject - subject of the emailbody - body of the emailpublic javax.mail.internet.MimeMessage[] getReceivedMessages()
public javax.mail.internet.MimeMessage getReceivedMessage()
public javax.mail.internet.MimeMessage waitAndGetReceivedMessage()
throws java.lang.InterruptedException
getReceivedMessage() but waits until a message is received or until a timeout is reached.
java.lang.InterruptedException
public void removeAllReceivedMessages()
throws com.icegreen.greenmail.store.FolderException
com.icegreen.greenmail.store.FolderException
public boolean waitForIncomingMessage(int numberOfMessages)
throws java.lang.InterruptedException
numberOfMessages -
java.lang.InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||