@Test public void testGetJobFoldersEmptyHistoryFolder() { Path histFolder = new Path(Constants.TONY_CORE_SRC + "test/resources/emptyHistFolder"); assertTrue(HdfsUtils.getJobDirs(fs, histFolder, "job*").isEmpty()); }
public static List<Path> getJobDirs(FileSystem fs, Path curr, String regex) { List<Path> result = new ArrayList<>(); List<FileStatus> dirs = getDirectories(fs, curr); dirs.forEach(dir -> { if (isJobFolder(dir.getPath(), regex)) { result.add(dir.getPath()); } result.addAll(getJobDirs(fs, dir.getPath(), regex)); }); return result; }
HdfsUtils { public static List<Path> getJobDirs(FileSystem fs, Path curr, String regex) { List<Path> result = new ArrayList<>(); List<FileStatus> dirs = getDirectories(fs, curr); dirs.forEach(dir -> { if (isJobFolder(dir.getPath(), regex)) { result.add(dir.getPath()); } result.addAll(getJobDirs(fs, dir.getPath(), regex)); }); return result; } }
HdfsUtils { public static List<Path> getJobDirs(FileSystem fs, Path curr, String regex) { List<Path> result = new ArrayList<>(); List<FileStatus> dirs = getDirectories(fs, curr); dirs.forEach(dir -> { if (isJobFolder(dir.getPath(), regex)) { result.add(dir.getPath()); } result.addAll(getJobDirs(fs, dir.getPath(), regex)); }); return result; } private  HdfsUtils(); }
HdfsUtils { public static List<Path> getJobDirs(FileSystem fs, Path curr, String regex) { List<Path> result = new ArrayList<>(); List<FileStatus> dirs = getDirectories(fs, curr); dirs.forEach(dir -> { if (isJobFolder(dir.getPath(), regex)) { result.add(dir.getPath()); } result.addAll(getJobDirs(fs, dir.getPath(), regex)); }); return result; } private  HdfsUtils(); static boolean pathExists(FileSystem fs, Path filePath); static String contentOfHdfsFile(FileSystem fs, Path filePath); static String getLastComponent(String path); @VisibleForTesting static boolean isJobFolder(Path p, String regex); static List<FileStatus> getDirectories(FileSystem fs, Path path); static Path getJobDirPath(FileSystem fs, Path curr, String applicationId); static List<Path> getJobDirs(FileSystem fs, Path curr, String regex); static void copySrcToDest(Path src, Path dst, Configuration conf); }
HdfsUtils { public static List<Path> getJobDirs(FileSystem fs, Path curr, String regex) { List<Path> result = new ArrayList<>(); List<FileStatus> dirs = getDirectories(fs, curr); dirs.forEach(dir -> { if (isJobFolder(dir.getPath(), regex)) { result.add(dir.getPath()); } result.addAll(getJobDirs(fs, dir.getPath(), regex)); }); return result; } private  HdfsUtils(); static boolean pathExists(FileSystem fs, Path filePath); static String contentOfHdfsFile(FileSystem fs, Path filePath); static String getLastComponent(String path); @VisibleForTesting static boolean isJobFolder(Path p, String regex); static List<FileStatus> getDirectories(FileSystem fs, Path path); static Path getJobDirPath(FileSystem fs, Path curr, String applicationId); static List<Path> getJobDirs(FileSystem fs, Path curr, String regex); static void copySrcToDest(Path src, Path dst, Configuration conf);  }