Package org.elasticsearch.index.mapper
Class TestDocumentParserContext
java.lang.Object
org.elasticsearch.index.mapper.DocumentParserContext
org.elasticsearch.index.mapper.TestDocumentParserContext
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
ConstructorsConstructorDescriptionTestDocumentParserContext(IndexSettings indexSettings) The shortest and easiest way to create a context, to be used when none of the constructor arguments are needed besidesIndexSettings.TestDocumentParserContext(MappingLookup mappingLookup, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, Function<DateFormatter, MappingParserContext> parserContextFunction, 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 TypeMethodDescriptionprotected voidaddDoc(LuceneDocument doc) final LuceneDocumentdoc()docs()org.elasticsearch.xcontent.XContentParserparser()final ContentPathpath()rootDoc()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
-
Constructor Details
-
TestDocumentParserContext
The shortest and easiest way to create a context, to be used when none of the constructor arguments are needed besidesIndexSettings. Use with caution as it can causeNullPointerExceptions down the line. -
TestDocumentParserContext
public TestDocumentParserContext(MappingLookup mappingLookup, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, Function<DateFormatter, MappingParserContext> parserContextFunction, 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
- Specified by:
docin classDocumentParserContext
-
path
- Specified by:
pathin classDocumentParserContext
-
nonRootDocuments
- Specified by:
nonRootDocumentsin classDocumentParserContext
-
docs
- Specified by:
docsin classDocumentParserContext
-
parser
public org.elasticsearch.xcontent.XContentParser parser()- Specified by:
parserin classDocumentParserContext
-
rootDoc
- Specified by:
rootDocin classDocumentParserContext
-
addDoc
- Specified by:
addDocin classDocumentParserContext
-