@Test public void testIsJobFolderMatch() { Path filePath1 = new Path("/abc/def/application_1541469337545_0024"); Path filePath2 = new Path("/abc/def/job2"); String regex1 = "^application_.*"; String regex2 = "^job.*"; assertTrue(HdfsUtils.isJobFolder(filePath1, regex1)); assertTrue(HdfsUtils.isJobFolder(filePath2, regex2)); }
@VisibleForTesting public static boolean isJobFolder(Path p, String regex) { return p != null && getLastComponent(p.toString()).matches(regex); }
HdfsUtils { @VisibleForTesting public static boolean isJobFolder(Path p, String regex) { return p != null && getLastComponent(p.toString()).matches(regex); } }
HdfsUtils { @VisibleForTesting public static boolean isJobFolder(Path p, String regex) { return p != null && getLastComponent(p.toString()).matches(regex); } private  HdfsUtils(); }
HdfsUtils { @VisibleForTesting public static boolean isJobFolder(Path p, String regex) { return p != null && getLastComponent(p.toString()).matches(regex); } 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 { @VisibleForTesting public static boolean isJobFolder(Path p, String regex) { return p != null && getLastComponent(p.toString()).matches(regex); } 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);  }