public virtual void TestWriterAfterCrash() { IndexWriter writer = InitIndex(); MockRAMDirectory dir = (MockRAMDirectory)writer.Directory; dir.SetPreventDoubleWrite(false); Crash(writer); writer = InitIndex(dir); writer.Close(); IndexReader reader = IndexReader.Open((Directory)dir, false, null); Assert.IsTrue(reader.NumDocs() < 314); }
public virtual void TestTransactions_Rename() { RANDOM = NewRandom(); MockRAMDirectory dir1 = new MockRAMDirectory(); MockRAMDirectory dir2 = new MockRAMDirectory(); dir1.SetPreventDoubleWrite(false); dir2.SetPreventDoubleWrite(false); dir1.FailOn(new RandomFailure(this)); dir2.FailOn(new RandomFailure(this)); InitIndex(dir1); InitIndex(dir2); TimedThread[] threads = new TimedThread[3]; int numThread = 0; IndexerThread indexerThread = new IndexerThread(this, this, dir1, dir2, threads); threads[numThread++] = indexerThread; indexerThread.Start(); SearcherThread searcherThread1 = new SearcherThread(this, dir1, dir2, threads); threads[numThread++] = searcherThread1; searcherThread1.Start(); SearcherThread searcherThread2 = new SearcherThread(this, dir1, dir2, threads); threads[numThread++] = searcherThread2; searcherThread2.Start(); for (int i = 0; i < numThread; i++) threads[i].Join(); for (int i = 0; i < numThread; i++) Assert.IsTrue(!((TimedThread) threads[i]).failed); }