You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2012/04/15 16:42:01 UTC

svn commit: r1326351 [13/22] - in /lucene/dev/trunk: ./ dev-tools/eclipse/ lucene/ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/custom/ lucene/contrib/hig...

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java Sun Apr 15 14:41:44 2012
@@ -164,7 +164,7 @@ public class TestFSTs extends LuceneTest
         for(IntsRef term : terms2) {
           pairs.add(new FSTTester.InputOutput<Object>(term, NO_OUTPUT));
         }
-        FST<Object> fst = new FSTTester<Object>(random, dir, inputMode, pairs, outputs, false).doTest(0, 0, false);
+        FST<Object> fst = new FSTTester<Object>(random(), dir, inputMode, pairs, outputs, false).doTest(0, 0, false);
         assertNotNull(fst);
         assertEquals(22, fst.getNodeCount());
         assertEquals(27, fst.getArcCount());
@@ -177,7 +177,7 @@ public class TestFSTs extends LuceneTest
         for(int idx=0;idx<terms2.length;idx++) {
           pairs.add(new FSTTester.InputOutput<Long>(terms2[idx], (long) idx));
         }
-        final FST<Long> fst = new FSTTester<Long>(random, dir, inputMode, pairs, outputs, true).doTest(0, 0, false);
+        final FST<Long> fst = new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, true).doTest(0, 0, false);
         assertNotNull(fst);
         assertEquals(22, fst.getNodeCount());
         assertEquals(27, fst.getArcCount());
@@ -189,10 +189,10 @@ public class TestFSTs extends LuceneTest
         final BytesRef NO_OUTPUT = outputs.getNoOutput();      
         final List<FSTTester.InputOutput<BytesRef>> pairs = new ArrayList<FSTTester.InputOutput<BytesRef>>(terms2.length);
         for(int idx=0;idx<terms2.length;idx++) {
-          final BytesRef output = random.nextInt(30) == 17 ? NO_OUTPUT : new BytesRef(Integer.toString(idx));
+          final BytesRef output = random().nextInt(30) == 17 ? NO_OUTPUT : new BytesRef(Integer.toString(idx));
           pairs.add(new FSTTester.InputOutput<BytesRef>(terms2[idx], output));
         }
-        final FST<BytesRef> fst = new FSTTester<BytesRef>(random, dir, inputMode, pairs, outputs, false).doTest(0, 0, false);
+        final FST<BytesRef> fst = new FSTTester<BytesRef>(random(), dir, inputMode, pairs, outputs, false).doTest(0, 0, false);
         assertNotNull(fst);
         assertEquals(24, fst.getNodeCount());
         assertEquals(30, fst.getArcCount());
@@ -225,7 +225,7 @@ public class TestFSTs extends LuceneTest
       for(IntsRef term : terms) {
         pairs.add(new FSTTester.InputOutput<Object>(term, NO_OUTPUT));
       }
-      new FSTTester<Object>(random, dir, inputMode, pairs, outputs, false).doTest();
+      new FSTTester<Object>(random(), dir, inputMode, pairs, outputs, false).doTest();
     }
 
     // PositiveIntOutput (ord)
@@ -235,47 +235,47 @@ public class TestFSTs extends LuceneTest
       for(int idx=0;idx<terms.length;idx++) {
         pairs.add(new FSTTester.InputOutput<Long>(terms[idx], (long) idx));
       }
-      new FSTTester<Long>(random, dir, inputMode, pairs, outputs, true).doTest();
+      new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, true).doTest();
     }
 
     // PositiveIntOutput (random monotonically increasing positive number)
     {
-      final boolean doShare = random.nextBoolean();
+      final boolean doShare = random().nextBoolean();
       final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(doShare);
       final List<FSTTester.InputOutput<Long>> pairs = new ArrayList<FSTTester.InputOutput<Long>>(terms.length);
       long lastOutput = 0;
       for(int idx=0;idx<terms.length;idx++) {
-        final long value = lastOutput + _TestUtil.nextInt(random, 1, 1000);
+        final long value = lastOutput + _TestUtil.nextInt(random(), 1, 1000);
         lastOutput = value;
         pairs.add(new FSTTester.InputOutput<Long>(terms[idx], value));
       }
-      new FSTTester<Long>(random, dir, inputMode, pairs, outputs, doShare).doTest();
+      new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, doShare).doTest();
     }
 
     // PositiveIntOutput (random positive number)
     {
-      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(random.nextBoolean());
+      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(random().nextBoolean());
       final List<FSTTester.InputOutput<Long>> pairs = new ArrayList<FSTTester.InputOutput<Long>>(terms.length);
       for(int idx=0;idx<terms.length;idx++) {
-        pairs.add(new FSTTester.InputOutput<Long>(terms[idx], random.nextLong() & Long.MAX_VALUE));
+        pairs.add(new FSTTester.InputOutput<Long>(terms[idx], random().nextLong() & Long.MAX_VALUE));
       }
-      new FSTTester<Long>(random, dir, inputMode, pairs, outputs, false).doTest();
+      new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, false).doTest();
     }
 
     // Pair<ord, (random monotonically increasing positive number>
     {
-      final PositiveIntOutputs o1 = PositiveIntOutputs.getSingleton(random.nextBoolean());
-      final PositiveIntOutputs o2 = PositiveIntOutputs.getSingleton(random.nextBoolean());
+      final PositiveIntOutputs o1 = PositiveIntOutputs.getSingleton(random().nextBoolean());
+      final PositiveIntOutputs o2 = PositiveIntOutputs.getSingleton(random().nextBoolean());
       final PairOutputs<Long,Long> outputs = new PairOutputs<Long,Long>(o1, o2);
       final List<FSTTester.InputOutput<PairOutputs.Pair<Long,Long>>> pairs = new ArrayList<FSTTester.InputOutput<PairOutputs.Pair<Long,Long>>>(terms.length);
       long lastOutput = 0;
       for(int idx=0;idx<terms.length;idx++) {
-        final long value = lastOutput + _TestUtil.nextInt(random, 1, 1000);
+        final long value = lastOutput + _TestUtil.nextInt(random(), 1, 1000);
         lastOutput = value;
         pairs.add(new FSTTester.InputOutput<PairOutputs.Pair<Long,Long>>(terms[idx],
                                                                          outputs.newPair((long) idx, value)));
       }
-      new FSTTester<PairOutputs.Pair<Long,Long>>(random, dir, inputMode, pairs, outputs, false).doTest();
+      new FSTTester<PairOutputs.Pair<Long,Long>>(random(), dir, inputMode, pairs, outputs, false).doTest();
     }
 
     // Sequence-of-bytes
