@Test public void resolveMulePluginsVersions() throws URISyntaxException { BundleDependency mulePluginToResolveOlder = buildBundleDependency(1, 1, MULE_PLUGIN_CLASSIFIER, "1.0.0"); BundleDependency mulePluginToResolveNewer = buildBundleDependency(1, 1, MULE_PLUGIN_CLASSIFIER, "1.0.1"); BundleDependency anotherRandomMulePlugin = buildBundleDependency(0, 0, MULE_PLUGIN_CLASSIFIER, "1.0.0"); List<BundleDependency> mulePluginsToResolve = new ArrayList<>(); mulePluginsToResolve.add(mulePluginToResolveNewer); mulePluginsToResolve.add(anotherRandomMulePlugin); List<BundleDependency> definitiveMulePlugins = new ArrayList<>(); definitiveMulePlugins.add(mulePluginToResolveOlder); List<BundleDependency> resolvedPlugins = resolver.resolveConflicts(mulePluginsToResolve, definitiveMulePlugins); assertThat("List should contain only the older version", resolvedPlugins, containsInAnyOrder(mulePluginToResolveOlder, anotherRandomMulePlugin)); assertThat("List should contain only one dependency", resolvedPlugins.size(), equalTo(2)); }
protected List<BundleDependency> resolveMulePluginsVersions(List<BundleDependency> mulePluginsToResolve, List<BundleDependency> definitiveMulePlugins) { List<BundleDependency> resolvedPlugins = new ArrayList<>(); checkArgument(mulePluginsToResolve != null, "List of mule plugins to resolve should not be null"); checkArgument(definitiveMulePlugins != null, "List of definitive mule plugins should not be null"); for (BundleDependency mulePluginToResolve : mulePluginsToResolve) { Optional<BundleDependency> mulePlugin = definitiveMulePlugins.stream().filter(p -> hasSameArtifactIdAndMajor(p, mulePluginToResolve)).findFirst(); resolvedPlugins.add(mulePlugin.orElse(mulePluginToResolve)); } return resolvedPlugins; }
MulePluginClassloaderModelResolver extends ClassloaderModelResolver { protected List<BundleDependency> resolveMulePluginsVersions(List<BundleDependency> mulePluginsToResolve, List<BundleDependency> definitiveMulePlugins) { List<BundleDependency> resolvedPlugins = new ArrayList<>(); checkArgument(mulePluginsToResolve != null, "List of mule plugins to resolve should not be null"); checkArgument(definitiveMulePlugins != null, "List of definitive mule plugins should not be null"); for (BundleDependency mulePluginToResolve : mulePluginsToResolve) { Optional<BundleDependency> mulePlugin = definitiveMulePlugins.stream().filter(p -> hasSameArtifactIdAndMajor(p, mulePluginToResolve)).findFirst(); resolvedPlugins.add(mulePlugin.orElse(mulePluginToResolve)); } return resolvedPlugins; } }
MulePluginClassloaderModelResolver extends ClassloaderModelResolver { protected List<BundleDependency> resolveMulePluginsVersions(List<BundleDependency> mulePluginsToResolve, List<BundleDependency> definitiveMulePlugins) { List<BundleDependency> resolvedPlugins = new ArrayList<>(); checkArgument(mulePluginsToResolve != null, "List of mule plugins to resolve should not be null"); checkArgument(definitiveMulePlugins != null, "List of definitive mule plugins should not be null"); for (BundleDependency mulePluginToResolve : mulePluginsToResolve) { Optional<BundleDependency> mulePlugin = definitiveMulePlugins.stream().filter(p -> hasSameArtifactIdAndMajor(p, mulePluginToResolve)).findFirst(); resolvedPlugins.add(mulePlugin.orElse(mulePluginToResolve)); } return resolvedPlugins; } MulePluginClassloaderModelResolver(AetherMavenClient muleMavenPluginClient); }
MulePluginClassloaderModelResolver extends ClassloaderModelResolver { protected List<BundleDependency> resolveMulePluginsVersions(List<BundleDependency> mulePluginsToResolve, List<BundleDependency> definitiveMulePlugins) { List<BundleDependency> resolvedPlugins = new ArrayList<>(); checkArgument(mulePluginsToResolve != null, "List of mule plugins to resolve should not be null"); checkArgument(definitiveMulePlugins != null, "List of definitive mule plugins should not be null"); for (BundleDependency mulePluginToResolve : mulePluginsToResolve) { Optional<BundleDependency> mulePlugin = definitiveMulePlugins.stream().filter(p -> hasSameArtifactIdAndMajor(p, mulePluginToResolve)).findFirst(); resolvedPlugins.add(mulePlugin.orElse(mulePluginToResolve)); } return resolvedPlugins; } MulePluginClassloaderModelResolver(AetherMavenClient muleMavenPluginClient); @Override Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> mulePlugins); }
MulePluginClassloaderModelResolver extends ClassloaderModelResolver { protected List<BundleDependency> resolveMulePluginsVersions(List<BundleDependency> mulePluginsToResolve, List<BundleDependency> definitiveMulePlugins) { List<BundleDependency> resolvedPlugins = new ArrayList<>(); checkArgument(mulePluginsToResolve != null, "List of mule plugins to resolve should not be null"); checkArgument(definitiveMulePlugins != null, "List of definitive mule plugins should not be null"); for (BundleDependency mulePluginToResolve : mulePluginsToResolve) { Optional<BundleDependency> mulePlugin = definitiveMulePlugins.stream().filter(p -> hasSameArtifactIdAndMajor(p, mulePluginToResolve)).findFirst(); resolvedPlugins.add(mulePlugin.orElse(mulePluginToResolve)); } return resolvedPlugins; } MulePluginClassloaderModelResolver(AetherMavenClient muleMavenPluginClient); @Override Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> mulePlugins);  }