Search in sources :

Example 21 with IndexConfig

use of org.neo4j.internal.schema.IndexConfig in project neo4j by neo4j.

the class GenericNativeIndexProviderTest method mustCompleteIndexDescriptorConfigurationsWithSpatialConfig.

@Test
void mustCompleteIndexDescriptorConfigurationsWithSpatialConfig() {
    // Given
    DatabaseIndexContext context = DatabaseIndexContext.builder(null, null, DEFAULT_DATABASE_NAME).build();
    GenericNativeIndexProvider provider = new GenericNativeIndexProvider(context, IndexDirectoryStructure.NONE, null, Config.defaults());
    LabelSchemaDescriptor incompleteSchema = SchemaDescriptor.forLabel(1, 1);
    IndexDescriptor incompleteDescriptor = IndexPrototype.forSchema(incompleteSchema, IndexProviderDescriptor.UNDECIDED).withName("index").materialise(1);
    // When
    IndexDescriptor completedDescriptor = provider.completeConfiguration(incompleteDescriptor);
    // Then
    IndexConfig sinfulIndexConfig = incompleteDescriptor.getIndexConfig();
    IndexConfig completedIndexConfig = completedDescriptor.getIndexConfig();
    assertEquals(0, sinfulIndexConfig.entries().count(p -> true), "expected sinful index config to have no entries");
    for (CoordinateReferenceSystem crs : CoordinateReferenceSystem.all()) {
        assertNotNull(completedIndexConfig.get(spatialMinSettingForCrs(crs).getSettingName()));
        assertNotNull(completedIndexConfig.get(spatialMaxSettingForCrs(crs).getSettingName()));
    }
}
Also used : DoubleArray(org.neo4j.values.storable.DoubleArray) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) HashMap(java.util.HashMap) Config(org.neo4j.configuration.Config) IndexDirectoryStructure(org.neo4j.kernel.api.index.IndexDirectoryStructure) Value(org.neo4j.values.storable.Value) LabelSchemaDescriptor(org.neo4j.internal.schema.LabelSchemaDescriptor) IndexSettingUtil.spatialMinSettingForCrs(org.neo4j.graphdb.schema.IndexSettingUtil.spatialMinSettingForCrs) Values(org.neo4j.values.storable.Values) Test(org.junit.jupiter.api.Test) DEFAULT_DATABASE_NAME(org.neo4j.configuration.GraphDatabaseSettings.DEFAULT_DATABASE_NAME) IndexSettingUtil.spatialMaxSettingForCrs(org.neo4j.graphdb.schema.IndexSettingUtil.spatialMaxSettingForCrs) CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem) SchemaDescriptor(org.neo4j.internal.schema.SchemaDescriptor) IndexPrototype(org.neo4j.internal.schema.IndexPrototype) Map(java.util.Map) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) IndexProviderDescriptor(org.neo4j.internal.schema.IndexProviderDescriptor) IndexConfig(org.neo4j.internal.schema.IndexConfig) IndexConfig(org.neo4j.internal.schema.IndexConfig) LabelSchemaDescriptor(org.neo4j.internal.schema.LabelSchemaDescriptor) CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor) Test(org.junit.jupiter.api.Test)

Aggregations

IndexConfig (org.neo4j.internal.schema.IndexConfig)21 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)10 Test (org.junit.jupiter.api.Test)9 Value (org.neo4j.values.storable.Value)6 IndexProviderDescriptor (org.neo4j.internal.schema.IndexProviderDescriptor)5 LabelSchemaDescriptor (org.neo4j.internal.schema.LabelSchemaDescriptor)4 SchemaDescriptor (org.neo4j.internal.schema.SchemaDescriptor)4 CoordinateReferenceSystem (org.neo4j.values.storable.CoordinateReferenceSystem)4 HashMap (java.util.HashMap)3 IndexPrototype (org.neo4j.internal.schema.IndexPrototype)3 Path (java.nio.file.Path)2 StringJoiner (java.util.StringJoiner)2 Config (org.neo4j.configuration.Config)2 FulltextSchemaDescriptor (org.neo4j.internal.schema.FulltextSchemaDescriptor)2 KernelTransactionImplementation (org.neo4j.kernel.impl.api.KernelTransactionImplementation)2 SpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings)2 BooleanValue (org.neo4j.values.storable.BooleanValue)2 DoubleArray (org.neo4j.values.storable.DoubleArray)2 IntValue (org.neo4j.values.storable.IntValue)2 StringValue (org.neo4j.values.storable.StringValue)2