use of org.neo4j.concurrent.WorkSync in project neo4j by neo4j.
the class IndexBatchTransactionApplierTest method shouldProvideLabelScanStoreUpdatesSortedByNodeId.
@Test
public void shouldProvideLabelScanStoreUpdatesSortedByNodeId() throws Exception {
// GIVEN
IndexingService indexing = mock(IndexingService.class);
LabelScanWriter writer = new OrderVerifyingLabelScanWriter(10, 15, 20);
WorkSync<Supplier<LabelScanWriter>, LabelUpdateWork> labelScanSync = spy(new WorkSync<>(singletonProvider(writer)));
WorkSync<IndexingService, IndexUpdatesWork> indexUpdatesSync = new WorkSync<>(indexing);
TransactionToApply tx = mock(TransactionToApply.class);
PropertyStore propertyStore = mock(PropertyStore.class);
try (IndexBatchTransactionApplier applier = new IndexBatchTransactionApplier(indexing, labelScanSync, indexUpdatesSync, mock(NodeStore.class), mock(PropertyLoader.class), new PropertyPhysicalToLogicalConverter(propertyStore), TransactionApplicationMode.INTERNAL)) {
try (TransactionApplier txApplier = applier.startTx(tx)) {
// WHEN
txApplier.visitNodeCommand(node(15));
txApplier.visitNodeCommand(node(20));
txApplier.visitNodeCommand(node(10));
}
}
// THEN all assertions happen inside the LabelScanWriter#write and #close
verify(labelScanSync).apply(any());
}
Aggregations