FileDocCategorySizeDatePackage
FTPTest.javaAPI DocApache Ant 1.7033181Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs.optional.net

FTPTest

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

Fields Summary
private boolean
supportsSymlinks
private org.apache.commons.net.ftp.FTPClient
ftp
private boolean
connectionSucceeded
private boolean
loginSuceeded
private String
tmpDir
private String
remoteTmpDir
private String
ftpFileSep
private myFTP
myFTPTask
Constructors Summary
public FTPTest(String name)


       
        super(name);
    
Methods Summary
private booleanchangeRemoteDir(java.lang.String remoteDir)

        boolean result = true;
        try {
            ftp.cwd(remoteDir);
        }
        catch (Exception ex) {
            System.out.println("could not change directory to " + remoteTmpDir);
            result = false;
        }
        return result;
    
private voidcompareFiles(org.apache.tools.ant.DirectoryScanner ds, java.lang.String[] expectedFiles, java.lang.String[] expectedDirectories)

        String includedFiles[] = ds.getIncludedFiles();
        String includedDirectories[] = ds.getIncludedDirectories();
        assertEquals("file present: ", expectedFiles.length,
                     includedFiles.length);
        assertEquals("directories present: ", expectedDirectories.length,
                     includedDirectories.length);

        for (int counter=0; counter < includedFiles.length; counter++) {
            includedFiles[counter] = includedFiles[counter].replace(File.separatorChar, '/");
        }
        Arrays.sort(includedFiles);
        for (int counter=0; counter < includedDirectories.length; counter++) {
            includedDirectories[counter] = includedDirectories[counter]
                            .replace(File.separatorChar, '/");
        }
        Arrays.sort(includedDirectories);
        for (int counter=0; counter < includedFiles.length; counter++) {
            assertEquals(expectedFiles[counter], includedFiles[counter]);
        }
        for (int counter=0; counter < includedDirectories.length; counter++) {
            assertEquals(expectedDirectories[counter], includedDirectories[counter]);
            counter++;
        }
    
private voidperformCommandTest(java.lang.String target, int[] expectedCounts)

        String[] messages = new String[]{
                "Doing Site Command: umask 222",
                "Failed to issue Site Command: umask 222",

        };
        LogCounter counter = new LogCounter();
        for (int i=0; i < messages.length; i++) {
            counter.addLogMessageToSearch(messages[i]);
        }
            
        getProject().addBuildListener(counter);
        getProject().executeTarget(target);
        for (int i=0; i < messages.length; i++) {
            assertEquals("target "+target+":message "+ i, expectedCounts[i], counter.getMatchCount(messages[i]));
        }

    
private voidperformConfigTest(java.lang.String target, int[] expectedCounts)

        String[] messages = new String[]{
                "custom configuration",
                "custom config: system key = default (UNIX)",
                "custom config: system key = UNIX",
                "custom config: server time zone ID = " + getProject().getProperty("ftp.server.timezone"),
                "custom config: system key = WINDOWS",
                "custom config: default date format = yyyy/MM/dd HH:mm",
                "custom config: server language code = de" 

        };
        LogCounter counter = new LogCounter();
        for (int i=0; i < messages.length; i++) {
            counter.addLogMessageToSearch(messages[i]);
        }
            
        getProject().addBuildListener(counter);
        getProject().executeTarget(target);
        for (int i=0; i < messages.length; i++) {
            assertEquals("target "+target+":message "+ i, expectedCounts[i], counter.getMatchCount(messages[i]));
        }
        
    
public voidsetUp()

        configureProject("src/etc/testcases/taskdefs/optional/net/ftp.xml");
        getProject().executeTarget("setup");
        tmpDir = getProject().getProperty("tmp.dir");
        ftp = new FTPClient();
        ftpFileSep = getProject().getProperty("ftp.filesep");
        myFTPTask.setSeparator(ftpFileSep);
        myFTPTask.setProject(getProject());
        remoteTmpDir = myFTPTask.resolveFile(tmpDir);
        String remoteHost = getProject().getProperty("ftp.host");
        int port = Integer.parseInt(getProject().getProperty("ftp.port"));
        String remoteUser = getProject().getProperty("ftp.user");
        String password = getProject().getProperty("ftp.password");
        try {
            ftp.connect(remoteHost, port);
        } catch (Exception ex) {
            connectionSucceeded = false;
            loginSuceeded = false;
            System.out.println("could not connect to host " + remoteHost + " on port " + port);
        }
        if (connectionSucceeded) {
            try {
                ftp.login(remoteUser, password);
            } catch (IOException ioe) {
                loginSuceeded = false;
                System.out.println("could not log on to " + remoteHost + " as user " + remoteUser);
            }
        }
    
public voidtearDown()

        try {
            ftp.disconnect();
        } catch (IOException ioe) {
            // do nothing
        }
        getProject().executeTarget("cleanup");
    
public voidtest1()

        if (loginSuceeded) {
            if (changeRemoteDir(remoteTmpDir))  {
                FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
                ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
                ds.setIncludes(new String[] {"alpha"});
                ds.scan();
                compareFiles(ds, new String[] {} ,new String[] {"alpha"});
            }
        }
    
public voidtest2()

        if (loginSuceeded) {
            if (changeRemoteDir(remoteTmpDir)) {
                FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
                ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
                ds.setIncludes(new String[] {"alpha/"});
                ds.scan();
                compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                               "alpha/beta/gamma/gamma.xml"},
                    new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
            }
        }
    
public voidtest2ButCaseInsensitive()

        if (loginSuceeded) {
            if (changeRemoteDir(remoteTmpDir)) {
                FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
                ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
                ds.setIncludes(new String[] {"ALPHA/"});
                ds.setCaseSensitive(false);
                ds.scan();
                compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                               "alpha/beta/gamma/gamma.xml"},
                    new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
            }
        }
    
