Class AbstractScriptFieldTypeTestCase

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

public abstract class AbstractScriptFieldTypeTestCase extends MapperServiceTestCase
  • Constructor Details

    • AbstractScriptFieldTypeTestCase

      public AbstractScriptFieldTypeTestCase()
  • Method Details

    • simpleMappedFieldType

      protected abstract MappedFieldType simpleMappedFieldType()
    • loopFieldType

      protected abstract MappedFieldType loopFieldType()
    • typeName

      protected abstract String typeName()
    • addDocument

      protected static <T extends org.apache.lucene.index.IndexableField> void addDocument(org.apache.lucene.tests.index.RandomIndexWriter iw, Iterable<T> indexableFields) throws IOException
      Add the provided document to the provided writer, and randomly flush. This is useful for situations where there are not enough documents indexed to trigger random flush and commit performed by RandomIndexWriter. Flushing is important to obtain multiple slices and inter-segment concurrency.
      Throws:
      IOException
    • testMinimalSerializesToItself

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

      public final void testMeta() throws IOException
      Throws:
      IOException
    • testMinimalMappingToMaximal

      public final void testMinimalMappingToMaximal() throws IOException
      Throws:
      IOException
    • testCopyToIsNotSupported

      public void testCopyToIsNotSupported() throws IOException
      Throws:
      IOException
    • testMultiFieldsIsNotSupported

      public void testMultiFieldsIsNotSupported() throws IOException
      Throws:
      IOException
    • testStoredScriptsAreNotSupported

      public void testStoredScriptsAreNotSupported() throws Exception
      Throws:
      Exception
    • testFieldCaps

      public void testFieldCaps() throws Exception
      Throws:
      Exception
    • testOnScriptError

      public final void testOnScriptError() throws IOException
      Check that running query on a runtime field script that fails has the expected behaviour according to its configuration
      Throws:
      IOException
    • testOnScriptErrorFail

      public final void testOnScriptErrorFail() throws IOException
      Throws:
      IOException
    • testFieldHasValue

      public void testFieldHasValue()
      Overrides:
      testFieldHasValue in class FieldTypeTestCase
    • testFieldHasValueWithEmptyFieldInfos

      public void testFieldHasValueWithEmptyFieldInfos()
      Overrides:
      testFieldHasValueWithEmptyFieldInfos in class FieldTypeTestCase
    • getMappedFieldType

      public MappedFieldType getMappedFieldType()
      Overrides:
      getMappedFieldType in class FieldTypeTestCase
    • build

      protected abstract AbstractScriptFieldType<?> build(String error, Map<String,Object> emptyMap, OnScriptError onScriptError)
    • testDocValues

      public abstract void testDocValues() throws IOException
      Throws:
      IOException
    • testSort

      public abstract void testSort() throws IOException
      Throws:
      IOException
    • testUsedInScript

      public abstract void testUsedInScript() throws IOException
      Throws:
      IOException
    • testExistsQuery

      public abstract void testExistsQuery() throws IOException
      Throws:
      IOException
    • testRangeQuery

      public abstract void testRangeQuery() throws IOException
      Throws:
      IOException
    • randomRangeQuery

      protected abstract org.apache.lucene.search.Query randomRangeQuery(MappedFieldType ft, SearchExecutionContext ctx)
    • testTermQuery

      public abstract void testTermQuery() throws IOException
      Throws:
      IOException
    • randomTermQuery

      protected abstract org.apache.lucene.search.Query randomTermQuery(MappedFieldType ft, SearchExecutionContext ctx)
    • testTermsQuery

      public abstract void testTermsQuery() throws IOException
      Throws:
      IOException
    • randomTermsQuery

      protected abstract org.apache.lucene.search.Query randomTermsQuery(MappedFieldType ft, SearchExecutionContext ctx)
    • mockContext

      protected static SearchExecutionContext mockContext()
    • mockFielddataContext

      protected static FieldDataContext mockFielddataContext()
    • mockContext

      protected static SearchExecutionContext mockContext(boolean allowExpensiveQueries)
    • supportsTermQueries

      protected boolean supportsTermQueries()
    • supportsRangeQueries

      protected boolean supportsRangeQueries()
    • mockContext

      protected static SearchExecutionContext mockContext(boolean allowExpensiveQueries, MappedFieldType mappedFieldType)
    • mockContext

      protected static SearchExecutionContext mockContext(boolean allowExpensiveQueries, MappedFieldType mappedFieldType, SourceProvider sourceProvider)
    • testExistsQueryIsExpensive

      public void testExistsQueryIsExpensive()
    • testExistsQueryInLoop

      public void testExistsQueryInLoop()
    • testRangeQueryWithShapeRelationIsError

      public void testRangeQueryWithShapeRelationIsError()
    • testRangeQueryIsExpensive

      public void testRangeQueryIsExpensive()
    • testRangeQueryInLoop

      public void testRangeQueryInLoop()
    • testTermQueryIsExpensive

      public void testTermQueryIsExpensive()
    • testTermQueryInLoop

      public void testTermQueryInLoop()
    • testTermsQueryIsExpensive

      public void testTermsQueryIsExpensive()
    • testTermsQueryInLoop

      public void testTermsQueryInLoop()
    • testPhraseQueryIsError

      public void testPhraseQueryIsError()
    • testPhrasePrefixQueryIsError

      public void testPhrasePrefixQueryIsError()
    • testMultiPhraseQueryIsError

      public void testMultiPhraseQueryIsError()
    • testSpanPrefixQueryIsError

      public void testSpanPrefixQueryIsError()
    • testCacheable

      public final void testCacheable() throws IOException
      Throws:
      IOException
    • blockLoaderReadValuesFromColumnAtATimeReader

      protected final List<Object> blockLoaderReadValuesFromColumnAtATimeReader(org.apache.lucene.index.DirectoryReader reader, MappedFieldType fieldType) throws IOException
      Throws:
      IOException
    • blockLoaderReadValuesFromRowStrideReader

      protected final List<Object> blockLoaderReadValuesFromRowStrideReader(org.apache.lucene.index.DirectoryReader reader, MappedFieldType fieldType) throws IOException
      Throws:
      IOException
    • readSource

      protected final String readSource(org.apache.lucene.index.IndexReader reader, int docId) throws IOException
      Throws:
      IOException
    • checkExpensiveQuery

      protected final void checkExpensiveQuery(BiConsumer<MappedFieldType,SearchExecutionContext> queryBuilder)
    • checkLoop

      protected final void checkLoop(BiConsumer<MappedFieldType,SearchExecutionContext> queryBuilder)
    • minimalMapping

      protected final void minimalMapping(org.elasticsearch.xcontent.XContentBuilder b) throws IOException
      Throws:
      IOException
    • parseFromSource

      protected abstract ScriptFactory parseFromSource()
    • dummyScript

      protected abstract ScriptFactory dummyScript()
    • compileScript

      protected <T> T compileScript(Script script, ScriptContext<T> context)
      Description copied from class: MapperServiceTestCase
      This is the injection point for tests that require mock scripts. Test cases should override this to return the mock script factory of their choice.
      Overrides:
      compileScript in class MapperServiceTestCase