LocalDirAllocator { public Iterable<Path> getAllLocalPathsToRead(String pathStr, Configuration conf ) throws IOException { AllocatorPerContext context; synchronized (this) { context = obtainContext(contextCfgItemName); } return context.getAllLocalPathsToRead(pathStr, conf); } LocalDirAllocator(String contextCfgItemName);  LocalDirAllocator(String contextCfgItemName,
          DiskValidator diskValidator); Path getLocalPathForWrite(String pathStr, 
      Configuration conf); Path getLocalPathForWrite(String pathStr, long size, 
      Configuration conf); Path getLocalPathForWrite(String pathStr, long size, 
                                   Configuration conf,
                                   boolean checkWrite); Path getLocalPathToRead(String pathStr, 
      Configuration conf); Iterable<Path> getAllLocalPathsToRead(String pathStr, 
                                               Configuration conf
                                               ); File createTmpFileForWrite(String pathStr, long size, 
      Configuration conf); static boolean isContextValid(String contextCfgItemName); @Deprecated @InterfaceAudience.LimitedPrivate({"MapReduce"}) static void removeContext(String contextCfgItemName); boolean ifExists(String pathStr, Configuration conf); static final int SIZE_UNKNOWN; }
@Test (timeout = 30000) public void testGetAllLocalPathsToRead() throws IOException { assumeNotWindows(); String dir0 = buildBufferDir(ROOT, 0); String dir1 = buildBufferDir(ROOT, 1); try { conf.set(CONTEXT, dir0 + "," + dir1); assertTrue(localFs.mkdirs(new Path(dir0))); assertTrue(localFs.mkdirs(new Path(dir1))); localFs.create(new Path(dir0 + Path.SEPARATOR + FILENAME)); localFs.create(new Path(dir1 + Path.SEPARATOR + FILENAME)); final Iterable<Path> pathIterable = dirAllocator.getAllLocalPathsToRead(FILENAME, conf); int count = 0; for (final Path p: pathIterable) { count++; assertEquals(FILENAME, p.getName()); assertEquals("file", p.getFileSystem(conf).getUri().getScheme()); } assertEquals(2, count); try { Path p = pathIterable.iterator().next(); assertFalse("NoSuchElementException must be thrown, but returned ["+p +"] instead.", true); } catch (NoSuchElementException nsee) { } final Iterable<Path> pathIterable2 = dirAllocator.getAllLocalPathsToRead(FILENAME, conf); final Iterator<Path> it = pathIterable2.iterator(); try { it.remove(); assertFalse(true); } catch (UnsupportedOperationException uoe) { } } finally { Shell.execCommand(new String[] { "chmod", "u+w", BUFFER_DIR_ROOT }); rmBufferDirs(); } }