BusinessObjectDataFinalizeRestoreHelperServiceImpl implements BusinessObjectDataFinalizeRestoreHelperService { @Override @Transactional(propagation = Propagation.NOT_SUPPORTED) public void executeS3SpecificSteps(BusinessObjectDataRestoreDto businessObjectDataRestoreDto) { executeS3SpecificStepsImpl(businessObjectDataRestoreDto); }  @PublishNotificationMessages @Override @Transactional(propagation = Propagation.REQUIRES_NEW) void completeFinalizeRestore(BusinessObjectDataRestoreDto businessObjectDataRestoreDto); @Override @Transactional(propagation = Propagation.NOT_SUPPORTED) void executeS3SpecificSteps(BusinessObjectDataRestoreDto businessObjectDataRestoreDto); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) BusinessObjectDataRestoreDto prepareToFinalizeRestore(BusinessObjectDataStorageUnitKey storageUnitKey);  }
@Test public void testExecuteS3SpecificSteps() { BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION); List<StorageFile> storageFiles = Arrays.asList(new StorageFile(S3_KEY, FILE_SIZE, ROW_COUNT), new StorageFile(S3_KEY_2, FILE_SIZE_2, ROW_COUNT_2)); BusinessObjectDataRestoreDto businessObjectDataRestoreDto = new BusinessObjectDataRestoreDto(businessObjectDataKey, STORAGE_NAME, S3_ENDPOINT, S3_BUCKET_NAME, S3_KEY_PREFIX, STORAGE_UNIT_STATUS_2, STORAGE_UNIT_STATUS, storageFiles, NO_EXCEPTION, ARCHIVE_RETRIEVAL_OPTION); S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = new S3FileTransferRequestParamsDto(); S3FileTransferRequestParamsDto updatedS3FileTransferRequestParamsDto = new S3FileTransferRequestParamsDto(); updatedS3FileTransferRequestParamsDto.setS3BucketName(S3_BUCKET_NAME); updatedS3FileTransferRequestParamsDto.setS3Endpoint(S3_ENDPOINT); updatedS3FileTransferRequestParamsDto.setS3KeyPrefix(S3_KEY_PREFIX + "/"); S3ObjectSummary glacierS3ObjectSummary = mock(S3ObjectSummary.class); when(glacierS3ObjectSummary.getStorageClass()).thenReturn(StorageClass.Glacier.toString()); S3ObjectSummary standardS3ObjectSummary = mock(S3ObjectSummary.class); when(standardS3ObjectSummary.getStorageClass()).thenReturn(StorageClass.Standard.toString()); List<S3ObjectSummary> s3Files = Arrays.asList(glacierS3ObjectSummary, standardS3ObjectSummary); List<S3ObjectSummary> glacierS3Files = Arrays.asList(glacierS3ObjectSummary); List<StorageFile> glacierStorageFiles = Arrays.asList(new StorageFile(S3_KEY, FILE_SIZE, ROW_COUNT)); List<File> files = Arrays.asList(new File(S3_KEY)); S3FileTransferRequestParamsDto finalS3FileTransferRequestParamsDto = new S3FileTransferRequestParamsDto(); finalS3FileTransferRequestParamsDto.setS3BucketName(S3_BUCKET_NAME); finalS3FileTransferRequestParamsDto.setS3Endpoint(S3_ENDPOINT); finalS3FileTransferRequestParamsDto.setS3KeyPrefix(S3_KEY_PREFIX + "/"); finalS3FileTransferRequestParamsDto.setFiles(files); when(storageHelper.getS3FileTransferRequestParamsDto()).thenReturn(s3FileTransferRequestParamsDto); when(s3Service.listDirectory(updatedS3FileTransferRequestParamsDto, true)).thenReturn(s3Files); when(storageFileHelper.createStorageFilesFromS3ObjectSummaries(glacierS3Files)).thenReturn(glacierStorageFiles); when(storageFileHelper.getFiles(glacierStorageFiles)).thenReturn(files); businessObjectDataFinalizeRestoreHelperServiceImpl.executeS3SpecificSteps(businessObjectDataRestoreDto); verify(storageHelper).getS3FileTransferRequestParamsDto(); verify(s3Service).listDirectory(any(S3FileTransferRequestParamsDto.class), eq(true)); verify(storageFileHelper).validateRegisteredS3Files(storageFiles, s3Files, STORAGE_NAME, businessObjectDataKey); verify(storageFileHelper).createStorageFilesFromS3ObjectSummaries(glacierS3Files); verify(storageFileHelper).getFiles(glacierStorageFiles); verify(s3Service).validateGlacierS3FilesRestored(finalS3FileTransferRequestParamsDto); verifyNoMoreInteractionsHelper(); }