]> source.dussan.org Git - aspectj.git/commitdiff
clean up tests not using a destination directory
authorwisberg <wisberg>
Wed, 29 Oct 2003 09:25:05 +0000 (09:25 +0000)
committerwisberg <wisberg>
Wed, 29 Oct 2003 09:25:05 +0000 (09:25 +0000)
taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java

index 3186e8df4f4029a5563700ef696e19878105bcbe..194ba64bdd9a696946a535459f27a85dd6ba2667 100644 (file)
@@ -48,6 +48,8 @@ public class AjcTaskTest extends TestCase {
     private static final String aspectjtoolsJar;
     private static final String testdataDir;
     private static final StringBuffer MESSAGES = new StringBuffer();
+    /** accept writable .class files */
+    private static FileFilter PICK_CLASS_FILES;
     
     static {
         tempDir = new File("IncrementalAjcTaskTest-temp");            
@@ -68,6 +70,15 @@ public class AjcTaskTest extends TestCase {
         } else {
             testdataDir = null;
         }
+        PICK_CLASS_FILES = new FileFilter() {
+            public boolean accept(File file) {
+                return ((null != file)
+                    && file.isFile()
+                    && file.canWrite()
+                    && file.getPath().endsWith(".class"));
+            }
+
+        };
     }
     
     /** 
@@ -118,6 +129,13 @@ public class AjcTaskTest extends TestCase {
         if ((null != tempDir) && tempDir.exists()) {
             FileUtil.deleteContents(tempDir);
             tempDir.delete();
+            // when tempDir not used...
+            if (null != testdataDir) {
+                File dataDir = new File(testdataDir);
+                if (dataDir.canRead()) {
+                    FileUtil.deleteContents(dataDir, PICK_CLASS_FILES, false);
+                }
+            }
         }
     }    
     private static final File getTempDir() {