Package org.apache.lucene.tests.geo
Class BaseXYPointTestCase
- java.lang.Object
-
- org.junit.Assert
-
- org.apache.lucene.tests.util.LuceneTestCase
-
- org.apache.lucene.tests.geo.BaseXYPointTestCase
-
public abstract class BaseXYPointTestCase extends LuceneTestCase
Abstract class to do basic tests for a xy spatial impl (high level fields and queries)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.tests.util.LuceneTestCase
LuceneTestCase.AwaitsFix, LuceneTestCase.BadApple, LuceneTestCase.Monster, LuceneTestCase.Nightly, LuceneTestCase.SuppressCodecs, LuceneTestCase.SuppressFileSystems, LuceneTestCase.SuppressFsync, LuceneTestCase.SuppressReproduceLine, LuceneTestCase.SuppressSysoutChecks, LuceneTestCase.SuppressTempFileChecks, LuceneTestCase.ThrowingConsumer<T>, LuceneTestCase.ThrowingRunnable, LuceneTestCase.Weekly
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringFIELD_NAME-
Fields 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 Constructor Description BaseXYPointTestCase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddPointToDoc(String field, Document doc, float x, float y)protected abstract QuerynewDistanceQuery(String field, float centerX, float centerY, float radius)protected abstract QuerynewGeometryQuery(String field, XYGeometry... geometries)protected abstract QuerynewPolygonQuery(String field, XYPolygon... polygon)protected abstract QuerynewRectQuery(String field, float minX, float maxX, float minY, float maxY)protected XYRectanglenextBox()protected XYGeometry[]nextGeometry()protected XYPolygonnextPolygon()protected floatnextX()protected floatnextY()voidtestAllXEqual()voidtestAllYEqual()voidtestBoxBasics()Add a single point and search for it in a boxvoidtestBoxInvalidCoordinates()voidtestBoxNull()null field name not allowedvoidtestDistanceBasics()test we can search for a pointvoidtestDistanceIllegal()distance query should not accept invalid x/y as originvoidtestDistanceInf()Inf distance queries are not allowedvoidtestDistanceNaN()NaN distance queries are not allowedvoidtestDistanceNegative()negative distance queries are not allowedvoidtestDistanceNull()null field name not allowedvoidtestEquals()voidtestIndexExtremeValues()Valid values that should not cause exceptionvoidtestIndexInfValues()Inf: illegalvoidtestIndexNaNValues()NaN: illegalvoidtestLowCardinality()voidtestMultiPolygonBasics()test we can search for a multi-polygonvoidtestMultiValued()voidtestPolygonBasics()test we can search for a polygonvoidtestPolygonHole()test we can search for a polygon with a hole (but still includes the doc)voidtestPolygonHoleExcludes()test we can search for a polygon with a hole (that excludes the doc)voidtestPolygonNullField()null field name not allowedvoidtestRandomBig()voidtestRandomDistance()Run a few iterations with just 10 docs, hopefully easy to debugvoidtestRandomDistanceHuge()Runs with thousands of docsvoidtestRandomMedium()voidtestRandomTiny()voidtestRectBoundariesAreInclusive()voidtestSamePointManyTimes()voidtestSmallSetDistance()voidtestSmallSetHugeDistance()Explicitly largevoidtestSmallSetMultiValued()voidtestSmallSetPoly()voidtestSmallSetPolyWholeSpace()voidtestSmallSetRect()voidtestSmallSetRect2()voidtestSmallSetTinyDistance()voidtestSmallSetWholeSpace()protected voidverifyRandomDistances(float[] xs, float[] ys)protected voidverifyRandomGeometries(float[] xs, float[] ys)protected voidverifyRandomPolygons(float[] xs, float[] ys)protected voidverifyRandomRectangles(float[] xs, float[] ys)-
Methods 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, getDataPath, 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, wrapReader
-
Methods 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, assertThat, assertThat, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
-
-
-
-
Field Detail
-
FIELD_NAME
protected static final String FIELD_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
nextX
protected float nextX()
-
nextY
protected float nextY()
-
nextBox
protected XYRectangle nextBox()
-
nextPolygon
protected XYPolygon nextPolygon()
-
nextGeometry
protected XYGeometry[] nextGeometry()
-
testIndexExtremeValues
public void testIndexExtremeValues()
Valid values that should not cause exception
-
testIndexNaNValues
public void testIndexNaNValues()
NaN: illegal
-
testIndexInfValues
public void testIndexInfValues()
Inf: illegal
-
testBoxBasics
public void testBoxBasics() throws ExceptionAdd a single point and search for it in a box- Throws:
Exception
-
testBoxNull
public void testBoxNull()
null field name not allowed
-
testBoxInvalidCoordinates
public void testBoxInvalidCoordinates() throws Exception- Throws:
Exception
-
testDistanceBasics
public void testDistanceBasics() throws Exceptiontest we can search for a point- Throws:
Exception
-
testDistanceNull
public void testDistanceNull()
null field name not allowed
-
testDistanceIllegal
public void testDistanceIllegal() throws Exceptiondistance query should not accept invalid x/y as origin- Throws:
Exception
-
testDistanceNegative
public void testDistanceNegative()
negative distance queries are not allowed
-
testDistanceNaN
public void testDistanceNaN()
NaN distance queries are not allowed
-
testDistanceInf
public void testDistanceInf()
Inf distance queries are not allowed
-
testPolygonBasics
public void testPolygonBasics() throws Exceptiontest we can search for a polygon- Throws:
Exception
-
testPolygonHole
public void testPolygonHole() throws Exceptiontest we can search for a polygon with a hole (but still includes the doc)- Throws:
Exception
-
testPolygonHoleExcludes
public void testPolygonHoleExcludes() throws Exceptiontest we can search for a polygon with a hole (that excludes the doc)- Throws:
Exception
-
testMultiPolygonBasics
public void testMultiPolygonBasics() throws Exceptiontest we can search for a multi-polygon- Throws:
Exception
-
testPolygonNullField
public void testPolygonNullField()
null field name not allowed
-
newRectQuery
protected abstract Query newRectQuery(String field, float minX, float maxX, float minY, float maxY)
-
newDistanceQuery
protected abstract Query newDistanceQuery(String field, float centerX, float centerY, float radius)
-
newGeometryQuery
protected abstract Query newGeometryQuery(String field, XYGeometry... geometries)
-
verifyRandomRectangles
protected void verifyRandomRectangles(float[] xs, float[] ys) throws Exception- Throws:
Exception
-
verifyRandomDistances
protected void verifyRandomDistances(float[] xs, float[] ys) throws Exception- Throws:
Exception
-
verifyRandomPolygons
protected void verifyRandomPolygons(float[] xs, float[] ys) throws Exception- Throws:
Exception
-
verifyRandomGeometries
protected void verifyRandomGeometries(float[] xs, float[] ys) throws Exception- Throws:
Exception
-
testRectBoundariesAreInclusive
public void testRectBoundariesAreInclusive() throws Exception- Throws:
Exception
-
testRandomDistance
public void testRandomDistance() throws ExceptionRun a few iterations with just 10 docs, hopefully easy to debug- Throws:
Exception
-
testRandomDistanceHuge
@Nightly public void testRandomDistanceHuge() throws Exception
Runs with thousands of docs- Throws:
Exception
-
testEquals
public void testEquals()
-
testSmallSetPolyWholeSpace
public void testSmallSetPolyWholeSpace() throws Exception- Throws:
Exception
-
-