BusinessObjectDataFinalizeRestoreServiceImpl implements BusinessObjectDataFinalizeRestoreService { @Override @Transactional(propagation = Propagation.NOT_SUPPORTED) public void finalizeRestore(BusinessObjectDataStorageUnitKey storageUnitKey) { finalizeRestoreImpl(storageUnitKey); }  @Override @Transactional(propagation = Propagation.NOT_SUPPORTED) void finalizeRestore(BusinessObjectDataStorageUnitKey storageUnitKey); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) List<BusinessObjectDataStorageUnitKey> getS3StorageUnitsToRestore(int maxResult);  }
@Test public void testFinalizeRestore() { BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION); BusinessObjectDataStorageUnitKey storageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME); BusinessObjectDataRestoreDto businessObjectDataRestoreDto = new BusinessObjectDataRestoreDto(businessObjectDataKey, STORAGE_NAME, S3_ENDPOINT, S3_BUCKET_NAME, S3_KEY_PREFIX, NO_STORAGE_UNIT_STATUS, NO_STORAGE_UNIT_STATUS, Arrays.asList(new StorageFile(S3_KEY, FILE_SIZE, ROW_COUNT)), NO_EXCEPTION, ARCHIVE_RETRIEVAL_OPTION); when(businessObjectDataFinalizeRestoreHelperService.prepareToFinalizeRestore(storageUnitKey)).thenReturn(businessObjectDataRestoreDto); doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { BusinessObjectDataRestoreDto businessObjectDataRestoreDto = (BusinessObjectDataRestoreDto) invocation.getArguments()[0]; businessObjectDataRestoreDto.setNewStorageUnitStatus(StorageUnitStatusEntity.RESTORED); businessObjectDataRestoreDto.setOldStorageUnitStatus(StorageUnitStatusEntity.RESTORING); return null; } }).when(businessObjectDataFinalizeRestoreHelperService).completeFinalizeRestore(businessObjectDataRestoreDto); businessObjectDataFinalizeRestoreServiceImpl.finalizeRestore(storageUnitKey); verify(businessObjectDataFinalizeRestoreHelperService).prepareToFinalizeRestore(storageUnitKey); verify(businessObjectDataFinalizeRestoreHelperService).executeS3SpecificSteps(businessObjectDataRestoreDto); verify(businessObjectDataFinalizeRestoreHelperService).completeFinalizeRestore(businessObjectDataRestoreDto); verify(notificationEventService) .processStorageUnitNotificationEventAsync(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG, businessObjectDataKey, STORAGE_NAME, StorageUnitStatusEntity.RESTORED, StorageUnitStatusEntity.RESTORING); verifyNoMoreInteractionsHelper(); }