diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java index 58c8288c18d..10492a2fc78 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java @@ -142,8 +142,8 @@ public class TestIndexWriterOnDiskFull extends LuceneTestCase { public void testAddIndexOnDiskFull() throws IOException { int START_COUNT = 57; - int NUM_DIR = 50; - int END_COUNT = START_COUNT + NUM_DIR*25; + int NUM_DIR = TEST_NIGHTLY ? 50 : 5; + int END_COUNT = START_COUNT + NUM_DIR* (TEST_NIGHTLY ? 25 : 5); // Build up a bunch of dirs that have indexes which we // will then merge together by calling addIndexes(*): diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java index 696a884fd98..c7f14c5a561 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java @@ -48,6 +48,8 @@ import java.util.concurrent.atomic.AtomicInteger; public class TestIndexWriterReader extends LuceneTestCase { static PrintStream infoStream = VERBOSE ? System.out : null; + private final int numThreads = TEST_NIGHTLY ? 5 : 3; + public static int count(Term t, IndexReader r) throws IOException { int count = 0; DocsEnum td = MultiFields.getTermDocsEnum(r, @@ -381,7 +383,7 @@ public class TestIndexWriterReader extends LuceneTestCase { addDirThreads.launchThreads(numDirs); addDirThreads.joinThreads(); - //assertEquals(100 + numDirs * (3 * numIter / 4) * addDirThreads.NUM_THREADS + //assertEquals(100 + numDirs * (3 * numIter / 4) * addDirThreads.numThreads // * addDirThreads.NUM_INIT_DOCS, addDirThreads.mainWriter.numDocs()); assertEquals(addDirThreads.count.intValue(), addDirThreads.mainWriter.numDocs()); @@ -393,7 +395,7 @@ public class TestIndexWriterReader extends LuceneTestCase { IndexReader reader = IndexReader.open(mainDir, true); assertEquals(addDirThreads.count.intValue(), reader.numDocs()); - //assertEquals(100 + numDirs * (3 * numIter / 4) * addDirThreads.NUM_THREADS + //assertEquals(100 + numDirs * (3 * numIter / 4) * addDirThreads.numThreads // * addDirThreads.NUM_INIT_DOCS, reader.numDocs()); reader.close(); @@ -403,10 +405,9 @@ public class TestIndexWriterReader extends LuceneTestCase { private class AddDirectoriesThreads { Directory addDir; - final static int NUM_THREADS = 5; final static int NUM_INIT_DOCS = 100; int numDirs; - final Thread[] threads = new Thread[NUM_THREADS]; + final Thread[] threads = new Thread[numThreads]; IndexWriter mainWriter; final List failures = new ArrayList(); IndexReader[] readers; @@ -432,7 +433,7 @@ public class TestIndexWriterReader extends LuceneTestCase { } void joinThreads() { - for (int i = 0; i < NUM_THREADS; i++) + for (int i = 0; i < numThreads; i++) try { threads[i].join(); } catch (InterruptedException ie) { @@ -462,7 +463,7 @@ public class TestIndexWriterReader extends LuceneTestCase { } void launchThreads(final int numIter) { - for (int i = 0; i < NUM_THREADS; i++) { + for (int i = 0; i < numThreads; i++) { threads[i] = new Thread() { @Override public void run() { @@ -489,7 +490,7 @@ public class TestIndexWriterReader extends LuceneTestCase { } }; } - for (int i = 0; i < NUM_THREADS; i++) + for (int i = 0; i < numThreads; i++) threads[i].start(); } @@ -759,14 +760,13 @@ public class TestIndexWriterReader extends LuceneTestCase { IndexReader r = writer.getReader(); - final int NUM_THREAD = 5; final float SECONDS = 0.5f; final long endTime = (long) (System.currentTimeMillis() + 1000.*SECONDS); final List excs = Collections.synchronizedList(new ArrayList()); - final Thread[] threads = new Thread[NUM_THREAD]; - for(int i=0;i excs = Collections.synchronizedList(new ArrayList()); - final Thread[] threads = new Thread[NUM_THREAD]; - for(int i=0;i