org.mule.providers.email
Class AbstractMailConnectorFunctionalTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.mule.tck.AbstractMuleTestCase
              extended by org.mule.tck.providers.AbstractConnectorTestCase
                  extended by org.mule.providers.email.AbstractMailConnectorFunctionalTestCase
All Implemented Interfaces:
Test, org.mule.tck.TestCaseWatchdogTimeoutHandler
Direct Known Subclasses:
AbstractReceivingMailConnectorTestCase, SmtpConnectorTestCase

public abstract class AbstractMailConnectorFunctionalTestCase
extends org.mule.tck.providers.AbstractConnectorTestCase

Start a (greenmail) mail server with a known message, for use in subclasses. Each test gets a new set of ports to avoid conflicts (shouldn't be needed, but greenmail doesn't seem to be closing ports). Also contains utility methods for comparing emails, building endpoints, etc.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.mule.tck.AbstractMuleTestCase
org.mule.tck.AbstractMuleTestCase.TestInfo
 
Field Summary
static String FROM
           
static String LOCALHOST
           
static String PASSWORD
           
static int RETRY_LIMIT
           
static String TO
           
static String USER
           
 
Fields inherited from class org.mule.tck.AbstractMuleTestCase
IGNORED_DOT_MULE_DIRS, logger
 
Constructor Summary
protected AbstractMailConnectorFunctionalTestCase(boolean initialEmail, String connectorName)
           
 
Method Summary
protected  void assertMessageOk(Object message)
           
 org.mule.umo.provider.UMOConnector createConnector()
           
abstract  org.mule.umo.provider.UMOConnector createConnector(boolean init)
           
protected  void doSetUp()
           
protected  void doTearDown()
           
 String getConnectorName()
           
protected  String getImapsTestEndpointURI()
           
protected  String getImapTestEndpointURI()
           
protected  String getPop3sTestEndpointURI()
           
protected  String getPop3TestEndpointURI()
           
protected  Servers getServers()
           
protected  String getSmtpsTestEndpointURI()
           
protected  String getSmtpTestEndpointURI()
           
 Object getValidMessage()
           
protected  void repeatTest(String method)
          Tests are intermittently failing due to busy ports.
protected  void startServers()
           
protected  void stopServers()
           
 
Methods inherited from class org.mule.tck.providers.AbstractConnectorTestCase
getConnector, getDescriptor, getModel, getTestEndpointURI, testConnectorBeanProps, testConnectorExceptionHandling, testConnectorInitialise, testConnectorLifecycle, testConnectorListenerSupport, testConnectorMessageAdapter, testConnectorMessageDispatcherFactory
 
Methods inherited from class org.mule.tck.AbstractMuleTestCase
createTestInfo, createWatchdog, disposeManager, getDefaultModel, getManager, getName, getTestComponent, getTestConnector, getTestDescriptor, getTestEndpoint, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEventContext, getTestInfo, getTestManager, getTestSession, getTestTransformer, handleTimeout, isDisabledInThisEnvironment, isDisabledInThisEnvironment, isDisposeManagerPerSuite, isExcluded, isOffline, run, runBare, setDisposeManagerPerSuite, setUp, suitePostSetUp, suitePostTearDown, suitePreSetUp, suitePreTearDown, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RETRY_LIMIT

public static final int RETRY_LIMIT
See Also:
Constant Field Values

LOCALHOST

public static final String LOCALHOST
See Also:
Constant Field Values

USER

public static final String USER
See Also:
Constant Field Values

FROM

public static final String FROM
See Also:
Constant Field Values

TO

public static final String TO
See Also:
Constant Field Values

PASSWORD

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

AbstractMailConnectorFunctionalTestCase

protected AbstractMailConnectorFunctionalTestCase(boolean initialEmail,
                                                  String connectorName)
Method Detail

doSetUp

protected void doSetUp()
                throws Exception
Overrides:
doSetUp in class org.mule.tck.providers.AbstractConnectorTestCase
Throws:
Exception

doTearDown

protected void doTearDown()
                   throws Exception
Overrides:
doTearDown in class org.mule.tck.providers.AbstractConnectorTestCase
Throws:
Exception

startServers

protected void startServers()
                     throws Exception
Throws:
Exception

stopServers

protected void stopServers()
                    throws Exception
Throws:
Exception

getServers

protected Servers getServers()

getValidMessage

public Object getValidMessage()
                       throws Exception
Specified by:
getValidMessage in class org.mule.tck.providers.AbstractConnectorTestCase
Throws:
Exception

getConnectorName

public String getConnectorName()

createConnector

public org.mule.umo.provider.UMOConnector createConnector()
                                                   throws Exception
Specified by:
createConnector in class org.mule.tck.providers.AbstractConnectorTestCase
Throws:
Exception

createConnector

public abstract org.mule.umo.provider.UMOConnector createConnector(boolean init)
                                                            throws Exception
Throws:
Exception

getPop3TestEndpointURI

protected String getPop3TestEndpointURI()

getPop3sTestEndpointURI

protected String getPop3sTestEndpointURI()

getImapTestEndpointURI

protected String getImapTestEndpointURI()

getImapsTestEndpointURI

protected String getImapsTestEndpointURI()

getSmtpTestEndpointURI

protected String getSmtpTestEndpointURI()

getSmtpsTestEndpointURI

protected String getSmtpsTestEndpointURI()

assertMessageOk

protected void assertMessageOk(Object message)
                        throws Exception
Throws:
Exception

repeatTest

protected void repeatTest(String method)
                   throws Exception
Tests are intermittently failing due to busy ports. Here we repeat a test a number of times (more than twice should not be necessary!) to make sure that the first failure was not due to an active port.

Parameters:
method - The method name of the test
Throws:
Exception - If the failure occurs repeatedly


Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.