Github user uce commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2288#discussion_r75086698
  
    --- Diff: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/util/HDFSCopyUtilitiesTest.java
 ---
    @@ -70,6 +70,85 @@ public void testCopyFromLocal() throws Exception {
                }
        }
     
    +
    +   /**
    +    * This test verifies that nested directories are properly copied.
    +    */
    +   @Test
    +   public void testCopyFromLocalRecursive() throws Exception {
    +
    +           File rootDir = tempFolder.newFolder();
    +           File nestedDir = new File(rootDir,"nested");
    +           nestedDir.mkdir();
    +
    +           Map<String,File>  copyFiles = new HashMap<String,File>();
    +
    +           copyFiles.put("1",new File(rootDir, "1"));
    +           copyFiles.put("2",new File(rootDir, "2"));
    +           copyFiles.put("3",new File(nestedDir, "3"));
    +
    +           for (File file : copyFiles.values()) {
    +                   try (DataOutputStream out = new DataOutputStream(new 
FileOutputStream(file))) {
    +                           out.writeUTF("Hello there, " + file.getName());
    +                   }
    +           }
    +           //add root and nested dirs to expected output
    +           copyFiles.put(rootDir.getName(),rootDir);
    +           copyFiles.put("nested",nestedDir);
    +
    +           assertEquals(5,copyFiles.size());
    +
    +           //Test for copy to unspecified target directory
    +           File copyDirU = tempFolder.newFolder();
    +           HDFSCopyFromLocal.copyFromLocal(
    +                           rootDir,
    +                           new Path("file://" + 
copyDirU.getAbsolutePath()).toUri());
    +
    +           //Test for copy to specified target directory
    +           File copyDirQ = tempFolder.newFolder();
    +           HDFSCopyFromLocal.copyFromLocal(
    +                           rootDir,
    +                           new Path("file://" + copyDirQ.getAbsolutePath() 
+ "/" + rootDir.getName()).toUri());
    +
    +           FilenameFilter noCrc = new FilenameFilter() {
    --- End diff --
    
    I see. I was wondering why there might be such files in the newly created 
directory.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to