use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicRecordOwnedByPropertyKeyAndOtherDynamicRecord.
@Test
public void shouldReportDynamicRecordOwnedByPropertyKeyAndOtherDynamicRecord() 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.PropertyKeyTokenConsistencyReport keyReport = check(ConsistencyReport.PropertyKeyTokenConsistencyReport.class, keyCheck, key, records);
ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
// then
verifyNoMoreInteractions(keyReport);
verify(dynReport).nextMultipleOwners(key);
verifyNoMoreInteractions(dynReport);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportRelationshipWithReferenceToTheGraphGlobalChain.
@Test
public void shouldReportRelationshipWithReferenceToTheGraphGlobalChain() 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.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, neoStoreCheck, master, records);
ConsistencyReport.RelationshipConsistencyReport relationshipReport = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship, records);
// then
verifyZeroInteractions(masterReport);
verify(relationshipReport).multipleOwners(master);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportNodeWithSamePropertyChainAsRelationship.
@Test
public void shouldReportNodeWithSamePropertyChainAsRelationship() throws Exception {
// given
OwnerCheck decorator = new OwnerCheck(true);
RecordCheck<NodeRecord, ConsistencyReport.NodeConsistencyReport> nodeChecker = decorator.decorateNodeChecker(dummyNodeCheck());
RecordCheck<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> relationshipChecker = decorator.decorateRelationshipChecker(dummyRelationshipChecker());
RecordAccessStub records = new RecordAccessStub();
NodeRecord node = records.add(inUse(new NodeRecord(1, false, NONE, 7)));
RelationshipRecord relationship = records.add(inUse(new RelationshipRecord(1, 0, 1, 0)));
relationship.setNextProp(node.getNextProp());
// when
ConsistencyReport.RelationshipConsistencyReport relationshipReport = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship, records);
ConsistencyReport.NodeConsistencyReport nodeReport = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node, records);
// then
verifyZeroInteractions(relationshipReport);
verify(nodeReport).multipleOwners(relationship);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportOrphanedDynamicStringRecord.
@Test
public void shouldReportOrphanedDynamicStringRecord() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck owners = new OwnerCheck(true, DynamicStore.STRING);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> stringCheck = owners.decorateDynamicChecker(RecordType.STRING_PROPERTY, dummyDynamicCheck(configureDynamicStore(60), DynamicStore.STRING));
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 shouldReportDynamicArrayRecordOwnedByOtherDynamicAndProperty.
@Test
public void shouldReportDynamicArrayRecordOwnedByOtherDynamicAndProperty() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.ARRAY);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> dynChecker = decorator.decorateDynamicChecker(RecordType.ARRAY_PROPERTY, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.ARRAY));
RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> propChecker = decorator.decoratePropertyChecker(dummyPropertyChecker());
DynamicRecord owned = records.add(inUse(array(new DynamicRecord(42))));
DynamicRecord dynamic = records.add(inUse(array(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.ARRAY, 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).arrayMultipleOwners(dynamic);
verifyNoMoreInteractions(dynReport);
}
Aggregations