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);
}
}
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);
}
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);
}
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);
}
Aggregations