FileDocCategorySizeDatePackage
FTPParseTestFramework.javaAPI DocApache Commons NET 1.4.1 API4094Sat Dec 03 10:05:50 GMT 2005org.apache.commons.net.ftp.parser

FTPParseTestFramework

public abstract class FTPParseTestFramework extends TestCase
author
Steve Cohen
version
$Id: FTPParseTestFramework.java 165675 2005-05-02 20:09:55Z rwinston $

Fields Summary
private org.apache.commons.net.ftp.FTPFileEntryParser
parser
protected SimpleDateFormat
df
Constructors Summary
public FTPParseTestFramework(String name)

see
junit.framework.TestCase#TestCase(String)


           
      
    
        super(name);
    
Methods Summary
protected voiddoAdditionalBadTests(java.lang.String test, org.apache.commons.net.ftp.FTPFile f)
during processing you could hook here to do additional tests

param
test raw entry
param
f parsed entry

    
protected voiddoAdditionalGoodTests(java.lang.String test, org.apache.commons.net.ftp.FTPFile f)
during processing you could hook here to do additional tests

param
test raw entry
param
f parsed entry

        
protected abstract java.lang.String[]getBadListing()
Method getBadListing. Implementors must provide a listing that contains failures.

return
String[]

protected abstract java.lang.String[]getGoodListing()
Method getGoodListing. Implementors must provide a listing that passes.

return
String[]

protected abstract org.apache.commons.net.ftp.FTPFileEntryParsergetParser()
Method getParser. Provide the parser to use for testing.

return
FTPFileEntryParser

protected voidsetUp()

see
junit.framework.TestCase#setUp()

        super.setUp();
        parser = getParser();
        df = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy", Locale.US);
    
public voidtestBadListing()
Method testBadListing. Tests that parser provided failures actually fail.

throws
Exception


        String[] badsamples = getBadListing();
        for (int i = 0; i < badsamples.length; i++)
        {

            String test = badsamples[i];
            FTPFile f = parser.parseFTPEntry(test);
            assertNull("Should have Failed to parse " + test,
                       f);

            doAdditionalBadTests(test, f);
        }
    
public voidtestGoodListing()
Method testGoodListing. Test that parser provided listings pass.

throws
Exception


        String[] goodsamples = getGoodListing();
        for (int i = 0; i < goodsamples.length; i++)
        {

            String test = goodsamples[i];
            FTPFile f = parser.parseFTPEntry(test);
            assertNotNull("Failed to parse " + test,
                          f);

            doAdditionalGoodTests(test, f);
        }
    
public abstract voidtestParseFieldsOnDirectory()
Method testParseFieldsOnDirectory. Provide a test to show that fields on a directory entry are parsed correctly.

throws
Exception

public abstract voidtestParseFieldsOnFile()
Method testParseFieldsOnFile. Provide a test to show that fields on a file entry are parsed correctly.

throws
Exception