ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [1/2] git commit: BUnzipTest was writing outside of ${output}
Date Sun, 25 May 2014 18:53:21 GMT
Repository: ant
Updated Branches:
  refs/heads/master 39ad231a2 -> 74d19d829


BUnzipTest was writing outside of ${output}


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/f0f1a3ca
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/f0f1a3ca
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/f0f1a3ca

Branch: refs/heads/master
Commit: f0f1a3ca00c4f8f355818c8ed56440df3cc004f8
Parents: 39ad231
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Sun May 25 20:44:50 2014 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sun May 25 20:44:50 2014 +0200

----------------------------------------------------------------------
 src/etc/testcases/taskdefs/bunzip2.xml          | 27 ++++++++++----------
 .../apache/tools/ant/taskdefs/BUnzip2Test.java  | 13 +++++-----
 2 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/f0f1a3ca/src/etc/testcases/taskdefs/bunzip2.xml
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/bunzip2.xml b/src/etc/testcases/taskdefs/bunzip2.xml
index 8da474b..8ae1758 100644
--- a/src/etc/testcases/taskdefs/bunzip2.xml
+++ b/src/etc/testcases/taskdefs/bunzip2.xml
@@ -16,33 +16,32 @@
   limitations under the License.
 -->
 
-<project basedir="." default="cleanup">
+<project basedir="." default="tearDown">
+
+  <import file="../buildfiletest-base.xml"/>
+
+  <target name="prepare">
+    <mkdir dir="${output}"/>
+    <gunzip src="expected/asf-logo-huge.tar.gz"
+            dest="${output}/asf-logo-huge-from-gzip.tar"/>
+  </target>
 
   <target name="realTest">
-    <bunzip2 src="expected/asf-logo-huge.tar.bz2" dest="asf-logo-huge.tar" />
+    <bunzip2 src="expected/asf-logo-huge.tar.bz2" dest="${output}/asf-logo-huge.tar" />
   </target>
 
   <target name="realTestWithResource">
-    <bunzip2 dest="asf-logo-huge.tar">
+    <bunzip2 dest="${output}/asf-logo-huge.tar">
       <file file="expected/asf-logo-huge.tar.bz2"/>
     </bunzip2>
   </target>
 
-  <target name="cleanup">
-    <delete file="asf-logo-huge.tar" />
-    <delete file="expected/asf-logo-huge.tar" />
-  </target>
-
-  <target name="prepare">
-    <gunzip src="expected/asf-logo-huge.tar.gz"/>
-  </target>
-
   <target name="testDocumentationClaimsOnCopy">
-    <copy todir=".">
+    <copy todir="${output}">
       <bzip2resource>
         <file file="expected/asf-logo-huge.tar.bz2"/>
       </bzip2resource>
       <mapper type="glob" from="*.bz2" to="*"/>
     </copy>
   </target>
-</project>
\ No newline at end of file
+</project>

http://git-wip-us.apache.org/repos/asf/ant/blob/f0f1a3ca/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java b/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java
index 60ba5a6..9ea9a4f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java
@@ -18,6 +18,7 @@
 
 package org.apache.tools.ant.taskdefs;
 
+import java.io.File;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.FileUtilities;
 import org.junit.Before;
@@ -32,18 +33,16 @@ public class BUnzip2Test {
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
+    private File outputDir;
+
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/taskdefs/bunzip2.xml");
+        outputDir = new File(buildRule.getProject().getProperty("output"));
         buildRule.executeTarget("prepare");
     }
 
     @Test
-    public void tearDown() {
-        buildRule.executeTarget("cleanup");
-    }
-
-    @Test
     public void testRealTest() throws java.io.IOException {
         testRealTest("realTest");
     }
@@ -56,8 +55,8 @@ public class BUnzip2Test {
     private void testRealTest(String target) throws java.io.IOException {
         buildRule.executeTarget(target);
         assertEquals("File content mismatch after bunzip2",
-                FileUtilities.getFileContents(buildRule.getProject().resolveFile("expected/asf-logo-huge.tar")),
-                FileUtilities.getFileContents(buildRule.getProject().resolveFile("asf-logo-huge.tar")));
+                FileUtilities.getFileContents(new File(outputDir, "asf-logo-huge-from-gzip.tar")),
+                FileUtilities.getFileContents(new File(outputDir, "asf-logo-huge.tar")));
     }
 
     @Test


Mime
View raw message