C# Class Lucene.Net.Util.LuceneTestCase

Inheritance: Assert
Afficher le fichier Open project: apache/lucenenet Class Usage Examples

Méthodes publiques

Свойство 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

Свойство Type Description
DoesntSupportOffsets HashSet

Private Properties

Свойство 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

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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

Méthode 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 méthode

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

AssertDeletedDocsEquals() public méthode

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

AssertDocValuesEquals() public méthode

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
Résultat void

AssertDocValuesEquals() public méthode

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
Résultat void

AssertDocsAndPositionsEnumEquals() public méthode

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
Résultat void

AssertDocsEnumEquals() public méthode

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
Résultat void

AssertDocsSkippingEquals() public méthode

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
Résultat void

AssertFieldInfosEquals() public méthode

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

AssertFieldStatisticsEquals() public méthode

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
Résultat void

AssertFieldsEquals() public méthode

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
Résultat void

AssertNormsEquals() public méthode

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
Résultat void

AssertPositionsSkippingEquals() public méthode

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
Résultat void

AssertReaderEquals() public méthode

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

AssertReaderStatisticsEquals() public méthode

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
Résultat void

AssertSaneFieldCaches() protected static méthode

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
Résultat void

AssertStoredFieldEquals() public méthode

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

AssertStoredFieldsEquals() public méthode

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
Résultat void

AssertTermStatsEquals() public méthode

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
Résultat void

AssertTermVectorsEquals() public méthode

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
Résultat void

AssertTermsEnumEquals() public méthode

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
Résultat void

AssertTermsEquals() public méthode

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
Résultat void

AssertTermsStatisticsEquals() public méthode

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
Résultat void

AssumeFalse() public static méthode

public static AssumeFalse ( string msg, bool condition ) : void
msg string
condition bool
Résultat void

AssumeNoException() public static méthode

public static AssumeNoException ( string msg, Exception e ) : void
msg string
e System.Exception
Résultat void

AssumeTrue() public static méthode

public static AssumeTrue ( string msg, bool condition ) : void
msg string
condition bool
Résultat void

AtLeast() public static méthode

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
Résultat int

AtLeast() public static méthode

public static AtLeast ( int i ) : int
i int
Résultat int

CreateTempDir() public static méthode

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

CreateTempDir() public static méthode

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
Résultat System.IO.DirectoryInfo

CreateTempFile() public static méthode

Creates an empty temporary file.
public static CreateTempFile ( ) : FileInfo
Résultat System.IO.FileInfo

CreateTempFile() public static méthode

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
Résultat System.IO.FileInfo

DefaultCodecSupportsDocValues() public static méthode

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
Résultat bool

DefaultCodecSupportsDocsWithField() public static méthode

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

DefaultCodecSupportsFieldUpdates() public static méthode

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

DefaultCodecSupportsMissingDocValues() public static méthode

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

DefaultCodecSupportsSortedSet() public static méthode

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

DumpArray() public static méthode

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
Résultat void

DumpIterator() public static méthode

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.
Résultat void

GetDataFile() protected méthode

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
Résultat Stream

GetOnlySegmentReader() public static méthode

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
Résultat Lucene.Net.Index.SegmentReader

LuceneTestCase() public méthode

public LuceneTestCase ( ) : System.Collections.Concurrent
Résultat System.Collections.Concurrent

MaybeWrapReader() public static méthode

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
Résultat Lucene.Net.Index.IndexReader

NewAlcoholicMergePolicy() public méthode

public NewAlcoholicMergePolicy ( ) : Lucene.Net.Index.AlcoholicMergePolicy
Résultat Lucene.Net.Index.AlcoholicMergePolicy

NewAlcoholicMergePolicy() public static méthode

public static NewAlcoholicMergePolicy ( Random r, TimeZone tz ) : AlcoholicMergePolicy
r Random
tz TimeZone
Résultat AlcoholicMergePolicy

NewDirectory() public static méthode

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
Résultat BaseDirectoryWrapper

NewDirectory() public static méthode

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
Résultat BaseDirectoryWrapper

NewDirectory() public static méthode

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

NewDirectory() public static méthode

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
Résultat BaseDirectoryWrapper

NewFSDirectory() public static méthode

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

NewFSDirectory() public static méthode

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
Résultat BaseDirectoryWrapper

NewField() public méthode

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
Résultat Field

NewField() public méthode

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
Résultat Field

NewIOContext() public static méthode

TODO: javadoc
public static NewIOContext ( Random random ) : IOContext
random Random
Résultat IOContext

NewIOContext() public static méthode

TODO: javadoc
public static NewIOContext ( Random random, IOContext oldContext ) : IOContext
random Random
oldContext IOContext
Résultat IOContext

NewIndexWriterConfig() public méthode

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
Résultat IndexWriterConfig

NewIndexWriterConfig() public méthode

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
Résultat IndexWriterConfig

NewIndexWriterConfig() public static méthode

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
Résultat IndexWriterConfig

NewLogMergePolicy() public static méthode

public static NewLogMergePolicy ( ) : LogMergePolicy
Résultat LogMergePolicy

NewLogMergePolicy() public static méthode

public static NewLogMergePolicy ( Random r ) : LogMergePolicy
r Random
Résultat LogMergePolicy

NewLogMergePolicy() public static méthode

