use of org.apache.solr.core.DirectoryFactory.DirContext in project lucene-solr by apache.
the class RAMDirectoryFactoryTest method dotestOpenReturnsTheSameForSamePath.
private void dotestOpenReturnsTheSameForSamePath() throws IOException {
final Directory directory = new RAMDirectory();
RAMDirectoryFactory factory = new RAMDirectoryFactory() {
@Override
protected Directory create(String path, LockFactory lockFactory, DirContext dirContext) {
return directory;
}
};
String path = "/fake/path";
Directory dir1 = factory.get(path, DirContext.DEFAULT, DirectoryFactory.LOCK_TYPE_SINGLE);
Directory dir2 = factory.get(path, DirContext.DEFAULT, DirectoryFactory.LOCK_TYPE_SINGLE);
assertEquals("RAMDirectoryFactory should not create new instance of RefCntRamDirectory " + "every time open() is called for the same path", dir1, dir2);
factory.release(dir1);
factory.release(dir2);
factory.close();
}
Aggregations