You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by bi...@apache.org on 2014/02/19 14:42:23 UTC
svn commit: r1569739 [8/9] - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/analysis/
lucene/analysis/common/src/test/org/apache/lucene/analysis/charfilter/
lucene/analysis/common/src/test/org/apache/lucene/analysis/core/
lucene/analysis/common/s...
Modified: lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/FSTCompletionTest.java Wed Feb 19 13:42:17 2014
@@ -159,7 +159,7 @@ public class FSTCompletionTest extends L
Random r = random();
List<Input> keys = new ArrayList<Input>();
for (int i = 0; i < 5000; i++) {
- keys.add(new Input(_TestUtil.randomSimpleString(r), -1));
+ keys.add(new Input(TestUtil.randomSimpleString(r), -1));
}
lookup.build(new InputArrayIterator(keys));
@@ -168,7 +168,7 @@ public class FSTCompletionTest extends L
// are.
Long previous = null;
for (Input tf : keys) {
- Long current = ((Number)lookup.get(_TestUtil.bytesToCharSequence(tf.term, random()))).longValue();
+ Long current = ((Number)lookup.get(TestUtil.bytesToCharSequence(tf.term, random()))).longValue();
if (previous != null) {
assertEquals(previous, current);
}
@@ -183,8 +183,8 @@ public class FSTCompletionTest extends L
lookup.build(new InputArrayIterator(input));
assertEquals(input.size(), lookup.getCount());
for (Input tf : input) {
- assertNotNull("Not found: " + tf.term.toString(), lookup.get(_TestUtil.bytesToCharSequence(tf.term, random())));
- assertEquals(tf.term.utf8ToString(), lookup.lookup(_TestUtil.bytesToCharSequence(tf.term, random()), true, 1).get(0).key.toString());
+ assertNotNull("Not found: " + tf.term.toString(), lookup.get(TestUtil.bytesToCharSequence(tf.term, random())));
+ assertEquals(tf.term.utf8ToString(), lookup.lookup(TestUtil.bytesToCharSequence(tf.term, random()), true, 1).get(0).key.toString());
}
List<LookupResult> result = lookup.lookup(stringToCharSequence("wit"), true, 5);
@@ -221,7 +221,7 @@ public class FSTCompletionTest extends L
}
private CharSequence stringToCharSequence(String prefix) {
- return _TestUtil.stringToCharSequence(prefix, random());
+ return TestUtil.stringToCharSequence(prefix, random());
}
private void assertMatchEquals(List<Completion> res, String... expected) {
Modified: lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/TestSort.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/TestSort.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/TestSort.java Wed Feb 19 13:42:17 2014
@@ -37,15 +37,15 @@ public class TestSort extends LuceneTest
@Before
public void prepareTempDir() throws IOException {
- tempDir = _TestUtil.getTempDir("mergesort");
- _TestUtil.rmDir(tempDir);
+ tempDir = TestUtil.getTempDir("mergesort");
+ TestUtil.rmDir(tempDir);
tempDir.mkdirs();
}
@After
public void cleanup() throws IOException {
if (tempDir != null)
- _TestUtil.rmDir(tempDir);
+ TestUtil.rmDir(tempDir);
}
@Test
Modified: lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java (original)
+++ lucene/dev/branches/branch_4x/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/WFSTCompletionTest.java Wed Feb 19 13:42:17 2014
@@ -24,7 +24,7 @@ import org.apache.lucene.search.suggest.
import org.apache.lucene.search.suggest.InputArrayIterator;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
public class WFSTCompletionTest extends LuceneTestCase {
@@ -41,25 +41,25 @@ public class WFSTCompletionTest extends
suggester.build(new InputArrayIterator(keys));
// top N of 2, but only foo is available
- List<LookupResult> results = suggester.lookup(_TestUtil.stringToCharSequence("f", random), false, 2);
+ List<LookupResult> results = suggester.lookup(TestUtil.stringToCharSequence("f", random), false, 2);
assertEquals(1, results.size());
assertEquals("foo", results.get(0).key.toString());
assertEquals(50, results.get(0).value, 0.01F);
// make sure we don't get a dup exact suggestion:
- results = suggester.lookup(_TestUtil.stringToCharSequence("foo", random), false, 2);
+ results = suggester.lookup(TestUtil.stringToCharSequence("foo", random), false, 2);
assertEquals(1, results.size());
assertEquals("foo", results.get(0).key.toString());
assertEquals(50, results.get(0).value, 0.01F);
// top N of 1 for 'bar': we return this even though barbar is higher
- results = suggester.lookup(_TestUtil.stringToCharSequence("bar", random), false, 1);
+ results = suggester.lookup(TestUtil.stringToCharSequence("bar", random), false, 1);
assertEquals(1, results.size());
assertEquals("bar", results.get(0).key.toString());
assertEquals(10, results.get(0).value, 0.01F);
// top N Of 2 for 'b'
- results = suggester.lookup(_TestUtil.stringToCharSequence("b", random), false, 2);
+ results = suggester.lookup(TestUtil.stringToCharSequence("b", random), false, 2);
assertEquals(2, results.size());
assertEquals("barbar", results.get(0).key.toString());
assertEquals(12, results.get(0).value, 0.01F);
@@ -67,7 +67,7 @@ public class WFSTCompletionTest extends
assertEquals(10, results.get(1).value, 0.01F);
// top N of 3 for 'ba'
- results = suggester.lookup(_TestUtil.stringToCharSequence("ba", random), false, 3);
+ results = suggester.lookup(TestUtil.stringToCharSequence("ba", random), false, 3);
assertEquals(3, results.size());
assertEquals("barbar", results.get(0).key.toString());
assertEquals(12, results.get(0).value, 0.01F);
@@ -138,7 +138,7 @@ public class WFSTCompletionTest extends
while (true) {
// TODO: would be nice to fix this slowCompletor/comparator to
// use full range, but we might lose some coverage too...
- s = _TestUtil.randomSimpleString(random());
+ s = TestUtil.randomSimpleString(random());
if (!slowCompletor.containsKey(s)) {
break;
}
@@ -159,8 +159,8 @@ public class WFSTCompletionTest extends
assertEquals(numWords, suggester.getCount());
Random random = new Random(random().nextLong());
for (String prefix : allPrefixes) {
- final int topN = _TestUtil.nextInt(random, 1, 10);
- List<LookupResult> r = suggester.lookup(_TestUtil.stringToCharSequence(prefix, random), false, topN);
+ final int topN = TestUtil.nextInt(random, 1, 10);
+ List<LookupResult> r = suggester.lookup(TestUtil.stringToCharSequence(prefix, random), false, topN);
// 2. go thru whole treemap (slowCompletor) and check its actually the best suggestion
final List<LookupResult> matches = new ArrayList<LookupResult>();
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java Wed Feb 19 13:42:17 2014
@@ -41,7 +41,7 @@ import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LineFileDocs;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.Rethrow;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
/**
* Base class for all Lucene unit tests that use TokenStreams.
@@ -493,12 +493,12 @@ public abstract class BaseTokenStreamTes
boolean useCharFilter = random.nextBoolean();
Directory dir = null;
RandomIndexWriter iw = null;
- final String postingsFormat = _TestUtil.getPostingsFormat("dummy");
+ final String postingsFormat = TestUtil.getPostingsFormat("dummy");
boolean codecOk = iterations * maxWordLength < 100000 ||
!(postingsFormat.equals("Memory") ||
postingsFormat.equals("SimpleText"));
if (rarely(random) && codecOk) {
- dir = newFSDirectory(_TestUtil.getTempDir("bttc"));
+ dir = newFSDirectory(TestUtil.getTempDir("bttc"));
iw = new RandomIndexWriter(new Random(seed), dir, a);
}
boolean success = false;
@@ -506,7 +506,7 @@ public abstract class BaseTokenStreamTes
checkRandomData(new Random(seed), a, iterations, maxWordLength, useCharFilter, simple, offsetsAreCorrect, iw);
// now test with multiple threads: note we do the EXACT same thing we did before in each thread,
// so this should only really fail from another thread if its an actual thread problem
- int numThreads = _TestUtil.nextInt(random, 2, 4);
+ int numThreads = TestUtil.nextInt(random, 2, 4);
AnalysisThread threads[] = new AnalysisThread[numThreads];
for (int i = 0; i < threads.length; i++) {
threads[i] = new AnalysisThread(seed, a, iterations, maxWordLength, useCharFilter, simple, offsetsAreCorrect, iw);
@@ -556,7 +556,7 @@ public abstract class BaseTokenStreamTes
if (random.nextBoolean()) {
ft.setOmitNorms(true);
}
- String pf = _TestUtil.getPostingsFormat("dummy");
+ String pf = TestUtil.getPostingsFormat("dummy");
boolean supportsOffsets = !doesntSupportOffsets.contains(pf);
switch(random.nextInt(4)) {
case 0: ft.setIndexOptions(IndexOptions.DOCS_ONLY); break;
@@ -598,7 +598,7 @@ public abstract class BaseTokenStreamTes
}
} else {
// synthetic
- text = _TestUtil.randomAnalysisString(random, maxWordLength, simple);
+ text = TestUtil.randomAnalysisString(random, maxWordLength, simple);
}
try {
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java Wed Feb 19 13:42:17 2014
@@ -47,7 +47,8 @@ import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.IndexableBinaryStringTools;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
+import org.apache.lucene.util.TestUtil;
/**
* Base test class for testing Unicode collation.
@@ -268,7 +269,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.
@@ -276,7 +277,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());
IOException priorException = null;
TokenStream ts = analyzer.tokenStream("fake", term);
try {
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockGraphTokenFilter.java Wed Feb 19 13:42:17 2014
@@ -21,7 +21,7 @@ import java.io.IOException;
import java.util.Random;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
// TODO: sometimes remove tokens too...?
@@ -55,7 +55,7 @@ public final class MockGraphTokenFilter
}
if (random.nextInt(7) == 5) {
- final int posLength = _TestUtil.nextInt(random, 1, 5);
+ final int posLength = TestUtil.nextInt(random, 1, 5);
if (DEBUG) {
System.out.println(" do insert! posLen=" + posLength);
@@ -76,7 +76,7 @@ public final class MockGraphTokenFilter
insertToken();
clearAttributes();
posLenAtt.setPositionLength(posLength);
- termAtt.append(_TestUtil.randomUnicodeString(random));
+ termAtt.append(TestUtil.randomUnicodeString(random));
posIncAtt.setPositionIncrement(0);
offsetAtt.setOffset(positions.get(outputPos).startOffset,
posEndData.endOffset);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockHoleInjectingTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockHoleInjectingTokenFilter.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockHoleInjectingTokenFilter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockHoleInjectingTokenFilter.java Wed Feb 19 13:42:17 2014
@@ -23,7 +23,7 @@ import java.util.Random;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionLengthAttribute;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
// TODO: maybe, instead to be more "natural", we should make
// a MockRemovesTokensTF, ideally subclassing FilteringTF
@@ -64,7 +64,7 @@ public final class MockHoleInjectingToke
// Carefully inject a hole only where it won't mess up
// the graph:
if (posInc > 0 && maxPos <= nextPos && random.nextInt(5) == 3) {
- final int holeSize = _TestUtil.nextInt(random, 1, 5);
+ final int holeSize = TestUtil.nextInt(random, 1, 5);
posIncAtt.setPositionIncrement(posInc + holeSize);
nextPos += holeSize;
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockReaderWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockReaderWrapper.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockReaderWrapper.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/analysis/MockReaderWrapper.java Wed Feb 19 13:42:17 2014
@@ -21,7 +21,7 @@ import java.io.IOException;
import java.io.Reader;
import java.util.Random;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
/** Wraps a Reader, and can throw random or fixed
* exceptions, and spoon feed read chars. */
@@ -68,7 +68,7 @@ public class MockReaderWrapper extends R
} else {
// Spoon-feed: intentionally maybe return less than
// the consumer asked for
- realLen = _TestUtil.nextInt(random, 1, len);
+ realLen = TestUtil.nextInt(random, 1, len);
}
if (excAtChar != -1) {
final int left = excAtChar - readSoFar;
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/AlcoholicMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/AlcoholicMergePolicy.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/AlcoholicMergePolicy.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/AlcoholicMergePolicy.java Wed Feb 19 13:42:17 2014
@@ -24,7 +24,7 @@ import java.util.Locale;
import java.util.Random;
import java.util.TimeZone;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
/**
* <p>
@@ -47,9 +47,9 @@ public class AlcoholicMergePolicy extend
public AlcoholicMergePolicy(TimeZone tz, Random random) {
this.calendar = new GregorianCalendar(tz, Locale.ROOT);
- calendar.setTimeInMillis(_TestUtil.nextLong(random, 0, Long.MAX_VALUE));
+ calendar.setTimeInMillis(TestUtil.nextLong(random, 0, Long.MAX_VALUE));
this.random = random;
- maxMergeSize = _TestUtil.nextInt(random, 1024*1024, Integer.MAX_VALUE);
+ maxMergeSize = TestUtil.nextInt(random, 1024 * 1024, Integer.MAX_VALUE);
}
@Override
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseCompressingDocValuesFormatTestCase.java Wed Feb 19 13:42:17 2014
@@ -26,7 +26,7 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.packed.PackedInts;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
@@ -47,7 +47,7 @@ public abstract class BaseCompressingDoc
final IndexWriterConfig iwc = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
final IndexWriter iwriter = new IndexWriter(dir, iwc);
- final int uniqueValueCount = _TestUtil.nextInt(random(), 1, 256);
+ final int uniqueValueCount = TestUtil.nextInt(random(), 1, 256);
final List<Long> values = new ArrayList<Long>();
final Document doc = new Document();
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java Wed Feb 19 13:42:17 2014
@@ -56,7 +56,7 @@ import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefHash;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
import static org.apache.lucene.index.SortedSetDocValues.NO_MORE_ORDS;
@@ -1139,11 +1139,11 @@ public abstract class BaseDocValuesForma
int numDocs = atLeast(100);
BytesRefHash hash = new BytesRefHash();
Map<String, String> docToString = new HashMap<String, String>();
- int maxLength = _TestUtil.nextInt(random(), 1, 50);
+ int maxLength = TestUtil.nextInt(random(), 1, 50);
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
doc.add(newTextField("id", "" + i, Field.Store.YES));
- String string = _TestUtil.randomRealisticUnicodeString(random(), 1, maxLength);
+ String string = TestUtil.randomRealisticUnicodeString(random(), 1, maxLength);
BytesRef br = new BytesRef(string);
doc.add(new SortedDocValuesField("field", br));
hash.add(br);
@@ -1175,7 +1175,7 @@ public abstract class BaseDocValuesForma
Document doc = new Document();
String id = "" + i + numDocs;
doc.add(newTextField("id", id, Field.Store.YES));
- String string = _TestUtil.randomRealisticUnicodeString(random(), 1, maxLength);
+ String string = TestUtil.randomRealisticUnicodeString(random(), 1, maxLength);
BytesRef br = new BytesRef(string);
hash.add(br);
docToString.put(id, string);
@@ -1221,7 +1221,7 @@ public abstract class BaseDocValuesForma
doTestNumericsVsStoredFields(new LongProducer() {
@Override
long next() {
- return _TestUtil.nextLong(random(), minValue, maxValue);
+ return TestUtil.nextLong(random(), minValue, maxValue);
}
});
}
@@ -1285,7 +1285,7 @@ public abstract class BaseDocValuesForma
doTestMissingVsFieldCache(new LongProducer() {
@Override
long next() {
- return _TestUtil.nextLong(random(), minValue, maxValue);
+ return TestUtil.nextLong(random(), minValue, maxValue);
}
});
}
@@ -1431,7 +1431,7 @@ public abstract class BaseDocValuesForma
if (minLength == maxLength) {
length = minLength; // fixed length
} else {
- length = _TestUtil.nextInt(random(), minLength, maxLength);
+ length = TestUtil.nextInt(random(), minLength, maxLength);
}
byte buffer[] = new byte[length];
random().nextBytes(buffer);
@@ -1470,7 +1470,7 @@ public abstract class BaseDocValuesForma
public void testBinaryFixedLengthVsStoredFields() throws Exception {
int numIterations = atLeast(1);
for (int i = 0; i < numIterations; i++) {
- int fixedLength = _TestUtil.nextInt(random(), 0, 10);
+ int fixedLength = TestUtil.nextInt(random(), 0, 10);
doTestBinaryVsStoredFields(fixedLength, fixedLength);
}
}
@@ -1502,7 +1502,7 @@ public abstract class BaseDocValuesForma
if (minLength == maxLength) {
length = minLength; // fixed length
} else {
- length = _TestUtil.nextInt(random(), minLength, maxLength);
+ length = TestUtil.nextInt(random(), minLength, maxLength);
}
byte buffer[] = new byte[length];
random().nextBytes(buffer);
@@ -1558,9 +1558,9 @@ public abstract class BaseDocValuesForma
if (minLength == maxLength) {
length = minLength; // fixed length
} else {
- length = _TestUtil.nextInt(random(), minLength, maxLength);
+ length = TestUtil.nextInt(random(), minLength, maxLength);
}
- String value = _TestUtil.randomSimpleString(random(), length);
+ String value = TestUtil.randomSimpleString(random(), length);
indexedField.setStringValue(value);
dvField.setBytesValue(new BytesRef(value));
writer.addDocument(doc);
@@ -1592,7 +1592,7 @@ public abstract class BaseDocValuesForma
public void testSortedFixedLengthVsStoredFields() throws Exception {
int numIterations = atLeast(1);
for (int i = 0; i < numIterations; i++) {
- int fixedLength = _TestUtil.nextInt(random(), 1, 10);
+ int fixedLength = TestUtil.nextInt(random(), 1, 10);
doTestSortedVsStoredFields(fixedLength, fixedLength);
}
}
@@ -1600,7 +1600,7 @@ public abstract class BaseDocValuesForma
public void testSortedFixedLengthVsFieldCache() throws Exception {
int numIterations = atLeast(1);
for (int i = 0; i < numIterations; i++) {
- int fixedLength = _TestUtil.nextInt(random(), 1, 10);
+ int fixedLength = TestUtil.nextInt(random(), 1, 10);
doTestSortedVsFieldCache(fixedLength, fixedLength);
}
}
@@ -2082,13 +2082,13 @@ public abstract class BaseDocValuesForma
if (minLength == maxLength) {
length = minLength; // fixed length
} else {
- length = _TestUtil.nextInt(random(), minLength, maxLength);
+ length = TestUtil.nextInt(random(), minLength, maxLength);
}
- int numValues = _TestUtil.nextInt(random(), 0, maxValuesPerDoc);
+ int numValues = TestUtil.nextInt(random(), 0, maxValuesPerDoc);
// create a random set of strings
Set<String> values = new TreeSet<String>();
for (int v = 0; v < numValues; v++) {
- values.add(_TestUtil.randomSimpleString(random(), length));
+ values.add(TestUtil.randomSimpleString(random(), length));
}
// add ordered to the stored field
@@ -2146,7 +2146,7 @@ public abstract class BaseDocValuesForma
assumeTrue("Codec does not support SORTED_SET", defaultCodecSupportsSortedSet());
int numIterations = atLeast(1);
for (int i = 0; i < numIterations; i++) {
- int fixedLength = _TestUtil.nextInt(random(), 1, 10);
+ int fixedLength = TestUtil.nextInt(random(), 1, 10);
doTestSortedSetVsStoredFields(fixedLength, fixedLength, 16);
}
}
@@ -2163,7 +2163,7 @@ public abstract class BaseDocValuesForma
assumeTrue("Codec does not support SORTED_SET", defaultCodecSupportsSortedSet());
int numIterations = atLeast(1);
for (int i = 0; i < numIterations; i++) {
- int fixedLength = _TestUtil.nextInt(random(), 1, 10);
+ int fixedLength = TestUtil.nextInt(random(), 1, 10);
doTestSortedSetVsStoredFields(fixedLength, fixedLength, 1);
}
}
@@ -2256,7 +2256,7 @@ public abstract class BaseDocValuesForma
// random seekExact(ord)
for (long i = 0; i < numOrds; i++) {
- long randomOrd = _TestUtil.nextLong(random(), 0, numOrds-1);
+ long randomOrd = TestUtil.nextLong(random(), 0, numOrds - 1);
expected.seekExact(randomOrd);
actual.seekExact(randomOrd);
assertEquals(expected.ord(), actual.ord());
@@ -2265,7 +2265,7 @@ public abstract class BaseDocValuesForma
// random seekExact(BytesRef)
for (long i = 0; i < numOrds; i++) {
- long randomOrd = _TestUtil.nextLong(random(), 0, numOrds-1);
+ long randomOrd = TestUtil.nextLong(random(), 0, numOrds - 1);
expected.seekExact(randomOrd);
actual.seekExact(expected.term());
assertEquals(expected.ord(), actual.ord());
@@ -2274,7 +2274,7 @@ public abstract class BaseDocValuesForma
// random seekCeil(BytesRef)
for (long i = 0; i < numOrds; i++) {
- BytesRef target = new BytesRef(_TestUtil.randomUnicodeString(random()));
+ BytesRef target = new BytesRef(TestUtil.randomUnicodeString(random()));
SeekStatus expectedStatus = expected.seekCeil(target);
assertEquals(expectedStatus, actual.seekCeil(target));
if (expectedStatus != SeekStatus.END) {
@@ -2299,13 +2299,13 @@ public abstract class BaseDocValuesForma
if (minLength == maxLength) {
length = minLength; // fixed length
} else {
- length = _TestUtil.nextInt(random(), minLength, maxLength);
+ length = TestUtil.nextInt(random(), minLength, maxLength);
}
int numValues = random().nextInt(17);
// create a random list of strings
List<String> values = new ArrayList<String>();
for (int v = 0; v < numValues; v++) {
- values.add(_TestUtil.randomSimpleString(random(), length));
+ values.add(TestUtil.randomSimpleString(random(), length));
}
// add in any order to the indexed field
@@ -2363,7 +2363,7 @@ public abstract class BaseDocValuesForma
assumeTrue("Codec does not support SORTED_SET", defaultCodecSupportsSortedSet());
int numIterations = atLeast(1);
for (int i = 0; i < numIterations; i++) {
- int fixedLength = _TestUtil.nextInt(random(), 1, 10);
+ int fixedLength = TestUtil.nextInt(random(), 1, 10);
doTestSortedSetVsUninvertedField(fixedLength, fixedLength);
}
}
@@ -2615,17 +2615,17 @@ public abstract class BaseDocValuesForma
Analyzer analyzer = new MockAnalyzer(random());
// FSDirectory because SimpleText will consume gobbs of
// space when storing big binary values:
- Directory d = newFSDirectory(_TestUtil.getTempDir("hugeBinaryValues"));
+ Directory d = newFSDirectory(TestUtil.getTempDir("hugeBinaryValues"));
boolean doFixed = random().nextBoolean();
int numDocs;
int fixedLength = 0;
if (doFixed) {
// Sometimes make all values fixed length since some
// codecs have different code paths for this:
- numDocs = _TestUtil.nextInt(random(), 10, 20);
- fixedLength = _TestUtil.nextInt(random(), 65537, 256*1024);
+ numDocs = TestUtil.nextInt(random(), 10, 20);
+ fixedLength = TestUtil.nextInt(random(), 65537, 256 * 1024);
} else {
- numDocs = _TestUtil.nextInt(random(), 100, 200);
+ numDocs = TestUtil.nextInt(random(), 100, 200);
}
IndexWriter w = new IndexWriter(d, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
List<byte[]> docBytes = new ArrayList<byte[]>();
@@ -2640,9 +2640,9 @@ public abstract class BaseDocValuesForma
if (doFixed) {
numBytes = fixedLength;
} else if (docID == 0 || random().nextInt(5) == 3) {
- numBytes = _TestUtil.nextInt(random(), 65537, 3*1024*1024);
+ numBytes = TestUtil.nextInt(random(), 65537, 3 * 1024 * 1024);
} else {
- numBytes = _TestUtil.nextInt(random(), 1, 1024*1024);
+ numBytes = TestUtil.nextInt(random(), 1, 1024 * 1024);
}
totalBytes += numBytes;
if (totalBytes > 5 * 1024*1024) {
@@ -2713,17 +2713,17 @@ public abstract class BaseDocValuesForma
Analyzer analyzer = new MockAnalyzer(random());
// FSDirectory because SimpleText will consume gobbs of
// space when storing big binary values:
- Directory d = newFSDirectory(_TestUtil.getTempDir("hugeBinaryValues"));
+ Directory d = newFSDirectory(TestUtil.getTempDir("hugeBinaryValues"));
boolean doFixed = random().nextBoolean();
int numDocs;
int fixedLength = 0;
if (doFixed) {
// Sometimes make all values fixed length since some
// codecs have different code paths for this:
- numDocs = _TestUtil.nextInt(random(), 10, 20);
+ numDocs = TestUtil.nextInt(random(), 10, 20);
fixedLength = Lucene42DocValuesFormat.MAX_BINARY_FIELD_LENGTH;
} else {
- numDocs = _TestUtil.nextInt(random(), 100, 200);
+ numDocs = TestUtil.nextInt(random(), 100, 200);
}
IndexWriter w = new IndexWriter(d, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
List<byte[]> docBytes = new ArrayList<byte[]>();
@@ -2740,7 +2740,7 @@ public abstract class BaseDocValuesForma
} else if (docID == 0 || random().nextInt(5) == 3) {
numBytes = Lucene42DocValuesFormat.MAX_BINARY_FIELD_LENGTH;
} else {
- numBytes = _TestUtil.nextInt(random(), 1, Lucene42DocValuesFormat.MAX_BINARY_FIELD_LENGTH);
+ numBytes = TestUtil.nextInt(random(), 1, Lucene42DocValuesFormat.MAX_BINARY_FIELD_LENGTH);
}
totalBytes += numBytes;
if (totalBytes > 5 * 1024*1024) {
@@ -2799,7 +2799,7 @@ public abstract class BaseDocValuesForma
int numDocs = atLeast(300);
for (int i = 0; i < numDocs; i++) {
idField.setStringValue(Integer.toString(i));
- int length = _TestUtil.nextInt(random(), 0, 8);
+ int length = TestUtil.nextInt(random(), 0, 8);
byte buffer[] = new byte[length];
random().nextBytes(buffer);
storedBinField.setBytesValue(buffer);
@@ -2824,7 +2824,7 @@ public abstract class BaseDocValuesForma
// compare
final DirectoryReader ir = DirectoryReader.open(dir);
- int numThreads = _TestUtil.nextInt(random(), 2, 7);
+ int numThreads = TestUtil.nextInt(random(), 2, 7);
Thread threads[] = new Thread[numThreads];
final CountDownLatch startingGun = new CountDownLatch(1);
@@ -2850,7 +2850,7 @@ public abstract class BaseDocValuesForma
assertEquals(Long.parseLong(expected), numerics.get(j));
}
}
- _TestUtil.checkReader(ir);
+ TestUtil.checkReader(ir);
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -2884,7 +2884,7 @@ public abstract class BaseDocValuesForma
int numDocs = atLeast(300);
for (int i = 0; i < numDocs; i++) {
idField.setStringValue(Integer.toString(i));
- int length = _TestUtil.nextInt(random(), 0, 8);
+ int length = TestUtil.nextInt(random(), 0, 8);
byte buffer[] = new byte[length];
random().nextBytes(buffer);
storedBinField.setBytesValue(buffer);
@@ -2907,7 +2907,7 @@ public abstract class BaseDocValuesForma
int numSortedSetFields = random().nextInt(3);
Set<String> values = new TreeSet<String>();
for (int j = 0; j < numSortedSetFields; j++) {
- values.add(_TestUtil.randomSimpleString(random()));
+ values.add(TestUtil.randomSimpleString(random()));
}
for (String v : values) {
doc.add(new SortedSetDocValuesField("dvSortedSet", new BytesRef(v)));
@@ -2929,7 +2929,7 @@ public abstract class BaseDocValuesForma
// compare
final DirectoryReader ir = DirectoryReader.open(dir);
- int numThreads = _TestUtil.nextInt(random(), 2, 7);
+ int numThreads = TestUtil.nextInt(random(), 2, 7);
Thread threads[] = new Thread[numThreads];
final CountDownLatch startingGun = new CountDownLatch(1);
@@ -2997,7 +2997,7 @@ public abstract class BaseDocValuesForma
}
}
}
- _TestUtil.checkReader(ir);
+ TestUtil.checkReader(ir);
} catch (Exception e) {
throw new RuntimeException(e);
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java Wed Feb 19 13:42:17 2014
@@ -57,7 +57,8 @@ import org.apache.lucene.store.MockDirec
import org.apache.lucene.store.MockDirectoryWrapper.Throttling;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
+import org.apache.lucene.util.TestUtil;
import com.carrotsearch.randomizedtesting.generators.RandomInts;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
@@ -93,10 +94,10 @@ public abstract class BaseStoredFieldsFo
public void testRandomStoredFields() throws IOException {
Directory dir = newDirectory();
Random rand = random();
- RandomIndexWriter w = new RandomIndexWriter(rand, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMaxBufferedDocs(_TestUtil.nextInt(rand, 5, 20)));
+ RandomIndexWriter w = new RandomIndexWriter(rand, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())).setMaxBufferedDocs(TestUtil.nextInt(rand, 5, 20)));
//w.w.setNoCFSRatio(0.0);
final int docCount = atLeast(200);
- final int fieldCount = _TestUtil.nextInt(rand, 1, 5);
+ final int fieldCount = TestUtil.nextInt(rand, 1, 5);
final List<Integer> fieldIDs = new ArrayList<Integer>();
@@ -129,7 +130,7 @@ public abstract class BaseStoredFieldsFo
for(int field: fieldIDs) {
final String s;
if (rand.nextInt(4) != 3) {
- s = _TestUtil.randomUnicodeString(rand, 1000);
+ s = TestUtil.randomUnicodeString(rand, 1000);
doc.add(newField("f"+field, s, customType2));
} else {
s = null;
@@ -349,7 +350,7 @@ public abstract class BaseStoredFieldsFo
ft.setStored(true);
ft.freeze();
- final String string = _TestUtil.randomSimpleString(random(), 50);
+ final String string = TestUtil.randomSimpleString(random(), 50);
final byte[] bytes = string.getBytes("UTF-8");
final long l = random().nextBoolean() ? random().nextInt(42) : random().nextLong();
final int i = random().nextBoolean() ? random().nextInt(42) : random().nextInt();
@@ -597,7 +598,7 @@ public abstract class BaseStoredFieldsFo
// for this test we force a FS dir
// we can't just use newFSDirectory, because this test doesn't really index anything.
// so if we get NRTCachingDir+SimpleText, we make massive stored fields and OOM (LUCENE-4484)
- Directory dir = new MockDirectoryWrapper(random(), new MMapDirectory(_TestUtil.getTempDir("testBigDocuments")));
+ Directory dir = new MockDirectoryWrapper(random(), new MMapDirectory(TestUtil.getTempDir("testBigDocuments")));
IndexWriterConfig iwConf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
iwConf.setMaxBufferedDocs(RandomInts.randomIntBetween(random(), 2, 30));
RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwConf);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/BaseTermVectorsFormatTestCase.java Wed Feb 19 13:42:17 2014
@@ -48,7 +48,7 @@ import org.apache.lucene.util.AttributeI
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
@@ -216,17 +216,17 @@ public abstract class BaseTermVectorsFor
final int o = random().nextInt(sampleTerms.length);
terms[i] = sampleTerms[o];
termBytes[i] = sampleTermBytes[o];
- positionsIncrements[i] = _TestUtil.nextInt(random(), i == 0 ? 1 : 0, 10);
+ positionsIncrements[i] = TestUtil.nextInt(random(), i == 0 ? 1 : 0, 10);
if (offsetsGoBackwards) {
startOffsets[i] = random().nextInt();
endOffsets[i] = random().nextInt();
} else {
if (i == 0) {
- startOffsets[i] = _TestUtil.nextInt(random(), 0, 1 << 16);
+ startOffsets[i] = TestUtil.nextInt(random(), 0, 1 << 16);
} else {
- startOffsets[i] = startOffsets[i-1] + _TestUtil.nextInt(random(), 0, rarely() ? 1 << 16 : 20);
+ startOffsets[i] = startOffsets[i-1] + TestUtil.nextInt(random(), 0, rarely() ? 1 << 16 : 20);
}
- endOffsets[i] = startOffsets[i] + _TestUtil.nextInt(random(), 0, rarely() ? 1 << 10 : 20);
+ endOffsets[i] = startOffsets[i] + TestUtil.nextInt(random(), 0, rarely() ? 1 << 10 : 20);
}
}
@@ -320,7 +320,7 @@ public abstract class BaseTermVectorsFor
this.fieldNames[i] = RandomPicks.randomFrom(random(), fieldNames);
} while (usedFileNames.contains(this.fieldNames[i]));
usedFileNames.add(this.fieldNames[i]);
- tokenStreams[i] = new RandomTokenStream(_TestUtil.nextInt(random(), 1, maxTermCount), sampleTerms, sampleTermBytes);
+ tokenStreams[i] = new RandomTokenStream(TestUtil.nextInt(random(), 1, maxTermCount), sampleTerms, sampleTermBytes);
}
}
@@ -343,14 +343,14 @@ public abstract class BaseTermVectorsFor
protected RandomDocumentFactory(int distinctFieldNames, int disctinctTerms) {
final Set<String> fieldNames = new HashSet<String>();
while (fieldNames.size() < distinctFieldNames) {
- fieldNames.add(_TestUtil.randomSimpleString(random()));
+ fieldNames.add(TestUtil.randomSimpleString(random()));
fieldNames.remove("id");
}
this.fieldNames = fieldNames.toArray(new String[0]);
terms = new String[disctinctTerms];
termBytes = new BytesRef[disctinctTerms];
for (int i = 0; i < disctinctTerms; ++i) {
- terms[i] = _TestUtil.randomRealisticUnicodeString(random());
+ terms[i] = TestUtil.randomRealisticUnicodeString(random());
termBytes[i] = new BytesRef(terms[i]);
}
}
@@ -525,7 +525,7 @@ public abstract class BaseTermVectorsFor
final Document emptyDoc = new Document();
final Directory dir = newDirectory();
final RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
- final RandomDocument doc = docFactory.newDocument(_TestUtil.nextInt(random(), 1, 3), 20, options);
+ final RandomDocument doc = docFactory.newDocument(TestUtil.nextInt(random(), 1, 3), 20, options);
for (int i = 0; i < numDocs; ++i) {
if (i == docWithVectors) {
writer.addDocument(addId(doc.toDocument(), "42"));
@@ -560,7 +560,7 @@ public abstract class BaseTermVectorsFor
}
final Directory dir = newDirectory();
final RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
- final RandomDocument doc = docFactory.newDocument(_TestUtil.nextInt(random(), 1, 2), atLeast(20000), options);
+ final RandomDocument doc = docFactory.newDocument(TestUtil.nextInt(random(), 1, 2), atLeast(20000), options);
writer.addDocument(doc.toDocument());
final IndexReader reader = writer.getReader();
assertEquals(doc, reader.getTermVectors(0));
@@ -587,7 +587,7 @@ public abstract class BaseTermVectorsFor
// different options for the same field
public void testMixedOptions() throws IOException {
- final int numFields = _TestUtil.nextInt(random(), 1, 3);
+ final int numFields = TestUtil.nextInt(random(), 1, 3);
final RandomDocumentFactory docFactory = new RandomDocumentFactory(numFields, 10);
for (Options options1 : validOptions()) {
for (Options options2 : validOptions()) {
@@ -617,7 +617,7 @@ public abstract class BaseTermVectorsFor
final int numDocs = atLeast(100);
final RandomDocument[] docs = new RandomDocument[numDocs];
for (int i = 0; i < numDocs; ++i) {
- docs[i] = docFactory.newDocument(_TestUtil.nextInt(random(), 1, 3), _TestUtil.nextInt(random(), 10, 50), randomOptions());
+ docs[i] = docFactory.newDocument(TestUtil.nextInt(random(), 1, 3), TestUtil.nextInt(random(), 10, 50), randomOptions());
}
final Directory dir = newDirectory();
final RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
@@ -645,7 +645,7 @@ public abstract class BaseTermVectorsFor
for (Options options : validOptions()) {
final RandomDocument[] docs = new RandomDocument[numDocs];
for (int i = 0; i < numDocs; ++i) {
- docs[i] = docFactory.newDocument(_TestUtil.nextInt(random(), 1, 3), atLeast(10), options);
+ docs[i] = docFactory.newDocument(TestUtil.nextInt(random(), 1, 3), atLeast(10), options);
}
final Directory dir = newDirectory();
final RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
@@ -681,7 +681,7 @@ public abstract class BaseTermVectorsFor
for (Options options : validOptions()) {
final RandomDocument[] docs = new RandomDocument[numDocs];
for (int i = 0; i < numDocs; ++i) {
- docs[i] = docFactory.newDocument(_TestUtil.nextInt(random(), 1, 3), atLeast(10), options);
+ docs[i] = docFactory.newDocument(TestUtil.nextInt(random(), 1, 3), atLeast(10), options);
}
final Directory dir = newDirectory();
final RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/MockRandomMergePolicy.java Wed Feb 19 13:42:17 2014
@@ -25,8 +25,7 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
-import org.apache.lucene.index.MergePolicy.MergeTrigger;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
/**
* MergePolicy that makes random decisions for testing.
@@ -64,7 +63,7 @@ public class MockRandomMergePolicy exten
// TODO: sometimes make more than 1 merge?
mergeSpec = new MergeSpecification();
- final int segsToMerge = _TestUtil.nextInt(random, 1, numSegments);
+ final int segsToMerge = TestUtil.nextInt(random, 1, numSegments);
mergeSpec.add(new OneMerge(segments.subList(0, segsToMerge)));
}
@@ -93,7 +92,7 @@ public class MockRandomMergePolicy exten
int upto = 0;
while(upto < eligibleSegments.size()) {
int max = Math.min(10, eligibleSegments.size()-upto);
- int inc = max <= 2 ? max : _TestUtil.nextInt(random, 2, max);
+ int inc = max <= 2 ? max : TestUtil.nextInt(random, 2, max);
mergeSpec.add(new OneMerge(eligibleSegments.subList(upto, upto+inc)));
upto += inc;
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/RandomIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/RandomIndexWriter.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/RandomIndexWriter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/RandomIndexWriter.java Wed Feb 19 13:42:17 2014
@@ -25,14 +25,13 @@ import java.util.Random;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.codecs.Codec;
-import org.apache.lucene.index.IndexWriter; // javadoc
import org.apache.lucene.search.Query;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.InfoStream;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.NullInfoStream;
+import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.Version;
-import org.apache.lucene.util._TestUtil;
/** Silly class that randomizes the indexing experience. EG
* it may swap in a different merge policy/scheduler; may
@@ -88,7 +87,7 @@ public class RandomIndexWriter implement
// TODO: this should be solved in a different way; Random should not be shared (!).
this.r = new Random(r.nextLong());
w = mockIndexWriter(dir, c, r);
- flushAt = _TestUtil.nextInt(r, 10, 1000);
+ flushAt = TestUtil.nextInt(r, 10, 1000);
codec = w.getConfig().getCodec();
if (LuceneTestCase.VERBOSE) {
System.out.println("RIW dir=" + dir + " config=" + w.getConfig());
@@ -155,7 +154,7 @@ public class RandomIndexWriter implement
System.out.println("RIW.add/updateDocument: now doing a commit at docCount=" + docCount);
}
w.commit();
- flushAt += _TestUtil.nextInt(r, (int) (flushAtFactor * 10), (int) (flushAtFactor * 1000));
+ flushAt += TestUtil.nextInt(r, (int) (flushAtFactor * 10), (int) (flushAtFactor * 1000));
if (flushAtFactor < 2e6) {
// gradually but exponentially increase time b/w flushes
flushAtFactor *= 1.05;
@@ -283,7 +282,7 @@ public class RandomIndexWriter implement
w.forceMerge(1);
} else {
// partial forceMerge
- final int limit = _TestUtil.nextInt(r, 1, segCount);
+ final int limit = TestUtil.nextInt(r, 1, segCount);
if (LuceneTestCase.VERBOSE) {
System.out.println("RIW: doRandomForceMerge(" + limit + ")");
}
@@ -315,7 +314,7 @@ public class RandomIndexWriter implement
}
w.commit();
if (r.nextBoolean()) {
- return DirectoryReader.open(w.getDirectory(), _TestUtil.nextInt(r, 1, 10));
+ return DirectoryReader.open(w.getDirectory(), TestUtil.nextInt(r, 1, 10));
} else {
return w.getReader(applyDeletions);
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java Wed Feb 19 13:42:17 2014
@@ -39,7 +39,6 @@ import org.apache.lucene.search.TermQuer
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.BaseDirectoryWrapper;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.FailOnNonBulkMergesInfoStream;
@@ -47,7 +46,7 @@ import org.apache.lucene.util.LineFileDo
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.NamedThreadFactory;
import org.apache.lucene.util.PrintStreamInfoStream;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
// TODO
// - mix in forceMerge, addIndexes
@@ -137,12 +136,12 @@ public abstract class ThreadedIndexingAn
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));
+ Thread.sleep(TestUtil.nextInt(random(), 1, 10));
if (VERBOSE) {
System.out.println(Thread.currentThread().getName() + ": done sleep");
}
@@ -187,16 +186,16 @@ public abstract class ThreadedIndexingAn
allSubDocs.add(subDocs);
doc.add(packIDField);
- docsList.add(_TestUtil.cloneDocument(doc));
+ 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) {
break;
}
- docsList.add(_TestUtil.cloneDocument(doc));
+ docsList.add(TestUtil.cloneDocument(doc));
docIDs.add(doc.get("docid"));
}
addCount.addAndGet(docsList.size());
@@ -317,7 +316,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();
@@ -436,7 +435,7 @@ public abstract class ThreadedIndexingAn
Random random = new Random(random().nextLong());
final LineFileDocs docs = new LineFileDocs(random, defaultCodecSupportsDocValues());
- final File tempDir = _TestUtil.getTempDir(testName);
+ final File tempDir = TestUtil.getTempDir(testName);
dir = getDirectory(newMockFSDirectory(tempDir)); // some subclasses rely on this being MDW
if (dir instanceof BaseDirectoryWrapper) {
((BaseDirectoryWrapper) dir).setCheckIndexOnClose(false); // don't double-checkIndex, we do it ourselves.
@@ -497,13 +496,13 @@ public abstract class ThreadedIndexingAn
});
}
writer = new IndexWriter(dir, conf);
- _TestUtil.reduceOpenFiles(writer);
+ TestUtil.reduceOpenFiles(writer);
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;
@@ -642,9 +641,9 @@ public abstract class ThreadedIndexingAn
es.awaitTermination(1, TimeUnit.SECONDS);
}
- _TestUtil.checkIndex(dir);
+ TestUtil.checkIndex(dir);
dir.close();
- _TestUtil.rmDir(tempDir);
+ TestUtil.rmDir(tempDir);
if (VERBOSE) {
System.out.println("TEST: done [" + (System.currentTimeMillis()-t0) + " ms]");
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingIndexSearcher.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingIndexSearcher.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingIndexSearcher.java Wed Feb 19 13:42:17 2014
@@ -25,7 +25,7 @@ import java.util.concurrent.ExecutorServ
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReaderContext;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
/**
* Helper class that adds some extra checks to ensure correct
@@ -85,7 +85,7 @@ public class AssertingIndexSearcher exte
protected Query wrapFilter(Query query, Filter filter) {
if (random.nextBoolean())
return super.wrapFilter(query, filter);
- return (filter == null) ? query : new FilteredQuery(query, filter, _TestUtil.randomFilterStrategy(random));
+ return (filter == null) ? query : new FilteredQuery(query, filter, TestUtil.randomFilterStrategy(random));
}
@Override
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/SearchEquivalenceTestBase.java Wed Feb 19 13:42:17 2014
@@ -31,9 +31,8 @@ import org.apache.lucene.index.IndexRead
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.Bits;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
import org.junit.AfterClass;
@@ -125,7 +124,7 @@ 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');
}
/**
@@ -173,8 +172,8 @@ 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()) {
- q1 = new FilteredQuery(q1, filter, _TestUtil.randomFilterStrategy(random()));
- q2 = new FilteredQuery(q2, filter, _TestUtil.randomFilterStrategy(random()));
+ q1 = new FilteredQuery(q1, filter, TestUtil.randomFilterStrategy(random()));
+ q2 = new FilteredQuery(q2, filter, TestUtil.randomFilterStrategy(random()));
filter = null;
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/search/ShardSearchingTestBase.java Wed Feb 19 13:42:17 2014
@@ -36,7 +36,7 @@ import org.apache.lucene.store.Directory
import org.apache.lucene.util.LineFileDocs;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.PrintStreamInfoStream;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
// TODO
// - doc blocks? so we can test joins/grouping...
@@ -447,7 +447,7 @@ public abstract class ShardSearchingTest
public NodeState(Random random, int nodeID, int numNodes) throws IOException {
myNodeID = nodeID;
- dir = newFSDirectory(_TestUtil.getTempDir("ShardSearchingTestBase"));
+ dir = newFSDirectory(TestUtil.getTempDir("ShardSearchingTestBase"));
// TODO: set warmer
IndexWriterConfig iwc = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random));
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/store/BaseDirectoryWrapper.java Wed Feb 19 13:42:17 2014
@@ -20,7 +20,7 @@ package org.apache.lucene.store;
import java.io.IOException;
import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
/**
* Calls check index on close.
@@ -42,7 +42,7 @@ public class BaseDirectoryWrapper extend
public void close() throws IOException {
isOpen = false;
if (checkIndexOnClose && DirectoryReader.indexExists(this)) {
- _TestUtil.checkIndex(this, crossCheckTermVectorsOnClose);
+ TestUtil.checkIndex(this, crossCheckTermVectorsOnClose);
}
super.close();
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java Wed Feb 19 13:42:17 2014
@@ -41,8 +41,8 @@ import org.apache.lucene.index.IndexWrit
import org.apache.lucene.index.NoDeletionPolicy;
import org.apache.lucene.index.SegmentInfos;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.ThrottledIndexOutput;
-import org.apache.lucene.util._TestUtil;
/**
* This is a Directory Wrapper that adds methods
@@ -660,7 +660,7 @@ public class MockDirectoryWrapper extend
if (LuceneTestCase.VERBOSE) {
System.out.println("\nNOTE: MockDirectoryWrapper: now run CheckIndex");
}
- _TestUtil.checkIndex(this, getCrossCheckTermVectorsOnClose());
+ TestUtil.checkIndex(this, getCrossCheckTermVectorsOnClose());
// TODO: factor this out / share w/ TestIW.assertNoUnreferencedFiles
if (assertNoUnreferencedFilesOnClose) {
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.java Wed Feb 19 13:42:17 2014
@@ -86,7 +86,7 @@ public abstract class BaseDocIdSetTestCa
/** Compare the content of the set against a {@link BitSet}. */
public void testAgainstBitSet() throws IOException {
- final int numBits = _TestUtil.nextInt(random(), 100, 1 << 20);
+ final int numBits = TestUtil.nextInt(random(), 100, 1 << 20);
// test various random sets with various load factors
for (float percentSet : new float[] {0f, 0.0001f, random().nextFloat() / 2, 0.9f, 1f}) {
final BitSet set = randomSet(numBits, percentSet);
@@ -103,7 +103,7 @@ public abstract class BaseDocIdSetTestCa
copy = copyOf(set, numBits); // then random index
assertEquals(numBits, set, copy);
// test regular increments
- for (int inc = 2; inc < 1000; inc += _TestUtil.nextInt(random(), 1, 100)) {
+ for (int inc = 2; inc < 1000; inc += TestUtil.nextInt(random(), 1, 100)) {
set = new BitSet(numBits);
for (int d = random().nextInt(10); d < numBits; d += inc) {
set.set(d);
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/CloseableFile.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/CloseableFile.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/CloseableFile.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/CloseableFile.java Wed Feb 19 13:42:17 2014
@@ -37,7 +37,7 @@ final class CloseableFile implements Clo
if (failureMarker.wasSuccessful()) {
if (file.exists()) {
try {
- _TestUtil.rmDir(file);
+ TestUtil.rmDir(file);
} catch (IOException e) {
// Ignore the exception from rmDir.
}
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Wed Feb 19 13:42:17 2014
@@ -639,7 +639,7 @@ public abstract class LuceneTestCase ext
public static int atLeast(Random random, int i) {
int min = (TEST_NIGHTLY ? 2*i : i) * RANDOM_MULTIPLIER;
int max = min+(min/2);
- return _TestUtil.nextInt(random, min, max);
+ return TestUtil.nextInt(random, min, max);
}
public static int atLeast(int i) {
@@ -744,8 +744,8 @@ public abstract class LuceneTestCase ext
if (r.nextBoolean()) {
c.setMergeScheduler(new SerialMergeScheduler());
} else if (rarely(r)) {
- int maxThreadCount = _TestUtil.nextInt(random(), 1, 4);
- int maxMergeCount = _TestUtil.nextInt(random(), maxThreadCount, maxThreadCount+4);
+ int maxThreadCount = TestUtil.nextInt(random(), 1, 4);
+ int maxMergeCount = TestUtil.nextInt(random(), maxThreadCount, maxThreadCount+4);
ConcurrentMergeScheduler cms = new ConcurrentMergeScheduler();
cms.setMaxMergesAndThreads(maxMergeCount, maxThreadCount);
c.setMergeScheduler(cms);
@@ -753,24 +753,24 @@ public abstract class LuceneTestCase ext
if (r.nextBoolean()) {
if (rarely(r)) {
// crazy value
- c.setMaxBufferedDocs(_TestUtil.nextInt(r, 2, 15));
+ c.setMaxBufferedDocs(TestUtil.nextInt(r, 2, 15));
} else {
// reasonable value
- c.setMaxBufferedDocs(_TestUtil.nextInt(r, 16, 1000));
+ c.setMaxBufferedDocs(TestUtil.nextInt(r, 16, 1000));
}
}
if (r.nextBoolean()) {
if (rarely(r)) {
// crazy value
- c.setTermIndexInterval(r.nextBoolean() ? _TestUtil.nextInt(r, 1, 31) : _TestUtil.nextInt(r, 129, 1000));
+ c.setTermIndexInterval(r.nextBoolean() ? TestUtil.nextInt(r, 1, 31) : TestUtil.nextInt(r, 129, 1000));
} else {
// reasonable value
- c.setTermIndexInterval(_TestUtil.nextInt(r, 32, 128));
+ c.setTermIndexInterval(TestUtil.nextInt(r, 32, 128));
}
}
if (r.nextBoolean()) {
- int maxNumThreadStates = rarely(r) ? _TestUtil.nextInt(r, 5, 20) // crazy value
- : _TestUtil.nextInt(r, 1, 4); // reasonable value
+ int maxNumThreadStates = rarely(r) ? TestUtil.nextInt(r, 5, 20) // crazy value
+ : TestUtil.nextInt(r, 1, 4); // reasonable value
Method setIndexerThreadPoolMethod = null;
try {
@@ -815,7 +815,7 @@ public abstract class LuceneTestCase ext
}
c.setUseCompoundFile(r.nextBoolean());
c.setReaderPooling(r.nextBoolean());
- c.setReaderTermsIndexDivisor(_TestUtil.nextInt(r, 1, 4));
+ c.setReaderTermsIndexDivisor(TestUtil.nextInt(r, 1, 4));
return c;
}
@@ -854,9 +854,9 @@ public abstract class LuceneTestCase ext
LogMergePolicy logmp = r.nextBoolean() ? new LogDocMergePolicy() : new LogByteSizeMergePolicy();
logmp.setCalibrateSizeByDeletes(r.nextBoolean());
if (rarely(r)) {
- logmp.setMergeFactor(_TestUtil.nextInt(r, 2, 9));
+ logmp.setMergeFactor(TestUtil.nextInt(r, 2, 9));
} else {
- logmp.setMergeFactor(_TestUtil.nextInt(r, 10, 50));
+ logmp.setMergeFactor(TestUtil.nextInt(r, 10, 50));
}
configureRandom(r, logmp);
return logmp;
@@ -879,11 +879,11 @@ public abstract class LuceneTestCase ext
public static TieredMergePolicy newTieredMergePolicy(Random r) {
TieredMergePolicy tmp = new TieredMergePolicy();
if (rarely(r)) {
- tmp.setMaxMergeAtOnce(_TestUtil.nextInt(r, 2, 9));
- tmp.setMaxMergeAtOnceExplicit(_TestUtil.nextInt(r, 2, 9));
+ tmp.setMaxMergeAtOnce(TestUtil.nextInt(r, 2, 9));
+ tmp.setMaxMergeAtOnceExplicit(TestUtil.nextInt(r, 2, 9));
} else {
- tmp.setMaxMergeAtOnce(_TestUtil.nextInt(r, 10, 50));
- tmp.setMaxMergeAtOnceExplicit(_TestUtil.nextInt(r, 10, 50));
+ tmp.setMaxMergeAtOnce(TestUtil.nextInt(r, 10, 50));
+ tmp.setMaxMergeAtOnceExplicit(TestUtil.nextInt(r, 10, 50));
}
if (rarely(r)) {
tmp.setMaxMergedSegmentMB(0.2 + r.nextDouble() * 2.0);
@@ -893,9 +893,9 @@ public abstract class LuceneTestCase ext
tmp.setFloorSegmentMB(0.2 + r.nextDouble() * 2.0);
tmp.setForceMergeDeletesPctAllowed(0.0 + r.nextDouble() * 30.0);
if (rarely(r)) {
- tmp.setSegmentsPerTier(_TestUtil.nextInt(r, 2, 20));
+ tmp.setSegmentsPerTier(TestUtil.nextInt(r, 2, 20));
} else {
- tmp.setSegmentsPerTier(_TestUtil.nextInt(r, 10, 50));
+ tmp.setSegmentsPerTier(TestUtil.nextInt(r, 10, 50));
}
configureRandom(r, tmp);
tmp.setReclaimDeletesWeight(r.nextDouble()*4);
@@ -1174,7 +1174,7 @@ public abstract class LuceneTestCase ext
final Class<? extends Directory> clazz = CommandLineUtil.loadDirectoryClass(clazzName);
// If it is a FSDirectory type, try its ctor(File)
if (FSDirectory.class.isAssignableFrom(clazz)) {
- final File dir = _TestUtil.getTempDir("index");
+ final File dir = TestUtil.getTempDir("index");
dir.mkdirs(); // ensure it's created so we 'have' it.
return newFSDirectoryImpl(clazz.asSubclass(FSDirectory.class), dir);
}
@@ -1270,7 +1270,7 @@ public abstract class LuceneTestCase ext
} else if (oldContext.mergeInfo != null) {
// Always return at least the estimatedMergeBytes of
// the incoming IOContext:
- return new IOContext(new MergeInfo(randomNumDocs, Math.max(oldContext.mergeInfo.estimatedMergeBytes, size), random.nextBoolean(), _TestUtil.nextInt(random, 1, 100)));
+ return new IOContext(new MergeInfo(randomNumDocs, Math.max(oldContext.mergeInfo.estimatedMergeBytes, size), random.nextBoolean(), TestUtil.nextInt(random, 1, 100)));
} else {
// Make a totally random IOContext:
final IOContext context;
@@ -1326,7 +1326,7 @@ public abstract class LuceneTestCase ext
// TODO: not useful to check DirectoryReader (redundant with checkindex)
// but maybe sometimes run this on the other crazy readers maybeWrapReader creates?
try {
- _TestUtil.checkReader(r);
+ TestUtil.checkReader(r);
} catch (IOException e) {
throw new AssertionError(e);
}
@@ -1340,7 +1340,7 @@ public abstract class LuceneTestCase ext
if (random.nextBoolean()) {
ex = null;
} else {
- threads = _TestUtil.nextInt(random, 1, 8);
+ threads = TestUtil.nextInt(random, 1, 8);
ex = new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
new NamedThreadFactory("LuceneTestCase"));
@@ -1354,7 +1354,7 @@ public abstract class LuceneTestCase ext
r.addReaderClosedListener(new ReaderClosedListener() {
@Override
public void onClose(IndexReader reader) {
- _TestUtil.shutdownExecutorService(ex);
+ TestUtil.shutdownExecutorService(ex);
}
});
}
@@ -1786,7 +1786,7 @@ public abstract class LuceneTestCase ext
tests.add(new BytesRef(new byte[] {(byte) 0xFF, (byte) 0xFF})); // past the last term
break;
case 2:
- tests.add(new BytesRef(_TestUtil.randomSimpleString(random()))); // random term
+ tests.add(new BytesRef(TestUtil.randomSimpleString(random()))); // random term
break;
default:
throw new AssertionError();
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/automaton/AutomatonTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/automaton/AutomatonTestUtil.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/automaton/AutomatonTestUtil.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/automaton/AutomatonTestUtil.java Wed Feb 19 13:42:17 2014
@@ -28,8 +28,8 @@ import java.util.Random;
import java.util.Set;
import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.UnicodeUtil;
-import org.apache.lucene.util._TestUtil;
/**
* Utilities for testing automata.
@@ -65,14 +65,14 @@ public class AutomatonTestUtil {
if (0 == t && i < end - 1) {
// Make a surrogate pair
// High surrogate
- buffer[i++] = (char) _TestUtil.nextInt(r, 0xd800, 0xdbff);
+ buffer[i++] = (char) TestUtil.nextInt(r, 0xd800, 0xdbff);
// Low surrogate
- buffer[i] = (char) _TestUtil.nextInt(r, 0xdc00, 0xdfff);
+ buffer[i] = (char) TestUtil.nextInt(r, 0xdc00, 0xdfff);
}
else if (t <= 1) buffer[i] = (char) r.nextInt(0x80);
- else if (2 == t) buffer[i] = (char) _TestUtil.nextInt(r, 0x80, 0x800);
- else if (3 == t) buffer[i] = (char) _TestUtil.nextInt(r, 0x800, 0xd7ff);
- else if (4 == t) buffer[i] = (char) _TestUtil.nextInt(r, 0xe000, 0xffff);
+ else if (2 == t) buffer[i] = (char) TestUtil.nextInt(r, 0x80, 0x800);
+ else if (3 == t) buffer[i] = (char) TestUtil.nextInt(r, 0x800, 0xd7ff);
+ else if (4 == t) buffer[i] = (char) TestUtil.nextInt(r, 0xe000, 0xffff);
else if (5 == t) buffer[i] = '.';
else if (6 == t) buffer[i] = '?';
else if (7 == t) buffer[i] = '*';
Modified: lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java (original)
+++ lucene/dev/branches/branch_4x/lucene/test-framework/src/java/org/apache/lucene/util/fst/FSTTester.java Wed Feb 19 13:42:17 2014
@@ -38,8 +38,8 @@ import org.apache.lucene.store.IndexOutp
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IntsRef;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.UnicodeUtil;
-import org.apache.lucene.util._TestUtil;
import org.apache.lucene.util.packed.PackedInts;
import static org.junit.Assert.assertEquals;
@@ -97,7 +97,7 @@ public class FSTTester<T> {
static String getRandomString(Random random) {
final String term;
if (random.nextBoolean()) {
- term = _TestUtil.randomRealisticUnicodeString(random);
+ term = TestUtil.randomRealisticUnicodeString(random);
} else {
// we want to mix in limited-alphabet symbols so
// we get more sharing of the nodes given how few
@@ -115,7 +115,7 @@ public class FSTTester<T> {
}
final char[] buffer = new char[end];
for (int i = 0; i < end; i++) {
- buffer[i] = (char) _TestUtil.nextInt(r, 97, 102);
+ buffer[i] = (char) TestUtil.nextInt(r, 97, 102);
}
return new String(buffer, 0, end);
}
@@ -188,10 +188,10 @@ public class FSTTester<T> {
if (testPruning) {
// simple pruning
- doTest(_TestUtil.nextInt(random, 1, 1+pairs.size()), 0, true);
+ doTest(TestUtil.nextInt(random, 1, 1 + pairs.size()), 0, true);
// leafy pruning
- doTest(0, _TestUtil.nextInt(random, 1, 1+pairs.size()), true);
+ doTest(0, TestUtil.nextInt(random, 1, 1 + pairs.size()), true);
}
}
@@ -285,7 +285,7 @@ public class FSTTester<T> {
prune1, prune2,
prune1==0 && prune2==0,
allowRandomSuffixSharing ? random.nextBoolean() : true,
- allowRandomSuffixSharing ? _TestUtil.nextInt(random, 1, 10) : Integer.MAX_VALUE,
+ allowRandomSuffixSharing ? TestUtil.nextInt(random, 1, 10) : Integer.MAX_VALUE,
outputs,
null,
willRewrite,
@@ -434,7 +434,7 @@ public class FSTTester<T> {
final int num = LuceneTestCase.atLeast(random, 100);
for(int iter=0;iter<num;iter++) {
- Long v = _TestUtil.nextLong(random, minLong, maxLong);
+ Long v = TestUtil.nextLong(random, minLong, maxLong);
IntsRef input = Util.getByOutput(fstLong, v);
assertTrue(validOutputs.contains(v) || input == null);
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java Wed Feb 19 13:42:17 2014
@@ -17,7 +17,8 @@
package org.apache.solr;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
+import org.apache.lucene.util.TestUtil;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrInputDocument;
@@ -85,20 +86,20 @@ public class TestHighlightDedupGrouping
handle.put("timestamp", SKIPVAL);
handle.put("grouped", UNORDERED); // distrib grouping doesn't guarantee order of top level group commands
- int numDocs = _TestUtil.nextInt(random(), 100, 1000);
- int numGroups = _TestUtil.nextInt(random(), 1, numDocs / 50);
+ int numDocs = TestUtil.nextInt(random(), 100, 1000);
+ int numGroups = TestUtil.nextInt(random(), 1, numDocs / 50);
int[] docsInGroup = new int[numGroups + 1];
- int percentDuplicates = _TestUtil.nextInt(random(), 1, 25);
+ int percentDuplicates = TestUtil.nextInt(random(), 1, 25);
for (int docid = 0 ; docid < numDocs ; ++docid) {
- int group = _TestUtil.nextInt(random(), 1, numGroups);
+ int group = TestUtil.nextInt(random(), 1, numGroups);
++docsInGroup[group];
- boolean makeDuplicate = 0 == _TestUtil.nextInt(random(), 0, numDocs / percentDuplicates);
+ boolean makeDuplicate = 0 == TestUtil.nextInt(random(), 0, numDocs / percentDuplicates);
if (makeDuplicate) {
for (int shard = 0 ; shard < shardCount ; ++shard) {
addDoc(docid, group, shard);
}
} else {
- int shard = _TestUtil.nextInt(random(), 0, shardCount - 1);
+ int shard = TestUtil.nextInt(random(), 0, shardCount - 1);
addDoc(docid, group, shard);
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomDVFaceting.java Wed Feb 19 13:42:17 2014
@@ -24,7 +24,7 @@ import java.util.Map;
import java.util.Random;
import org.apache.lucene.search.FieldCache;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.apache.solr.common.params.ModifiableSolrParams;
@@ -202,7 +202,7 @@ public class TestRandomDVFaceting extend
if ((ftype.vals instanceof SVal) && rand.nextInt(100) < 20) {
// validate = false;
String prefix = ftype.createValue().toString();
- if (rand.nextInt(100) < 5) prefix = _TestUtil.randomUnicodeString(rand);
+ if (rand.nextInt(100) < 5) prefix = TestUtil.randomUnicodeString(rand);
else if (rand.nextInt(100) < 10) prefix = Character.toString((char)rand.nextInt(256));
else if (prefix.length() > 0) prefix = prefix.substring(0, rand.nextInt(prefix.length()));
params.add("facet.prefix", prefix);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomFaceting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomFaceting.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomFaceting.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/TestRandomFaceting.java Wed Feb 19 13:42:17 2014
@@ -18,7 +18,7 @@
package org.apache.solr;
import org.apache.lucene.search.FieldCache;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.request.SolrQueryRequest;
@@ -185,7 +185,7 @@ public class TestRandomFaceting extends
if ((ftype.vals instanceof SVal) && rand.nextInt(100) < 20) {
// validate = false;
String prefix = ftype.createValue().toString();
- if (rand.nextInt(100) < 5) prefix = _TestUtil.randomUnicodeString(rand);
+ if (rand.nextInt(100) < 5) prefix = TestUtil.randomUnicodeString(rand);
else if (rand.nextInt(100) < 10) prefix = Character.toString((char)rand.nextInt(256));
else if (prefix.length() > 0) prefix = prefix.substring(0, rand.nextInt(prefix.length()));
params.add("facet.prefix", prefix);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java?rev=1569739&r1=1569738&r2=1569739&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/analysis/LegacyHTMLStripCharFilterTest.java Wed Feb 19 13:42:17 2014
@@ -30,7 +30,7 @@ import org.apache.lucene.analysis.Analyz
import org.apache.lucene.analysis.BaseTokenStreamTestCase;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.analysis.Tokenizer;
-import org.apache.lucene.util._TestUtil;
+import org.apache.lucene.util.TestUtil;
import org.junit.Ignore;
public class LegacyHTMLStripCharFilterTest extends BaseTokenStreamTestCase {
@@ -277,7 +277,7 @@ public class LegacyHTMLStripCharFilterTe
public void testRandomBrokenHTML() throws Exception {
int maxNumElements = 10000;
- String text = _TestUtil.randomHtmlishString(random(), maxNumElements);
+ String text = TestUtil.randomHtmlishString(random(), maxNumElements);
Reader reader
= new LegacyHTMLStripCharFilter(new StringReader(text));
while (reader.read() != -1);
@@ -289,18 +289,18 @@ public class LegacyHTMLStripCharFilterTe
int maxNumWords = 10000;
int minWordLength = 3;
int maxWordLength = 20;
- int numWords = _TestUtil.nextInt(random(), minNumWords, maxNumWords);
- switch (_TestUtil.nextInt(random(), 0, 4)) {
+ int numWords = TestUtil.nextInt(random(), minNumWords, maxNumWords);
+ switch (TestUtil.nextInt(random(), 0, 4)) {
case 0: {
for (int wordNum = 0 ; wordNum < numWords ; ++wordNum) {
- text.append(_TestUtil.randomUnicodeString(random(), maxWordLength));
+ text.append(TestUtil.randomUnicodeString(random(), maxWordLength));
text.append(' ');
}
break;
}
case 1: {
for (int wordNum = 0 ; wordNum < numWords ; ++wordNum) {
- text.append(_TestUtil.randomRealisticUnicodeString
+ text.append(TestUtil.randomRealisticUnicodeString
(random(), minWordLength, maxWordLength));
text.append(' ');
}
@@ -308,7 +308,7 @@ public class LegacyHTMLStripCharFilterTe
}
default: { // ASCII 50% of the time
for (int wordNum = 0 ; wordNum < numWords ; ++wordNum) {
- text.append(_TestUtil.randomSimpleString(random()));
+ text.append(TestUtil.randomSimpleString(random()));
text.append(' ');
}
}