@Test public void startUploading_retryOn_DicomWebException408Code_Success() throws DicomWebException, IOException { when(backupFlagsMock.getHttpErrorCodesToRetry()).thenReturn(List.of(408)); when(backupFlagsMock.getAttemptsAmount()).thenReturn(ATTEMPTS_AMOUNT_TWO); doThrow(new DicomWebException(" Request Timeout 408", HttpStatus.REQUEST_TIMEOUT_408, HttpStatusCodes.STATUS_CODE_BAD_REQUEST)) .doNothing() .when(webClientMock).stowRs(any(InputStream.class)); when(backupUploaderMock.doReadBackup(eq(UNIQUE_FILE_NAME))).thenReturn(backupInputStream); backupUploadService.startUploading(webClientMock, spyBackupState); verify(backupUploaderMock, times(2)).doReadBackup(eq(UNIQUE_FILE_NAME)); verify(webClientMock, times(2)).stowRs(any(InputStream.class)); verify(backupUploaderMock).doRemoveBackup(eq(UNIQUE_FILE_NAME)); }
@Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); }
BackupUploadService implements IBackupUploadService { @Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); } }
BackupUploadService implements IBackupUploadService { @Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); } BackupUploadService(IBackupUploader backupUploader, BackupFlags backupFlags, DelayCalculator delayCalculator); }
BackupUploadService implements IBackupUploadService { @Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); } BackupUploadService(IBackupUploader backupUploader, BackupFlags backupFlags, DelayCalculator delayCalculator); @Override BackupState createBackup(InputStream inputStream, String uniqueFileName); @Override InputStream getBackupStream(String uniqueFileName); @Override void startUploading(IDicomWebClient webClient, BackupState backupState); @Override void removeBackup(String fileName); boolean filterHttpCode(Integer actualHttpStatus); }
BackupUploadService implements IBackupUploadService { @Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); } BackupUploadService(IBackupUploader backupUploader, BackupFlags backupFlags, DelayCalculator delayCalculator); @Override BackupState createBackup(InputStream inputStream, String uniqueFileName); @Override InputStream getBackupStream(String uniqueFileName); @Override void startUploading(IDicomWebClient webClient, BackupState backupState); @Override void removeBackup(String fileName); boolean filterHttpCode(Integer actualHttpStatus);  }