@@ -284,10 +284,10 @@ public class TestFSTs extends LuceneTest
       final BytesRef NO_OUTPUT = outputs.getNoOutput();      
       final List<FSTTester.InputOutput<BytesRef>> pairs = new ArrayList<FSTTester.InputOutput<BytesRef>>(terms.length);
       for(int idx=0;idx<terms.length;idx++) {
-        final BytesRef output = random.nextInt(30) == 17 ? NO_OUTPUT : new BytesRef(Integer.toString(idx));
+        final BytesRef output = random().nextInt(30) == 17 ? NO_OUTPUT : new BytesRef(Integer.toString(idx));
         pairs.add(new FSTTester.InputOutput<BytesRef>(terms[idx], output));
       }
-      new FSTTester<BytesRef>(random, dir, inputMode, pairs, outputs, false).doTest();
+      new FSTTester<BytesRef>(random(), dir, inputMode, pairs, outputs, false).doTest();
     }
 
     // Sequence-of-ints
@@ -303,7 +303,7 @@ public class TestFSTs extends LuceneTest
         }
         pairs.add(new FSTTester.InputOutput<IntsRef>(terms[idx], output));
       }
-      new FSTTester<IntsRef>(random, dir, inputMode, pairs, outputs, false).doTest();
+      new FSTTester<IntsRef>(random(), dir, inputMode, pairs, outputs, false).doTest();
     }
 
     // Up to two positive ints, shared, generally but not
@@ -317,15 +317,15 @@ public class TestFSTs extends LuceneTest
       long lastOutput = 0;
       for(int idx=0;idx<terms.length;idx++) {
         // Sometimes go backwards
-        long value = lastOutput + _TestUtil.nextInt(random, -100, 1000);
+        long value = lastOutput + _TestUtil.nextInt(random(), -100, 1000);
         while(value < 0) {
-          value = lastOutput + _TestUtil.nextInt(random, -100, 1000);
+          value = lastOutput + _TestUtil.nextInt(random(), -100, 1000);
         }
         final Object output;
-        if (random.nextInt(5) == 3) {
-          long value2 = lastOutput + _TestUtil.nextInt(random, -100, 1000);
+        if (random().nextInt(5) == 3) {
+          long value2 = lastOutput + _TestUtil.nextInt(random(), -100, 1000);
           while(value2 < 0) {
-            value2 = lastOutput + _TestUtil.nextInt(random, -100, 1000);
+            value2 = lastOutput + _TestUtil.nextInt(random(), -100, 1000);
           }
           output = outputs.get(value, value2);
         } else {
@@ -333,7 +333,7 @@ public class TestFSTs extends LuceneTest
         }
         pairs.add(new FSTTester.InputOutput<Object>(terms[idx], output));
       }
-      new FSTTester<Object>(random, dir, inputMode, pairs, outputs, false).doTest();
+      new FSTTester<Object>(random(), dir, inputMode, pairs, outputs, false).doTest();
     }
   }
 
