commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r765471 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Date Thu, 16 Apr 2009 05:42:15 GMT
Author: grobmeier
Date: Thu Apr 16 05:42:14 2009
New Revision: 765471

URL: http://svn.apache.org/viewvc?rev=765471&view=rev
Log:
made it possible to clean up resources manually

Modified:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java?rev=765471&r1=765470&r2=765471&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Thu Apr 16 05:42:14 2009
@@ -263,6 +263,20 @@
      */
     protected void checkArchiveContent(ArchiveInputStream in, List expected)
             throws Exception {
+        checkArchiveContent(in, expected, true);
+    }
+    
+    /**
+     * Checks that an archive input stream can be read, and that the file data matches file
sizes.
+     * 
+     * @param in
+     * @param expected list of expected entries or <code>null</code> if no check
of names desired
+     * @param cleanUp Cleans up resources if true 
+     * @return returns the created result file if cleanUp = false, or null otherwise 
+     * @throws Exception
+     */
+    protected File checkArchiveContent(ArchiveInputStream in, List expected, boolean cleanUp)
+            throws Exception {
         File result = File.createTempFile("dir-result", "");
         result.delete();
         result.mkdir();
@@ -304,8 +318,11 @@
                 assertEquals(0, expected.size());
             }
         } finally {
-            rmdir(result);
+            if (cleanUp) {
+                rmdir(result);
+            }
         }
+        return result;
     }
 
     /**



Mime
View raw message