Search in sources :

Example 1 with BusinessObjectDataDownloadCredential

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);
}
Also used : StorageUnitDownloadCredential(org.finra.herd.model.api.xml.StorageUnitDownloadCredential) BusinessObjectDataDownloadCredential(org.finra.herd.model.api.xml.BusinessObjectDataDownloadCredential) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) AwsCredential(org.finra.herd.model.api.xml.AwsCredential) Test(org.junit.Test)

Aggregations

AwsCredential (org.finra.herd.model.api.xml.AwsCredential)1 BusinessObjectDataDownloadCredential (org.finra.herd.model.api.xml.BusinessObjectDataDownloadCredential)1 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)1 StorageUnitDownloadCredential (org.finra.herd.model.api.xml.StorageUnitDownloadCredential)1 Test (org.junit.Test)1