DirectoryListerTest fails when listed files come back in unexpected order; 
breaks build
---------------------------------------------------------------------------------------

                 Key: FTPSERVER-103
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-103
             Project: FtpServer
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.0-M1, 1.0-M2, 1.0, WISHLIST
         Environment: Windows XP
            Reporter: Ron Cemer
             Fix For: 1.0-M1, 1.0-M2, 1.0, WISHLIST


DirectoryListerTest fails when listed files come back in unexpected order; 
breaks build.

The project can't be built completely because of this.

To fix, replace the testListFiles() function in DirectoryListerTest.java with 
the following:

    public void testListFiles() throws Exception {
        ListArgument arg = new ListArgument(TEST_DIR1.getName(), null, null);
        FileFormater formater = new NLSTFileFormater();
        
        String actual = directoryLister.listFiles(arg, fileSystemView, 
formater);
/// This doesn't work because the files sometimes come back in a different 
order.
///        assertEquals("dir3\r\ntest3.txt\r\ntest4.txt\r\n", actual);
                java.util.StringTokenizer st = new 
java.util.StringTokenizer(actual, "\r\n");
                boolean gotDir3 = false, gotTest3_txt = false, gotTest4_txt = 
false;
                int i = 0;
                while (true) {
                        if (!st.hasMoreTokens()) break;
                        String s = st.nextToken();
                        if (s.length() > 0) {
                                i++;
                                if (s.equals("dir3")) {
                                        gotDir3 = true;
                                } else if (s.equals("test3.txt")) {
                                        gotTest3_txt = true;
                                } else if (s.equals("test4.txt")) {
                                        gotTest4_txt = true;
                                }
                        }
                }
                assertTrue((i == 3) && gotDir3 && gotTest3_txt && gotTest4_txt);
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to