Methods Summary |
---|
protected void | doAdditionalGoodTests(java.lang.String test, org.apache.commons.net.ftp.FTPFile f)
if (test.indexOf("<DIR>") >= 0)
{
assertEquals("directory.type",
FTPFile.DIRECTORY_TYPE, f.getType());
}
|
protected java.lang.String[][] | getBadListings()
return badsamples;
|
protected java.lang.String[][] | getGoodListings()
return goodsamples;
|
protected org.apache.commons.net.ftp.FTPFileEntryParser | getParser()
return new CompositeFileEntryParser(new FTPFileEntryParser[]
{
new NTFTPEntryParser(),
new UnixFTPEntryParser()
});
|
public static junit.framework.TestSuite | suite()Method suite.
return(new TestSuite(NTFTPEntryParserTest.class));
|
public void | testDirectoryBeginningWithNumber()test condition reported as bug 20259.
directory with name beginning with a numeric character
was not parsing correctly
FTPFile f = getParser().parseFTPEntry(directoryBeginningWithNumber);
assertEquals("name", "123xyz", f.getName());
|
public void | testParseFieldsOnDirectory()
FTPFile dir = getParser().parseFTPEntry("12-05-96 05:03PM <DIR> absoft2");
assertNotNull("Could not parse entry.", dir);
assertEquals("Thu Dec 05 17:03:00 1996",
df.format(dir.getTimestamp().getTime()));
assertTrue("Should have been a directory.",
dir.isDirectory());
assertEquals("absoft2", dir.getName());
assertEquals(0, dir.getSize());
dir = getParser().parseFTPEntry("12-03-96 06:38AM <DIR> 123456");
assertNotNull("Could not parse entry.", dir);
assertTrue("Should have been a directory.",
dir.isDirectory());
assertEquals("123456", dir.getName());
assertEquals(0, dir.getSize());
|
public void | testParseFieldsOnFile()
FTPFile f = getParser().parseFTPEntry("05-22-97 12:08AM 5000000000 AUTOEXEC.BAK");
assertNotNull("Could not parse entry.", f);
assertEquals("Thu May 22 00:08:00 1997",
df.format(f.getTimestamp().getTime()));
assertTrue("Should have been a file.",
f.isFile());
assertEquals("AUTOEXEC.BAK", f.getName());
assertEquals(5000000000L, f.getSize());
// test an NT-unix style listing that does NOT have a leading zero
// on the hour.
f = getParser().parseFTPEntry(
"-rw-rw-r-- 1 mqm mqm 17707 Mar 12 3:33 killmq.sh.log");
assertNotNull("Could not parse entry.", f);
Calendar cal = Calendar.getInstance();
cal.setTime(f.getTimestamp().getTime());
assertEquals("hour", 3, cal.get(Calendar.HOUR));
assertTrue("Should have been a file.",
f.isFile());
assertEquals(17707, f.getSize());
|