GitHub user Guangxian opened a pull request:

    https://github.com/apache/flume/pull/193

    FLUME-3207:Fix some typos in TestReliableSpoolingFileEventReader

    There is a mistake in `testConsumeFileOldestWithLexicographicalComparision`
    ```java
    public void testConsumeFileOldestWithLexicographicalComparision()
          throws IOException, InterruptedException {
        ReliableEventReader reader =
            new 
ReliableSpoolingFileEventReader.Builder().spoolDirectory(WORK_DIR)
                                                         
.consumeOrder(ConsumeOrder.OLDEST)
                                                         .build();
        File file1 = new File(WORK_DIR, "new-file1");
        File file2 = new File(WORK_DIR, "new-file2");
        File file3 = new File(WORK_DIR, "new-file3");
        Thread.sleep(1000L);
        FileUtils.write(file3, "New file3 created.\n");
        FileUtils.write(file2, "New file2 created.\n");
        FileUtils.write(file1, "New file1 created.\n");
        file1.setLastModified(file3.lastModified());
        file1.setLastModified(file2.lastModified());
        // file ages are same now they need to be ordered
        // lexicographically (file1, file2, file3).
        List<String> actual = Lists.newLinkedList();
        readEventsForFilesInDir(WORK_DIR, reader, actual);
        List<String> expected = Lists.newLinkedList();
        createExpectedFromFilesInSetup(expected);
        expected.add(""); // Empty file was added in the last in setup.
        expected.add("New file1 created.");
        expected.add("New file2 created.");
        expected.add("New file3 created.");
        Assert.assertEquals(expected, actual);
      }
    ```
    The code is incorrect. To set the same modify time for the three files, 
code should be:
    ```java
    file2.setLastModified(file1.lastModified());
    file3.setLastModified(file1.lastModified());
    ```
    Test `testConsumeFileYoungestWithLexicographicalComparision` has the same 
mistake.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Guangxian/flume flume-3207

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flume/pull/193.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #193
    
----
commit f66b1c42541adbaf0e0a65212f92cdce1f35ae00
Author: liaoguangxian <liaoguangxian@...>
Date:   2017-12-27T13:23:21Z

    FLUME-3207:Fix some typos in TestReliableSpoolingFileEventReader

----


---

Reply via email to