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
ConstructorDescriptionTestDocumentParserContext
(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 void
addDoc
(LuceneDocument doc) final LuceneDocument
doc()
docs()
org.elasticsearch.xcontent.XContentParser
parser()
final ContentPath
path()
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 causeNullPointerException
s 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:
doc
in classDocumentParserContext
-
path
- Specified by:
path
in classDocumentParserContext
-
nonRootDocuments
- Specified by:
nonRootDocuments
in classDocumentParserContext
-
docs
- Specified by:
docs
in classDocumentParserContext
-
parser
public org.elasticsearch.xcontent.XContentParser parser()- Specified by:
parser
in classDocumentParserContext
-
rootDoc
- Specified by:
rootDoc
in classDocumentParserContext
-
addDoc
- Specified by:
addDoc
in classDocumentParserContext
-