Search in sources :

Example 46 with IndexRule

use of org.neo4j.kernel.impl.store.record.IndexRule in project neo4j by neo4j.

the class SchemaStoreTest method storeAndLoadCompositeSchemaRule.

@Test
public void storeAndLoadCompositeSchemaRule() throws Exception {
    // GIVEN
    int[] propertyIds = { 4, 5, 6, 7 };
    IndexRule indexRule = IndexRule.indexRule(store.nextId(), NewIndexDescriptorFactory.forLabel(2, propertyIds), PROVIDER_DESCRIPTOR);
    // WHEN
    IndexRule readIndexRule = (IndexRule) SchemaRuleSerialization.deserialize(indexRule.getId(), wrap(indexRule.serialize()));
    // THEN
    assertEquals(indexRule.getId(), readIndexRule.getId());
    assertEquals(indexRule.schema(), readIndexRule.schema());
    assertEquals(indexRule.getIndexDescriptor(), readIndexRule.getIndexDescriptor());
    assertEquals(indexRule.getProviderDescriptor(), readIndexRule.getProviderDescriptor());
}
Also used : IndexRule(org.neo4j.kernel.impl.store.record.IndexRule) Test(org.junit.Test)

Example 47 with IndexRule

use of org.neo4j.kernel.impl.store.record.IndexRule in project neo4j by neo4j.

the class SchemaStoreTest method storeAndLoad_Big_CompositeSchemaRule.

@Test
public void storeAndLoad_Big_CompositeSchemaRule() throws Exception {
    // GIVEN
    IndexRule indexRule = IndexRule.indexRule(store.nextId(), NewIndexDescriptorFactory.forLabel(2, IntStream.range(1, 200).toArray()), PROVIDER_DESCRIPTOR);
    // WHEN
    IndexRule readIndexRule = (IndexRule) SchemaRuleSerialization.deserialize(indexRule.getId(), wrap(indexRule.serialize()));
    // THEN
    assertEquals(indexRule.getId(), readIndexRule.getId());
    assertEquals(indexRule.schema(), readIndexRule.schema());
    assertEquals(indexRule.getIndexDescriptor(), readIndexRule.getIndexDescriptor());
    assertEquals(indexRule.getProviderDescriptor(), readIndexRule.getProviderDescriptor());
}
Also used : IndexRule(org.neo4j.kernel.impl.store.record.IndexRule) Test(org.junit.Test)

Aggregations

IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)47 Test (org.junit.Test)30 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)20 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)19 SchemaRuleUtil.constraintIndexRule (org.neo4j.consistency.checking.SchemaRuleUtil.constraintIndexRule)10 NodePropertyDescriptor (org.neo4j.kernel.api.schema.NodePropertyDescriptor)9 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)9 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)9 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)8 ConstraintRule (org.neo4j.kernel.impl.store.record.ConstraintRule)8 BatchTransactionApplier (org.neo4j.kernel.impl.api.BatchTransactionApplier)7 LabelTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.LabelTokenCommand)7 PropertyKeyTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.PropertyKeyTokenCommand)7 RelationshipTypeTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand)7 ArrayList (java.util.ArrayList)6 SchemaStorage (org.neo4j.kernel.impl.store.SchemaStorage)6 NewIndexDescriptor (org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor)4 IndexSamplingConfig (org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig)4 SchemaStore (org.neo4j.kernel.impl.store.SchemaStore)4 SchemaRule (org.neo4j.storageengine.api.schema.SchemaRule)4