Class ThrowingLeafReaderWrapper

java.lang.Object
org.apache.lucene.index.IndexReader
org.apache.lucene.index.LeafReader
org.apache.lucene.index.FilterLeafReader
org.elasticsearch.common.lucene.index.SequentialStoredFieldsLeafReader
org.elasticsearch.test.engine.ThrowingLeafReaderWrapper
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable

public class ThrowingLeafReaderWrapper
extends org.elasticsearch.common.lucene.index.SequentialStoredFieldsLeafReader
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
    static interface  ThrowingLeafReaderWrapper.Thrower
    A callback interface that allows to throw certain exceptions for methods called on the IndexReader that is wrapped by ThrowingLeafReaderWrapper
    static class  ThrowingLeafReaderWrapper.ThrowingFields
    Wraps a Fields but with additional asserts
    static class  ThrowingLeafReaderWrapper.ThrowingTerms
    Wraps a Terms but with additional asserts

    Nested classes/interfaces inherited from class org.apache.lucene.index.FilterLeafReader

    org.apache.lucene.index.FilterLeafReader.FilterFields, org.apache.lucene.index.FilterLeafReader.FilterPostingsEnum, org.apache.lucene.index.FilterLeafReader.FilterTerms, org.apache.lucene.index.FilterLeafReader.FilterTermsEnum

    Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader

    org.apache.lucene.index.IndexReader.CacheHelper, org.apache.lucene.index.IndexReader.CacheKey, org.apache.lucene.index.IndexReader.ClosedListener
  • Field Summary

    Fields inherited from class org.apache.lucene.index.FilterLeafReader

    in
  • Constructor Summary

    Constructors
    Constructor Description
    ThrowingLeafReaderWrapper​(org.apache.lucene.index.LeafReader in, ThrowingLeafReaderWrapper.Thrower thrower)  
  • Method Summary

    Modifier and Type Method Description
    protected org.apache.lucene.codecs.StoredFieldsReader doGetSequentialStoredFieldsReader​(org.apache.lucene.codecs.StoredFieldsReader reader)  
    org.apache.lucene.index.BinaryDocValues getBinaryDocValues​(java.lang.String field)  
    org.apache.lucene.index.IndexReader.CacheHelper getCoreCacheHelper()  
    org.apache.lucene.index.NumericDocValues getNormValues​(java.lang.String field)  
    org.apache.lucene.index.NumericDocValues getNumericDocValues​(java.lang.String field)  
    org.apache.lucene.index.IndexReader.CacheHelper getReaderCacheHelper()  
    org.apache.lucene.index.SortedDocValues getSortedDocValues​(java.lang.String field)  
    org.apache.lucene.index.SortedSetDocValues getSortedSetDocValues​(java.lang.String field)  
    org.apache.lucene.index.Fields getTermVectors​(int docID)  
    org.apache.lucene.index.Terms terms​(java.lang.String field)  

    Methods inherited from class org.elasticsearch.common.lucene.index.SequentialStoredFieldsLeafReader

    getSequentialStoredFieldsReader

    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

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • terms

      public org.apache.lucene.index.Terms terms​(java.lang.String field) throws java.io.IOException
      Overrides:
      terms in class org.apache.lucene.index.FilterLeafReader
      Throws:
      java.io.IOException
    • getTermVectors

      public org.apache.lucene.index.Fields getTermVectors​(int docID) throws java.io.IOException
      Overrides:
      getTermVectors in class org.apache.lucene.index.FilterLeafReader
      Throws:
      java.io.IOException
    • getNumericDocValues

      public org.apache.lucene.index.NumericDocValues getNumericDocValues​(java.lang.String field) throws java.io.IOException
      Overrides:
      getNumericDocValues in class org.apache.lucene.index.FilterLeafReader
      Throws:
      java.io.IOException
    • getBinaryDocValues

      public org.apache.lucene.index.BinaryDocValues getBinaryDocValues​(java.lang.String field) throws java.io.IOException
      Overrides:
      getBinaryDocValues in class org.apache.lucene.index.FilterLeafReader
      Throws:
      java.io.IOException
    • getSortedDocValues

      public org.apache.lucene.index.SortedDocValues getSortedDocValues​(java.lang.String field) throws java.io.IOException
      Overrides:
      getSortedDocValues in class org.apache.lucene.index.FilterLeafReader
      Throws:
      java.io.IOException
    • getSortedSetDocValues

      public org.apache.lucene.index.SortedSetDocValues getSortedSetDocValues​(java.lang.String field) throws java.io.IOException
      Overrides:
      getSortedSetDocValues in class org.apache.lucene.index.FilterLeafReader
      Throws:
      java.io.IOException
    • getNormValues

      public org.apache.lucene.index.NumericDocValues getNormValues​(java.lang.String field) throws java.io.IOException
      Overrides:
      getNormValues in class org.apache.lucene.index.FilterLeafReader
      Throws:
      java.io.IOException
    • getCoreCacheHelper

      public org.apache.lucene.index.IndexReader.CacheHelper getCoreCacheHelper()
      Specified by:
      getCoreCacheHelper in class org.apache.lucene.index.LeafReader
    • getReaderCacheHelper

      public org.apache.lucene.index.IndexReader.CacheHelper getReaderCacheHelper()
      Specified by:
      getReaderCacheHelper in class org.apache.lucene.index.IndexReader
    • doGetSequentialStoredFieldsReader

      protected org.apache.lucene.codecs.StoredFieldsReader doGetSequentialStoredFieldsReader​(org.apache.lucene.codecs.StoredFieldsReader reader)
      Specified by:
      doGetSequentialStoredFieldsReader in class org.elasticsearch.common.lucene.index.SequentialStoredFieldsLeafReader