Index: src/test/org/apache/lucene/index/TestIndexWriter.java =================================================================== --- src/test/org/apache/lucene/index/TestIndexWriter.java (revision 981834) +++ src/test/org/apache/lucene/index/TestIndexWriter.java (working copy) @@ -54,6 +54,7 @@ import org.apache.lucene.document.Field.TermVector; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.search.DocIdSetIterator; +import org.apache.lucene.search.TopDocs; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.PhraseQuery; import org.apache.lucene.search.Query; @@ -81,7 +82,7 @@ super(name); } - public void testDocCount() throws IOException { + public void xxxtestDocCount() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = null; @@ -167,7 +168,7 @@ either all or none of the incoming documents were in fact added. */ - public void testAddIndexOnDiskFull() throws IOException + public void xxxtestAddIndexOnDiskFull() throws IOException { int START_COUNT = 57; int NUM_DIR = 50; @@ -454,7 +455,7 @@ * Make sure IndexWriter cleans up on hitting a disk * full exception in addDocument. */ - public void testAddDocumentOnDiskFull() throws IOException { + public void xxxtestAddDocumentOnDiskFull() throws IOException { for(int pass=0;pass<2;pass++) { if (VERBOSE) @@ -539,7 +540,7 @@ } } - public void testOptimizeMaxNumSegments() throws IOException { + public void xxxtestOptimizeMaxNumSegments() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); @@ -580,7 +581,7 @@ } } - public void testOptimizeMaxNumSegments2() throws IOException { + public void xxxtestOptimizeMaxNumSegments2() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); final Document doc = new Document(); @@ -625,7 +626,7 @@ * starting index size as its temporary free space * required. */ - public void testOptimizeTempSpaceUsage() throws IOException { + public void xxxtestOptimizeTempSpaceUsage() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -665,7 +666,7 @@ // Make sure we can open an index for create even when a // reader holds it open (this fails pre lock-less // commits on windows): - public void testCreateWithReader() throws IOException { + public void xxxtestCreateWithReader() throws IOException { File indexDir = _TestUtil.getTempDir("lucenetestindexwriter"); try { @@ -700,7 +701,7 @@ // file: make sure we can still open the index (ie, // gracefully fallback to the previous segments file), // and that we can add to the index: - public void testSimulatedCrashedWriter() throws IOException { + public void xxxtestSimulatedCrashedWriter() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = null; @@ -761,7 +762,7 @@ // Simulate a corrupt index by removing last byte of // latest segments file and make sure we get an // IOException trying to open the index: - public void testSimulatedCorruptIndex1() throws IOException { + public void xxxtestSimulatedCorruptIndex1() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = null; @@ -804,7 +805,7 @@ } } - public void testChangesAfterClose() throws IOException { + public void xxxtestChangesAfterClose() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = null; @@ -826,7 +827,7 @@ // Simulate a corrupt index by removing one of the cfs // files and make sure we get an IOException trying to // open the index: - public void testSimulatedCorruptIndex2() throws IOException { + public void xxxtestSimulatedCorruptIndex2() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = null; @@ -868,7 +869,7 @@ * add a bunch of docs, making sure reader does not see * these docs until writer is closed. */ - public void testCommitOnClose() throws IOException { + public void xxxtestCommitOnClose() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); for (int i = 0; i < 14; i++) { @@ -914,7 +915,7 @@ * nothing was added. Then verify we can open the index * and add docs to it. */ - public void testCommitOnCloseAbort() throws IOException { + public void xxxtestCommitOnCloseAbort() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10)); for (int i = 0; i < 14; i++) { @@ -986,7 +987,7 @@ * file. We check this by using MockRAMDirectory to * measure max temp disk space used. */ - public void testCommitOnCloseDiskUsage() throws IOException { + public void xxxtestCommitOnCloseDiskUsage() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); for(int j=0;j<30;j++) { @@ -1029,7 +1030,7 @@ * "commit on close" works correctly both for rollback() * and close(). */ - public void testCommitOnCloseOptimize() throws IOException { + public void xxxtestCommitOnCloseOptimize() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10)); for(int j=0;j<17;j++) { @@ -1072,7 +1073,7 @@ reader.close(); } - public void testIndexNoDocuments() throws IOException { + public void xxxtestIndexNoDocuments() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); writer.commit(); @@ -1093,7 +1094,7 @@ reader.close(); } - public void testManyFields() throws IOException { + public void xxxtestManyFields() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10)); for(int j=0;j<100;j++) { @@ -1123,7 +1124,7 @@ dir.close(); } - public void testSmallRAMBuffer() throws IOException { + public void xxxtestSmallRAMBuffer() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setRAMBufferSizeMB(0.000001)); int lastNumFile = dir.listAll().length; @@ -1149,7 +1150,7 @@ * removed because changing ram buffer settings during a write * session won't be possible. */ - public void testChangingRAMBuffer() throws IOException { + public void xxxtestChangingRAMBuffer() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10).setRAMBufferSizeMB( @@ -1207,7 +1208,7 @@ * @deprecated after setters on IW go away, this test can be deleted because * changing those settings on IW won't be possible. */ - public void testChangingRAMBuffer2() throws IOException { + public void xxxtestChangingRAMBuffer2() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10).setMaxBufferedDeleteTerms( @@ -1266,7 +1267,7 @@ dir.close(); } - public void testDiverseDocs() throws IOException { + public void xxxtestDiverseDocs() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setRAMBufferSizeMB(0.5)); Random rand = newRandom(); @@ -1314,7 +1315,7 @@ dir.close(); } - public void testEnablingNorms() throws IOException { + public void xxxtestEnablingNorms() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(10)); // Enable norms for only 1 doc, pre flush @@ -1360,7 +1361,7 @@ dir.close(); } - public void testHighFreqTerm() throws IOException { + public void xxxtestHighFreqTerm() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxFieldLength(100000000).setRAMBufferSizeMB(0.01)); @@ -1397,7 +1398,7 @@ // implements its own private locking) works OK. This // was raised on java-dev as loss of backwards // compatibility. - public void testNullLockFactory() throws IOException { + public void xxxtestNullLockFactory() throws IOException { final class MyRAMDirectory extends RAMDirectory { private LockFactory myLockFactory; @@ -1431,7 +1432,7 @@ dir.close(); } - public void testFlushWithNoMerging() throws IOException { + public void xxxtestFlushWithNoMerging() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2)); @@ -1450,7 +1451,7 @@ // Make sure we can flush segment w/ norms, then add // empty doc (no norms) and flush - public void testEmptyDocAfterFlushingRealDoc() throws IOException { + public void xxxtestEmptyDocAfterFlushingRealDoc() throws IOException { Directory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); Document doc = new Document(); @@ -1467,7 +1468,7 @@ // Test calling optimize(false) whereby optimize is kicked // off but we don't wait for it to finish (but // writer.close()) does wait - public void testBackgroundOptimize() throws IOException { + public void xxxtestBackgroundOptimize() throws IOException { Directory dir = new MockRAMDirectory(); for(int pass=0;pass<2;pass++) { @@ -1523,7 +1524,7 @@ * @throws IOException * */ - public void testBadSegment() throws IOException { + public void xxxtestBadSegment() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -1536,7 +1537,7 @@ } // LUCENE-1008 - public void testNoTermVectorAfterTermVector() throws IOException { + public void xxxtestNoTermVectorAfterTermVector() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -1563,7 +1564,7 @@ } // LUCENE-1010 - public void testNoTermVectorAfterTermVectorMerge() throws IOException { + public void xxxtestNoTermVectorAfterTermVectorMerge() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -1594,7 +1595,7 @@ } // LUCENE-1036 - public void testMaxThreadPriority() throws IOException { + public void xxxtestMaxThreadPriority() throws IOException { int pri = Thread.currentThread().getPriority(); try { MockRAMDirectory dir = new MockRAMDirectory(); @@ -1638,7 +1639,7 @@ } // LUCENE-1013 - public void testSetMaxMergeDocs() throws IOException { + public void xxxtestSetMaxMergeDocs() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriterConfig conf = new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()) @@ -1656,7 +1657,7 @@ } // LUCENE-1072 - public void testExceptionFromTokenStream() throws IOException { + public void xxxtestExceptionFromTokenStream() throws IOException { RAMDirectory dir = new MockRAMDirectory(); IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new Analyzer() { @@ -1759,7 +1760,7 @@ // LUCENE-1072: make sure an errant exception on flushing // one segment only takes out those docs in that one flush - public void testDocumentsWriterAbort() throws IOException { + public void xxxtestDocumentsWriterAbort() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); FailOnlyOnFlush failure = new FailOnlyOnFlush(); failure.setDoFail(); @@ -1810,7 +1811,7 @@ } } - public void testDocumentsWriterExceptions() throws IOException { + public void xxxtestDocumentsWriterExceptions() throws IOException { Analyzer analyzer = new Analyzer() { @Override public TokenStream tokenStream(String fieldName, Reader reader) { @@ -1893,7 +1894,7 @@ } } - public void testDocumentsWriterExceptionThreads() throws Exception { + public void xxxtestDocumentsWriterExceptionThreads() throws Exception { Analyzer analyzer = new Analyzer() { @Override public TokenStream tokenStream(String fieldName, Reader reader) { @@ -2007,7 +2008,7 @@ } } - public void testVariableSchema() throws Exception { + public void xxxtestVariableSchema() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); int delID = 0; for(int i=0;i<20;i++) { @@ -2058,7 +2059,7 @@ } } - public void testNoWaitClose() throws Throwable { + public void xxxtestNoWaitClose() throws Throwable { RAMDirectory directory = new MockRAMDirectory(); final Document doc = new Document(); @@ -2211,7 +2212,7 @@ // threads are trying to add documents. Strictly // speaking, this isn't valid us of Lucene's APIs, but we // still want to be robust to this case: - public void testCloseWithThreads() throws Exception { + public void xxxtestCloseWithThreads() throws Exception { int NUM_THREADS = 3; for(int iter=0;iter<7;iter++) { @@ -2272,7 +2273,7 @@ // LUCENE-1130: make sure immeidate disk full on creating // an IndexWriter (hit during DW.ThreadState.init()) is // OK: - public void testImmediateDiskFull() throws IOException { + public void xxxtestImmediateDiskFull() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2)); dir.setMaxSizeInBytes(Math.max(1, dir.getRecomputedActualSizeInBytes())); @@ -2305,7 +2306,7 @@ // LUCENE-1130: make sure immediate disk full on creating // an IndexWriter (hit during DW.ThreadState.init()), with // multiple threads, is OK: - public void testImmediateDiskFullWithThreads() throws Exception { + public void xxxtestImmediateDiskFullWithThreads() throws Exception { int NUM_THREADS = 3; @@ -2450,25 +2451,25 @@ // LUCENE-1130: make sure initial IOException, and then 2nd // IOException during rollback(), is OK: - public void testIOExceptionDuringAbort() throws IOException { + public void xxxtestIOExceptionDuringAbort() throws IOException { _testSingleThreadFailure(new FailOnlyOnAbortOrFlush(false)); } // LUCENE-1130: make sure initial IOException, and then 2nd // IOException during rollback(), is OK: - public void testIOExceptionDuringAbortOnlyOnce() throws IOException { + public void xxxtestIOExceptionDuringAbortOnlyOnce() throws IOException { _testSingleThreadFailure(new FailOnlyOnAbortOrFlush(true)); } // LUCENE-1130: make sure initial IOException, and then 2nd // IOException during rollback(), with multiple threads, is OK: - public void testIOExceptionDuringAbortWithThreads() throws Exception { + public void xxxtestIOExceptionDuringAbortWithThreads() throws Exception { _testMultipleThreadsFailure(new FailOnlyOnAbortOrFlush(false)); } // LUCENE-1130: make sure initial IOException, and then 2nd // IOException during rollback(), with multiple threads, is OK: - public void testIOExceptionDuringAbortWithThreadsOnlyOnce() throws Exception { + public void xxxtestIOExceptionDuringAbortWithThreadsOnlyOnce() throws Exception { _testMultipleThreadsFailure(new FailOnlyOnAbortOrFlush(true)); } @@ -2494,22 +2495,22 @@ } // LUCENE-1130: test IOException in closeDocStore - public void testIOExceptionDuringCloseDocStore() throws IOException { + public void xxxtestIOExceptionDuringCloseDocStore() throws IOException { _testSingleThreadFailure(new FailOnlyInCloseDocStore(false)); } // LUCENE-1130: test IOException in closeDocStore - public void testIOExceptionDuringCloseDocStoreOnlyOnce() throws IOException { + public void xxxtestIOExceptionDuringCloseDocStoreOnlyOnce() throws IOException { _testSingleThreadFailure(new FailOnlyInCloseDocStore(true)); } // LUCENE-1130: test IOException in closeDocStore, with threads - public void testIOExceptionDuringCloseDocStoreWithThreads() throws Exception { + public void xxxtestIOExceptionDuringCloseDocStoreWithThreads() throws Exception { _testMultipleThreadsFailure(new FailOnlyInCloseDocStore(false)); } // LUCENE-1130: test IOException in closeDocStore, with threads - public void testIOExceptionDuringCloseDocStoreWithThreadsOnlyOnce() throws Exception { + public void xxxtestIOExceptionDuringCloseDocStoreWithThreadsOnlyOnce() throws Exception { _testMultipleThreadsFailure(new FailOnlyInCloseDocStore(true)); } @@ -2535,27 +2536,27 @@ } // LUCENE-1130: test IOException in writeSegment - public void testIOExceptionDuringWriteSegment() throws IOException { + public void xxxtestIOExceptionDuringWriteSegment() throws IOException { _testSingleThreadFailure(new FailOnlyInWriteSegment(false)); } // LUCENE-1130: test IOException in writeSegment - public void testIOExceptionDuringWriteSegmentOnlyOnce() throws IOException { + public void xxxtestIOExceptionDuringWriteSegmentOnlyOnce() throws IOException { _testSingleThreadFailure(new FailOnlyInWriteSegment(true)); } // LUCENE-1130: test IOException in writeSegment, with threads - public void testIOExceptionDuringWriteSegmentWithThreads() throws Exception { + public void xxxtestIOExceptionDuringWriteSegmentWithThreads() throws Exception { _testMultipleThreadsFailure(new FailOnlyInWriteSegment(false)); } // LUCENE-1130: test IOException in writeSegment, with threads - public void testIOExceptionDuringWriteSegmentWithThreadsOnlyOnce() throws Exception { + public void xxxtestIOExceptionDuringWriteSegmentWithThreadsOnlyOnce() throws Exception { _testMultipleThreadsFailure(new FailOnlyInWriteSegment(true)); } // LUCENE-1084: test unlimited field length - public void testUnlimitedMaxFieldLength() throws IOException { + public void xxxtestUnlimitedMaxFieldLength() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -2577,7 +2578,7 @@ } // LUCENE-1044: Simulate checksum error in segments_N - public void testSegmentsChecksumError() throws IOException { + public void xxxtestSegmentsChecksumError() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = null; @@ -2615,7 +2616,7 @@ } // LUCENE-1044: test writer.commit() when ac=false - public void testForceCommit() throws IOException { + public void xxxtestForceCommit() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( @@ -2669,7 +2670,7 @@ } // LUCENE-1044: test exception during sync - public void testExceptionDuringSync() throws IOException { + public void xxxtestExceptionDuringSync() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); FailOnlyInSync failure = new FailOnlyInSync(); dir.failOn(failure); @@ -2701,7 +2702,7 @@ } // LUCENE-1168 - public void testTermVectorCorruption() throws IOException { + public void xxxtestTermVectorCorruption() throws IOException { Directory dir = new MockRAMDirectory(); for(int iter=0;iter<2;iter++) { @@ -2753,7 +2754,7 @@ } // LUCENE-1168 - public void testTermVectorCorruption2() throws IOException { + public void xxxtestTermVectorCorruption2() throws IOException { Directory dir = new MockRAMDirectory(); for(int iter=0;iter<2;iter++) { IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( @@ -2791,7 +2792,7 @@ } // LUCENE-1168 - public void testTermVectorCorruption3() throws IOException { + public void xxxtestTermVectorCorruption3() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()) @@ -2834,7 +2835,7 @@ } // LUCENE-1084: test user-specified field length - public void testUserSpecifiedMaxFieldLength() throws IOException { + public void xxxtestUserSpecifiedMaxFieldLength() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( @@ -2858,7 +2859,7 @@ // LUCENE-325: test expungeDeletes, when 2 singular merges // are required - public void testExpungeDeletes() throws IOException { + public void xxxtestExpungeDeletes() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()) @@ -2901,7 +2902,7 @@ } // LUCENE-325: test expungeDeletes, when many adjacent merges are required - public void testExpungeDeletes2() throws IOException { + public void xxxtestExpungeDeletes2() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()) @@ -2946,7 +2947,7 @@ // LUCENE-325: test expungeDeletes without waiting, when // many adjacent merges are required - public void testExpungeDeletes3() throws IOException { + public void xxxtestExpungeDeletes3() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()) @@ -2989,7 +2990,7 @@ } // LUCENE-1179 - public void testEmptyFieldName() throws IOException { + public void xxxtestEmptyFieldName() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); Document doc = new Document(); @@ -3016,7 +3017,7 @@ } - public void testExceptionDocumentsWriterInit() throws IOException { + public void xxxtestExceptionDocumentsWriterInit() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); MockIndexWriter w = new MockIndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); Document doc = new Document(); @@ -3036,7 +3037,7 @@ } // LUCENE-1208 - public void testExceptionJustBeforeFlush() throws IOException { + public void xxxtestExceptionJustBeforeFlush() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); MockIndexWriter w = new MockIndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2)); Document doc = new Document(); @@ -3086,7 +3087,7 @@ // LUCENE-1210 - public void testExceptionOnMergeInit() throws IOException { + public void xxxtestExceptionOnMergeInit() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2); ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(2); @@ -3130,7 +3131,7 @@ // LUCENE-1222 - public void testDoBeforeAfterFlush() throws IOException { + public void xxxtestDoBeforeAfterFlush() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); MockIndexWriter3 w = new MockIndexWriter3(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); Document doc = new Document(); @@ -3186,7 +3187,7 @@ // LUCENE-1214 - public void testExceptionsDuringCommit() throws Throwable { + public void xxxtestExceptionsDuringCommit() throws Throwable { MockRAMDirectory dir = new MockRAMDirectory(); FailOnlyInCommit failure = new FailOnlyInCommit(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -3235,7 +3236,7 @@ }; // LUCENE-510 - public void testInvalidUTF16() throws Throwable { + public void xxxtestInvalidUTF16() throws Throwable { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); Document doc = new Document(); @@ -3257,7 +3258,7 @@ } // LUCENE-510 - public void testAllUnicodeChars() throws Throwable { + public void xxxtestAllUnicodeChars() throws Throwable { BytesRef utf8 = new BytesRef(10); UnicodeUtil.UTF16Result utf16 = new UnicodeUtil.UTF16Result(); @@ -3347,7 +3348,7 @@ } // LUCENE-510 - public void testRandomUnicodeStrings() throws Throwable { + public void xxxtestRandomUnicodeStrings() throws Throwable { r = newRandom(); char[] buffer = new char[20]; @@ -3376,7 +3377,7 @@ } // LUCENE-510 - public void testIncrementalUnicodeStrings() throws Throwable { + public void xxxtestIncrementalUnicodeStrings() throws Throwable { r = newRandom(); char[] buffer = new char[20]; char[] expected = new char[20]; @@ -3432,7 +3433,7 @@ } // LUCENE-1255 - public void testNegativePositions() throws Throwable { + public void xxxtestNegativePositions() throws Throwable { final TokenStream tokens = new TokenStream() { final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class); final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class); @@ -3486,7 +3487,7 @@ } // LUCENE-1274: test writer.prepareCommit() - public void testPrepareCommit() throws IOException { + public void xxxtestPrepareCommit() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2)); @@ -3537,7 +3538,7 @@ } // LUCENE-1274: test writer.prepareCommit() - public void testPrepareCommitRollback() throws IOException { + public void xxxtestPrepareCommitRollback() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); dir.setPreventDoubleWrite(false); @@ -3590,7 +3591,7 @@ } // LUCENE-1274 - public void testPrepareCommitNoChanges() throws IOException { + public void xxxtestPrepareCommitNoChanges() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -3724,7 +3725,7 @@ // LUCENE-1335: test simultaneous addIndexes & commits // from multiple threads - public void testAddIndexesWithThreads() throws Throwable { + public void xxxtestAddIndexesWithThreads() throws Throwable { final int NUM_ITER = 15; final int NUM_COPY = 3; @@ -3769,7 +3770,7 @@ } // LUCENE-1335: test simultaneous addIndexes & close - public void testAddIndexesWithClose() throws Throwable { + public void xxxtestAddIndexesWithClose() throws Throwable { final int NUM_COPY = 3; CommitAndAddIndexes2 c = new CommitAndAddIndexes2(NUM_COPY); //c.writer2.setInfoStream(System.out); @@ -3835,7 +3836,7 @@ } // LUCENE-1335: test simultaneous addIndexes & close - public void testAddIndexesWithCloseNoWait() throws Throwable { + public void xxxtestAddIndexesWithCloseNoWait() throws Throwable { final int NUM_COPY = 50; CommitAndAddIndexes3 c = new CommitAndAddIndexes3(NUM_COPY); @@ -3856,7 +3857,7 @@ } // LUCENE-1335: test simultaneous addIndexes & close - public void testAddIndexesWithRollback() throws Throwable { + public void xxxtestAddIndexesWithRollback() throws Throwable { final int NUM_COPY = 50; CommitAndAddIndexes3 c = new CommitAndAddIndexes3(NUM_COPY); @@ -3896,7 +3897,7 @@ // LUCENE-1347 - public void testRollbackExceptionHang() throws Throwable { + public void xxxtestRollbackExceptionHang() throws Throwable { MockRAMDirectory dir = new MockRAMDirectory(); MockIndexWriter4 w = new MockIndexWriter4(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -3915,7 +3916,7 @@ // LUCENE-1219 - public void testBinaryFieldOffsetLength() throws IOException { + public void xxxtestBinaryFieldOffsetLength() throws IOException { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); byte[] b = new byte[50]; @@ -3945,7 +3946,7 @@ } // LUCENE-1382 - public void testCommitUserData() throws IOException { + public void xxxtestCommitUserData() throws IOException { Directory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2)); for(int j=0;j<17;j++) @@ -3982,7 +3983,7 @@ dir.close(); } - public void testOptimizeExceptions() throws IOException { + public void xxxtestOptimizeExceptions() throws IOException { RAMDirectory startDir = new MockRAMDirectory(); IndexWriterConfig conf = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2); ((LogMergePolicy) conf.getMergePolicy()).setMergeFactor(100); @@ -4009,7 +4010,7 @@ } // LUCENE-1429 - public void testOutOfMemoryErrorCausesCloseToFail() throws Exception { + public void xxxtestOutOfMemoryErrorCausesCloseToFail() throws Exception { final List thrown = new ArrayList(); @@ -4037,7 +4038,7 @@ } // LUCENE-1442 - public void testDoubleOffsetCounting() throws Exception { + public void xxxtestDoubleOffsetCounting() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -4073,7 +4074,7 @@ } // LUCENE-1442 - public void testDoubleOffsetCounting2() throws Exception { + public void xxxtestDoubleOffsetCounting2() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); Document doc = new Document(); @@ -4095,7 +4096,7 @@ } // LUCENE-1448 - public void testEndOffsetPositionCharAnalyzer() throws Exception { + public void xxxtestEndOffsetPositionCharAnalyzer() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); Document doc = new Document(); @@ -4117,7 +4118,7 @@ } // LUCENE-1448 - public void testEndOffsetPositionWithCachingTokenFilter() throws Exception { + public void xxxtestEndOffsetPositionWithCachingTokenFilter() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); Analyzer analyzer = new MockAnalyzer(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, analyzer)); @@ -4141,7 +4142,7 @@ } // LUCENE-1448 - public void testEndOffsetPositionStopFilter() throws Exception { + public void xxxtestEndOffsetPositionStopFilter() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true))); @@ -4164,7 +4165,7 @@ } // LUCENE-1448 - public void testEndOffsetPositionStandard() throws Exception { + public void xxxtestEndOffsetPositionStandard() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -4195,7 +4196,7 @@ } // LUCENE-1448 - public void testEndOffsetPositionStandardEmptyField() throws Exception { + public void xxxtestEndOffsetPositionStandardEmptyField() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -4223,7 +4224,7 @@ } // LUCENE-1448 - public void testEndOffsetPositionStandardEmptyField2() throws Exception { + public void xxxtestEndOffsetPositionStandardEmptyField2() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -4258,7 +4259,7 @@ // LUCENE-1468 -- make sure opening an IndexWriter with // create=true does not remove non-index files - public void testOtherFiles() throws Throwable { + public void xxxtestOtherFiles() throws Throwable { File indexDir = new File(TEMP_DIR, "otherfiles"); Directory dir = FSDirectory.open(indexDir); try { @@ -4277,7 +4278,7 @@ } } - public void testDeadlock() throws Exception { + public void xxxtestDeadlock() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2)); Document doc = new Document(); @@ -4417,7 +4418,7 @@ } } - public void testThreadInterruptDeadlock() throws Exception { + public void xxxtestThreadInterruptDeadlock() throws Exception { IndexerThreadInterrupt t = new IndexerThreadInterrupt(); t.setDaemon(true); t.start(); @@ -4444,7 +4445,7 @@ } - public void testIndexStoreCombos() throws Exception { + public void xxxtestIndexStoreCombos() throws Exception { MockRAMDirectory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); byte[] b = new byte[50]; @@ -4506,7 +4507,7 @@ } // LUCENE-1727: make sure doc fields are stored in order - public void testStoredFieldsOrder() throws Throwable { + public void xxxtestStoredFieldsOrder() throws Throwable { Directory d = new MockRAMDirectory(); IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); Document doc = new Document(); @@ -4537,7 +4538,7 @@ d.close(); } - public void testEmbeddedFFFF() throws Throwable { + public void xxxtestEmbeddedFFFF() throws Throwable { Directory d = new MockRAMDirectory(); IndexWriter w = new IndexWriter(d, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -4555,7 +4556,7 @@ d.close(); } - public void testNoDocsIndex() throws Throwable { + public void xxxtestNoDocsIndex() throws Throwable { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())); @@ -4574,7 +4575,7 @@ // LUCENE-2095: make sure with multiple threads commit // doesn't return until all changes are in fact in the // index - public void testCommitThreadSafety() throws Throwable { + public void xxxtestCommitThreadSafety() throws Throwable { final int NUM_THREADS = 5; final double RUN_SEC = 0.5; final Directory dir = new MockRAMDirectory(); @@ -4683,7 +4684,7 @@ // Make sure terms, including ones with surrogate pairs, // sort in codepoint sort order by default - public void testTermUTF16SortOrder() throws Throwable { + public void xxxtestTermUTF16SortOrder() throws Throwable { Random rnd = newRandom(); Directory dir = new MockRAMDirectory(); RandomIndexWriter writer = new RandomIndexWriter(rnd, dir); @@ -4748,7 +4749,7 @@ dir.close(); } - public void testIndexDivisor() throws Exception { + public void xxxtestIndexDivisor() throws Exception { Directory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new MockAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED); StringBuilder s = new StringBuilder(); @@ -4775,7 +4776,7 @@ dir.close(); } - public void testDeleteUnusedFiles() throws Exception { + public void xxxtestDeleteUnusedFiles() throws Exception { for(int iter=0;iter<2;iter++) { Directory dir = new MockRAMDirectory(); @@ -4833,7 +4834,7 @@ } } - public void testDeleteUnsedFiles2() throws Exception { + public void xxxtestDeleteUnsedFiles2() throws Exception { // Validates that iw.deleteUnusedFiles() also deletes unused index commits // in case a deletion policy which holds onto commits is used. Directory dir = new MockRAMDirectory(); @@ -4877,7 +4878,7 @@ } } - public void testIndexingThenDeleting() throws Exception { + public void xxxtestIndexingThenDeleting() throws Exception { final Random r = newRandom(); Directory dir = new MockRAMDirectory(); @@ -4911,7 +4912,7 @@ dir.close(); } - public void testNoCommits() throws Exception { + public void xxxtestNoCommits() throws Exception { // Tests that if we don't call commit(), the directory has 0 commits. This has // changed since LUCENE-2386, where before IW would always commit on a fresh // new index. @@ -4928,7 +4929,7 @@ assertEquals("expected 1 commits!", 1, IndexReader.listCommits(dir).size()); } - public void testEmptyFSDirWithNoLock() throws Exception { + public void xxxtestEmptyFSDirWithNoLock() throws Exception { // Tests that if FSDir is opened w/ a NoLockFactory (or SingleInstanceLF), // then IndexWriter ctor succeeds. Previously (LUCENE-2386) it failed // when listAll() was called in IndexFileDeleter. @@ -4936,7 +4937,7 @@ new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())).close(); } - public void testEmptyDirRollback() throws Exception { + public void xxxtestEmptyDirRollback() throws Exception { // Tests that if IW is created over an empty Directory, some documents are // indexed, flushed (but not committed) and then IW rolls back, then no // files are left in the Directory. @@ -4968,7 +4969,7 @@ assertEquals("expected a no-op close after IW.rollback()", 0, dir.listAll().length); } - public void testNoSegmentFile() throws IOException { + public void xxxtestNoSegmentFile() throws IOException { File tempDir = _TestUtil.getTempDir("noSegmentFile"); try { Directory dir = FSDirectory.open(tempDir); @@ -4993,7 +4994,7 @@ } } - public void testFutureCommit() throws Exception { + public void xxxtestFutureCommit() throws Exception { Directory dir = new MockRAMDirectory(); IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()).setIndexDeletionPolicy(NoDeletionPolicy.INSTANCE)); @@ -5073,23 +5074,31 @@ File index = _TestUtil.getTempDir("lucenerandfields"); Directory dir = FSDirectory.open(index); try { - Random rand = newRandom(); + // nocommit seed + Random rand = newRandom(1864464794067677128L); + //Random rand = newRandom(); RandomIndexWriter w = new RandomIndexWriter(rand, dir, newIndexWriterConfig(rand, TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(_TestUtil.nextInt(rand, 5, 20))); + w.w.setInfoStream(System.out); final int docCount = 200*RANDOM_MULTIPLIER; final int fieldCount = _TestUtil.nextInt(rand, 1, 5); - String[][] fields = new String[fieldCount][]; - for(int i=0;i fieldIDs = new ArrayList(); + Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED); + for(int i=0;i docs = new HashMap(); for(int i=0;i Number every so often Collections.shuffle(fieldIDs); } + if (rand.nextInt(5) == 3 && i > 0) { + final String delID = ""+rand.nextInt(i); + w.deleteDocuments(new Term("id", delID)); + docs.remove(delID); + } } - for(int x=0;x<2;x++) { - IndexReader r = w.getReader(); + if (docs.size() > 0) { + String[] idsList = docs.keySet().toArray(new String[docs.size()]); - for(int iter=0;iter<1000*RANDOM_MULTIPLIER;iter++) { - int docID = rand.nextInt(docCount); - Document doc = r.document(docID); - for(int i=0;i