ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r1584506 - in /ant/core/trunk/src: etc/testcases/taskdefs/ tests/junit/org/apache/tools/ant/taskdefs/
Date Fri, 04 Apr 2014 02:37:43 GMT
Author: antoine
Date: Fri Apr  4 02:37:42 2014
New Revision: 1584506

URL: http://svn.apache.org/r1584506
Log:
creating temporary directory with a unique name

Removed:
    ant/core/trunk/src/etc/testcases/taskdefs/echo.xml
Modified:
    ant/core/trunk/src/etc/testcases/taskdefs/copydir.xml
    ant/core/trunk/src/etc/testcases/taskdefs/copyfile.xml
    ant/core/trunk/src/etc/testcases/taskdefs/delete.xml
    ant/core/trunk/src/etc/testcases/taskdefs/jar.xml
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopyfileTest.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/DeleteTest.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java

Modified: ant/core/trunk/src/etc/testcases/taskdefs/copydir.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/copydir.xml?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/copydir.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/copydir.xml Fri Apr  4 02:37:42 2014
@@ -18,6 +18,12 @@
 
 <project name="copydir-test" basedir="." default="test1">
 
+  <import file="../buildfiletest-base.xml"/>
+
+  <target name="setUp">
+    <mkdir dir="${output}" />
+  </target>
+
   <target name="test1">
     <copydir/>
   </target>
@@ -36,9 +42,9 @@
   </target>
 
   <target name="test5">
-    <mkdir dir="../taskdefs.tmp" />
+    <mkdir dir="${output}/taskdefs.tmp" />
     <copydir src="." 
-             dest="../taskdefs.tmp"/>
+             dest="${output}/taskdefs.tmp"/>
   </target>
 
   <target name="test6">
@@ -46,8 +52,5 @@
              dest="template.xml"/>
   </target>
 
-  <target name="cleanup">
-    <delete dir="../taskdefs.tmp" />
-  </target>
 
 </project>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/copyfile.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/copyfile.xml?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/copyfile.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/copyfile.xml Fri Apr  4 02:37:42 2014
@@ -18,6 +18,12 @@
 
 <project name="copyfile-test" basedir="." default="test1">
 
+  <import file="../buildfiletest-base.xml"/>
+
+  <target name="setUp">
+    <mkdir dir="${output}" />
+  </target>
+
   <target name="test1">
     <copyfile/>
   </target>
@@ -37,18 +43,14 @@
 
   <target name="test5">
     <copyfile src="copyfile.xml" 
-             dest="copyfile.tmp"/>
+             dest="${output}/copyfile.tmp"/>
   </target>
 
   <target name="test6">
-    <delete file="testdir"/>
-    <mkdir dir="testdir" />
-    <copyfile src="copyfile.xml" 
-              dest="testdir"
+    <mkdir dir="${output}/testdir"/>
+    <copyfile src="copyfile.xml"
+              dest="${output}/testdir"
               forceoverwrite="true" />
   </target>
 
-  <target name="cleanup">
-    <delete dir="testdir" />
-  </target>
 </project>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/delete.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/delete.xml?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/delete.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/delete.xml Fri Apr  4 02:37:42 2014
@@ -18,8 +18,11 @@
 
 <project name="delete-test" basedir="." default="test1">
 
-  <property name="dirname" value="taskdefs.tmp" />
-  <property name="dir" location="${dirname}" />
+  <import file="../buildfiletest-base.xml"/>
+
+
+  <property name="dir" location="${output}" />
+  <basename property="dirname" file="${output}"/>
 
   <macrodef name="expectabsent">
     <attribute name="target" default="${dir}"/>
@@ -187,6 +190,5 @@
   </target>
 
 
-  <target name="cleanup" depends="test4" />
 
 </project>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/jar.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/jar.xml?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/jar.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/jar.xml Fri Apr  4 02:37:42 2014
@@ -18,11 +18,17 @@
 
 <project name="jar-test" basedir="." default="test1">
 
