ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs ImportTest.java
Date Fri, 04 Jun 2004 12:09:38 GMT
peterreilly    2004/06/04 05:09:38

  Modified:    src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
                        ImportTask.java
               src/testcases/org/apache/tools/ant/taskdefs Tag:
                        ANT_16_BRANCH ImportTest.java
  Added:       src/etc/testcases/taskdefs/import/symlinks/d1 Tag:
                        ANT_16_BRANCH p1.xml
               src/etc/testcases/taskdefs/import/symlinks/d2 Tag:
                        ANT_16_BRANCH p2.xml
               src/etc/testcases/taskdefs/import/symlinks/d3a Tag:
                        ANT_16_BRANCH p3.xml
  Log:
  Sync the import canonical change - 28505
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.16.2.11 +0 -9      ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java
  
  Index: ImportTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java,v
  retrieving revision 1.16.2.10
  retrieving revision 1.16.2.11
  diff -u -r1.16.2.10 -r1.16.2.11
  --- ImportTask.java	14 Apr 2004 08:21:35 -0000	1.16.2.10
  +++ ImportTask.java	4 Jun 2004 12:09:38 -0000	1.16.2.11
  @@ -131,8 +131,6 @@
               }
           }
   
  -        importedFile = new File(getPath(importedFile));
  -
           if (importStack.contains(importedFile)) {
               getProject().log(
                   "Skipped already imported file:\n   "
  @@ -148,11 +146,4 @@
           }
       }
   
  -    private static String getPath(File file) {
  -        try {
  -            return file.getCanonicalPath();
  -        } catch (IOException e) {
  -            return file.getAbsolutePath();
  -        }
  -    }
   }
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +0 -0      ant/src/etc/testcases/taskdefs/import/symlinks/d1/p1.xml
  
  Index: p1.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/import/symlinks/d1/p1.xml,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +0 -0      ant/src/etc/testcases/taskdefs/import/symlinks/d2/p2.xml
  
  Index: p2.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/import/symlinks/d2/p2.xml,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +0 -0      ant/src/etc/testcases/taskdefs/import/symlinks/d3a/p3.xml
  
  Index: p3.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/import/symlinks/d3a/p3.xml,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  
  
  
  No                   revision
  No                   revision
  1.6.2.6   +39 -3     ant/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java
  
  Index: ImportTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java,v
  retrieving revision 1.6.2.5
  retrieving revision 1.6.2.6
  diff -u -r1.6.2.5 -r1.6.2.6
  --- ImportTest.java	9 Mar 2004 17:02:01 -0000	1.6.2.5
  +++ ImportTest.java	4 Jun 2004 12:09:38 -0000	1.6.2.6
  @@ -17,6 +17,9 @@
   
   package org.apache.tools.ant.taskdefs;
   
  +import java.io.File;
  +import java.io.IOException;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.BuildFileTest;
   import org.apache.tools.ant.Location;
  @@ -51,8 +54,12 @@
   
       public void testSerial() {
           configureProject("src/etc/testcases/taskdefs/import/subdir/serial.xml");
  -        assertLogContaining(
  -            "Unnamed2.xmlUnnamed1.xmlSkipped already imported file");
  +        assertLogContaining("Unnamed2.xmlUnnamed1.xml");
  +        String fullLog = getFullLog();
  +        String substring = "Skipped already imported file";
  +        assertTrue("expecting full log to contain \"" + substring
  +            + "\" full log was \"" + fullLog + "\"",
  +            fullLog.indexOf(substring) >= 0);
       }
   
       // allow this as imported in targets are only tested when a target is run
  @@ -105,5 +112,34 @@
               "Did not see build exception",
               false);
       }
  -}
   
  +    public void testSymlinkedImports() throws Exception {
  +        String ln = "/usr/bin/ln";
  +        if (!new File(ln).exists()) {
  +            ln = "/bin/ln";
  +        }
  +        if (!new File(ln).exists()) {
  +            // Running on Windows or something, so skip it.
  +            return;
  +        }
  +        String symlink = "src/etc/testcases/taskdefs/import/symlinks/d3b";
  +        if (Runtime.getRuntime().exec(new String[] {ln, "-s", "d3a", symlink}).waitFor()
!= 0) {
  +            throw new IOException("'" + ln + " -s d3a " + symlink + "' failed");
  +        }
  +        try {
  +            configureProject(
  +                "src/etc/testcases/taskdefs/import/symlinks/d1/p1.xml");
  +            assertPropertyEquals(
  +                "ant.file.p2",
  +                new File("src/etc/testcases/taskdefs/import/symlinks/d2/p2.xml")
  +                .getAbsolutePath());
  +            assertPropertyEquals(
  +                "ant.file.p3",
  +                new File("src/etc/testcases/taskdefs/import/symlinks/d3b/p3.xml")
  +                .getAbsolutePath());
  +        } finally {
  +            new File(symlink).delete();
  +        }
  +    }
  +
  +}
  
  
  

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


Mime
View raw message