SetStepRowMetadata implements BaseUpgradeTaskTo_2_1_0_PE { @Override public void run() { final AtomicLong current = new AtomicLong(0); final long count = repository.list(PersistentPreparation.class).count(); LOGGER.info("Starting a potentially long migration task, there are {} preparations to process", count); repository.list(PersistentPreparation.class).forEach(p -> setStepRowMetadata(p, current, count)); LOGGER.info("Finished setting up row metadata in preparation steps"); }  @Override void run(); @Override int getOrder(); @Override UpgradeTask.target getTarget();  }
@Test public void whenFolderNotFoundThenShouldNotUpdateStepRowMetadata() throws Exception { when(folderRepository.locateEntry(anyString(), any())).thenReturn(null); task.run(); verify(service, never()).execute(any()); }
@Test public void shouldUpdateStepRowMetadataForEachPersistentPreparation() throws Exception { when(folderRepository.locateEntry(any(), any())).thenReturn(mock(Folder.class)); when(service.execute(any(ExportParameters.class))).thenReturn(mock(StreamingResponseBody.class)); task.run(); verify(service, times(preparations.size())).execute(any()); }