Java 类org.apache.hadoop.mapred.JobLocalizer 实例源码

项目:hadoop-2.6.0-cdh5.4.3    文件:TestTrackerDistributedCacheManager.java   
/**
   * This is the typical flow for using the DistributedCache classes.
   * 
   * @throws IOException
   * @throws LoginException
   */
  public void testManagerFlow() throws IOException, LoginException {
    if (!canRun()) {
      return;
    }

    // ****** Imitate JobClient code
    // Configures a task/job with both a regular file and a "classpath" file.
    Configuration subConf = new Configuration(conf);
    String userName = getJobOwnerName();
    subConf.set("user.name", userName);
    JobID jobid = new JobID("jt",1);
    DistributedCache.addCacheFile(firstCacheFile.toUri(), subConf);
    DistributedCache.addFileToClassPath(secondCacheFile, subConf, 
                                        FileSystem.get(subConf));

    Map<URI, FileStatus> statCache = new HashMap<URI, FileStatus>();
    TrackerDistributedCacheManager.determineTimestamps(subConf, statCache);
    TrackerDistributedCacheManager.determineCacheVisibilities(subConf, statCache);
    assertEquals(2, statCache.size());
    // ****** End of imitating JobClient code

    Path jobFile = new Path(TEST_ROOT_DIR, "job.xml");
    FileOutputStream os = new FileOutputStream(new File(jobFile.toString()));
    subConf.writeXml(os);
    os.close();

    // ****** Imitate TaskRunner code.
    TrackerDistributedCacheManager manager = 
      new TrackerDistributedCacheManager(conf, taskController);
    TaskDistributedCacheManager handle =
      manager.newTaskDistributedCacheManager(jobid, subConf);
    assertNull(null, DistributedCache.getLocalCacheFiles(subConf));
    File workDir = new File(new Path(TEST_ROOT_DIR, "workdir").toString());
    handle.setupCache(subConf, TaskTracker.getPublicDistributedCacheDir(), 
        TaskTracker.getPrivateDistributedCacheDir(userName));
    JobLocalizer.downloadPrivateCache(subConf);
    // DOESN'T ACTUALLY HAPPEN IN THE TaskRunner (THIS IS A TODO)
//    handle.setupPrivateCache(localDirAllocator, TaskTracker
//        .getPrivateDistributedCacheDir(userName));
//    // ****** End of imitating TaskRunner code

    Path[] localCacheFiles = DistributedCache.getLocalCacheFiles(subConf);
    assertNotNull(null, localCacheFiles);
    assertEquals(2, localCacheFiles.length);
    Path cachedFirstFile = localCacheFiles[0];
    Path cachedSecondFile = localCacheFiles[1];
    assertFileLengthEquals(firstCacheFile, cachedFirstFile);
    assertFalse("Paths should be different.", 
        firstCacheFile.equals(cachedFirstFile));

    assertEquals(1, handle.getClassPaths().size());
    assertEquals(cachedSecondFile.toString(), handle.getClassPaths().get(0));

    checkFilePermissions(localCacheFiles);

    // Cleanup
    handle.release();
    manager.purgeCache();
    assertFalse(pathToFile(cachedFirstFile).exists());
  }
