/**
   * Tests closing all FileSystems
   *
   * @throws Exception
   */
  @Ignore("vfs close file system doesn't seem to work properly")
  @Test
  public void testCloseFileSystems() throws Exception {
    logger.info("*************** testCloseFileSystems");
    String[] validUrls = server.getVFSRootURLs();
    ArrayList<FileObject> fos = new ArrayList<FileObject>();
    for (String validUrl : validUrls) {
      FileObject mounted = VFSMountManagerHelper.mount(validUrl);
      Assert.assertTrue(mounted.exists());
      fos.add(mounted);
    }

    VFSMountManagerHelper.closeFileSystems(Arrays.asList(validUrls));

    boolean onlyExceptions = true;
    for (FileObject closedFo : fos) {
      try {
        FileObject toto = closedFo.resolveFile("toto");
        toto.createFile();
        onlyExceptions = false;
        logger.error(toto.getURL() + " exists : " + toto.exists());
      } catch (FileSystemException e) {
        // this should occur
      }
    }
    Assert.assertTrue("Only Exceptions received", onlyExceptions);
  }
 /**
  * Tests mounting only one invalid FileSystem
  *
  * @throws Exception
  */
 @Test(expected = FileSystemException.class)
 public void testMountKo() throws Exception {
   logger.info("*************** testMountKo");
   for (String fakeUrl : fakeUrls) {
     FileObject mounted = VFSMountManagerHelper.mount(fakeUrl);
   }
 }
 /**
  * when only fake uris are provided to mountAny, verify that an exception is received
  *
  * @throws Exception
  */
 @Test(expected = FileSystemException.class)
 public void testMountAnyKo() throws Exception {
   logger.info("*************** testMountAnyKo");
   ArrayList<String> urlsToMount = new ArrayList<String>(fakeFileUrls);
   urlsToMount.addAll(fakeUrls);
   ConcurrentHashMap<String, FileObject> fileSystems = new ConcurrentHashMap<String, FileObject>();
   VFSMountManagerHelper.mountAny(urlsToMount, fileSystems);
 }
 /**
  * Tests mounting only one valid FileSystem
  *
  * @throws Exception
  */
 @Test
 public void testMountOk() throws Exception {
   logger.info("*************** testMountOk");
   String[] validUrls = server.getVFSRootURLs();
   for (String validUrl : validUrls) {
     FileObject mounted = VFSMountManagerHelper.mount(validUrl);
     Assert.assertTrue(mounted.exists());
   }
 }
  @AfterClass
  public static void tearDown() throws ProActiveException {
    server.terminate();

    router.stop();

    VFSMountManagerHelper.terminate();

    if (spacesDir != null && spacesDir.exists()) {
      assertTrue(AbstractIOOperationsBase.deleteRecursively(spacesDir));
      spacesDir = null;
    }
  }
  /**
   * - Insert a valid file vfs root and a valid proactive vfs root in the list of fake uris -
   * verifies that mountAny returns the file system corresponding to the valid uri - do that for all
   * valid uris of the file system server
   *
   * @throws Exception
   */
  @Test
  public void testMountAnyOk() throws Exception {
    logger.info("*************** testMountAnyOk");
    String[] validUris = server.getVFSRootURLs();

    for (String validUrl : validUris) {
      ConcurrentHashMap<String, FileObject> fileSystems =
          new ConcurrentHashMap<String, FileObject>();
      ArrayList<String> uriToMount = new ArrayList<String>(fakeFileUrls);
      uriToMount.add(spacesDir.toURI().toString()); // adds a valid file uri
      uriToMount.addAll(fakeUrls);
      uriToMount.add((int) Math.floor(Math.random() * uriToMount.size()), validUrl);
      VFSMountManagerHelper.mountAny(uriToMount, fileSystems);
      logger.info("Content of map : " + fileSystems.toString());
      Assert.assertTrue("map contains valid Url", fileSystems.containsKey(validUrl));
    }
  }