Class TestDocumentParserContext

java.lang.Object
org.elasticsearch.index.mapper.DocumentParserContext
org.elasticsearch.index.mapper.TestDocumentParserContext

public class TestDocumentParserContext extends org.elasticsearch.index.mapper.DocumentParserContext
Simplified version of DocumentParserContext to be used in tests. Every non final method throws UnsupportedOperationException and can be implemented as needed. doc() and path() are defined and final, as their behaviour is standard and they are both needed in almost every situation. The methods defined final in DocumentParserContext depend on the provided constructor arguments.
  • Constructor Summary

    Constructors
    Constructor
    Description
    The shortest and easiest way to create a context, to be used when none of the constructor arguments are needed.
    TestDocumentParserContext​(org.elasticsearch.index.mapper.MappingLookup mappingLookup, org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.analysis.IndexAnalyzers indexAnalyzers, Function<org.elasticsearch.common.time.DateFormatter,​org.elasticsearch.index.mapper.MappingParserContext> parserContextFunction, org.elasticsearch.index.mapper.SourceToParse source)
    More verbose way to create a context, to be used when one or more constructor arguments are needed as final methods that depend on them are called while executing tests.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addDoc​(org.elasticsearch.index.mapper.LuceneDocument doc)
     
    org.elasticsearch.index.mapper.LuceneDocument
    doc()
     
    Iterable<org.elasticsearch.index.mapper.LuceneDocument>
     
    org.elasticsearch.xcontent.XContentParser
     
    org.elasticsearch.index.mapper.ContentPath
     
    org.elasticsearch.index.mapper.LuceneDocument
     

    Methods inherited from class org.elasticsearch.index.mapper.DocumentParserContext

    addDynamicMapper, addDynamicRuntimeField, addIgnoredField, addToFieldNames, createCopyToContext, createMultiFieldContext, createNestedContext, dynamicTemplateParserContext, findDynamicTemplate, getDynamicMappers, getDynamicRuntimeFields, getIgnoredFields, getMetadataMapper, getObjectMapper, indexAnalyzers, indexSettings, isShadowed, isWithinCopyTo, isWithinMultiFields, mappingLookup, overridePath, root, seqID, seqID, sourceToParse, switchDoc, switchParser, version, version

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TestDocumentParserContext

      public TestDocumentParserContext()
      The shortest and easiest way to create a context, to be used when none of the constructor arguments are needed. Use with caution as it can cause NullPointerExceptions down the line.
    • TestDocumentParserContext

      public TestDocumentParserContext(org.elasticsearch.index.mapper.MappingLookup mappingLookup, org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.analysis.IndexAnalyzers indexAnalyzers, Function<org.elasticsearch.common.time.DateFormatter,​org.elasticsearch.index.mapper.MappingParserContext> parserContextFunction, org.elasticsearch.index.mapper.SourceToParse source)
      More verbose way to create a context, to be used when one or more constructor arguments are needed as final methods that depend on them are called while executing tests.
  • Method Details

    • doc

      public final org.elasticsearch.index.mapper.LuceneDocument doc()
      Specified by:
      doc in class org.elasticsearch.index.mapper.DocumentParserContext
    • path

      public final org.elasticsearch.index.mapper.ContentPath path()
      Specified by:
      path in class org.elasticsearch.index.mapper.DocumentParserContext
    • nonRootDocuments

      public Iterable<org.elasticsearch.index.mapper.LuceneDocument> nonRootDocuments()
      Specified by:
      nonRootDocuments in class org.elasticsearch.index.mapper.DocumentParserContext
    • parser

      public org.elasticsearch.xcontent.XContentParser parser()
      Specified by:
      parser in class org.elasticsearch.index.mapper.DocumentParserContext
    • rootDoc

      public org.elasticsearch.index.mapper.LuceneDocument rootDoc()
      Specified by:
      rootDoc in class org.elasticsearch.index.mapper.DocumentParserContext
    • addDoc

      protected void addDoc(org.elasticsearch.index.mapper.LuceneDocument doc)
      Specified by:
      addDoc in class org.elasticsearch.index.mapper.DocumentParserContext