Search in sources :

Example 1 with LabelScanDocument

use of org.neo4j.consistency.store.synthetic.LabelScanDocument in project neo4j by neo4j.

the class NodeInUseWithCorrectLabelsCheckTest method reportNodeWithoutLabelsWhenLabelsAreDynamic.

@Test
public void reportNodeWithoutLabelsWhenLabelsAreDynamic() {
    int nodeId = 42;
    long[] indexLabelIds = { 3, 7, 9, 10 };
    long[] storeLabelIds = {};
    long[] missingLabelIds = { 3, 7, 9, 10 };
    RecordAccessStub recordAccess = new RecordAccessStub();
    NodeRecord node = inUse(withDynamicLabels(recordAccess, new NodeRecord(nodeId, false, 0, 0), storeLabelIds));
    ConsistencyReport.LabelScanConsistencyReport report = mock(ConsistencyReport.LabelScanConsistencyReport.class);
    // when
    CheckerEngine<LabelScanDocument, ConsistencyReport.LabelScanConsistencyReport> engine = recordAccess.engine(null, report);
    checker(indexLabelIds, true).checkReference(null, node, engine, recordAccess);
    recordAccess.checkDeferred();
    // then
    for (long missingLabelId : missingLabelIds) {
        verify(report).nodeDoesNotHaveExpectedLabel(node, missingLabelId);
    }
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) LabelScanDocument(org.neo4j.consistency.store.synthetic.LabelScanDocument) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 2 with LabelScanDocument

use of org.neo4j.consistency.store.synthetic.LabelScanDocument in project neo4j by neo4j.

the class NodeInUseWithCorrectLabelsCheckTest method shouldReportNodeWithoutExpectedLabelWhenLabelsAreDynamicBothDirections.

@Test
public void shouldReportNodeWithoutExpectedLabelWhenLabelsAreDynamicBothDirections() throws Exception {
    // given
    int nodeId = 42;
    long[] indexLabelIds = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    long[] storeLabelIds = { 1, 2, 3, 4, 5, 6, 8, 9, 10, 11 };
    RecordAccessStub recordAccess = new RecordAccessStub();
    NodeRecord node = inUse(withDynamicLabels(recordAccess, new NodeRecord(nodeId, false, 0, 0), storeLabelIds));
    ConsistencyReport.LabelScanConsistencyReport report = mock(ConsistencyReport.LabelScanConsistencyReport.class);
    // when
    CheckerEngine<LabelScanDocument, ConsistencyReport.LabelScanConsistencyReport> engine = recordAccess.engine(null, report);
    checker(indexLabelIds, true).checkReference(null, node, engine, recordAccess);
    recordAccess.checkDeferred();
    // then
    verify(report).nodeDoesNotHaveExpectedLabel(node, 7);
    verify(report).nodeLabelNotInIndex(node, 11);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) LabelScanDocument(org.neo4j.consistency.store.synthetic.LabelScanDocument) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 3 with LabelScanDocument

use of org.neo4j.consistency.store.synthetic.LabelScanDocument in project neo4j by neo4j.

the class NodeInUseWithCorrectLabelsCheckTest method shouldReportNodeWithoutExpectedLabelWhenLabelsAreDynamicIndexToStore.

@Test
public void shouldReportNodeWithoutExpectedLabelWhenLabelsAreDynamicIndexToStore() throws Exception {
    // given
    int nodeId = 42;
    long[] indexLabelIds = { 3, 7, 9, 10 };
    long[] storeLabelIds = { 1, 2, 3, 4, 5, 6, 8, 9, 10 };
    long missingLabelId = 7;
    RecordAccessStub recordAccess = new RecordAccessStub();
    NodeRecord node = inUse(withDynamicLabels(recordAccess, new NodeRecord(nodeId, false, 0, 0), storeLabelIds));
    ConsistencyReport.LabelScanConsistencyReport report = mock(ConsistencyReport.LabelScanConsistencyReport.class);
    // when
    CheckerEngine<LabelScanDocument, ConsistencyReport.LabelScanConsistencyReport> engine = recordAccess.engine(null, report);
    checker(indexLabelIds, true).checkReference(null, node, engine, recordAccess);
    recordAccess.checkDeferred();
    // then
    verify(report).nodeDoesNotHaveExpectedLabel(node, missingLabelId);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) LabelScanDocument(org.neo4j.consistency.store.synthetic.LabelScanDocument) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 4 with LabelScanDocument

use of org.neo4j.consistency.store.synthetic.LabelScanDocument in project neo4j by neo4j.

the class NodeInUseWithCorrectLabelsCheckTest method reportNodeWithoutLabelsWhenLabelsAreInlined.

@Test
public void reportNodeWithoutLabelsWhenLabelsAreInlined() {
    int nodeId = 42;
    long[] indexLabelIds = { 3 };
    long[] storeLabelIds = {};
    long missingLabelId = 3;
    RecordAccessStub recordAccess = new RecordAccessStub();
    NodeRecord node = inUse(withInlineLabels(new NodeRecord(nodeId, false, 0, 0), storeLabelIds));
    ConsistencyReport.LabelScanConsistencyReport report = mock(ConsistencyReport.LabelScanConsistencyReport.class);
    // when
    CheckerEngine<LabelScanDocument, ConsistencyReport.LabelScanConsistencyReport> engine = recordAccess.engine(null, report);
    checker(indexLabelIds, true).checkReference(null, node, engine, recordAccess);
    recordAccess.checkDeferred();
    // then
    verify(report).nodeDoesNotHaveExpectedLabel(node, missingLabelId);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) LabelScanDocument(org.neo4j.consistency.store.synthetic.LabelScanDocument) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)4 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)4 LabelScanDocument (org.neo4j.consistency.store.synthetic.LabelScanDocument)4 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)4