You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/01/24 15:30:49 UTC
svn commit: r1062797 -
/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
Author: rmuir
Date: Mon Jan 24 14:30:48 2011
New Revision: 1062797
URL: http://svn.apache.org/viewvc?rev=1062797&view=rev
Log:
improve seed compatibility across trunk/3x
Modified:
lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=1062797&r1=1062796&r2=1062797&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java Mon Jan 24 14:30:48 2011
@@ -212,6 +212,12 @@ public abstract class LuceneTestCase ext
staticSeed = "random".equals(TEST_SEED) ? seedRand.nextLong() : TwoLongs.fromString(TEST_SEED).l1;
random.setSeed(staticSeed);
stores = Collections.synchronizedMap(new IdentityHashMap<MockDirectoryWrapper,StackTraceElement[]>());
+ // this code consumes randoms where 4.0's lucenetestcase would: to make seeds work across both branches.
+ // TODO: doesn't completely work, because what if we get mockrandom codec?!
+ if (random.nextInt(4) != 0) {
+ random.nextInt(); // consume RandomCodecProvider's seed.
+ }
+ // end compatibility random-consumption
savedLocale = Locale.getDefault();
locale = TEST_LOCALE.equals("random") ? randomLocale(random) : localeForName(TEST_LOCALE);
Locale.setDefault(locale);