use of org.neo4j.kernel.api.impl.labelscan.WritableDatabaseLabelScanIndex in project neo4j by neo4j.
the class NodeRangeDocumentLabelScanStorageStrategyTest method shouldStoreAnyNodeIdInRange.
@Test
public void shouldStoreAnyNodeIdInRange() throws Exception {
for (int i = 0, max = 1 << format.bitmapFormat().shift; i < max; i++) {
// given
IndexWriter indexWriter = mock(IndexWriter.class);
WritableIndexPartition partition = newIndexPartitionMock(indexWriter);
WritableDatabaseLabelScanIndex index = buildLuceneIndex(partition);
LabelScanWriter writer = new PartitionedLuceneLabelScanWriter(index, format);
// when
writer.write(labelChanges(i, labels(), labels(7)));
writer.close();
// then
Document document = new Document();
format.addRangeValuesField(document, 0);
format.addLabelAndSearchFields(document, 7, new Bitmap(1L << i));
verify(indexWriter).updateDocument(eq(format.rangeTerm(0)), match(document));
}
}
use of org.neo4j.kernel.api.impl.labelscan.WritableDatabaseLabelScanIndex in project neo4j by neo4j.
the class NodeRangeDocumentLabelScanStorageStrategyTest method buildLuceneIndex.
private WritableDatabaseLabelScanIndex buildLuceneIndex(WritableIndexPartition partition) {
WritableDatabaseLabelScanIndex index = mock(WritableDatabaseLabelScanIndex.class);
when(index.getPartitions()).thenReturn(singletonList(partition));
return index;
}
Aggregations