public class MockDirectoryWrapper
extends org.apache.lucene.store.Directory
LuceneTestCase.newDirectory() are tracked
to ensure they are closed by the test.
| Modifier and Type | Class and Description |
|---|---|
static class |
MockDirectoryWrapper.Failure
Objects that represent fail-able conditions.
|
static class |
MockDirectoryWrapper.Throttling |
| Constructor and Description |
|---|
MockDirectoryWrapper(java.util.Random random,
org.apache.lucene.store.Directory delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCrash() |
void |
clearLock(java.lang.String name) |
void |
close() |
void |
copy(org.apache.lucene.store.Directory to,
java.lang.String src,
java.lang.String dest) |
void |
crash()
Simulates a crash of OS or machine by overwriting
unsynced files.
|
org.apache.lucene.store.IndexOutput |
createOutput(java.lang.String name) |
void |
deleteFile(java.lang.String name) |
void |
failOn(MockDirectoryWrapper.Failure fail)
add a Failure object to the list of objects to be evaluated
at every potential failure point
|
boolean |
fileExists(java.lang.String name) |
long |
fileLength(java.lang.String name) |
long |
fileModified(java.lang.String name) |
boolean |
getCheckIndexOnClose() |
int |
getInputCloneCount() |
org.apache.lucene.store.LockFactory |
getLockFactory() |
java.lang.String |
getLockID() |
long |
getMaxSizeInBytes() |
long |
getMaxUsedSizeInBytes()
Returns the peek actual storage used (bytes) in this
directory.
|
boolean |
getNoDeleteOpenFile() |
java.util.Set<java.lang.String> |
getOpenDeletedFiles() |
double |
getRandomIOExceptionRate() |
long |
getRecomputedActualSizeInBytes()
Like getRecomputedSizeInBytes(), but, uses actual file
lengths rather than buffer allocations (which are
quantized up to nearest
RAMOutputStream.BUFFER_SIZE (now 1024) bytes.
|
long |
getRecomputedSizeInBytes()
Provided for testing purposes.
|
boolean |
isOpen() |
java.lang.String[] |
listAll() |
org.apache.lucene.store.Lock |
makeLock(java.lang.String name) |
org.apache.lucene.store.IndexInput |
openInput(java.lang.String name) |
void |
removeIndexInput(org.apache.lucene.store.IndexInput in,
java.lang.String name) |
void |
removeIndexOutput(org.apache.lucene.store.IndexOutput out,
java.lang.String name) |
void |
resetMaxUsedSizeInBytes() |
void |
setAssertNoUnrefencedFilesOnClose(boolean v) |
void |
setCheckIndexOnClose(boolean value)
Set whether or not checkindex should be run
on close
|
void |
setFailOnCreateOutput(boolean v) |
void |
setFailOnOpenInput(boolean v) |
void |
setLockFactory(org.apache.lucene.store.LockFactory lockFactory) |
void |
setMaxSizeInBytes(long maxSize) |
void |
setNoDeleteOpenFile(boolean value)
Emulate windows whereby deleting an open file is not
allowed (raise IOException).
|
void |
setPreventDoubleWrite(boolean value)
If set to true, we throw an IOException if the same
file is opened by createOutput, ever.
|
void |
setRandomIOExceptionRate(double rate)
If 0.0, no exceptions will be thrown.
|
void |
setThrottling(MockDirectoryWrapper.Throttling throttling) |
void |
setTrackDiskUsage(boolean v) |
long |
sizeInBytes() |
void |
sync(java.util.Collection<java.lang.String> names) |
void |
sync(java.lang.String name)
Deprecated.
|
java.lang.String |
toString() |
void |
touchFile(java.lang.String name)
Deprecated.
|
public MockDirectoryWrapper(java.util.Random random,
org.apache.lucene.store.Directory delegate)
public int getInputCloneCount()
public void setTrackDiskUsage(boolean v)
public void setPreventDoubleWrite(boolean value)
@Deprecated
public void sync(java.lang.String name)
throws java.io.IOException
sync in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic void setThrottling(MockDirectoryWrapper.Throttling throttling)
public void sync(java.util.Collection<java.lang.String> names)
throws java.io.IOException
sync in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic java.lang.String toString()
toString in class org.apache.lucene.store.Directorypublic final long sizeInBytes()
throws java.io.IOException
java.io.IOExceptionpublic void crash()
throws java.io.IOException
java.io.IOExceptionpublic void clearCrash()
throws java.io.IOException
java.io.IOExceptionpublic void setMaxSizeInBytes(long maxSize)
public long getMaxSizeInBytes()
public long getMaxUsedSizeInBytes()
public void resetMaxUsedSizeInBytes()
throws java.io.IOException
java.io.IOExceptionpublic void setNoDeleteOpenFile(boolean value)
public boolean getNoDeleteOpenFile()
public void setCheckIndexOnClose(boolean value)
public boolean getCheckIndexOnClose()
public void setRandomIOExceptionRate(double rate)
public double getRandomIOExceptionRate()
public void deleteFile(java.lang.String name)
throws java.io.IOException
deleteFile in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic java.util.Set<java.lang.String> getOpenDeletedFiles()
public void setFailOnCreateOutput(boolean v)
public org.apache.lucene.store.IndexOutput createOutput(java.lang.String name)
throws java.io.IOException
createOutput in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic void setFailOnOpenInput(boolean v)
public org.apache.lucene.store.IndexInput openInput(java.lang.String name)
throws java.io.IOException
openInput in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic final long getRecomputedSizeInBytes()
throws java.io.IOException
java.io.IOExceptionpublic final long getRecomputedActualSizeInBytes()
throws java.io.IOException
java.io.IOExceptionpublic void setAssertNoUnrefencedFilesOnClose(boolean v)
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic void removeIndexOutput(org.apache.lucene.store.IndexOutput out,
java.lang.String name)
public void removeIndexInput(org.apache.lucene.store.IndexInput in,
java.lang.String name)
public boolean isOpen()
public void failOn(MockDirectoryWrapper.Failure fail)
public java.lang.String[] listAll()
throws java.io.IOException
listAll in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic boolean fileExists(java.lang.String name)
throws java.io.IOException
fileExists in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic long fileModified(java.lang.String name)
throws java.io.IOException
fileModified in class org.apache.lucene.store.Directoryjava.io.IOException@Deprecated
public void touchFile(java.lang.String name)
throws java.io.IOException
touchFile in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic long fileLength(java.lang.String name)
throws java.io.IOException
fileLength in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic org.apache.lucene.store.Lock makeLock(java.lang.String name)
makeLock in class org.apache.lucene.store.Directorypublic void clearLock(java.lang.String name)
throws java.io.IOException
clearLock in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic void setLockFactory(org.apache.lucene.store.LockFactory lockFactory)
throws java.io.IOException
setLockFactory in class org.apache.lucene.store.Directoryjava.io.IOExceptionpublic org.apache.lucene.store.LockFactory getLockFactory()
getLockFactory in class org.apache.lucene.store.Directorypublic java.lang.String getLockID()
getLockID in class org.apache.lucene.store.Directorypublic void copy(org.apache.lucene.store.Directory to,
java.lang.String src,
java.lang.String dest)
throws java.io.IOException
copy in class org.apache.lucene.store.Directoryjava.io.IOExceptionCopyright © 2000-2022 Apache Software Foundation. All Rights Reserved.