BuildSpecialCollBackground extends AppFunction { @Override public void run(Parameters p, PrintStream output) throws Exception { if (!p.isString("indexPath") && !p.isList("indexPath")) { output.println(getHelpString()); } Job job = getBuildJob(p); if (job != null) { TupleflowAppUtil.runTupleFlowJob(job, p, output); } }  Job getBuildJob(Parameters p); @Override String getName(); @Override String getHelpString(); @Override void run(Parameters p, PrintStream output); static void main(String[] args);  }
@Test public void testSomeMethod() throws Exception { File docs = FileUtility.createTemporary(); File back = FileUtility.createTemporary(); File index = FileUtility.createTemporaryDirectory(); try { makeTrecDocs(docs); Parameters p = Parameters.create(); p.set("inputPath", docs.getAbsolutePath()); p.set("indexPath", index.getAbsolutePath()); p.set("corpus", false); App.run("build", p, System.out); StreamUtil.copyStringToFile( "1\t1\n" + "2\t2\n" + "3\t3\n" + "4\t4\n" + "4\t4\n", back); Parameters p2 = Parameters.create(); p2.set("inputPath", back.getAbsolutePath()); p2.set("indexPath", index.getAbsolutePath()); p2.set("partName", "back"); App.run("build-special-coll-background", p2, System.out); BackgroundStatsReader backPart = (BackgroundStatsReader) DiskIndex.openIndexComponent(new File(index, "back").getAbsolutePath()); assertEquals(backPart.getManifest().getLong("statistics/highestCollectionFrequency"), 8); Retrieval r = RetrievalFactory.instance(index.getAbsolutePath(), Parameters.create()); assertEquals(r.getNodeStatistics("#counts:@/0/:part=back()").nodeFrequency, 0); assertEquals(r.getNodeStatistics("#counts:@/4/:part=back()").nodeFrequency, 8); backPart.close(); r.close(); p2.clear(); p.clear(); } finally { Assert.assertTrue(docs.delete()); Assert.assertTrue(back.delete()); FSUtil.deleteDirectory(index); } }