项目:hadoop-2.6.0-cdh5.4.3    文件:TestTrackerDistributedCacheManager.java   
private void checkLocalizedPath(boolean visibility) 
throws IOException, LoginException, InterruptedException, URISyntaxException {
  TrackerDistributedCacheManager manager = 
    new TrackerDistributedCacheManager(conf, taskController);
  String userName = getJobOwnerName();
  File workDir = new File(TEST_ROOT_DIR, "workdir");
  Path cacheFile = new Path(TEST_ROOT_DIR, "fourthcachefile");
  if (visibility) {
    createPublicTempFile(cacheFile);
  } else {
    createPrivateTempFile(cacheFile);
  }

  Configuration conf1 = new Configuration(conf);
  conf1.set("user.name", userName);
  DistributedCache.addCacheFile(cacheFile.toUri(), conf1);
  TrackerDistributedCacheManager.determineTimestampsAndCacheVisibilities(conf1);
  dumpState(conf1);

  // Task localizing for job
  TaskDistributedCacheManager handle = manager
      .newTaskDistributedCacheManager(new JobID("jt", 1), conf1);
  handle.setupCache(conf1, TaskTracker.getPublicDistributedCacheDir(),
      TaskTracker.getPrivateDistributedCacheDir(userName));
  JobLocalizer.downloadPrivateCache(conf1);
  TaskDistributedCacheManager.CacheFile c = handle.getCacheFiles().get(0);
  String distCacheDir;
  if (visibility) {
    distCacheDir = TaskTracker.getPublicDistributedCacheDir(); 
  } else {
    distCacheDir = TaskTracker.getPrivateDistributedCacheDir(userName);
  }
  Path localizedPath =
    manager.getLocalCache(cacheFile.toUri(), conf1, distCacheDir,
                          fs.getFileStatus(cacheFile), false,
                        c.timestamp, visibility, c);
  assertTrue("Cache file didn't get localized in the expected directory. " +
      "Expected localization to happen within " + 
      ROOT_MAPRED_LOCAL_DIR + "/" + distCacheDir +
      ", but was localized at " + 
      localizedPath, localizedPath.toString().contains(distCacheDir));
  if (visibility) {
    checkPublicFilePermissions(new Path[]{localizedPath});
  } else {
    checkFilePermissions(new Path[]{localizedPath});
  }
}
项目:hadoop-on-lustre    文件:TestTrackerDistributedCacheManager.java   
/**
   * This is the typical flow for using the DistributedCache classes.
   * 
   * @throws IOException
   * @throws LoginException
   */
  public void testManagerFlow() throws IOException, LoginException {
    if (!canRun()) {
      return;
    }

    // ****** Imitate JobClient code
    // Configures a task/job with both a regular file and a "classpath" file.
    Configuration subConf = new Configuration(conf);
    String userName = getJobOwnerName();
    subConf.set("user.name", userName);
    JobID jobid = new JobID("jt",1);
    DistributedCache.addCacheFile(firstCacheFile.toUri(), subConf);
    DistributedCache.addFileToClassPath(secondCacheFile, subConf, 
                                        FileSystem.get(subConf));
    TrackerDistributedCacheManager.determineTimestamps(subConf);
    TrackerDistributedCacheManager.determineCacheVisibilities(subConf);
    // ****** End of imitating JobClient code

    Path jobFile = new Path(TEST_ROOT_DIR, "job.xml");
    FileOutputStream os = new FileOutputStream(new File(jobFile.toString()));
    subConf.writeXml(os);
    os.close();

    // ****** Imitate TaskRunner code.
    TrackerDistributedCacheManager manager = 
      new TrackerDistributedCacheManager(conf, taskController);
    TaskDistributedCacheManager handle =
      manager.newTaskDistributedCacheManager(jobid, subConf);
    assertNull(null, DistributedCache.getLocalCacheFiles(subConf));
    File workDir = new File(new Path(TEST_ROOT_DIR, "workdir").toString());
    handle.setupCache(subConf, TaskTracker.getPublicDistributedCacheDir(), 
        TaskTracker.getPrivateDistributedCacheDir(userName));
    JobLocalizer.downloadPrivateCache(subConf);
    // DOESN'T ACTUALLY HAPPEN IN THE TaskRunner (THIS IS A TODO)
//    handle.setupPrivateCache(localDirAllocator, TaskTracker
//        .getPrivateDistributedCacheDir(userName));
//    // ****** End of imitating TaskRunner code

    Path[] localCacheFiles = DistributedCache.getLocalCacheFiles(subConf);
    assertNotNull(null, localCacheFiles);
    assertEquals(2, localCacheFiles.length);
    Path cachedFirstFile = localCacheFiles[0];
    Path cachedSecondFile = localCacheFiles[1];
    assertFileLengthEquals(firstCacheFile, cachedFirstFile);
    assertFalse("Paths should be different.", 
        firstCacheFile.equals(cachedFirstFile));

    assertEquals(1, handle.getClassPaths().size());
    assertEquals(cachedSecondFile.toString(), handle.getClassPaths().get(0));

    checkFilePermissions(localCacheFiles);

    // Cleanup
    handle.release();
    manager.purgeCache();
    assertFalse(pathToFile(cachedFirstFile).exists());
  }
