@Test public void resolutionFailsIfPluginNotDeclared() throws Exception { expectedException.expect(MuleRuntimeException.class); expectedException.expectMessage("plugin not present"); createAdditionalPluginDependenciesResolver(of(DECLARED_POM_PLUGIN)).resolveDependencies(emptyList(), emptyList()); }
public Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> applicationDependencies, Collection<ClassLoaderModel> mulePluginsClassLoaderModels) { addPluginDependenciesAdditionalLibraries(applicationDependencies); Map<BundleDependency, List<BundleDependency>> pluginsWithAdditionalDeps = new LinkedHashMap<>(); for (Plugin pluginWithAdditionalDependencies : pluginsWithAdditionalDependencies) { BundleDependency pluginBundleDependency = getPluginBundleDependency(pluginWithAdditionalDependencies, applicationDependencies); ClassLoaderModel pluginClassLoaderModel = getPluginClassLoaderModel(pluginWithAdditionalDependencies, mulePluginsClassLoaderModels); List<BundleDependency> additionalDependencies = resolveDependencies(pluginWithAdditionalDependencies.getAdditionalDependencies().stream() .filter(additionalDep -> !isPresentInClassLoaderModel(pluginClassLoaderModel, additionalDep)) .collect(toList())); if (!additionalDependencies.isEmpty()) { pluginsWithAdditionalDeps.put(pluginBundleDependency, additionalDependencies); } } return pluginsWithAdditionalDeps; }
AdditionalPluginDependenciesResolver { public Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> applicationDependencies, Collection<ClassLoaderModel> mulePluginsClassLoaderModels) { addPluginDependenciesAdditionalLibraries(applicationDependencies); Map<BundleDependency, List<BundleDependency>> pluginsWithAdditionalDeps = new LinkedHashMap<>(); for (Plugin pluginWithAdditionalDependencies : pluginsWithAdditionalDependencies) { BundleDependency pluginBundleDependency = getPluginBundleDependency(pluginWithAdditionalDependencies, applicationDependencies); ClassLoaderModel pluginClassLoaderModel = getPluginClassLoaderModel(pluginWithAdditionalDependencies, mulePluginsClassLoaderModels); List<BundleDependency> additionalDependencies = resolveDependencies(pluginWithAdditionalDependencies.getAdditionalDependencies().stream() .filter(additionalDep -> !isPresentInClassLoaderModel(pluginClassLoaderModel, additionalDep)) .collect(toList())); if (!additionalDependencies.isEmpty()) { pluginsWithAdditionalDeps.put(pluginBundleDependency, additionalDependencies); } } return pluginsWithAdditionalDeps; } }
AdditionalPluginDependenciesResolver { public Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> applicationDependencies, Collection<ClassLoaderModel> mulePluginsClassLoaderModels) { addPluginDependenciesAdditionalLibraries(applicationDependencies); Map<BundleDependency, List<BundleDependency>> pluginsWithAdditionalDeps = new LinkedHashMap<>(); for (Plugin pluginWithAdditionalDependencies : pluginsWithAdditionalDependencies) { BundleDependency pluginBundleDependency = getPluginBundleDependency(pluginWithAdditionalDependencies, applicationDependencies); ClassLoaderModel pluginClassLoaderModel = getPluginClassLoaderModel(pluginWithAdditionalDependencies, mulePluginsClassLoaderModels); List<BundleDependency> additionalDependencies = resolveDependencies(pluginWithAdditionalDependencies.getAdditionalDependencies().stream() .filter(additionalDep -> !isPresentInClassLoaderModel(pluginClassLoaderModel, additionalDep)) .collect(toList())); if (!additionalDependencies.isEmpty()) { pluginsWithAdditionalDeps.put(pluginBundleDependency, additionalDependencies); } } return pluginsWithAdditionalDeps; } AdditionalPluginDependenciesResolver(AetherMavenClient muleMavenPluginClient,
                                              List<Plugin> additionalPluginDependencies,
                                              File temporaryFolder); }
AdditionalPluginDependenciesResolver { public Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> applicationDependencies, Collection<ClassLoaderModel> mulePluginsClassLoaderModels) { addPluginDependenciesAdditionalLibraries(applicationDependencies); Map<BundleDependency, List<BundleDependency>> pluginsWithAdditionalDeps = new LinkedHashMap<>(); for (Plugin pluginWithAdditionalDependencies : pluginsWithAdditionalDependencies) { BundleDependency pluginBundleDependency = getPluginBundleDependency(pluginWithAdditionalDependencies, applicationDependencies); ClassLoaderModel pluginClassLoaderModel = getPluginClassLoaderModel(pluginWithAdditionalDependencies, mulePluginsClassLoaderModels); List<BundleDependency> additionalDependencies = resolveDependencies(pluginWithAdditionalDependencies.getAdditionalDependencies().stream() .filter(additionalDep -> !isPresentInClassLoaderModel(pluginClassLoaderModel, additionalDep)) .collect(toList())); if (!additionalDependencies.isEmpty()) { pluginsWithAdditionalDeps.put(pluginBundleDependency, additionalDependencies); } } return pluginsWithAdditionalDeps; } AdditionalPluginDependenciesResolver(AetherMavenClient muleMavenPluginClient,
                                              List<Plugin> additionalPluginDependencies,
                                              File temporaryFolder); Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> applicationDependencies,
                                                                           Collection<ClassLoaderModel> mulePluginsClassLoaderModels); }
AdditionalPluginDependenciesResolver { public Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> applicationDependencies, Collection<ClassLoaderModel> mulePluginsClassLoaderModels) { addPluginDependenciesAdditionalLibraries(applicationDependencies); Map<BundleDependency, List<BundleDependency>> pluginsWithAdditionalDeps = new LinkedHashMap<>(); for (Plugin pluginWithAdditionalDependencies : pluginsWithAdditionalDependencies) { BundleDependency pluginBundleDependency = getPluginBundleDependency(pluginWithAdditionalDependencies, applicationDependencies); ClassLoaderModel pluginClassLoaderModel = getPluginClassLoaderModel(pluginWithAdditionalDependencies, mulePluginsClassLoaderModels); List<BundleDependency> additionalDependencies = resolveDependencies(pluginWithAdditionalDependencies.getAdditionalDependencies().stream() .filter(additionalDep -> !isPresentInClassLoaderModel(pluginClassLoaderModel, additionalDep)) .collect(toList())); if (!additionalDependencies.isEmpty()) { pluginsWithAdditionalDeps.put(pluginBundleDependency, additionalDependencies); } } return pluginsWithAdditionalDeps; } AdditionalPluginDependenciesResolver(AetherMavenClient muleMavenPluginClient,
                                              List<Plugin> additionalPluginDependencies,
                                              File temporaryFolder); Map<BundleDependency, List<BundleDependency>> resolveDependencies(List<BundleDependency> applicationDependencies,
                                                                           Collection<ClassLoaderModel> mulePluginsClassLoaderModels);  }