C# Class Lucene.Net.Util.LuceneTestCase

Inheritance: Assert
显示文件 Open project: apache/lucenenet Class Usage Examples

Public Properties

Property Type Description
DEFAULT_LINE_DOCS_FILE string
INFOSTREAM bool
JENKINS_LARGE_LINE_DOCS_FILE string
LEAVE_TEMPORARY bool
RANDOM_MULTIPLIER int
SuiteFailureMarker bool
TEMP_DIR System.IO.FileInfo
TEST_AWAITSFIX bool
TEST_CODEC string
TEST_DIRECTORY string
TEST_DOCVALUESFORMAT string
TEST_LINE_DOCS_FILE string
TEST_NIGHTLY bool
TEST_POSTINGSFORMAT string
TEST_SLOW bool
TEST_THROTTLING MockDirectoryWrapper.Throttling_e
TEST_VERSION_CURRENT LuceneVersion
TEST_WEEKLY bool
VERBOSE bool

Protected Properties

Property Type Description
DoesntSupportOffsets HashSet

Private Properties

Property Type Description
AssertTermsSeekingEquals void
CleanupTemporaryFiles void
ConfigureRandom void
GetDVFields ISet
GetFullMethodName string
NewDirectoryImpl Directory
NewFSDirectory BaseDirectoryWrapper
NewFSDirectoryImpl Directory
RegisterToRemoveAfterSuite void
SetUp void
TearDown void
WrapDirectory BaseDirectoryWrapper

Public Methods

Method Description
AsSet ( ) : ISet

Return args as a Set instance. The order of elements is not preserved in iterators.

AssertDeletedDocsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
AssertDocValuesEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void

checks that docvalues across all fields are equivalent

AssertDocValuesEquals ( string info, int num, Lucene.Net.Index.NumericDocValues leftDocValues, Lucene.Net.Index.NumericDocValues rightDocValues ) : void
AssertDocsAndPositionsEnumEquals ( string info, Lucene.Net.Index.DocsAndPositionsEnum leftDocs, Lucene.Net.Index.DocsAndPositionsEnum rightDocs ) : void

checks docs + freqs + positions + payloads, sequentially

AssertDocsEnumEquals ( string info, Lucene.Net.Index.DocsEnum leftDocs, Lucene.Net.Index.DocsEnum rightDocs, bool hasFreqs ) : void

checks docs + freqs, sequentially

AssertDocsSkippingEquals ( string info, IndexReader leftReader, int docFreq, Lucene.Net.Index.DocsEnum leftDocs, Lucene.Net.Index.DocsEnum rightDocs, bool hasFreqs ) : void

checks advancing docs

AssertFieldInfosEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
AssertFieldStatisticsEquals ( string info, Fields leftFields, Fields rightFields ) : void

checks that top-level statistics on Fields are the same

AssertFieldsEquals ( string info, IndexReader leftReader, Fields leftFields, Fields rightFields, bool deep ) : void

Fields api equivalency

AssertNormsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void

checks that norms are the same across all fields

AssertPositionsSkippingEquals ( string info, IndexReader leftReader, int docFreq, Lucene.Net.Index.DocsAndPositionsEnum leftDocs, Lucene.Net.Index.DocsAndPositionsEnum rightDocs ) : void

checks advancing docs + positions

AssertReaderEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
AssertReaderStatisticsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void

checks that reader-level statistics are the same

AssertStoredFieldEquals ( string info, IndexableField leftField, IndexableField rightField ) : void

checks that two stored fields are equivalent

AssertStoredFieldsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void

checks that stored fields of all documents are the same

AssertTermStatsEquals ( string info, Lucene.Net.Index.TermsEnum leftTermsEnum, Lucene.Net.Index.TermsEnum rightTermsEnum ) : void

checks term-level statistics

AssertTermVectorsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void

checks that term vectors across all fields are equivalent

AssertTermsEnumEquals ( string info, IndexReader leftReader, Lucene.Net.Index.TermsEnum leftTermsEnum, Lucene.Net.Index.TermsEnum rightTermsEnum, bool deep ) : void

checks the terms enum sequentially if deep is false, it does a 'shallow' test that doesnt go down to the docsenums

AssertTermsEquals ( string info, IndexReader leftReader, Lucene.Net.Index.Terms leftTerms, Lucene.Net.Index.Terms rightTerms, bool deep ) : void

Terms api equivalency

AssertTermsStatisticsEquals ( string info, Lucene.Net.Index.Terms leftTerms, Lucene.Net.Index.Terms rightTerms ) : void

checks collection-level statistics on Terms

AssumeFalse ( string msg, bool condition ) : void
AssumeNoException ( string msg, Exception e ) : void
AssumeTrue ( string msg, bool condition ) : void
AtLeast ( Random random, int i ) : int

Returns a number of at least i

The actual number returned will be influenced by whether #TEST_NIGHTLY is active and #RANDOM_MULTIPLIER, but also with some random fudge.

AtLeast ( int i ) : int
CreateTempDir ( ) : DirectoryInfo

