Search in sources :

Example 36 with RecordAccessStub

use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.

the class OwnerCheckTest method shouldNotReportAnythingForRelationshipsWithDifferentPropertyChains.

@Test
public void shouldNotReportAnythingForRelationshipsWithDifferentPropertyChains() 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(8);
    // when
    ConsistencyReport.RelationshipConsistencyReport report1 = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship1, records);
    ConsistencyReport.RelationshipConsistencyReport report2 = check(ConsistencyReport.RelationshipConsistencyReport.class, relationshipChecker, relationship2, records);
    // then
    verifyZeroInteractions(report1);
    verifyZeroInteractions(report2);
}
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 37 with RecordAccessStub

use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.

the class OwnerCheckTest method shouldReportOrphanPropertyChain.

@Test
public void shouldReportOrphanPropertyChain() throws Exception {
    // given
    RecordAccessStub records = new RecordAccessStub();
    OwnerCheck decorator = new OwnerCheck(true);
    RecordCheck<PropertyRecord, ConsistencyReport.PropertyConsistencyReport> checker = decorator.decoratePropertyChecker(dummyPropertyChecker());
    PropertyRecord record = inUse(new PropertyRecord(42));
    ConsistencyReport.PropertyConsistencyReport report = check(ConsistencyReport.PropertyConsistencyReport.class, checker, record, records);
    // when
    decorator.scanForOrphanChains(ProgressMonitorFactory.NONE);
    records.checkDeferred();
    // then
    verify(report).orphanPropertyChain();
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 38 with RecordAccessStub

use of org.neo4j.consistency.store.RecordAccessStub in project neo4j by neo4j.

the class OwnerCheckTest method shouldReportTwoNodesWithSamePropertyChain.

@Test
public void shouldReportTwoNodesWithSamePropertyChain() 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, 7)));
    // when
    ConsistencyReport.NodeConsistencyReport report1 = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node1, records);
    ConsistencyReport.NodeConsistencyReport report2 = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node2, records);
    // then
    verifyZeroInteractions(report1);
    verify(report2).multipleOwners(node1);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) 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