@Override public ConstraintRule createUniquenessConstraintRule( long ruleId, UniquenessConstraintDescriptor descriptor, long indexId ) { return ConstraintRule.constraintRule( ruleId, descriptor, indexId ); }
private void assertEqualityByDescriptor( UniquenessConstraintDescriptor descriptor ) { ConstraintRule rule1 = ConstraintRule.constraintRule( RULE_ID, descriptor, RULE_ID_2 ); ConstraintRule rule2 = ConstraintRule.constraintRule( RULE_ID_2, descriptor ); assertEquality( rule1, rule2 ); }
private void assertEqualityByDescriptor( ConstraintDescriptor descriptor ) { ConstraintRule rule1 = ConstraintRule.constraintRule( RULE_ID, descriptor ); ConstraintRule rule2 = ConstraintRule.constraintRule( RULE_ID_2, descriptor ); assertEquality( rule1, rule2 ); } }
public static ConstraintRule nodePropertyExistenceConstraintRule( long ruleId, int labelId, int propertyId ) { return ConstraintRule.constraintRule( ruleId, ConstraintDescriptorFactory.existsForLabel( labelId, propertyId ) ); }
private static ConstraintRule uniquenessConstraintRule( long id, int labelId, int propertyKeyId, long ownedIndexRule ) { return ConstraintRule.constraintRule( id, ConstraintDescriptorFactory.uniqueForLabel( labelId, propertyKeyId ), ownedIndexRule ); } }
public static ConstraintRule relPropertyExistenceConstraintRule( long ruleId, int labelId, int propertyId ) { return ConstraintRule.constraintRule( ruleId, ConstraintDescriptorFactory.existsForRelType( labelId, propertyId ) ); }
public static ConstraintRule uniquenessConstraintRule( long ruleId, int labelId, int propertyId, long indexId ) { return ConstraintRule.constraintRule( ruleId, ConstraintDescriptorFactory.uniqueForLabel( labelId, propertyId ), indexId ); }
private ConstraintRule constraintExistsRule( long ruleId, int labelId, int... propertyIds ) { return ConstraintRule.constraintRule( ruleId, ConstraintDescriptorFactory.existsForLabel( labelId, propertyIds ) ); } }
@Test( expected = IllegalArgumentException.class ) public void constraintRuleNameMustNotBeTheEmptyString() { //noinspection RedundantStringConstructorCall String name = new String( "" ); ConstraintRule.constraintRule( RULE_ID, ConstraintDescriptorFactory.existsForLabel( LABEL_ID, PROPERTY_ID_1 ), name ); }
@Test( expected = IllegalArgumentException.class ) public void nodeKeyConstraintRuleNameMustNotBeTheEmptyString() { //noinspection RedundantStringConstructorCall String name = new String( "" ); ConstraintRule.constraintRule( RULE_ID, ConstraintDescriptorFactory.nodeKeyForLabel( LABEL_ID, PROPERTY_ID_1 ), RULE_ID_2, name ); }
@Test( expected = IllegalArgumentException.class ) public void uniquenessConstraintRuleNameMustNotContainNullCharacter() { String name = "a\0b"; ConstraintRule.constraintRule( RULE_ID, ConstraintDescriptorFactory.uniqueForLabel( LABEL_ID, PROPERTY_ID_1 ), RULE_ID_2, name ); }
@Test( expected = IllegalArgumentException.class ) public void constraintRuleNameMustNotContainNullCharacter() { String name = "a\0b"; ConstraintRule.constraintRule( RULE_ID, ConstraintDescriptorFactory.existsForLabel( LABEL_ID, PROPERTY_ID_1 ), name ); }
private void createNodePropertyExistenceConstraintRule( int labelId, int... propertyKeyIds ) { SchemaRule rule = ConstraintRule.constraintRule( schemaStore.nextId(), ConstraintDescriptorFactory.existsForLabel( labelId, propertyKeyIds ) ); for ( DynamicRecord record : schemaStore.allocateFrom( rule ) ) { schemaStore.updateRecord( record ); } schemaCache.addSchemaRule( rule ); labelsTouched = true; flushStrategy.forceFlush(); }
private void createRelTypePropertyExistenceConstraintRule( int relTypeId, int... propertyKeyIds ) { SchemaRule rule = ConstraintRule.constraintRule( schemaStore.nextId(), ConstraintDescriptorFactory.existsForRelType( relTypeId, propertyKeyIds ) ); for ( DynamicRecord record : schemaStore.allocateFrom( rule ) ) { schemaStore.updateRecord( record ); } schemaCache.addSchemaRule( rule ); flushStrategy.forceFlush(); }
private ConstraintRule getRelationshipPropertyExistenceConstraintRule( long id, String type, String property ) { return ConstraintRule.constraintRule( id, ConstraintDescriptorFactory.existsForRelType( typeId( type ), propId( property ) ) ); }
@Test public void shouldCreateNodeKeyConstraintWithOwnedIndex() { // GIVEN NodeKeyConstraintDescriptor descriptor = nodeKeyForLabel( LABEL_ID, PROPERTY_ID_1 ); ConstraintRule constraintRule = ConstraintRule.constraintRule( RULE_ID, descriptor, RULE_ID_2 ); // THEN assertThat( constraintRule.getConstraintDescriptor(), equalTo( descriptor ) ); assertThat( constraintRule.getOwnedIndex(), equalTo( RULE_ID_2 ) ); }
@Test public void shouldCreateUniquenessConstraintWithOwnedIndex() { // GIVEN UniquenessConstraintDescriptor descriptor = ConstraintDescriptorFactory.uniqueForLabel( LABEL_ID, PROPERTY_ID_1 ); ConstraintRule constraintRule = ConstraintRule.constraintRule( RULE_ID, descriptor, RULE_ID_2 ); // THEN assertThat( constraintRule.getConstraintDescriptor(), equalTo( descriptor ) ); assertThat( constraintRule.getOwnedIndex(), equalTo( RULE_ID_2 ) ); }
@Test public void shouldCreateNodeKeyConstraint() { // GIVEN ConstraintDescriptor descriptor = nodeKeyForLabel( LABEL_ID, PROPERTY_ID_1 ); ConstraintRule constraintRule = ConstraintRule.constraintRule( RULE_ID, descriptor ); // THEN assertThat( constraintRule.getId(), equalTo( RULE_ID ) ); assertThat( constraintRule.schema(), equalTo( descriptor.schema() ) ); assertThat( constraintRule.getConstraintDescriptor(), equalTo( descriptor ) ); assertException( constraintRule::getOwnedIndex, IllegalStateException.class ); }
@Test public void shouldCreateUniquenessConstraint() { // GIVEN ConstraintDescriptor descriptor = ConstraintDescriptorFactory.uniqueForLabel( LABEL_ID, PROPERTY_ID_1 ); ConstraintRule constraintRule = ConstraintRule.constraintRule( RULE_ID, descriptor ); // THEN assertThat( constraintRule.getId(), equalTo( RULE_ID ) ); assertThat( constraintRule.schema(), equalTo( descriptor.schema() ) ); assertThat( constraintRule.getConstraintDescriptor(), equalTo( descriptor ) ); assertException( constraintRule::getOwnedIndex, IllegalStateException.class ); }
@Test public void shouldCreateExistenceConstraint() { // GIVEN ConstraintDescriptor descriptor = existsForLabel( LABEL_ID, PROPERTY_ID_1 ); ConstraintRule constraintRule = ConstraintRule.constraintRule( RULE_ID, descriptor ); // THEN assertThat( constraintRule.getId(), equalTo( RULE_ID ) ); assertThat( constraintRule.schema(), equalTo( descriptor.schema() ) ); assertThat( constraintRule.getConstraintDescriptor(), equalTo( descriptor ) ); assertException( constraintRule::getOwnedIndex, IllegalStateException.class ); }