public class _TestUtil
extends java.lang.Object
Constructor and Description |
---|
_TestUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
anyFilesExceptWriteLock(Directory dir) |
static java.lang.String |
arrayToString(int[] array)
Deprecated.
-- in 3.0 we can use Arrays.toString
instead
|
static java.lang.String |
arrayToString(java.lang.Object[] array)
Deprecated.
-- in 3.0 we can use Arrays.toString
instead
|
static <T> void |
assertAttributeReflection(AttributeImpl att,
java.util.Map<java.lang.String,T> reflectedValues)
Checks some basic behaviour of an AttributeImpl
|
static void |
assertEquals(TopDocs expected,
TopDocs actual) |
static java.lang.CharSequence |
bytesToCharSequence(BytesRef ref,
java.util.Random random) |
static CheckIndex.Status |
checkIndex(Directory dir)
This runs the CheckIndex tool on the index in.
|
static Document |
cloneDocument(Document doc1) |
static java.io.File |
createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File directory)
insecure, fast version of File.createTempFile
uses Random instead of SecureRandom.
|
static java.io.File |
getTempDir(java.lang.String desc)
Returns temp dir, based on String arg in its name;
does not create the directory.
|
static void |
keepFullyDeletedSegments(IndexWriter w) |
static int |
nextInt(java.util.Random r,
int start,
int end)
start and end are BOTH inclusive
|
static java.lang.String |
randomFixedByteLengthUnicodeString(java.util.Random r,
int length)
Returns random string, with a given UTF-8 byte length
|
static void |
randomFixedLengthUnicodeString(java.util.Random random,
char[] chars,
int offset,
int length)
Fills provided char[] with valid random unicode code
unit sequence.
|
static java.lang.String |
randomHtmlishString(java.util.Random random,
int numElements) |
static java.lang.String |
randomlyRecaseCodePoints(java.util.Random random,
java.lang.String str)
Randomly upcases, downcases, or leaves intact each code point in the given string
|
static java.lang.String |
randomRealisticUnicodeString(java.util.Random r)
Returns random string of length between 0-20 codepoints, all codepoints within the same unicode block.
|
static java.lang.String |
randomRealisticUnicodeString(java.util.Random r,
int maxLength)
Returns random string of length up to maxLength codepoints , all codepoints within the same unicode block.
|
static java.lang.String |
randomRealisticUnicodeString(java.util.Random r,
int minLength,
int maxLength)
Returns random string of length between min and max codepoints, all codepoints within the same unicode block.
|
static java.lang.String |
randomRegexpishString(java.util.Random r)
Returns a String thats "regexpish" (contains lots of operators typically found in regular expressions)
If you call this enough times, you might get a valid regex!
|
static java.lang.String |
randomRegexpishString(java.util.Random r,
int maxLength)
Returns a String thats "regexpish" (contains lots of operators typically found in regular expressions)
If you call this enough times, you might get a valid regex!
|
static java.lang.String |
randomSimpleString(java.util.Random r) |
static java.lang.String |
randomSimpleString(java.util.Random r,
int maxLength) |
static java.lang.String |
randomUnicodeString(java.util.Random r)
Returns random string, including full unicode range.
|
static java.lang.String |
randomUnicodeString(java.util.Random r,
int maxLength)
Returns a random string up to a certain length.
|
static void |
reduceOpenFiles(IndexWriter w)
just tries to configure things to keep the open file
count lowish
|
static void |
rmDir(java.io.File dir)
Deletes a directory and everything underneath it.
|
static void |
setUseCompoundFile(MergePolicy mp,
boolean v) |
static java.lang.CharSequence |
stringToCharSequence(java.lang.String string,
java.util.Random random) |
static void |
syncConcurrentMerges(IndexWriter writer) |
static void |
syncConcurrentMerges(MergeScheduler ms) |
static void |
unzip(java.io.File zipName,
java.io.File destDir)
Convenience method: Unzip zipName + ".zip" under destDir, removing destDir first
|
public static java.io.File getTempDir(java.lang.String desc)
public static void rmDir(java.io.File dir) throws java.io.IOException
java.io.IOException
public static void unzip(java.io.File zipName, java.io.File destDir) throws java.io.IOException
java.io.IOException
public static void syncConcurrentMerges(IndexWriter writer)
public static void syncConcurrentMerges(MergeScheduler ms)
public static CheckIndex.Status checkIndex(Directory dir) throws java.io.IOException
java.io.IOException
@Deprecated public static java.lang.String arrayToString(int[] array)
public static int nextInt(java.util.Random r, int start, int end)
public static void setUseCompoundFile(MergePolicy mp, boolean v)
@Deprecated public static java.lang.String arrayToString(java.lang.Object[] array)
public static java.lang.String randomSimpleString(java.util.Random r, int maxLength)
public static java.lang.String randomSimpleString(java.util.Random r)
public static java.lang.String randomUnicodeString(java.util.Random r)
public static java.lang.String randomUnicodeString(java.util.Random r, int maxLength)
public static void randomFixedLengthUnicodeString(java.util.Random random, char[] chars, int offset, int length)
public static java.lang.String randomRegexpishString(java.util.Random r)
public static java.lang.String randomRegexpishString(java.util.Random r, int maxLength)
public static java.lang.String randomHtmlishString(java.util.Random random, int numElements)
public static java.lang.String randomlyRecaseCodePoints(java.util.Random random, java.lang.String str)
public static java.lang.String randomRealisticUnicodeString(java.util.Random r)
public static java.lang.String randomRealisticUnicodeString(java.util.Random r, int maxLength)
public static java.lang.String randomRealisticUnicodeString(java.util.Random r, int minLength, int maxLength)
public static java.lang.String randomFixedByteLengthUnicodeString(java.util.Random r, int length)
public static boolean anyFilesExceptWriteLock(Directory dir) throws java.io.IOException
java.io.IOException
public static void reduceOpenFiles(IndexWriter w)
public static <T> void assertAttributeReflection(AttributeImpl att, java.util.Map<java.lang.String,T> reflectedValues)
reflectedValues
- contains a map with "AttributeClass#key" as valuespublic static void keepFullyDeletedSegments(IndexWriter w)
public static java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix, java.io.File directory) throws java.io.IOException
java.io.IOException
public static java.lang.CharSequence stringToCharSequence(java.lang.String string, java.util.Random random)
public static java.lang.CharSequence bytesToCharSequence(BytesRef ref, java.util.Random random)