Search in sources :

Example 6 with UploadBusinessObjectDefinitionSampleDataFileInitiationResponse

use of org.finra.herd.model.api.xml.UploadBusinessObjectDefinitionSampleDataFileInitiationResponse in project herd by FINRAOS.

the class UploadDownloadServiceTest method testUploadBusinessObjectDefinitionSampleFileTrimedParameters.

@Test
public void testUploadBusinessObjectDefinitionSampleFileTrimedParameters() {
    String s3_velocity_template = "$namespace/$businessObjectDefinitionName";
    // Create a test storage.
    storageDaoTestHelper.createStorageEntity(StorageEntity.SAMPLE_DATA_FILE_STORAGE, Arrays.asList(new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_BUCKET_NAME), S3_BUCKET_NAME), new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_UPLOAD_ROLE_ARN), UPLOADER_ROLE_ARN), new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_KEY_PREFIX_VELOCITY_TEMPLATE), s3_velocity_template)));
    // 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());
    UploadBusinessObjectDefinitionSampleDataFileInitiationRequest request = new UploadBusinessObjectDefinitionSampleDataFileInitiationRequest();
    BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(NAMESPACE, BDEF_NAME);
    BusinessObjectDefinitionKey businessObjectDefinitionKeyWhitespace = new BusinessObjectDefinitionKey("    " + NAMESPACE + " ", "   " + BDEF_NAME + "  ");
    request.setBusinessObjectDefinitionKey(businessObjectDefinitionKeyWhitespace);
    UploadBusinessObjectDefinitionSampleDataFileInitiationResponse response = uploadDownloadService.initiateUploadSampleFile(request);
    assertEquals(response.getBusinessObjectDefinitionKey(), businessObjectDefinitionKey);
    assertEquals(response.getAwsS3BucketName(), S3_BUCKET_NAME);
    assertEquals(response.getAwsAccessKey(), MockStsOperationsImpl.MOCK_AWS_ASSUMED_ROLE_ACCESS_KEY);
    assertEquals(response.getAwsSecretKey(), MockStsOperationsImpl.MOCK_AWS_ASSUMED_ROLE_SECRET_KEY);
    assertEquals(response.getAwsSessionToken(), MockStsOperationsImpl.MOCK_AWS_ASSUMED_ROLE_SESSION_TOKEN);
}
Also used : Attribute(org.finra.herd.model.api.xml.Attribute) BusinessObjectDefinitionKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionKey) UploadBusinessObjectDefinitionSampleDataFileInitiationResponse(org.finra.herd.model.api.xml.UploadBusinessObjectDefinitionSampleDataFileInitiationResponse) UploadBusinessObjectDefinitionSampleDataFileInitiationRequest(org.finra.herd.model.api.xml.UploadBusinessObjectDefinitionSampleDataFileInitiationRequest) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)6 UploadBusinessObjectDefinitionSampleDataFileInitiationResponse (org.finra.herd.model.api.xml.UploadBusinessObjectDefinitionSampleDataFileInitiationResponse)6 UploadBusinessObjectDefinitionSampleDataFileInitiationRequest (org.finra.herd.model.api.xml.UploadBusinessObjectDefinitionSampleDataFileInitiationRequest)5 Test (org.junit.Test)5 Attribute (org.finra.herd.model.api.xml.Attribute)4 Credentials (com.amazonaws.services.securitytoken.model.Credentials)1 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)1 StorageEntity (org.finra.herd.model.jpa.StorageEntity)1