Fix test that fails on Windows if it gets a FSDirectory (it intentionally does not close IW/IR). The new cleanup code then complains about inability to delete the index dir

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1586301 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2014-04-10 13:52:25 +00:00
parent 9608b95934
commit 3f773d6699
1 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,8 @@ import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FieldCache;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.store.RAMDirectory;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.JUnitCore; import org.junit.runner.JUnitCore;
@ -41,8 +43,10 @@ public class TestFailOnFieldCacheInsanity extends WithNestedTests {
private AtomicReader subR; private AtomicReader subR;
private void makeIndex() throws Exception { private void makeIndex() throws Exception {
d = newDirectory(); // we use RAMDirectory here, because we dont want to stay on open files on Windows:
RandomIndexWriter w = new RandomIndexWriter(random(), d); d = new MockDirectoryWrapper(random(), new RAMDirectory());
@SuppressWarnings("resource") RandomIndexWriter w =
new RandomIndexWriter(random(), d);
Document doc = new Document(); Document doc = new Document();
doc.add(newField("ints", "1", StringField.TYPE_NOT_STORED)); doc.add(newField("ints", "1", StringField.TYPE_NOT_STORED));
w.addDocument(doc); w.addDocument(doc);