org.mule.tck
Class AbstractMuleTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.mule.tck.AbstractMuleTestCase
All Implemented Interfaces:
junit.framework.Test, TestCaseWatchdogTimeoutHandler

Deprecated. Use AbstractMuleTestCase

@Deprecated
public abstract class AbstractMuleTestCase
extends junit.framework.TestCase
implements TestCaseWatchdogTimeoutHandler

AbstractMuleTestCase is a base class for Mule testcases. This implementation provides services to test code for creating mock and test objects.


Nested Class Summary
static class AbstractMuleTestCase.TestInfo
          Deprecated.  
 
Field Summary
protected  Latch callbackCalled
          Deprecated. Use this as a semaphore to the unit test to indicate when a callback has successfully been called.
static String CLASSNAME_ANNOTATIONS_CONFIG_BUILDER
          Deprecated. If the annotations module is on the classpath, also enable annotations config builder
static int DEFAULT_MULE_TEST_TIMEOUT_SECS
          Deprecated. Default test watchdog timeout in seconds.
static String[] IGNORED_DOT_MULE_DIRS
          Deprecated. Top-level directories under .mule which are not deleted on each test case recycle.
static long LOCK_TIMEOUT
          Deprecated. Default timeout for multithreaded tests (using CountDownLatch, WaitableBoolean, etc.), in milliseconds.
protected  Log logger
          Deprecated.  
protected static MuleContext muleContext
          Deprecated.  
protected  int numPorts
          Deprecated.  
 List<Integer> ports
          Deprecated.  
static String PROPERTY_MULE_TEST_TIMEOUT
          Deprecated. Name of a property to override the default test watchdog timeout.
static int RECEIVE_TIMEOUT
          Deprecated. Default timeout for waiting for responses
static String TEST_MESSAGE
          Deprecated. Convenient test message for unit testing.
protected  int testTimeoutSecs
          Deprecated. Timeout used for the test watchdog
 
Constructor Summary
AbstractMuleTestCase()
          Deprecated.  
 
Method Summary
protected  void addBuilders(List<ConfigurationBuilder> builders)
          Deprecated.  
protected  void configureMuleContext(MuleContextBuilder contextBuilder)
          Deprecated. Override this method to set properties of the MuleContextBuilder before it is used to create the MuleContext.
protected  MuleContext createMuleContext()
          Deprecated.  
protected
<T> T
createObject(Class<T> clazz)
          Deprecated. Create an object of instance clazz.
protected
<T> T
createObject(Class<T> clazz, Object... args)
          Deprecated. Create an object of instance clazz.
protected  AbstractMuleTestCase.TestInfo createTestInfo()
          Deprecated.  
protected  TestCaseWatchdog createWatchdog()
          Deprecated.  
protected  void disposeManager()
          Deprecated.  
protected  void doSetUp()
          Deprecated. Exactly the same a setUp() in normal JUnit test cases.
protected  void doTearDown()
          Deprecated. Exactly the same a tearDown() in normal JUnit test cases.
protected  ConfigurationBuilder getBuilder()
          Deprecated.  
protected  String getConfigurationResources()
          Deprecated.  
 List<Integer> getPorts()
          Deprecated.  
 SensingNullMessageProcessor getSensingNullMessageProcessor()
          Deprecated.  
protected  Properties getStartUpProperties()
          Deprecated.  
static TestConnector getTestConnector()
          Deprecated.  
static MuleEvent getTestEvent(Object data)
          Deprecated.  
static MuleEvent getTestEvent(Object data, InboundEndpoint endpoint)
          Deprecated.  
static MuleEvent getTestEvent(Object data, MessageExchangePattern mep)
          Deprecated.  
static MuleEvent getTestEvent(Object data, MuleSession session)
          Deprecated.  
static MuleEvent getTestEvent(Object data, Service service)
          Deprecated.  
static MuleEvent getTestEvent(Object data, Service service, InboundEndpoint endpoint)
          Deprecated.  
static MuleEvent getTestEvent(Object data, Service service, MessageExchangePattern mep)
          Deprecated.  
static MuleEventContext getTestEventContext(Object data)
          Deprecated.  
static MuleEventContext getTestEventContext(Object data, MessageExchangePattern mep)
          Deprecated.  
static MuleEvent getTestEventUsingFlow(Object data)
          Deprecated.  
protected  String getTestHeader()
          Deprecated.  
static InboundEndpoint getTestInboundEndpoint(MessageExchangePattern mep)
          Deprecated.  
static InboundEndpoint getTestInboundEndpoint(String name)
          Deprecated.  
static InboundEndpoint getTestInboundEndpoint(String name, List<Transformer> transformers)
          Deprecated.  
static InboundEndpoint getTestInboundEndpoint(String name, String uri)
          Deprecated.  
static InboundEndpoint getTestInboundEndpoint(String name, String uri, List<Transformer> transformers, Filter filter, Map<Object,Object> properties)
          Deprecated.  
static InboundEndpoint getTestInboundEndpoint(String name, String uri, List<Transformer> transformers, Filter filter, Map<Object,Object> properties, Connector connector)
          Deprecated.  
protected  AbstractMuleTestCase.TestInfo getTestInfo()
          Deprecated.  
static OutboundEndpoint getTestOutboundEndpoint(String name)
          Deprecated.  
static OutboundEndpoint getTestOutboundEndpoint(String name, List<Transformer> transformers)
          Deprecated.  
static OutboundEndpoint getTestOutboundEndpoint(String name, String uri)
          Deprecated.  
static OutboundEndpoint getTestOutboundEndpoint(String name, String uri, List<Transformer> transformers, Filter filter, Map<Object,Object> properties)
          Deprecated.  
static OutboundEndpoint getTestOutboundEndpoint(String name, String uri, List<Transformer> transformers, Filter filter, Map<Object,Object> properties, Connector connector)
          Deprecated.  
static Service getTestService()
          Deprecated.  
static Service getTestService(String name, Class<?> clazz)
          Deprecated.  
static Service getTestService(String name, Class<?> clazz, Map<?,?> props)
          Deprecated.  
static MuleSession getTestSession(Service service, MuleContext context)
          Deprecated.  
 int getTestTimeoutSecs()
          Deprecated.  
static InboundEndpoint getTestTransactedInboundEndpoint(MessageExchangePattern mep)
          Deprecated.  
static Transformer getTestTransformer()
          Deprecated.  
 TriggerableMessageSource getTriggerableMessageSource()
          Deprecated.  
 TriggerableMessageSource getTriggerableMessageSource(MessageProcessor listener)
          Deprecated.  
protected  void giveTheTestSomeTimeToCleanUpAndThenKillIt(String messageIfNeedToKill)
          Deprecated.  
 void handleTimeout(long timeout, TimeUnit unit)
          Deprecated.  
protected  void initialiseObject(Object o)
          Deprecated. A convenience method that will register an object in the registry using its hashcode as the key.
protected  void initTestTimeoutSecs()
          Deprecated.  
protected  boolean isDisabledInThisEnvironment()
          Deprecated. Subclasses can override this method to skip the execution of the entire test class.
protected  boolean isDisabledInThisEnvironment(String testMethodName)
          Deprecated. Should this test run?
protected  boolean isDisposeManagerPerSuite()
          Deprecated.  
protected  boolean isExcluded()
          Deprecated. Indicates whether this test has been explicitly disabled through the configuration file loaded by TestInfo.
protected  boolean isGracefulShutdown()
          Deprecated. Determines if the test case should perform graceful shutdown or not.
 boolean isOffline(String method)
          Deprecated.  
protected  boolean isStartContext()
          Deprecated.  
protected  void printTestHeader()
          Deprecated.  
protected  void registerTestMethod()
          Deprecated.  
 void run(junit.framework.TestResult result)
          Deprecated.  
 void runBare()
          Deprecated. Shamelessly copy from Spring's ConditionalTestCase so in MULE-2.0 we can extend this class from ConditionalTestCase.
protected  void setDisposeManagerPerSuite(boolean val)
          Deprecated.  
 void setFailOnTimeout(boolean failOnTimeout)
          Deprecated.  
 void setName(String name)
          Deprecated.  
protected  void setStartContext(boolean startContext)
          Deprecated.  
protected  void setUp()
          Deprecated. Normal JUnit method
protected  void suitePostTearDown()
          Deprecated. Run after all testcase teardowns.
protected  void suitePreSetUp()
          Deprecated. Run before any testcase setup.
protected  void tearDown()
          Deprecated. Normal JUnit method
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, runTest, 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, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IGNORED_DOT_MULE_DIRS

public static final String[] IGNORED_DOT_MULE_DIRS
Deprecated. 
Top-level directories under .mule which are not deleted on each test case recycle. This is required, e.g. to play nice with transaction manager recovery service object store.


