public abstract class ArtifactFunctionalTestCase extends FunctionalTestCase
FunctionalTestCase with class loader isolation using ArtifactClassLoaderRunner, a JUnit
Runner. ArtifactClassLoaderRunner classifies the classpath provided by
IDE/surfire-maven-plugin generates an equivalent ClassLoader hierarchy as standalone mode.
The classification is based on the maven dependencies declared by the pom maven artifact that the test belongs to. In order to
classify the URLs from the classpath it will use a dependency tree that holds also duplicates relationship for
the dependency graph.
The classification for ClassLoaders would be based on dependencies scope, provided will go to the container, compile to
plugin and test to the application. For more information about the classification process see ClassPathClassifier.
For plugins it will scan the plugin set of URLs to search for classes annotated with
org.mule.runtime.extension.api.annotation.Extension, if a class is annotated it will generate the metadata for the
extension in runtime and it will also register it to the ExtensionManager. Non
extension plugins will set its filter based on mule-module.properties file.
By default this test runs internally with a BlockJUnit4ClassRunner runner. On those cases where the
test has to be run with another runner the RunnerDelegateTo should be used to define it.
PluginClassLoadersAware will define that this class also needs to get access to plugin ArtifactClassLoader in
order to load extension classes (they are not exposed to the application) for registering them to the
ExtensionManager.
Due to the cost of reading the classpath, scanning the dependencies and classes to generate the ClassLoader is high,
this runner will hold an static reference to the ClassLoader created for the first test and will use the same during
the whole execution of the tests that are marked with the RunWith ArtifactClassLoaderRunner, so be aware that
static initializations or things related to this could be an issue and tests should be aware of this.| Modifier and Type | Class and Description |
|---|---|
protected static class |
ArtifactFunctionalTestCase.TestClassLoaderRepository
Defines a
ClassLoaderRepository with all the class loaders configured in the ArtifactFunctionalTestCase
class. |
| Modifier and Type | Field and Description |
|---|---|
static String |
MULE_SPRING_CONFIG_FILE |
static String |
SPRING_CONFIG_FILES_PROPERTIES |
muleDisableAsyncRetryPolicyOnSourcesProperty, registryBLOCK_TIMEOUT, componentLocator, IGNORED_DOT_MULE_DIRS, LOCK_TIMEOUT, muleContext, NON_GRACEFUL_SHUTDOWN_TIMEOUT, RECEIVE_TIMEOUT, TEST_MESSAGE, testServicesConfigurationBuilder, testServicesConfigurationBuilderSupplier, WORKING_DIRECTORY_SYSTEM_PROPERTY_KEY, workingDirectorychain, DEFAULT_TEST_TIMEOUT_SECS, name, TEST_CONNECTOR, TEST_CONNECTOR_LOCATION, TEST_PAYLOAD, TEST_TIMEOUT_SYSTEM_PROPERTY| Constructor and Description |
|---|
ArtifactFunctionalTestCase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addBuilders(List<org.mule.runtime.core.api.config.ConfigurationBuilder> builders)
Adds a
ConfigurationBuilder that sets the ExtensionManager into the
AbstractMuleContextTestCase.muleContext. |
void |
clearRequestContext() |
static void |
configureClassLoaderRepository() |
protected void |
configureSpringXmlConfigurationBuilder(org.mule.runtime.core.api.config.ConfigurationBuilder builder) |
protected org.mule.runtime.core.api.config.ConfigurationBuilder |
getBuilder() |
protected ClassLoader |
getExecutionClassLoader() |
protected org.mule.runtime.api.serialization.ObjectSerializer |
getObjectSerializer() |
protected <T extends org.mule.runtime.api.service.Service> |
getService(Class<T> serviceClass)
Returns an instance of a given service if available
|
protected boolean |
mustRegenerateExtensionModels()
Subclasses can override this method so that extension models used are regenerated before running its tests.
|
artifactProperties, clearFlowAssertions, disableXmlValidations, doTearDown, enableLazyInit, flowRunner, getConfigFile, getConfigFiles, getConfigResources, getFlowConstruct, loadResource, loadResourceAsString, runFlow, stopFlowConstructawaitLatch, configureMuleContext, createMuleContext, createMuleContext, disposeContext, disposeContextPerTest, disposeOnlyMuleContext, doSetUp, doSetUpBeforeMuleContextCreation, doTearDownAfterMuleContextDispose, doTestClassInjection, getAppleFlowComponentLocationAnnotations, getConfigurationResources, getDeploymentProperties, getEventBuilder, getFileInsideWorkingDirectory, getFlowComponentLocationAnnotations, getPayload, getPayload, getPayloadAsBytes, getPayloadAsString, getSensingNullMessageProcessor, getStartUpRegistryObjects, getTriggerableMessageSource, getWorkingDirectory, isDisposeContextPerClass, isGracefulShutdown, isStartContext, mockExprExecutorService, mockHttpService, process, recordSchedulersOnInit, setDisposeContextPerClass, setStartContext, setUpMuleContext, sleepFor, verifyAndStopSchedulersaddMockComponentLocation, clearTestCaseName, clearTestEvents, collectThreadNames, createTestTimeoutRule, dumpFilteredThreadsInTest, getFeatureFlaggingService, getMavenProjectVersionProperty, getTestHeader, getTestTimeoutSecs, getTimeoutSystemProperty, initializeMuleTest, isDisabledInThisEnvironment, isDisabledInThisEnvironment, isFailOnTimeout, isOffline, newEvent, nullPayloadEvent, takeTestCaseName, testEventpublic static final String SPRING_CONFIG_FILES_PROPERTIES
public static final String MULE_SPRING_CONFIG_FILE
public static void configureClassLoaderRepository()
public final void clearRequestContext()
clearRequestContext in class AbstractMuleTestCaseprotected org.mule.runtime.api.serialization.ObjectSerializer getObjectSerializer()
getObjectSerializer in class AbstractMuleContextTestCaseprotected ClassLoader getExecutionClassLoader()
getExecutionClassLoader in class FunctionalTestCaseClassLoader created by the runner.protected org.mule.runtime.core.api.config.ConfigurationBuilder getBuilder()
throws Exception
getBuilder in class FunctionalTestCaseExceptionprotected <T extends org.mule.runtime.api.service.Service> T getService(Class<T> serviceClass)
T - service classserviceClass - class of service to look for. Non null.protected void configureSpringXmlConfigurationBuilder(org.mule.runtime.core.api.config.ConfigurationBuilder builder)
protected void addBuilders(List<org.mule.runtime.core.api.config.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 AbstractMuleContextTestCasebuilders - the list of ConfigurationBuilders that will be used to initialise the AbstractMuleContextTestCase.muleContextprotected boolean mustRegenerateExtensionModels()
Copyright © 2003–2021 MuleSoft, Inc.. All rights reserved.