use of org.neo4j.internal.schema.ConstraintDescriptor in project neo4j by neo4j.
the class FullCheckIntegrationTest method createRelationshipPropertyExistenceConstraint.
private void createRelationshipPropertyExistenceConstraint(int relTypeId, int propertyKeyId) throws KernelException {
SchemaStore schemaStore = fixture.directStoreAccess().nativeStores().getSchemaStore();
ConstraintDescriptor rule = relPropertyExistenceConstraintRule(schemaStore.nextId(NULL), relTypeId, propertyKeyId);
writeToSchemaStore(schemaStore, rule);
}
use of org.neo4j.internal.schema.ConstraintDescriptor in project neo4j by neo4j.
the class FullCheckIntegrationTest method createUniquenessConstraintRule.
private void createUniquenessConstraintRule(final int labelId, final int... propertyKeyIds) throws KernelException {
SchemaStore schemaStore = fixture.directStoreAccess().nativeStores().getSchemaStore();
long ruleId1 = schemaStore.nextId(NULL);
long ruleId2 = schemaStore.nextId(NULL);
String name = "constraint_" + ruleId2;
IndexDescriptor indexRule = uniqueForSchema(forLabel(labelId, propertyKeyIds), DESCRIPTOR).withName(name).materialise(ruleId1).withOwningConstraintId(ruleId2);
ConstraintDescriptor uniqueRule = ConstraintDescriptorFactory.uniqueForLabel(labelId, propertyKeyIds).withId(ruleId2).withName(name).withOwnedIndexId(ruleId1);
writeToSchemaStore(schemaStore, indexRule);
writeToSchemaStore(schemaStore, uniqueRule);
}
use of org.neo4j.internal.schema.ConstraintDescriptor in project neo4j by neo4j.
the class ConstraintDescriptorFactoryTest method shouldCreateUniqueConstraintDescriptors.
@Test
void shouldCreateUniqueConstraintDescriptors() {
ConstraintDescriptor desc;
desc = ConstraintDescriptorFactory.uniqueForLabel(LABEL_ID, 1);
assertThat(desc.type()).isEqualTo(ConstraintType.UNIQUE);
assertThat(desc.schema()).isEqualTo(SchemaDescriptor.forLabel(LABEL_ID, 1));
}
use of org.neo4j.internal.schema.ConstraintDescriptor in project neo4j by neo4j.
the class ConstraintDescriptorFactoryTest method shouldCreateEqualDescriptors.
@Test
void shouldCreateEqualDescriptors() {
ConstraintDescriptor desc1;
ConstraintDescriptor desc2;
desc1 = ConstraintDescriptorFactory.uniqueForLabel(LABEL_ID, 1);
desc2 = ConstraintDescriptorFactory.uniqueForLabel(LABEL_ID, 1);
assertEquality(desc1, desc2);
desc1 = ConstraintDescriptorFactory.existsForLabel(LABEL_ID, 1);
desc2 = ConstraintDescriptorFactory.existsForLabel(LABEL_ID, 1);
assertEquality(desc1, desc2);
desc1 = ConstraintDescriptorFactory.existsForRelType(LABEL_ID, 1);
desc2 = ConstraintDescriptorFactory.existsForRelType(LABEL_ID, 1);
assertEquality(desc1, desc2);
}
use of org.neo4j.internal.schema.ConstraintDescriptor in project neo4j by neo4j.
the class ConstraintDescriptorFactoryTest method shouldCreateExistsConstraintDescriptors.
@Test
void shouldCreateExistsConstraintDescriptors() {
ConstraintDescriptor desc;
desc = ConstraintDescriptorFactory.existsForLabel(LABEL_ID, 1);
assertThat(desc.type()).isEqualTo(ConstraintType.EXISTS);
assertThat(desc.schema()).isEqualTo(SchemaDescriptor.forLabel(LABEL_ID, 1));
desc = ConstraintDescriptorFactory.existsForRelType(REL_TYPE_ID, 1);
assertThat(desc.type()).isEqualTo(ConstraintType.EXISTS);
assertThat(desc.schema()).isEqualTo(SchemaDescriptor.forRelType(REL_TYPE_ID, 1));
}
Aggregations