Class GeoGridAggregatorTestCase<T extends InternalGeoGridBucket>
java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase
org.elasticsearch.test.ESTestCase
org.elasticsearch.search.aggregations.AggregatorTestCase
org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregatorTestCase<T>
public abstract class GeoGridAggregatorTestCase<T extends InternalGeoGridBucket>
extends AggregatorTestCase
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.AggregatorTestCase
AggregatorTestCase.AggregationcContextSupplier, AggregatorTestCase.AggTestConfig, AggregatorTestCase.InternalAggCardinalityUpperBoundNested classes/interfaces inherited from class org.elasticsearch.test.ESTestCase
ESTestCase.DeprecationWarning, ESTestCase.GeohashGenerator, ESTestCase.TestAnalysis, ESTestCase.WithoutSecurityManagerNested classes/interfaces inherited from class org.apache.lucene.tests.util.LuceneTestCase
org.apache.lucene.tests.util.LuceneTestCase.AwaitsFix, org.apache.lucene.tests.util.LuceneTestCase.BadApple, org.apache.lucene.tests.util.LuceneTestCase.Monster, org.apache.lucene.tests.util.LuceneTestCase.Nightly, org.apache.lucene.tests.util.LuceneTestCase.SuppressCodecs, org.apache.lucene.tests.util.LuceneTestCase.SuppressFileSystems, org.apache.lucene.tests.util.LuceneTestCase.SuppressFsync, org.apache.lucene.tests.util.LuceneTestCase.SuppressReproduceLine, org.apache.lucene.tests.util.LuceneTestCase.SuppressSysoutChecks, org.apache.lucene.tests.util.LuceneTestCase.SuppressTempFileChecks, org.apache.lucene.tests.util.LuceneTestCase.ThrowingConsumer<T>, org.apache.lucene.tests.util.LuceneTestCase.ThrowingRunnable, org.apache.lucene.tests.util.LuceneTestCase.Weekly -
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.AggregatorTestCase
valuesSourceRegistryFields inherited from class org.elasticsearch.test.ESTestCase
checkIndexFailures, DEFAULT_TEST_WORKER_ID, failureAndSuccessEvents, FIPS_SYSPROP, JAVA_TIMEZONE_IDS, JAVA_ZONE_IDS, logger, MIN_PRIVATE_PORT, SAFE_AWAIT_TIMEOUT, TEST_REQUEST_TIMEOUT, TEST_WORKER_SYS_PROPERTY, TEST_WORKER_VM_ID, UNSIGNED_LONG_MAXFields inherited from class org.apache.lucene.tests.util.LuceneTestCase
assertsAreEnabled, classRules, DEFAULT_LINE_DOCS_FILE, INFOSTREAM, JENKINS_LARGE_LINE_DOCS_FILE, LEAVE_TEMPORARY, MAYBE_CACHE_POLICY, RANDOM_MULTIPLIER, ruleChain, suiteFailureMarker, SYSPROP_AWAITSFIX, SYSPROP_BADAPPLES, SYSPROP_FAILFAST, SYSPROP_MAXFAILURES, SYSPROP_MONSTER, SYSPROP_NIGHTLY, SYSPROP_WEEKLY, TEST_ASSERTS_ENABLED, TEST_AWAITSFIX, TEST_BADAPPLES, TEST_CODEC, TEST_DIRECTORY, TEST_DOCVALUESFORMAT, TEST_LINE_DOCS_FILE, TEST_MONSTER, TEST_NIGHTLY, TEST_POSTINGSFORMAT, TEST_THROTTLING, TEST_WEEKLY, VERBOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AggregationBuildercreateAggBuilderForTypeTest(MappedFieldType fieldType, String fieldName) This method is invoked each time a field type is tested inAggregatorTestCase.testSupportedFieldTypes().protected abstract GeoGridAggregationBuildercreateBuilder(String name) Create a new namedGeoGridAggregationBuilder-derived buildervoiddoAssertReducedMultiBucketConsumer(Aggregation agg, MultiBucketConsumerService.MultiBucketConsumer bucketConsumer) protected List<ValuesSourceType> Implementors should return a list ofValuesSourceTypethat the aggregator supports.protected abstract org.elasticsearch.geometry.RectanglegetTile(double lng, double lat, int precision) Return the bounding tile as aRectanglefor a given pointprotected abstract StringhashAsString(double lng, double lat, int precision) Convert geo point into a hash string (bucket string ID)protected abstract GeoBoundingBoxrandomBBox(int precision) Return a randomGeoBoundingBoxwithin the bounds of the tile grid.protected abstract org.elasticsearch.geometry.PointReturn a point within the bounds of the tile gridprotected abstract intGenerate a random precision according to the rules of the given aggregation.voidvoidvoidvoidprotected voidtestCase(org.apache.lucene.search.Query query, String field, int precision, GeoBoundingBox geoBoundingBox, Consumer<InternalGeoGrid<T>> verify, org.elasticsearch.core.CheckedConsumer<org.apache.lucene.tests.index.RandomIndexWriter, IOException> buildIndex) voidvoidvoidvoidvoidvoidvoidMethods inherited from class org.elasticsearch.search.aggregations.AggregatorTestCase
afterClose, aggCardinalityUpperBound, buildMockFieldMapper, cleanupReleasables, createAggregationContext, createAggregationContext, createAggregator, createAnalysisModule, createIndexSettings, dateField, debugTestCase, debugTestCase, doubleField, geoPointField, getMockScriptService, getSearchPlugins, initAnalysisRegistry, initPlugins, keywordField, longField, maybeWrapReaderEs, newRandomIndexWriterWithLogDocMergePolicy, objectMappers, rangeField, searchAndReduce, testCase, testSupportedFieldTypes, unsupportedMappedFieldTypes, verifyOutputFieldNames, withAggregator, withIndex, withNonMergingIndex, wrapDirectoryReader, wrapInMockESDirectoryReader, writableRegistryMethods inherited from class org.elasticsearch.test.ESTestCase
after, afterIfFailed, afterIfSuccessful, allBreakersMemoryReleased, asInstanceOf, assertArrayEquals, assertBusy, assertBusy, assertCriticalWarnings, assertEquals, assertLeakDetected, assertSettingDeprecationsAndWarnings, assertThat, assertThat, assertWarnings, assertWarnings, before, between, buildEnvSettings, buildNewFakeTransportAddress, captureLoggingLevel, checkStaticState, compatibleMediaType, copyInstance, copyNamedWriteable, copyNamedWriteable, copyWriteable, copyWriteable, createDefaultIndexAnalyzers, createParser, createParser, createParser, createParser, createParser, createParser, createParserWithCompatibilityFor, createTestAnalysis, createTestAnalysis, createTestAnalysis, createThreadPool, enableBigArraysReleasedCheck, enableWarningsCheck, ensureAllContextsReleased, ensureAllSearchContextsReleased, ensureCheckIndexPassed, ensureNoWarnings, ensureSupportedLocale, expectThrows, expectThrows, fail, fail, filteredWarnings, flushThreadPoolExecutor, frequently, generateRandomStringArray, generateRandomStringArray, getDataPath, getPortRange, getResourceDataPath, getSuiteFailureMarker, getTestTransportPlugin, getTestTransportType, getWorkerBasePort, indexSettings, indexSettings, inFipsJvm, initTestSeed, isTurkishLocale, iterations, maybeRestoreClassSecurityManager, maybeSet, maybeStashClassSecurityManager, mockScript, newEnvironment, newEnvironment, newLimitedBreaker, newNodeEnvironment, newNodeEnvironment, parserConfig, randomAlphanumericOfLength, randomAlphaOfLength, randomAlphaOfLengthBetween, randomAlphaOfLengthOrNull, randomArray, randomArray, randomBigInteger, randomBoolean, randomByte, randomByteArrayOfLength, randomByteBetween, randomBytesBetween, randomByteSizeValue, randomBytesReference, randomCompatibleMediaType, randomDateFormatterPattern, randomDouble, randomDoubleBetween, randomDoubles, randomDoubles, randomExecutor, randomFloat, randomFloatBetween, randomFloatOrNull, randomFrom, randomFrom, randomFrom, randomFrom, randomFrom, randomFrom, randomGeohash, randomIdentifier, randomInstantBetween, randomInt, randomInt, randomIntBetween, randomIntOrNull, randomInts, randomInts, randomIp, randomList, randomList, randomLong, randomLongBetween, randomLongOrNull, randomLongs, randomLongs, randomMap, randomMillisUpToYear9999, randomNegativeInt, randomNonEmptySubsetOf, randomNonNegativeByte, randomNonNegativeInt, randomNonNegativeIntOrNull, randomNonNegativeLong, randomNonNegativeLongOrNull, randomOptionalBoolean, randomPositiveTimeValue, randomRealisticUnicodeOfCodepointLength, randomRealisticUnicodeOfCodepointLengthBetween, randomRealisticUnicodeOfLength, randomRealisticUnicodeOfLengthBetween, randomSecretKey, randomSecureStringOfLength, randomSet, randomShort, randomSubsetOf, randomSubsetOf, randomSubsetOf, randomTimeValue, randomTimeValue, randomTimeValue, randomTimeZone, randomUnicodeOfCodepointLength, randomUnicodeOfCodepointLengthBetween, randomUnicodeOfLength, randomUnicodeOfLengthBetween, randomUnique, randomUnsignedLongBetween, randomUUID, randomValueOtherThan, randomValueOtherThanMany, randomVendorType, randomZone, removeHeaderWarningAppender, resetCheckIndexStatus, resetPortCounter, restoreContentType, restoreFileSystem, restoreLoggingLevel, runInParallel, safeAcquire, safeAcquire, safeAwait, safeAwait, safeAwait, safeAwait, safeAwait, safeAwaitAndUnwrapFailure, safeAwaitFailure, safeAwaitFailure, safeAwaitFailure, safeAwaitFailure, safeExecute, safeGet, safeGet, safeSleep, safeSleep, scaledRandomIntBetween, secureRandom, secureRandom, secureRandomFips, secureRandomFips, secureRandomNonFips, secureRandomNonFips, setContentType, setFileSystem, setHeaderWarningAppender, settings, shuffledList, shuffleMap, shuffleXContent, shuffleXContent, skipTestWaitingForLuceneFix, spinForAtLeastNMilliseconds, spinForAtLeastOneMillisecond, startInParallel, terminate, terminate, tmpPaths, toShuffledXContent, waitUntil, waitUntil, xContentRegistryMethods inherited from class org.apache.lucene.tests.util.LuceneTestCase
addVirusChecker, assertDeletedDocsEquals, assertDocsAndPositionsEnumEquals, assertDocsEnumEquals, assertDocsSkippingEquals, assertDocValuesEquals, assertDocValuesEquals, assertDoubleUlpEquals, assertFieldInfosEquals, assertFloatUlpEquals, assertNormsEquals, assertPointsEquals, assertPositionsSkippingEquals, assertReaderEquals, assertReaderStatisticsEquals, assertStoredFieldEquals, assertStoredFieldsEquals, assertTermsEnumEquals, assertTermsEquals, assertTermsEquals, assertTermsStatisticsEquals, assertTermStatsEquals, assertTermVectorsEquals, asSet, assumeFalse, assumeNoException, assumeTrue, assumeWorkingMMapOnWindows, atLeast, atLeast, callStackContains, callStackContains, callStackContainsAnyOf, closeAfterSuite, closeAfterTest, collate, createTempDir, createTempDir, createTempFile, createTempFile, dumpArray, dumpIterator, ensureSaneIWCOnNightly, expectThrows, expectThrows, expectThrows, expectThrowsAnyOf, expectThrowsAnyOf, getDataInputStream, getJvmForkArguments, getOnlyLeafReader, getTestClass, getTestName, hasWorkingMMapOnWindows, isTestThread, localeForLanguageTag, maybeChangeLiveIndexWriterConfig, maybeWrapReader, newAlcoholicMergePolicy, newAlcoholicMergePolicy, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newBytesRef, newDirectory, newDirectory, newDirectory, newDirectory, newDirectory, newField, newField, newFSDirectory, newFSDirectory, newIndexWriterConfig, newIndexWriterConfig, newIndexWriterConfig, newIOContext, newIOContext, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newLogMergePolicy, newMaybeVirusCheckingDirectory, newMaybeVirusCheckingFSDirectory, newMergePolicy, newMergePolicy, newMergePolicy, newMockDirectory, newMockDirectory, newMockDirectory, newMockFSDirectory, newMockFSDirectory, newSearcher, newSearcher, newSearcher, newSearcher, newSnapshotIndexWriterConfig, newStringField, newStringField, newStringField, newStringField, newTextField, newTextField, newTieredMergePolicy, newTieredMergePolicy, overrideDefaultQueryCache, overrideTestDefaultQueryCache, random, randomLocale, randomTimeZone, randomVectorFormat, rarely, rarely, replaceMaxFailureRule, resetDefaultQueryCache, restoreCPUCoreCount, restoreIndexWriterMaxDocs, runWithRestrictedPermissions, setIndexWriterMaxDocs, setUp, setupCPUCoreCount, setUpExecutorService, shutdownExecutorService, slowFileExists, tearDown, usually, usually, wrapReaderMethods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
-
Constructor Details
-
GeoGridAggregatorTestCase
public GeoGridAggregatorTestCase()
-
-
Method Details
-
randomPrecision
protected abstract int randomPrecision()Generate a random precision according to the rules of the given aggregation. -
hashAsString
Convert geo point into a hash string (bucket string ID) -
createBuilder
Create a new namedGeoGridAggregationBuilder-derived builder -
randomPoint
protected abstract org.elasticsearch.geometry.Point randomPoint()Return a point within the bounds of the tile grid -
randomBBox
Return a randomGeoBoundingBoxwithin the bounds of the tile grid. -
getTile
protected abstract org.elasticsearch.geometry.Rectangle getTile(double lng, double lat, int precision) Return the bounding tile as aRectanglefor a given point -
createAggBuilderForTypeTest
protected AggregationBuilder createAggBuilderForTypeTest(MappedFieldType fieldType, String fieldName) Description copied from class:AggregatorTestCaseThis method is invoked each time a field type is tested inAggregatorTestCase.testSupportedFieldTypes(). The field type and name are provided, and the implementor is expected to return an AggBuilder accordingly. The AggBuilder should be returned even if the aggregation does not support the field type, because the test will check if an exception is thrown in that case. The list of supported types are provided byAggregatorTestCase.getSupportedValuesSourceTypes(), which must also be implemented.- Overrides:
createAggBuilderForTypeTestin classAggregatorTestCase- Parameters:
fieldType- the type of the field that will be testedfieldName- the name of the field that will be test- Returns:
- an aggregation builder to test against the field
-
getSupportedValuesSourceTypes
Description copied from class:AggregatorTestCaseImplementors should return a list ofValuesSourceTypethat the aggregator supports. This is used to test the matrix of supported/unsupported field types against the aggregator and verify it works (or doesn't) as expected. If this method is implemented,AggregatorTestCase.createAggBuilderForTypeTest(MappedFieldType, String)should be implemented as well.- Overrides:
getSupportedValuesSourceTypesin classAggregatorTestCase- Returns:
- list of supported ValuesSourceTypes
-
testNoDocs
- Throws:
IOException
-
testUnmapped
- Throws:
IOException
-
testUnmappedMissing
- Throws:
IOException
-
testSingletonDocs
- Throws:
IOException
-
testBoundedSingletonDocs
- Throws:
IOException
-
testMultiValuedDocs
- Throws:
IOException
-
testBoundedMultiValuedDocs
- Throws:
IOException
-
testSingletonDocsAsSubAgg
- Throws:
IOException
-
testBoundedSingletonDocsAsSubAgg
- Throws:
IOException
-
testMultiValuedDocsAsSubAgg
- Throws:
IOException
-
testBoundedMultiValuedDocsAsSubAgg
- Throws:
IOException
-
testCase
protected void testCase(org.apache.lucene.search.Query query, String field, int precision, GeoBoundingBox geoBoundingBox, Consumer<InternalGeoGrid<T>> verify, org.elasticsearch.core.CheckedConsumer<org.apache.lucene.tests.index.RandomIndexWriter, IOException> buildIndex) throws IOException- Throws:
IOException
-
doAssertReducedMultiBucketConsumer
public void doAssertReducedMultiBucketConsumer(Aggregation agg, MultiBucketConsumerService.MultiBucketConsumer bucketConsumer) - Overrides:
doAssertReducedMultiBucketConsumerin classAggregatorTestCase
-