FileSystemOperations { public String downloadAndZip(String remoteDir, String destFileName) throws IOException { DownloadResult downloadResult = downloadInternal(remoteDir, destFileName); String zipFileUri = zipLocalDirectory(downloadResult); if (downloadResult.remote) { deleteFiles(downloadResult.srcPath); } return zipFileUri; } 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();  }
@Test public void testDownloadAndZip() throws IOException { String remoteDir = "hdfs: fileUtils.createDirInDir(stagingDir, "remoteDir"); String resultFilePath = fileSystemOperations.downloadAndZip(remoteDir, TARGET_ZIP_DIR); File resultFile = new File(resultFilePath); assertTrue(resultFile.exists()); assertTrue( String.format( "Result file name is '%s' and does not start with prefix '%s'", resultFile.getName(), TARGET_ZIP_DIR), resultFile.getName().startsWith(TARGET_ZIP_DIR)); }