EnterpriseUnixFTPEntryParserTestpublic class EnterpriseUnixFTPEntryParserTest extends FTPParseTestFramework Tests the EnterpriseUnixFTPEntryParser |
Fields Summary |
---|
private static final String[] | BADSAMPLES | private static final String[] | GOODSAMPLES |
Constructors Summary |
---|
public EnterpriseUnixFTPEntryParserTest(String name)Creates a new EnterpriseUnixFTPEntryParserTest object.
super(name);
|
Methods Summary |
---|
private void | checkPermisions(org.apache.commons.net.ftp.FTPFile dir)Method checkPermisions. Verify that the parser does NOT set the
permissions.
assertTrue("Owner should not have read permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Owner should not have write permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Owner should not have execute permission.",
!dir.hasPermission(FTPFile.USER_ACCESS,
FTPFile.EXECUTE_PERMISSION));
assertTrue("Group should not have read permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("Group should not have write permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("Group should not have execute permission.",
!dir.hasPermission(FTPFile.GROUP_ACCESS,
FTPFile.EXECUTE_PERMISSION));
assertTrue("World should not have read permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.READ_PERMISSION));
assertTrue("World should not have write permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.WRITE_PERMISSION));
assertTrue("World should not have execute permission.",
!dir.hasPermission(FTPFile.WORLD_ACCESS,
FTPFile.EXECUTE_PERMISSION));
| protected java.lang.String[] | getBadListing()
return (BADSAMPLES);
| protected java.lang.String[] | getGoodListing()
return (GOODSAMPLES);
| protected org.apache.commons.net.ftp.FTPFileEntryParser | getParser()
return (new EnterpriseUnixFTPEntryParser());
| public static junit.framework.TestSuite | suite()Method suite.
return (new TestSuite(EnterpriseUnixFTPEntryParserTest.class));
| public void | testParseFieldsOnDirectory()
// Everything is a File for now.
| public void | testParseFieldsOnFile()
FTPFile file = getParser().parseFTPEntry("-C--E-----FTP B QUA1I1 18128 5000000000 Aug 12 13:56 QUADTEST");
Calendar today = Calendar.getInstance();
int year = today.get(Calendar.YEAR);
assertTrue("Should be a file.",
file.isFile());
assertEquals("QUADTEST",
file.getName());
assertEquals(5000000000L,
file.getSize());
assertEquals("QUA1I1",
file.getUser());
assertEquals("18128",
file.getGroup());
if(today.get(Calendar.MONTH) < Calendar.AUGUST)
--year;
Calendar timestamp = file.getTimestamp();
assertEquals(year, timestamp.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, timestamp.get(Calendar.MONTH));
assertEquals(12, timestamp.get(Calendar.DAY_OF_MONTH));
assertEquals(13, timestamp.get(Calendar.HOUR_OF_DAY));
assertEquals(56, timestamp.get(Calendar.MINUTE));
assertEquals(0, timestamp.get(Calendar.SECOND));
checkPermisions(file);
|
|