public voidtest2bisButCaseInsensitive()

        if (loginSuceeded) {
            if (changeRemoteDir(remoteTmpDir)) {
                FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
                ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
                ds.setIncludes(new String[] {"alpha/BETA/gamma/"});
                ds.setCaseSensitive(false);
                ds.scan();
                compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                    new String[] {"alpha/beta/gamma"});
            }
        }
    
public voidtest3()

        if (loginSuceeded) {
            if (changeRemoteDir(remoteTmpDir)) {
                FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
                ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
                ds.scan();
                compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                               "alpha/beta/gamma/gamma.xml"},
                    new String[] {"alpha", "alpha/beta",
                                  "alpha/beta/gamma"});
            }
        }
    
public voidtestAllowSymlinks()

        if (!supportsSymlinks) {
            return;
        }
        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        getProject().executeTarget("symlink-setup");
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
        ds.setFollowSymlinks(true);
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                     new String[] {"alpha/beta/gamma"});
    
public voidtestAlternateExcludeInclude()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setExcludes(new String[] {
            "alpha/**",
            "alpha/beta/gamma/**"
        });
        ds.setIncludes(new String[] {
            "alpha/beta/**"
        });
        ds.scan();
        compareFiles(ds, new String[] {},
                     new String[] {});

    
public voidtestAlternateIncludeExclude()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {
            "alpha/**",
            "alpha/beta/gamma/**"
        });
        ds.setExcludes(new String[] {
            "alpha/beta/**"
        });
        ds.scan();
        compareFiles(ds, new String[] {},
                     new String[] {"alpha"});

    
public voidtestChildrenOfExcludedDirectory()
Test inspired by Bug#1415.

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        getProject().executeTarget("children-of-excluded-dir-setup");
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setExcludes(new String[] {"alpha/**"});
        ds.scan();
        compareFiles(ds, new String[] {"delta/delta.xml"},
                    new String[] {"delta"});

        ds = myFTPTask.newScanner(ftp);
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setExcludes(new String[] {"alpha"});
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                       "alpha/beta/gamma/gamma.xml",
                                        "delta/delta.xml"},
                     new String[] {"alpha/beta", "alpha/beta/gamma", "delta"});

    
public voidtestConfiguration1()
Tests that the presence of one of the server config params forces the system type to Unix if not specified.

        int[] expectedCounts = {
                1,1,0,1,0,0,0
        };
        performConfigTest("configuration.1", expectedCounts);
        
    
public voidtestConfiguration2()
Tests the systemTypeKey attribute.

        int[] expectedCounts = {
                1,0,0,1,1,0,0
        };
        performConfigTest("configuration.2", expectedCounts);
        
    
