mirror of https://github.com/apache/lucene.git
tests: allow calling useFactory more than once
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1424793 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2d3b44c0e7
commit
fb0a737ff6
|
@ -104,13 +104,16 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
|||
private static String savedFactory;
|
||||
/** Use a different directory factory. Passing "null" sets to an FS-based factory */
|
||||
public static void useFactory(String factory) throws Exception {
|
||||
assert !changedFactory;
|
||||
changedFactory = true;
|
||||
// allow calling more than once so a subclass can override a base class
|
||||
if (!changedFactory) {
|
||||
savedFactory = System.getProperty("solr.DirectoryFactory");
|
||||
}
|
||||
|
||||
if (factory == null) {
|
||||
factory = random().nextInt(100) < 75 ? "solr.NRTCachingDirectoryFactory" : "solr.StandardDirectoryFactory"; // test the default most of the time
|
||||
}
|
||||
System.setProperty("solr.directoryFactory", factory);
|
||||
changedFactory = true;
|
||||
}
|
||||
|
||||
private static void resetFactory() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue