Search in sources :

Example 6 with MuleCoreExtension

use of org.mule.runtime.container.api.MuleCoreExtension in project mule by mulesoft.

the class ReflectionMuleCoreExtensionDependencyResolverTestCase method resolvesDisorderedCoreExtensionAwareExtensions.

@Test
public void resolvesDisorderedCoreExtensionAwareExtensions() throws Exception {
    MuleCoreExtension coreExtensionsAwareExtension1 = mockCoreExtension(EXTENSION1);
    MuleCoreExtension coreExtensionsAwareExtension2 = mockCoreExtension(EXTENSION2);
    List<MuleCoreExtension> coreExtensions = new LinkedList<>();
    coreExtensions.add(coreExtensionsAwareExtension2);
    coreExtensions.add(coreExtensionsAwareExtension1);
    final List<MuleCoreExtension> resolvedCoreExtensions = dependencyResolver.resolveDependencies(coreExtensions);
    assertThat(resolvedCoreExtensions.size(), equalTo(2));
    assertThat(resolvedCoreExtensions.get(0), sameInstance(coreExtensionsAwareExtension1));
    assertThat(resolvedCoreExtensions.get(1), sameInstance(coreExtensionsAwareExtension2));
}
Also used : MuleCoreExtension(org.mule.runtime.container.api.MuleCoreExtension) LinkedList(java.util.LinkedList) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 7 with MuleCoreExtension

use of org.mule.runtime.container.api.MuleCoreExtension in project mule by mulesoft.

the class ReflectionMuleCoreExtensionDependencyResolverTestCase method resolvesStandardAndCoreExtensionAwareExtensions.

@Test
public void resolvesStandardAndCoreExtensionAwareExtensions() throws Exception {
    MuleCoreExtension coreExtensionsAwareExtension = mockCoreExtension("coreExtensionsAwareExtension");
    MuleCoreExtension testCoreExtension = new TestCoreExtension();
    List<MuleCoreExtension> coreExtensions = new LinkedList<>();
    coreExtensions.add(coreExtensionsAwareExtension);
    coreExtensions.add(testCoreExtension);
    final List<MuleCoreExtension> resolvedCoreExtensions = dependencyResolver.resolveDependencies(coreExtensions);
    assertThat(resolvedCoreExtensions.size(), equalTo(2));
    assertThat(resolvedCoreExtensions.get(0), sameInstance(testCoreExtension));
    assertThat(resolvedCoreExtensions.get(1), sameInstance(coreExtensionsAwareExtension));
}
Also used : MuleCoreExtension(org.mule.runtime.container.api.MuleCoreExtension) LinkedList(java.util.LinkedList) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 8 with MuleCoreExtension

use of org.mule.runtime.container.api.MuleCoreExtension in project mule by mulesoft.

the class ReflectionMuleCoreExtensionDependencyResolverTestCase method resolvesCoreExtensionAwareAndStandardExtensions.

@Test
public void resolvesCoreExtensionAwareAndStandardExtensions() throws Exception {
    MuleCoreExtension coreExtensionsAwareExtension = mockCoreExtension(EXTENSION1);
    MuleCoreExtension testCoreExtension = new TestCoreExtension();
    List<MuleCoreExtension> coreExtensions = new LinkedList<>();
    coreExtensions.add(testCoreExtension);
    coreExtensions.add(coreExtensionsAwareExtension);
    final List<MuleCoreExtension> resolvedCoreExtensions = dependencyResolver.resolveDependencies(coreExtensions);
    assertThat(resolvedCoreExtensions.size(), equalTo(2));
    assertThat(resolvedCoreExtensions.get(0), sameInstance(testCoreExtension));
    assertThat(resolvedCoreExtensions.get(1), sameInstance(coreExtensionsAwareExtension));
}
Also used : MuleCoreExtension(org.mule.runtime.container.api.MuleCoreExtension) LinkedList(java.util.LinkedList) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 9 with MuleCoreExtension

use of org.mule.runtime.container.api.MuleCoreExtension in project mule by mulesoft.

the class ReflectionMuleCoreExtensionDependencyResolverTestCase method mockCoreExtension.

private MuleCoreExtension mockCoreExtension(String extension11) {
    MuleCoreExtension extension1 = mock(CoreExtensionsAwareExtension.class);
    when(extension1.getName()).thenReturn(extension11);
    return extension1;
}
Also used : MuleCoreExtension(org.mule.runtime.container.api.MuleCoreExtension)

Example 10 with MuleCoreExtension

use of org.mule.runtime.container.api.MuleCoreExtension in project mule by mulesoft.

the class DefaultMuleCoreExtensionManagerServer method start.

@Override
public void start() throws MuleException {
    LOGGER.info("Starting core extensions");
    for (MuleCoreExtension extension : orderedCoreExtensions) {
        extension.start();
        startedCoreExtensions.add(extension);
        LOGGER.info("Core extension '{}' started", extension.toString());
    }
}
Also used : MuleCoreExtension(org.mule.runtime.container.api.MuleCoreExtension)

Aggregations

MuleCoreExtension (org.mule.runtime.container.api.MuleCoreExtension)23 LinkedList (java.util.LinkedList)17 Test (org.junit.Test)15 SmallTest (org.mule.tck.size.SmallTest)14 InOrder (org.mockito.InOrder)5 MuleException (org.mule.runtime.api.exception.MuleException)4 URL (java.net.URL)2 ExpectedException (org.junit.rules.ExpectedException)2 DefaultMuleException (org.mule.runtime.api.exception.DefaultMuleException)2 Map (java.util.Map)1 Properties (java.util.Properties)1 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)1 ServiceRepository (org.mule.runtime.api.service.ServiceRepository)1 ArtifactClassLoaderManagerAware (org.mule.runtime.container.api.ArtifactClassLoaderManagerAware)1 CoreExtensionsAware (org.mule.runtime.container.api.CoreExtensionsAware)1 Injector (org.mule.runtime.core.api.Injector)1 ClassUtils.withContextClassLoader (org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader)1 PropertiesUtils.loadProperties (org.mule.runtime.core.api.util.PropertiesUtils.loadProperties)1 ArtifactClassLoader (org.mule.runtime.module.artifact.api.classloader.ArtifactClassLoader)1 ArtifactDeploymentListener (org.mule.runtime.module.deployment.api.ArtifactDeploymentListener)1