use of com.buschmais.jqassistant.commandline.plugin.PluginResolverFactory in project jqa-commandline-tool by jQAssistant.
the class CliPluginResolverIT method resolve.
@Test
void resolve() {
Map<String, String> configurationProperties = new HashMap<>();
configurationProperties.put("jqassistant.plugins[0].group-id", "org.jqassistant.contrib.plugin");
configurationProperties.put("jqassistant.plugins[0].artifact-id", "jqassistant-docker-plugin");
configurationProperties.put("jqassistant.plugins[0].version", "1.11.0");
PropertiesConfigSource testConfigSource = new PropertiesConfigSource(configurationProperties, "TestConfigSource", 110);
ConfigurationLoaderImpl configurationLoader = new ConfigurationLoaderImpl(new File("src/test/resources"));
CliConfiguration cliConfiguration = configurationLoader.load(CliConfiguration.class, testConfigSource);
PluginResolverFactory pluginResolverFactory = new PluginResolverFactory();
PluginResolver pluginResolver = pluginResolverFactory.create(cliConfiguration);
PluginClassLoader pluginClassLoader = pluginResolver.createClassLoader(PluginResolverFactory.class.getClassLoader(), cliConfiguration.plugins());
assertThat(pluginClassLoader).isNotNull();
}
use of com.buschmais.jqassistant.commandline.plugin.PluginResolverFactory in project jqa-commandline-tool by jQAssistant.
the class Main method getPluginRepository.
/**
* Initialize the plugin repository.
*
* @param configuration
* The {@link CliConfiguration}
* @return The repository.
* @throws CliExecutionException
* If initialization fails.
*/
private PluginRepository getPluginRepository(CliConfiguration configuration) throws CliExecutionException {
// create classloader for the plugins/ directory.
ClassLoader pluginDirectoryClassLoader = createPluginClassLoader();
PluginResolverFactory pluginResolverFactory = new PluginResolverFactory();
PluginResolver pluginResolver = pluginResolverFactory.create(configuration);
// create plugin classloader using classloader for plugins/ directory as parent, adding plugins to be resolved frol PluginResolver
PluginClassLoader pluginClassLoader = pluginResolver.createClassLoader(pluginDirectoryClassLoader, configuration.plugins());
PluginConfigurationReader pluginConfigurationReader = new PluginConfigurationReaderImpl(pluginClassLoader);
return new PluginRepositoryImpl(pluginConfigurationReader);
}
Aggregations