-  <property name="tmp.jar" location="tmp.jar"/>
-  <property name="tmp.dir" location="jartmp"/>
-  <property name="tmp.zip" location="tmp.zip"/>
-  <property name="tmp1.dir" location="jartmp1"/>
-  <property name="tmp2.dir" location="jartmp2"/>
+  <import file="../buildfiletest-base.xml"/>
+
+  <target name="setUp">
+    <mkdir dir="${output}" />
+  </target>
+
+  <property name="tmp.jar" location="${output}/tmp.jar"/>
+  <property name="tmp.dir" location="${output}/jartmp"/>
+  <property name="tmp.zip" location="${output}/tmp.zip"/>
+  <property name="tmp1.dir" location="${output}/jartmp1"/>
+  <property name="tmp2.dir" location="${output}/jartmp2"/>
 
   <target name="test1">
     <jar/>
@@ -181,15 +187,6 @@
     </jar>
   </target>
 
-  <target name="cleanup">
-    <delete file="${tmp.jar}" />
-    <delete file="${tmp.jar}2" />
-    <delete dir="${tmp.dir}"/>
-    <delete file="${tmp.zip}" />
-    <delete dir="${tmp1.dir}"/>
-    <delete dir="${tmp2.dir}"/>
-  </target>
-
   <target name="testCreateWithEmptyFilesetSetUp">
     <mkdir dir="${tmp1.dir}"/>
     <mkdir dir="${tmp2.dir}"/>

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java Fri Apr
 4 02:37:42 2014
