BusinessObjectDataFinalizeRestoreHelperServiceImpl implements BusinessObjectDataFinalizeRestoreHelperService { @PublishNotificationMessages @Override @Transactional(propagation = Propagation.REQUIRES_NEW) public void completeFinalizeRestore(BusinessObjectDataRestoreDto businessObjectDataRestoreDto) { completeFinalizeRestoreImpl(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 testCompleteFinalizeRestore() { BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION); 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); BusinessObjectDataEntity businessObjectDataEntity = new BusinessObjectDataEntity(); StorageUnitStatusEntity newStorageUnitStatusEntity = new StorageUnitStatusEntity(); newStorageUnitStatusEntity.setCode(StorageUnitStatusEntity.RESTORED); StorageUnitStatusEntity oldStorageUnitStatusEntity = new StorageUnitStatusEntity(); oldStorageUnitStatusEntity.setCode(StorageUnitStatusEntity.RESTORING); StorageUnitEntity storageUnitEntity = new StorageUnitEntity(); storageUnitEntity.setStatus(oldStorageUnitStatusEntity); when(businessObjectDataDaoHelper.getBusinessObjectDataEntity(businessObjectDataKey)).thenReturn(businessObjectDataEntity); when(storageUnitDaoHelper.getStorageUnitEntity(STORAGE_NAME, businessObjectDataEntity)).thenReturn(storageUnitEntity); when(storageUnitStatusDaoHelper.getStorageUnitStatusEntity(StorageUnitStatusEntity.RESTORED)).thenReturn(newStorageUnitStatusEntity); businessObjectDataFinalizeRestoreHelperServiceImpl.completeFinalizeRestore(businessObjectDataRestoreDto); verify(businessObjectDataDaoHelper).getBusinessObjectDataEntity(businessObjectDataKey); verify(storageUnitDaoHelper).getStorageUnitEntity(STORAGE_NAME, businessObjectDataEntity); verify(storageUnitStatusDaoHelper).getStorageUnitStatusEntity(StorageUnitStatusEntity.RESTORED); verify(storageUnitDaoHelper).updateStorageUnitStatus(storageUnitEntity, newStorageUnitStatusEntity, StorageUnitStatusEntity.RESTORED); verifyNoMoreInteractionsHelper(); assertEquals(StorageUnitStatusEntity.RESTORED, businessObjectDataRestoreDto.getNewStorageUnitStatus()); assertEquals(StorageUnitStatusEntity.RESTORING, businessObjectDataRestoreDto.getOldStorageUnitStatus()); }