App { public static void main(String[] args) throws Exception { App.run(args); }  static void processClassPath(String cp); static void main(String[] args); static void run(String[] args); static void run(String[] args, PrintStream out); static void run(String fn, Parameters p, PrintStream out); final static Logger log; final static HashMap<String, AppFunction> appFunctions; }
@Test public void testMakeCorpora() throws Exception { File trecCorpusFile = null; File corpusFile1 = null; File corpusFile2 = null; File indexFile1 = null; File indexFile2 = null; try { String trecCorpus = trecDocument("55", "This is a sample document") + trecDocument("59", "sample document two"); trecCorpusFile = FileUtility.createTemporary(); StreamUtil.copyStringToFile(trecCorpus, trecCorpusFile); corpusFile1 = FileUtility.createTemporary(); App.main(new String[]{"make-corpus", "--corpusPath=" + corpusFile1.getAbsolutePath(), "--inputPath=" + trecCorpusFile.getAbsolutePath(), "--corpusFormat=file", "--server=false"}); assertTrue(corpusFile1.exists()); corpusFile2 = FileUtility.createTemporaryDirectory(); App.main(new String[]{"make-corpus", "--corpusPath=" + corpusFile2.getAbsolutePath(), "--inputPath=" + trecCorpusFile.getAbsolutePath(), "--distrib=2", "--corpusParameters/corpusTags=false", "--corpusParameters/corpusTerms=false", "--server=false"}); assertTrue(corpusFile2.exists()); assertTrue(new File(corpusFile2, "split.keys").exists()); assertTrue(new File(corpusFile2, "0").exists()); assertTrue(SplitBTreeReader.isBTree(new File(corpusFile2, "split.keys"))); assertFalse(SplitBTreeReader.isBTree(new File(corpusFile2, "0"))); indexFile1 = FileUtility.createTemporaryDirectory(); App.main(new String[]{"build", "--indexPath=" + indexFile1.getAbsolutePath(), "--inputPath=" + corpusFile1.getAbsolutePath(), "--server=false"}); indexFile2 = FileUtility.createTemporaryDirectory(); App.main(new String[]{"build", "--indexPath=" + indexFile2.getAbsolutePath(), "--inputPath=" + corpusFile2.getAbsolutePath(), "--server=false"}); assertTrue(indexFile1.exists()); assertTrue(indexFile2.exists()); } finally { if (trecCorpusFile != null) { Assert.assertTrue(trecCorpusFile.delete()); } boolean deleted; deleted = corpusFile1.delete(); if (!deleted) { deleted = true; FSUtil.deleteDirectory(corpusFile1); } assertTrue(deleted); deleted = corpusFile2.delete(); if (!deleted) { deleted = true; FSUtil.deleteDirectory(corpusFile2); } assertTrue(deleted); if (indexFile1 != null) { FSUtil.deleteDirectory(indexFile1); } if (indexFile2 != null) { FSUtil.deleteDirectory(indexFile2); } } }