Creates an empty, temporary folder (when the name of the folder is of no importance).

CreateTempDir ( string prefix ) : DirectoryInfo

Creates an empty, temporary folder with the given name prefix under the test class's #getBaseTempDirForTestClass().

The folder will be automatically removed after the test class completes successfully. The test should close any file handles that would prevent the folder from being removed.

CreateTempFile ( ) : FileInfo

Creates an empty temporary file.

CreateTempFile ( string prefix, string suffix ) : FileInfo

Creates an empty file with the given prefix and suffix under the test class's #getBaseTempDirForTestClass().

The file will be automatically removed after the test class completes successfully. The test should close any file handles that would prevent the folder from being removed.

DefaultCodecSupportsDocValues ( ) : bool

Return a random Locale from the available locales on the system.

Return a random TimeZone from the available timezones on the system

return a Locale object equivalent to its programmatic name

DefaultCodecSupportsDocsWithField ( ) : bool

Returns true if the codec "supports" docsWithField (other codecs return MatchAllBits, because you couldnt write missing values before)

DefaultCodecSupportsFieldUpdates ( ) : bool

Returns true if the codec "supports" field updates.

DefaultCodecSupportsMissingDocValues ( ) : bool

Returns true if the default codec supports single valued docvalues with missing values

DefaultCodecSupportsSortedSet ( ) : bool

Returns true if the default codec supports SORTED_SET docvalues

DumpArray ( string label, Object objs, TextWriter stream ) : void

Convenience method for logging an array. Wraps the array in an iterator and delegates

DumpIterator ( string label, System iter, TextWriter stream ) : void

Convenience method for logging an iterator.

GetOnlySegmentReader ( DirectoryReader reader ) : Lucene.Net.Index.SegmentReader

Some tests expect the directory to contain a single segment, and want to do tests on that segment's reader. this is an utility method to help them.

LuceneTestCase ( ) : System.Collections.Concurrent
MaybeWrapReader ( IndexReader r ) : IndexReader

Sometimes wrap the IndexReader as slow, parallel or filter reader (or combinations of that)

NewAlcoholicMergePolicy ( ) : Lucene.Net.Index.AlcoholicMergePolicy
NewAlcoholicMergePolicy ( Random r, TimeZone tz ) : AlcoholicMergePolicy
NewDirectory ( ) : BaseDirectoryWrapper

Returns a new Directory instance. Use this when the test does not care about the specific Directory implementation (most tests).

The Directory is wrapped with BaseDirectoryWrapper. this means usually it will be picky, such as ensuring that you properly close it and all open files in your test. It will emulate some features of Windows, such as not allowing open files to be overwritten.

NewDirectory ( Directory d ) : BaseDirectoryWrapper

Returns a new Directory instance, with contents copied from the provided directory. See #newDirectory() for more information.

NewDirectory ( Random r ) : BaseDirectoryWrapper

Returns a new Directory instance, using the specified random. See #newDirectory() for more information.

NewDirectory ( Random r, Directory d ) : BaseDirectoryWrapper

Returns a new Directory instance, using the specified random with contents copied from the provided directory. See #newDirectory() for more information.

NewFSDirectory ( DirectoryInfo d ) : BaseDirectoryWrapper

Returns a new FSDirectory instance over the given file, which must be a folder.

NewFSDirectory ( DirectoryInfo d, LockFactory lf ) : BaseDirectoryWrapper

Returns a new FSDirectory instance over the given file, which must be a folder.

NewField ( Random random, string name, string value, FieldType type ) : Field

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.

NewField ( string name, string value, FieldType type ) : Field

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.

NewIOContext ( Random random ) : IOContext

TODO: javadoc

NewIOContext ( Random random, IOContext oldContext ) : IOContext

TODO: javadoc

NewIndexWriterConfig ( LuceneVersion v, Analyzer a ) : IndexWriterConfig

create a new index writer config with random defaults LUCENENET specific Non-static so that we do not depend on any hidden static dependencies

NewIndexWriterConfig ( Random r, LuceneVersion v, Analyzer a ) : IndexWriterConfig

LUCENENET specific Non-static so that we do not depend on any hidden static dependencies

NewIndexWriterConfig ( Random r, LuceneVersion v, Analyzer a, Similarity similarity, TimeZone timezone ) : IndexWriterConfig

create a new index writer config with random defaults using the specified random LUCENENET specific This is the only static ctor for IndexWriterConfig because it removes the dependency on ClassEnvRule by using parameters Similarity and TimeZone.

NewLogMergePolicy ( ) : LogMergePolicy
NewLogMergePolicy ( Random r ) : LogMergePolicy
NewLogMergePolicy ( bool useCFS ) : MergePolicy
NewLogMergePolicy ( bool useCFS, int mergeFactor ) : MergePolicy
NewLogMergePolicy ( int mergeFactor ) : MergePolicy
NewMergePolicy ( Random r, TimeZone timezone ) : MergePolicy
NewMergePolicy ( TimeZone timezone ) : MergePolicy
NewMockDirectory ( ) : MockDirectoryWrapper
NewMockDirectory ( Random r ) : MockDirectoryWrapper
NewMockFSDirectory ( DirectoryInfo d ) : MockDirectoryWrapper
NewSearcher ( IndexReader r ) : IndexSearcher

