From 602a4e906aacd0062c82edeb44253f82ff28a9ce Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 7 Jan 2011 17:42:44 +0000 Subject: [PATCH] don't use package private API to assert no unreferenced files git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1056409 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/src/test/org/apache/lucene/index/TestIndexReader.java | 1 + lucene/src/test/org/apache/lucene/index/TestIndexWriter.java | 3 +-- .../test/org/apache/lucene/index/TestIndexWriterDelete.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReader.java b/lucene/src/test/org/apache/lucene/index/TestIndexReader.java index e75d17c28dc..d3a3db8b691 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexReader.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexReader.java @@ -981,6 +981,7 @@ public class TestIndexReader extends LuceneTestCase // new IndexFileDeleter, have it delete // unreferenced files, then verify that in fact // no files were deleted: + IndexWriter.unlock(dir); TestIndexWriter.assertNoUnreferencedFiles(dir, "reader.close() failed to delete unreferenced files"); // Finally, verify index is not corrupt, and, if diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java index 7f84850b4d9..c4e8ba82af6 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java @@ -43,7 +43,6 @@ import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Fieldable; -import org.apache.lucene.index.codecs.CodecProvider; import org.apache.lucene.document.Field.Index; import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.Field.TermVector; @@ -157,7 +156,7 @@ public class TestIndexWriter extends LuceneTestCase { String[] startFiles = dir.listAll(); SegmentInfos infos = new SegmentInfos(); infos.read(dir); - new IndexFileDeleter(dir, new KeepOnlyLastCommitDeletionPolicy(), infos, null, CodecProvider.getDefault()); + new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())).rollback(); String[] endFiles = dir.listAll(); Arrays.sort(startFiles); diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java index 617a6b8d4a6..c546b2a3cb3 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java @@ -832,8 +832,8 @@ public class TestIndexWriterDelete extends LuceneTestCase { } } - TestIndexWriter.assertNoUnreferencedFiles(dir, "docsWriter.abort() failed to delete unreferenced files"); modifier.close(); + TestIndexWriter.assertNoUnreferencedFiles(dir, "docsWriter.abort() failed to delete unreferenced files"); dir.close(); }