项目:hadoop-on-lustre    文件:TestTrackerDistributedCacheManager.java   
private void checkLocalizedPath(boolean visibility) 
throws IOException, LoginException, InterruptedException {
  TrackerDistributedCacheManager manager = 
    new TrackerDistributedCacheManager(conf, taskController);
  String userName = getJobOwnerName();
  File workDir = new File(TEST_ROOT_DIR, "workdir");
  Path cacheFile = new Path(TEST_ROOT_DIR, "fourthcachefile");
  if (visibility) {
    createPublicTempFile(cacheFile);
  } else {
    createPrivateTempFile(cacheFile);
  }

  Configuration conf1 = new Configuration(conf);
  conf1.set("user.name", userName);
  DistributedCache.addCacheFile(cacheFile.toUri(), conf1);
  TrackerDistributedCacheManager.determineTimestamps(conf1);
  TrackerDistributedCacheManager.determineCacheVisibilities(conf1);
  dumpState(conf1);

  // Task localizing for job
  TaskDistributedCacheManager handle = manager
      .newTaskDistributedCacheManager(new JobID("jt", 1), conf1);
  handle.setupCache(conf1, TaskTracker.getPublicDistributedCacheDir(),
      TaskTracker.getPrivateDistributedCacheDir(userName));
  JobLocalizer.downloadPrivateCache(conf1);
  TaskDistributedCacheManager.CacheFile c = handle.getCacheFiles().get(0);
  String distCacheDir;
  if (visibility) {
    distCacheDir = TaskTracker.getPublicDistributedCacheDir(); 
  } else {
    distCacheDir = TaskTracker.getPrivateDistributedCacheDir(userName);
  }
  Path localizedPath =
    manager.getLocalCache(cacheFile.toUri(), conf1, distCacheDir,
                          fs.getFileStatus(cacheFile), false,
                        c.timestamp, visibility, c);
  assertTrue("Cache file didn't get localized in the expected directory. " +
      "Expected localization to happen within " + 
      ROOT_MAPRED_LOCAL_DIR + "/" + distCacheDir +
      ", but was localized at " + 
      localizedPath, localizedPath.toString().contains(distCacheDir));
  if (visibility) {
    checkPublicFilePermissions(new Path[]{localizedPath});
  } else {
    checkFilePermissions(new Path[]{localizedPath});
  }
}
项目:hanoi-hadoop-2.0.0-cdh    文件:TestTrackerDistributedCacheManager.java   
/**
   * This is the typical flow for using the DistributedCache classes.
   * 
   * @throws IOException
   * @throws LoginException
   */
  public void testManagerFlow() throws IOException, LoginException {
    if (!canRun()) {
      return;
    }

    // ****** Imitate JobClient code
    // Configures a task/job with both a regular file and a "classpath" file.
    Configuration subConf = new Configuration(conf);
    String userName = getJobOwnerName();
    subConf.set("user.name", userName);
    JobID jobid = new JobID("jt",1);
    DistributedCache.addCacheFile(firstCacheFile.toUri(), subConf);
    DistributedCache.addFileToClassPath(secondCacheFile, subConf, 
                                        FileSystem.get(subConf));

    Map<URI, FileStatus> statCache = new HashMap<URI, FileStatus>();
    TrackerDistributedCacheManager.determineTimestamps(subConf, statCache);
    TrackerDistributedCacheManager.determineCacheVisibilities(subConf, statCache);
    assertEquals(2, statCache.size());
    // ****** End of imitating JobClient code

    Path jobFile = new Path(TEST_ROOT_DIR, "job.xml");
    FileOutputStream os = new FileOutputStream(new File(jobFile.toString()));
    subConf.writeXml(os);
    os.close();

    // ****** Imitate TaskRunner code.
    TrackerDistributedCacheManager manager = 
      new TrackerDistributedCacheManager(conf, taskController);
    TaskDistributedCacheManager handle =
      manager.newTaskDistributedCacheManager(jobid, subConf);
    assertNull(null, DistributedCache.getLocalCacheFiles(subConf));
    File workDir = new File(new Path(TEST_ROOT_DIR, "workdir").toString());
    handle.setupCache(subConf, TaskTracker.getPublicDistributedCacheDir(), 
        TaskTracker.getPrivateDistributedCacheDir(userName));
    JobLocalizer.downloadPrivateCache(subConf);
    // DOESN'T ACTUALLY HAPPEN IN THE TaskRunner (THIS IS A TODO)
//    handle.setupPrivateCache(localDirAllocator, TaskTracker
//        .getPrivateDistributedCacheDir(userName));
//    // ****** End of imitating TaskRunner code

    Path[] localCacheFiles = DistributedCache.getLocalCacheFiles(subConf);
    assertNotNull(null, localCacheFiles);
    assertEquals(2, localCacheFiles.length);
    Path cachedFirstFile = localCacheFiles[0];
    Path cachedSecondFile = localCacheFiles[1];
    assertFileLengthEquals(firstCacheFile, cachedFirstFile);
    assertFalse("Paths should be different.", 
        firstCacheFile.equals(cachedFirstFile));

    assertEquals(1, handle.getClassPaths().size());
    assertEquals(cachedSecondFile.toString(), handle.getClassPaths().get(0));

    checkFilePermissions(localCacheFiles);

    // Cleanup
    handle.release();
    manager.purgeCache();
    assertFalse(pathToFile(cachedFirstFile).exists());
  }
