Package org.elasticsearch.test.engine
Class ThrowingLeafReaderWrapper
- java.lang.Object
-
- org.apache.lucene.index.IndexReader
-
- org.apache.lucene.index.LeafReader
-
- org.apache.lucene.index.FilterLeafReader
-
- org.elasticsearch.test.engine.ThrowingLeafReaderWrapper
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ThrowingLeafReaderWrapper extends FilterLeafReader
An FilterLeafReader that allows to throw exceptions if certain methods are called on is. This allows to test parts of the system under certain error conditions that would otherwise not be possible.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ThrowingLeafReaderWrapper.Flags
Flags passed toThrowingLeafReaderWrapper.Thrower.maybeThrow(org.elasticsearch.test.engine.ThrowingLeafReaderWrapper.Flags)
when the corresponding method is called.static interface
ThrowingLeafReaderWrapper.Thrower
A callback interface that allows to throw certain exceptions for methods called on the IndexReader that is wrapped byThrowingLeafReaderWrapper
static class
ThrowingLeafReaderWrapper.ThrowingFields
Wraps a Fields but with additional assertsstatic class
ThrowingLeafReaderWrapper.ThrowingTerms
Wraps a Terms but with additional asserts-
Nested classes/interfaces inherited from class org.apache.lucene.index.FilterLeafReader
FilterLeafReader.FilterFields, FilterLeafReader.FilterPostingsEnum, FilterLeafReader.FilterTerms, FilterLeafReader.FilterTermsEnum
-
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
IndexReader.CacheHelper, IndexReader.CacheKey, IndexReader.ClosedListener
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.index.FilterLeafReader
in
-
-
Constructor Summary
Constructors Constructor Description ThrowingLeafReaderWrapper(LeafReader in, ThrowingLeafReaderWrapper.Thrower thrower)
-
Method Summary
Modifier and Type Method Description BinaryDocValues
getBinaryDocValues(java.lang.String field)
IndexReader.CacheHelper
getCoreCacheHelper()
NumericDocValues
getNormValues(java.lang.String field)
NumericDocValues
getNumericDocValues(java.lang.String field)
IndexReader.CacheHelper
getReaderCacheHelper()
SortedDocValues
getSortedDocValues(java.lang.String field)
SortedSetDocValues
getSortedSetDocValues(java.lang.String field)
Fields
getTermVectors(int docID)
Terms
terms(java.lang.String field)
-
Methods inherited from class org.apache.lucene.index.FilterLeafReader
checkIntegrity, doClose, document, getDelegate, getFieldInfos, getLiveDocs, getMetaData, getPointValues, getSortedNumericDocValues, maxDoc, numDocs, toString, unwrap
-
Methods inherited from class org.apache.lucene.index.LeafReader
docFreq, getContext, getDocCount, getSumDocFreq, getSumTotalTermFreq, postings, postings, totalTermFreq
-
Methods inherited from class org.apache.lucene.index.IndexReader
close, decRef, document, document, ensureOpen, equals, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, registerParentReader, tryIncRef
-
-
-
-
Constructor Detail
-
ThrowingLeafReaderWrapper
public ThrowingLeafReaderWrapper(LeafReader in, ThrowingLeafReaderWrapper.Thrower thrower)
-
-
Method Detail
-
terms
public Terms terms(java.lang.String field) throws java.io.IOException
- Overrides:
terms
in classFilterLeafReader
- Throws:
java.io.IOException
-
getTermVectors
public Fields getTermVectors(int docID) throws java.io.IOException
- Overrides:
getTermVectors
in classFilterLeafReader
- Throws:
java.io.IOException
-
getNumericDocValues
public NumericDocValues getNumericDocValues(java.lang.String field) throws java.io.IOException
- Overrides:
getNumericDocValues
in classFilterLeafReader
- Throws:
java.io.IOException
-
getBinaryDocValues
public BinaryDocValues getBinaryDocValues(java.lang.String field) throws java.io.IOException
- Overrides:
getBinaryDocValues
in classFilterLeafReader
- Throws:
java.io.IOException
-
getSortedDocValues
public SortedDocValues getSortedDocValues(java.lang.String field) throws java.io.IOException
- Overrides:
getSortedDocValues
in classFilterLeafReader
- Throws:
java.io.IOException
-
getSortedSetDocValues
public SortedSetDocValues getSortedSetDocValues(java.lang.String field) throws java.io.IOException
- Overrides:
getSortedSetDocValues
in classFilterLeafReader
- Throws:
java.io.IOException
-
getNormValues
public NumericDocValues getNormValues(java.lang.String field) throws java.io.IOException
- Overrides:
getNormValues
in classFilterLeafReader
- Throws:
java.io.IOException
-
getCoreCacheHelper
public IndexReader.CacheHelper getCoreCacheHelper()
- Specified by:
getCoreCacheHelper
in classLeafReader
-
getReaderCacheHelper
public IndexReader.CacheHelper getReaderCacheHelper()
- Specified by:
getReaderCacheHelper
in classIndexReader
-
-