@SuppressWarnings("deprecation")
  public static void setupDistributedCache(Configuration conf,
      Map<String, LocalResource> localResources) throws IOException {

    LocalResourceBuilder lrb = new LocalResourceBuilder();
    lrb.setConf(conf);

    // Cache archives
    lrb.setType(LocalResourceType.ARCHIVE);
    lrb.setUris(JobContextImpl.getCacheArchives(conf));
    lrb.setTimestamps(JobContextImpl.getArchiveTimestamps(conf));
    lrb.setSizes(getFileSizes(conf, MRJobConfig.CACHE_ARCHIVES_SIZES));
    lrb.setVisibilities(DistributedCache.getArchiveVisibilities(conf));
    lrb.setSharedCacheUploadPolicies(
        Job.getArchiveSharedCacheUploadPolicies(conf));
    lrb.createLocalResources(localResources);
    
    // Cache files
    lrb.setType(LocalResourceType.FILE);
    lrb.setUris(JobContextImpl.getCacheFiles(conf));
    lrb.setTimestamps(JobContextImpl.getFileTimestamps(conf));
    lrb.setSizes(getFileSizes(conf, MRJobConfig.CACHE_FILES_SIZES));
    lrb.setVisibilities(DistributedCache.getFileVisibilities(conf));
    lrb.setSharedCacheUploadPolicies(
        Job.getFileSharedCacheUploadPolicies(conf));
    lrb.createLocalResources(localResources);
  }
@Test
  @Timeout(30000)
  public void testSetupDistributedCacheEmpty() throws IOException {
    Configuration conf = new Configuration();
    Map<String, LocalResource> localResources = new HashMap<String, LocalResource>();
    MRApps.setupDistributedCache(conf, localResources);
    assertTrue(localResources.isEmpty(),
        "Empty Config did not produce an empty list of resources");
  }