项目:hanoi-hadoop-2.0.0-cdh    文件:TestTrackerDistributedCacheManager.java   
private void checkLocalizedPath(boolean visibility) 
throws IOException, LoginException, InterruptedException, URISyntaxException {
  TrackerDistributedCacheManager manager = 
    new TrackerDistributedCacheManager(conf, taskController);
  String userName = getJobOwnerName();
  File workDir = new File(TEST_ROOT_DIR, "workdir");
  Path cacheFile = new Path(TEST_ROOT_DIR, "fourthcachefile");
  if (visibility) {
    createPublicTempFile(cacheFile);
  } else {
    createPrivateTempFile(cacheFile);
  }

  Configuration conf1 = new Configuration(conf);
  conf1.set("user.name", userName);
  DistributedCache.addCacheFile(cacheFile.toUri(), conf1);
  TrackerDistributedCacheManager.determineTimestampsAndCacheVisibilities(conf1);
  dumpState(conf1);

  // Task localizing for job
  TaskDistributedCacheManager handle = manager
      .newTaskDistributedCacheManager(new JobID("jt", 1), conf1);
  handle.setupCache(conf1, TaskTracker.getPublicDistributedCacheDir(),
      TaskTracker.getPrivateDistributedCacheDir(userName));
  JobLocalizer.downloadPrivateCache(conf1);
  TaskDistributedCacheManager.CacheFile c = handle.getCacheFiles().get(0);
  String distCacheDir;
  if (visibility) {
    distCacheDir = TaskTracker.getPublicDistributedCacheDir(); 
  } else {
    distCacheDir = TaskTracker.getPrivateDistributedCacheDir(userName);
  }
  Path localizedPath =
    manager.getLocalCache(cacheFile.toUri(), conf1, distCacheDir,
                          fs.getFileStatus(cacheFile), false,
                        c.timestamp, visibility, c);
  assertTrue("Cache file didn't get localized in the expected directory. " +
      "Expected localization to happen within " + 
      ROOT_MAPRED_LOCAL_DIR + "/" + distCacheDir +
      ", but was localized at " + 
      localizedPath, localizedPath.toString().contains(distCacheDir));
  if (visibility) {
    checkPublicFilePermissions(new Path[]{localizedPath});
  } else {
    checkFilePermissions(new Path[]{localizedPath});
  }
}
项目:hortonworks-extension    文件:TestTrackerDistributedCacheManager.java   
/**
   * This is the typical flow for using the DistributedCache classes.
   * 
   * @throws IOException
   * @throws LoginException
   */
  public void testManagerFlow() throws IOException, LoginException {
    if (!canRun()) {
      return;
    }

    // ****** Imitate JobClient code
    // Configures a task/job with both a regular file and a "classpath" file.
    Configuration subConf = new Configuration(conf);
    String userName = getJobOwnerName();
    subConf.set("user.name", userName);
    JobID jobid = new JobID("jt",1);
    DistributedCache.addCacheFile(firstCacheFile.toUri(), subConf);
    DistributedCache.addFileToClassPath(secondCacheFile, subConf, 
                                        FileSystem.get(subConf));
    TrackerDistributedCacheManager.determineTimestamps(subConf);
    TrackerDistributedCacheManager.determineCacheVisibilities(subConf);
    // ****** End of imitating JobClient code

    Path jobFile = new Path(TEST_ROOT_DIR, "job.xml");
    FileOutputStream os = new FileOutputStream(new File(jobFile.toString()));
    subConf.writeXml(os);
    os.close();

    // ****** Imitate TaskRunner code.
    TrackerDistributedCacheManager manager = 
      new TrackerDistributedCacheManager(conf, taskController);
    TaskDistributedCacheManager handle =
      manager.newTaskDistributedCacheManager(jobid, subConf);
    assertNull(null, DistributedCache.getLocalCacheFiles(subConf));
    File workDir = new File(new Path(TEST_ROOT_DIR, "workdir").toString());
    handle.setupCache(subConf, TaskTracker.getPublicDistributedCacheDir(), 
        TaskTracker.getPrivateDistributedCacheDir(userName));
    JobLocalizer.downloadPrivateCache(subConf);
    // DOESN'T ACTUALLY HAPPEN IN THE TaskRunner (THIS IS A TODO)
//    handle.setupPrivateCache(localDirAllocator, TaskTracker
//        .getPrivateDistributedCacheDir(userName));
//    // ****** End of imitating TaskRunner code

    Path[] localCacheFiles = DistributedCache.getLocalCacheFiles(subConf);
    assertNotNull(null, localCacheFiles);
    assertEquals(2, localCacheFiles.length);
    Path cachedFirstFile = localCacheFiles[0];
    Path cachedSecondFile = localCacheFiles[1];
    assertFileLengthEquals(firstCacheFile, cachedFirstFile);
    assertFalse("Paths should be different.", 
        firstCacheFile.equals(cachedFirstFile));

    assertEquals(1, handle.getClassPaths().size());
    assertEquals(cachedSecondFile.toString(), handle.getClassPaths().get(0));

    checkFilePermissions(localCacheFiles);

    // Cleanup
    handle.release();
    manager.purgeCache();
    assertFalse(pathToFile(cachedFirstFile).exists());
  }
