[ 
https://issues.apache.org/jira/browse/FTPSERVER-103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Niklas Gustavsson closed FTPSERVER-103.
---------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.0-M1)
                       (was: 1.0)
                       (was: WISHLIST)

Fixed by now returting a sorted file listing. Thanks for reporting!

commit -m "Make sure files are returned in alphabetical order (FTPSERVER-103)
Refactor tests further to make the reusable for other file system 
implementations" 
C:/home/niklas/workspaces/apache/ftpserver/ftplet-api/src/java/org/apache/ftpserver/ftplet/FileObject.java
 
C:/home/niklas/workspaces/apache/ftpserver/core/src/java/org/apache/ftpserver/filesystem/NativeFileObject.java
 
C:/home/niklas/workspaces/apache/ftpserver/core/src/java/org/apache/ftpserver/listing/DirectoryLister.java
 
C:/home/niklas/workspaces/apache/ftpserver/core/src/test/org/apache/ftpserver/filesystem/FileObjectTestTemplate.java
 
C:/home/niklas/workspaces/apache/ftpserver/core/src/test/org/apache/ftpserver/filesystem/FileSystemViewTemplate.java
 
C:/home/niklas/workspaces/apache/ftpserver/core/src/test/org/apache/ftpserver/filesystem/NativeFileObjectTest.java
 
C:/home/niklas/workspaces/apache/ftpserver/core/src/test/org/apache/ftpserver/filesystem/NativeFileSystemViewTest.java
    Sending        
C:/home/niklas/workspaces/apache/ftpserver/core/src/java/org/apache/ftpserver/filesystem/NativeFileObject.java
    Sending        
C:/home/niklas/workspaces/apache/ftpserver/core/src/java/org/apache/ftpserver/listing/DirectoryLister.java
    Sending        
C:/home/niklas/workspaces/apache/ftpserver/core/src/test/org/apache/ftpserver/filesystem/FileObjectTestTemplate.java
    Adding         
C:/home/niklas/workspaces/apache/ftpserver/core/src/test/org/apache/ftpserver/filesystem/FileSystemViewTemplate.java
    Sending        
C:/home/niklas/workspaces/apache/ftpserver/core/src/test/org/apache/ftpserver/filesystem/NativeFileObjectTest.java
    Sending        
C:/home/niklas/workspaces/apache/ftpserver/core/src/test/org/apache/ftpserver/filesystem/NativeFileSystemViewTest.java
    Sending        
C:/home/niklas/workspaces/apache/ftpserver/ftplet-api/src/java/org/apache/ftpserver/ftplet/FileObject.java
    Transmitting file data ...
    Committed revision 565040.

> 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-M2
>
>         Attachments: DirectoryListerTest.java
>
>
> 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