com.atlassian.confluence.it.mail
Class MailFacade

java.lang.Object
  extended by com.atlassian.confluence.it.mail.MailFacade

public class MailFacade
extends Object

Provides common Mail methods for getting mail messages and setting User mail preferences.

Since:
v4.2

Field Summary
static String TEST_POP_SERVER_NAME
           
static String TESTMAILSERVER_HOSTNAME
           
 
Constructor Summary
MailFacade(ConfluenceRpc rpc)
           
 
Method Summary
 void addMailboxesForUsers(User... users)
           
 void addMailboxForUser(MailUser user)
           
 void addMailboxForUser(User user)
           
 void addPopMailServer(String username, String password, String toAddress)
           
 void changeSmtpFromName(String fromName)
           
 void changeSmtpServerHost(String hostname, int port)
           
 javax.mail.internet.MimeMessage getExpectedMessage()
           
 javax.mail.internet.MimeMessage[] getExpectedMessages(int expectedMessages)
           
 javax.mail.internet.MimeMessage[] getMessages()
           
 int getPopPort()
           
 javax.mail.internet.MimeMessage getReceivedMessage()
           
 boolean noMessages()
           
 void removeMailServer()
           
 void removeMailServer(String serverName)
           
 void reset()
           
 void send(String to, String from, String subject, String body)
           
 MailFacade start()
          Starts up and configures a new mail server which will be pulled back down during test tearDown.
 void startMailServerOnly()
          Starts the mail server, but DOESN'T configure Confluence to use it.
 MailFacade startSoleServer()
          Same as start() except it removes all existing mail servers if any are configured.
 void stop()
           
 int waitForEmail(int numberOfEmails)
          Fetches the given count of emails
 void watchAsHtmlWithDiffs(User user)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TESTMAILSERVER_HOSTNAME

public static final String TESTMAILSERVER_HOSTNAME

TEST_POP_SERVER_NAME

public static final String TEST_POP_SERVER_NAME
See Also:
Constant Field Values
Constructor Detail

MailFacade

public MailFacade(ConfluenceRpc rpc)
Method Detail

startSoleServer

public MailFacade startSoleServer()
                           throws BindException
Same as start() except it removes all existing mail servers if any are configured. It is your responsibility to ensure that stop() is eventually called once you call this method.

Throws:
BindException - If a free port could not be found

start

public MailFacade start()
                 throws BindException
Starts up and configures a new mail server which will be pulled back down during test tearDown. It is your responsibility to ensure that stop() is eventually called once you call this method.

Throws:
BindException - If a free port could not be found

startMailServerOnly

public void startMailServerOnly()
                         throws BindException
Starts the mail server, but DOESN'T configure Confluence to use it. Useful for tests that need a running server but are testing the "Mail Servers" Confluence admin UI.

Throws:
BindException

addMailboxesForUsers

public void addMailboxesForUsers(User... users)

addMailboxForUser

public void addMailboxForUser(User user)

addMailboxForUser

public void addMailboxForUser(MailUser user)

getReceivedMessage

public javax.mail.internet.MimeMessage getReceivedMessage()
                                                   throws Exception
Throws:
Exception

getExpectedMessages

public javax.mail.internet.MimeMessage[] getExpectedMessages(int expectedMessages)

getMessages

public javax.mail.internet.MimeMessage[] getMessages()

noMessages

public boolean noMessages()

stop

public void stop()

removeMailServer

public void removeMailServer(String serverName)

removeMailServer

public void removeMailServer()

changeSmtpServerHost

public void changeSmtpServerHost(String hostname,
                                 int port)

changeSmtpFromName

public void changeSmtpFromName(String fromName)

reset

public void reset()
           throws com.icegreen.greenmail.store.FolderException
Throws:
com.icegreen.greenmail.store.FolderException

waitForEmail

public int waitForEmail(int numberOfEmails)
Fetches the given count of emails

Parameters:
numberOfEmails - the number of expected emails
Returns:
the actual number of received emails

send

public void send(String to,
                 String from,
                 String subject,
                 String body)

getPopPort

public int getPopPort()

getExpectedMessage

public javax.mail.internet.MimeMessage getExpectedMessage()

watchAsHtmlWithDiffs

public void watchAsHtmlWithDiffs(User user)

addPopMailServer

public void addPopMailServer(String username,
                             String password,
                             String toAddress)


Copyright © 2003-2013 Atlassian. All Rights Reserved.