From d8d01e83e3f1a618b5e79e3311d6a47bb842aea0 Mon Sep 17 00:00:00 2001 From: wisberg Date: Wed, 29 Oct 2003 09:25:05 +0000 Subject: [PATCH] clean up tests not using a destination directory --- .../tools/ant/taskdefs/AjcTaskTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java index 3186e8df4..194ba64bd 100644 --- a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java +++ b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java @@ -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() { -- 2.39.5