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

SyncTest

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

Fields Summary
Constructors Summary
public SyncTest(String name)

        super(name);
    
Methods Summary
public voidassertFileIsNotPresent(java.lang.String f)

        assertTrue("Didn't expect file " + f,
                   !getProject().resolveFile(f).exists());
    
public voidassertFileIsPresent(java.lang.String f)

        assertTrue("Expected file " + f,
                   getProject().resolveFile(f).exists());
    
public voidsetUp()

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

        executeTarget("cleanup");
    
private voidtestCopyAndRemove(java.lang.String target)

        executeTarget(target);
        String d = getProject().getProperty("dest") + "/a/b/c/d";
        assertFileIsPresent(d);
        String f = getProject().getProperty("dest") + "/e/f";
        assertFileIsNotPresent(f);
        assertTrue(getFullLog().indexOf("Removing orphan file:") > -1);
        assertDebuglogContaining("Removed 1 dangling file from");
        assertDebuglogContaining("Removed 1 dangling directory from");
    
public voidtestCopyAndRemove()

        testCopyAndRemove("copyandremove");
    
public voidtestCopyAndRemoveEmptyPreserve()

        executeTarget("copyandremove-emptypreserve");
        String d = getProject().getProperty("dest") + "/a/b/c/d";
        assertFileIsPresent(d);
        String f = getProject().getProperty("dest") + "/e/f";
        assertFileIsNotPresent(f);
        assertTrue(getFullLog().indexOf("Removing orphan file:") > -1);
        assertDebuglogContaining("Removed 1 dangling file from");
        assertDebuglogContaining("Removed 1 dangling directory from");
    
public voidtestCopyAndRemoveWithFileList()

        testCopyAndRemove("copyandremove-with-filelist");
    
public voidtestCopyAndRemoveWithZipfileset()

        testCopyAndRemove("copyandremove-with-zipfileset");
    
public voidtestCopyNoRemove()

        executeTarget("copynoremove");
        String d = getProject().getProperty("dest") + "/a/b/c/d";
        assertFileIsPresent(d);
        String f = getProject().getProperty("dest") + "/e/f";
        assertFileIsPresent(f);
        assertTrue(getFullLog().indexOf("Removing orphan file:") == -1);
    
public voidtestCopyNoRemoveSelectors()

        executeTarget("copynoremove-selectors");
        String d = getProject().getProperty("dest") + "/a/b/c/d";
        assertFileIsPresent(d);
        String f = getProject().getProperty("dest") + "/e/f";
        assertFileIsPresent(f);
        assertTrue(getFullLog().indexOf("Removing orphan file:") == -1);
    
public voidtestEmptyCopy()

        executeTarget("emptycopy");
        String d = getProject().getProperty("dest") + "/a/b/c/d";
        assertFileIsNotPresent(d);
        String c = getProject().getProperty("dest") + "/a/b/c";
        assertFileIsNotPresent(c);
        assertTrue(getFullLog().indexOf("dangling") == -1);
    
public voidtestEmptyDirCopy()

        executeTarget("emptydircopy");
        String d = getProject().getProperty("dest") + "/a/b/c/d";
        assertFileIsNotPresent(d);
        String c = getProject().getProperty("dest") + "/a/b/c";
        assertFileIsPresent(c);
        assertTrue(getFullLog().indexOf("dangling") == -1);
    
public voidtestEmptyDirCopyAndRemove()

        executeTarget("emptydircopyandremove");
        String d = getProject().getProperty("dest") + "/a/b/c/d";
        assertFileIsNotPresent(d);
        String c = getProject().getProperty("dest") + "/a/b/c";
        assertFileIsPresent(c);
        String f = getProject().getProperty("dest") + "/e/f";
        assertFileIsNotPresent(f);
        assertTrue(getFullLog().indexOf("Removing orphan directory:") > -1);
        assertDebuglogContaining("NO dangling file to remove from");
        assertDebuglogContaining("Removed 2 dangling directories from");
    
public voidtestSimpleCopy()

        executeTarget("simplecopy");
        String d = getProject().getProperty("dest") + "/a/b/c/d";
        assertFileIsPresent(d);
        assertTrue(getFullLog().indexOf("dangling") == -1);