use of org.sonar.api.utils.HttpDownloader in project sonarqube by SonarSource.
the class PluginDownloaderTest method before.
@Before
public void before() throws Exception {
updateCenterMatrixFactory = mock(UpdateCenterMatrixFactory.class);
updateCenter = mock(UpdateCenter.class);
when(updateCenterMatrixFactory.getUpdateCenter(anyBoolean())).thenReturn(Optional.of(updateCenter));
httpDownloader = mock(HttpDownloader.class);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock inv) throws Throwable {
File toFile = (File) inv.getArguments()[1];
touch(toFile);
return null;
}
}).when(httpDownloader).download(any(URI.class), any(File.class));
ServerFileSystem fs = mock(ServerFileSystem.class);
downloadDir = testFolder.newFolder("downloads");
when(fs.getDownloadedPluginsDir()).thenReturn(downloadDir);
pluginDownloader = new PluginDownloader(updateCenterMatrixFactory, httpDownloader, fs);
}
Aggregations