OS400FTPEntryParserTestpublic class OS400FTPEntryParserTest extends CompositeFTPParseTestFramework
Fields Summary |
---|
private static final String[] | badsamples | private static final String[] | goodsamples |
Constructors Summary |
---|
public OS400FTPEntryParserTest(String name)
super(name);
|
Methods Summary |
---|
protected void | doAdditionalGoodTests(java.lang.String test, org.apache.commons.net.ftp.FTPFile f)
if (test.startsWith("d"))
{
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 OS400FTPEntryParser(),
new UnixFTPEntryParser()
});
| public static junit.framework.TestSuite | suite()Method suite.
return(new TestSuite(OS400FTPEntryParserTest.class));
| public void | testParseFieldsOnDirectory()
FTPFile f = getParser().parseFTPEntry("PEP 36864 04/03/24 14:06:34 *DIR dir1/");
assertNotNull("Could not parse entry.",
f);
assertTrue("Should have been a directory.",
f.isDirectory());
assertEquals("PEP",
f.getUser());
assertEquals("dir1",
f.getName());
assertEquals(36864,
f.getSize());
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, Calendar.MARCH);
cal.set(Calendar.YEAR, 2004);
cal.set(Calendar.DATE, 24);
cal.set(Calendar.HOUR_OF_DAY, 14);
cal.set(Calendar.MINUTE, 6);
cal.set(Calendar.SECOND, 34);
assertEquals(df.format(cal.getTime()),
df.format(f.getTimestamp().getTime()));
| public void | testParseFieldsOnFile()
FTPFile f = getParser().parseFTPEntry("PEP 5000000000 04/03/24 14:06:29 *STMF build.xml");
assertNotNull("Could not parse entry.",
f);
assertTrue("Should have been a file.",
f.isFile());
assertEquals("PEP",
f.getUser());
assertEquals("build.xml",
f.getName());
assertEquals(5000000000L,
f.getSize());
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DATE, 24);
cal.set(Calendar.MONTH, Calendar.MARCH);
cal.set(Calendar.YEAR, 2004);
cal.set(Calendar.HOUR_OF_DAY, 14);
cal.set(Calendar.MINUTE, 6);
cal.set(Calendar.SECOND, 29);
assertEquals(df.format(cal.getTime()),
df.format(f.getTimestamp().getTime()));
|
|