Search in sources :

Example 26 with UniquenessConstraintDescriptor

use of org.neo4j.internal.schema.constraints.UniquenessConstraintDescriptor in project neo4j by neo4j.

the class TxStateTest method shouldDifferentiateBetweenUniquenessConstraintsForDifferentLabels.

@Test
void shouldDifferentiateBetweenUniquenessConstraintsForDifferentLabels() {
    // when
    LabelSchemaDescriptor schema1 = forLabel(1, 17);
    UniquenessConstraintDescriptor constraint1 = ConstraintDescriptorFactory.uniqueForSchema(schema1);
    state.constraintDoAdd(constraint1, IndexPrototype.uniqueForSchema(schema1).withName("constraint_7").materialise(7));
    LabelSchemaDescriptor schema2 = forLabel(2, 17);
    UniquenessConstraintDescriptor constraint2 = ConstraintDescriptorFactory.uniqueForSchema(schema2);
    state.constraintDoAdd(constraint2, IndexPrototype.uniqueForSchema(schema2).withName("constraint_19").materialise(19));
    // then
    assertEquals(singleton(constraint1), state.constraintsChangesForLabel(1).getAdded());
    assertEquals(singleton(constraint2), state.constraintsChangesForLabel(2).getAdded());
}
Also used : LabelSchemaDescriptor(org.neo4j.internal.schema.LabelSchemaDescriptor) UniquenessConstraintDescriptor(org.neo4j.internal.schema.constraints.UniquenessConstraintDescriptor) RepeatedTest(org.junit.jupiter.api.RepeatedTest) Test(org.junit.jupiter.api.Test)

Aggregations

UniquenessConstraintDescriptor (org.neo4j.internal.schema.constraints.UniquenessConstraintDescriptor)26 Test (org.junit.jupiter.api.Test)17 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)10 LabelSchemaDescriptor (org.neo4j.internal.schema.LabelSchemaDescriptor)7 ConstraintDescriptor (org.neo4j.internal.schema.ConstraintDescriptor)6 NodeKeyConstraintDescriptor (org.neo4j.internal.schema.constraints.NodeKeyConstraintDescriptor)6 RepeatedTest (org.junit.jupiter.api.RepeatedTest)4 IndexBackedConstraintDescriptor (org.neo4j.internal.schema.constraints.IndexBackedConstraintDescriptor)4 RelationTypeSchemaDescriptor (org.neo4j.internal.schema.RelationTypeSchemaDescriptor)2 SchemaDescriptor (org.neo4j.internal.schema.SchemaDescriptor)2 NodeExistenceConstraintDescriptor (org.neo4j.internal.schema.constraints.NodeExistenceConstraintDescriptor)2 RelExistenceConstraintDescriptor (org.neo4j.internal.schema.constraints.RelExistenceConstraintDescriptor)2 KernelException (org.neo4j.exceptions.KernelException)1 UnspecifiedKernelException (org.neo4j.exceptions.UnspecifiedKernelException)1 ConstraintViolationException (org.neo4j.graphdb.ConstraintViolationException)1 PropertyKeyIdNotFoundKernelException (org.neo4j.internal.kernel.api.exceptions.PropertyKeyIdNotFoundKernelException)1 IndexNotApplicableKernelException (org.neo4j.internal.kernel.api.exceptions.schema.IndexNotApplicableKernelException)1 IndexNotFoundKernelException (org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException)1 MalformedSchemaRuleException (org.neo4j.internal.kernel.api.exceptions.schema.MalformedSchemaRuleException)1 SchemaKernelException (org.neo4j.internal.kernel.api.exceptions.schema.SchemaKernelException)1