Skip to content

Commit

Permalink
NodeValueIndexCursorGenericTest
Browse files Browse the repository at this point in the history
- Replace old NodeValueIndexCursorInMemoryTest because in memory index does not exist any more
- Add read ValueCategory for all ValueGroups
- Remove spatialRangeSupport() because all index provider have spatial range support
- Add index order test for text array in NodeValueIndexCursorTestBase
  • Loading branch information
burqen committed Sep 20, 2018
1 parent abb0391 commit 5b0cfc9
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 47 deletions.
Expand Up @@ -45,12 +45,6 @@ protected String providerVersion()
return "1.0";
}

@Override
protected boolean spatialRangeSupport()
{
return true;
}

@Override
protected boolean indexProvidesStringValues()
{
Expand Down
Expand Up @@ -43,12 +43,6 @@ protected String providerVersion()
return "1.0";
}

@Override
protected boolean spatialRangeSupport()
{
return true;
}

@Override
protected boolean indexProvidesStringValues()
{
Expand Down
Expand Up @@ -43,12 +43,6 @@ protected String providerVersion()
return "2.0";
}

@Override
protected boolean spatialRangeSupport()
{
return true;
}

@Override
protected boolean indexProvidesStringValues()
{
Expand Down
Expand Up @@ -19,30 +19,28 @@
*/
package org.neo4j.kernel.impl.newapi;

public class NodeValueIndexCursorInMemoryTest extends AbstractNodeValueIndexCursorTest
import org.neo4j.graphdb.factory.GraphDatabaseSettings;

public class NodeValueIndexCursorGenericTest extends AbstractNodeValueIndexCursorTest
{
@Override
public ReadTestSupport newTestSupport()
{
return new ReadTestSupport();
ReadTestSupport readTestSupport = new ReadTestSupport();
readTestSupport.addSetting( GraphDatabaseSettings.default_schema_provider, GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10.providerIdentifier() );
return readTestSupport;
}

@Override
protected String providerKey()
{
return "lucene+native";
return GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10.providerName();
}

@Override
protected String providerVersion()
{
return "2.0";
}

@Override
protected boolean spatialRangeSupport()
{
return false;
return GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10.providerVersion();
}

@Override
Expand Down
Expand Up @@ -41,7 +41,6 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import static org.neo4j.graphdb.Label.label;
import static org.neo4j.values.storable.CoordinateReferenceSystem.Cartesian;
import static org.neo4j.values.storable.CoordinateReferenceSystem.Cartesian_3D;
Expand Down Expand Up @@ -133,7 +132,6 @@ void createTestGraph( GraphDatabaseService graphDb )
protected abstract void createCompositeIndex( GraphDatabaseService graphDb, String label, String... properties ) throws Exception;
protected abstract String providerKey();
protected abstract String providerVersion();
protected abstract boolean spatialRangeSupport();
protected abstract boolean indexProvidesStringValues();
protected abstract boolean indexProvidesNumericValues();

Expand Down Expand Up @@ -480,8 +478,6 @@ public void shouldPerformTemporalRangeSearch() throws KernelException
@Test
public void shouldPerformSpatialRangeSearch() throws KernelException
{
assumeTrue( spatialRangeSupport() );

// given
boolean needsValues = indexProvidesSpatialValues();
int label = token.nodeLabel( "Node" );
Expand Down Expand Up @@ -663,8 +659,6 @@ public void shouldRespectOrderCapabilitiesForTemporal() throws KernelException
@Test
public void shouldRespectOrderCapabilitiesForSpatial() throws KernelException
{
assumeTrue( spatialRangeSupport() );

// given
boolean needsValues = indexProvidesSpatialValues();
int label = token.nodeLabel( "Node" );
Expand All @@ -684,6 +678,30 @@ public void shouldRespectOrderCapabilitiesForSpatial() throws KernelException
}
}

@Test
public void shouldRespectOrderCapabilitiesForStringArray() throws KernelException
{
// given
boolean needsValues = indexProvidesSpatialValues();
int label = token.nodeLabel( "Node" );
int prop = token.propertyKey( "prop" );
IndexReference index = schemaRead.index( label, prop );
IndexOrder[] orderCapabilities = index.orderCapability( ValueCategory.TEXT_ARRAY );
try ( NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor() )
{
for ( IndexOrder orderCapability : orderCapabilities )
{
// when
read.nodeIndexSeek( index, node, orderCapability, needsValues, IndexQuery.range( prop,
Values.of( new String[]{"first", "second", "third"} ), true,
Values.of( new String[]{"fourth", "fifth", "sixth", "seventh"} ), true ) );

// then
assertFoundNodesInOrder( node, orderCapability );
}
}
}

@Test
public void shouldRespectOrderCapabilitiesForWildcard() throws Exception
{
Expand Down
Expand Up @@ -22,11 +22,15 @@
public enum ValueCategory
{
NUMBER,
NUMBER_ARRAY,
TEXT,
TEXT_ARRAY,
GEOMETRY,
TEMPORAL,
GEOMETRY_ARRAY,
REST,
TEMPORAL,
TEMPORAL_ARRAY,
BOOLEAN,
BOOLEAN_ARRAY,
UNKNOWN,
NO_CATEGORY
}
Expand Up @@ -20,8 +20,8 @@
package org.neo4j.values.storable;

import static org.neo4j.values.storable.ValueCategory.NO_CATEGORY;
import static org.neo4j.values.storable.ValueCategory.REST;
import static org.neo4j.values.storable.ValueCategory.TEMPORAL;
import static org.neo4j.values.storable.ValueCategory.TEMPORAL_ARRAY;

/**
* The ValueGroup is the logical group or type of a Value. For example byte, short, int and long are all attempting
Expand All @@ -37,15 +37,15 @@ public enum ValueGroup
{
UNKNOWN( ValueCategory.UNKNOWN ),
GEOMETRY_ARRAY( ValueCategory.GEOMETRY_ARRAY ),
ZONED_DATE_TIME_ARRAY( REST ),
LOCAL_DATE_TIME_ARRAY( REST ),
DATE_ARRAY( REST ),
ZONED_TIME_ARRAY( REST ),
LOCAL_TIME_ARRAY( REST ),
DURATION_ARRAY( REST ),
TEXT_ARRAY( REST ),
BOOLEAN_ARRAY( REST ),
NUMBER_ARRAY( REST ),
ZONED_DATE_TIME_ARRAY( TEMPORAL_ARRAY ),
LOCAL_DATE_TIME_ARRAY( TEMPORAL_ARRAY ),
DATE_ARRAY( TEMPORAL_ARRAY ),
ZONED_TIME_ARRAY( TEMPORAL_ARRAY ),
LOCAL_TIME_ARRAY( TEMPORAL_ARRAY ),
DURATION_ARRAY( TEMPORAL_ARRAY ),
TEXT_ARRAY( ValueCategory.TEXT_ARRAY ),
BOOLEAN_ARRAY( ValueCategory.BOOLEAN_ARRAY ),
NUMBER_ARRAY( ValueCategory.NUMBER_ARRAY ),
GEOMETRY( ValueCategory.GEOMETRY ),
ZONED_DATE_TIME( TEMPORAL ),
LOCAL_DATE_TIME( TEMPORAL ),
Expand All @@ -54,7 +54,7 @@ public enum ValueGroup
LOCAL_TIME( TEMPORAL ),
DURATION( TEMPORAL ),
TEXT( ValueCategory.TEXT ),
BOOLEAN( REST ),
BOOLEAN( ValueCategory.BOOLEAN ),
NUMBER( ValueCategory.NUMBER ),
NO_VALUE( NO_CATEGORY );

Expand Down

0 comments on commit 5b0cfc9

Please sign in to comment.