use of org.finra.herd.model.api.xml.BusinessObjectDataDownloadCredential in project herd by FINRAOS.
the class BusinessObjectDataRestControllerTest method testGetBusinessObjectDataDownloadCredential.
@Test
public void testGetBusinessObjectDataDownloadCredential() {
// Create a business object data key.
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION);
// Create an AWS credential.
AwsCredential awsCredential = new AwsCredential(AWS_ASSUMED_ROLE_ACCESS_KEY, AWS_ASSUMED_ROLE_SECRET_KEY, AWS_ASSUMED_ROLE_SESSION_TOKEN, AWS_ASSUMED_ROLE_SESSION_EXPIRATION_TIME);
// Create a storage unit download credential.
StorageUnitDownloadCredential storageUnitDownloadCredential = new StorageUnitDownloadCredential(awsCredential);
// Mock the external calls.
when(storageUnitService.getStorageUnitDownloadCredential(businessObjectDataKey, STORAGE_NAME)).thenReturn(storageUnitDownloadCredential);
// Call the method under test.
BusinessObjectDataDownloadCredential result = businessObjectDataRestController.getBusinessObjectDataDownloadCredential(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, DATA_VERSION, STORAGE_NAME, getDelimitedFieldValues(SUBPARTITION_VALUES));
// Verify the external calls.
verify(storageUnitService).getStorageUnitDownloadCredential(businessObjectDataKey, STORAGE_NAME);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(new BusinessObjectDataDownloadCredential(awsCredential), result);
}
Aggregations