use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicArrayRecordOwnedByTwoPropertyRecords.
@Test
public void shouldReportDynamicArrayRecordOwnedByTwoPropertyRecords() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.ARRAY);
RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> propChecker = decorator.decoratePropertyChecker(dummyPropertyChecker());
DynamicRecord dynamic = records.add(inUse(array(new DynamicRecord(42))));
PropertyRecord property1 = records.add(inUse(new PropertyRecord(1)));
PropertyRecord property2 = records.add(inUse(new PropertyRecord(2)));
PropertyKeyTokenRecord key = records.add(inUse(new PropertyKeyTokenRecord(10)));
property1.addPropertyBlock(propertyBlock(key, PropertyType.ARRAY, dynamic.getId()));
property2.addPropertyBlock(propertyBlock(key, PropertyType.ARRAY, dynamic.getId()));
// when
ConsistencyReport.PropertyConsistencyReport report1 = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property1, records);
ConsistencyReport.PropertyConsistencyReport report2 = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property2, records);
// then
verifyNoMoreInteractions(report1);
verify(report2).arrayMultipleOwners(property1);
verifyNoMoreInteractions(report2);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportOrphanedDynamicRelationshipLabelRecord.
@Test
public void shouldReportOrphanedDynamicRelationshipLabelRecord() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck owners = new OwnerCheck(true, DynamicStore.RELATIONSHIP_TYPE);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> stringCheck = owners.decorateDynamicChecker(RecordType.RELATIONSHIP_TYPE_NAME, dummyDynamicCheck(configureDynamicStore(60), DynamicStore.RELATIONSHIP_TYPE));
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 shouldNotReportOrphanIfOwnedByNode.
@Test
public void shouldNotReportOrphanIfOwnedByNode() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true);
PropertyRecord record = inUse(new PropertyRecord(42));
ConsistencyReport.PropertyConsistencyReport report = check(ConsistencyReport.PropertyConsistencyReport.class, decorator.decoratePropertyChecker(dummyPropertyChecker()), record, records);
ConsistencyReport.NodeConsistencyReport nodeReport = check(ConsistencyReport.NodeConsistencyReport.class, decorator.decorateNodeChecker(dummyNodeCheck()), inUse(new NodeRecord(10, false, NONE, 42)), records);
// when
decorator.scanForOrphanChains(ProgressMonitorFactory.NONE);
records.checkDeferred();
// then
verifyNoMoreInteractions(report);
verifyNoMoreInteractions(nodeReport);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldNotReportOrphanIfOwnedByNeoStore.
@Test
public void shouldNotReportOrphanIfOwnedByNeoStore() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true);
PropertyRecord record = inUse(new PropertyRecord(42));
ConsistencyReport.PropertyConsistencyReport report = check(ConsistencyReport.PropertyConsistencyReport.class, decorator.decoratePropertyChecker(dummyPropertyChecker()), record, records);
NeoStoreRecord master = inUse(new NeoStoreRecord());
master.setNextProp(42);
ConsistencyReport.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, decorator.decorateNeoStoreChecker(dummyNeoStoreCheck()), master, records);
// when
decorator.scanForOrphanChains(ProgressMonitorFactory.NONE);
records.checkDeferred();
// then
verifyNoMoreInteractions(report);
verifyNoMoreInteractions(masterReport);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicRecordOwnedByTwoRelationshipLabels.
@Test
public void shouldReportDynamicRecordOwnedByTwoRelationshipLabels() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.RELATIONSHIP_TYPE);
RecordCheck<RelationshipTypeTokenRecord, ConsistencyReport.RelationshipTypeConsistencyReport> checker = decorator.decorateRelationshipTypeTokenChecker(dummyRelationshipLabelCheck());
DynamicRecord dynamic = records.addRelationshipTypeName(inUse(string(new DynamicRecord(42))));
RelationshipTypeTokenRecord record1 = records.add(inUse(new RelationshipTypeTokenRecord(1)));
RelationshipTypeTokenRecord record2 = records.add(inUse(new RelationshipTypeTokenRecord(2)));
record1.setNameId((int) dynamic.getId());
record2.setNameId((int) dynamic.getId());
// when
ConsistencyReport.RelationshipTypeConsistencyReport report1 = check(ConsistencyReport.RelationshipTypeConsistencyReport.class, checker, record1, records);
ConsistencyReport.RelationshipTypeConsistencyReport report2 = check(ConsistencyReport.RelationshipTypeConsistencyReport.class, checker, record2, records);
// then
verifyNoMoreInteractions(report1);
verify(report2).nameMultipleOwners(record1);
verifyNoMoreInteractions(report2);
}
Aggregations