Search in sources :

Example 26 with RecordAccessStub

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);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 27 with RecordAccessStub

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);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 28 with RecordAccessStub

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NeoStoreRecord(org.neo4j.kernel.impl.store.record.NeoStoreRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 29 with RecordAccessStub

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);
}
Also used : RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 30 with RecordAccessStub

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);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) PropertyKeyTokenRecord(org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)38 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)38 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)38 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)16 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)13 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)12 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)9 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)8 NeoStoreRecord (org.neo4j.kernel.impl.store.record.NeoStoreRecord)5 LabelScanDocument (org.neo4j.consistency.store.synthetic.LabelScanDocument)4 ChainCheck (org.neo4j.consistency.checking.ChainCheck)3 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)3 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)3