use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicRecordOwnedByPropertyAndOtherDynamic.
@Test
public void shouldReportDynamicRecordOwnedByPropertyAndOtherDynamic() 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.PropertyConsistencyReport propReport = check(ConsistencyReport.PropertyConsistencyReport.class, propChecker, property, records);
ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
// then
verifyNoMoreInteractions(propReport);
verify(dynReport).nextMultipleOwners(property);
verifyNoMoreInteractions(dynReport);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicRecordOwnedByRelationshipLabelAndOtherDynamicRecord.
@Test
public void shouldReportDynamicRecordOwnedByRelationshipLabelAndOtherDynamicRecord() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.RELATIONSHIP_TYPE);
RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> dynChecker = decorator.decorateDynamicChecker(RecordType.RELATIONSHIP_TYPE_NAME, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.RELATIONSHIP_TYPE));
RecordCheck<RelationshipTypeTokenRecord, ConsistencyReport.RelationshipTypeConsistencyReport> labelCheck = decorator.decorateRelationshipTypeTokenChecker(dummyRelationshipLabelCheck());
DynamicRecord owned = records.addRelationshipTypeName(inUse(string(new DynamicRecord(42))));
DynamicRecord dynamic = records.addRelationshipTypeName(inUse(string(new DynamicRecord(1))));
RelationshipTypeTokenRecord label = records.add(inUse(new RelationshipTypeTokenRecord(1)));
dynamic.setNextBlock(owned.getId());
label.setNameId((int) owned.getId());
// when
ConsistencyReport.RelationshipTypeConsistencyReport labelReport = check(ConsistencyReport.RelationshipTypeConsistencyReport.class, labelCheck, label, records);
ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
// then
verifyNoMoreInteractions(labelReport);
verify(dynReport).nextMultipleOwners(label);
verifyNoMoreInteractions(dynReport);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportNodeStoreReferencingSameChainAsNode.
@Test
public void shouldReportNodeStoreReferencingSameChainAsNode() 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.NodeConsistencyReport nodeReport = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node, records);
ConsistencyReport.NeoStoreConsistencyReport masterReport = check(ConsistencyReport.NeoStoreConsistencyReport.class, neoStoreCheck, master, records);
// then
verifyZeroInteractions(nodeReport);
verify(masterReport).multipleOwners(node);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportTwoRelationshipsWithSamePropertyChain.
@Test
public void shouldReportTwoRelationshipsWithSamePropertyChain() throws Exception {
// given
OwnerCheck decorator = new OwnerCheck(true);
RecordCheck<RelationshipRecord, ConsistencyReport.RelationshipConsistencyReport> relationshipChecker = decorator.decorateRelationshipChecker(dummyRelationshipChecker());
RecordAccessStub records = new RecordAccessStub();
RelationshipRecord relationship1 = records.add(inUse(new RelationshipRecord(1, 0, 1, 0)));
relationship1.setNextProp(7);
RelationshipRecord relationship2 = records.add(inUse(new RelationshipRecord(2, 0, 1, 0)));
relationship2.setNextProp(relationship1.getNextProp());
// when
ConsistencyReport.RelationshipConsistencyReport report1 = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship1, records);
ConsistencyReport.RelationshipConsistencyReport report2 = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship2, records);
// then
verifyZeroInteractions(report1);
verify(report2).multipleOwners(relationship1);
}
use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.
the class OwnerCheckTest method shouldReportDynamicStringRecordOwnedByTwoPropertyRecords.
@Test
public void shouldReportDynamicStringRecordOwnedByTwoPropertyRecords() throws Exception {
// given
RecordAccessStub records = new RecordAccessStub();
OwnerCheck decorator = new OwnerCheck(true, DynamicStore.STRING);
RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> propChecker = decorator.decoratePropertyChecker(dummyPropertyChecker());
DynamicRecord dynamic = records.add(inUse(string(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.STRING, dynamic.getId()));
property2.addPropertyBlock(propertyBlock(key, PropertyType.STRING, 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).stringMultipleOwners(property1);
verifyNoMoreInteractions(report2);
}
Aggregations