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);
}
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));
}
Aggregations