You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-dev@incubator.apache.org by "Niklas Gustavsson (JIRA)" <ji...@apache.org> on 2007/08/10 09:37:42 UTC

[jira] Commented: (FTPSERVER-103) DirectoryListerTest fails when listed files come back in unexpected order; breaks build

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

Niklas Gustavsson commented on FTPSERVER-103:
---------------------------------------------

Thanks for reporting. Should we attack this problem by updating the text to allow random order or should we force an order in the lister?

> 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
>
>         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.