org.mule.providers.email
Class AbstractMailConnectorFunctionalTestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.mule.tck.AbstractMuleTestCase
              extended byorg.mule.tck.providers.AbstractConnectorTestCase
                  extended byorg.mule.providers.email.AbstractMailConnectorFunctionalTestCase
All Implemented Interfaces:
Test
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 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.providers.AbstractConnectorTestCase
connector, descriptor, model
 
Fields inherited from class org.mule.tck.AbstractMuleTestCase
logger
 
Constructor Summary
protected AbstractMailConnectorFunctionalTestCase(boolean initialEmail, String connectorName)
           
 
Method Summary
protected  void assertMessageOk(Object message)
           
protected  void doSetUp()
           
protected  void doTearDown()
           
 org.mule.umo.provider.UMOConnector getConnector()
           
abstract  org.mule.umo.provider.UMOConnector getConnector(boolean init)
           
 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
getTestEndpointURI, testConnectorBeanProps, testConnectorExceptionHandling, testConnectorInitialise, testConnectorLifecycle, testConnectorListenerSupport, testConnectorMessageAdapter, testConnectorMessageDispatcherFactory
 
Methods inherited from class org.mule.tck.AbstractMuleTestCase
addTest, disposeManager, finalize, getDefaultModel, getManager, getName, getTestComponent, getTestConnector, getTestDescriptor, getTestEndpoint, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEventContext, getTestInfo, getTestManager, getTestSession, getTestTransformer, isDisabledInThisEnvironment, isDisabledInThisEnvironment, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, 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
Throws:
Exception

doTearDown

protected void doTearDown()
                   throws Exception
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
Throws:
Exception

getConnectorName

public String getConnectorName()

getConnector

public org.mule.umo.provider.UMOConnector getConnector()
                                                throws Exception
Throws:
Exception

getConnector

public abstract org.mule.umo.provider.UMOConnector getConnector(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.