/** * Return log file and as a side effect create directory structure necessary to store it. * * @param testPlan * @return * @throws Exception */ public File getLogFile(File testPlan) throws Exception { String relativePath = TestSpec.getLogicalPath(testPlan.getParentFile(), testKit); File path = new File(testLog + File.separator + relativePath + File.separator + "log.xml"); // System.out.println("testspec is " + testPlan); path.getParentFile().mkdirs(); return path; }
public static Map<String, String> getTestKitReadMe(File testkit) throws IOException { Map<String, String> map = new HashMap<String, String>(); TestSpec ts = new TestSpec(testkit); for (int i = 0; i < defaultSections.length; i++) { ts.section = defaultSections[i]; File sectionDir = ts.getSectionDir(); if (!sectionDir.exists()) continue; String[] files = sectionDir.list(); if (files == null) continue; for (int j = 0; j < files.length; j++) { if (files[j].startsWith(".")) continue; File file = new File(sectionDir + File.separator + files[j]); if (!file.isDirectory()) continue; ts.testNum = file.getName(); if (ts.isTestDir()) { File readme = ts.getReadme(); String firstline = ""; if (readme.exists() && readme.isFile()) firstline = firstLineOfFile(readme); map.put(ts.testNum, firstline.trim()); } } } return map; }
public static void listTestKitContents(File testkit) throws IOException { TestSpec ts = new TestSpec(testkit); for (int i = 0; i < defaultSections.length; i++) { ts.section = defaultSections[i]; File sectionDir = ts.getSectionDir(); if (!sectionDir.exists()) continue; System.out.println("====================== " + ts.section + " ======================"); String[] files = sectionDir.list(); if (files == null) continue; for (int j = 0; j < files.length; j++) { if (files[j].startsWith(".")) continue; File file = new File(sectionDir + File.separator + files[j]); if (!file.isDirectory()) continue; ts.testNum = file.getName(); if (ts.isTestDir()) { File readme = ts.getReadme(); String firstline = ""; if (readme.exists() && readme.isFile()) firstline = firstLineOfFile(readme); System.out.println(ts.testNum + "\t" + firstline.trim()); } } } }