List<File> getTestLogsFromIndex(File index) throws Exception { List<File> logs = new ArrayList<File>(); for (LinesOfFile lof = new LinesOfFile(index); lof.hasNext(); ) { String dir = lof.next().trim(); if (dir.length() == 0) continue; File path = new File(logdir + File.separator + dir + File.separatorChar + "log.xml"); if (!path.exists()) throw new Exception( "TestSpec " + toString() + " references the section " + dir + " - no log file exists ( file " + path.toString() + " does not exist"); logs.add(path); } return logs; }
List<File> getTestPlansFromIndex(File index) throws Exception { List<File> plans = new ArrayList<File>(); File testdir = getTestDir(); for (LinesOfFile lof = new LinesOfFile(index); lof.hasNext(); ) { String dir = lof.next().trim(); if (dir.length() == 0) continue; File path = new File(testdir + File.separator + dir + File.separatorChar + testPlanFileName); if (!path.exists()) throw new Exception( "TestSpec " + toString() + " references sub-directory " + dir + " which does not exist or does not contain a " + testPlanFileName + " file"); plans.add(path); } return plans; }
static String firstLineOfFile(File file) throws IOException { LinesOfFile lof = new LinesOfFile(file); return lof.next(); }