/** * Gets the directory listing for a path and invokes * {@link #processPaths(PathData, PathData...)} * @param item {@link PathData} for directory to recurse into * @throws IOException if anything goes wrong... */ protected void recursePath(PathData item) throws IOException { try { depth++; if (isSorted()) { // use the non-iterative method for listing because explicit sorting is // required. Iterators not guaranteed to return sorted elements processPaths(item, item.getDirectoryContents()); } else { processPaths(item, item.getDirectoryContentsIterator()); } } finally { depth--; } }
/** * Gets the directory listing for a path and invokes * {@link #processPaths(PathData, PathData...)} * @param item {@link PathData} for directory to recurse into * @throws IOException if anything goes wrong... */ protected void recursePath(PathData item) throws IOException { try { depth++; processPaths(item, item.getDirectoryContents()); } finally { depth--; } }
/** * Gets the directory listing for a path and invokes * {@link #processPaths(PathData, PathData...)} * @param item {@link PathData} for directory to recurse into * @throws IOException if anything goes wrong... */ protected void recursePath(PathData item) throws IOException { try { depth++; processPaths(item, item.getDirectoryContents()); } finally { depth--; } }
/** * Gets the directory listing for a path and invokes * {@link #processPaths(PathData, PathData...)} * @param item {@link PathData} for directory to recurse into * @throws IOException if anything goes wrong... */ protected void recursePath(PathData item) throws IOException { try { depth++; processPaths(item, item.getDirectoryContents()); } finally { depth--; } }
/** * Gets the directory listing for a path and invokes * {@link #processPaths(PathData, PathData...)} * @param item {@link PathData} for directory to recurse into * @throws IOException if anything goes wrong... */ protected void recursePath(PathData item) throws IOException { try { depth++; processPaths(item, item.getDirectoryContents()); } finally { depth--; } }
@Test (timeout = 30000) public void testQualifiedUriContents() throws Exception { String dirString = fs.makeQualified(new Path("d1")).toString(); PathData item = new PathData(dirString, conf); PathData[] items = item.getDirectoryContents(); assertEquals( sortedString(dirString+"/f1", dirString+"/f1.1", dirString+"/f2"), sortedString(items) ); }
@Test (timeout = 30000) public void testQualifiedUriContents() throws Exception { String dirString = fs.makeQualified(new Path("d1")).toString(); PathData item = new PathData(dirString, conf); PathData[] items = item.getDirectoryContents(); assertEquals( sortedString(dirString+"/f1", dirString+"/f1.1", dirString+"/f2"), sortedString(items) ); }
@Test (timeout = 30000) public void testUnqualifiedUriContents() throws Exception { String dirString = "d1"; PathData item = new PathData(dirString, conf); PathData[] items = item.getDirectoryContents(); assertEquals( sortedString("d1/f1", "d1/f1.1", "d1/f2"), sortedString(items) ); }
@Test (timeout = 30000) public void testCwdContents() throws Exception { String dirString = Path.CUR_DIR; PathData item = new PathData(dirString, conf); PathData[] items = item.getDirectoryContents(); assertEquals( sortedString("d1", "d2"), sortedString(items) ); }
@Test (timeout = 30000) public void testUnqualifiedUriContents() throws Exception { String dirString = "d1"; PathData item = new PathData(dirString, conf); PathData[] items = item.getDirectoryContents(); assertEquals( sortedString("d1/f1", "d1/f1.1", "d1/f2"), sortedString(items) ); }
@Test (timeout = 30000) public void testCwdContents() throws Exception { String dirString = Path.CUR_DIR; PathData item = new PathData(dirString, conf); PathData[] items = item.getDirectoryContents(); assertEquals( sortedString("d1", "d2"), sortedString(items) ); }