use of org.mule.runtime.module.artifact.api.descriptor.BundleDescriptor in project mule by mulesoft.
the class BundlePluginDependenciesResolverTestCase method resolvesSnapshotPluginDependencyWithCompatibleMinorVersion.
@Test
public void resolvesSnapshotPluginDependencyWithCompatibleMinorVersion() throws Exception {
ArtifactPluginDescriptor updatedFooPlugin = new ArtifactPluginDescriptor(FOO_PLUGIN);
updatedFooPlugin.setBundleDescriptor(createTestBundleDescriptor(FOO_PLUGIN, "1.1"));
final List<ArtifactPluginDescriptor> pluginDescriptors = createPluginDescriptors(updatedFooPlugin, barPlugin);
BundleDescriptor fooBundleDescriptor = createTestBundleDescriptor(FOO_PLUGIN, "1.0-SNAPSHOT");
barPlugin.setClassLoaderModel(new ClassLoaderModelBuilder().dependingOn(singleton(createBundleDependency(fooBundleDescriptor))).build());
final List<ArtifactPluginDescriptor> resolvedPluginDescriptors = dependenciesResolver.resolve(emptySet(), pluginDescriptors);
assertResolvedPlugins(resolvedPluginDescriptors, updatedFooPlugin, barPlugin);
}
use of org.mule.runtime.module.artifact.api.descriptor.BundleDescriptor in project mule by mulesoft.
the class DefaultApplicationFactoryTestCase method createClassLoaderModelWithDomain.
private ClassLoaderModel createClassLoaderModelWithDomain() {
BundleDescriptor domainDescriptor = new BundleDescriptor.Builder().setArtifactId(DOMAIN_NAME).setGroupId("test").setVersion("1.0.0").setClassifier(MULE_DOMAIN_CLASSIFIER).build();
Set<BundleDependency> domainDependency = Collections.singleton(new BundleDependency.Builder().setDescriptor(domainDescriptor).build());
return new ClassLoaderModel.ClassLoaderModelBuilder().dependingOn(domainDependency).build();
}
use of org.mule.runtime.module.artifact.api.descriptor.BundleDescriptor in project mule by mulesoft.
the class RepositorySystemTestCase method noExistentResource.
@Test
public void noExistentResource() throws Exception {
executeTestWithDefaultRemoteRepo(() -> {
RepositoryService defaultRepositoryService = new RepositoryServiceFactory().createRepositoryService();
BundleDescriptor bundleDescriptor = new BundleDescriptor.Builder().setGroupId("no").setArtifactId("existent").setVersion("bundle").build();
expectedException.expect(BundleNotFoundException.class);
defaultRepositoryService.lookupBundle(new BundleDependency.Builder().setDescriptor(bundleDescriptor).build());
});
}
use of org.mule.runtime.module.artifact.api.descriptor.BundleDescriptor in project mule by mulesoft.
the class BundlePluginDependenciesResolver method resolvePluginsDependencies.
private List<ArtifactPluginDescriptor> resolvePluginsDependencies(List<ArtifactPluginDescriptor> descriptors) {
Set<BundleDescriptor> knownPlugins = descriptors.stream().map(ArtifactPluginDescriptor::getBundleDescriptor).collect(toSet());
descriptors = getArtifactsWithDependencies(descriptors, knownPlugins);
List<ArtifactPluginDescriptor> sortedDescriptors = new ArrayList<>(descriptors);
sortedDescriptors.sort((d1, d2) -> (d1.getName().compareTo(d2.getName())));
List<ArtifactPluginDescriptor> resolvedPlugins = new LinkedList<>();
List<ArtifactPluginDescriptor> unresolvedPlugins = new LinkedList<>(sortedDescriptors);
boolean continueResolution = true;
while (continueResolution) {
int initialResolvedCount = resolvedPlugins.size();
List<ArtifactPluginDescriptor> pendingUnresolvedPlugins = new LinkedList<>();
for (ArtifactPluginDescriptor unresolvedPlugin : unresolvedPlugins) {
if (isResolvedPlugin(unresolvedPlugin, resolvedPlugins)) {
sanitizeExportedPackages(unresolvedPlugin, resolvedPlugins);
resolvedPlugins.add(unresolvedPlugin);
} else {
pendingUnresolvedPlugins.add(unresolvedPlugin);
}
}
// Will try to resolve the plugins that are still unresolved
unresolvedPlugins = pendingUnresolvedPlugins;
continueResolution = resolvedPlugins.size() > initialResolvedCount;
}
if (unresolvedPlugins.size() != 0) {
throw new PluginResolutionError(createResolutionErrorMessage(unresolvedPlugins, resolvedPlugins));
}
return resolvedPlugins;
}
Aggregations