@Test(expected = FileNotFoundException.class) public void testUploadToRemoteFileNotExistingFile() throws IOException { fileSystemOperations.uploadToRemoteFile(stagingDir, "notExisting"); }
public Path uploadToRemoteFile(Path stagingDir, String fileToUpload) throws IOException { FileSystem fs = remoteDirectoryManager.getDefaultFileSystem(); File localFile = new File(fileToUpload); if (!localFile.exists()) { throw new FileNotFoundException( "Trying to upload file " + localFile.getAbsolutePath() + " to remote, but could not find local file!"); } String filename = localFile.getName(); Path uploadedFilePath = new Path(stagingDir, filename); if (!uploadedFiles.contains(uploadedFilePath)) { if (SubmarineLogs.isVerbose()) { LOG.info("Copying local file " + fileToUpload + " to remote " + uploadedFilePath); } fs.copyFromLocalFile(new Path(fileToUpload), uploadedFilePath); uploadedFiles.add(uploadedFilePath); } return uploadedFilePath; }
FileSystemOperations { public Path uploadToRemoteFile(Path stagingDir, String fileToUpload) throws IOException { FileSystem fs = remoteDirectoryManager.getDefaultFileSystem(); File localFile = new File(fileToUpload); if (!localFile.exists()) { throw new FileNotFoundException( "Trying to upload file " + localFile.getAbsolutePath() + " to remote, but could not find local file!"); } String filename = localFile.getName(); Path uploadedFilePath = new Path(stagingDir, filename); if (!uploadedFiles.contains(uploadedFilePath)) { if (SubmarineLogs.isVerbose()) { LOG.info("Copying local file " + fileToUpload + " to remote " + uploadedFilePath); } fs.copyFromLocalFile(new Path(fileToUpload), uploadedFilePath); uploadedFiles.add(uploadedFilePath); } return uploadedFilePath; } }
FileSystemOperations { public Path uploadToRemoteFile(Path stagingDir, String fileToUpload) throws IOException { FileSystem fs = remoteDirectoryManager.getDefaultFileSystem(); File localFile = new File(fileToUpload); if (!localFile.exists()) { throw new FileNotFoundException( "Trying to upload file " + localFile.getAbsolutePath() + " to remote, but could not find local file!"); } String filename = localFile.getName(); Path uploadedFilePath = new Path(stagingDir, filename); if (!uploadedFiles.contains(uploadedFilePath)) { if (SubmarineLogs.isVerbose()) { LOG.info("Copying local file " + fileToUpload + " to remote " + uploadedFilePath); } fs.copyFromLocalFile(new Path(fileToUpload), uploadedFilePath); uploadedFiles.add(uploadedFilePath); } return uploadedFilePath; } FileSystemOperations(ClientContext clientContext); }
FileSystemOperations { public Path uploadToRemoteFile(Path stagingDir, String fileToUpload) throws IOException { FileSystem fs = remoteDirectoryManager.getDefaultFileSystem(); File localFile = new File(fileToUpload); if (!localFile.exists()) { throw new FileNotFoundException( "Trying to upload file " + localFile.getAbsolutePath() + " to remote, but could not find local file!"); } String filename = localFile.getName(); Path uploadedFilePath = new Path(stagingDir, filename); if (!uploadedFiles.contains(uploadedFilePath)) { if (SubmarineLogs.isVerbose()) { LOG.info("Copying local file " + fileToUpload + " to remote " + uploadedFilePath); } fs.copyFromLocalFile(new Path(fileToUpload), uploadedFilePath); uploadedFiles.add(uploadedFilePath); } return uploadedFilePath; } FileSystemOperations(ClientContext clientContext); String downloadAndZip(String remoteDir, String destFileName); String download(String remoteDir, String zipFileName); void deleteFiles(String localUri); @VisibleForTesting void uploadToRemoteFileAndLocalizeToContainerWorkDir(Path stagingDir,
      String fileToUpload, String destFilename, Component comp); Path uploadToRemoteFile(Path stagingDir, String fileToUpload); void validFileSize(String uri); void setPermission(Path destPath, FsPermission permission); static boolean needHdfs(List<String> stringsToCheck); static boolean needHdfs(String content); Set<Path> getUploadedFiles(); }
FileSystemOperations { public Path uploadToRemoteFile(Path stagingDir, String fileToUpload) throws IOException { FileSystem fs = remoteDirectoryManager.getDefaultFileSystem(); File localFile = new File(fileToUpload); if (!localFile.exists()) { throw new FileNotFoundException( "Trying to upload file " + localFile.getAbsolutePath() + " to remote, but could not find local file!"); } String filename = localFile.getName(); Path uploadedFilePath = new Path(stagingDir, filename); if (!uploadedFiles.contains(uploadedFilePath)) { if (SubmarineLogs.isVerbose()) { LOG.info("Copying local file " + fileToUpload + " to remote " + uploadedFilePath); } fs.copyFromLocalFile(new Path(fileToUpload), uploadedFilePath); uploadedFiles.add(uploadedFilePath); } return uploadedFilePath; } FileSystemOperations(ClientContext clientContext); String downloadAndZip(String remoteDir, String destFileName); String download(String remoteDir, String zipFileName); void deleteFiles(String localUri); @VisibleForTesting void uploadToRemoteFileAndLocalizeToContainerWorkDir(Path stagingDir,
      String fileToUpload, String destFilename, Component comp); Path uploadToRemoteFile(Path stagingDir, String fileToUpload); void validFileSize(String uri); void setPermission(Path destPath, FsPermission permission); static boolean needHdfs(List<String> stringsToCheck); static boolean needHdfs(String content); Set<Path> getUploadedFiles();  }