FileDocCategorySizeDatePackage
OS400FTPEntryParserTest.javaAPI DocApache Commons NET 1.4.1 API5900Sat Dec 03 10:05:48 GMT 2005org.apache.commons.net.ftp.parser

OS400FTPEntryParserTest

public class OS400FTPEntryParserTest extends CompositeFTPParseTestFramework
version
$Id: OS400FTPEntryParserTest.java 155429 2005-02-26 13:13:04Z dirkv $

Fields Summary
private static final String[]
badsamples
private static final String[]
goodsamples
Constructors Summary
public OS400FTPEntryParserTest(String name)

see
junit.framework.TestCase#TestCase(String)


           
      
    
        super(name);
    
Methods Summary
protected voiddoAdditionalGoodTests(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()

see
FTPParseTestFramework#getBadListing()

        return badsamples;
    
protected java.lang.String[][]getGoodListings()

see
FTPParseTestFramework#getGoodListing()

        return goodsamples;
    
protected org.apache.commons.net.ftp.FTPFileEntryParsergetParser()

see
FTPParseTestFramework#getParser()

        return new CompositeFileEntryParser(new FTPFileEntryParser[]
        {
            new OS400FTPEntryParser(),
            new UnixFTPEntryParser()
        });
    
public static junit.framework.TestSuitesuite()
Method suite.

return
TestSuite

        return(new TestSuite(OS400FTPEntryParserTest.class));
    
public voidtestParseFieldsOnDirectory()

see
FTPParseTestFramework#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 voidtestParseFieldsOnFile()

see
FTPParseTestFramework#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()));