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
ConstructorsConstructorDescriptionThe shortest and easiest way to create a context, to be used when none of the constructor arguments are needed.TestDocumentParserContext(Settings settings) 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 voidaddDoc(LuceneDocument doc) final LuceneDocumentdoc()org.elasticsearch.xcontent.XContentParserparser()final ContentPathpath()rootDoc()Methods inherited from class org.elasticsearch.index.mapper.DocumentParserContext
addDynamicMapper, addIgnoredField, addIgnoredField, addIgnoredFieldFromContext, addToFieldNames, canAddIgnoredField, createChildContext, createCopyToContext, createDynamicMapperBuilderContext, createFlattenContext, createNestedContext, documentDescription, dynamic, dynamicTemplateParserContext, findDynamicTemplate, getDynamicMappers, getDynamicMappers, getDynamicRuntimeFields, getIgnoredFields, getIgnoredFieldValues, getMapper, getMetadataMapper, getRoutingFields, hasDynamicMappers, hasDynamicMappersOrRuntimeFields, id, id, indexAnalyzers, indexSettings, isCopyToDestinationField, isFieldAppliedFromTemplate, isWithinCopyTo, mappingLookup, markFieldAsAppliedFromTemplate, markFieldAsCopyTo, maybeCloneForArray, parent, root, routing, 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 causeNullPointerExceptions down the line. -
TestDocumentParserContext
-
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:
docin classDocumentParserContext
-
path
- Specified by:
pathin classDocumentParserContext
-
nonRootDocuments
- Specified by:
nonRootDocumentsin classDocumentParserContext
-
parser
public org.elasticsearch.xcontent.XContentParser parser()- Specified by:
parserin classDocumentParserContext
-
rootDoc
- Specified by:
rootDocin classDocumentParserContext
-
addDoc
- Specified by:
addDocin classDocumentParserContext
-