ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject cvs commit: ant build.xml
Date Tue, 07 Dec 2004 09:10:39 GMT
jglick      2004/12/07 01:10:39

  Modified:    src/testcases/org/apache/tools/ant/util FileUtilsTest.java
               src/testcases/org/apache/tools/ant/types/selectors
                        PresentSelectorTest.java BaseSelectorTest.java
               src/testcases/org/apache/tools/ant/types XMLCatalogTest.java
                        PathTest.java FilterSetTest.java
                        CommandlineJavaTest.java
               src/testcases/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitReportTest.java
               src/testcases/org/apache/tools/ant/taskdefs/optional/i18n
                        TranslateTest.java
               src/testcases/org/apache/tools/ant/taskdefs/optional
                        ReplaceRegExpTest.java PropertyFileTest.java
                        JspcTest.java ANTLRTest.java
               src/testcases/org/apache/tools/ant/taskdefs
                        XmlPropertyTest.java TouchTest.java TarTest.java
                        ManifestTest.java InitializeClassTest.java
                        ImportTest.java FixCrLfTest.java ExecTaskTest.java
               src/testcases/org/apache/tools/ant DirectoryScannerTest.java
                        BuildFileTest.java
               .        build.xml
  Log:
  Trying to make unit tests independent of CWD.
  
  Revision  Changes    Path
  1.30      +13 -8     ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
  
  Index: FileUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- FileUtilsTest.java	8 Aug 2004 21:03:21 -0000	1.29
  +++ FileUtilsTest.java	7 Dec 2004 09:10:38 -0000	1.30
  @@ -322,18 +322,18 @@
        * Test contentEquals
        */
       public void testContentEquals() throws IOException {
  -        assertTrue("Non existing files", fu.contentEquals(new File("foo"),
  -                                                          new File("bar")));
  +        assertTrue("Non existing files", fu.contentEquals(new File(System.getProperty("root"),
"foo"),
  +                                                          new File(System.getProperty("root"),
"bar")));
           assertTrue("One exists, the other one doesn\'t",
  -                   !fu.contentEquals(new File("foo"), new File("build.xml")));
  +                   !fu.contentEquals(new File(System.getProperty("root"), "foo"), new File(System.getProperty("root"),
"build.xml")));
           assertTrue("Don\'t compare directories",
  -                   !fu.contentEquals(new File("src"), new File("src")));
  +                   !fu.contentEquals(new File(System.getProperty("root"), "src"), new File(System.getProperty("root"),
"src")));
           assertTrue("File equals itself",
  -                   fu.contentEquals(new File("build.xml"),
  -                                    new File("build.xml")));
  +                   fu.contentEquals(new File(System.getProperty("root"), "build.xml"),
  +                                    new File(System.getProperty("root"), "build.xml")));
           assertTrue("Files are different",
  -                   !fu.contentEquals(new File("build.xml"),
  -                                     new File("docs.xml")));
  +                   !fu.contentEquals(new File(System.getProperty("root"), "build.xml"),
  +                                     new File(System.getProperty("root"), "docs.xml")));
       }
   
       /**
  @@ -409,9 +409,14 @@
               assertEquals("file:///SYS:/foo", fu.toURI("sys:\\foo"));
           }
           assertEquals("file:///" + dosRoot + "foo", fu.toURI("/foo"));
  +        /* May fail if the directory ${user.dir}/foo/ exists
  +         * (and anyway is the tested behavior actually desirable?):
           assertEquals("file:./foo",  fu.toURI("./foo"));
  +         */
           assertEquals("file:///" + dosRoot + "foo", fu.toURI("\\foo"));
  +        /* See above:
           assertEquals("file:./foo",  fu.toURI(".\\foo"));
  +         */
           assertEquals("file:///" + dosRoot + "foo%20bar", fu.toURI("/foo bar"));
           assertEquals("file:///" + dosRoot + "foo%20bar", fu.toURI("\\foo bar"));
           assertEquals("file:///" + dosRoot + "foo%23bar", fu.toURI("/foo#bar"));
  
  
  
  1.9       +1 -1      ant/src/testcases/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
  
  Index: PresentSelectorTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/types/selectors/PresentSelectorTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PresentSelectorTest.java	9 Mar 2004 16:49:07 -0000	1.8
  +++ PresentSelectorTest.java	7 Dec 2004 09:10:38 -0000	1.9
  @@ -108,7 +108,7 @@
               assertEquals("TTTTTTTTTTTT", results);
   
               s = (PresentSelector)getInstance();
  -            File subdir = new File("src/etc/testcases/taskdefs/expected");
  +            File subdir = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/expected");
               s.setTargetdir(subdir);
               m = s.createMapper();
               m.setType(flatten);
  
  
  
  1.12      +3 -3      ant/src/testcases/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
  
  Index: BaseSelectorTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/types/selectors/BaseSelectorTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- BaseSelectorTest.java	9 Mar 2004 16:49:06 -0000	1.11
  +++ BaseSelectorTest.java	7 Dec 2004 09:10:38 -0000	1.12
  @@ -39,9 +39,9 @@
       protected String basedirname = "src/etc/testcases/types";
       protected String beddirname = basedirname + "/selectortest";
       protected String mirrordirname = basedirname + "/selectortest2";
  -    protected File basedir = new File(basedirname);
  -    protected File beddir = new File(beddirname);
  -    protected File mirrordir = new File(mirrordirname);
  +    protected File basedir = new File(System.getProperty("root"), basedirname);
  +    protected File beddir = new File(System.getProperty("root"), beddirname);
  +    protected File mirrordir = new File(System.getProperty("root"), mirrordirname);
       protected String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
               "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
               "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
  
  
  
  1.13      +2 -2      ant/src/testcases/org/apache/tools/ant/types/XMLCatalogTest.java
  
  Index: XMLCatalogTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/types/XMLCatalogTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XMLCatalogTest.java	9 Mar 2004 16:49:05 -0000	1.12
  +++ XMLCatalogTest.java	7 Dec 2004 09:10:38 -0000	1.13
  @@ -61,7 +61,7 @@
   
       public void setUp() {
           project = new Project();
  -        project.setBasedir(".");
  +        project.setBasedir(System.getProperty("root"));
   
           // This causes XMLCatalog to print out detailed logging
           // messages for debugging
  @@ -206,7 +206,7 @@
           ResourceLocation dtd = new ResourceLocation();
           dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
   
  -        String sysid = System.getProperty("user.dir") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
  +        String sysid = System.getProperty("root") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
           dtd.setLocation(sysid);
           catalog.addDTD(dtd);
           File dtdFile = project.resolveFile(sysid);
  
  
  
  1.25      +2 -2      ant/src/testcases/org/apache/tools/ant/types/PathTest.java
  
  Index: PathTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/types/PathTest.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- PathTest.java	9 Mar 2004 16:49:05 -0000	1.24
  +++ PathTest.java	7 Dec 2004 09:10:38 -0000	1.25
  @@ -45,7 +45,7 @@
   
       public void setUp() {
           project = new Project();
  -        project.setBasedir(".");
  +        project.setBasedir(System.getProperty("root"));
       }
   
       // actually tests constructor as well as setPath
  @@ -66,7 +66,7 @@
       }
   
       public void testRelativePathUnixStyle() {
  -        project.setBasedir("src/etc");
  +        project.setBasedir(new File(System.getProperty("root"), "src/etc").getAbsolutePath());
           Path p = new Path(project, "..:testcases");
           String[] l = p.list();
           assertEquals("two items, Unix style", 2, l.length);
  
  
  
  1.14      +2 -2      ant/src/testcases/org/apache/tools/ant/types/FilterSetTest.java
  
  Index: FilterSetTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/types/FilterSetTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- FilterSetTest.java	9 Mar 2004 16:49:05 -0000	1.13
  +++ FilterSetTest.java	7 Dec 2004 09:10:38 -0000	1.14
  @@ -125,8 +125,8 @@
       }
   
       private boolean compareFiles(String name1, String name2) {
  -        File file1 = new File(name1);
  -        File file2 = new File(name2);
  +        File file1 = new File(System.getProperty("root"), name1);
  +        File file2 = new File(System.getProperty("root"), name2);
   
           try {
               if (!file1.exists() || !file2.exists()) {
  
  
  
  1.26      +1 -1      ant/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java
  
  Index: CommandlineJavaTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- CommandlineJavaTest.java	7 Oct 2004 10:59:45 -0000	1.25
  +++ CommandlineJavaTest.java	7 Dec 2004 09:10:38 -0000	1.26
  @@ -37,7 +37,7 @@
   
       public void setUp() {
           project = new Project();
  -        project.setBasedir(".");
  +        project.setBasedir(System.getProperty("root"));
           project.setProperty("build.sysclasspath", "ignore");
           cloneVm = System.getProperty("build.clonevm");
           if (cloneVm != null) {
  
  
  
  1.7       +1 -1      ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
  
  Index: JUnitReportTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JUnitReportTest.java	9 Mar 2004 16:49:02 -0000	1.6
  +++ JUnitReportTest.java	7 Dec 2004 09:10:38 -0000	1.7
  @@ -46,7 +46,7 @@
        */
       public void testNoFileJUnitNoFrames() {
           executeTarget("reports1");
  -        if (new File("src/etc/testcases/taskdefs/optional/junitreport/test/html/junit-noframes.html").exists())
  +        if (new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/junit-noframes.html").exists())
           {
               fail("No file junit-noframes.html expected");
           }
  
  
  
  1.6       +2 -2      ant/src/testcases/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
  
  Index: TranslateTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TranslateTest.java	9 Mar 2004 16:49:02 -0000	1.5
  +++ TranslateTest.java	7 Dec 2004 09:10:38 -0000	1.6
  @@ -51,8 +51,8 @@
           assertTrue("translation of "+ TASKDEFS_DIR + "/input/template.txt",compareFiles(TASKDEFS_DIR+"/expected/de/template.txt",TASKDEFS_DIR+"/output/de/template.txt"));
       }
       private boolean compareFiles(String name1, String name2) {
  -        File file1 = new File(name1);
  -        File file2 = new File(name2);
  +        File file1 = new File(System.getProperty("root"), name1);
  +        File file2 = new File(System.getProperty("root"), name2);
   
           try {
               if (!file1.exists() || !file2.exists()) {
  
  
  
  1.13      +8 -8      ant/src/testcases/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
  
  Index: ReplaceRegExpTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ReplaceRegExpTest.java	9 Mar 2004 16:49:01 -0000	1.12
  +++ ReplaceRegExpTest.java	7 Dec 2004 09:10:38 -0000	1.13
  @@ -47,7 +47,7 @@
           Properties original = new Properties();
           FileInputStream propsFile = null;
           try {
  -            propsFile = new FileInputStream(PROJECT_PATH + "/replaceregexp.properties");
  +            propsFile = new FileInputStream(new File(System.getProperty("root"), PROJECT_PATH
+ "/replaceregexp.properties"));
               original.load(propsFile);
           } finally {
               if (propsFile != null) {
  @@ -62,7 +62,7 @@
   
           Properties after = new Properties();
           try {
  -            propsFile = new FileInputStream(PROJECT_PATH + "/test.properties");
  +            propsFile = new FileInputStream(new File(System.getProperty("root"), PROJECT_PATH
+ "/test.properties"));
               after.load(propsFile);
           } finally {
               if (propsFile != null) {
  @@ -77,7 +77,7 @@
       // inspired by bug 22541
       public void testDirectoryDateDoesNotChange() {
           executeTarget("touchDirectory");
  -        File myFile = new File(PROJECT_PATH + "/" + getProject().getProperty("tmpregexp"));
  +        File myFile = new File(System.getProperty("root"), PROJECT_PATH + "/" + getProject().getProperty("tmpregexp"));
           long timeStampBefore = myFile.lastModified();
           executeTarget("testDirectoryDateDoesNotChange");
           long timeStampAfter = myFile.lastModified();
  @@ -88,16 +88,16 @@
           executeTarget("testDontAddNewline1");
           assertTrue("Files match",
                      FileUtils.newFileUtils()
  -                   .contentEquals(new File(PROJECT_PATH + "/test.properties"),
  -                                  new File(PROJECT_PATH + "/replaceregexp2.result.properties")));
  +                   .contentEquals(new File(System.getProperty("root"), PROJECT_PATH + "/test.properties"),
  +                                  new File(System.getProperty("root"), PROJECT_PATH + "/replaceregexp2.result.properties")));
       }
   
       public void testDontAddNewline2() throws IOException {
           executeTarget("testDontAddNewline2");
           assertTrue("Files match",
                      FileUtils.newFileUtils()
  -                   .contentEquals(new File(PROJECT_PATH + "/test.properties"),
  -                                  new File(PROJECT_PATH + "/replaceregexp2.result.properties")));
  +                   .contentEquals(new File(System.getProperty("root"), PROJECT_PATH + "/test.properties"),
  +                                  new File(System.getProperty("root"), PROJECT_PATH + "/replaceregexp2.result.properties")));
       }
   
   }// ReplaceRegExpTest
  
  
  
  1.14      +7 -7      ant/src/testcases/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
  
  Index: PropertyFileTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PropertyFileTest.java	9 Mar 2004 16:49:01 -0000	1.13
  +++ PropertyFileTest.java	7 Dec 2004 09:10:38 -0000	1.14
  @@ -117,7 +117,7 @@
       public void testDirect() throws Exception {
           PropertyFile pf = new PropertyFile();
           pf.setProject(project);
  -        pf.setFile(new File(testPropsFilePath));
  +        pf.setFile(new File(System.getProperty("root"), testPropsFilePath));
           PropertyFile.Entry entry = pf.createEntry();
   
           entry.setKey("date");
  @@ -139,7 +139,7 @@
   
       private Properties getTestProperties() throws Exception {
           Properties testProps = new Properties();
  -        FileInputStream propsFile = new FileInputStream(testPropsFilePath);
  +        FileInputStream propsFile = new FileInputStream(new File(System.getProperty("root"),
testPropsFilePath));
           testProps.load(propsFile);
           propsFile.close();
           return testProps;
  @@ -153,7 +153,7 @@
           testProps.put(EMAIL_KEY, EMAIL);
           testProps.put("existing.prop", "37");
   
  -        FileOutputStream fos = new FileOutputStream(testPropsFilePath);
  +        FileOutputStream fos = new FileOutputStream(new File(System.getProperty("root"),
testPropsFilePath));
           testProps.store(fos, "defaults");
           fos.close();
       }
  @@ -169,22 +169,22 @@
           buildProps.put(AGE_KEY, NEW_AGE);
           buildProps.put(DATE_KEY, NEW_DATE);
   
  -        FileOutputStream fos = new FileOutputStream(buildPropsFilePath);
  +        FileOutputStream fos = new FileOutputStream(new File(System.getProperty("root"),
buildPropsFilePath));
           buildProps.store(fos, null);
           fos.close();
       }
   
   
       private void destroyTempFiles() {
  -        File tempFile = new File(testPropsFilePath);
  +        File tempFile = new File(System.getProperty("root"), testPropsFilePath);
           tempFile.delete();
           tempFile = null;
   
  -        tempFile = new File(buildPropsFilePath);
  +        tempFile = new File(System.getProperty("root"), buildPropsFilePath);
           tempFile.delete();
           tempFile = null;
   
  -        tempFile = new File(valueDoesNotGetOverwrittenPropsFilePath);
  +        tempFile = new File(System.getProperty("root"), valueDoesNotGetOverwrittenPropsFilePath);
           tempFile.delete();
           tempFile = null;
       }
  
  
  
  1.11      +1 -1      ant/src/testcases/org/apache/tools/ant/taskdefs/optional/JspcTest.java
  
  Index: JspcTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/JspcTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JspcTest.java	9 Mar 2004 16:49:01 -0000	1.10
  +++ JspcTest.java	7 Dec 2004 09:10:38 -0000	1.11
  @@ -64,7 +64,7 @@
        */
       public void setUp() {
           configureProject(TASKDEFS_DIR + "jspc.xml");
  -        baseDir = new File(TASKDEFS_DIR);
  +        baseDir = new File(System.getProperty("root"), TASKDEFS_DIR);
           outDir = new File(baseDir, "jsp/java");
       }
   
  
  
  
  1.18      +2 -2      ant/src/testcases/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
  
  Index: ANTLRTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ANTLRTest.java	9 Mar 2004 16:49:01 -0000	1.17
  +++ ANTLRTest.java	7 Dec 2004 09:10:38 -0000	1.18
  @@ -57,7 +57,7 @@
   
       public void test3() {
           executeTarget("test3");
  -        File outputDirectory = new File(TASKDEFS_DIR + "antlr.tmp");
  +        File outputDirectory = new File(System.getProperty("root"), TASKDEFS_DIR + "antlr.tmp");
           String[] calcFiles = outputDirectory.list(new CalcFileFilter());
           assertEquals(5, calcFiles.length);
       }
  @@ -101,7 +101,7 @@
        */
       public void test10() {
           executeTarget("test10");
  -        File outputDirectory = new File(TASKDEFS_DIR + "antlr.tmp");
  +        File outputDirectory = new File(System.getProperty("root"), TASKDEFS_DIR + "antlr.tmp");
           String[] calcFiles = outputDirectory.list(new HTMLFilter());
           assertTrue(calcFiles.length > 0);
       }
  
  
  
  1.14      +1 -1      ant/src/testcases/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
  
  Index: XmlPropertyTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/XmlPropertyTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XmlPropertyTest.java	10 Sep 2004 08:50:25 -0000	1.13
  +++ XmlPropertyTest.java	7 Dec 2004 09:10:38 -0000	1.14
  @@ -116,7 +116,7 @@
       private void doTest(String msg, boolean keepRoot, boolean collapse,
                           boolean semantic, boolean include, boolean localRoot) {
           Enumeration iter =
  -            getFiles(new File("src/etc/testcases/taskdefs/xmlproperty/inputs"));
  +            getFiles(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/xmlproperty/inputs"));
           while (iter.hasMoreElements()) {
               File inputFile = (File) iter.nextElement();
               // What's the working directory?  If local, then its the
  
  
  
  1.8       +3 -3      ant/src/testcases/org/apache/tools/ant/taskdefs/TouchTest.java
  
  Index: TouchTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/TouchTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TouchTest.java	9 Feb 2004 21:05:41 -0000	1.7
  +++ TouchTest.java	7 Dec 2004 09:10:38 -0000	1.8
  @@ -25,7 +25,7 @@
   
   public class TouchTest extends BuildFileTest {
   
  -    private static String touchfile="src/etc/testcases/taskdefs/touchtest";
  +    private static String TOUCH_FILE = "src/etc/testcases/taskdefs/touchtest";
   
       public TouchTest(String name) {
           super(name);
  @@ -41,9 +41,9 @@
   
       public long getTargetTime() {
   
  -        File file = new File(touchfile);
  +        File file = new File(System.getProperty("root"), TOUCH_FILE);
           if(!file.exists()) {
  -            throw new BuildException("failed to touch file "+touchfile);
  +            throw new BuildException("failed to touch file " + file);
           }
           return file.lastModified();
       }
  
  
  
  1.16      +14 -12    ant/src/testcases/org/apache/tools/ant/taskdefs/TarTest.java
  
  Index: TarTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/TarTest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TarTest.java	9 Mar 2004 16:48:57 -0000	1.15
  +++ TarTest.java	7 Dec 2004 09:10:38 -0000	1.16
  @@ -16,6 +16,8 @@
    */
   
   package org.apache.tools.ant.taskdefs;
  +
  +import java.io.File;
   import org.apache.tools.ant.BuildFileTest;
   
   /**
  @@ -48,8 +50,8 @@
   
       public void test5() {
           executeTarget("test5");
  -        java.io.File f
  -            = new java.io.File("src/etc/testcases/taskdefs/test5.tar");
  +        File f
  +            = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test5.tar");
   
           if (!f.exists()) {
               fail("Tarring a directory failed");
  @@ -62,15 +64,15 @@
   
       public void test7() {
           executeTarget("test7");
  -        java.io.File f1
  -            = new java.io.File("src/etc/testcases/taskdefs/test7-prefix");
  +        File f1
  +            = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test7-prefix");
   
           if (!(f1.exists() && f1.isDirectory())) {
               fail("The prefix attribute is not working properly.");
           }
   
  -        java.io.File f2
  -            = new java.io.File("src/etc/testcases/taskdefs/test7dir");
  +        File f2
  +            = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test7dir");
   
           if (!(f2.exists() && f2.isDirectory())) {
               fail("The prefix attribute is not working properly.");
  @@ -79,8 +81,8 @@
   
       public void test8() {
           executeTarget("test8");
  -        java.io.File f1
  -            = new java.io.File("src/etc/testcases/taskdefs/test8.xml");
  +        File f1
  +            = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test8.xml");
           if (! f1.exists()) {
               fail("The fullpath attribute or the preserveLeadingSlashes attribute does not
work propertly");
           }
  @@ -92,8 +94,8 @@
   
       public void test10() {
           executeTarget("test10");
  -        java.io.File f1
  -            = new java.io.File("src/etc/testcases/taskdefs/test10.xml");
  +        File f1
  +            = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test10.xml");
           if (! f1.exists()) {
               fail("The fullpath attribute or the preserveLeadingSlashes attribute does not
work propertly");
           }
  @@ -101,8 +103,8 @@
   
       public void test11() {
           executeTarget("test11");
  -        java.io.File f1
  -            = new java.io.File("src/etc/testcases/taskdefs/test11.xml");
  +        File f1
  +            = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test11.xml");
           if (! f1.exists()) {
               fail("The fullpath attribute or the preserveLeadingSlashes attribute does not
work propertly");
           }
  
  
  
  1.15      +1 -1      ant/src/testcases/org/apache/tools/ant/taskdefs/ManifestTest.java
  
  Index: ManifestTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/ManifestTest.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ManifestTest.java	11 Nov 2004 17:48:36 -0000	1.14
  +++ ManifestTest.java	7 Dec 2004 09:10:38 -0000	1.15
  @@ -294,7 +294,7 @@
        * Reads mftest.mf.
        */
       private Manifest getManifest(String filename) throws IOException, ManifestException
{
  -        FileReader r = new FileReader(filename);
  +        FileReader r = new FileReader(new File(System.getProperty("root"), filename));
           try {
               return new Manifest(r);
           } finally {
  
  
  
  1.9       +3 -4      ant/src/testcases/org/apache/tools/ant/taskdefs/InitializeClassTest.java
  
  Index: InitializeClassTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/InitializeClassTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- InitializeClassTest.java	9 Mar 2004 16:48:57 -0000	1.8
  +++ InitializeClassTest.java	7 Dec 2004 09:10:38 -0000	1.9
  @@ -31,6 +31,9 @@
    *
    */
   public class InitializeClassTest extends BuildFileTest {
  +    
  +    private File f1 = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/forkedout");
  +    private File f2 = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/unforkedout");
   
       public InitializeClassTest(String name) {
           super(name);
  @@ -43,8 +46,6 @@
       public void testAll() throws IOException {
           executeTarget("forked");
           PrintStream ps = System.out;
  -        File f1 = new File("src/etc/testcases/taskdefs/forkedout");
  -        File f2 = new File("src/etc/testcases/taskdefs/unforkedout");
           PrintStream newps = new PrintStream(new FileOutputStream(f2));
           System.setOut(newps);
           project.executeTarget("unforked");
  @@ -55,8 +56,6 @@
       }
   
       public void tearDown() {
  -        File f1 = new File("src/etc/testcases/taskdefs/forkedout");
  -        File f2 = new File("src/etc/testcases/taskdefs/unforkedout");
           f1.delete();
           f2.delete();
       }
  
  
  
  1.15      +5 -4      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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ImportTest.java	30 Sep 2004 17:05:38 -0000	1.14
  +++ ImportTest.java	7 Dec 2004 09:10:38 -0000	1.15
  @@ -123,7 +123,8 @@
               return;
           }
           String symlink = "src/etc/testcases/taskdefs/import/symlinks/d3b";
  -        if (Runtime.getRuntime().exec(new String[] {ln, "-s", "d3a", symlink}).waitFor()
!= 0) {
  +        File symlinkFile = new File(System.getProperty("root"), symlink);
  +        if (Runtime.getRuntime().exec(new String[] {ln, "-s", "d3a", symlinkFile.getAbsolutePath()}).waitFor()
!= 0) {
               throw new IOException("'" + ln + " -s d3a " + symlink + "' failed");
           }
           try {
  @@ -131,14 +132,14 @@
                   "src/etc/testcases/taskdefs/import/symlinks/d1/p1.xml");
               assertPropertyEquals(
                   "ant.file.p2",
  -                new File("src/etc/testcases/taskdefs/import/symlinks/d2/p2.xml")
  +                new File(System.getProperty("root"), "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")
  +                new File(System.getProperty("root"), "src/etc/testcases/taskdefs/import/symlinks/d3b/p3.xml")
                   .getAbsolutePath());
           } finally {
  -            new File(symlink).delete();
  +            symlinkFile.delete();
           }
       }
   
  
  
  
  1.21      +36 -36    ant/src/testcases/org/apache/tools/ant/taskdefs/FixCrLfTest.java
  
  Index: FixCrLfTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/FixCrLfTest.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- FixCrLfTest.java	9 Mar 2004 16:48:57 -0000	1.20
  +++ FixCrLfTest.java	7 Dec 2004 09:10:38 -0000	1.21
  @@ -42,68 +42,68 @@
   
       public void test1() throws IOException {
           executeTarget("test1");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk1.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk1.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk1.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk1.java"));
       }
   
       public void test2() throws IOException {
           executeTarget("test2");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk2.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk2.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk2.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk2.java"));
       }
   
       public void test3() throws IOException {
           executeTarget("test3");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk3.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk3.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk3.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk3.java"));
       }
   
       public void test4() throws IOException {
           executeTarget("test4");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk4.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk4.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk4.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk4.java"));
       }
   
       public void test5() throws IOException {
           executeTarget("test5");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk5.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk5.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk5.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk5.java"));
       }
   
       public void test6() throws IOException {
           executeTarget("test6");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk6.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk6.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk6.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk6.java"));
       }
   
       public void test7() throws IOException {
           executeTarget("test7");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk7.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk7.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk7.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk7.java"));
       }
   
       public void test8() throws IOException {
           executeTarget("test8");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk8.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk8.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk8.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk8.java"));
       }
   
       public void test9() throws IOException {
           executeTarget("test9");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Junk9.java"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk9.java"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Junk9.java"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk9.java"));
       }
   
       public void testMacLines() throws IOException {
           executeTarget("testMacLines");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/Mac2Unix"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/Mac2Unix"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/Mac2Unix"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Mac2Unix"));
       }
   
       public void testNoOverwrite() throws IOException {
           executeTarget("test1");
           File result =
  -            new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk1.java");
  +            new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk1.java");
           long modTime = result.lastModified();
   
           /*
  @@ -125,7 +125,7 @@
   
           executeTarget("test1");
           result =
  -            new File("src/etc/testcases/taskdefs/fixcrlf/result/Junk1.java");
  +            new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/Junk1.java");
           assertEquals(modTime, result.lastModified());
       }
   
  @@ -135,44 +135,44 @@
               return;
           }
           executeTarget("testEncoding");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/input.lf.utf16"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/input.crlf.utf16"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/input.lf.utf16"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/input.crlf.utf16"));
       }
   
       public void testLongLines() throws IOException {
           executeTarget("testLongLines");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/longlines.lf"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/longlines.crlf"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/longlines.lf"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/longlines.crlf"));
       }
   
       public void testCrCrLfSequenceUnix() throws IOException {
           executeTarget("testCrCrLfSequence-unix");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/crcrlf.unix"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/crcrlf"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/crcrlf.unix"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/crcrlf"));
       }
   
       public void testCrCrLfSequenceDos() throws IOException {
           executeTarget("testCrCrLfSequence-dos");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/crcrlf.dos"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/crcrlf"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/crcrlf.dos"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/crcrlf"));
       }
   
       public void testCrCrLfSequenceMac() throws IOException {
           executeTarget("testCrCrLfSequence-mac");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/crcrlf.mac"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/crcrlf"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/crcrlf.mac"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/crcrlf"));
       }
   
       public void testFixlastDos() throws IOException {
           executeTarget("testFixlastDos");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/fixlast.dos"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/fixlastfalse.lf"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/fixlast.dos"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/fixlastfalse.lf"));
       }
   
       public void testFixlastFalseMac() throws IOException {
           executeTarget("testFixlastFalseMac");
  -        assertEqualContent(new File("src/etc/testcases/taskdefs/fixcrlf/expected/fixlastfalse.mac"),
  -                           new File("src/etc/testcases/taskdefs/fixcrlf/result/fixlastfalse.lf"));
  +        assertEqualContent(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/expected/fixlastfalse.mac"),
  +                           new File(System.getProperty("root"), "src/etc/testcases/taskdefs/fixcrlf/result/fixlastfalse.lf"));
       }
   
       /**
  
  
  
  1.16      +1 -1      ant/src/testcases/org/apache/tools/ant/taskdefs/ExecTaskTest.java
  
  Index: ExecTaskTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/ExecTaskTest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ExecTaskTest.java	24 Sep 2004 18:55:16 -0000	1.15
  +++ ExecTaskTest.java	7 Dec 2004 09:10:38 -0000	1.16
  @@ -342,7 +342,7 @@
           if (project.getProperty("test.can.run") == null) {
               return;
           }
  -        myBuild = new MonitoredBuild(new File(BUILD_FILE), "spawn");
  +        myBuild = new MonitoredBuild(new File(System.getProperty("root"), BUILD_FILE),
"spawn");
           FileUtils fileutils  = FileUtils.newFileUtils();
           logFile = fileutils.createTempFile("spawn","log", project.getBaseDir());
           // this is guaranteed by FileUtils#createTempFile
  
  
  
  1.30      +5 -5      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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DirectoryScannerTest.java	22 Apr 2004 14:48:31 -0000	1.29
  +++ DirectoryScannerTest.java	7 Dec 2004 09:10:39 -0000	1.30
  @@ -227,10 +227,11 @@
   
       public void testSetFollowLinks() {
           if (supportsSymlinks) {
  +            File linkFile = new File(System.getProperty("root"), "src/main/org/apache/tools/ThisIsALink");
               try {
                   // add conditions and more commands as soon as the need arises
                   String[] command = new String[] {
  -                    "ln", "-s", "ant", "src/main/org/apache/tools/ThisIsALink"
  +                    "ln", "-s", "ant", linkFile.getAbsolutePath()
                   };
                   try {
                       Runtime.getRuntime().exec(command);
  @@ -243,7 +244,7 @@
                   } catch (InterruptedException ie) {
                   }
   
  -                File dir = new File("src/main/org/apache/tools");
  +                File dir = new File(System.getProperty("root"), "src/main/org/apache/tools");
                   DirectoryScanner ds = new DirectoryScanner();
   
                   // followLinks should be true by default, but if this ever
  @@ -300,9 +301,8 @@
                              !haveTaskdefsPackage);
   
               } finally {
  -                File f = new File("src/main/org/apache/tools/ThisIsALink");
  -                if (!f.delete()) {
  -                    throw new RuntimeException("Failed to delete " + f);
  +                if (!linkFile.delete()) {
  +                    throw new RuntimeException("Failed to delete " + linkFile);
                   }
               }
           }
  
  
  
  1.31      +3 -2      ant/src/testcases/org/apache/tools/ant/BuildFileTest.java
  
  Index: BuildFileTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/BuildFileTest.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- BuildFileTest.java	9 Nov 2004 10:19:51 -0000	1.30
  +++ BuildFileTest.java	7 Dec 2004 09:10:39 -0000	1.31
  @@ -214,9 +214,10 @@
           fullLogBuffer = new StringBuffer();
           project = new Project();
           project.init();
  -        project.setUserProperty( "ant.file" , new File(filename).getAbsolutePath() );
  +        File antFile = new File(System.getProperty("root"), filename);
  +        project.setUserProperty("ant.file" , antFile.getAbsolutePath());
           project.addBuildListener(new AntTestListener(logLevel));
  -        ProjectHelper.configureProject(project, new File(filename));
  +        ProjectHelper.configureProject(project, antFile);
       }
   
       /**
  
  
  
  1.443     +2 -0      ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/ant/build.xml,v
  retrieving revision 1.442
  retrieving revision 1.443
  diff -u -r1.442 -r1.443
  --- build.xml	12 Nov 2004 10:04:39 -0000	1.442
  +++ build.xml	7 Dec 2004 09:10:39 -0000	1.443
  @@ -1467,6 +1467,7 @@
         <sysproperty key="build.tests.value" value="${build.tests.value}"/>
         <sysproperty key="tests-classpath.value"
                      value="${tests-classpath.value}"/>
  +      <sysproperty key="root" file="${basedir}"/>
   
         <formatter type="brief" usefile="false"/>
   
  @@ -1622,6 +1623,7 @@
         <sysproperty key="offline" value="${offline}"/>      
         <sysproperty key="tests-classpath.value"
                      value="${tests-classpath.value}"/>
  +      <sysproperty key="root" file="${basedir}"/>
         <classpath refid="tests-classpath"/>
         <formatter type="plain" usefile="false"/>
         <test name="${testcase}"/>
  
  
  

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


Mime
View raw message