项目:hortonworks-extension    文件:TestTrackerDistributedCacheManager.java   
private void checkLocalizedPath(boolean visibility) 
throws IOException, LoginException, InterruptedException {
  TrackerDistributedCacheManager manager = 
    new TrackerDistributedCacheManager(conf, taskController);
  String userName = getJobOwnerName();
  File workDir = new File(TEST_ROOT_DIR, "workdir");
  Path cacheFile = new Path(TEST_ROOT_DIR, "fourthcachefile");
  if (visibility) {
    createPublicTempFile(cacheFile);
  } else {
    createPrivateTempFile(cacheFile);
  }

  Configuration conf1 = new Configuration(conf);
  conf1.set("user.name", userName);
  DistributedCache.addCacheFile(cacheFile.toUri(), conf1);
  TrackerDistributedCacheManager.determineTimestamps(conf1);
  TrackerDistributedCacheManager.determineCacheVisibilities(conf1);
  dumpState(conf1);

  // Task localizing for job
  TaskDistributedCacheManager handle = manager
      .newTaskDistributedCacheManager(new JobID("jt", 1), conf1);
  handle.setupCache(conf1, TaskTracker.getPublicDistributedCacheDir(),
      TaskTracker.getPrivateDistributedCacheDir(userName));
  JobLocalizer.downloadPrivateCache(conf1);
  TaskDistributedCacheManager.CacheFile c = handle.getCacheFiles().get(0);
  String distCacheDir;
  if (visibility) {
    distCacheDir = TaskTracker.getPublicDistributedCacheDir(); 
  } else {
    distCacheDir = TaskTracker.getPrivateDistributedCacheDir(userName);
  }
  Path localizedPath =
    manager.getLocalCache(cacheFile.toUri(), conf1, distCacheDir,
                          fs.getFileStatus(cacheFile), false,
                        c.timestamp, visibility, c);
  assertTrue("Cache file didn't get localized in the expected directory. " +
      "Expected localization to happen within " + 
      ROOT_MAPRED_LOCAL_DIR + "/" + distCacheDir +
      ", but was localized at " + 
      localizedPath, localizedPath.toString().contains(distCacheDir));
  if (visibility) {
    checkPublicFilePermissions(new Path[]{localizedPath});
  } else {
    checkFilePermissions(new Path[]{localizedPath});
  }
}
项目:hortonworks-extension    文件:TestTrackerDistributedCacheManager.java   
/**
   * This is the typical flow for using the DistributedCache classes.
   * 
   * @throws IOException
   * @throws LoginException
   */
  public void testManagerFlow() throws IOException, LoginException {
    if (!canRun()) {
      return;
    }

    // ****** Imitate JobClient code
    // Configures a task/job with both a regular file and a "classpath" file.
    Configuration subConf = new Configuration(conf);
    String userName = getJobOwnerName();
    subConf.set("user.name", userName);
    JobID jobid = new JobID("jt",1);
    DistributedCache.addCacheFile(firstCacheFile.toUri(), subConf);
    DistributedCache.addFileToClassPath(secondCacheFile, subConf, 
                                        FileSystem.get(subConf));
    TrackerDistributedCacheManager.determineTimestamps(subConf);
    TrackerDistributedCacheManager.determineCacheVisibilities(subConf);
    // ****** End of imitating JobClient code

    Path jobFile = new Path(TEST_ROOT_DIR, "job.xml");
    FileOutputStream os = new FileOutputStream(new File(jobFile.toString()));
    subConf.writeXml(os);
    os.close();

    // ****** Imitate TaskRunner code.
    TrackerDistributedCacheManager manager = 
      new TrackerDistributedCacheManager(conf, taskController);
    TaskDistributedCacheManager handle =
      manager.newTaskDistributedCacheManager(jobid, subConf);
    assertNull(null, DistributedCache.getLocalCacheFiles(subConf));
    File workDir = new File(new Path(TEST_ROOT_DIR, "workdir").toString());
    handle.setupCache(subConf, TaskTracker.getPublicDistributedCacheDir(), 
        TaskTracker.getPrivateDistributedCacheDir(userName));
    JobLocalizer.downloadPrivateCache(subConf);
    // DOESN'T ACTUALLY HAPPEN IN THE TaskRunner (THIS IS A TODO)
//    handle.setupPrivateCache(localDirAllocator, TaskTracker
//        .getPrivateDistributedCacheDir(userName));
//    // ****** End of imitating TaskRunner code

    Path[] localCacheFiles = DistributedCache.getLocalCacheFiles(subConf);
    assertNotNull(null, localCacheFiles);
    assertEquals(2, localCacheFiles.length);
    Path cachedFirstFile = localCacheFiles[0];
    Path cachedSecondFile = localCacheFiles[1];
    assertFileLengthEquals(firstCacheFile, cachedFirstFile);
    assertFalse("Paths should be different.", 
        firstCacheFile.equals(cachedFirstFile));

    assertEquals(1, handle.getClassPaths().size());
    assertEquals(cachedSecondFile.toString(), handle.getClassPaths().get(0));

    checkFilePermissions(localCacheFiles);

    // Cleanup
    handle.release();
    manager.purgeCache();
    assertFalse(pathToFile(cachedFirstFile).exists());
  }
