public abstract class ExtensionsFunctionalTestCase extends FunctionalTestCase
FunctionalTestCase
s
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.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
Describer s 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, runFlowWithPayloadAndExpect, runSchedulersOnce, stopFlowConstruct, stopFlowSchedulers, testFlow, testFlow, testFlowNonBlocking, testFlowNonBlocking
configureMuleContext, 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, setUpMuleContext
clearExcludedFlag, clearRequestContext, clearTestCaseName, createTestTimeoutRule, dumpFilteredThreadsInTest, getTestHeader, getTestTimeoutSecs, getTimeoutSystemProperty, initializeMuleTest, isDisabledInThisEnvironment, isDisabledInThisEnvironment, isExcluded, isFailOnTimeout, isOffline, isTestIncludedInExclusionFile, takeTestCaseName
protected void doSetUpBeforeMuleContextCreation() throws Exception
createExtensionsManager()
doSetUpBeforeMuleContextCreation
in class org.mule.tck.junit4.AbstractMuleContextTestCase
Exception
- in case of any failureprotected org.mule.extension.introspection.declaration.Describer[] getDescribers()
Describer
s 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 null
protected 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 null
protected 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
List
addBuilders
in class org.mule.tck.junit4.AbstractMuleContextTestCase
builders
- the list of ConfigurationBuilder
s that will be used to initialise the AbstractMuleContextTestCase.muleContext
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.