Search in sources :

Example 31 with ArtifactPluginDescriptor

use of org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor in project mule by mulesoft.

the class BundlePluginDependenciesResolverTestCase method resolvesTransitiveDependencies.

@Test
public void resolvesTransitiveDependencies() throws Exception {
    final List<ArtifactPluginDescriptor> pluginDescriptors = createPluginDescriptors(fooPlugin, barPlugin, bazPlugin);
    barPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().dependingOn(singleton(BAZ_PLUGIN_DESCRIPTOR)).build());
    bazPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().dependingOn(singleton(FOO_PLUGIN_DESCRIPTOR)).build());
    final List<ArtifactPluginDescriptor> resolvedPluginDescriptors = dependenciesResolver.resolve(emptySet(), pluginDescriptors);
    assertResolvedPlugins(resolvedPluginDescriptors, fooPlugin, bazPlugin, barPlugin);
}
Also used : ArtifactPluginDescriptor(org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor) ClassLoaderModelBuilder(org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder) Test(org.junit.Test)

Example 32 with ArtifactPluginDescriptor

use of org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor in project mule by mulesoft.

the class BundlePluginDependenciesResolverTestCase method resolvesPluginDependencyWithSnapshotMinorVersion.

@Test
public void resolvesPluginDependencyWithSnapshotMinorVersion() throws Exception {
    ArtifactPluginDescriptor updatedFooPlugin = new ArtifactPluginDescriptor(FOO_PLUGIN);
    updatedFooPlugin.setBundleDescriptor(createTestBundleDescriptor(FOO_PLUGIN, "1.1-SNAPSHOT"));
    final List<ArtifactPluginDescriptor> pluginDescriptors = createPluginDescriptors(updatedFooPlugin, barPlugin);
    barPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().dependingOn(singleton(createBundleDependency(FOO_BUNDLE_DESCRIPTOR))).build());
    final List<ArtifactPluginDescriptor> resolvedPluginDescriptors = dependenciesResolver.resolve(emptySet(), pluginDescriptors);
    assertResolvedPlugins(resolvedPluginDescriptors, updatedFooPlugin, barPlugin);
}
Also used : ArtifactPluginDescriptor(org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor) ClassLoaderModelBuilder(org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder) Test(org.junit.Test)

Example 33 with ArtifactPluginDescriptor

use of org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor in project mule by mulesoft.

the class BundlePluginDependenciesResolverTestCase method doesNotResolvesPluginDependencyWithIncompatibleMinorVersion.

@Test(expected = PluginResolutionError.class)
public void doesNotResolvesPluginDependencyWithIncompatibleMinorVersion() throws Exception {
    ArtifactPluginDescriptor majorUpdatedFooPlugin = new ArtifactPluginDescriptor(FOO_PLUGIN);
    majorUpdatedFooPlugin.setBundleDescriptor(createTestBundleDescriptor(FOO_PLUGIN, "1.1"));
    final List<ArtifactPluginDescriptor> pluginDescriptors = createPluginDescriptors(fooPlugin, barPlugin);
    barPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().dependingOn(singleton(createBundleDependency(majorUpdatedFooPlugin.getBundleDescriptor()))).build());
    dependenciesResolver.resolve(emptySet(), pluginDescriptors);
}
Also used : ArtifactPluginDescriptor(org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor) ClassLoaderModelBuilder(org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder) Test(org.junit.Test)

Example 34 with ArtifactPluginDescriptor

use of org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor in project mule by mulesoft.

the class BundlePluginDependenciesResolverTestCase method doesNotResolvesPluginDependencyWithIncompatibleMajorVersion.

@Test(expected = PluginResolutionError.class)
public void doesNotResolvesPluginDependencyWithIncompatibleMajorVersion() throws Exception {
    ArtifactPluginDescriptor majorUpdatedFooPlugin = new ArtifactPluginDescriptor(FOO_PLUGIN);
    majorUpdatedFooPlugin.setBundleDescriptor(createTestBundleDescriptor(FOO_PLUGIN, "2.0"));
    final List<ArtifactPluginDescriptor> pluginDescriptors = createPluginDescriptors(majorUpdatedFooPlugin, barPlugin);
    barPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().dependingOn(singleton(createBundleDependency(FOO_BUNDLE_DESCRIPTOR))).build());
    dependenciesResolver.resolve(emptySet(), pluginDescriptors);
}
Also used : ArtifactPluginDescriptor(org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor) ClassLoaderModelBuilder(org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder) Test(org.junit.Test)

Example 35 with ArtifactPluginDescriptor

use of org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor in project mule by mulesoft.

the class ToolingArtifactClassLoaderTestCase method createsClassLoaderMultiplePlugin.

@Test
public void createsClassLoaderMultiplePlugin() throws Exception {
    TestToolingPluginClassLoader anotherPluginClassLoader = new TestToolingPluginClassLoader(new ArtifactPluginDescriptor("test-another-plugin-descriptor"));
    regionClassLoader.addClassLoader(anotherPluginClassLoader, mock(ArtifactClassLoaderFilter.class));
    regionClassLoader.addClassLoader(pluginArtifactClassLoader, mock(ArtifactClassLoaderFilter.class));
    ToolingArtifactClassLoader toolingArtifactClassLoader = new ToolingArtifactClassLoader(regionClassLoader, pluginArtifactClassLoader);
    assertThat(regionClassLoader.getArtifactPluginClassLoaders().size(), is(2));
    assertThat(pluginArtifactClassLoader.disposed, is(false));
    assertThat(anotherPluginClassLoader.disposed, is(false));
    toolingArtifactClassLoader.dispose();
    assertThat(pluginArtifactClassLoader.disposed, is(true));
    assertThat(anotherPluginClassLoader.disposed, is(true));
}
Also used : ArtifactPluginDescriptor(org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor) ArtifactClassLoaderFilter(org.mule.runtime.module.artifact.api.classloader.ArtifactClassLoaderFilter) Test(org.junit.Test)

Aggregations

ArtifactPluginDescriptor (org.mule.runtime.deployment.model.api.plugin.ArtifactPluginDescriptor)42 Test (org.junit.Test)24 ClassLoaderModelBuilder (org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder)15 ArtifactClassLoader (org.mule.runtime.module.artifact.api.classloader.ArtifactClassLoader)11 File (java.io.File)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 LookupStrategy (org.mule.runtime.module.artifact.api.classloader.LookupStrategy)6 BundleDependency (org.mule.runtime.module.artifact.api.descriptor.BundleDependency)6 ClassLoaderLookupPolicy (org.mule.runtime.module.artifact.api.classloader.ClassLoaderLookupPolicy)5 HashSet (java.util.HashSet)4 LinkedList (java.util.LinkedList)4 List (java.util.List)4 Optional (java.util.Optional)4 Domain (org.mule.runtime.deployment.model.api.domain.Domain)4 DomainDescriptor (org.mule.runtime.deployment.model.api.domain.DomainDescriptor)4 ArtifactPlugin (org.mule.runtime.deployment.model.api.plugin.ArtifactPlugin)4 ArtifactClassLoaderFilter (org.mule.runtime.module.artifact.api.classloader.ArtifactClassLoaderFilter)4 Map (java.util.Map)3 Set (java.util.Set)3