Search in sources :

Example 1 with DynamicLabelConsistencyReport

use of org.neo4j.consistency.report.ConsistencyReport.DynamicLabelConsistencyReport in project neo4j by neo4j.

the class NodeDynamicLabelOrphanChainStartCheckTest method shouldReportMissingOwnerId.

@Test
public void shouldReportMissingOwnerId() throws Exception {
    // given
    DynamicRecord record = new DynamicRecord(0);
    inUse(record);
    allocateFromNumbers(new ArrayList<>(), new long[] {}, new ReusableRecordsAllocator(66, record));
    // when
    DynamicLabelConsistencyReport report = check(record);
    // then
    verify(report).orphanDynamicLabelRecord();
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) ReusableRecordsAllocator(org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator) DynamicLabelConsistencyReport(org.neo4j.consistency.report.ConsistencyReport.DynamicLabelConsistencyReport) Test(org.junit.Test)

Example 2 with DynamicLabelConsistencyReport

use of org.neo4j.consistency.report.ConsistencyReport.DynamicLabelConsistencyReport in project neo4j by neo4j.

the class NodeDynamicLabelOrphanChainStartCheckTest method shouldReportOwningNodeRecordNotInUse.

@Test
public void shouldReportOwningNodeRecordNotInUse() throws Exception {
    // given
    NodeRecord nodeRecord = notInUse(new NodeRecord(12L, false, -1, -1));
    add(nodeRecord);
    DynamicRecord nodeDynamicLabelRecord = inUse(new DynamicRecord(0));
    allocateFromNumbers(new ArrayList<>(), new long[] { 12L }, new ReusableRecordsAllocator(66, nodeDynamicLabelRecord));
    // when
    DynamicLabelConsistencyReport report = check(nodeDynamicLabelRecord);
    // then
    verify(report).orphanDynamicLabelRecordDueToInvalidOwner(nodeRecord);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) ReusableRecordsAllocator(org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator) DynamicLabelConsistencyReport(org.neo4j.consistency.report.ConsistencyReport.DynamicLabelConsistencyReport) Test(org.junit.Test)

Example 3 with DynamicLabelConsistencyReport

use of org.neo4j.consistency.report.ConsistencyReport.DynamicLabelConsistencyReport in project neo4j by neo4j.

the class NodeDynamicLabelOrphanChainStartCheckTest method shouldReportOwningNodeRecordNotPointingBack.

@Test
public void shouldReportOwningNodeRecordNotPointingBack() throws Exception {
    // given
    long nodeId = 12L;
    Collection<DynamicRecord> validLabelRecords = new ArrayList<>();
    DynamicRecord dynamicRecord = inUse(new DynamicRecord(0));
    allocateFromNumbers(validLabelRecords, new long[] { nodeId }, new ReusableRecordsAllocator(66, dynamicRecord));
    Collection<DynamicRecord> fakePointedToRecords = new ArrayList<>();
    DynamicRecord dynamicRecord1 = inUse(new DynamicRecord(1));
    allocateFromNumbers(fakePointedToRecords, new long[] { nodeId }, new ReusableRecordsAllocator(66, dynamicRecord1));
    NodeRecord nodeRecord = inUse(new NodeRecord(nodeId, false, -1, -1));
    nodeRecord.setLabelField(dynamicPointer(fakePointedToRecords), fakePointedToRecords);
    add(nodeRecord);
    // when
    DynamicLabelConsistencyReport report = check(Iterators.single(validLabelRecords.iterator()));
    // then
    verify(report).orphanDynamicLabelRecordDueToInvalidOwner(nodeRecord);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) ArrayList(java.util.ArrayList) ReusableRecordsAllocator(org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator) DynamicLabelConsistencyReport(org.neo4j.consistency.report.ConsistencyReport.DynamicLabelConsistencyReport) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 DynamicLabelConsistencyReport (org.neo4j.consistency.report.ConsistencyReport.DynamicLabelConsistencyReport)3 ReusableRecordsAllocator (org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator)3 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)3 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)2 ArrayList (java.util.ArrayList)1