guangxian.liao created FLUME-3207:
-------------------------------------

             Summary: Fix some typos in TestReliableSpoolingFileEventReader
                 Key: FLUME-3207
                 URL: https://issues.apache.org/jira/browse/FLUME-3207
             Project: Flume
          Issue Type: Bug
    Affects Versions: 1.8.0
            Reporter: guangxian.liao
            Assignee: guangxian.liao
            Priority: Trivial



{code:java}
  @Test
  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);
  }
{code}


{noformat}
file1.setLastModified(file3.lastModified());
file1.setLastModified(file2.lastModified());
{noformat}
The code is incorrect,may be typos.To set the same modify time for the three 
files, should be
{noformat}
file2.setLastModified(file1.lastModified());
file3.setLastModified(file1.lastModified());
{noformat}

Same mistake in test 'testConsumeFileYoungestWithLexicographicalComparision'
Maybe file modify time only accurate to seconds, the test rarely fail.





--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to