use of org.neo4j.consistency.checking.ChainCheck in project neo4j by neo4j.
the class DuplicatePropertyTest method shouldReportDuplicatePropertyIndexesInPropertyRecordForNode.
@Test
public void shouldReportDuplicatePropertyIndexesInPropertyRecordForNode() throws Exception {
// given
ChainCheck check = new ChainCheck();
RecordAccessStub records = new RecordAccessStub();
NodeRecord master = records.add(inUse(new NodeRecord(1, false, -1, 1)));
PropertyRecord propertyRecord = inUse(new PropertyRecord(1));
PropertyBlock firstBlock = new PropertyBlock();
firstBlock.setSingleBlock(1);
firstBlock.setKeyIndexId(1);
PropertyBlock secondBlock = new PropertyBlock();
secondBlock.setSingleBlock(1);
secondBlock.setKeyIndexId(2);
PropertyBlock thirdBlock = new PropertyBlock();
thirdBlock.setSingleBlock(1);
thirdBlock.setKeyIndexId(1);
propertyRecord.addPropertyBlock(firstBlock);
propertyRecord.addPropertyBlock(secondBlock);
propertyRecord.addPropertyBlock(thirdBlock);
records.add(propertyRecord);
// when
ConsistencyReport.NodeConsistencyReport report = mock(ConsistencyReport.NodeConsistencyReport.class);
CheckerEngine<NodeRecord, ConsistencyReport.NodeConsistencyReport> checkEngine = records.engine(master, report);
check.checkReference(master, propertyRecord, checkEngine, records);
// then
verify(report).propertyKeyNotUniqueInChain();
}
use of org.neo4j.consistency.checking.ChainCheck in project neo4j by neo4j.
the class DuplicatePropertyTest method shouldReportDuplicatePropertyIndexesAcrossRecordsInPropertyChainForNode.
@Test
public void shouldReportDuplicatePropertyIndexesAcrossRecordsInPropertyChainForNode() throws Exception {
// given
ChainCheck check = new ChainCheck();
RecordAccessStub records = new RecordAccessStub();
RelationshipRecord master = records.add(inUse(new RelationshipRecord(1, 2, 3, 4)));
master.setNextProp(1);
PropertyRecord firstRecord = inUse(new PropertyRecord(1));
firstRecord.setNextProp(12);
PropertyBlock firstBlock = new PropertyBlock();
firstBlock.setSingleBlock(1);
firstBlock.setKeyIndexId(1);
PropertyBlock secondBlock = new PropertyBlock();
secondBlock.setSingleBlock(1);
secondBlock.setKeyIndexId(2);
PropertyRecord secondRecord = inUse(new PropertyRecord(12));
secondRecord.setPrevProp(1);
PropertyBlock thirdBlock = new PropertyBlock();
thirdBlock.setSingleBlock(1);
thirdBlock.setKeyIndexId(4);
PropertyBlock fourthBlock = new PropertyBlock();
fourthBlock.setSingleBlock(1);
fourthBlock.setKeyIndexId(1);
firstRecord.addPropertyBlock(firstBlock);
firstRecord.addPropertyBlock(secondBlock);
secondRecord.addPropertyBlock(thirdBlock);
secondRecord.addPropertyBlock(fourthBlock);
records.add(firstRecord);
records.add(secondRecord);
// when
ConsistencyReport.RelationshipConsistencyReport report = mock(ConsistencyReport.RelationshipConsistencyReport.class);
CheckerEngine<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> checkEngine = records.engine(master, report);
check.checkReference(master, firstRecord, checkEngine, records);
records.checkDeferred();
// then
verify(report).propertyKeyNotUniqueInChain();
}
use of org.neo4j.consistency.checking.ChainCheck in project neo4j by neo4j.
the class DuplicatePropertyTest method shouldNotReportAnythingForConsistentChains.
@Test
public void shouldNotReportAnythingForConsistentChains() throws Exception {
// given
ChainCheck check = new ChainCheck();
RecordAccessStub records = new RecordAccessStub();
RelationshipRecord master = records.add(inUse(new RelationshipRecord(1, 2, 3, 4)));
master.setNextProp(1);
PropertyRecord firstRecord = inUse(new PropertyRecord(1));
firstRecord.setNextProp(12);
PropertyBlock firstBlock = new PropertyBlock();
firstBlock.setSingleBlock(1);
firstBlock.setKeyIndexId(1);
PropertyBlock secondBlock = new PropertyBlock();
secondBlock.setSingleBlock(1);
secondBlock.setKeyIndexId(2);
PropertyRecord secondRecord = inUse(new PropertyRecord(12));
secondRecord.setPrevProp(1);
PropertyBlock thirdBlock = new PropertyBlock();
thirdBlock.setSingleBlock(1);
thirdBlock.setKeyIndexId(4);
PropertyBlock fourthBlock = new PropertyBlock();
fourthBlock.setSingleBlock(11);
fourthBlock.setKeyIndexId(11);
firstRecord.addPropertyBlock(firstBlock);
firstRecord.addPropertyBlock(secondBlock);
secondRecord.addPropertyBlock(thirdBlock);
secondRecord.addPropertyBlock(fourthBlock);
records.add(firstRecord);
records.add(secondRecord);
// when
ConsistencyReport.RelationshipConsistencyReport report = mock(ConsistencyReport.RelationshipConsistencyReport.class);
CheckerEngine<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> checkEngine = records.engine(master, report);
check.checkReference(master, firstRecord, checkEngine, records);
records.checkDeferred();
// then
verifyZeroInteractions(report);
}
Aggregations