use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class LabelTokenRecordCheckTest method shouldNotReportAnythingForRecordNotInUse.
@Test
public void shouldNotReportAnythingForRecordNotInUse() throws Exception {
// given
LabelTokenRecord key = notInUse(new LabelTokenRecord(42));
// when
ConsistencyReport.LabelTokenConsistencyReport report = check(key);
// then
verifyNoMoreInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class SchemaRecordCheckTest method shouldReportTwoConstraintIndexesReferencingSameConstraint.
@Test
public void shouldReportTwoConstraintIndexesReferencingSameConstraint() throws Exception {
// given
int ruleId1 = 0;
int ruleId2 = 1;
DynamicRecord record1 = inUse(dynamicRecord(ruleId1));
DynamicRecord record2 = inUse(dynamicRecord(ruleId2));
SchemaIndexProvider.Descriptor providerDescriptor = new SchemaIndexProvider.Descriptor("in-memory", "1.0");
IndexRule rule1 = constraintIndexRule(ruleId1, labelId, propertyKeyId, providerDescriptor, (long) ruleId1);
IndexRule rule2 = constraintIndexRule(ruleId2, labelId, propertyKeyId, providerDescriptor, (long) ruleId1);
when(checker().ruleAccess.loadSingleSchemaRule(ruleId1)).thenReturn(rule1);
when(checker().ruleAccess.loadSingleSchemaRule(ruleId2)).thenReturn(rule2);
add(inUse(new LabelTokenRecord(labelId)));
add(inUse(new PropertyKeyTokenRecord(propertyKeyId)));
// when
check(record1);
ConsistencyReport.SchemaConsistencyReport report = check(record2);
// then
verify(report).duplicateObligation(record1);
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class SchemaRecordCheckTest method shouldReportUnreferencedUniquenessConstraint.
@Test
public void shouldReportUnreferencedUniquenessConstraint() throws Exception {
// given
int ruleId = 0;
DynamicRecord record = inUse(dynamicRecord(ruleId));
ConstraintRule rule = uniquenessConstraintRule(ruleId, labelId, propertyKeyId, ruleId);
when(checker().ruleAccess.loadSingleSchemaRule(ruleId)).thenReturn(rule);
add(inUse(new LabelTokenRecord(labelId)));
add(inUse(new PropertyKeyTokenRecord(propertyKeyId)));
// when
check(record);
SchemaRecordCheck obligationChecker = checker().forObligationChecking();
ConsistencyReport.SchemaConsistencyReport report = check(obligationChecker, record);
// then
verify(report).missingObligation(SchemaRule.Kind.CONSTRAINT_INDEX_RULE);
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class SchemaRecordCheckTest method shouldReportConstraintIndexNotReferencingBack.
@Test
public void shouldReportConstraintIndexNotReferencingBack() throws Exception {
// given
int ruleId1 = 0;
int ruleId2 = 1;
DynamicRecord record1 = inUse(dynamicRecord(ruleId1));
DynamicRecord record2 = inUse(dynamicRecord(ruleId2));
SchemaIndexProvider.Descriptor providerDescriptor = new SchemaIndexProvider.Descriptor("in-memory", "1.0");
IndexRule rule1 = constraintIndexRule(ruleId1, labelId, propertyKeyId, providerDescriptor, (long) ruleId1);
ConstraintRule rule2 = uniquenessConstraintRule(ruleId2, labelId, propertyKeyId, ruleId1);
when(checker().ruleAccess.loadSingleSchemaRule(ruleId1)).thenReturn(rule1);
when(checker().ruleAccess.loadSingleSchemaRule(ruleId2)).thenReturn(rule2);
add(inUse(new LabelTokenRecord(labelId)));
add(inUse(new PropertyKeyTokenRecord(propertyKeyId)));
// when
check(record1);
check(record2);
SchemaRecordCheck obligationChecker = checker().forObligationChecking();
ConsistencyReport.SchemaConsistencyReport report = check(obligationChecker, record1);
check(obligationChecker, record2);
// then
verify(report).constraintIndexRuleNotReferencingBack(record2);
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class TransactionWriter method label.
public void label(int id, String name, int... dynamicIds) {
LabelTokenRecord before = new LabelTokenRecord(id);
LabelTokenRecord after = withName(new LabelTokenRecord(id), dynamicIds, name);
otherCommands.add(new Command.LabelTokenCommand(before, after));
}
Aggregations