ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: ant/src/etc/testcases/taskdefs/optional/net ftp.xml
Date Mon, 13 Oct 2003 19:53:01 GMT
antoine     2003/10/13 12:53:01

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
               src/testcases/org/apache/tools/ant/taskdefs/optional/net
                        FTPTest.java
               src/etc/testcases/taskdefs/optional/net ftp.xml
  Log:
  Merge from ANT_16_BRANCH
  
  Revision  Changes    Path
  1.53      +28 -24    ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- FTP.java	12 Sep 2003 20:32:29 -0000	1.52
  +++ FTP.java	13 Oct 2003 19:53:01 -0000	1.53
  @@ -1357,30 +1357,34 @@
                   }
                   bw = new BufferedWriter(new FileWriter(listing));
               }
  -
  -            for (int i = 0; i < dsfiles.length; i++) {
  -                switch (action) {
  -                    case SEND_FILES:
  -                        sendFile(ftp, dir, dsfiles[i]);
  -                        break;
  -                    case GET_FILES:
  -                        getFile(ftp, dir, dsfiles[i]);
  -                        break;
  -                    case DEL_FILES:
  -                        delFile(ftp, dsfiles[i]);
  -                        break;
  -                    case LIST_FILES:
  -                        listFile(ftp, bw, dsfiles[i]);
  -                        break;
  -                    case CHMOD:
  -                        doSiteCommand(ftp, "chmod " + chmod + " " + resolveFile(dsfiles[i]));
  -                        transferred++;
  -                        break;
  -                    case RM_DIR:
  -                        rmDir(ftp, dsfiles[i]);
  -                        break;
  -                    default:
  -                        throw new BuildException("unknown ftp action " + action);
  +            if (action == RM_DIR) {
  +                // to remove directories, start by the end of the list
  +                // the trunk does not let itself be removed before the leaves
  +                for (int i = dsfiles.length - 1; i >= 0; i--) {
  +                    rmDir(ftp, dsfiles[i]);
  +                }
  +            }   else {
  +                for (int i = 0; i < dsfiles.length; i++) {
  +                    switch (action) {
  +                        case SEND_FILES:
  +                            sendFile(ftp, dir, dsfiles[i]);
  +                            break;
  +                        case GET_FILES:
  +                            getFile(ftp, dir, dsfiles[i]);
  +                            break;
  +                        case DEL_FILES:
  +                            delFile(ftp, dsfiles[i]);
  +                            break;
  +                        case LIST_FILES:
  +                            listFile(ftp, bw, dsfiles[i]);
  +                            break;
  +                        case CHMOD:
  +                            doSiteCommand(ftp, "chmod " + chmod + " " + resolveFile(dsfiles[i]));
  +                            transferred++;
  +                            break;
  +                        default:
  +                            throw new BuildException("unknown ftp action " + action);
  +                    }
                   }
               }
           } finally {
  
  
  
  1.9       +6 -1      ant/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
  
  Index: FTPTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FTPTest.java	22 Aug 2003 10:48:08 -0000	1.8
  +++ FTPTest.java	13 Oct 2003 19:53:01 -0000	1.9
  @@ -570,7 +570,12 @@
                        new String[] {"alpha/beta", "alpha/beta/gamma", "delta"});
   
       }
  -
  +    /**
  +     *  this test is inspired by a user reporting that deletions of directories with the
ftp task do not work
  +     */
  +    public void testFTPDelete() {
  +        getProject().executeTarget("ftp-delete");
  +    }
       private void compareFiles(DirectoryScanner ds, String[] expectedFiles,
                                 String[] expectedDirectories) {
           String includedFiles[] = ds.getIncludedFiles();
  
  
  
  1.6       +23 -0     ant/src/etc/testcases/taskdefs/optional/net/ftp.xml
  
  Index: ftp.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/optional/net/ftp.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ftp.xml	14 Aug 2003 17:23:22 -0000	1.5
  +++ ftp.xml	13 Oct 2003 19:53:01 -0000	1.6
  @@ -77,4 +77,27 @@
           <symlink link="${tmp.dir}/alpha/beta/gamma/gamma.xml"
               resource="${tmp.dir}/alpha/beta/beta.xml"/>
       </target>
  +    <target name="ftp-delete">
  +        <!-- this target can produce an error if the rmdir does not work -->
  +        <!-- there can be problems with the rmdir action if the directories are not
removed in a proper order -->
  +        <!-- which means beginning by the leaves of the tree, going back to the trunk
-->
  +        <ftp action="del"
  +            server="${ftp.host}"
  +            userid="${ftp.user}"
  +            password="${ftp.password}"
  +            remotedir="${tmp.dir}">
  +            <fileset dir="${tmp.get.dir}">
  +                <include name="**"/>
  +            </fileset>
  +        </ftp>
  +        <ftp action="rmdir"
  +            server="${ftp.host}"
  +            userid="${ftp.user}"
  +            password="${ftp.password}"
  +            remotedir="${tmp.dir}">
  +            <fileset dir="${tmp.get.dir}">
  +                <include name="**"/>
  +            </fileset>
  +        </ftp>
  +    </target>
   </project>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message