@@ -30,10 +30,7 @@ public class CopydirTest extends BuildFi
 
     public void setUp() {
         configureProject("src/etc/testcases/taskdefs/copydir.xml");
-    }
-
-    public void tearDown() {
-        executeTarget("cleanup");
+        executeTarget("setUp");
     }
 
     public void test1() {
@@ -54,7 +51,7 @@ public class CopydirTest extends BuildFi
 
     public void test5() {
         executeTarget("test5");
-        java.io.File f = new java.io.File(getProjectDir(), "../taskdefs.tmp");
+        java.io.File f = new java.io.File(getOutputDir(), "taskdefs.tmp");
         if (!f.exists() || !f.isDirectory()) {
             fail("Copy failed");
         }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopyfileTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopyfileTest.java?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopyfileTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/CopyfileTest.java Fri Apr
 4 02:37:42 2014
@@ -34,10 +34,7 @@ public class CopyfileTest extends BuildF
 
     public void setUp() {
         configureProject("src/etc/testcases/taskdefs/copyfile.xml");
-    }
-
-    public void tearDown() {
-        executeTarget("cleanup");
+        executeTarget("setUp");
     }
 
     public void test1() {
@@ -58,10 +55,8 @@ public class CopyfileTest extends BuildF
 
     public void test5() {
         executeTarget("test5");
-        java.io.File f = new java.io.File(getProjectDir(), "copyfile.tmp");
-        if (f.exists()) {
-            f.delete();
-        } else {
+        java.io.File f = new java.io.File(getOutputDir(), "copyfile.tmp");
+        if (!f.exists()) {
             fail("Copy failed");
         }
     }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/DeleteTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/DeleteTest.java?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/DeleteTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/DeleteTest.java Fri Apr 
4 02:37:42 2014
@@ -32,10 +32,6 @@ public class DeleteTest extends BuildFil
         configureProject("src/etc/testcases/taskdefs/delete.xml");
     }
 
-    public void tearDown() {
-        executeTarget("cleanup");
-    }
-
     public void test1() {
         expectBuildException("test1", "required argument not specified");
     }

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java Fri Apr  4 02:37:42
2014
@@ -48,6 +48,7 @@ public class JarTest extends BuildFileTe
 
     public void setUp() {
         configureProject("src/etc/testcases/taskdefs/jar.xml");
+        executeTarget("setUp");
     }
 
     public void tearDown() {
@@ -63,8 +64,11 @@ public class JarTest extends BuildFileTe
             } catch (IOException e) {
             }
         }
+        try {
+            super.tearDown();
+        } catch (Exception exc) {
 
-        executeTarget("cleanup");
+        }
     }
 
     public void test1() {
@@ -81,7 +85,7 @@ public class JarTest extends BuildFileTe
 
     public void test4() {
         executeTarget("test4");
-        File jarFile = new File(getProjectDir(), tempJar);
+        File jarFile = new File(getOutputDir(), tempJar);
         assertTrue(jarFile.exists());
     }
 
@@ -95,7 +99,7 @@ public class JarTest extends BuildFileTe
 
     private void testNoRecreate(String secondTarget) {
         executeTarget("test4");
-        File jarFile = new File(getProjectDir(), tempJar);
+        File jarFile = new File(getOutputDir(), tempJar);
         long jarModifiedDate = jarFile.lastModified();
         try {
             Thread.sleep(2500);
@@ -132,10 +136,10 @@ public class JarTest extends BuildFileTe
             Thread.sleep(sleeptime);
         } catch (InterruptedException e) {
         } // end of try-catch
-        File jarFile = new File(getProjectDir(), tempJar);
+        File jarFile = new File(getOutputDir(), tempJar);
         long jarModifiedDate = jarFile.lastModified();
         executeTarget(secondTarget);
-        jarFile = new File(getProjectDir(), tempJar);
+        jarFile = new File(getOutputDir(), tempJar);
         assertTrue("jar has been recreated in " + secondTarget,
                    jarModifiedDate < jarFile.lastModified());
     }
@@ -144,10 +148,10 @@ public class JarTest extends BuildFileTe
         throws IOException, ManifestException {
         executeTarget("testManifestStaysIntact");
 
-        r1 = new FileReader(getProject()
-                            .resolveFile(tempDir + "manifest"));
-        r2 = new FileReader(getProject()
-                            .resolveFile(tempDir + "META-INF/MANIFEST.MF"));
+        r1 = new FileReader(new File(getOutputDir(),
+                            tempDir + "manifest"));
+        r2 = new FileReader(new File(getOutputDir(),
+                tempDir + "META-INF/MANIFEST.MF"));
         Manifest mf1 = new Manifest(r1);
         Manifest mf2 = new Manifest(r2);
         assertEquals(mf1, mf2);
@@ -197,7 +201,7 @@ public class JarTest extends BuildFileTe
 
     public void testUpdateIfOnlyManifestHasChanged() {
         executeTarget("testUpdateIfOnlyManifestHasChanged");
-        File jarXml = getProject().resolveFile(tempDir + "jar.xml");
+        File jarXml = new File(getOutputDir(), tempDir + "jar.xml");
         assertTrue(jarXml.exists());
     }
 
@@ -206,7 +210,7 @@ public class JarTest extends BuildFileTe
         ZipFile archive = null;
         try {
             executeTarget("testIndexTests");
-            archive = new ZipFile(getProject().resolveFile(tempJar));
+            archive = new ZipFile(new File(getOutputDir(), tempJar));
             Enumeration e = archive.entries();
             int numberOfIndexLists = 0;
             while (e.hasMoreElements()) {
@@ -228,7 +232,7 @@ public class JarTest extends BuildFileTe
         ZipFile archive = null;
         try {
             executeTarget("testIndexTests");
-            archive = new ZipFile(getProject().resolveFile(tempJar));
+            archive = new ZipFile(new File(getOutputDir(), tempJar));
             ZipEntry ze = archive.getEntry("META-INF/INDEX.LIST");
             InputStream is = archive.getInputStream(ze);
             BufferedReader r = new BufferedReader(new InputStreamReader(is,
@@ -260,7 +264,7 @@ public class JarTest extends BuildFileTe
     }
     public void testManifestOnlyJar() {
         expectLogContaining("testManifestOnlyJar", "Building MANIFEST-only jar: ");
-        File manifestFile = getProject().resolveFile(tempDir + "META-INF" + File.separator
+ "MANIFEST.MF");
+        File manifestFile = new File(getOutputDir(), tempDir + "META-INF" + File.separator
+ "MANIFEST.MF");
         assertTrue(manifestFile.exists());
     }
 

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java?rev=1584506&r1=1584505&r2=1584506&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
(original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
Fri Apr  4 02:37:42 2014
@@ -35,15 +35,12 @@ public class ProtectedJarMethodsTest ext
 
     public void setUp() {
         configureProject("src/etc/testcases/taskdefs/jar.xml");
-    }
-
-    public void tearDown() {
-        executeTarget("cleanup");
+        executeTarget("setUp");
     }
 
     public void testGrabFilesAndDirs() throws IOException {
         executeTarget("testIndexTests");
-        String archive = getProject().resolveFile(tempJar).getAbsolutePath();
+        String archive = getProject().getProperty(tempJar);
         ArrayList dirs = new ArrayList();
         ArrayList files = new ArrayList();
         String[] expectedDirs = new String[] {



Mime
View raw message