Create a new searcher over the reader. this searcher might randomly use threads. LUCENENET specific Is non-static because ClassEnvRule is now non-static.

NewSearcher ( IndexReader r, Similarity similarity ) : IndexSearcher
NewSearcher ( IndexReader r, bool maybeWrap ) : IndexSearcher

Create a new searcher over the reader. This searcher might randomly use threads.

NewSearcher ( IndexReader r, bool maybeWrap, Similarity similarity ) : IndexSearcher

Create a new searcher over the reader. this searcher might randomly use threads.

NewSearcher ( IndexReader r, bool maybeWrap, bool wrapWithAssertions ) : IndexSearcher
NewSearcher ( IndexReader r, bool maybeWrap, bool wrapWithAssertions, Similarity similarity ) : IndexSearcher

Create a new searcher over the reader. this searcher might randomly use threads. if maybeWrap is true, this searcher might wrap the reader with one that returns null for getSequentialSubReaders. If wrapWithAssertions is true, this searcher might be an AssertingIndexSearcher instance.

NewStringField ( Random random, string name, string value, Field stored ) : Field

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.

NewStringField ( string name, string value, Field stored ) : Field

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.

NewTextField ( Random random, string name, string value, Field stored ) : Field

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is also non-static to reduce hidden dependencies on this variable.

NewTextField ( string name, string value, Field stored ) : Field

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.

NewTieredMergePolicy ( ) : TieredMergePolicy
NewTieredMergePolicy ( Random r ) : TieredMergePolicy
Random ( ) : Random

Access to the current RandomizedContext's Random instance. It is safe to use this method from multiple threads, etc., but it should be called while within a runner's scope (so no static initializers). The returned Random instance will be different when this method is called inside a BeforeClass hook (static suite scope) and within Before/ After hooks or test methods.

The returned instance must not be shared with other threads or cross a single scope's boundary. For example, a Random acquired within a test method shouldn't be reused for another test case.

There is an overhead connected with getting the Random for a particular context and thread. It is better to cache the Random locally if tight loops with multiple invocations are present or create a derivative local Random for millions of calls like this:

 Random random = new Random(random().nextLong()); // tight loop with many invocations. 

Rarely ( ) : bool
Rarely ( Random random ) : bool

Returns true if something should happen rarely,

The actual number returned will be influenced by whether #TEST_NIGHTLY is active and #RANDOM_MULTIPLIER.

SlowFileExists ( Directory dir, string fileName ) : bool

