Package org.sonar.updatecenter.common

Examples of org.sonar.updatecenter.common.Plugin


    assertThat(files[0].getName()).isEqualTo("sonar-php.jar");
  }

  @Test
  public void download_from_url() throws Exception {
    Plugin test = new Plugin("test");
    Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/test-1.0.jar");
    test.addRelease(test10);

    when(updateCenter.findInstallablePlugins("foo", Version.create("1.0"))).thenReturn(newArrayList(test10));

    pluginDownloader.start();
    pluginDownloader.download("foo", Version.create("1.0"));
View Full Code Here


  /**
   * SONAR-4685
   */
  @Test
  public void download_from_redirect_url() throws Exception {
    Plugin test = new Plugin("plugin-test");
    Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/redirect?r=release&g=test&a=test&v=1.0&e=jar");
    test.addRelease(test10);

    when(updateCenter.findInstallablePlugins("foo", Version.create("1.0"))).thenReturn(newArrayList(test10));

    pluginDownloader.start();
    pluginDownloader.download("foo", Version.create("1.0"));
View Full Code Here

    }
  }

  @Test
  public void download_from_file() throws Exception {
    Plugin test = new Plugin("test");
    File file = testFolder.newFile("test-1.0.jar");
    file.createNewFile();
    Release test10 = new Release(test, "1.0").setDownloadUrl("file://" + FilenameUtils.separatorsToUnix(file.getCanonicalPath()));
    test.addRelease(test10);

    when(updateCenter.findInstallablePlugins("foo", Version.create("1.0"))).thenReturn(newArrayList(test10));

    pluginDownloader.start();
    pluginDownloader.download("foo", Version.create("1.0"));
View Full Code Here

    assertThat(pluginDownloader.hasDownloads()).isTrue();
  }

  @Test
  public void throw_exception_if_could_not_download() throws Exception {
    Plugin test = new Plugin("test");
    Release test10 = new Release(test, "1.0").setDownloadUrl("file://not_found");
    test.addRelease(test10);

    when(updateCenter.findInstallablePlugins("foo", Version.create("1.0"))).thenReturn(newArrayList(test10));

    pluginDownloader.start();
    try {
View Full Code Here

    }
  }

  @Test
  public void throw_exception_if_download_fail() throws Exception {
    Plugin test = new Plugin("test");
    Release test10 = new Release(test, "1.0").setDownloadUrl("http://server/test-1.0.jar");
    test.addRelease(test10);
    when(updateCenter.findInstallablePlugins("foo", Version.create("1.0"))).thenReturn(newArrayList(test10));

    doThrow(new RuntimeException()).when(httpDownloader).download(any(URI.class), any(File.class));

    pluginDownloader.start();
View Full Code Here

  }

  // SONAR-5011
  @Test
  public void download_common_transitive_dependency() throws Exception {
    Plugin test1 = new Plugin("test1");
    Release test1R = new Release(test1, "1.0").setDownloadUrl("http://server/test1-1.0.jar");
    test1.addRelease(test1R);

    Plugin test2 = new Plugin("test2");
    Release test2R = new Release(test2, "1.0").setDownloadUrl("http://server/test2-1.0.jar");
    test2.addRelease(test2R);

    Plugin testDep = new Plugin("testdep");
    Release testDepR = new Release(testDep, "1.0").setDownloadUrl("http://server/testdep-1.0.jar");
    testDep.addRelease(testDepR);

    when(updateCenter.findInstallablePlugins("test1", Version.create("1.0"))).thenReturn(newArrayList(test1R, testDepR));
    when(updateCenter.findInstallablePlugins("test2", Version.create("1.0"))).thenReturn(newArrayList(test2R, testDepR));

    pluginDownloader.start();
View Full Code Here

TOP

Related Classes of org.sonar.updatecenter.common.Plugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.