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));
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldReportLabelNotInUse.
@Test
public void shouldReportLabelNotInUse() throws Exception {
// given
NodeRecord node = inUse(new NodeRecord(42, false, NONE, NONE));
new InlineNodeLabels(node).add(1, null, null);
LabelTokenRecord labelRecordNotInUse = notInUse(new LabelTokenRecord(1));
add(labelRecordNotInUse);
add(node);
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verify(report).labelNotInUse(labelRecordNotInUse);
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldReportOutOfOrderLabels.
@Test
public void shouldReportOutOfOrderLabels() throws Exception {
// given
final NodeRecord node = inUse(new NodeRecord(42, false, NONE, NONE));
// We need to do this override so we can put the labels unsorted, since InlineNodeLabels always sorts on insert
new InlineNodeLabels(node) {
@Override
public Collection<DynamicRecord> put(long[] labelIds, NodeStore nodeStore, DynamicRecordAllocator allocator) {
return putSorted(node, labelIds, nodeStore, allocator);
}
}.put(new long[] { 3, 1, 2 }, null, null);
LabelTokenRecord label1 = inUse(new LabelTokenRecord(1));
LabelTokenRecord label2 = inUse(new LabelTokenRecord(2));
LabelTokenRecord label3 = inUse(new LabelTokenRecord(3));
add(label1);
add(label2);
add(label3);
add(node);
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verify(report).labelsOutOfOrder(3, 1);
}
Aggregations