use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder in project mule by mulesoft.
the class BundlePluginDependenciesResolverTestCase method detectsUnresolvablePluginDependency.
@Test
public void detectsUnresolvablePluginDependency() throws Exception {
final List<ArtifactPluginDescriptor> pluginDescriptors = createPluginDescriptors(fooPlugin);
fooPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().dependingOn(singleton(BAR_PLUGIN_DESCRIPTOR)).build());
expectedException.expect(PluginResolutionError.class);
expectedException.expectMessage(format(DEPENDENCY_PROVIDER_ERROR_MESSAGE, BAR_BUNDLE_DESCRIPTOR));
dependenciesResolver.resolve(emptySet(), pluginDescriptors);
}
use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder in project mule by mulesoft.
the class BundlePluginDependenciesResolverTestCase method detectsDuplicateExportedPackagesOnIndependentPlugins.
@Test
public void detectsDuplicateExportedPackagesOnIndependentPlugins() throws Exception {
fooPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().exportingPackages(getFooExportedPackages()).build());
barPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().exportingPackages(getBarExportedPackages()).build());
final List<ArtifactPluginDescriptor> pluginDescriptors = createPluginDescriptors(fooPlugin, barPlugin);
Map<String, List<String>> pluginsPerPackage = new HashMap<>();
pluginsPerPackage.put("org.foo", asList("bar, foo"));
pluginsPerPackage.put("org.foo.mule", asList("bar, foo"));
String expectedErrorMessage = new DuplicateExportedPackageException(pluginsPerPackage).getMessage();
this.expectedException.expect(DuplicateExportedPackageException.class);
this.expectedException.expectMessage(expectedErrorMessage);
dependenciesResolver.resolve(emptySet(), pluginDescriptors);
}
use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder 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);
}
use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder 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);
}
use of org.mule.runtime.module.artifact.api.descriptor.ClassLoaderModel.ClassLoaderModelBuilder 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);
}
Aggregations