//
// UnconfiguredFiles.java
//

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import loci.common.DataTools;

/**
 * Recursively searchs a directory for files that have not been configured for
 * testing.
 *
 * <dl><dt><b>Source code:</b></dt>
 * <dd><a href="http://trac.openmicroscopy.org.uk/ome/browser/bioformats.git/components/test-suite/utils/UnconfiguredFiles.java">Trac</a>,
 * <a href="http://git.openmicroscopy.org/?p=bioformats.git;a=blob;f=components/test-suite/utils/UnconfiguredFiles.java;hb=HEAD">Gitweb</a></dd></dl>
 */
public class UnconfiguredFiles {

  private ArrayList<String> unconfigured = new ArrayList<String>();

  public void buildUnconfiguredList(File root) throws IOException {
    if (!root.isDirectory()) return;
    String[] list = root.list();
    File configFile = new File(root, ".bioformats");
    String configData = null;
    if (configFile.exists()) {
      configData = DataTools.readFile(configFile.getAbsolutePath());
    }

    for (String file : list) {
      File child = new File(root, file).getAbsoluteFile();
      if (file.startsWith(".")) continue;
      else if (child.isDirectory()) buildUnconfiguredList(child);
      else if (!configFile.exists() ||
        configData.indexOf("\"" + child.getName() + "\"") < 0)
      {
        unconfigured.add(child.getAbsolutePath());
      }
    }
  }

  public void printList() {
    if (unconfigured.size() > 0) {
      System.out.println("Unconfigured files:");
      for (String file : unconfigured) {
        System.out.println("  " + file);
      }
    }
    else System.out.println("All files have been configured!");
  }

  public static void main(String[] args) throws IOException {
    UnconfiguredFiles f = new UnconfiguredFiles();
    f.buildUnconfiguredList(new File(args[0]));
    f.printList();
  }

}

@@ -1,34 +1,931 @@
 /
-/%0A// UnconfiguredFiles.java%0A/
+*%0A * #%25L%0A * OME Bio-Formats manual and automated test suite.%0A * %25%25%0A * Copyright (C) 2006 - 2012 Open Microscopy Environment:%0A *   - Board of Regents of the University of Wisconsin-Madison%0A *   - Glencoe Software, Inc.%0A *   - University of Dundee%0A * %25%25%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as%0A * published by the Free Software Foundation, either version 2 of the %0A * License, or (at your option) any later version.%0A * %0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A * %0A * You should have received a copy of the GNU General Public %0A * License along with this program.  If not, see%0A * %3Chttp://www.gnu.org/licenses/gpl-2.0.html%3E.%0A * #L%25%0A *
 /%0A%0Ai

Add non-src license headers: test-suite