@@ -665,7 +665,7 @@ public class TestFSTs extends LuceneTest
         if (random.nextBoolean()) {
           // seek to term that doesn't exist:
           while(true) {
-            final IntsRef term = toIntsRef(getRandomString(), inputMode);
+            final IntsRef term = toIntsRef(getRandomString(random), inputMode);
             int pos = Collections.binarySearch(pairs, new InputOutput<T>(term, null));
             if (pos < 0) {
               pos = -(pos+1);
@@ -762,7 +762,7 @@ public class TestFSTs extends LuceneTest
           } else if (upto != -1 && upto < 0.75 * pairs.size() && random.nextBoolean()) {
             int attempt = 0;
             for(;attempt<10;attempt++) {
-              IntsRef term = toIntsRef(getRandomString(), inputMode);
+              IntsRef term = toIntsRef(getRandomString(random), inputMode);
               if (!termsMap.containsKey(term) && term.compareTo(pairs.get(upto).input) > 0) {
                 int pos = Collections.binarySearch(pairs, new InputOutput<T>(term, null));
                 assert pos < 0;
@@ -1034,6 +1034,7 @@ public class TestFSTs extends LuceneTest
   }
 
   private void testRandomWords(int maxNumWords, int numIter) throws IOException {
+    Random random = new Random(random().nextLong());
     for(int iter=0;iter<numIter;iter++) {
       if (VERBOSE) {
         System.out.println("\nTEST: iter " + iter);
@@ -1043,7 +1044,7 @@ public class TestFSTs extends LuceneTest
         Set<IntsRef> termsSet = new HashSet<IntsRef>();
         IntsRef[] terms = new IntsRef[numWords];
         while(termsSet.size() < numWords) {
-          final String term = getRandomString();
+          final String term = getRandomString(random);
           termsSet.add(toIntsRef(term, inputMode));
         }
         doTest(inputMode, termsSet.toArray(new IntsRef[termsSet.size()]));
@@ -1051,7 +1052,7 @@ public class TestFSTs extends LuceneTest
     }
   }
 
-  static String getRandomString() {
+  static String getRandomString(Random random) {
     final String term;
     if (random.nextBoolean()) {
       term = _TestUtil.randomRealisticUnicodeString(random);
@@ -1066,7 +1067,7 @@ public class TestFSTs extends LuceneTest
 
   @Nightly
   public void testBigSet() throws IOException {
-    testRandomWords(_TestUtil.nextInt(random, 50000, 60000), 1);
+    testRandomWords(_TestUtil.nextInt(random(), 50000, 60000), 1);
   }
   
   static String inputToString(int inputMode, IntsRef term) {
@@ -1096,9 +1097,9 @@ public class TestFSTs extends LuceneTest
       Codec.setDefault(_TestUtil.alwaysPostingsFormat(new Lucene40PostingsFormat()));
     }
 
-    final LineFileDocs docs = new LineFileDocs(random, defaultCodecSupportsDocValues());
+    final LineFileDocs docs = new LineFileDocs(random(), defaultCodecSupportsDocValues());
     final int RUN_TIME_MSEC = atLeast(500);
-    final IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(-1).setRAMBufferSizeMB(64);
+    final IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMaxBufferedDocs(-1).setRAMBufferSizeMB(64);
     final File tempDir = _TestUtil.getTempDir("fstlines");
     final MockDirectoryWrapper dir = newFSDirectory(tempDir);
     final IndexWriter writer = new IndexWriter(dir, conf);
@@ -1111,13 +1112,13 @@ public class TestFSTs extends LuceneTest
     }
     IndexReader r = IndexReader.open(writer, true);
     writer.close();
-    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(random.nextBoolean());
+    final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(random().nextBoolean());
 
-    final boolean doRewrite = random.nextBoolean();
+    final boolean doRewrite = random().nextBoolean();
 
     Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, 0, 0, true, true, Integer.MAX_VALUE, outputs, null, doRewrite);
 
-    boolean storeOrd = random.nextBoolean();
+    boolean storeOrd = random().nextBoolean();
     if (VERBOSE) {
       if (storeOrd) {
         System.out.println("FST stores ord");
@@ -1163,6 +1164,7 @@ public class TestFSTs extends LuceneTest
       }
 
       if (ord > 0) {
+        final Random random = new Random(random().nextLong());
         for(int rewriteIter=0;rewriteIter<2;rewriteIter++) {
           if (rewriteIter == 1) {
             if (doRewrite) {
@@ -1177,7 +1179,7 @@ public class TestFSTs extends LuceneTest
           final BytesRefFSTEnum<Long> fstEnum = new BytesRefFSTEnum<Long>(fst);
           int num = atLeast(1000);
           for(int iter=0;iter<num;iter++) {
-            final BytesRef randomTerm = new BytesRef(getRandomString());
+            final BytesRef randomTerm = new BytesRef(getRandomString(random));
         
             if (VERBOSE) {
               System.out.println("TEST: seek non-exist " + randomTerm.utf8ToString() + " " + randomTerm);
@@ -1603,8 +1605,8 @@ public class TestFSTs extends LuceneTest
       if (VERBOSE) {
         System.out.println("TEST: cycle=" + cycle);
       }
-      RandomIndexWriter w = new RandomIndexWriter(random, dir,
-                                                  newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(IndexWriterConfig.OpenMode.CREATE));
+      RandomIndexWriter w = new RandomIndexWriter(random(), dir,
+                                                  newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setOpenMode(IndexWriterConfig.OpenMode.CREATE));
       Document doc = new Document();
       Field idField = newField("id", "", StringField.TYPE_UNSTORED);
       doc.add(idField);
@@ -1622,7 +1624,7 @@ public class TestFSTs extends LuceneTest
           idString = String.format("%07d", id);
         } else {
           while(true) {
-            final String s = Long.toString(random.nextLong());
+            final String s = Long.toString(random().nextLong());
             if (!allIDs.contains(s)) {
               idString = s;
               break;
@@ -1653,7 +1655,7 @@ public class TestFSTs extends LuceneTest
           idString = String.format("%07d", (NUM_IDS + idx));
         } else {
           while(true) {
-            idString = Long.toString(random.nextLong());
+            idString = Long.toString(random().nextLong());
             if (!allIDs.contains(idString)) {
               break;
             }
@@ -1665,7 +1667,7 @@ public class TestFSTs extends LuceneTest
 
       // Verify w/ TermQuery
       for(int iter=0;iter<2*NUM_IDS;iter++) {
-        final String id = allIDsList.get(random.nextInt(allIDsList.size()));
+        final String id = allIDsList.get(random().nextInt(allIDsList.size()));
         final boolean exists = !outOfBounds.contains(id);
         if (VERBOSE) {
           System.out.println("TEST: TermQuery " + (exists ? "" : "non-exist ") + " id=" + id);
@@ -1680,8 +1682,8 @@ public class TestFSTs extends LuceneTest
         final String nextID;
         final boolean exists;
 
-        if (random.nextBoolean()) {
-          id = allIDsList.get(random.nextInt(allIDsList.size()));
+        if (random().nextBoolean()) {
+          id = allIDsList.get(random().nextInt(allIDsList.size()));
           exists = !outOfBounds.contains(id);
           nextID = null;
           if (VERBOSE) {
@@ -1690,7 +1692,7 @@ public class TestFSTs extends LuceneTest
         } else {
           // Pick ID between two IDs:
           exists = false;
-          final int idv = random.nextInt(NUM_IDS-1);
+          final int idv = random().nextInt(NUM_IDS-1);
           if (cycle == 0) {
             id = String.format("%07da", idv);
             nextID = String.format("%07d", idv+1);
@@ -1703,7 +1705,7 @@ public class TestFSTs extends LuceneTest
           }
         }
 
-        final boolean useCache = random.nextBoolean();
+        final boolean useCache = random().nextBoolean();
         if (VERBOSE) {
           System.out.println("  useCache=" + useCache);
         }
@@ -1738,20 +1740,20 @@ public class TestFSTs extends LuceneTest
   public void testRandomTermLookup() throws Exception {
     Directory dir = newDirectory();
 
-    RandomIndexWriter w = new RandomIndexWriter(random, dir,
-                                                newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(IndexWriterConfig.OpenMode.CREATE));
+    RandomIndexWriter w = new RandomIndexWriter(random(), dir,
+                                                newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setOpenMode(IndexWriterConfig.OpenMode.CREATE));
     Document doc = new Document();
     Field f = newField("field", "", StringField.TYPE_UNSTORED);
     doc.add(f);
       
-    final int NUM_TERMS = (int) (1000*RANDOM_MULTIPLIER * (1+random.nextDouble()));
+    final int NUM_TERMS = (int) (1000*RANDOM_MULTIPLIER * (1+random().nextDouble()));
     if (VERBOSE) {
       System.out.println("TEST: NUM_TERMS=" + NUM_TERMS);
     }
 
     final Set<String> allTerms = new HashSet<String>();
     while(allTerms.size() < NUM_TERMS) {
-      allTerms.add(simpleRandomString(random));
+      allTerms.add(simpleRandomString(random()));
     }
 
     for(String term : allTerms) {
@@ -1771,7 +1773,7 @@ public class TestFSTs extends LuceneTest
     w.close();
 
     final List<String> allTermsList = new ArrayList<String>(allTerms);
-    Collections.shuffle(allTermsList, random);
+    Collections.shuffle(allTermsList, random());
 
     // verify exact lookup
     for(String term : allTermsList) {
@@ -1871,7 +1873,7 @@ public class TestFSTs extends LuceneTest
   public void testFinalOutputOnEndState() throws Exception {
     final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
 
-    final Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE4, 2, 0, true, true, Integer.MAX_VALUE, outputs, null, random.nextBoolean());
+    final Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE4, 2, 0, true, true, Integer.MAX_VALUE, outputs, null, random().nextBoolean());
     builder.add(Util.toUTF32("stat", new IntsRef()), 17L);
     builder.add(Util.toUTF32("station", new IntsRef()), 10L);
     final FST<Long> fst = builder.finish();
@@ -1885,7 +1887,7 @@ public class TestFSTs extends LuceneTest
 
   public void testInternalFinalState() throws Exception {
     final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
-    final boolean willRewrite = random.nextBoolean();
+    final boolean willRewrite = random().nextBoolean();
     final Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, 0, 0, true, true, Integer.MAX_VALUE, outputs, null, willRewrite);
     builder.add(Util.toIntsRef(new BytesRef("stat"), new IntsRef()), outputs.getNoOutput());
     builder.add(Util.toIntsRef(new BytesRef("station"), new IntsRef()), outputs.getNoOutput());
@@ -2059,6 +2061,7 @@ public class TestFSTs extends LuceneTest
   }
   
   public void testShortestPathsRandom() throws Exception {
+    final Random random = random();
     int numWords = atLeast(1000);
     
     final TreeMap<String,Long> slowCompletor = new TreeMap<String,Long>();
@@ -2168,6 +2171,7 @@ public class TestFSTs extends LuceneTest
     final Builder<Pair<Long,Long>> builder = new Builder<Pair<Long,Long>>(FST.INPUT_TYPE.BYTE1, outputs);
     final IntsRef scratch = new IntsRef();
     
+    Random random = random();
     for (int i = 0; i < numWords; i++) {
       String s;
       while (true) {

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestReproduceMessage.java Sun Apr 15 14:41:44 2012
@@ -123,49 +123,49 @@ public class TestReproduceMessage extend
   public void testAssumeBeforeClass() throws Exception { 
     type = SoreType.ASSUMPTION; 
     where = SorePoint.BEFORE_CLASS;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: Assume failed in"));
+    Assert.assertTrue(runAndReturnSyserr().isEmpty());
   }
 
   @Test @Ignore
   public void testAssumeInitializer() throws Exception { 
     type = SoreType.ASSUMPTION; 
     where = SorePoint.INITIALIZER;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: Assume failed in"));
+    Assert.assertTrue(runAndReturnSyserr().isEmpty());
   }
 
   @Test
   public void testAssumeRule() throws Exception { 
     type = SoreType.ASSUMPTION; 
     where = SorePoint.RULE;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: Assume failed in"));
+    Assert.assertEquals("", runAndReturnSyserr());
   }
 
   @Test
   public void testAssumeBefore() throws Exception { 
     type = SoreType.ASSUMPTION; 
     where = SorePoint.BEFORE;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: Assume failed in"));
+    Assert.assertTrue(runAndReturnSyserr().isEmpty());
   }
 
   @Test
   public void testAssumeTest() throws Exception { 
     type = SoreType.ASSUMPTION; 
     where = SorePoint.TEST;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: Assume failed in"));
+    Assert.assertTrue(runAndReturnSyserr().isEmpty());
   }
 
   @Test
   public void testAssumeAfter() throws Exception { 
     type = SoreType.ASSUMPTION; 
     where = SorePoint.AFTER;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: Assume failed in"));
+    Assert.assertTrue(runAndReturnSyserr().isEmpty());
   }
 
   @Test @Ignore
   public void testAssumeAfterClass() throws Exception { 
     type = SoreType.ASSUMPTION; 
     where = SorePoint.AFTER_CLASS;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: Assume failed in"));
+    Assert.assertTrue(runAndReturnSyserr().isEmpty());
   }
 
   /*
@@ -190,32 +190,44 @@ public class TestReproduceMessage extend
   public void testFailureRule() throws Exception { 
     type = SoreType.FAILURE; 
     where = SorePoint.RULE;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
-    Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
+
+    final String syserr = runAndReturnSyserr();
+    
+    super.prevSysOut.println(getSysErr() + "\n" + getSysOut());
+    
+    Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));
   }
 
   @Test
   public void testFailureBefore() throws Exception { 
     type = SoreType.FAILURE; 
     where = SorePoint.BEFORE;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
-    Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
+    final String syserr = runAndReturnSyserr();
+    Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));
   }
 
   @Test
   public void testFailureTest() throws Exception { 
     type = SoreType.FAILURE; 
     where = SorePoint.TEST;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
-    Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
+    final String syserr = runAndReturnSyserr();
+    Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));
   }
 
   @Test
   public void testFailureAfter() throws Exception { 
     type = SoreType.FAILURE; 
     where = SorePoint.AFTER;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
-    Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
+    final String syserr = runAndReturnSyserr();
+    Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));
   }
 
   @Test @Ignore
@@ -247,32 +259,40 @@ public class TestReproduceMessage extend
   public void testErrorRule() throws Exception { 
     type = SoreType.ERROR; 
     where = SorePoint.RULE;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
-    Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
+    final String syserr = runAndReturnSyserr();
+    Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));
   }
 
   @Test
   public void testErrorBefore() throws Exception { 
     type = SoreType.ERROR; 
     where = SorePoint.BEFORE;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
-    Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
+    final String syserr = runAndReturnSyserr();
+    Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));
   }
 
   @Test
   public void testErrorTest() throws Exception { 
     type = SoreType.ERROR; 
     where = SorePoint.TEST;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
-    Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
+    final String syserr = runAndReturnSyserr();
+    Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));
   }
 
   @Test
   public void testErrorAfter() throws Exception { 
     type = SoreType.ERROR; 
     where = SorePoint.AFTER;
-    Assert.assertTrue(runAndReturnSyserr().contains("NOTE: reproduce with:"));
-    Assert.assertTrue(Arrays.asList(runAndReturnSyserr().split("\\s")).contains("-Dtestmethod=test"));
+    final String syserr = runAndReturnSyserr();
+    Assert.assertTrue(syserr.contains("NOTE: reproduce with:"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.method=test"));
+    Assert.assertTrue(Arrays.asList(syserr.split("\\s")).contains("-Dtests.class=*." + Nested.class.getSimpleName()));
   }
 
   @Test @Ignore
@@ -286,8 +306,8 @@ public class TestReproduceMessage extend
     JUnitCore.runClasses(Nested.class);
 
     String err = getSysErr();
-    //super.prevSysErr.println("Type: " + type + ", point: " + where + " resulted in:\n" + err);
-    //super.prevSysErr.println("---");
+    // super.prevSysErr.println("Type: " + type + ", point: " + where + " resulted in:\n" + err);
+    // super.prevSysErr.println("---");
     return err;
   }
 }

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSeedFromUncaught.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSeedFromUncaught.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSeedFromUncaught.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSeedFromUncaught.java Sun Apr 15 14:41:44 2012
@@ -22,6 +22,7 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.JUnitCore;
 import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
 
 /**
  * Check that uncaught exceptions result in seed info being dumped to
@@ -53,9 +54,9 @@ public class TestSeedFromUncaught extend
   public void testUncaughtDumpsSeed() {
     Result result = JUnitCore.runClasses(ThrowInUncaught.class);
     Assert.assertEquals(1, result.getFailureCount());
-    String consoleOut = super.getSysErr() + "\n\n" + super.getSysOut();
-    Assert.assertTrue(consoleOut.contains("-Dtests.seed="));
-    Assert.assertTrue(consoleOut.contains("-Dtestmethod=testFoo"));
-    Assert.assertTrue(consoleOut.contains("foobar"));
+    Failure f = result.getFailures().get(0);
+    String trace = f.getTrace();
+    Assert.assertTrue(trace.contains("SeedInfo.seed("));
+    Assert.assertTrue(trace.contains("foobar"));
   }
 }

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSetupTeardownChaining.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSetupTeardownChaining.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSetupTeardownChaining.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSetupTeardownChaining.java Sun Apr 15 14:41:44 2012
@@ -33,6 +33,7 @@ public class TestSetupTeardownChaining e
     @Override
     public void setUp() throws Exception {
       // missing call.
+      System.out.println("Hello.");
     }
 
     @Test

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java Sun Apr 15 14:41:44 2012
@@ -30,6 +30,8 @@ import org.junit.rules.TestRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
 
+import com.carrotsearch.randomizedtesting.RandomizedRunner;
+
 /**
  * An abstract test class that prepares nested test classes to run.
  * A nested test class will assume it's executed under control of this
@@ -43,12 +45,11 @@ import org.junit.runners.model.Statement
  * cause havoc (static fields).
  */
 public abstract class WithNestedTests {
-  public static ThreadLocal<Boolean> runsAsNested = new ThreadLocal<Boolean>() {
-    @Override
-    protected Boolean initialValue() {
-      return false;
-    }
-  };
+  /**
+   * This can no longer be thread local because {@link RandomizedRunner} runs
+   * suites in an isolated threadgroup/thread.
+   */
+  public static volatile boolean runsAsNested;
 
   public static abstract class AbstractNestedTest extends LuceneTestCase {
     @ClassRule
@@ -65,7 +66,7 @@ public abstract class WithNestedTests {
     };
 
     protected static boolean isRunningNested() {
-      return runsAsNested.get() != null && runsAsNested.get();
+      return runsAsNested;
     }
   }
 
@@ -96,13 +97,13 @@ public abstract class WithNestedTests {
       }
     }
 
-    runsAsNested.set(true);
+    runsAsNested = true;
   }
 
   @After
   public final void after() {
-    runsAsNested.set(false);
-    
+    runsAsNested = false;
+
     if (suppressOutputStreams) {
       System.out.flush();
       System.err.flush();

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java Sun Apr 15 14:41:44 2012
@@ -51,16 +51,16 @@ public class TestPackedInts extends Luce
     for (int iter = 0; iter < num; iter++) {
       long ceil = 2;
       for(int nbits=1;nbits<63;nbits++) {
-        final int valueCount = 100+random.nextInt(500);
+        final int valueCount = 100+random().nextInt(500);
         final Directory d = newDirectory();
 
-        IndexOutput out = d.createOutput("out.bin", newIOContext(random));
+        IndexOutput out = d.createOutput("out.bin", newIOContext(random()));
         PackedInts.Writer w = PackedInts.getWriter(
                 out, valueCount, nbits);
 
         final long[] values = new long[valueCount];
         for(int i=0;i<valueCount;i++) {
-          long v = random.nextLong() % ceil;
+          long v = random().nextLong() % ceil;
           if (v < 0) {
             v = -v;
           }
@@ -71,7 +71,7 @@ public class TestPackedInts extends Luce
         final long fp = out.getFilePointer();
         out.close();
         {// test reader
-          IndexInput in = d.openInput("out.bin", newIOContext(random));
+          IndexInput in = d.openInput("out.bin", newIOContext(random()));
           PackedInts.Reader r = PackedInts.getReader(in);
           assertEquals(fp, in.getFilePointer());
           for(int i=0;i<valueCount;i++) {
@@ -82,7 +82,7 @@ public class TestPackedInts extends Luce
           in.close();
         }
         { // test reader iterator next
-          IndexInput in = d.openInput("out.bin", newIOContext(random));
+          IndexInput in = d.openInput("out.bin", newIOContext(random()));
           PackedInts.ReaderIterator r = PackedInts.getReaderIterator(in);
           for(int i=0;i<valueCount;i++) {
             assertEquals("index=" + i + " ceil=" + ceil + " valueCount="
@@ -93,15 +93,15 @@ public class TestPackedInts extends Luce
           in.close();
         }
         { // test reader iterator next vs. advance
-          IndexInput in = d.openInput("out.bin", newIOContext(random));
+          IndexInput in = d.openInput("out.bin", newIOContext(random()));
           PackedInts.ReaderIterator intsEnum = PackedInts.getReaderIterator(in);
           for (int i = 0; i < valueCount; i += 
-            1 + ((valueCount - i) <= 20 ? random.nextInt(valueCount - i)
-              : random.nextInt(20))) {
+            1 + ((valueCount - i) <= 20 ? random().nextInt(valueCount - i)
+              : random().nextInt(20))) {
             final String msg = "index=" + i + " ceil=" + ceil + " valueCount="
                 + valueCount + " nbits=" + nbits + " for "
                 + intsEnum.getClass().getSimpleName();
-            if (i - intsEnum.ord() == 1 && random.nextBoolean()) {
+            if (i - intsEnum.ord() == 1 && random().nextBoolean()) {
               assertEquals(msg, values[i], intsEnum.next());
             } else {
               assertEquals(msg, values[i], intsEnum.advance(i));
@@ -117,13 +117,13 @@ public class TestPackedInts extends Luce
         }
         
         { // test direct reader get
-          IndexInput in = d.openInput("out.bin", newIOContext(random));
+          IndexInput in = d.openInput("out.bin", newIOContext(random()));
           PackedInts.Reader intsEnum = PackedInts.getDirectReader(in);
           for (int i = 0; i < valueCount; i++) {
             final String msg = "index=" + i + " ceil=" + ceil + " valueCount="
                 + valueCount + " nbits=" + nbits + " for "
                 + intsEnum.getClass().getSimpleName();
-            final int index = random.nextInt(valueCount);
+            final int index = random().nextInt(valueCount);
             long value = intsEnum.get(index);
             assertEquals(msg, value, values[index]);
           }
@@ -158,7 +158,7 @@ public class TestPackedInts extends Luce
       for (int bitsPerValue = MIN_BITS_PER_VALUE ;
            bitsPerValue <= MAX_BITS_PER_VALUE ;
            bitsPerValue++) {
-        assertRandomEquality(valueCount, bitsPerValue, random.nextLong());
+        assertRandomEquality(valueCount, bitsPerValue, random().nextLong());
       }
     }
   }
@@ -243,14 +243,14 @@ public class TestPackedInts extends Luce
 
   public void testSingleValue() throws Exception {
     Directory dir = newDirectory();
-    IndexOutput out = dir.createOutput("out", newIOContext(random));
+    IndexOutput out = dir.createOutput("out", newIOContext(random()));
     PackedInts.Writer w = PackedInts.getWriter(out, 1, 8);
     w.add(17);
     w.finish();
     final long end = out.getFilePointer();
     out.close();
 
-    IndexInput in = dir.openInput("out", newIOContext(random));
+    IndexInput in = dir.openInput("out", newIOContext(random()));
     PackedInts.getReader(in);
     assertEquals(end, in.getFilePointer());
     in.close();

Modified: lucene/dev/trunk/lucene/test-framework/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/ivy.xml?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/ivy.xml (original)
+++ lucene/dev/trunk/lucene/test-framework/ivy.xml Sun Apr 15 14:41:44 2012
@@ -22,6 +22,10 @@
       <dependency org="org.apache.ant" name="ant" rev="1.7.1" transitive="false"/>
       <dependency org="org.apache.ant" name="ant-junit" rev="1.7.1" transitive="false"/>
       <dependency org="junit" name="junit" rev="4.10" transitive="false"/>
+
+      <dependency org="com.carrotsearch.randomizedtesting" name="junit4-ant" rev="1.1.0" transitive="false" />
+      <dependency org="com.carrotsearch.randomizedtesting" name="randomizedtesting-runner" rev="1.1.0" transitive="false"/>
+
       <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/> 
     </dependencies>
 </ivy-module>

Added: lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-1.1.0.jar.sha1
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-1.1.0.jar.sha1?rev=1326351&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-1.1.0.jar.sha1 (added)
+++ lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-1.1.0.jar.sha1 Sun Apr 15 14:41:44 2012
@@ -0,0 +1 @@
+773996a80119ea828613eaee11a9c303ede78a03

Added: lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-LICENSE-ASL.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-LICENSE-ASL.txt?rev=1326351&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-LICENSE-ASL.txt (added)
+++ lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-LICENSE-ASL.txt Sun Apr 15 14:41:44 2012
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
\ No newline at end of file

Added: lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-NOTICE.txt?rev=1326351&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-NOTICE.txt (added)
+++ lucene/dev/trunk/lucene/test-framework/lib/junit4-ant-NOTICE.txt Sun Apr 15 14:41:44 2012
@@ -0,0 +1,12 @@
+
+JUnit4, parallel JUnit execution for ANT
+Copyright 2011-2012 Carrot Search s.c.
+http://labs.carrotsearch.com/randomizedtesting.html
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes asm (asmlib), BSD license
+This product includes Google Guava, ASL license
+This product includes simple-xml,   ASL license
+This product includes Google GSON,  ASL license

Added: lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-1.1.0.jar.sha1
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-1.1.0.jar.sha1?rev=1326351&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-1.1.0.jar.sha1 (added)
+++ lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-1.1.0.jar.sha1 Sun Apr 15 14:41:44 2012
@@ -0,0 +1 @@
+32682aa5df3aa618bad5eb54a9b6d186a7956f9d

Added: lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-LICENSE-ASL.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-LICENSE-ASL.txt?rev=1326351&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-LICENSE-ASL.txt (added)
+++ lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-LICENSE-ASL.txt Sun Apr 15 14:41:44 2012
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
\ No newline at end of file

Added: lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-NOTICE.txt?rev=1326351&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-NOTICE.txt (added)
+++ lucene/dev/trunk/lucene/test-framework/lib/randomizedtesting-runner-NOTICE.txt Sun Apr 15 14:41:44 2012
@@ -0,0 +1,12 @@
+
+RandomizedRunner, a JUnit @Runner for randomized tests (and more)
+Copyright 2011-2012 Carrot Search s.c.
+http://labs.carrotsearch.com/randomizedtesting.html
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes asm (asmlib), BSD license
+This product includes Google Guava, ASL license
+This product includes simple-xml,   ASL license
+This product includes Google GSON,  ASL license

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java Sun Apr 15 14:41:44 2012
@@ -189,7 +189,7 @@ public abstract class CollationTestBase 
                                    String dkResult) throws Exception {
     Directory indexStore = newDirectory();
     IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
-        TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
+        TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)));
 
     // document data:
     // the tracer field is used to determine which document was hit
@@ -267,7 +267,7 @@ public abstract class CollationTestBase 
 
   public void assertThreadSafe(final Analyzer analyzer) throws Exception {
     int numTestPoints = 100;
-    int numThreads = _TestUtil.nextInt(random, 3, 5);
+    int numThreads = _TestUtil.nextInt(random(), 3, 5);
     final HashMap<String,BytesRef> map = new HashMap<String,BytesRef>();
     
     // create a map<String,SortKey> up front.
@@ -275,7 +275,7 @@ public abstract class CollationTestBase 
     // and ensure they are the same as the ones we produced in serial fashion.
 
     for (int i = 0; i < numTestPoints; i++) {
-      String term = _TestUtil.randomSimpleString(random);
+      String term = _TestUtil.randomSimpleString(random());
       TokenStream ts = analyzer.tokenStream("fake", new StringReader(term));
       TermToBytesRefAttribute termAtt = ts.addAttribute(TermToBytesRefAttribute.class);
       BytesRef bytes = termAtt.getBytesRef();

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/analysis/MockAnalyzer.java Sun Apr 15 14:41:44 2012
@@ -64,7 +64,8 @@ public final class MockAnalyzer extends 
    */
   public MockAnalyzer(Random random, CharacterRunAutomaton runAutomaton, boolean lowerCase, CharacterRunAutomaton filter, boolean enablePositionIncrements) {
     super(new PerFieldReuseStrategy());
-    this.random = random;
+    // TODO: this should be solved in a different way; Random should not be shared (!).
+    this.random = new Random(random.nextLong());
     this.runAutomaton = runAutomaton;
     this.lowerCase = lowerCase;
     this.filter = filter;

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/RandomIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/RandomIndexWriter.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/RandomIndexWriter.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/RandomIndexWriter.java Sun Apr 15 14:41:44 2012
@@ -62,10 +62,8 @@ public class RandomIndexWriter implement
 
     public MockIndexWriter(Random r, Directory dir, IndexWriterConfig conf) throws IOException {
       super(dir, conf);
-      // must make a private random since our methods are
-      // called from different threads; else test failures may
-      // not be reproducible from the original seed
-      this.r = new Random(r.nextInt());
+      // TODO: this should be solved in a different way; Random should not be shared (!).
+      this.r = new Random(r.nextLong());
     }
 
     @Override
@@ -93,7 +91,8 @@ public class RandomIndexWriter implement
   
   /** create a RandomIndexWriter with the provided config */
   public RandomIndexWriter(Random r, Directory dir, IndexWriterConfig c) throws IOException {
-    this.r = r;
+    // TODO: this should be solved in a different way; Random should not be shared (!).
+    this.r = new Random(r.nextLong());
     w = new MockIndexWriter(r, dir, c);
     flushAt = _TestUtil.nextInt(r, 10, 1000);
     codec = w.getConfig().getCodec();

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java Sun Apr 15 14:41:44 2012
@@ -19,11 +19,7 @@ package org.apache.lucene.index;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
@@ -138,16 +134,16 @@ public abstract class ThreadedIndexingAn
 
                 // Occasional longish pause if running
                 // nightly
-                if (LuceneTestCase.TEST_NIGHTLY && random.nextInt(6) == 3) {
+                if (LuceneTestCase.TEST_NIGHTLY && random().nextInt(6) == 3) {
                   if (VERBOSE) {
                     System.out.println(Thread.currentThread().getName() + ": now long sleep");
                   }
-                  Thread.sleep(_TestUtil.nextInt(random, 50, 500));
+                  Thread.sleep(_TestUtil.nextInt(random(), 50, 500));
                 }
 
                 // Rate limit ingest rate:
-                if (random.nextInt(7) == 5) {
-                  Thread.sleep(_TestUtil.nextInt(random, 1, 10));
+                if (random().nextInt(7) == 5) {
+                  Thread.sleep(_TestUtil.nextInt(random(), 1, 10));
                   if (VERBOSE) {
                     System.out.println(Thread.currentThread().getName() + ": done sleep");
                   }
@@ -160,21 +156,21 @@ public abstract class ThreadedIndexingAn
 
                 // Maybe add randomly named field
                 final String addedField;
-                if (random.nextBoolean()) {
-                  addedField = "extra" + random.nextInt(40);
+                if (random().nextBoolean()) {
+                  addedField = "extra" + random().nextInt(40);
                   doc.add(newField(addedField, "a random field", TextField.TYPE_STORED));
                 } else {
                   addedField = null;
                 }
 
-                if (random.nextBoolean()) {
+                if (random().nextBoolean()) {
 
-                  if (random.nextBoolean()) {
+                  if (random().nextBoolean()) {
                     // Add/update doc block:
                     final String packID;
                     final SubDocs delSubDocs;
-                    if (toDeleteSubDocs.size() > 0 && random.nextBoolean()) {
-                      delSubDocs = toDeleteSubDocs.get(random.nextInt(toDeleteSubDocs.size()));
+                    if (toDeleteSubDocs.size() > 0 && random().nextBoolean()) {
+                      delSubDocs = toDeleteSubDocs.get(random().nextInt(toDeleteSubDocs.size()));
                       assert !delSubDocs.deleted;
                       toDeleteSubDocs.remove(delSubDocs);
                       // Update doc block, replacing prior packID
@@ -195,7 +191,7 @@ public abstract class ThreadedIndexingAn
                     docsList.add(_TestUtil.cloneDocument(doc));
                     docIDs.add(doc.get("docid"));
 
-                    final int maxDocCount = _TestUtil.nextInt(random, 1, 10);
+                    final int maxDocCount = _TestUtil.nextInt(random(), 1, 10);
                     while(docsList.size() < maxDocCount) {
                       doc = docs.nextDoc();
                       if (doc == null) {
@@ -224,7 +220,7 @@ public abstract class ThreadedIndexingAn
                     }
                     doc.removeField("packID");
 
-                    if (random.nextInt(5) == 2) {
+                    if (random().nextInt(5) == 2) {
                       if (VERBOSE) {
                         System.out.println(Thread.currentThread().getName() + ": buffer del id:" + packID);
                       }
@@ -240,7 +236,7 @@ public abstract class ThreadedIndexingAn
                     addDocument(new Term("docid", docid), doc);
                     addCount.getAndIncrement();
 
-                    if (random.nextInt(5) == 3) {
+                    if (random().nextInt(5) == 3) {
                       if (VERBOSE) {
                         System.out.println(Thread.currentThread().getName() + ": buffer del id:" + doc.get("docid"));
                       }
@@ -259,7 +255,7 @@ public abstract class ThreadedIndexingAn
                   updateDocument(new Term("docid", docid), doc);
                   addCount.getAndIncrement();
 
-                  if (random.nextInt(5) == 3) {
+                  if (random().nextInt(5) == 3) {
                     if (VERBOSE) {
                       System.out.println(Thread.currentThread().getName() + ": buffer del id:" + doc.get("docid"));
                     }
@@ -267,7 +263,7 @@ public abstract class ThreadedIndexingAn
                   }
                 }
 
-                if (random.nextInt(30) == 17) {
+                if (random().nextInt(30) == 17) {
                   if (VERBOSE) {
                     System.out.println(Thread.currentThread().getName() + ": apply " + toDeleteIDs.size() + " deletes");
                   }
@@ -322,7 +318,7 @@ public abstract class ThreadedIndexingAn
   }
 
   protected void runSearchThreads(final long stopTimeMS) throws Exception {
-    final int numThreads = _TestUtil.nextInt(random, 1, 5);
+    final int numThreads = _TestUtil.nextInt(random(), 1, 5);
     final Thread[] searchThreads = new Thread[numThreads];
     final AtomicInteger totHits = new AtomicInteger();
 
@@ -357,7 +353,7 @@ public abstract class ThreadedIndexingAn
                       trigger = 1;
                     } else {
                       trigger = totTermCount.get()/30;
-                      shift = random.nextInt(trigger);
+                      shift = random().nextInt(trigger);
                     }
                     while (System.currentTimeMillis() < stopTimeMS) {
                       BytesRef term = termsEnum.next();
@@ -418,12 +414,13 @@ public abstract class ThreadedIndexingAn
 
     final long t0 = System.currentTimeMillis();
 
+    Random random = new Random(random().nextLong());
     final LineFileDocs docs = new LineFileDocs(random, defaultCodecSupportsDocValues());
     final File tempDir = _TestUtil.getTempDir(testName);
     dir = newFSDirectory(tempDir);
     ((MockDirectoryWrapper) dir).setCheckIndexOnClose(false); // don't double-checkIndex, we do it ourselves.
-    final IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).
-        setInfoStream(new FailOnNonBulkMergesInfoStream());
+    final IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, 
+        new MockAnalyzer(random())).setInfoStream(new FailOnNonBulkMergesInfoStream());
 
     if (LuceneTestCase.TEST_NIGHTLY) {
       // newIWConfig makes smallish max seg size, which
@@ -468,11 +465,11 @@ public abstract class ThreadedIndexingAn
     writer = new IndexWriter(dir, conf);
     _TestUtil.reduceOpenFiles(writer);
 
-    final ExecutorService es = random.nextBoolean() ? null : Executors.newCachedThreadPool(new NamedThreadFactory(testName));
+    final ExecutorService es = random().nextBoolean() ? null : Executors.newCachedThreadPool(new NamedThreadFactory(testName));
 
     doAfterWriter(es);
 
-    final int NUM_INDEX_THREADS = _TestUtil.nextInt(random, 2, 4);
+    final int NUM_INDEX_THREADS = _TestUtil.nextInt(random(), 2, 4);
 
     final int RUN_TIME_SEC = LuceneTestCase.TEST_NIGHTLY ? 300 : RANDOM_MULTIPLIER;
 

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java Sun Apr 15 14:41:44 2012
@@ -18,6 +18,7 @@ package org.apache.lucene.search;
  */
 
 import java.util.BitSet;
+import java.util.Random;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.MockAnalyzer;
@@ -54,6 +55,7 @@ public abstract class SearchEquivalenceT
   
   @BeforeClass
   public static void beforeClass() throws Exception {
+    Random random = random();
     directory = newDirectory();
     stopword = "" + randomChar();
     CharacterRunAutomaton stopset = new CharacterRunAutomaton(BasicAutomata.makeString(stopword));
@@ -109,7 +111,7 @@ public abstract class SearchEquivalenceT
   static String randomFieldContents() {
     // TODO: zipf-like distribution
     StringBuilder sb = new StringBuilder();
-    int numTerms = random.nextInt(15);
+    int numTerms = random().nextInt(15);
     for (int i = 0; i < numTerms; i++) {
       if (sb.length() > 0) {
         sb.append(' '); // whitespace
@@ -123,9 +125,9 @@ public abstract class SearchEquivalenceT
    * returns random character (a-z)
    */
   static char randomChar() {
-    return (char) _TestUtil.nextInt(random, 'a', 'z');
+    return (char) _TestUtil.nextInt(random(), 'a', 'z');
   }
-  
+
   /**
    * returns a term suitable for searching.
    * terms are single characters in lowercase (a-z)
@@ -170,9 +172,9 @@ public abstract class SearchEquivalenceT
    */
   protected void assertSubsetOf(Query q1, Query q2, Filter filter) throws Exception {
     // TRUNK ONLY: test both filter code paths
-    if (filter != null && random.nextBoolean()) {
-      final boolean q1RandomAccess = random.nextBoolean();
-      final boolean q2RandomAccess = random.nextBoolean();
+    if (filter != null && random().nextBoolean()) {
+      final boolean q1RandomAccess = random().nextBoolean();
+      final boolean q2RandomAccess = random().nextBoolean();
       q1 = new FilteredQuery(q1, filter) {
         @Override
         protected boolean useRandomAccess(Bits bits, int firstFilterDoc) {

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java?rev=1326351&r1=1326350&r2=1326351&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java Sun Apr 15 14:41:44 2012
@@ -518,29 +518,29 @@ public abstract class ShardSearchingTest
     @Override
     public void run() {
       try {
-        final LineFileDocs docs = new LineFileDocs(random, defaultCodecSupportsDocValues());
+        final LineFileDocs docs = new LineFileDocs(random(), defaultCodecSupportsDocValues());
         int numDocs = 0;
         while (System.nanoTime() < endTimeNanos) {
-          final int what = random.nextInt(3);
-          final NodeState node = nodes[random.nextInt(nodes.length)];
+          final int what = random().nextInt(3);
+          final NodeState node = nodes[random().nextInt(nodes.length)];
           if (numDocs == 0 || what == 0) {
             node.writer.addDocument(docs.nextDoc());
             numDocs++;
           } else if (what == 1) {
-            node.writer.updateDocument(new Term("docid", ""+random.nextInt(numDocs)),
+            node.writer.updateDocument(new Term("docid", ""+random().nextInt(numDocs)),
                                         docs.nextDoc());
             numDocs++;
           } else {
-            node.writer.deleteDocuments(new Term("docid", ""+random.nextInt(numDocs)));
+            node.writer.deleteDocuments(new Term("docid", ""+random().nextInt(numDocs)));
           }
           // TODO: doc blocks too
 
-          if (random.nextInt(17) == 12) {
+          if (random().nextInt(17) == 12) {
             node.writer.commit();
           }
 
-          if (random.nextInt(17) == 12) {
-            nodes[random.nextInt(nodes.length)].reopen();
+          if (random().nextInt(17) == 12) {
+            nodes[random().nextInt(nodes.length)].reopen();
           }
         }
       } catch (Throwable t) {
@@ -563,7 +563,7 @@ public abstract class ShardSearchingTest
 
     nodes = new NodeState[numNodes];
     for(int nodeID=0;nodeID<numNodes;nodeID++) {
-      nodes[nodeID] = new NodeState(random, baseDirName, nodeID, numNodes);
+      nodes[nodeID] = new NodeState(random(), baseDirName, nodeID, numNodes);
     }
 
     long[] nodeVersions = new long[nodes.length];

Added: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneJUnit3MethodProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneJUnit3MethodProvider.java?rev=1326351&view=auto
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneJUnit3MethodProvider.java (added)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneJUnit3MethodProvider.java Sun Apr 15 14:41:44 2012
@@ -0,0 +1,33 @@
+package org.apache.lucene.util;
+
+import static com.carrotsearch.randomizedtesting.MethodCollector.flatten;
+import static com.carrotsearch.randomizedtesting.MethodCollector.mutableCopy1;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.*;
+
+import com.carrotsearch.randomizedtesting.TestMethodProvider;
+
+/**
+ * Backwards compatible test* method provider (public, non-static).
+ */
+public final class LuceneJUnit3MethodProvider implements TestMethodProvider {
+  @Override
+  public Collection<Method> getTestMethods(Class<?> suiteClass, List<List<Method>> methods) {
+    // We will return all methods starting with test* and rely on further validation to weed
+    // out static or otherwise invalid test methods.
+    List<Method> copy = mutableCopy1(flatten(methods));
+    Iterator<Method> i =copy.iterator();
+    while (i.hasNext()) {
+      Method m= i.next();
+      if (!m.getName().startsWith("test") ||
+          !Modifier.isPublic(m.getModifiers()) ||
+           Modifier.isStatic(m.getModifiers()) ||
+           m.getParameterTypes().length != 0) {
+        i.remove();
+      }
+    }
+    return copy;
+  }
+}