public voidtestConfiguration3()
Tests the systemTypeKey attribute with UNIX specified.

        int[] expectedCounts = {
                1,0,1,0,0,1,0
        };
        performConfigTest("configuration.3", expectedCounts);
        
    
public voidtestConfigurationLang()

        int[] expectedCounts = {
                1,1,0,0,0,0,1
        };
        performConfigTest("configuration.lang.good", expectedCounts);
        
        try {
            performConfigTest("configuration.lang.bad", expectedCounts);
            fail("BuildException Expected");
        } catch (Exception bx) {
            assertTrue(bx instanceof BuildException); 
        }
    
public voidtestConfigurationNone()
Tests the systemTypeKey attribute.

        int[] expectedCounts = {
                0,0,0,0,0,0,0
        };
        performConfigTest("configuration.none", expectedCounts);
 
    
public voidtestExcludeHasPrecedence()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {
            "alpha/**"
        });
        ds.setExcludes(new String[] {
            "alpha/**"
        });
        ds.scan();
        compareFiles(ds, new String[] {},
                     new String[] {});

    
public voidtestExcludeOneFile()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {
            "**/*.xml"
        });
        ds.setExcludes(new String[] {
            "alpha/beta/b*xml"
        });
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                     new String[] {});
    
public voidtestFTPDelete()
this test is inspired by a user reporting that deletions of directories with the ftp task do not work

        getProject().executeTarget("ftp-delete");
    
public voidtestFileSymlink()

        if (!supportsSymlinks) {
            return;
        }
        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        getProject().executeTarget("symlink-file-setup");
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
        ds.setFollowSymlinks(true);
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                     new String[] {"alpha/beta/gamma"});
    
public voidtestFullPathMatchesCaseInsensitive()

        if (loginSuceeded) {
            if (changeRemoteDir(remoteTmpDir)) {
                FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
                ds.setCaseSensitive(false);
                ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
                ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
                ds.scan();
                compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                    new String[] {});
            }
        }
    
public voidtestFullPathMatchesCaseSensitive()

        if (loginSuceeded) {
            if (changeRemoteDir(remoteTmpDir)) {
                FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
                ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
                ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
                ds.scan();
                compareFiles(ds, new String[] {}, new String[] {});
            }
        }
    
public voidtestFullpathDiffersInCaseScanningInsensitive()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {
            "alpha/beta/gamma/gamma.xml",
            "alpha/beta/gamma/GAMMA.XML"
        });
        ds.setCaseSensitive(false);
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                     new String[] {});
    
public voidtestFullpathDiffersInCaseScanningSensitive()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {
            "alpha/beta/gamma/gamma.xml",
            "alpha/beta/gamma/GAMMA.XML"
        });
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                     new String[] {});
    
public voidtestGetFollowSymlinksFalse()

        if (!supportsSymlinks) {
            return;
        }
        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        getProject().executeTarget("ftp-get-directory-no-symbolic-link");
        FileSet fsDestination = (FileSet) getProject().getReference("fileset-destination-without-selector");
        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(getProject());
        dsDestination.scan();
        compareFiles(dsDestination, new String[] {},
            new String[] {});
    
