ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant DirectoryScannerTest.java
Date Wed, 16 Jul 2003 13:34:14 GMT
bodewig     2003/07/16 06:34:14

  Modified:    src/etc/testcases/core directoryscanner.xml
               src/testcases/org/apache/tools/ant DirectoryScannerTest.java
  Log:
  Demonstrate symlink problem.
  
  With includes="alpha/beta/gamma", gamma must not be scanned if beta is
  a symlink.
  
  Fix is in the works.
  
  Revision  Changes    Path
  1.2       +7 -3      ant/src/etc/testcases/core/directoryscanner.xml
  
  Index: directoryscanner.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/core/directoryscanner.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- directoryscanner.xml	11 Jul 2003 12:59:29 -0000	1.1
  +++ directoryscanner.xml	16 Jul 2003 13:34:14 -0000	1.2
  @@ -1,14 +1,18 @@
   <project name="directoryscanner-test" basedir=".">
       <property name="tmp.dir" location="tmp"/>
       <target name="setup">
  -        <mkdir dir="${tmp.dir}"/>
  -        <mkdir dir="${tmp.dir}/alpha"/>
  -        <mkdir dir="${tmp.dir}/alpha/beta"/>
           <mkdir dir="${tmp.dir}/alpha/beta/gamma"/>
           <touch file="${tmp.dir}/alpha/beta/gamma/gamma.xml"/>
           <touch file="${tmp.dir}/alpha/beta/beta.xml"/>
       </target>
       <target name="cleanup">
           <delete dir="${tmp.dir}" quiet="true"/>
  +    </target>
  +
  +    <target name="symlink-setup" depends="setup">
  +        <mkdir dir="${tmp.dir}/epsilon/gamma"/>
  +        <delete dir="${tmp.dir}/alpha/beta"/>
  +        <symlink link="${tmp.dir}/alpha/beta" resource="${tmp.dir}/epsilon"/>
  +        <touch file="${tmp.dir}/alpha/beta/gamma/gamma.xml"/>
       </target>
   </project>
  
  
  
  1.15      +28 -0     ant/src/testcases/org/apache/tools/ant/DirectoryScannerTest.java
  
  Index: DirectoryScannerTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/DirectoryScannerTest.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DirectoryScannerTest.java	16 Jul 2003 11:09:19 -0000	1.14
  +++ DirectoryScannerTest.java	16 Jul 2003 13:34:14 -0000	1.15
  @@ -144,6 +144,34 @@
                        new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
       }
   
  +    public void testAllowSymlinks() {
  +        if (!supportsSymlinks) {
  +            return;
  +        }
  +        
  +        getProject().executeTarget("symlink-setup");
  +        DirectoryScanner ds = new DirectoryScanner();
  +        ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
  +        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
  +        ds.scan();
  +        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
  +                     new String[] {"alpha/beta/gamma"});
  +    }
  +
  +    public void testProhibitSymlinks() {
  +        if (!supportsSymlinks) {
  +            return;
  +        }
  +        
  +        getProject().executeTarget("symlink-setup");
  +        DirectoryScanner ds = new DirectoryScanner();
  +        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[] {});
  +    }
  +
       // father and child pattern test
       public void testOrderOfIncludePatternsIrrelevant() {
           String [] expectedFiles = {"alpha/beta/beta.xml", 
  
  
  

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


Mime
View raw message