Apache Solr open-source search software
LUCENE-3023: Land DWPT on trunk
Uwe Schindler2a969f828c1b
diff --cc lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.javaindex aa2c228f200,66f7e90ab22..5888a1c008c--- a/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java@@@ -1056,16 -1055,16 +1056,16 @@@ public abstract class LuceneTestCase ex// Assuming every FSDirectory has a ctor(File), but not all may take a// LockFactory too, so setting it afterwards.Constructor<? extends FSDirectory> ctor = clazz.getConstructor(File.class);- FSDirectory d = ctor.newInstance(file);- if (lockFactory != null) {- d.setLockFactory(lockFactory);- }- return d;+ d = ctor.newInstance(file);} catch (Exception e) {- return FSDirectory.open(file);+ d = FSDirectory.open(file);+ }+ if (lockFactory != null) {+ d.setLockFactory(lockFactory);}+ return d;}-+static Directory newDirectoryImpl(Random random, String clazzName) {if (clazzName.equals("random"))clazzName = randomDirectory(random);@@@ -1092,25 -1091,12 +1092,25 @@@/** create a new searcher over the reader.* This searcher might randomly use threads. */public static IndexSearcher newSearcher(IndexReader r) throws IOException {+ return newSearcher(r, true);+ }++ /** create a new searcher over the reader.+ * This searcher might randomly use threads.+ * if <code>maybeWrap</code> is true, this searcher might wrap the reader+ * with one that returns null for getSequentialSubReaders.+ */+ public static IndexSearcher newSearcher(IndexReader r, boolean maybeWrap) throws IOException {if (random.nextBoolean()) {- return new IndexSearcher(r);+ if (maybeWrap && random.nextBoolean()) {+ return new IndexSearcher(new SlowMultiReaderWrapper(r));+ } else {+ return new IndexSearcher(r);+ }} else {int threads = 0;- final ExecutorService ex = (random.nextBoolean()) ? null- : Executors.newFixedThreadPool(threads = _TestUtil.nextInt(random, 1, 8),+ final ExecutorService ex = (random.nextBoolean()) ? null+ : Executors.newFixedThreadPool(threads = _TestUtil.nextInt(random, 1, 8),new NamedThreadFactory("LuceneTestCase"));if (ex != null && VERBOSE) {System.out.println("NOTE: newSearcher using ExecutorService with " + threads + " threads");