PROPERTY_MULE_TEST_TIMEOUT

public static final String PROPERTY_MULE_TEST_TIMEOUT
Deprecated. 
Name of a property to override the default test watchdog timeout.

See Also:
DEFAULT_MULE_TEST_TIMEOUT_SECS, Constant Field Values

DEFAULT_MULE_TEST_TIMEOUT_SECS

public static final int DEFAULT_MULE_TEST_TIMEOUT_SECS
Deprecated. 
Default test watchdog timeout in seconds.

See Also:
Constant Field Values

CLASSNAME_ANNOTATIONS_CONFIG_BUILDER

public static final String CLASSNAME_ANNOTATIONS_CONFIG_BUILDER
Deprecated. 
If the annotations module is on the classpath, also enable annotations config builder

See Also:
Constant Field Values

muleContext

protected static MuleContext muleContext
Deprecated. 

logger

protected final transient Log logger
Deprecated. 

numPorts

protected int numPorts
Deprecated. 

ports

public List<Integer> ports
Deprecated. 

TEST_MESSAGE

public static final String TEST_MESSAGE
Deprecated. 
Convenient test message for unit testing.

See Also:
Constant Field Values

LOCK_TIMEOUT

public static final long LOCK_TIMEOUT
Deprecated. 
Default timeout for multithreaded tests (using CountDownLatch, WaitableBoolean, etc.), in milliseconds. The higher this value, the more reliable the test will be, so it should be set high for Continuous Integration. However, this can waste time during day-to-day development cycles, so you may want to temporarily lower it while debugging.

See Also:
Constant Field Values

RECEIVE_TIMEOUT

public static final int RECEIVE_TIMEOUT
Deprecated. 
Default timeout for waiting for responses

See Also:
Constant Field Values

callbackCalled

protected Latch callbackCalled
Deprecated. 
Use this as a semaphore to the unit test to indicate when a callback has successfully been called.


testTimeoutSecs

protected int testTimeoutSecs
Deprecated. 
Timeout used for the test watchdog

Constructor Detail

AbstractMuleTestCase

public AbstractMuleTestCase()
Deprecated. 
Method Detail

registerTestMethod

protected void registerTestMethod()
Deprecated. 

initTestTimeoutSecs

protected void initTestTimeoutSecs()
Deprecated. 

setName

public void setName(String name)
Deprecated. 
Overrides:
setName in class junit.framework.TestCase

createTestInfo

protected AbstractMuleTestCase.TestInfo createTestInfo()
Deprecated. 

getTestInfo

protected AbstractMuleTestCase.TestInfo getTestInfo()
Deprecated. 

run

public void run(junit.framework.TestResult result)
Deprecated. 
Specified by:
run in interface junit.framework.Test
Overrides:
run in class junit.framework.TestCase

runBare

public void runBare()
             throws Throwable
Deprecated. 
Shamelessly copy from Spring's ConditionalTestCase so in MULE-2.0 we can extend this class from ConditionalTestCase.

Subclasses can override isDisabledInThisEnvironment to skip a single test.

Overrides:
runBare in class junit.framework.TestCase
Throws:
Throwable

isDisabledInThisEnvironment

protected boolean isDisabledInThisEnvironment()
Deprecated. 
Subclasses can override this method to skip the execution of the entire test class.

Returns:
true if the test class should not be run.

isExcluded

protected boolean isExcluded()
Deprecated. 
Indicates whether this test has been explicitly disabled through the configuration file loaded by TestInfo.

Returns:
whether the test has been explicitly disabled

isDisabledInThisEnvironment

protected boolean isDisabledInThisEnvironment(String testMethodName)
Deprecated. 
Should this test run?

Parameters:
testMethodName - name of the test method
Returns:
whether the test should execute in the current envionment

isOffline

public boolean isOffline(String method)
Deprecated. 

isDisposeManagerPerSuite

protected boolean isDisposeManagerPerSuite()
Deprecated. 

setDisposeManagerPerSuite

protected void setDisposeManagerPerSuite(boolean val)
Deprecated. 

getTestTimeoutSecs

public int getTestTimeoutSecs()
Deprecated. 

createWatchdog

protected TestCaseWatchdog createWatchdog()
Deprecated. 

handleTimeout

public void handleTimeout(long timeout,
                          TimeUnit unit)
