use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicRecordOwnedByTwoPropertyKeys.
@Test
public void shouldReportDynamicRecordOwnedByTwoPropertyKeys() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.PROPERTY_KEY);
RecordCheck<PropertyKeyTokenRecord, ConsistencyReport.PropertyKeyTokenConsistencyReport> checker = decorator.decoratePropertyKeyTokenChecker(dummyPropertyKeyCheck());
DynamicRecord dynamic = records.addPropertyKeyName(inUse(string(new DynamicRecord(42))));
PropertyKeyTokenRecord record1 = records.add(inUse(new PropertyKeyTokenRecord(1)));
PropertyKeyTokenRecord record2 = records.add(inUse(new PropertyKeyTokenRecord(2)));
record1.setNameId((int) dynamic.getId());
record2.setNameId((int) dynamic.getId());
// when
ConsistencyReport.PropertyKeyTokenConsistencyReport report1 = check(ConsistencyReport.PropertyKeyTokenConsistencyReport.class, checker, record1, records);
ConsistencyReport.PropertyKeyTokenConsistencyReport report2 = check(ConsistencyReport.PropertyKeyTokenConsistencyReport.class, checker, record2, records);
// then
verifyNoMoreInteractions(report1);
verify(report2).nameMultipleOwners(record1);
verifyNoMoreInteractions(report2);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicStringRecordOwnedByOtherDynamicAndProperty.
@Test
public void shouldReportDynamicStringRecordOwnedByOtherDynamicAndProperty() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.STRING);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> dynChecker = decorator.decorateDynamicChecker(RecordType.STRING_PROPERTY, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.STRING));
RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> propChecker = decorator.decoratePropertyChecker(dummyPropertyChecker());
DynamicRecord owned = records.add(inUse(string(new DynamicRecord(42))));
DynamicRecord dynamic = records.add(inUse(string(new DynamicRecord(100))));
dynamic.setNextBlock(owned.getId());
PropertyRecord property = records.add(inUse(new PropertyRecord(1)));
PropertyKeyTokenRecord key = records.add(inUse(new PropertyKeyTokenRecord(10)));
property.addPropertyBlock(propertyBlock(key, PropertyType.STRING, owned.getId()));
// when
ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
ConsistencyReport.PropertyConsistencyReport propReport = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property, records);
// then
verifyNoMoreInteractions(dynReport);
verify(propReport).stringMultipleOwners(dynamic);
verifyNoMoreInteractions(dynReport);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportOrphanedDynamicArrayRecord.
@Test
public void shouldReportOrphanedDynamicArrayRecord() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck owners = new OwnerCheck(true, DynamicStore.ARRAY);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> stringCheck = owners.decorateDynamicChecker(RecordType.ARRAY_PROPERTY, dummyDynamicCheck(configureDynamicStore(60), DynamicStore.ARRAY));
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();
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldNotReportAnythingForNodesWithDifferentPropertyChains.
@Test
public void shouldNotReportAnythingForNodesWithDifferentPropertyChains() throws Exception {
// given
OwnerCheck decorator = new OwnerCheck(true);
RecordCheck<NodeRecord, ConsistencyReport.NodeConsistencyReport> nodeChecker = decorator.decorateNodeChecker(dummyNodeCheck());
RecordAccessStub records = new RecordAccessStub();
NodeRecord node1 = records.add(inUse(new NodeRecord(1, false, NONE, 7)));
NodeRecord node2 = records.add(inUse(new NodeRecord(2, false, NONE, 8)));
// 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 shouldReportNodeStoreReferencingSameChainAsRelationship.
@Test
public void shouldReportNodeStoreReferencingSameChainAsRelationship() throws Exception {
// given
OwnerCheck decorator = new OwnerCheck(true);
RecordCheck<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> relationshipChecker = decorator.decorateRelationshipChecker(dummyRelationshipChecker());
RecordCheck<NeoStoreRecord, ConsistencyReport.NeoStoreConsistencyReport> neoStoreCheck = decorator.decorateNeoStoreChecker(dummyNeoStoreCheck());
RecordAccessStub records = new RecordAccessStub();
NeoStoreRecord master = records.add(new NeoStoreRecord());
master.setNextProp(7);
RelationshipRecord relationship = records.add(inUse(new RelationshipRecord(1, 0, 1, 0)));
relationship.setNextProp(7);
// when
ConsistencyReport.RelationshipConsistencyReport relationshipReport = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship, records);
ConsistencyReport.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, neoStoreCheck, master, records);
// then
verifyZeroInteractions(relationshipReport);
verify(masterReport).multipleOwners(relationship);
}
Aggregations