use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportNodeWithReferenceToTheGraphGlobalChain.
@Test
public void shouldReportNodeWithReferenceToTheGraphGlobalChain() throws Exception {
// given
OwnerCheck decorator = new OwnerCheck(true);
RecordCheck<NodeRecord, ConsistencyReport.NodeConsistencyReport> nodeChecker = decorator.decorateNodeChecker(dummyNodeCheck());
RecordCheck<NeoStoreRecord, ConsistencyReport.NeoStoreConsistencyReport> neoStoreCheck = decorator.decorateNeoStoreChecker(dummyNeoStoreCheck());
RecordAccessStub records = new RecordAccessStub();
NodeRecord node = records.add(inUse(new NodeRecord(1, false, NONE, 7)));
NeoStoreRecord master = records.add(new NeoStoreRecord());
master.setNextProp(node.getNextProp());
// when
ConsistencyReport.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, neoStoreCheck, master, records);
ConsistencyReport.NodeConsistencyReport nodeReport = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node, records);
// then
verifyZeroInteractions(masterReport);
verify(nodeReport).multipleOwners(master);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicRecordOwnedByOtherDynamicRecordAndPropertyKey.
@Test
public void shouldReportDynamicRecordOwnedByOtherDynamicRecordAndPropertyKey() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.PROPERTY_KEY);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> dynChecker = decorator.decorateDynamicChecker(RecordType.PROPERTY_KEY_NAME, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.PROPERTY_KEY));
RecordCheck<PropertyKeyTokenRecord, ConsistencyReport.PropertyKeyTokenConsistencyReport> keyCheck = decorator.decoratePropertyKeyTokenChecker(dummyPropertyKeyCheck());
DynamicRecord owned = records.addPropertyKeyName(inUse(string(new DynamicRecord(42))));
DynamicRecord dynamic = records.addPropertyKeyName(inUse(string(new DynamicRecord(1))));
PropertyKeyTokenRecord key = records.add(inUse(new PropertyKeyTokenRecord(1)));
dynamic.setNextBlock(owned.getId());
key.setNameId((int) owned.getId());
// when
ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
ConsistencyReport.PropertyKeyTokenConsistencyReport keyReport = check(ConsistencyReport.PropertyKeyTokenConsistencyReport.class, keyCheck, key, records);
// then
verifyNoMoreInteractions(dynReport);
verify(keyReport).nameMultipleOwners(dynamic);
verifyNoMoreInteractions(keyReport);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldNotReportAnythingForNodesNotInUse.
@Test
public void shouldNotReportAnythingForNodesNotInUse() throws Exception {
// given
OwnerCheck decorator = new OwnerCheck(true);
RecordCheck<NodeRecord, ConsistencyReport.NodeConsistencyReport> nodeChecker = decorator.decorateNodeChecker(dummyNodeCheck());
RecordAccessStub records = new RecordAccessStub();
NodeRecord node1 = records.add(notInUse(new NodeRecord(1, false, NONE, 6)));
NodeRecord node2 = records.add(notInUse(new NodeRecord(2, false, NONE, 6)));
// when
ConsistencyReport.NodeConsistencyReport report1 = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node1, records);
ConsistencyReport.NodeConsistencyReport report2 = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node2, records);
// then
verifyZeroInteractions(report1);
verifyZeroInteractions(report2);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicRecordOwnedByTwoOtherDynamicRecords.
@Test
public void shouldReportDynamicRecordOwnedByTwoOtherDynamicRecords() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.STRING);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> checker = decorator.decorateDynamicChecker(RecordType.STRING_PROPERTY, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.STRING));
DynamicRecord record1 = records.add(inUse(string(new DynamicRecord(1))));
DynamicRecord record2 = records.add(inUse(string(new DynamicRecord(2))));
DynamicRecord record3 = records.add(inUse(string(new DynamicRecord(3))));
record1.setNextBlock(record3.getId());
record2.setNextBlock(record3.getId());
// when
ConsistencyReport.DynamicConsistencyReport report1 = check(ConsistencyReport.DynamicConsistencyReport.class, checker, record1, records);
ConsistencyReport.DynamicConsistencyReport report2 = check(ConsistencyReport.DynamicConsistencyReport.class, checker, record2, records);
// then
verifyNoMoreInteractions(report1);
verify(report2).nextMultipleOwners(record1);
verifyNoMoreInteractions(report2);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportOrphanedDynamicPropertyKeyRecord.
@Test
public void shouldReportOrphanedDynamicPropertyKeyRecord() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck owners = new OwnerCheck(true, DynamicStore.PROPERTY_KEY);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> stringCheck = owners.decorateDynamicChecker(RecordType.PROPERTY_KEY_NAME, dummyDynamicCheck(configureDynamicStore(60), DynamicStore.PROPERTY_KEY));
DynamicRecord record = string(inUse(new DynamicRecord(42)));
// when
ConsistencyReport.DynamicConsistencyReport report = check(ConsistencyReport.DynamicConsistencyReport.class, stringCheck, record, records);
owners.scanForOrphanChains(ProgressMonitorFactory.NONE);
records.checkDeferred();
// then
verify(report).orphanDynamicRecord();
}
Aggregations