Deprecated. 
Specified by:
handleTimeout in interface TestCaseWatchdogTimeoutHandler

giveTheTestSomeTimeToCleanUpAndThenKillIt

protected void giveTheTestSomeTimeToCleanUpAndThenKillIt(String messageIfNeedToKill)
Deprecated. 

setUp

protected final void setUp()
                    throws Exception
Deprecated. 
Normal JUnit method

Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception
See Also:
doSetUp()

printTestHeader

protected void printTestHeader()
Deprecated. 

getTestHeader

protected String getTestHeader()
Deprecated. 

createMuleContext

protected MuleContext createMuleContext()
                                 throws Exception
Deprecated. 
Throws:
Exception

addBuilders

protected void addBuilders(List<ConfigurationBuilder> builders)
Deprecated. 

configureMuleContext

protected void configureMuleContext(MuleContextBuilder contextBuilder)
Deprecated. 
Override this method to set properties of the MuleContextBuilder before it is used to create the MuleContext.


getBuilder

protected ConfigurationBuilder getBuilder()
                                   throws Exception
Deprecated. 
Throws:
Exception

getConfigurationResources

protected String getConfigurationResources()
Deprecated. 

getStartUpProperties

protected Properties getStartUpProperties()
Deprecated. 

suitePreSetUp

protected void suitePreSetUp()
                      throws Exception
Deprecated. 
Run before any testcase setup. This is called once only before the test suite runs.

Throws:
Exception

suitePostTearDown

protected void suitePostTearDown()
                          throws Exception
Deprecated. 
Run after all testcase teardowns. This is called once only after all the tests in the suite have run.

Throws:
Exception

tearDown

protected final void tearDown()
                       throws Exception
Deprecated. 
Normal JUnit method

Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception
See Also:
doTearDown()

disposeManager

protected void disposeManager()
Deprecated. 

doSetUp

protected void doSetUp()
                throws Exception
Deprecated. 
Exactly the same a setUp() in normal JUnit test cases. this is called before a test method has been called.

Throws:
Exception - if something fails that should halt the testcase

doTearDown

protected void doTearDown()
                   throws Exception
Deprecated. 
Exactly the same a tearDown() in normal JUnit test cases. this is called after a test method has been called.

Throws:
Exception - if something fails that should halt the testcase

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(String name)
                                              throws Exception
Deprecated. 
Throws:
Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(String name)
                                                throws Exception
Deprecated. 
Throws:
Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(MessageExchangePattern mep)
                                              throws Exception
Deprecated. 
Throws:
Exception

getTestTransactedInboundEndpoint

public static InboundEndpoint getTestTransactedInboundEndpoint(MessageExchangePattern mep)
                                                        throws Exception
Deprecated. 
Throws:
Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(String name,
                                                     String uri)
                                              throws Exception
Deprecated. 
Throws:
Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(String name,
                                                       String uri)
                                                throws Exception
Deprecated. 
Throws:
Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(String name,
                                                     List<Transformer> transformers)
                                              throws Exception
Deprecated. 
Throws:
Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(String name,
                                                       List<Transformer> transformers)
                                                throws Exception
Deprecated. 
Throws:
Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(String name,
                                                     String uri,
                                                     List<Transformer> transformers,
                                                     Filter filter,
                                                     Map<Object,Object> properties,
                                                     Connector connector)
                                              throws Exception
Deprecated. 
Throws:
Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(String name,
                                                       String uri,
                                                       List<Transformer> transformers,
                                                       Filter filter,
                                                       Map<Object,Object> properties)
                                                throws Exception
Deprecated. 
Throws:
Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(String name,
                                                     String uri,
                                                     List<Transformer> transformers,
                                                     Filter filter,
                                                     Map<Object,Object> properties)
                                              throws Exception
Deprecated. 
Throws:
Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(String name,
                                                       String uri,
                                                       List<Transformer> transformers,
                                                       Filter filter,
                                                       Map<Object,Object> properties,
                                                       Connector connector)
                                                throws Exception
Deprecated. 
Throws:
Exception

getTestEvent

public static MuleEvent getTestEvent(Object data,
                                     Service service)
                              throws Exception
Deprecated. 
Throws:
Exception

getTestEvent

public static MuleEvent getTestEvent(Object data,
                                     Service service,
                                     MessageExchangePattern mep)
                              throws Exception
Deprecated. 
Throws:
Exception

getTestEvent

