Search in sources :

Example 26 with ConstraintRule

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

the class SchemaStorageTest method shouldReturnCorrectUniquenessRuleForLabelAndProperty.

@Test
public void shouldReturnCorrectUniquenessRuleForLabelAndProperty() throws SchemaRuleNotFoundException, DuplicateSchemaRuleException {
    // Given
    createSchema(uniquenessConstraint(LABEL1, PROP1), uniquenessConstraint(LABEL2, PROP1));
    // When
    ConstraintRule rule = storage.constraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(labelId(LABEL1), propId(PROP1)));
    // Then
    assertNotNull(rule);
    assertRule(rule, LABEL1, PROP1, ConstraintDescriptor.Type.UNIQUE);
}
Also used : ConstraintRule(org.neo4j.kernel.impl.store.record.ConstraintRule) Test(org.junit.Test)

Aggregations

ConstraintRule (org.neo4j.kernel.impl.store.record.ConstraintRule)26 Test (org.junit.Test)20 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)16 SchemaRuleUtil.uniquenessConstraintRule (org.neo4j.consistency.checking.SchemaRuleUtil.uniquenessConstraintRule)8 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)8 BatchTransactionApplier (org.neo4j.kernel.impl.api.BatchTransactionApplier)6 LabelTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.LabelTokenCommand)6 PropertyKeyTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.PropertyKeyTokenCommand)6 RelationshipTypeTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand)6 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)5 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)5 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)5 SchemaRuleUtil.constraintIndexRule (org.neo4j.consistency.checking.SchemaRuleUtil.constraintIndexRule)3 SchemaRuleUtil.nodePropertyExistenceConstraintRule (org.neo4j.consistency.checking.SchemaRuleUtil.nodePropertyExistenceConstraintRule)3 SchemaRuleUtil.relPropertyExistenceConstraintRule (org.neo4j.consistency.checking.SchemaRuleUtil.relPropertyExistenceConstraintRule)3 ConstraintDescriptor (org.neo4j.kernel.api.schema_new.constaints.ConstraintDescriptor)3 SchemaStore (org.neo4j.kernel.impl.store.SchemaStore)3 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)2 NodePropertyDescriptor (org.neo4j.kernel.api.schema.NodePropertyDescriptor)2 NeoStores (org.neo4j.kernel.impl.store.NeoStores)2