use of org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey in project herd by FINRAOS.
the class CleanupDestroyedBusinessObjectDataServiceImplTest method testGetS3StorageUnitsToCleanup.
@Test
public void testGetS3StorageUnitsToCleanup() {
// Create a storage unit entity.
StorageUnitEntity storageUnitEntity = new StorageUnitEntity();
// Create a list of storage unit entities.
List<StorageUnitEntity> storageUnitEntities = Collections.singletonList(storageUnitEntity);
// Create a storage unit key.
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);
// Mock the external calls.
when(mockStorageUnitDao.getS3StorageUnitsToCleanup(MAX_RESULT)).thenReturn(storageUnitEntities);
when(mockStorageUnitHelper.createStorageUnitKeyFromEntity(storageUnitEntity)).thenReturn(storageUnitKey);
// Call the method under test.
List<BusinessObjectDataStorageUnitKey> result = cleanupDestroyedBusinessObjectDataService.getS3StorageUnitsToCleanup(MAX_RESULT);
// Verify the external calls.
verify(mockStorageUnitDao).getS3StorageUnitsToCleanup(MAX_RESULT);
verify(mockStorageUnitHelper).createStorageUnitKeyFromEntity(storageUnitEntity);
verifyNoMoreInteractionsHelper();
// Validate the result.
assertEquals(Collections.singletonList(storageUnitKey), result);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey in project herd by FINRAOS.
the class ExpireRestoredBusinessObjectDataServiceImplTest method testGetS3StorageUnitsToExpire.
@Test
public void testGetS3StorageUnitsToExpire() {
// Create a storage unit entity.
StorageUnitEntity storageUnitEntity = new StorageUnitEntity();
// Create a list of storage unit entities.
List<StorageUnitEntity> storageUnitEntities = Arrays.asList(storageUnitEntity);
// Create a storage unit key.
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);
// Mock the external calls.
when(storageUnitDao.getS3StorageUnitsToExpire(MAX_RESULT)).thenReturn(storageUnitEntities);
when(storageUnitHelper.createStorageUnitKeyFromEntity(storageUnitEntity)).thenReturn(storageUnitKey);
// Call the method under test.
List<BusinessObjectDataStorageUnitKey> result = expireRestoredBusinessObjectDataServiceImpl.getS3StorageUnitsToExpire(MAX_RESULT);
// Verify the external calls.
verify(storageUnitDao).getS3StorageUnitsToExpire(MAX_RESULT);
verify(storageUnitHelper).createStorageUnitKeyFromEntity(storageUnitEntity);
verifyNoMoreInteractionsHelper();
// Validate the result.
assertEquals(Arrays.asList(storageUnitKey), result);
}
Aggregations