public abstract class ExtensionsFunctionalTestCase extends FunctionalTestCase
FunctionalTestCases
that make use of components generated through the extensions API.
The value added by this class in comparison to a traditional
FunctionalTestCase is that before creating
the MuleContext, it creates a ExtensionManager
and automatically discovers extensions by delegating on
ExtensionManager.discoverExtensions(ClassLoader).
By default, standard extension discovery will be
performed by invoking ExtensionManager.discoverExtensions(ClassLoader).
Although this behavior suits most use cases, it can be time consuming because of
all the classpath scanning and the overhead of initialising extensions that
are most likely not used in this tests. As the number of extensions available grows,
the problem gets worst. For those cases, you can override the getDescribers()
and specify which describers are to be used to initialise the extensions manager. In that way,
extensions discovery is skipped and you only initialise what you need.
Once extensions are discovered and described,
a ResourcesGenerator is used to automatically
generate any backing resources needed (for example, XSD schemas, spring bundles,
service registration files, etc).
In this way, the user experience is greatly simplified when running the test
either through an IDE or build tool such as maven or gradle.
Since this class extends FunctionalTestCase, a new MuleContext
is created per each test. That also means that a new ExtensionManager
is created per test.callbackCalled, CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, IGNORED_DOT_MULE_DIRS, LOCK_TIMEOUT, muleContext, RECEIVE_TIMEOUT, TEST_MESSAGE, TEST_PAYLOAD, WORKING_DIRECTORY_SYSTEM_PROPERTY_KEY, workingDirectoryDEFAULT_TEST_TIMEOUT_SECS, globalTimeout, name, TEST_TIMEOUT_SYSTEM_PROPERTY, TESTING_MODE_PROPERTY_NAME| Constructor and Description |
|---|
ExtensionsFunctionalTestCase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addBuilders(List<ConfigurationBuilder> builders)
Adds a
ConfigurationBuilder that sets the extensionManager
into the AbstractMuleContextTestCase.muleContext. |
protected void |
doSetUpBeforeMuleContextCreation()
Performs all the logic inherited from the super class, plus invokes
createExtensionsManager() |
protected Class<?>[] |
getAnnotatedExtensionClasses()
Implement this method to limit the amount of extensions
initialised by providing the annotated classes which define
the extensions that you actually want to use for this test.
|
protected org.mule.extension.introspection.declaration.Describer[] |
getDescribers()
Implement this method to limit the amount of extensions
initialised by providing the
Describers for
the extensions that you actually want to use for this test. |
clearFlowAssertions, getBuilder, getComponent, getComponent, getConfigFile, getConfigFiles, getConfigResources, getFlowConstruct, getFunctionalTestComponent, getSubFlow, loadResource, loadResourceAsString, lookupFlowConstruct, runFlow, runFlow, runFlow, runFlowAndExpect, runFlowAndExpectProperty, runFlowNonBlocking, runFlowNonBlocking, runFlowNonBlocking, runFlowNonBlocking, runFlowWithPayloadAndExpect, runSchedulersOnce, stopFlowConstruct, stopFlowSchedulers, testFlow, testFlow, testFlow, testFlowNonBlocking, testFlowNonBlocking, testFlowNonBlockingconfigureMuleContext, createMuleContext, createObject, createObject, disposeContext, disposeContextPerTest, doSetUp, doTearDown, doTearDownAfterMuleContextDispose, getConfigurationResources, getFileInsideWorkingDirectory, getNonBlockingResponse, getNonBlockingTestEventUsingFlow, getSensingNullMessageProcessor, getStartUpProperties, getTestConnector, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEventContext, getTestEventContext, getTestEventUsingFlow, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestMuleMessage, getTestMuleMessage, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestService, getTestService, getTestService, getTestSession, getTestTransactedInboundEndpoint, getTestTransformer, getTriggerableMessageSource, getTriggerableMessageSource, getWorkingDirectory, initialiseObject, isDisposeContextPerClass, isGracefulShutdown, isStartContext, setDisposeContextPerClass, setStartContext, setUpMuleContextclearExcludedFlag, clearRequestContext, clearTestCaseName, createTestTimeoutRule, dumpFilteredThreadsInTest, getTestHeader, getTestTimeoutSecs, getTimeoutSystemProperty, initializeMuleTest, isDisabledInThisEnvironment, isDisabledInThisEnvironment, isExcluded, isFailOnTimeout, isOffline, isTestIncludedInExclusionFile, takeTestCaseNameprotected void doSetUpBeforeMuleContextCreation()
throws Exception
createExtensionsManager()doSetUpBeforeMuleContextCreation in class org.mule.tck.junit4.AbstractMuleContextTestCaseException - in case of any failureprotected org.mule.extension.introspection.declaration.Describer[] getDescribers()
Describers for
the extensions that you actually want to use for this test.
Returning a null or empty array will cause the
getAnnotatedExtensionClasses() method to be considered.
Default implementation of this method returns nullprotected Class<?>[] getAnnotatedExtensionClasses()
null or empty array forces the
ExtensionManager to perform a full classpath discovery.
Default implementation of this method returns null.
This method will only be considered if getDescribers()
returns nullprotected final void addBuilders(List<ConfigurationBuilder> builders)
ConfigurationBuilder that sets the extensionManager
into the AbstractMuleContextTestCase.muleContext. This ConfigurationBuilder is set
as the first element of the builders ListaddBuilders in class org.mule.tck.junit4.AbstractMuleContextTestCasebuilders - the list of ConfigurationBuilders that will be used to initialise the AbstractMuleContextTestCase.muleContextCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.