use of org.sonar.core.platform.RemotePlugin in project sonarqube by SonarSource.
the class ScannerPluginInstaller method loadPlugins.
private Map<String, PluginInfo> loadPlugins(List<RemotePlugin> remotePlugins) {
Map<String, PluginInfo> infosByKey = new HashMap<>(remotePlugins.size());
Profiler profiler = Profiler.create(LOG).startDebug("Load plugins");
for (RemotePlugin remotePlugin : remotePlugins) {
if (pluginPredicate.apply(remotePlugin.getKey())) {
File jarFile = download(remotePlugin);
PluginInfo info = PluginInfo.create(jarFile);
infosByKey.put(info.getKey(), info);
}
}
profiler.stopDebug();
return infosByKey;
}
use of org.sonar.core.platform.RemotePlugin in project sonarqube by SonarSource.
the class ScannerPluginInstallerTest method listRemotePlugins.
@Test
public void listRemotePlugins() {
WsTestUtil.mockReader(wsClient, "/deploy/plugins/index.txt", new StringReader("checkstyle\nsqale"));
ScannerPluginInstaller underTest = new ScannerPluginInstaller(wsClient, fileCache, pluginPredicate);
List<RemotePlugin> remotePlugins = underTest.listRemotePlugins();
assertThat(remotePlugins).extracting("key").containsOnly("checkstyle", "sqale");
}
use of org.sonar.core.platform.RemotePlugin in project sonarqube by SonarSource.
the class ScannerPluginInstallerTest method should_download_plugin.
@Test
public void should_download_plugin() throws Exception {
File pluginJar = temp.newFile();
when(fileCache.get(eq("checkstyle-plugin.jar"), eq("fakemd5_1"), any(FileCache.Downloader.class))).thenReturn(pluginJar);
ScannerPluginInstaller underTest = new ScannerPluginInstaller(wsClient, fileCache, pluginPredicate);
RemotePlugin remote = new RemotePlugin("checkstyle").setFile("checkstyle-plugin.jar", "fakemd5_1");
File file = underTest.download(remote);
assertThat(file).isEqualTo(pluginJar);
}
Aggregations