public voidtestGetFollowSymlinksTrue()

        if (!supportsSymlinks) {
            return;
        }
        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        getProject().executeTarget("ftp-get-directory-symbolic-link");
        FileSet fsDestination = (FileSet) getProject().getReference("fileset-destination-without-selector");
        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(getProject());
        dsDestination.scan();
        compareFiles(dsDestination, new String[] {"alpha/beta/gamma/gamma.xml"},
            new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
    
public voidtestGetWithSelector()

        expectLogContaining("ftp-get-with-selector",
            "selectors are not supported in remote filesets");
        FileSet fsDestination = (FileSet) getProject().getReference("fileset-destination-without-selector");
        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(getProject());
        dsDestination.scan();
        String [] sortedDestinationDirectories = dsDestination.getIncludedDirectories();
        String [] sortedDestinationFiles = dsDestination.getIncludedFiles();
        for (int counter = 0; counter < sortedDestinationDirectories.length; counter++) {
            sortedDestinationDirectories[counter] =
                sortedDestinationDirectories[counter].replace(File.separatorChar, '/");
        }
        for (int counter = 0; counter < sortedDestinationFiles.length; counter++) {
            sortedDestinationFiles[counter] =
                sortedDestinationFiles[counter].replace(File.separatorChar, '/");
        }
        FileSet fsSource =  (FileSet) getProject().getReference("fileset-source-without-selector");
        DirectoryScanner dsSource = fsSource.getDirectoryScanner(getProject());
        dsSource.scan();
        compareFiles(dsSource, sortedDestinationFiles, sortedDestinationDirectories);
    
public voidtestGetWithSelectorRetryable1()

        getProject().addTaskDefinition("ftp", oneFailureFTP.class);
        try {
            getProject().executeTarget("ftp-get-with-selector-retryable");
        } catch (BuildException bx) {
            fail("Two retries expected, failed after one.");
        }
    
public voidtestGetWithSelectorRetryable2()

        getProject().addTaskDefinition("ftp", twoFailureFTP.class);
        try {
            getProject().executeTarget("ftp-get-with-selector-retryable");
        } catch (BuildException bx) {
            fail("Two retries expected, failed after two.");
        }
    
public voidtestGetWithSelectorRetryable3()

        getProject().addTaskDefinition("ftp", threeFailureFTP.class);
        try {
            getProject().executeTarget("ftp-get-with-selector-retryable");
            fail("Two retries expected, continued after two.");
        } catch (BuildException bx) {
        }
    
public voidtestGetWithSelectorRetryableRandom()

        getProject().addTaskDefinition("ftp", randomFailureFTP.class);
        try {
            getProject().setProperty("ftp.retries", "forever");
            getProject().executeTarget("ftp-get-with-selector-retryable");
        } catch (BuildException bx) {
            fail("Retry forever specified, but failed.");
        }
    
public voidtestInitialCommand()

        performCommandTest("test-initial-command", new int[] { 1,0 });
    
public voidtestOrderOfIncludePatternsIrrelevant()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        String [] expectedFiles = {"alpha/beta/beta.xml",
                                   "alpha/beta/gamma/gamma.xml"};
        String [] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" };
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/be?a/**", "alpha/beta/gamma/"});
        ds.scan();
        compareFiles(ds, expectedFiles, expectedDirectories);
        // redo the test, but the 2 include patterns are inverted
        ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/beta/gamma/", "alpha/be?a/**"});
        ds.scan();
        compareFiles(ds, expectedFiles, expectedDirectories);
    
public voidtestParentDiffersInCaseScanningInsensitive()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
        ds.setCaseSensitive(false);
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                       "alpha/beta/gamma/gamma.xml"},
                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
    
public voidtestParentDiffersInCaseScanningSensitive()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                       "alpha/beta/gamma/gamma.xml"},
                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
    
public voidtestPatternsDifferInCaseScanningInsensitive()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
        ds.setCaseSensitive(false);
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                       "alpha/beta/gamma/gamma.xml"},
                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
    
public voidtestPatternsDifferInCaseScanningSensitive()

        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
        ds.scan();
        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                       "alpha/beta/gamma/gamma.xml"},
                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
    
public voidtestProhibitSymlinks()

        if (!supportsSymlinks) {
            return;
        }
        if (!loginSuceeded) {
            return;
        }
        if (!changeRemoteDir(remoteTmpDir)) {
            return;
        }
        getProject().executeTarget("symlink-setup");
        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
        ds.setFollowSymlinks(false);
        ds.scan();
        compareFiles(ds, new String[] {}, new String[] {});
    
public voidtestSiteAction()

        performCommandTest("test-site-action", new int[] { 1,0 });
    
public voidtestTimezoneGet()
Tests the combination of the newer parameter and the serverTimezoneConfig parameter in the GET action. The default configuration is an ftp server on localhost which formats timestamps as GMT.

        CountLogListener log = new CountLogListener("(\\d+) files? retrieved");
        getProject().executeTarget("timed.test.setup");
        getProject().addBuildListener(log);
        getProject().executeTarget("timed.test.get.older");
        assertEquals(3, log.getCount());
    
public voidtestTimezonePut()
Tests the combination of the newer parameter and the serverTimezoneConfig parameter in the PUT action. The default configuration is an ftp server on localhost which formats timestamps as GMT.

        CountLogListener log = new CountLogListener("(\\d+) files? sent");
        getProject().executeTarget("timed.test.setup");
        getProject().addBuildListener(log);
        getProject().executeTarget("timed.test.put.older");
        assertEquals(1, log.getCount());