com.atlassian.confluence.it.mail
Class MailFacade

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

public class MailFacade
extends java.lang.Object

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

Since:
v4.2

Field Summary
static java.lang.String TEST_POP_SERVER_NAME
           
static java.lang.String TESTMAILSERVER_HOSTNAME
           
 
Constructor Summary
MailFacade(ConfluenceRpc rpc)
           
 
Method Summary
 void addMailboxesForUsers(User... users)
           
 void addMailboxForUser(MailUser user)
           
 void addMailboxForUser(User user)
           
 void addPopMailServer(java.lang.String username, java.lang.String password, java.lang.String toAddress)
           
 void changeSmtpFromName(java.lang.String fromName)
           
 void changeSmtpServerHost(java.lang.String hostname, int port)
           
 java.util.List<javax.mail.internet.MimeMessage> getMessages()
          Returns whatever messages are available
 int getPopPort()
           
 javax.mail.internet.MimeMessage getReceivedMessage()
           
 boolean noMessages()
           
 void removeAllRecievedMessages()
           
 void removeMailServer()
           
 void removeMailServer(java.lang.String serverName)
           
 void removePopMailServer()
           
 void reset()
           
 void send(java.lang.String to, java.lang.String from, java.lang.String subject, java.lang.String body)
           
 void sendMimeMessage(java.io.InputStream inputStream)
           
 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()
           
 boolean verifyNoMessages()
           
 javax.mail.internet.MimeMessage waitForMessage()
          Waits for at least one message and returns it
 java.util.List<javax.mail.internet.MimeMessage> waitForMessages(java.lang.Integer expectedCount)
           
 java.util.List<javax.mail.internet.MimeMessage> waitForMessages(org.hamcrest.Matcher<java.lang.Integer> matcher)
           
 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 java.lang.String TESTMAILSERVER_HOSTNAME

TEST_POP_SERVER_NAME

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

MailFacade

public MailFacade(ConfluenceRpc rpc)
Method Detail

startSoleServer

public MailFacade startSoleServer()
                           throws java.net.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:
java.net.BindException - If a free port could not be found

start

public MailFacade start()
                 throws java.net.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:
java.net.BindException - If a free port could not be found

startMailServerOnly

public void startMailServerOnly()
                         throws java.net.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:
java.net.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 java.lang.Exception
Throws:
java.lang.Exception

verifyNoMessages

public boolean verifyNoMessages()

waitForMessages

public java.util.List<javax.mail.internet.MimeMessage> waitForMessages(java.lang.Integer expectedCount)

waitForMessages

public java.util.List<javax.mail.internet.MimeMessage> waitForMessages(org.hamcrest.Matcher<java.lang.Integer> matcher)

getMessages

public java.util.List<javax.mail.internet.MimeMessage> getMessages()
Returns whatever messages are available


noMessages

public boolean noMessages()

stop

public void stop()

removeMailServer

public void removeMailServer(java.lang.String serverName)

removeMailServer

public void removeMailServer()

changeSmtpServerHost

public void changeSmtpServerHost(java.lang.String hostname,
                                 int port)

changeSmtpFromName

public void changeSmtpFromName(java.lang.String fromName)

reset

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

removeAllRecievedMessages

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

send

public void send(java.lang.String to,
                 java.lang.String from,
                 java.lang.String subject,
                 java.lang.String body)

sendMimeMessage

public void sendMimeMessage(java.io.InputStream inputStream)

getPopPort

public int getPopPort()

waitForMessage

public javax.mail.internet.MimeMessage waitForMessage()
Waits for at least one message and returns it


watchAsHtmlWithDiffs

public void watchAsHtmlWithDiffs(User user)

addPopMailServer

public void addPopMailServer(java.lang.String username,
                             java.lang.String password,
                             java.lang.String toAddress)

removePopMailServer

public void removePopMailServer()


Copyright © 2003-2014 Atlassian. All Rights Reserved.