public abstract class AbstractMuleTestCase extends Object
AbstractMuleTestCase is a base class for Mule test cases. This implementation provides services to test code for
creating mock and test objects.| Modifier and Type | Field and Description |
|---|---|
org.junit.rules.TestRule |
chain |
static int |
DEFAULT_TEST_TIMEOUT_SECS |
org.junit.rules.TestName |
name |
static String |
TEST_CONNECTOR |
static org.mule.runtime.api.component.location.ComponentLocation |
TEST_CONNECTOR_LOCATION |
static String |
TEST_PAYLOAD |
static String |
TEST_TIMEOUT_SYSTEM_PROPERTY |
static String |
TESTING_MODE_PROPERTY_NAME |
| Constructor and Description |
|---|
AbstractMuleTestCase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addMockComponentLocation(org.mule.runtime.api.component.Component component)
Utility method to add a mock component location.
|
void |
clearRequestContext() |
static void |
clearTestCaseName() |
void |
clearTestEvents() |
protected static List<String> |
collectThreadNames() |
protected org.junit.rules.TestRule |
createTestTimeoutRule()
Creates the timeout rule that will be used to run the test.
|
static void |
dumpFilteredThreadsInTest() |
protected <B extends CoreEvent.Builder> |
getEventBuilder()
Allows subclasses to provide a builder configured in a different way
|
protected static String |
getMavenProjectVersionProperty()
Could be useful to use it in place of hardcoding the pom project version in the tests.
|
protected String |
getTestHeader() |
int |
getTestTimeoutSecs()
Defines the timeout in seconds that will be used to run the test.
|
protected int |
getTimeoutSystemProperty()
Defines the number of seconds that a test has in order to run before throwing a timeout.
|
void |
initializeMuleTest() |
protected boolean |
isDisabledInThisEnvironment()
Subclasses can override this method to skip the execution of the entire test class.
|
protected boolean |
isDisabledInThisEnvironment(String testMethodName)
Should this test run?
|
protected boolean |
isFailOnTimeout()
Indicates whether the test should fail when a timeout is reached.
|
boolean |
isOffline(String method) |
protected <E extends CoreEvent> |
newEvent()
Create a new
CoreEvent for each invocation. |
protected CoreEvent |
nullPayloadEvent() |
void |
takeTestCaseName() |
protected CoreEvent |
testEvent()
Creates and caches a test
CoreEvent instance for the scope of the current test method. |
public static final String TEST_PAYLOAD
public static final String TEST_CONNECTOR
public static final org.mule.runtime.api.component.location.ComponentLocation TEST_CONNECTOR_LOCATION
public static final String TESTING_MODE_PROPERTY_NAME
public static final int DEFAULT_TEST_TIMEOUT_SECS
public static final String TEST_TIMEOUT_SYSTEM_PROPERTY
public org.junit.rules.TestName name
public final org.junit.rules.TestRule chain
protected org.junit.rules.TestRule createTestTimeoutRule()
protected int getTimeoutSystemProperty()
DEFAULT_MULE_TEST_TIMEOUT_SECS constant.protected boolean isDisabledInThisEnvironment()
true if the test class should not be run.protected boolean isDisabledInThisEnvironment(String testMethodName)
testMethodName - name of the test methodpublic boolean isOffline(String method)
public int getTestTimeoutSecs()
protected static String getMavenProjectVersionProperty()
public final void initializeMuleTest()
protected String getTestHeader()
protected boolean isFailOnTimeout()
public void clearRequestContext()
public static void clearTestCaseName()
public void takeTestCaseName()
protected CoreEvent testEvent() throws org.mule.runtime.api.exception.MuleException
CoreEvent instance for the scope of the current test method.org.mule.runtime.api.exception.MuleExceptionprotected <E extends CoreEvent> E newEvent() throws org.mule.runtime.api.exception.MuleException
CoreEvent for each invocation. Useful if multiple distinct event instances are needed in a single test
method.org.mule.runtime.api.exception.MuleExceptionprotected <B extends CoreEvent.Builder> B getEventBuilder() throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleExceptionprotected CoreEvent nullPayloadEvent() throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleExceptionpublic void clearTestEvents()
throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleExceptionpublic static void dumpFilteredThreadsInTest()
protected void addMockComponentLocation(org.mule.runtime.api.component.Component component)
component - object to add the location.Copyright © 2003–2024 MuleSoft, Inc.. All rights reserved.