Class MapperTestCase

java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase
Direct Known Subclasses:
AbstractNumericFieldMapperTestCase, FieldMapperTestCase2

public abstract class MapperTestCase extends MapperServiceTestCase
Base class for testing Mappers.
  • Constructor Details

    • MapperTestCase

      public MapperTestCase()
  • Method Details

    • minimalMapping

      protected abstract void minimalMapping(org.opensearch.core.xcontent.XContentBuilder b) throws IOException
      Throws:
      IOException
    • writeField

      protected void writeField(org.opensearch.core.xcontent.XContentBuilder builder) throws IOException
      Writes the field and a sample value for it to the provided XContentBuilder. To be overridden in case the field should not be written at all in documents, like in the case of runtime fields.
      Throws:
      IOException
    • writeFieldValue

      protected abstract void writeFieldValue(org.opensearch.core.xcontent.XContentBuilder builder) throws IOException
      Writes a sample value for the field to the provided XContentBuilder.
      Throws:
      IOException
    • testExistsQueryMinimalMapping

      public final void testExistsQueryMinimalMapping() throws IOException
      This test verifies that the exists query created is the appropriate one, and aligns with the data structures being created for a document with a value for the field. This can only be verified for the minimal mapping. Field types that allow configurable doc_values or norms should write their own tests that creates the different mappings combinations and invoke assertExistsQuery(MapperService) to verify the behaviour.
      Throws:
      IOException
    • assertExistsQuery

      protected void assertExistsQuery(org.opensearch.index.mapper.MapperService mapperService) throws IOException
      Throws:
      IOException
    • assertExistsQuery

      protected void assertExistsQuery(org.opensearch.index.mapper.MappedFieldType fieldType, org.apache.lucene.search.Query query, org.opensearch.index.mapper.ParseContext.Document fields)
    • assertNoFieldNamesField

      protected static void assertNoFieldNamesField(org.opensearch.index.mapper.ParseContext.Document fields)
    • assertHasNorms

      protected static void assertHasNorms(org.opensearch.index.mapper.ParseContext.Document doc, String field)
    • assertDocValuesField

      protected static void assertDocValuesField(org.opensearch.index.mapper.ParseContext.Document doc, String field)
    • assertNoDocValuesField

      protected static void assertNoDocValuesField(org.opensearch.index.mapper.ParseContext.Document doc, String field)
    • testEmptyName

      public void testEmptyName()
    • testMinimalSerializesToItself

      public final void testMinimalSerializesToItself() throws IOException
      Throws:
      IOException
    • testMinimalToMaximal

      public void testMinimalToMaximal() throws IOException
      Throws:
      IOException
    • assertParseMinimalWarnings

      protected void assertParseMinimalWarnings()
    • assertParseMaximalWarnings

      protected void assertParseMaximalWarnings()
    • supportsMeta

      protected boolean supportsMeta()
      Override to disable testing meta in fields that don't support it.
    • metaMapping

      protected void metaMapping(org.opensearch.core.xcontent.XContentBuilder b) throws IOException
      Throws:
      IOException
    • testMeta

      public void testMeta() throws IOException
      Throws:
      IOException
    • typeName

      protected String typeName() throws IOException
      Throws:
      IOException
    • supportsOrIgnoresBoost

      protected boolean supportsOrIgnoresBoost()
    • testDeprecatedBoost

      public void testDeprecatedBoost() throws IOException
      Throws:
      IOException
    • fetchFromDocValues

      protected final List<?> fetchFromDocValues(org.opensearch.index.mapper.MapperService mapperService, org.opensearch.index.mapper.MappedFieldType ft, org.opensearch.search.DocValueFormat format, Object sourceValue) throws IOException
      Use a ValueFetcher to extract values from doc values.
      Throws:
      IOException
    • registerParameters

      protected abstract void registerParameters(MapperTestCase.ParameterChecker checker) throws IOException
      Throws:
      IOException
    • testUpdates

      public void testUpdates() throws IOException
      Throws:
      IOException