Search in sources :

Example 1 with CompositeArtifactExtensionManager

use of org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager in project mule by mulesoft.

the class CompositeArtifactExtensionManagerFactory method create.

@Override
public ExtensionManager create(MuleContext muleContext) {
    ExtensionManager parentExtensionManager = parentArtifact.getRegistry().<ExtensionManager>lookupByName(OBJECT_EXTENSION_MANAGER).get();
    ExtensionManager extensionManager = super.create(muleContext, parentExtensionManager.getExtensions());
    return new CompositeArtifactExtensionManager(parentExtensionManager, extensionManager);
}
Also used : CompositeArtifactExtensionManager(org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager) ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) CompositeArtifactExtensionManager(org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager)

Example 2 with CompositeArtifactExtensionManager

use of org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager in project mule by mulesoft.

the class CompositeArtifactExtensionManagerFactoryTestCase method createsCompositeExtensionManager.

@Test
public void createsCompositeExtensionManager() throws Exception {
    Application application = mock(Application.class, RETURNS_DEEP_STUBS);
    ExtensionManager applicationExtensionManager = mock(ExtensionManager.class);
    when(application.getRegistry().lookupByName(MuleProperties.OBJECT_EXTENSION_MANAGER)).thenReturn(of(applicationExtensionManager));
    ExtensionModelLoaderRepository extensionModelLoaderRepository = mock(ExtensionModelLoaderRepository.class);
    ExtensionManagerFactory extensionManagerFactory = mock(ExtensionManagerFactory.class);
    CompositeArtifactExtensionManagerFactory factory = new CompositeArtifactExtensionManagerFactory(application, extensionModelLoaderRepository, emptyList(), extensionManagerFactory);
    ExtensionManager policyExtensionManager = mock(ExtensionManager.class);
    MuleContext muleContext = mock(MuleContext.class);
    when(extensionManagerFactory.create(muleContext)).thenReturn(policyExtensionManager);
    ExtensionManager extensionManager = factory.create(muleContext);
    assertThat(extensionManager, instanceOf(CompositeArtifactExtensionManager.class));
    CompositeArtifactExtensionManager compositeArtifactExtensionManager = (CompositeArtifactExtensionManager) extensionManager;
    assertThat(compositeArtifactExtensionManager.getParentExtensionManager(), equalTo(applicationExtensionManager));
    assertThat(compositeArtifactExtensionManager.getChildExtensionManager(), equalTo(policyExtensionManager));
}
Also used : MuleContext(org.mule.runtime.core.api.MuleContext) CompositeArtifactExtensionManager(org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager) ExtensionModelLoaderRepository(org.mule.runtime.module.extension.internal.loader.ExtensionModelLoaderRepository) ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) CompositeArtifactExtensionManager(org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager) ExtensionManagerFactory(org.mule.runtime.module.extension.api.manager.ExtensionManagerFactory) Application(org.mule.runtime.deployment.model.api.application.Application) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

ExtensionManager (org.mule.runtime.core.api.extension.ExtensionManager)2 CompositeArtifactExtensionManager (org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager)2 Test (org.junit.Test)1 MuleContext (org.mule.runtime.core.api.MuleContext)1 Application (org.mule.runtime.deployment.model.api.application.Application)1 ExtensionManagerFactory (org.mule.runtime.module.extension.api.manager.ExtensionManagerFactory)1 ExtensionModelLoaderRepository (org.mule.runtime.module.extension.internal.loader.ExtensionModelLoaderRepository)1 SmallTest (org.mule.tck.size.SmallTest)1