@Throws(Exception::class) fun testExhaustContentSource() {val algLines = arrayOf("# ----- properties","content.source=org.apache.lucene.benchmark.byTask.feeds.SingleDocSource","content.source.log.step=1","doc.term.vector=false","content.source.forever=false","directory=RAMDirectory","doc.stored=false","doc.tokenized=false","# ----- alg ","CreateIndex","{ AddDoc } : * ","ForceMerge(1)","CloseIndex","OpenReader","{ CountingSearchTest } : 100","CloseReader","[ CountingSearchTest > : 30","[ CountingSearchTest > : 9")CountingSearchTestTask.numSearches = 0val benchmark: Benchmark = execBenchmark(algLines)assertEquals("TestSearchTask was supposed to be called!",139,CountingSearchTestTask.numSearches)assertTrue("Index does not exist?...!",DirectoryReader.indexExists(benchmark.getRunData().getDirectory())) val iw = IndexWriter(benchmark.getRunData().getDirectory(),IndexWriterConfig(MockAnalyzer(random())).setOpenMode(OpenMode.APP))iw.close()val ir: IndexReader = DirectoryReader.open(benchmark.getRunData().getDirectory())assertEquals("1 docs were added to the index, this is what we expect to find!",1,ir.numDocs())ir.close()}
Test Exhasting Doc Maker logic