Returns true if the file exists (can be opened), false if it cannot be opened, and (unlike Java's File.exists) if there's some unexpected error.

TestThread ( ) : bool

Returns true if and only if the calling thread is the primary thread executing the test case.

Usually ( ) : bool
Usually ( Random random ) : bool

Protected Methods

Method Description
AssertSaneFieldCaches ( string msg ) : void

Asserts that FieldCacheSanityChecker does not detect any problems with FieldCache.DEFAULT.

If any problems are found, they are logged to System.err (allong with the msg) when the Assertion is thrown.

this method is called by tearDown after every test method, however IndexReaders scoped inside test methods may be garbage collected prior to this method being called, causing errors to be overlooked. Tests are encouraged to keep their IndexReaders scoped at the class level, or to explicitly call this method directly in the same scope as the IndexReader.

GetDataFile ( string name ) : Stream

Gets a resource from the classpath as File. this method should only be used, if a real file is needed. To get a stream, code should prefer Class#getResourceAsStream using {@code this.getClass()}.

randon ( ) : Random

Private Methods

Method Description
AssertTermsSeekingEquals ( string info, Lucene.Net.Index.Terms leftTerms, Lucene.Net.Index.Terms rightTerms ) : void
CleanupTemporaryFiles ( ) : void
ConfigureRandom ( Random r, MergePolicy mergePolicy ) : void
GetDVFields ( IndexReader reader ) : ISet
GetFullMethodName ( ) : string
NewDirectoryImpl ( Random random, string clazzName ) : Directory
NewFSDirectory ( DirectoryInfo d, LockFactory lf, bool bare ) : BaseDirectoryWrapper
NewFSDirectoryImpl ( Type clazz, DirectoryInfo file ) : Directory
RegisterToRemoveAfterSuite ( FileSystemInfo f ) : void

Register temporary folder for removal after the suite completes.

SetUp ( ) : void
TearDown ( ) : void
WrapDirectory ( Random random, Directory directory, bool bare ) : BaseDirectoryWrapper

Method Details

AsSet() public static method

Return args as a Set instance. The order of elements is not preserved in iterators.
public static AsSet ( ) : ISet
return ISet

AssertDeletedDocsEquals() public method

public AssertDeletedDocsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
info string
leftReader Lucene.Net.Index.IndexReader
rightReader Lucene.Net.Index.IndexReader
return void

AssertDocValuesEquals() public method

checks that docvalues across all fields are equivalent
public AssertDocValuesEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
info string
leftReader Lucene.Net.Index.IndexReader
rightReader Lucene.Net.Index.IndexReader
return void

AssertDocValuesEquals() public method

public AssertDocValuesEquals ( string info, int num, Lucene.Net.Index.NumericDocValues leftDocValues, Lucene.Net.Index.NumericDocValues rightDocValues ) : void
info string
num int
leftDocValues Lucene.Net.Index.NumericDocValues
rightDocValues Lucene.Net.Index.NumericDocValues
return void

AssertDocsAndPositionsEnumEquals() public method

checks docs + freqs + positions + payloads, sequentially
public AssertDocsAndPositionsEnumEquals ( string info, Lucene.Net.Index.DocsAndPositionsEnum leftDocs, Lucene.Net.Index.DocsAndPositionsEnum rightDocs ) : void
info string
leftDocs Lucene.Net.Index.DocsAndPositionsEnum
rightDocs Lucene.Net.Index.DocsAndPositionsEnum
return void

AssertDocsEnumEquals() public method

checks docs + freqs, sequentially
public AssertDocsEnumEquals ( string info, Lucene.Net.Index.DocsEnum leftDocs, Lucene.Net.Index.DocsEnum rightDocs, bool hasFreqs ) : void
info string
leftDocs Lucene.Net.Index.DocsEnum
rightDocs Lucene.Net.Index.DocsEnum
hasFreqs bool
return void

AssertDocsSkippingEquals() public method

checks advancing docs
public AssertDocsSkippingEquals ( string info, IndexReader leftReader, int docFreq, Lucene.Net.Index.DocsEnum leftDocs, Lucene.Net.Index.DocsEnum rightDocs, bool hasFreqs ) : void
info string
leftReader Lucene.Net.Index.IndexReader
docFreq int
leftDocs Lucene.Net.Index.DocsEnum
rightDocs Lucene.Net.Index.DocsEnum
hasFreqs bool
return void

AssertFieldInfosEquals() public method

public AssertFieldInfosEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
info string
leftReader Lucene.Net.Index.IndexReader
rightReader Lucene.Net.Index.IndexReader
return void

AssertFieldStatisticsEquals() public method

checks that top-level statistics on Fields are the same
public AssertFieldStatisticsEquals ( string info, Fields leftFields, Fields rightFields ) : void
info string
leftFields Fields
rightFields Fields
return void

AssertFieldsEquals() public method

Fields api equivalency
public AssertFieldsEquals ( string info, IndexReader leftReader, Fields leftFields, Fields rightFields, bool deep ) : void
info string
leftReader Lucene.Net.Index.IndexReader
leftFields Fields
rightFields Fields
deep bool
return void

AssertNormsEquals() public method

checks that norms are the same across all fields
public AssertNormsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
info string
leftReader Lucene.Net.Index.IndexReader
rightReader Lucene.Net.Index.IndexReader
return void

AssertPositionsSkippingEquals() public method

checks advancing docs + positions
public AssertPositionsSkippingEquals ( string info, IndexReader leftReader, int docFreq, Lucene.Net.Index.DocsAndPositionsEnum leftDocs, Lucene.Net.Index.DocsAndPositionsEnum rightDocs ) : void
info string
leftReader Lucene.Net.Index.IndexReader
docFreq int
leftDocs Lucene.Net.Index.DocsAndPositionsEnum
rightDocs Lucene.Net.Index.DocsAndPositionsEnum
return void

AssertReaderEquals() public method

public AssertReaderEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
info string
leftReader Lucene.Net.Index.IndexReader
rightReader Lucene.Net.Index.IndexReader
return void

AssertReaderStatisticsEquals() public method

checks that reader-level statistics are the same
public AssertReaderStatisticsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
info string
leftReader Lucene.Net.Index.IndexReader
rightReader Lucene.Net.Index.IndexReader
return void

AssertSaneFieldCaches() protected static method

Asserts that FieldCacheSanityChecker does not detect any problems with FieldCache.DEFAULT.

If any problems are found, they are logged to System.err (allong with the msg) when the Assertion is thrown.

this method is called by tearDown after every test method, however IndexReaders scoped inside test methods may be garbage collected prior to this method being called, causing errors to be overlooked. Tests are encouraged to keep their IndexReaders scoped at the class level, or to explicitly call this method directly in the same scope as the IndexReader.

protected static AssertSaneFieldCaches ( string msg ) : void
msg string
return void

AssertStoredFieldEquals() public method

checks that two stored fields are equivalent
public AssertStoredFieldEquals ( string info, IndexableField leftField, IndexableField rightField ) : void
info string
leftField IndexableField
rightField IndexableField
return void

AssertStoredFieldsEquals() public method

checks that stored fields of all documents are the same
public AssertStoredFieldsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
info string
leftReader Lucene.Net.Index.IndexReader
rightReader Lucene.Net.Index.IndexReader
return void

AssertTermStatsEquals() public method

checks term-level statistics
public AssertTermStatsEquals ( string info, Lucene.Net.Index.TermsEnum leftTermsEnum, Lucene.Net.Index.TermsEnum rightTermsEnum ) : void
info string
leftTermsEnum Lucene.Net.Index.TermsEnum
rightTermsEnum Lucene.Net.Index.TermsEnum
return void

AssertTermVectorsEquals() public method

checks that term vectors across all fields are equivalent
public AssertTermVectorsEquals ( string info, IndexReader leftReader, IndexReader rightReader ) : void
info string
leftReader Lucene.Net.Index.IndexReader
rightReader Lucene.Net.Index.IndexReader
return void

AssertTermsEnumEquals() public method

checks the terms enum sequentially if deep is false, it does a 'shallow' test that doesnt go down to the docsenums
public AssertTermsEnumEquals ( string info, IndexReader leftReader, Lucene.Net.Index.TermsEnum leftTermsEnum, Lucene.Net.Index.TermsEnum rightTermsEnum, bool deep ) : void
info string
leftReader Lucene.Net.Index.IndexReader
leftTermsEnum Lucene.Net.Index.TermsEnum
rightTermsEnum Lucene.Net.Index.TermsEnum
deep bool
return void

AssertTermsEquals() public method

Terms api equivalency
public AssertTermsEquals ( string info, IndexReader leftReader, Lucene.Net.Index.Terms leftTerms, Lucene.Net.Index.Terms rightTerms, bool deep ) : void
info string
leftReader Lucene.Net.Index.IndexReader
leftTerms Lucene.Net.Index.Terms
rightTerms Lucene.Net.Index.Terms
deep bool
return void

AssertTermsStatisticsEquals() public method

checks collection-level statistics on Terms
public AssertTermsStatisticsEquals ( string info, Lucene.Net.Index.Terms leftTerms, Lucene.Net.Index.Terms rightTerms ) : void
info string
leftTerms Lucene.Net.Index.Terms
rightTerms Lucene.Net.Index.Terms
return void

AssumeFalse() public static method

public static AssumeFalse ( string msg, bool condition ) : void
msg string
condition bool
return void

AssumeNoException() public static method

public static AssumeNoException ( string msg, Exception e ) : void
msg string
e System.Exception
return void

AssumeTrue() public static method

public static AssumeTrue ( string msg, bool condition ) : void
msg string
condition bool
return void

AtLeast() public static method

Returns a number of at least i

The actual number returned will be influenced by whether #TEST_NIGHTLY is active and #RANDOM_MULTIPLIER, but also with some random fudge.

public static AtLeast ( Random random, int i ) : int
random System.Random
i int
return int

AtLeast() public static method

public static AtLeast ( int i ) : int
i int
return int

CreateTempDir() public static method

Creates an empty, temporary folder (when the name of the folder is of no importance).
public static CreateTempDir ( ) : DirectoryInfo
return System.IO.DirectoryInfo

CreateTempDir() public static method

Creates an empty, temporary folder with the given name prefix under the test class's #getBaseTempDirForTestClass().

The folder will be automatically removed after the test class completes successfully. The test should close any file handles that would prevent the folder from being removed.

public static CreateTempDir ( string prefix ) : DirectoryInfo
prefix string
return System.IO.DirectoryInfo

CreateTempFile() public static method

Creates an empty temporary file.
public static CreateTempFile ( ) : FileInfo
return System.IO.FileInfo

CreateTempFile() public static method

Creates an empty file with the given prefix and suffix under the test class's #getBaseTempDirForTestClass().

The file will be automatically removed after the test class completes successfully. The test should close any file handles that would prevent the folder from being removed.

public static CreateTempFile ( string prefix, string suffix ) : FileInfo
prefix string
suffix string
return System.IO.FileInfo

DefaultCodecSupportsDocValues() public static method

Return a random Locale from the available locales on the system. Return a random TimeZone from the available timezones on the system return a Locale object equivalent to its programmatic name
public static DefaultCodecSupportsDocValues ( ) : bool
return bool

DefaultCodecSupportsDocsWithField() public static method

Returns true if the codec "supports" docsWithField (other codecs return MatchAllBits, because you couldnt write missing values before)
public static DefaultCodecSupportsDocsWithField ( ) : bool
return bool

DefaultCodecSupportsFieldUpdates() public static method

Returns true if the codec "supports" field updates.
public static DefaultCodecSupportsFieldUpdates ( ) : bool
return bool

DefaultCodecSupportsMissingDocValues() public static method

Returns true if the default codec supports single valued docvalues with missing values
public static DefaultCodecSupportsMissingDocValues ( ) : bool
return bool

DefaultCodecSupportsSortedSet() public static method

Returns true if the default codec supports SORTED_SET docvalues
public static DefaultCodecSupportsSortedSet ( ) : bool
return bool

DumpArray() public static method

Convenience method for logging an array. Wraps the array in an iterator and delegates
public static DumpArray ( string label, Object objs, TextWriter stream ) : void
label string
objs Object
stream System.IO.TextWriter
return void

DumpIterator() public static method

Convenience method for logging an iterator.
public static DumpIterator ( string label, System iter, TextWriter stream ) : void
label string String logged before/after the items in the iterator
iter System Each next() is toString()ed and logged on it's own line. If iter is null this is logged differnetly then an empty iterator.
stream System.IO.TextWriter Stream to log messages to.
return void

GetDataFile() protected method

Gets a resource from the classpath as File. this method should only be used, if a real file is needed. To get a stream, code should prefer Class#getResourceAsStream using {@code this.getClass()}.
protected GetDataFile ( string name ) : Stream
name string
return Stream

GetOnlySegmentReader() public static method

Some tests expect the directory to contain a single segment, and want to do tests on that segment's reader. this is an utility method to help them.
public static GetOnlySegmentReader ( DirectoryReader reader ) : Lucene.Net.Index.SegmentReader
reader Lucene.Net.Index.DirectoryReader
return Lucene.Net.Index.SegmentReader

LuceneTestCase() public method

public LuceneTestCase ( ) : System.Collections.Concurrent
return System.Collections.Concurrent

MaybeWrapReader() public static method

Sometimes wrap the IndexReader as slow, parallel or filter reader (or combinations of that)
public static MaybeWrapReader ( IndexReader r ) : IndexReader
r Lucene.Net.Index.IndexReader
return Lucene.Net.Index.IndexReader

NewAlcoholicMergePolicy() public method

public NewAlcoholicMergePolicy ( ) : Lucene.Net.Index.AlcoholicMergePolicy
return Lucene.Net.Index.AlcoholicMergePolicy

NewAlcoholicMergePolicy() public static method

public static NewAlcoholicMergePolicy ( Random r, TimeZone tz ) : AlcoholicMergePolicy
r Random
tz TimeZone
return AlcoholicMergePolicy

NewDirectory() public static method

Returns a new Directory instance. Use this when the test does not care about the specific Directory implementation (most tests).

The Directory is wrapped with BaseDirectoryWrapper. this means usually it will be picky, such as ensuring that you properly close it and all open files in your test. It will emulate some features of Windows, such as not allowing open files to be overwritten.

public static NewDirectory ( ) : BaseDirectoryWrapper
return BaseDirectoryWrapper

NewDirectory() public static method

Returns a new Directory instance, with contents copied from the provided directory. See #newDirectory() for more information.
public static NewDirectory ( Directory d ) : BaseDirectoryWrapper
d Directory
return BaseDirectoryWrapper

NewDirectory() public static method

Returns a new Directory instance, using the specified random. See #newDirectory() for more information.
public static NewDirectory ( Random r ) : BaseDirectoryWrapper
r Random
return BaseDirectoryWrapper

NewDirectory() public static method

Returns a new Directory instance, using the specified random with contents copied from the provided directory. See #newDirectory() for more information.
public static NewDirectory ( Random r, Directory d ) : BaseDirectoryWrapper
r Random
d Directory
return BaseDirectoryWrapper

NewFSDirectory() public static method

Returns a new FSDirectory instance over the given file, which must be a folder.
public static NewFSDirectory ( DirectoryInfo d ) : BaseDirectoryWrapper
d DirectoryInfo
return BaseDirectoryWrapper

NewFSDirectory() public static method

Returns a new FSDirectory instance over the given file, which must be a folder.
public static NewFSDirectory ( DirectoryInfo d, LockFactory lf ) : BaseDirectoryWrapper
d DirectoryInfo
lf LockFactory
return BaseDirectoryWrapper

NewField() public method

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.
public NewField ( Random random, string name, string value, FieldType type ) : Field
random Random
name string
value string
type FieldType
return Field

NewField() public method

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.
public NewField ( string name, string value, FieldType type ) : Field
name string
value string
type FieldType
return Field

NewIOContext() public static method

TODO: javadoc
public static NewIOContext ( Random random ) : IOContext
random Random
return IOContext

NewIOContext() public static method

TODO: javadoc
public static NewIOContext ( Random random, IOContext oldContext ) : IOContext
random Random
oldContext IOContext
return IOContext

NewIndexWriterConfig() public method

create a new index writer config with random defaults LUCENENET specific Non-static so that we do not depend on any hidden static dependencies
public NewIndexWriterConfig ( LuceneVersion v, Analyzer a ) : IndexWriterConfig
v LuceneVersion
a Analyzer
return IndexWriterConfig

NewIndexWriterConfig() public method

LUCENENET specific Non-static so that we do not depend on any hidden static dependencies
public NewIndexWriterConfig ( Random r, LuceneVersion v, Analyzer a ) : IndexWriterConfig
r Random
v LuceneVersion
a Analyzer
return IndexWriterConfig

NewIndexWriterConfig() public static method

create a new index writer config with random defaults using the specified random LUCENENET specific This is the only static ctor for IndexWriterConfig because it removes the dependency on ClassEnvRule by using parameters Similarity and TimeZone.
public static NewIndexWriterConfig ( Random r, LuceneVersion v, Analyzer a, Similarity similarity, TimeZone timezone ) : IndexWriterConfig
r Random
v LuceneVersion
a Analyzer
similarity Similarity
timezone TimeZone
return IndexWriterConfig

NewLogMergePolicy() public static method

public static NewLogMergePolicy ( ) : LogMergePolicy
return LogMergePolicy

NewLogMergePolicy() public static method

public static NewLogMergePolicy ( Random r ) : LogMergePolicy
r Random
return LogMergePolicy

NewLogMergePolicy() public static method

public static NewLogMergePolicy ( bool useCFS ) : MergePolicy
useCFS bool
return MergePolicy

NewLogMergePolicy() public static method

public static NewLogMergePolicy ( bool useCFS, int mergeFactor ) : MergePolicy
useCFS bool
mergeFactor int
return MergePolicy

NewLogMergePolicy() public static method

public static NewLogMergePolicy ( int mergeFactor ) : MergePolicy
mergeFactor int
return MergePolicy

NewMergePolicy() public static method

public static NewMergePolicy ( Random r, TimeZone timezone ) : MergePolicy
r Random
timezone TimeZone /// LUCENENET specific /// Timezone added to remove dependency on the then-static ///
return MergePolicy

NewMergePolicy() public static method

public static NewMergePolicy ( TimeZone timezone ) : MergePolicy
timezone TimeZone /// LUCENENET specific /// Timezone added to remove dependency on the then-static ///
return MergePolicy

NewMockDirectory() public static method

public static NewMockDirectory ( ) : MockDirectoryWrapper
return MockDirectoryWrapper

NewMockDirectory() public static method

public static NewMockDirectory ( Random r ) : MockDirectoryWrapper
r Random
return MockDirectoryWrapper

NewMockFSDirectory() public static method

public static NewMockFSDirectory ( DirectoryInfo d ) : MockDirectoryWrapper
d DirectoryInfo
return MockDirectoryWrapper

NewSearcher() public method

Create a new searcher over the reader. this searcher might randomly use threads. LUCENENET specific Is non-static because ClassEnvRule is now non-static.
public NewSearcher ( IndexReader r ) : IndexSearcher
r IndexReader
return IndexSearcher

NewSearcher() public static method

public static NewSearcher ( IndexReader r, Similarity similarity ) : IndexSearcher
r IndexReader
similarity Similarity /// LUCENENET specific /// Removes dependency on ///
return IndexSearcher

NewSearcher() public method

Create a new searcher over the reader. This searcher might randomly use threads.
public NewSearcher ( IndexReader r, bool maybeWrap ) : IndexSearcher
r IndexReader
maybeWrap bool
return IndexSearcher

NewSearcher() public static method

Create a new searcher over the reader. this searcher might randomly use threads.
public static NewSearcher ( IndexReader r, bool maybeWrap, Similarity similarity ) : IndexSearcher
r IndexReader
maybeWrap bool
similarity Similarity /// LUCENENET specific /// Removes dependency on ///
return IndexSearcher

NewSearcher() public method

public NewSearcher ( IndexReader r, bool maybeWrap, bool wrapWithAssertions ) : IndexSearcher
r IndexReader
maybeWrap bool
wrapWithAssertions bool
return IndexSearcher

NewSearcher() public static method

Create a new searcher over the reader. this searcher might randomly use threads. if maybeWrap is true, this searcher might wrap the reader with one that returns null for getSequentialSubReaders. If wrapWithAssertions is true, this searcher might be an AssertingIndexSearcher instance.
public static NewSearcher ( IndexReader r, bool maybeWrap, bool wrapWithAssertions, Similarity similarity ) : IndexSearcher
r IndexReader
maybeWrap bool
wrapWithAssertions bool
similarity Similarity /// LUCENENET specific /// Removes dependency on ///
return IndexSearcher

NewStringField() public method

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.
public NewStringField ( Random random, string name, string value, Field stored ) : Field
random Random
name string
value string
stored Field
return Field

NewStringField() public method

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.
public NewStringField ( string name, string value, Field stored ) : Field
name string
value string
stored Field
return Field

NewTextField() public method

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is also non-static to reduce hidden dependencies on this variable.
public NewTextField ( Random random, string name, string value, Field stored ) : Field
random Random
name string
value string
stored Field
return Field

NewTextField() public method

LUCENENET specific Is non-static because OLD_FORMAT_IMPERSONATION_IS_ACTIVE is now non-static.
public NewTextField ( string name, string value, Field stored ) : Field
name string
value string
stored Field
return Field

NewTieredMergePolicy() public static method

public static NewTieredMergePolicy ( ) : TieredMergePolicy
return TieredMergePolicy

NewTieredMergePolicy() public static method

public static NewTieredMergePolicy ( Random r ) : TieredMergePolicy
r Random
return TieredMergePolicy

Random() public static method

Access to the current RandomizedContext's Random instance. It is safe to use this method from multiple threads, etc., but it should be called while within a runner's scope (so no static initializers). The returned Random instance will be different when this method is called inside a BeforeClass hook (static suite scope) and within Before/ After hooks or test methods.

The returned instance must not be shared with other threads or cross a single scope's boundary. For example, a Random acquired within a test method shouldn't be reused for another test case.

There is an overhead connected with getting the Random for a particular context and thread. It is better to cache the Random locally if tight loops with multiple invocations are present or create a derivative local Random for millions of calls like this:

 Random random = new Random(random().nextLong()); // tight loop with many invocations. 
public static Random ( ) : Random
return Random

Rarely() public static method

public static Rarely ( ) : bool
return bool

Rarely() public static method

Returns true if something should happen rarely,

The actual number returned will be influenced by whether #TEST_NIGHTLY is active and #RANDOM_MULTIPLIER.

public static Rarely ( Random random ) : bool
random Random
return bool

SlowFileExists() public static method

Returns true if the file exists (can be opened), false if it cannot be opened, and (unlike Java's File.exists) if there's some unexpected error.
public static SlowFileExists ( Directory dir, string fileName ) : bool
dir Directory
fileName string
return bool

TestThread() public static method

Returns true if and only if the calling thread is the primary thread executing the test case.
public static TestThread ( ) : bool
return bool

Usually() public static method

public static Usually ( ) : bool
return bool

Usually() public static method

public static Usually ( Random random ) : bool
random Random
return bool

randon() protected static method

protected static randon ( ) : Random
return Random

Property Details

DEFAULT_LINE_DOCS_FILE public_oe static_oe property

TODO: javadoc?
public static string DEFAULT_LINE_DOCS_FILE
return string

DoesntSupportOffsets protected_oe static_oe property

protected static HashSet DoesntSupportOffsets
return HashSet

INFOSTREAM public_oe static_oe property

TODO: javadoc?
public static bool INFOSTREAM
return bool

JENKINS_LARGE_LINE_DOCS_FILE public_oe static_oe property

TODO: javadoc?
public static string JENKINS_LARGE_LINE_DOCS_FILE
return string

LEAVE_TEMPORARY public_oe static_oe property

Leave temporary files on disk, even on successful runs.
public static bool LEAVE_TEMPORARY
return bool

RANDOM_MULTIPLIER public_oe static_oe property

A random multiplier which you should use when writing random tests: multiply it by the number of iterations to scale your tests (for nightly builds).
public static int RANDOM_MULTIPLIER
return int

SuiteFailureMarker public_oe static_oe property

Suite failure marker (any error in the test or suite scope).
public static bool SuiteFailureMarker
return bool

TEMP_DIR public_oe static_oe property

public static FileInfo,System.IO TEMP_DIR
return System.IO.FileInfo

TEST_AWAITSFIX public_oe static_oe property

Whether or not AwaitsFix tests should run.
public static bool TEST_AWAITSFIX
return bool

TEST_CODEC public_oe static_oe property

Gets the codec to run tests with.
public static string TEST_CODEC
return string

TEST_DIRECTORY public_oe static_oe property

Gets the directory to run tests with
public static string TEST_DIRECTORY
return string

TEST_DOCVALUESFORMAT public_oe static_oe property

Gets the docValuesFormat to run tests with
public static string TEST_DOCVALUESFORMAT
return string

TEST_LINE_DOCS_FILE public_oe static_oe property

the line file used by LineFileDocs
public static string TEST_LINE_DOCS_FILE
return string

TEST_NIGHTLY public_oe static_oe property

Whether or not Nightly tests should run.
public static bool TEST_NIGHTLY
return bool

TEST_POSTINGSFORMAT public_oe static_oe property

Gets the postingsFormat to run tests with.
public static string TEST_POSTINGSFORMAT
return string

TEST_SLOW public_oe static_oe property

Whether or not Slow tests should run.
public static bool TEST_SLOW
return bool

TEST_THROTTLING public_oe static_oe property

Throttling, see MockDirectoryWrapper#setThrottling(Throttling).
public static MockDirectoryWrapper.Throttling_e TEST_THROTTLING
return MockDirectoryWrapper.Throttling_e

TEST_VERSION_CURRENT public_oe static_oe property

Use this constant when creating Analyzers and any other version-dependent stuff.

NOTE: Change this when development starts for new Lucene version:

public static LuceneVersion TEST_VERSION_CURRENT
return LuceneVersion

TEST_WEEKLY public_oe static_oe property

Whether or not Weekly tests should run.
public static bool TEST_WEEKLY
return bool

VERBOSE public_oe static_oe property

True if and only if tests are run in verbose mode. If this flag is false tests are not expected to print any messages.
public static bool VERBOSE
return bool