C# Класс Lucene.Net.Store.MockDirectoryWrapper

this is a Directory Wrapper that adds methods intended to be used only by unit tests. It also adds a number of features useful for testing:
  • Instances created by LuceneTestCase#newDirectory() are tracked to ensure they are closed by the test.
  • When a MockDirectoryWrapper is closed, it will throw an exception if it has any open files against it (with a stacktrace indicating where they were opened from).
  • When a MockDirectoryWrapper is closed, it runs CheckIndex to test if the index was corrupted.
  • MockDirectoryWrapper simulates some "features" of Windows, such as refusing to write/delete to open files.
Наследование: Lucene.Net.Store.BaseDirectoryWrapper
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
LockFactory_Renamed LockFactory

Открытые методы

Метод Описание
ClearCrash ( ) : void
ClearLock ( string name ) : void
Copy ( Directory to, string src, string dest, IOContext context ) : void
Crash ( ) : void

Simulates a crash of OS or machine by overwriting unsynced files.

CreateOutput ( string name, IOContext context ) : IndexOutput
CreateSlicer ( string name, IOContext context ) : IndexInputSlicer
DeleteFile ( string name ) : void
Dispose ( ) : void
FailOn ( Failure fail ) : void

add a Failure object to the list of objects to be evaluated at every potential failure point

FileExists ( string name ) : bool
FileLength ( string name ) : long
ListAll ( ) : string[]
MakeLock ( string name ) : Lock
MockDirectoryWrapper ( Random random, Directory @delegate ) : NUnit.Framework
OpenInput ( string name, IOContext context ) : IndexInput
RemoveIndexInput ( IndexInput @in, string name ) : void
RemoveIndexOutput ( IndexOutput @out, string name ) : void
ResetMaxUsedSizeInBytes ( ) : void
SizeInBytes ( ) : long
Sync ( ICollection names ) : void

Приватные методы

Метод Описание
AddFileHandle ( IDisposable c, string name, Handle handle ) : void
DeleteFile ( string name, bool forced ) : void
FillOpenTrace ( Exception t, string name, bool input ) : Exception
Init ( ) : void
MaybeThrowDeterministicException ( ) : void

Iterate through the failures list, giving each object a chance to throw an IOE

MaybeThrowIOException ( string message ) : void
MaybeThrowIOExceptionOnOpen ( string name ) : void
MaybeYield ( ) : void
MustSync ( ) : bool

Returns true if #in must sync its files. Currently, only NRTCachingDirectory requires sync'ing its files because otherwise they are cached in an internal RAMDirectory. If other directories require that too, they should be added to this method.

RemoveOpenFile ( IDisposable c, string name ) : void

Описание методов

ClearCrash() публичный Метод

public ClearCrash ( ) : void
Результат void

ClearLock() публичный Метод

public ClearLock ( string name ) : void
name string
Результат void

Copy() публичный Метод

public Copy ( Directory to, string src, string dest, IOContext context ) : void
to Directory
src string
dest string
context IOContext
Результат void

Crash() публичный Метод

Simulates a crash of OS or machine by overwriting unsynced files.
public Crash ( ) : void
Результат void

CreateOutput() публичный Метод

public CreateOutput ( string name, IOContext context ) : IndexOutput
name string
context IOContext
Результат IndexOutput

CreateSlicer() публичный Метод

public CreateSlicer ( string name, IOContext context ) : IndexInputSlicer
name string
context IOContext
Результат IndexInputSlicer

DeleteFile() публичный Метод

public DeleteFile ( string name ) : void
name string
Результат void

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

FailOn() публичный Метод

add a Failure object to the list of objects to be evaluated at every potential failure point
public FailOn ( Failure fail ) : void
fail Failure
Результат void

FileExists() публичный Метод

public FileExists ( string name ) : bool
name string
Результат bool

FileLength() публичный Метод

public FileLength ( string name ) : long
name string
Результат long

ListAll() публичный Метод

public ListAll ( ) : string[]
Результат string[]

MakeLock() публичный Метод

public MakeLock ( string name ) : Lock
name string
Результат Lock

MockDirectoryWrapper() публичный Метод

public MockDirectoryWrapper ( Random random, Directory @delegate ) : NUnit.Framework
random Random
@delegate Directory
Результат NUnit.Framework

OpenInput() публичный Метод

public OpenInput ( string name, IOContext context ) : IndexInput
name string
context IOContext
Результат IndexInput

RemoveIndexInput() публичный Метод

public RemoveIndexInput ( IndexInput @in, string name ) : void
@in IndexInput
name string
Результат void

RemoveIndexOutput() публичный Метод

public RemoveIndexOutput ( IndexOutput @out, string name ) : void
@out IndexOutput
name string
Результат void

ResetMaxUsedSizeInBytes() публичный Метод

public ResetMaxUsedSizeInBytes ( ) : void
Результат void

SizeInBytes() публичный Метод

public SizeInBytes ( ) : long
Результат long

Sync() публичный Метод

public Sync ( ICollection names ) : void
names ICollection
Результат void

Описание свойств

LockFactory_Renamed защищенное свойство

protected LockFactory LockFactory_Renamed
Результат LockFactory