public static NewLogMergePolicy ( bool useCFS ) : MergePolicy
useCFS bool
Résultat MergePolicy

NewLogMergePolicy() public static méthode

public static NewLogMergePolicy ( bool useCFS, int mergeFactor ) : MergePolicy
useCFS bool
mergeFactor int
Résultat MergePolicy

NewLogMergePolicy() public static méthode

public static NewLogMergePolicy ( int mergeFactor ) : MergePolicy
mergeFactor int
Résultat MergePolicy

NewMergePolicy() public static méthode

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

NewMergePolicy() public static méthode

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

NewMockDirectory() public static méthode

public static NewMockDirectory ( ) : MockDirectoryWrapper
Résultat MockDirectoryWrapper

NewMockDirectory() public static méthode

public static NewMockDirectory ( Random r ) : MockDirectoryWrapper
r Random
Résultat MockDirectoryWrapper

NewMockFSDirectory() public static méthode

public static NewMockFSDirectory ( DirectoryInfo d ) : MockDirectoryWrapper
d DirectoryInfo
Résultat MockDirectoryWrapper

NewSearcher() public méthode

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
Résultat IndexSearcher

NewSearcher() public static méthode

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

NewSearcher() public méthode

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

NewSearcher() public static méthode

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 ///
Résultat IndexSearcher

NewSearcher() public méthode

public NewSearcher ( IndexReader r, bool maybeWrap, bool wrapWithAssertions ) : IndexSearcher
r IndexReader
maybeWrap bool
wrapWithAssertions bool
Résultat IndexSearcher

NewSearcher() public static méthode

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 ///
Résultat IndexSearcher

NewStringField() public méthode

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
Résultat Field

NewStringField() public méthode

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
Résultat Field

NewTextField() public méthode

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
Résultat Field

NewTextField() public méthode

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
Résultat Field

NewTieredMergePolicy() public static méthode

public static NewTieredMergePolicy ( ) : TieredMergePolicy
Résultat TieredMergePolicy

NewTieredMergePolicy() public static méthode

public static NewTieredMergePolicy ( Random r ) : TieredMergePolicy
r Random
Résultat TieredMergePolicy

Random() public static méthode

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
Résultat Random

Rarely() public static méthode

public static Rarely ( ) : bool
Résultat bool

Rarely() public static méthode

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
Résultat bool

SlowFileExists() public static méthode

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
Résultat bool

TestThread() public static méthode

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

Usually() public static méthode

public static Usually ( ) : bool
Résultat bool

Usually() public static méthode

public static Usually ( Random random ) : bool
random Random
Résultat bool

randon() protected static méthode

protected static randon ( ) : Random
Résultat Random

Property Details

DEFAULT_LINE_DOCS_FILE public_oe static_oe property

TODO: javadoc?
public static string DEFAULT_LINE_DOCS_FILE
Résultat string

DoesntSupportOffsets protected_oe static_oe property

protected static HashSet DoesntSupportOffsets
Résultat HashSet

INFOSTREAM public_oe static_oe property

TODO: javadoc?
public static bool INFOSTREAM
Résultat bool

JENKINS_LARGE_LINE_DOCS_FILE public_oe static_oe property

TODO: javadoc?
public static string JENKINS_LARGE_LINE_DOCS_FILE
Résultat string

LEAVE_TEMPORARY public_oe static_oe property

Leave temporary files on disk, even on successful runs.
public static bool LEAVE_TEMPORARY
Résultat 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
Résultat int

SuiteFailureMarker public_oe static_oe property

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

TEMP_DIR public_oe static_oe property

public static FileInfo,System.IO TEMP_DIR
Résultat System.IO.FileInfo

TEST_AWAITSFIX public_oe static_oe property

Whether or not AwaitsFix tests should run.
public static bool TEST_AWAITSFIX
Résultat bool

TEST_CODEC public_oe static_oe property

Gets the codec to run tests with.
public static string TEST_CODEC
Résultat string

TEST_DIRECTORY public_oe static_oe property

Gets the directory to run tests with
public static string TEST_DIRECTORY
Résultat string

TEST_DOCVALUESFORMAT public_oe static_oe property

Gets the docValuesFormat to run tests with
public static string TEST_DOCVALUESFORMAT
Résultat string

TEST_LINE_DOCS_FILE public_oe static_oe property

the line file used by LineFileDocs
public static string TEST_LINE_DOCS_FILE
Résultat string

TEST_NIGHTLY public_oe static_oe property

Whether or not Nightly tests should run.
public static bool TEST_NIGHTLY
Résultat bool

TEST_POSTINGSFORMAT public_oe static_oe property

Gets the postingsFormat to run tests with.
public static string TEST_POSTINGSFORMAT
Résultat string

TEST_SLOW public_oe static_oe property

Whether or not Slow tests should run.
public static bool TEST_SLOW
Résultat bool

TEST_THROTTLING public_oe static_oe property

Throttling, see MockDirectoryWrapper#setThrottling(Throttling).
public static MockDirectoryWrapper.Throttling_e TEST_THROTTLING
Résultat 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
Résultat LuceneVersion

TEST_WEEKLY public_oe static_oe property

Whether or not Weekly tests should run.
public static bool TEST_WEEKLY
Résultat 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
Résultat bool