FileDocCategorySizeDatePackage
UnzipTest.javaAPI DocApache Ant 1.706339Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs

UnzipTest

public class UnzipTest extends org.apache.tools.ant.BuildFileTest

Fields Summary
private static final org.apache.tools.ant.util.FileUtils
FILE_UTILS
Utilities used for file operations
Constructors Summary
public UnzipTest(String name)


       
        super(name);
    
Methods Summary
private voidassertFileExists(java.lang.String message, java.lang.String filename)
assert that a file exists, relative to the project

param
message message if there is no mpatch
param
filename filename to resolve against the project

        assertTrue(message,
                   getProject().resolveFile(filename).exists());
    
private voidassertFileMissing(java.lang.String message, java.lang.String filename)
assert that a file doesnt exist, relative to the project

param
message message if there is no mpatch
param
filename filename to resolve against the project

        assertTrue(message,
                !getProject().resolveFile(filename).exists());
    
private voidassertLogoUncorrupted()
test that the logo gif file has not been corrupted

throws
IOException

        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
                                           project.resolveFile("asf-logo.gif")));
    
public voidsetUp()

        configureProject("src/etc/testcases/taskdefs/unzip.xml");
    
public voidtearDown()

        executeTarget("cleanup");
    
public voidtest1()

        expectBuildException("test1", "required argument not specified");
    
public voidtest2()

        expectBuildException("test2", "required argument not specified");
    
public voidtest3()

        expectBuildException("test3", "required argument not specified");
    
public voidtestDocumentationClaimsOnCopy()

        executeTarget("testDocumentationClaimsOnCopy");
        assertFileMissing("1/foo is excluded", "unziptestout/1/foo");
        assertFileExists("2/bar is not excluded", "unziptestout/2/bar");
    
public voidtestEncoding()

        executeTarget("encodingTest");
        assertFileExists("foo has been properly named", "unziptestout/foo");
    
public voidtestFlattenMapper()

        executeTarget("testFlattenMapper");
        assertFileMissing("1/foo is not flattened", "unziptestout/1/foo");
        assertFileExists("foo is flattened", "unziptestout/foo");
    
public voidtestGlobMapper()
PR 21996

        executeTarget("testGlobMapper");
        assertFileMissing("1/foo is not mapped", "unziptestout/1/foo");
        assertFileExists("1/foo is mapped", "unziptestout/1/foo.txt");
    
public voidtestPatternSetExcludeOnly()

        executeTarget("testPatternSetExcludeOnly");
        assertFileMissing("1/foo is excluded", "unziptestout/1/foo");
        assertFileExists("2/bar is not excluded", "unziptestout/2/bar");
    
public voidtestPatternSetIncludeAndExclude()

        executeTarget("testPatternSetIncludeAndExclude");
        assertFileMissing("1/foo is not included", "unziptestout/1/foo");
        assertFileMissing("2/bar is excluded", "unziptestout/2/bar");
    
public voidtestPatternSetIncludeOnly()

        executeTarget("testPatternSetIncludeOnly");
        assertFileMissing("1/foo is not included", "unziptestout/1/foo");
        assertFileExists("2/bar is included", "unziptestout/2/bar");
    
public voidtestPatternSetSlashOnly()

        executeTarget("testPatternSetSlashOnly");
        assertFileMissing("1/foo is not included", "unziptestout/1/foo");
        assertFileExists("\"2/bar is included", "unziptestout/2/bar");
    
public voidtestRealTest()

        executeTarget("realTest");
        assertLogoUncorrupted();
    
public voidtestResourceCollections()

        executeTarget("testResourceCollection");
        assertFileExists("junit.jar has been extracted",
                         "unziptestout/junit/framework/Assert.class");
    
public voidtestSelfExtractingArchive()

        executeTarget("selfExtractingArchive");
    
public voidtestTestUncompressedZipTask()

        executeTarget("testUncompressedZipTask");
        assertLogoUncorrupted();
    
public voidtestTestZipTask()

        executeTarget("testZipTask");
        assertLogoUncorrupted();
    
public voidtestTwoMappers()

        expectBuildException("testTwoMappers",Expand.ERROR_MULTIPLE_MAPPERS);
    
public voidtestTwoPatternSets()

        executeTarget("testTwoPatternSets");
        assertFileMissing("1/foo is not included", "unziptestout/1/foo");
        assertFileExists("2/bar is included", "unziptestout/2/bar");
    
public voidtestTwoPatternSetsWithExcludes()

        executeTarget("testTwoPatternSetsWithExcludes");
        assertFileMissing("1/foo is not included", "unziptestout/1/foo");
        assertFileMissing("2/bar is excluded", "unziptestout/2/bar");