public static MuleEvent getTestEvent(Object data)
                              throws Exception
Deprecated. 
Throws:
Exception

getTestEventUsingFlow

public static MuleEvent getTestEventUsingFlow(Object data)
                                       throws Exception
Deprecated. 
Throws:
Exception

getTestEvent

public static MuleEvent getTestEvent(Object data,
                                     MessageExchangePattern mep)
                              throws Exception
Deprecated. 
Throws:
Exception

getTestEvent

public static MuleEvent getTestEvent(Object data,
                                     MuleSession session)
                              throws Exception
Deprecated. 
Throws:
Exception

getTestEventContext

public static MuleEventContext getTestEventContext(Object data)
                                            throws Exception
Deprecated. 
Throws:
Exception

getTestEventContext

public static MuleEventContext getTestEventContext(Object data,
                                                   MessageExchangePattern mep)
                                            throws Exception
Deprecated. 
Throws:
Exception

getTestTransformer

public static Transformer getTestTransformer()
                                      throws Exception
Deprecated. 
Throws:
Exception

getTestEvent

public static MuleEvent getTestEvent(Object data,
                                     InboundEndpoint endpoint)
                              throws Exception
Deprecated. 
Throws:
Exception

getTestEvent

public static MuleEvent getTestEvent(Object data,
                                     Service service,
                                     InboundEndpoint endpoint)
                              throws Exception
Deprecated. 
Throws:
Exception

getTestSession

public static MuleSession getTestSession(Service service,
                                         MuleContext context)
Deprecated. 

getTestConnector

public static TestConnector getTestConnector()
                                      throws Exception
Deprecated. 
Throws:
Exception

getTestService

public static Service getTestService()
                              throws Exception
Deprecated. 
Throws:
Exception

getTestService

public static Service getTestService(String name,
                                     Class<?> clazz)
                              throws Exception
Deprecated. 
Throws:
Exception

getTestService

public static Service getTestService(String name,
                                     Class<?> clazz,
                                     Map<?,?> props)
                              throws Exception
Deprecated. 
Throws:
Exception

isStartContext

protected boolean isStartContext()
Deprecated. 

setStartContext

protected void setStartContext(boolean startContext)
Deprecated. 

setFailOnTimeout

public void setFailOnTimeout(boolean failOnTimeout)
Deprecated. 

isGracefulShutdown

protected boolean isGracefulShutdown()
Deprecated. 
Determines if the test case should perform graceful shutdown or not. Default is false so that tests run more quickly.


createObject

protected <T> T createObject(Class<T> clazz)
                  throws Exception
Deprecated. 
Create an object of instance clazz. It will then register the object with the registry so that any dependencies are injected and then the object will be initialised. Note that if the object needs to be configured with additional state that cannot be passed into the constructor you should create an instance first set any additional data on the object then call initialiseObject(Object).

Type Parameters:
T - Object of this type will be returned
Parameters:
clazz - the class to create an instance of.
Returns:
an initialised instance of class
Throws:
Exception - if there is a problem creating or initializing the object

createObject

protected <T> T createObject(Class<T> clazz,
                             Object... args)
                  throws Exception
Deprecated. 
Create an object of instance clazz. It will then register the object with the registry so that any dependencies are injected and then the object will be initialised. Note that if the object needs to be configured with additional state that cannot be passed into the constructor you should create an instance first set any additional data on the object then call initialiseObject(Object).

Type Parameters:
T - Object of this type will be returned
Parameters:
clazz - the class to create an instance of.
args - constructor parameters
Returns:
an initialised instance of class
Throws:
Exception - if there is a problem creating or initializing the object

initialiseObject

protected void initialiseObject(Object o)
                         throws RegistrationException
Deprecated. 
A convenience method that will register an object in the registry using its hashcode as the key. This will cause the object to have any objects injected and lifecycle methods called. Note that the object lifecycle will be called to the same current lifecycle as the MuleContext

Parameters:
o - the object to register and initialize it
Throws:
RegistrationException

getSensingNullMessageProcessor

public SensingNullMessageProcessor getSensingNullMessageProcessor()
Deprecated. 

getTriggerableMessageSource

public TriggerableMessageSource getTriggerableMessageSource(MessageProcessor listener)
Deprecated. 

getTriggerableMessageSource

public TriggerableMessageSource getTriggerableMessageSource()
Deprecated. 

getPorts

public List<Integer> getPorts()
Deprecated. 


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.