}
Assert.assertFalse(dst.exists());
new File(cwd, fileName).mkdirs(); // will be auto deleted!
Files.write("wrong msg", new File(new File(cwd, fileName), fileName), Charsets.UTF_8); // will be auto deleted!
Command morphline = createMorphline("test-morphlines/testDownloadHdfsFile", inputFile, cwd);
Assert.assertTrue(morphline.process(new Record()));
Assert.assertEquals(msg, Files.toString(dst, Charsets.UTF_8));
if (isDir) {
FileUtil.fullyDelete(dst.getParentFile());
} else {
FileUtil.fullyDelete(dst);
}
Assert.assertTrue(fileSystem.exists(inputFile));
Assert.assertTrue(FileUtil.fullyDelete(cwd));
// verify that subsequent calls with same inputFile won't copy the file again (to prevent races)
morphline = createMorphline("test-morphlines/downloadHdfsFile", inputFile, cwd);
Assert.assertTrue(morphline.process(new Record()));
Assert.assertFalse(dst.exists());
Assert.assertTrue(morphline.process(new Record()));
Assert.assertFalse(dst.exists());
Assert.assertFalse(cwd.exists());
Assert.assertTrue(fileSystem.delete(inputFile, true));