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
ConstructorDescriptionThe shortest and easiest way to create a context, to be used when none of the constructor arguments are needed.TestDocumentParserContext
(MappingLookup mappingLookup, 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.TestDocumentParserContext
(org.elasticsearch.xcontent.XContentParser parser) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDoc
(LuceneDocument doc) final LuceneDocument
doc()
org.elasticsearch.xcontent.XContentParser
parser()
final ContentPath
path()
rootDoc()
Methods inherited from class org.elasticsearch.index.mapper.DocumentParserContext
addDynamicMapper, addIgnoredField, addToFieldNames, createChildContext, createCopyToContext, createDynamicMapperBuilderContext, createFlattenContext, createNestedContext, documentDescription, dynamic, dynamicTemplateParserContext, findDynamicTemplate, getDimensions, getDynamicMappers, getDynamicMappers, getDynamicRuntimeFields, getIgnoredFields, getMapper, getMetadataMapper, id, id, indexAnalyzers, indexSettings, isCopyToField, isFieldAppliedFromTemplate, isWithinCopyTo, mappingLookup, markFieldAsAppliedFromTemplate, markFieldAsCopyTo, parent, root, seqID, seqID, sourceToParse, switchDoc, switchParser, updateDynamicMappers, updateRoot, version, version
-
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 causeNullPointerException
s down the line. -
TestDocumentParserContext
public TestDocumentParserContext(org.elasticsearch.xcontent.XContentParser parser) -
TestDocumentParserContext
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
-
parser
public org.elasticsearch.xcontent.XContentParser parser()- Specified by:
parser
in classDocumentParserContext
-
rootDoc
- Specified by:
rootDoc
in classDocumentParserContext
-
addDoc
- Specified by:
addDoc
in classDocumentParserContext
-