Пример #1
0
  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;
  }
Пример #2
0
  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());
        }
      }
    }
  }