use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldReportDuplicateDynamicLabels.
@Test
public void shouldReportDuplicateDynamicLabels() throws Exception {
// given
long[] labelIds = createLabels(100);
NodeRecord node = inUse(new NodeRecord(42, false, NONE, NONE));
add(node);
DynamicRecord labelsRecord1 = inUse(array(new DynamicRecord(1)));
DynamicRecord labelsRecord2 = inUse(array(new DynamicRecord(2)));
Collection<DynamicRecord> labelRecords = asList(labelsRecord1, labelsRecord2);
labelIds[12] = 11;
DynamicArrayStore.allocateFromNumbers(new ArrayList<>(), labelIds, new ReusableRecordsAllocator(52, labelRecords));
assertDynamicRecordChain(labelsRecord1, labelsRecord2);
node.setLabelField(DynamicNodeLabels.dynamicPointer(labelRecords), labelRecords);
addNodeDynamicLabels(labelsRecord1);
addNodeDynamicLabels(labelsRecord2);
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verify(report).labelDuplicate(11);
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class SchemaRecordCheckTest method shouldNotReportConstraintIndexRuleWithoutBackReference.
@Test
public void shouldNotReportConstraintIndexRuleWithoutBackReference() throws Exception {
// given
int ruleId = 1;
DynamicRecord record = inUse(dynamicRecord(ruleId));
SchemaIndexProvider.Descriptor providerDescriptor = new SchemaIndexProvider.Descriptor("in-memory", "1.0");
IndexRule rule = constraintIndexRule(ruleId, labelId, propertyKeyId, providerDescriptor);
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
verifyZeroInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class SchemaRecordCheckTest method shouldReportTwoUniquenessConstraintsReferencingSameIndex.
@Test
public void shouldReportTwoUniquenessConstraintsReferencingSameIndex() throws Exception {
// given
int ruleId1 = 0;
int ruleId2 = 1;
DynamicRecord record1 = inUse(dynamicRecord(ruleId1));
DynamicRecord record2 = inUse(dynamicRecord(ruleId2));
ConstraintRule rule1 = uniquenessConstraintRule(ruleId1, labelId, propertyKeyId, ruleId2);
ConstraintRule rule2 = uniquenessConstraintRule(ruleId2, labelId, propertyKeyId, ruleId2);
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.DynamicRecord in project neo4j by neo4j.
the class PropertyKeyTokenRecordCheckTest method shouldReportDynamicBlockNotInUse.
@Test
public void shouldReportDynamicBlockNotInUse() throws Exception {
// given
PropertyKeyTokenRecord key = inUse(new PropertyKeyTokenRecord(42));
DynamicRecord name = addKeyName(notInUse(new DynamicRecord(6)));
key.setNameId((int) name.getId());
// when
ConsistencyReport.PropertyKeyTokenConsistencyReport report = check(key);
// then
verify(report).nameBlockNotInUse(name);
verifyNoMoreInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class TransactionRecordState method createSchemaRule.
public void createSchemaRule(SchemaRule schemaRule) {
for (DynamicRecord change : recordChangeSet.getSchemaRuleChanges().create(schemaRule.getId(), schemaRule).forChangingData()) {
change.setInUse(true);
change.setCreated();
}
}
Aggregations