ExpireRestoredBusinessObjectDataServiceImpl implements ExpireRestoredBusinessObjectDataService { @Override @Transactional(propagation = Propagation.NOT_SUPPORTED) public void expireS3StorageUnit(BusinessObjectDataStorageUnitKey storageUnitKey) { expireS3StorageUnitImpl(storageUnitKey); }  @Override @Transactional(propagation = Propagation.NOT_SUPPORTED) void expireS3StorageUnit(BusinessObjectDataStorageUnitKey storageUnitKey); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) List<BusinessObjectDataStorageUnitKey> getS3StorageUnitsToExpire(int maxResult);  }
@Test public void testExpireS3StorageUnit() { 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, StorageUnitStatusEntity.EXPIRING, StorageUnitStatusEntity.RESTORED, Arrays.asList(new StorageFile(S3_KEY, FILE_SIZE, ROW_COUNT)), NO_EXCEPTION, ARCHIVE_RETRIEVAL_OPTION); when(expireRestoredBusinessObjectDataHelperService.prepareToExpireStorageUnit(storageUnitKey)).thenReturn(businessObjectDataRestoreDto); doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { BusinessObjectDataRestoreDto businessObjectDataRestoreDto = (BusinessObjectDataRestoreDto) invocation.getArguments()[0]; businessObjectDataRestoreDto.setNewStorageUnitStatus(StorageUnitStatusEntity.ARCHIVED); businessObjectDataRestoreDto.setOldStorageUnitStatus(StorageUnitStatusEntity.EXPIRING); return null; } }).when(expireRestoredBusinessObjectDataHelperService).completeStorageUnitExpiration(businessObjectDataRestoreDto); expireRestoredBusinessObjectDataServiceImpl.expireS3StorageUnit(storageUnitKey); verify(expireRestoredBusinessObjectDataHelperService).prepareToExpireStorageUnit(storageUnitKey); verify(notificationEventService) .processStorageUnitNotificationEventAsync(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG, businessObjectDataKey, STORAGE_NAME, StorageUnitStatusEntity.EXPIRING, StorageUnitStatusEntity.RESTORED); verify(expireRestoredBusinessObjectDataHelperService).executeS3SpecificSteps(businessObjectDataRestoreDto); verify(expireRestoredBusinessObjectDataHelperService).completeStorageUnitExpiration(businessObjectDataRestoreDto); verify(notificationEventService) .processStorageUnitNotificationEventAsync(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG, businessObjectDataKey, STORAGE_NAME, StorageUnitStatusEntity.ARCHIVED, StorageUnitStatusEntity.EXPIRING); verifyNoMoreInteractionsHelper(); }