use of org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptor in project mule by mulesoft.
the class TrackingDeployableArtifactClassLoaderFactoryTestCase method setUp.
@Before
public void setUp() throws Exception {
artifactClassLoaderManager = mock(ArtifactClassLoaderManager.class);
delegateFactory = mock(DeployableArtifactClassLoaderFactory.class);
factory = new TrackingDeployableArtifactClassLoaderFactory<>(artifactClassLoaderManager, delegateFactory);
parent = mock(ArtifactClassLoader.class);
descriptor = new ArtifactDescriptor(ARTIFACT_NAME);
artifactPluginClassLoaders = emptyList();
ClassLoaderLookupPolicy lookupPolicy = mock(ClassLoaderLookupPolicy.class);
classLoader = new MuleArtifactClassLoader(ARTIFACT_NAME, descriptor, new URL[0], getClass().getClassLoader(), lookupPolicy);
when(lookupPolicy.getClassLookupStrategy(any())).thenReturn(PARENT_FIRST);
when(delegateFactory.create(ARTIFACT_ID, parent, descriptor, artifactPluginClassLoaders)).thenReturn(classLoader);
}
use of org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptor in project mule by mulesoft.
the class ContainerClassLoaderFactory method createContainerClassLoader.
/**
* Creates the classLoader to represent the Mule container.
*
* @param parentClassLoader parent classLoader. Can be null.
* @return a non null {@link ArtifactClassLoader} containing container code that can be used as parent classloader for other
* mule artifacts.
*/
public ArtifactClassLoader createContainerClassLoader(final ClassLoader parentClassLoader) {
final List<MuleModule> muleModules = moduleRepository.getModules();
final ClassLoaderLookupPolicy containerLookupPolicy = getContainerClassLoaderLookupPolicy(parentClassLoader, muleModules);
return createArtifactClassLoader(parentClassLoader, muleModules, containerLookupPolicy, new ArtifactDescriptor("mule"));
}
use of org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptor in project mule by mulesoft.
the class MuleSharedDomainClassLoaderTestCase method findResourcesInProvidedUrls.
@Test
public void findResourcesInProvidedUrls() throws Exception {
createDomainFolder(DEFAULT_DOMAIN_NAME);
final File resourceFile = createDomainResource(DEFAULT_DOMAIN_NAME, RESOURCE_FILE_NAME);
final List<URL> urls = Collections.singletonList(resourceFile.toURI().toURL());
MuleSharedDomainClassLoader classLoader = new MuleSharedDomainClassLoader(new ArtifactDescriptor(DEFAULT_DOMAIN_NAME), getClass().getClassLoader(), lookupPolicy, urls, emptyList());
assertThat(classLoader.findResource(RESOURCE_FILE_NAME), notNullValue());
}
use of org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptor in project mule by mulesoft.
the class AbstractToolingClassLoaderTestCase method createAppClassLoader.
@Before
public void createAppClassLoader() {
final ClassLoaderLookupPolicy classLoaderLookupPolicy = mock(ClassLoaderLookupPolicy.class);
// Mandatory to find a resource releaser instance when doing the dispose of a RegionClassLoader
when(classLoaderLookupPolicy.getClassLookupStrategy(anyString())).thenReturn(PARENT_FIRST);
regionClassLoader = new RegionClassLoader(TEST_REGION, new ArtifactDescriptor(REGION_NAME), getClass().getClassLoader(), classLoaderLookupPolicy);
// Loading the additional classloader as the ToolingPluginClassLoaderBuilder does
regionClassLoader.addClassLoader(mock(ArtifactClassLoader.class), mock(ArtifactClassLoaderFilter.class));
artifactPluginDescriptor = new ArtifactPluginDescriptor(PLUGIN_NAME);
pluginArtifactClassLoader = spy(new TestToolingPluginClassLoader(artifactPluginDescriptor));
}
use of org.mule.runtime.module.artifact.api.descriptor.ArtifactDescriptor in project mule by mulesoft.
the class LoggerContextConfigurer method shouldConfigureContext.
public boolean shouldConfigureContext(MuleLoggerContext context) {
if (!context.isApplicationClassloader()) {
return true;
}
ArtifactDescriptor descriptor = context.getArtifactDescriptor();
if (descriptor == null || !descriptor.getDeploymentProperties().isPresent()) {
return true;
}
Properties properties = descriptor.getDeploymentProperties().get();
return !parseBoolean(properties.getProperty(MULE_MUTE_APP_LOGS_DEPLOYMENT_PROPERTY, "false"));
}
Aggregations