Package org.sonar.server.platform

Examples of org.sonar.server.platform.DefaultServerFileSystem


    trashDir = new File(homeDir, "extensions/trash");
    bundledDir = new File(homeDir, "lib/bundled-plugins");
    coreDir = new File(homeDir, "lib/core-plugins");
    FileUtils.forceMkdir(bundledDir);

    fileSystem = new DefaultServerFileSystem(homeDir, server);
    jarInstaller = new ServerPluginJarInstaller();
    jarsInstaller = new ServerPluginJarsInstaller(server, upgradeStatus, fileSystem, jarInstaller);
  }
View Full Code Here


  @Rule
  public TemporaryFolder temp = new TemporaryFolder();

  @Test
  public void test_deploy() throws Exception {
    DefaultServerFileSystem fs = mock(DefaultServerFileSystem.class);
    File driver = new File(Resources.getResource(getClass(), "JdbcDriverDeployerTest/deploy/my-driver.jar").toURI());
    Settings settings = new Settings();
    settings.setProperty("sonar.jdbc.driverPath", driver.getAbsolutePath());

    File deployDir = temp.newFolder("deploy");
    when(fs.getDeployDir()).thenReturn(deployDir);
    File deployedIndex = new File(deployDir, "jdbc-driver.txt");
    File deployedFile = new File(deployDir, "my-driver.jar");
    assertThat(deployedIndex).doesNotExist();
    assertThat(deployedFile).doesNotExist();
    when(fs.getDeployedJdbcDriverIndex()).thenReturn(deployedIndex);

    new JdbcDriverDeployer(fs, settings).start();

    assertThat(deployedIndex).exists();
    assertThat(deployedFile).exists();
View Full Code Here

  }

  @Test
  public void create_empty_file_when_no_jdbc_driver() throws Exception {
    Settings settings = new Settings();
    DefaultServerFileSystem fs = mock(DefaultServerFileSystem.class);

    File deployDir = temp.newFolder("deploy");
    when(fs.getDeployDir()).thenReturn(deployDir);
    File deployedIndex = new File(deployDir, "jdbc-driver.txt");
    assertThat(deployedIndex).doesNotExist();
    when(fs.getDeployedJdbcDriverIndex()).thenReturn(deployedIndex);

    new JdbcDriverDeployer(fs, settings).start();

    assertThat(deployedIndex).exists();
    assertThat(Files.toString(deployedIndex, Charsets.UTF_8)).isEqualTo("");
View Full Code Here

        FileUtils.touch(toFile);
        return null;
      }
    }).when(httpDownloader).download(any(URI.class), any(File.class));

    DefaultServerFileSystem defaultServerFileSystem = mock(DefaultServerFileSystem.class);
    downloadDir = testFolder.newFolder("downloads");
    when(defaultServerFileSystem.getDownloadedPluginsDir()).thenReturn(downloadDir);

    pluginDownloader = new PluginDownloader(updateCenterMatrixFactory, httpDownloader, defaultServerFileSystem);
  }
View Full Code Here

    assertThat(new File(downloadDir, "plugin-test-1.0.jar.tmp")).doesNotExist();
  }

  @Test
  public void throw_exception_if_download_dir_is_invalid() throws Exception {
    DefaultServerFileSystem defaultServerFileSystem = mock(DefaultServerFileSystem.class);
    // download dir is a file instead of being a directory
    File downloadDir = testFolder.newFile();
    when(defaultServerFileSystem.getDownloadedPluginsDir()).thenReturn(downloadDir);

    pluginDownloader = new PluginDownloader(updateCenterMatrixFactory, httpDownloader, defaultServerFileSystem);
    try {
      pluginDownloader.start();
      fail();
View Full Code Here

TOP

Related Classes of org.sonar.server.platform.DefaultServerFileSystem

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.