@Override public void setDownstream( Step<?> downstream ) { assert downstream != this; this.downstream = downstream; //noinspection unchecked this.downstreamWorkSync = new WorkSync<>( new Downstream( (Step<Object>) downstream, doneBatches ) ); }
sync = new WorkSync<>( adder );
@Test public void shouldProvideLabelScanStoreUpdatesSortedByNodeId() throws Exception { // GIVEN IndexingService indexing = mock( IndexingService.class ); when( indexing.convertToIndexUpdates( any(), eq( EntityType.NODE ) ) ).thenAnswer( o -> Iterables.empty() ); LabelScanWriter writer = new OrderVerifyingLabelScanWriter( 10, 15, 20 ); WorkSync<Supplier<LabelScanWriter>,LabelUpdateWork> labelScanSync = spy( new WorkSync<>( singletonProvider( writer ) ) ); WorkSync<IndexingUpdateService,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( RelationshipStore.class ), new PropertyPhysicalToLogicalConverter( propertyStore ), new IndexActivator( indexing ) ) ) { 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 ).applyAsync( any() ); }
LabelScanWriter writer = new OrderVerifyingLabelScanWriter( 10, 15, 20 ); WorkSync<Supplier<LabelScanWriter>,LabelUpdateWork> labelScanSync = spy( new WorkSync<>( singletonProvider( writer ) ) ); WorkSync<IndexingUpdateService,IndexUpdatesWork> indexUpdatesSync = new WorkSync<>( indexing ); PropertyStore propertyStore = mock( PropertyStore.class ); TransactionToApply tx = mock( TransactionToApply.class );
@Override public void setDownstream( Step<?> downstream ) { assert downstream != this; this.downstream = downstream; //noinspection unchecked this.downstreamWorkSync = new WorkSync<>( new Downstream( (Step<Object>) downstream, doneBatches ) ); }