use of org.apache.flink.util.FileUtils in project flink by apache.
the class AbstractUserClassPathJobGraphRetrieverTest method testGetUserClassPath.
@Test
public void testGetUserClassPath() throws IOException {
final File testJobDir = temporaryFolder.newFolder("_test_job");
final Collection<Path> testFiles = FileUtilsTest.prepareTestFiles(testJobDir.toPath());
final Path currentWorkingDirectory = FileUtils.getCurrentWorkingDirectory();
final TestJobGraphRetriever testJobGraphRetriever = new TestJobGraphRetriever(testJobDir);
assertThat(testJobGraphRetriever.getUserClassPaths(), containsInAnyOrder(testFiles.stream().map(file -> FileUtils.relativizePath(currentWorkingDirectory, file)).map(FunctionUtils.uncheckedFunction(FileUtils::toURL)).toArray()));
}
use of org.apache.flink.util.FileUtils in project flink by apache.
the class DefaultPackagedProgramRetriever method getClasspathsFromUserLibDir.
private static List<URL> getClasspathsFromUserLibDir(@Nullable File userLibDir) throws IOException {
if (userLibDir == null) {
return Collections.emptyList();
}
final Path workingDirectory = FileUtils.getCurrentWorkingDirectory();
final List<URL> relativeJarURLs = FileUtils.listFilesInDirectory(userLibDir.toPath(), FileUtils::isJarFile).stream().map(path -> FileUtils.relativizePath(workingDirectory, path)).map(FunctionUtils.uncheckedFunction(FileUtils::toURL)).collect(Collectors.toList());
return Collections.unmodifiableList(relativeJarURLs);
}