@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.Modifier and Type | Class and Description |
---|---|
static class |
AbstractMuleTestCase.TestInfo
Deprecated.
|
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
AbstractMuleTestCase()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
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
|
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, runTest, toString
public static final String[] IGNORED_DOT_MULE_DIRS
.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.public static final String PROPERTY_MULE_TEST_TIMEOUT
public static final int DEFAULT_MULE_TEST_TIMEOUT_SECS
public static final String CLASSNAME_ANNOTATIONS_CONFIG_BUILDER
protected static MuleContext muleContext
protected final transient Log logger
protected int numPorts
public static final String TEST_MESSAGE
public static final long LOCK_TIMEOUT
public static final int RECEIVE_TIMEOUT
protected Latch callbackCalled
protected int testTimeoutSecs
protected void registerTestMethod()
protected void initTestTimeoutSecs()
public void setName(String name)
setName
in class junit.framework.TestCase
protected AbstractMuleTestCase.TestInfo createTestInfo()
protected AbstractMuleTestCase.TestInfo getTestInfo()
public void run(junit.framework.TestResult result)
run
in interface junit.framework.Test
run
in class junit.framework.TestCase
public void runBare() throws Throwable
isDisabledInThisEnvironment
to skip a single test.runBare
in class junit.framework.TestCase
Throwable
protected boolean isDisabledInThisEnvironment()
true
if the test class should not be run.protected boolean isExcluded()
protected boolean isDisabledInThisEnvironment(String testMethodName)
testMethodName
- name of the test methodpublic boolean isOffline(String method)
protected boolean isDisposeManagerPerSuite()
protected void setDisposeManagerPerSuite(boolean val)
public int getTestTimeoutSecs()
protected TestCaseWatchdog createWatchdog()
public void handleTimeout(long timeout, TimeUnit unit)
handleTimeout
in interface TestCaseWatchdogTimeoutHandler
protected void giveTheTestSomeTimeToCleanUpAndThenKillIt(String messageIfNeedToKill)
protected final void setUp() throws Exception
protected void printTestHeader()
protected String getTestHeader()
protected MuleContext createMuleContext() throws Exception
Exception
protected void addBuilders(List<ConfigurationBuilder> builders)
protected void configureMuleContext(MuleContextBuilder contextBuilder)
protected ConfigurationBuilder getBuilder() throws Exception
Exception
protected String getConfigurationResources()
protected Properties getStartUpProperties()
protected void suitePreSetUp() throws Exception
Exception
protected void suitePostTearDown() throws Exception
Exception
protected final void tearDown() throws Exception
tearDown
in class junit.framework.TestCase
Exception
doTearDown()
protected void disposeManager()
protected void doSetUp() throws Exception
setUp()
in normal JUnit test cases. this is called before a test
method has been called.Exception
- if something fails that should halt the testcaseprotected void doTearDown() throws Exception
tearDown()
in normal JUnit test cases. this is called after a test
method has been called.Exception
- if something fails that should halt the testcasepublic static InboundEndpoint getTestInboundEndpoint(String name) throws Exception
Exception
public static OutboundEndpoint getTestOutboundEndpoint(String name) throws Exception
Exception
public static InboundEndpoint getTestInboundEndpoint(MessageExchangePattern mep) throws Exception
Exception
public static InboundEndpoint getTestTransactedInboundEndpoint(MessageExchangePattern mep) throws Exception
Exception
public static InboundEndpoint getTestInboundEndpoint(String name, String uri) throws Exception
Exception
public static OutboundEndpoint getTestOutboundEndpoint(String name, String uri) throws Exception
Exception
public static InboundEndpoint getTestInboundEndpoint(String name, List<Transformer> transformers) throws Exception
Exception
public static OutboundEndpoint getTestOutboundEndpoint(String name, List<Transformer> transformers) throws Exception
Exception
public static InboundEndpoint getTestInboundEndpoint(String name, String uri, List<Transformer> transformers, Filter filter, Map<Object,Object> properties, Connector connector) throws Exception
Exception
public static OutboundEndpoint getTestOutboundEndpoint(String name, String uri, List<Transformer> transformers, Filter filter, Map<Object,Object> properties) throws Exception
Exception
public static InboundEndpoint getTestInboundEndpoint(String name, String uri, List<Transformer> transformers, Filter filter, Map<Object,Object> properties) throws Exception
Exception
public static OutboundEndpoint getTestOutboundEndpoint(String name, String uri, List<Transformer> transformers, Filter filter, Map<Object,Object> properties, Connector connector) throws Exception
Exception
public static MuleEvent getTestEvent(Object data, Service service) throws Exception
Exception
public static MuleEvent getTestEvent(Object data, Service service, MessageExchangePattern mep) throws Exception
Exception
public static MuleEvent getTestEvent(Object data) throws Exception
Exception
public static MuleEvent getTestEventUsingFlow(Object data) throws Exception
Exception
public static MuleEvent getTestEvent(Object data, MessageExchangePattern mep) throws Exception
Exception
public static MuleEvent getTestEvent(Object data, MuleSession session) throws Exception
Exception
public static MuleEventContext getTestEventContext(Object data) throws Exception
Exception
public static MuleEventContext getTestEventContext(Object data, MessageExchangePattern mep) throws Exception
Exception
public static Transformer getTestTransformer() throws Exception
Exception
public static MuleEvent getTestEvent(Object data, InboundEndpoint endpoint) throws Exception
Exception
public static MuleEvent getTestEvent(Object data, Service service, InboundEndpoint endpoint) throws Exception
Exception
public static MuleSession getTestSession(Service service, MuleContext context)
public static TestConnector getTestConnector() throws Exception
Exception
public static Service getTestService() throws Exception
Exception
public static Service getTestService(String name, Class<?> clazz) throws Exception
Exception
public static Service getTestService(String name, Class<?> clazz, Map<?,?> props) throws Exception
Exception
protected boolean isStartContext()
protected void setStartContext(boolean startContext)
public void setFailOnTimeout(boolean failOnTimeout)
protected boolean isGracefulShutdown()
protected <T> T createObject(Class<T> clazz) throws Exception
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)
.T
- Object of this type will be returnedclazz
- the class to create an instance of.class
Exception
- if there is a problem creating or initializing the objectprotected <T> T createObject(Class<T> clazz, Object... args) throws Exception
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)
.T
- Object of this type will be returnedclazz
- the class to create an instance of.args
- constructor parametersclass
Exception
- if there is a problem creating or initializing the objectprotected void initialiseObject(Object o) throws RegistrationException
o
- the object to register and initialize itRegistrationException
public SensingNullMessageProcessor getSensingNullMessageProcessor()
public TriggerableMessageSource getTriggerableMessageSource(MessageProcessor listener)
public TriggerableMessageSource getTriggerableMessageSource()
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.