use of org.finra.herd.model.api.xml.DownloadBusinessObjectDefinitionSampleDataFileSingleInitiationResponse in project herd by FINRAOS.
the class UploadDownloadServiceTest method testDownloadBusinessObjectDefinitionSampleFile.
@Test
public void testDownloadBusinessObjectDefinitionSampleFile() {
// Create a test storage.
storageDaoTestHelper.createStorageEntity(STORAGE_NAME, Arrays.asList(new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_BUCKET_NAME), S3_BUCKET_NAME), new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_DOWNLOAD_ROLE_ARN), DOWNLOADER_ROLE_ARN)));
// Create and persist a business object definition entity with sample data files.
businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, BDEF_DISPLAY_NAME, businessObjectDefinitionServiceTestHelper.getNewAttributes(), Arrays.asList(new SampleDataFile(DIRECTORY_PATH, FILE_NAME)));
// Initiate download of a sample data file.
DownloadBusinessObjectDefinitionSampleDataFileSingleInitiationRequest downloadRequest = new DownloadBusinessObjectDefinitionSampleDataFileSingleInitiationRequest();
BusinessObjectDefinitionSampleDataFileKey sampleDataFileKey = new BusinessObjectDefinitionSampleDataFileKey();
sampleDataFileKey.setNamespace(NAMESPACE);
sampleDataFileKey.setBusinessObjectDefinitionName(BDEF_NAME);
sampleDataFileKey.setDirectoryPath(DIRECTORY_PATH);
sampleDataFileKey.setFileName(FILE_NAME);
downloadRequest.setBusinessObjectDefinitionSampleDataFileKey(sampleDataFileKey);
DownloadBusinessObjectDefinitionSampleDataFileSingleInitiationResponse downloadResponse = uploadDownloadService.initiateDownloadSingleSampleFile(downloadRequest);
// Validate the response.
assertNotNull(downloadResponse.getAwsSessionExpirationTime());
assertNotNull(downloadResponse.getPreSignedUrl());
assertEquals(new DownloadBusinessObjectDefinitionSampleDataFileSingleInitiationResponse(new BusinessObjectDefinitionSampleDataFileKey(NAMESPACE, BDEF_NAME, DIRECTORY_PATH, FILE_NAME), S3_BUCKET_NAME, MockStsOperationsImpl.MOCK_AWS_ASSUMED_ROLE_ACCESS_KEY, MockStsOperationsImpl.MOCK_AWS_ASSUMED_ROLE_SECRET_KEY, MockStsOperationsImpl.MOCK_AWS_ASSUMED_ROLE_SESSION_TOKEN, downloadResponse.getAwsSessionExpirationTime(), downloadResponse.getPreSignedUrl()), downloadResponse);
}
Aggregations