private void Crash(IndexWriter writer) { MockRAMDirectory dir = (MockRAMDirectory)writer.GetDirectory(); ConcurrentMergeScheduler cms = (ConcurrentMergeScheduler)writer.GetMergeScheduler(); dir.Crash(); cms.Sync(); dir.ClearCrash(); }
public virtual void TestCrashAfterCloseNoWait() { IndexWriter writer = InitIndex(); MockRAMDirectory dir = (MockRAMDirectory)writer.GetDirectory(); writer.Close(false); dir.Crash(); /* * String[] l = dir.list(); * Arrays.sort(l); * for(int i=0;i<l.length;i++) * System.out.println("file " + i + " = " + l[i] + " " + dir.fileLength(l[i]) + " bytes"); */ IndexReader reader = IndexReader.Open(dir); Assert.AreEqual(157, reader.NumDocs()); }