项目:hortonworks-extension    文件:TestTrackerDistributedCacheManager.java   
private void checkLocalizedPath(boolean visibility) 
throws IOException, LoginException, InterruptedException {
  TrackerDistributedCacheManager manager = 
    new TrackerDistributedCacheManager(conf, taskController);
  String userName = getJobOwnerName();
  File workDir = new File(TEST_ROOT_DIR, "workdir");
  Path cacheFile = new Path(TEST_ROOT_DIR, "fourthcachefile");
  if (visibility) {
    createPublicTempFile(cacheFile);
  } else {
    createPrivateTempFile(cacheFile);
  }

  Configuration conf1 = new Configuration(conf);
  conf1.set("user.name", userName);
  DistributedCache.addCacheFile(cacheFile.toUri(), conf1);
  TrackerDistributedCacheManager.determineTimestamps(conf1);
  TrackerDistributedCacheManager.determineCacheVisibilities(conf1);
  dumpState(conf1);

  // Task localizing for job
  TaskDistributedCacheManager handle = manager
      .newTaskDistributedCacheManager(new JobID("jt", 1), conf1);
  handle.setupCache(conf1, TaskTracker.getPublicDistributedCacheDir(),
      TaskTracker.getPrivateDistributedCacheDir(userName));
  JobLocalizer.downloadPrivateCache(conf1);
  TaskDistributedCacheManager.CacheFile c = handle.getCacheFiles().get(0);
  String distCacheDir;
  if (visibility) {
    distCacheDir = TaskTracker.getPublicDistributedCacheDir(); 
  } else {
    distCacheDir = TaskTracker.getPrivateDistributedCacheDir(userName);
  }
  Path localizedPath =
    manager.getLocalCache(cacheFile.toUri(), conf1, distCacheDir,
                          fs.getFileStatus(cacheFile), false,
                        c.timestamp, visibility, c);
  assertTrue("Cache file didn't get localized in the expected directory. " +
      "Expected localization to happen within " + 
      ROOT_MAPRED_LOCAL_DIR + "/" + distCacheDir +
      ", but was localized at " + 
      localizedPath, localizedPath.toString().contains(distCacheDir));
  if (visibility) {
    checkPublicFilePermissions(new Path[]{localizedPath});
  } else {
    checkFilePermissions(new Path[]{localizedPath});
  }
}