1 2 3 package org.quilt.frontend.ant; 4 5 import java.util.Vector ; 6 import java.io.File ; 7 8 import org.apache.tools.ant.DirectoryScanner; 9 import org.apache.tools.ant.Project; 10 import org.apache.tools.ant.types.FileSet; 11 12 import org.quilt.framework.*; 13 14 19 public class BatchTest extends QuiltTest { 20 21 22 private Project project; 23 24 private Vector filesets = new Vector (); 25 26 32 public BatchTest(Project p){ 33 project = p; 34 } 35 36 43 public void addFileSet(FileSet fs) { 44 filesets.addElement(fs); 45 } 46 47 57 public void unbatch (Scheduler sch) { 58 if (runMe(project)) { 60 Vector v = new Vector (); 61 int size = filesets.size(); 62 for (int i = 0; i < size; i++) { 63 FileSet fs = (FileSet) filesets.elementAt(i); 64 DirectoryScanner ds = fs.getDirectoryScanner(project); 65 ds.scan(); 66 String [] files = ds.getIncludedFiles(); 67 for (int j = 0; j < files.length; j++) { 68 boolean gottaMatch = false; 69 String name = files[j]; 70 String className = ""; 71 if (name.endsWith(".class")) { 72 gottaMatch = true; 73 className = name.substring(0, 74 name.length() - ".class".length()); 75 } else if (name.endsWith(".java")) { 76 gottaMatch = true; 77 className = name.substring(0, 78 name.length() - ".java".length()); 79 } 80 if (gottaMatch) { 81 className = 83 className.replace(File.separatorChar, '.'); 84 QuiltTest qt = (QuiltTest) clone(); 86 qt.setName(className); 87 sch.addTest(qt); 89 } 90 } 91 } 92 } 93 } 94 } 95 | Popular Tags |