DistributedCache { @Deprecated public static void addFileToClassPath(Path file, Configuration conf) throws IOException { addFileToClassPath(file, conf, file.getFileSystem(conf)); }  @Deprecated static void setCacheArchives(URI[] archives, Configuration conf); @Deprecated static void setCacheFiles(URI[] files, Configuration conf); @Deprecated static URI[] getCacheArchives(Configuration conf); @Deprecated static URI[] getCacheFiles(Configuration conf); @Deprecated static Path[] getLocalCacheArchives(Configuration conf); @Deprecated static Path[] getLocalCacheFiles(Configuration conf); @Deprecated static long[] getArchiveTimestamps(Configuration conf); @Deprecated static long[] getFileTimestamps(Configuration conf); @Deprecated static void addCacheArchive(URI uri, Configuration conf); @Deprecated static void addCacheFile(URI uri, Configuration conf); @Deprecated static void addFileToClassPath(Path file, Configuration conf); static void addFileToClassPath(Path file, Configuration conf,
      FileSystem fs); static void addFileToClassPath(Path file, Configuration conf,
      FileSystem fs, boolean addToCache); @Deprecated static Path[] getFileClassPaths(Configuration conf); @Deprecated static void addArchiveToClassPath(Path archive, Configuration conf); static void addArchiveToClassPath(Path archive, Configuration conf, FileSystem fs); @Deprecated static Path[] getArchiveClassPaths(Configuration conf); @Deprecated static void createSymlink(Configuration conf); @Deprecated static boolean getSymlink(Configuration conf); static boolean[] getFileVisibilities(Configuration conf); static boolean[] getArchiveVisibilities(Configuration conf); static boolean checkURIs(URI[] uriFiles, URI[] uriArchives); static final String WILDCARD; }
@Test public void testAddFileToClassPath() throws Exception { Configuration conf = new Configuration(false); try { DistributedCache.addFileToClassPath(null, conf); fail("Accepted null archives argument"); } catch (NullPointerException ex) { } DistributedCache.addFileToClassPath(new Path("file: assertEquals("The mapreduce.job.classpath.files property was not " + "set correctly", "file:/a", conf.get(MRJobConfig.CLASSPATH_FILES)); assertEquals("The mapreduce.job.cache.files property was not set " + "correctly", "file: DistributedCache.addFileToClassPath(new Path("file: assertEquals("The mapreduce.job.classpath.files property was not " + "set correctly", "file:/a,file:/b", conf.get(MRJobConfig.CLASSPATH_FILES)); assertEquals("The mapreduce.job.cache.files property was not set " + "correctly", "file: conf.get(MRJobConfig.CACHE_FILES)); FileSystem fs = FileSystem.newInstance(conf); conf.clear(); try { DistributedCache.addFileToClassPath(null, conf, fs); fail("Accepted null archives argument"); } catch (NullPointerException ex) { } DistributedCache.addFileToClassPath(new Path("file: assertEquals("The mapreduce.job.classpath.files property was not " + "set correctly", "file:/a", conf.get(MRJobConfig.CLASSPATH_FILES)); assertEquals("The mapreduce.job.cache.files property was not set " + "correctly", "file: DistributedCache.addFileToClassPath(new Path("file: assertEquals("The mapreduce.job.classpath.files property was not " + "set correctly", "file:/a,file:/b", conf.get(MRJobConfig.CLASSPATH_FILES)); assertEquals("The mapreduce.job.cache.files property was not set " + "correctly", "file: conf.get(MRJobConfig.CACHE_FILES)); conf.clear(); try { DistributedCache.addFileToClassPath(null, conf, fs, true); fail("Accepted null archives argument"); } catch (NullPointerException ex) { } DistributedCache.addFileToClassPath(new Path("file: assertEquals("The mapreduce.job.classpath.files property was not " + "set correctly", "file:/a", conf.get(MRJobConfig.CLASSPATH_FILES)); assertEquals("The mapreduce.job.cache.files property was not set " + "correctly", "file: DistributedCache.addFileToClassPath(new Path("file: assertEquals("The mapreduce.job.classpath.files property was not " + "set correctly", "file:/a,file:/b", conf.get(MRJobConfig.CLASSPATH_FILES)); assertEquals("The mapreduce.job.cache.files property was not set " + "correctly", "file: conf.get(MRJobConfig.CACHE_FILES)); conf.clear(); try { DistributedCache.addFileToClassPath(null, conf, fs, false); fail("Accepted null archives argument"); } catch (NullPointerException ex) { } DistributedCache.addFileToClassPath(new Path("file: assertEquals("The mapreduce.job.classpath.files property was not " + "set correctly", "file:/a", conf.get(MRJobConfig.CLASSPATH_FILES)); assertEquals("The mapreduce.job.cache.files property was not set " + "correctly", "", conf.get(MRJobConfig.CACHE_FILES, "")); DistributedCache.addFileToClassPath(new Path("file: assertEquals("The mapreduce.job.classpath.files property was not " + "set correctly", "file:/a,file:/b", conf.get(MRJobConfig.CLASSPATH_FILES)); assertEquals("The mapreduce.job.cache.files property was not set " + "correctly", "", conf.get(MRJobConfig.CACHE_FILES, "")); }