@SuppressWarnings("ResultOfMethodCallIgnored") @Test void testDeleteAllStreamForbidden() { Object jobExecutionId = "myJobExecutionId"; JobExecution jobExecution = mock(JobExecution.class); when(jobExecution.getStatus()).thenReturn(Status.RUNNING).getMock(); when(delegateRepository.findOneById(jobExecutionId)).thenReturn(jobExecution); jobExecutionRepositoryDecorator.deleteAll(Stream.of(jobExecutionId)); @SuppressWarnings("unchecked") ArgumentCaptor<Stream<Object>> entityIdStreamCaptor = ArgumentCaptor.forClass(Stream.class); verify(delegateRepository).deleteAll(entityIdStreamCaptor.capture()); assertThrows( ActiveJobExecutionDeleteForbiddenException.class, () -> entityIdStreamCaptor.getValue().collect(toList())); }
@Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); }
JobExecutionRepositoryDecorator extends AbstractRepositoryDecorator<JobExecution> { @Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); } }
JobExecutionRepositoryDecorator extends AbstractRepositoryDecorator<JobExecution> { @Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); } JobExecutionRepositoryDecorator(Repository<JobExecution> delegateRepository); }
JobExecutionRepositoryDecorator extends AbstractRepositoryDecorator<JobExecution> { @Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); } JobExecutionRepositoryDecorator(Repository<JobExecution> delegateRepository); @Override void delete(JobExecution jobExecution); @Override void deleteById(Object id); @Override void deleteAll(); @Override void delete(Stream<JobExecution> jobExecutionStream); @Override void deleteAll(Stream<Object> ids); }
JobExecutionRepositoryDecorator extends AbstractRepositoryDecorator<JobExecution> { @Override public void deleteAll() { forEachBatched( jobExecutionBatch -> jobExecutionBatch.forEach(this::validateDeleteAllowed), BATCH_SIZE); super.deleteAll(); } JobExecutionRepositoryDecorator(Repository<JobExecution> delegateRepository); @Override void delete(JobExecution jobExecution); @Override void deleteById(Object id); @Override void deleteAll(); @Override void delete(Stream<JobExecution> jobExecutionStream); @Override void deleteAll(Stream<Object> ids);  }