testNoSegmentFile failed on Windows

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@953988 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2010-06-12 10:58:16 +00:00
parent 1cf9b74a22
commit 5d7197b306
1 changed files with 6 additions and 9 deletions

View File

@ -4959,24 +4959,21 @@ public class TestIndexWriter extends LuceneTestCase {
File tempDir = _TestUtil.getTempDir("noSegmentFile");
try {
Directory dir = FSDirectory.open(tempDir);
dir.setLockFactory(new NoLockFactory());
dir.setLockFactory(NoLockFactory.getNoLockFactory());
IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer())
.setMaxBufferedDocs(2));
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2));
Document doc = new Document();
doc.add(new Field("c", "val", Store.YES, Index.ANALYZED, TermVector.WITH_POSITIONS_OFFSETS));
w.addDocument(doc);
w.addDocument(doc);
String[] files = dir.listAll();
for(String file : files) {
System.out.println("file=" + file);
}
IndexWriter w2 = new IndexWriter(dir, new IndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer())
.setMaxBufferedDocs(2).setOpenMode(OpenMode.CREATE));
TEST_VERSION_CURRENT, new MockAnalyzer()).setMaxBufferedDocs(2)
.setOpenMode(OpenMode.CREATE));
w2.close();
// If we don't do that, the test fails on Windows
w.rollback();
dir.close();
} finally {
_TestUtil.rmDir(tempDir);