fix silly test bugs (thanks selckin!)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1136357 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2011-06-16 10:15:20 +00:00
parent aa6966782f
commit 38b838b25a
2 changed files with 9 additions and 9 deletions

View File

@ -502,12 +502,12 @@ public class TestNRTManager extends LuceneTestCase {
int seenTermCount = 0;
int shift;
int trigger;
if (totTermCount.get() == 0) {
if (totTermCount.get() < 10) {
shift = 0;
trigger = 1;
} else {
shift = random.nextInt(totTermCount.get()/10);
trigger = totTermCount.get()/10;
shift = random.nextInt(trigger);
}
while(System.currentTimeMillis() < stopTime) {
@ -518,13 +518,13 @@ public class TestNRTManager extends LuceneTestCase {
}
totTermCount.set(seenTermCount);
seenTermCount = 0;
if (totTermCount.get() == 0) {
if (totTermCount.get() < 10) {
shift = 0;
trigger = 1;
} else {
trigger = totTermCount.get()/10;
//System.out.println("trigger " + trigger);
shift = random.nextInt(totTermCount.get()/10);
shift = random.nextInt(trigger);
}
termsEnum.seek(new BytesRef(""));
continue;

View File

@ -405,30 +405,30 @@ public class TestNRTThreads extends LuceneTestCase {
for(int thread=0;thread<NUM_SEARCH_THREADS;thread++) {
searchThreads[thread] = new Thread() {
@Override
public void run() {
public void run() {
try {
TermsEnum termsEnum = MultiFields.getTerms(s.getIndexReader(), "body").iterator();
int seenTermCount = 0;
int shift;
int trigger;
if (totTermCount.get() == 0) {
if (totTermCount.get() < 10) {
shift = 0;
trigger = 1;
} else {
shift = random.nextInt(totTermCount.get()/10);
trigger = totTermCount.get()/10;
shift = random.nextInt(trigger);
}
while(System.currentTimeMillis() < searchStopTime) {
BytesRef term = termsEnum.next();
if (term == null) {
if (seenTermCount == 0) {
if (seenTermCount < 10) {
break;
}
totTermCount.set(seenTermCount);
seenTermCount = 0;
trigger = totTermCount.get()/10;
//System.out.println("trigger " + trigger);
shift = random.nextInt(totTermCount.get()/10);
shift = random.nextInt(trigger);
termsEnum.seek(new BytesRef(""));
continue;
}