Search in sources :

Example 16 with Plugin

use of org.sonar.updatecenter.common.Plugin in project sonarqube by SonarSource.

the class PluginDownloaderTest method download_from_file.

@Test
public void download_from_file() throws Exception {
    Plugin test = Plugin.factory("test");
    File file = testFolder.newFile("test-1.0.jar");
    file.createNewFile();
    Release test10 = new Release(test, "1.0").setDownloadUrl("file://" + separatorsToUnix(file.getCanonicalPath()));
    test.addRelease(test10);
    when(updateCenter.findInstallablePlugins("foo", create("1.0"))).thenReturn(newArrayList(test10));
    pluginDownloader.start();
    pluginDownloader.download("foo", create("1.0"));
    verify(httpDownloader, never()).download(any(URI.class), any(File.class));
    assertThat(pluginDownloader.hasDownloads()).isTrue();
}
Also used : File(java.io.File) URI(java.net.URI) Release(org.sonar.updatecenter.common.Release) Plugin(org.sonar.updatecenter.common.Plugin) Test(org.junit.Test)

Aggregations

Plugin (org.sonar.updatecenter.common.Plugin)16 Release (org.sonar.updatecenter.common.Release)9 Test (org.junit.Test)7 File (java.io.File)5 URI (java.net.URI)4 SonarException (org.sonar.api.utils.SonarException)2 ArrayList (java.util.ArrayList)1 JsonWriter (org.sonar.api.utils.text.JsonWriter)1 PluginInfo (org.sonar.core.platform.PluginInfo)1 PluginUpdate (org.sonar.updatecenter.common.PluginUpdate)1 Sonar (org.sonar.updatecenter.common.Sonar)1 SonarUpdate (org.sonar.updatecenter.common.SonarUpdate)1 UpdateCenter (org.sonar.updatecenter.common.UpdateCenter)1