BuildFilteredCollection extends AppFunction { @Override public void run(Parameters p, PrintStream output) throws Exception { if (!p.containsKey("inputPath") || !p.isString("outputPath") || !p.containsKey("filter")) { output.println(getHelpString()); return; } Job job = getIndexJob(p); TupleflowAppUtil.runTupleFlowJob(job, p, output); }  @Override String getName(); @Override String getHelpString(); @Override void run(Parameters p, PrintStream output);  }
@Test public void testSomeMethod() throws Exception { File input = FileUtility.createTemporary(); File filter = FileUtility.createTemporary(); File output = FileUtility.createTemporaryDirectory(); try { makeTrecDocs(input); String docs = "doc-1\ndoc-2\ndoc-88\ndoc-99\ndoc-100"; StreamUtil.copyStringToFile(docs, filter); Parameters p = Parameters.create(); p.set("inputPath", input.getAbsolutePath()); p.set("outputPath", output.getAbsolutePath()); p.set("filter", filter.getAbsolutePath()); p.set("distrib", 1); p.set("mode", "local"); (new BuildFilteredCollection()).run(p, System.out); int dcount = 0; assertNotNull(output); assertNotNull(output.listFiles()); for (File o : FileUtility.safeListFiles(output)) { dcount += countDocuments(o); } assertEquals(dcount, 4); } finally { input.delete(); filter.delete(); FSUtil.deleteDirectory(output); } }