Search in sources :

Example 1 with BusinessObjectDataUploadCredential

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

the class UploaderWebClientTest method testGetBusinessObjectDataUploadCredential1.

@Test
public void testGetBusinessObjectDataUploadCredential1() throws Exception {
    DataBridgeBaseManifestDto manifest = new DataBridgeBaseManifestDto();
    manifest.setNamespace("test1");
    manifest.setBusinessObjectDefinitionName("test2");
    manifest.setBusinessObjectFormatUsage("test3");
    manifest.setBusinessObjectFormatFileType("test4");
    manifest.setBusinessObjectFormatVersion("test5");
    manifest.setPartitionValue("test6");
    manifest.setSubPartitionValues(Arrays.asList("test7", "test8"));
    String storageName = "test8";
    Integer businessObjectDataVersion = 1234;
    Boolean createNewVersion = false;
    uploaderWebClient.getRegServerAccessParamsDto().setUseSsl(false);
    BusinessObjectDataUploadCredential businessObjectDataUploadCredential = uploaderWebClient.getBusinessObjectDataUploadCredential(manifest, storageName, businessObjectDataVersion, createNewVersion);
    Assert.assertNotNull(businessObjectDataUploadCredential);
    AwsCredential awsCredential = businessObjectDataUploadCredential.getAwsCredential();
    Assert.assertNotNull(awsCredential);
    Assert.assertEquals("http://testWebServiceHostname:1234/herd-app/rest/businessObjectData/upload/credential/namespaces/test1" + "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&subPartitionValues=test7%7Ctest8&businessObjectDataVersion=1234&createNewVersion=false", awsCredential.getAwsAccessKey());
}
Also used : BusinessObjectDataUploadCredential(org.finra.herd.model.api.xml.BusinessObjectDataUploadCredential) DataBridgeBaseManifestDto(org.finra.herd.model.dto.DataBridgeBaseManifestDto) AwsCredential(org.finra.herd.model.api.xml.AwsCredential) Test(org.junit.Test)

Example 2 with BusinessObjectDataUploadCredential

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

the class MockHttpClientOperationsImpl method getBusinessObjectDataUploadCredentialResponse.

private void getBusinessObjectDataUploadCredentialResponse(MockCloseableHttpResponse response, URI uri) throws UnsupportedCharsetException, JAXBException {
    BusinessObjectDataUploadCredential businessObjectDataUploadCredential = new BusinessObjectDataUploadCredential();
    AwsCredential awsCredential = new AwsCredential();
    awsCredential.setAwsAccessKey(uri.toString());
    businessObjectDataUploadCredential.setAwsCredential(awsCredential);
    response.setEntity(getHttpEntity(businessObjectDataUploadCredential));
}
Also used : BusinessObjectDataUploadCredential(org.finra.herd.model.api.xml.BusinessObjectDataUploadCredential) AwsCredential(org.finra.herd.model.api.xml.AwsCredential)

Example 3 with BusinessObjectDataUploadCredential

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

the class BusinessObjectDataRestControllerTest method testGetBusinessObjectDataUploadCredential.

@Test
public void testGetBusinessObjectDataUploadCredential() {
    // 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.
    StorageUnitUploadCredential storageUnitUploadCredential = new StorageUnitUploadCredential(awsCredential, AWS_KMS_KEY_ID);
    // Mock the external calls.
    when(storageUnitService.getStorageUnitUploadCredential(businessObjectDataKey, CREATE_NEW_VERSION, STORAGE_NAME)).thenReturn(storageUnitUploadCredential);
    // Call the method under test.
    BusinessObjectDataUploadCredential result = businessObjectDataRestController.getBusinessObjectDataUploadCredential(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, DATA_VERSION, CREATE_NEW_VERSION, STORAGE_NAME, getDelimitedFieldValues(SUBPARTITION_VALUES));
    // Verify the external calls.
    verify(storageUnitService).getStorageUnitUploadCredential(businessObjectDataKey, CREATE_NEW_VERSION, STORAGE_NAME);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(new BusinessObjectDataUploadCredential(awsCredential, AWS_KMS_KEY_ID), result);
}
Also used : BusinessObjectDataUploadCredential(org.finra.herd.model.api.xml.BusinessObjectDataUploadCredential) StorageUnitUploadCredential(org.finra.herd.model.api.xml.StorageUnitUploadCredential) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) AwsCredential(org.finra.herd.model.api.xml.AwsCredential) Test(org.junit.Test)

Example 4 with BusinessObjectDataUploadCredential

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

the class UploaderWebClientTest method testGetBusinessObjectDataUploadCredential2.

@Test
public void testGetBusinessObjectDataUploadCredential2() throws Exception {
    DataBridgeBaseManifestDto manifest = new DataBridgeBaseManifestDto();
    manifest.setNamespace("test1");
    manifest.setBusinessObjectDefinitionName("test2");
    manifest.setBusinessObjectFormatUsage("test3");
    manifest.setBusinessObjectFormatFileType("test4");
    manifest.setBusinessObjectFormatVersion("test5");
    manifest.setPartitionValue("test6");
    String storageName = "test8";
    Integer businessObjectDataVersion = 1234;
    Boolean createNewVersion = null;
    uploaderWebClient.getRegServerAccessParamsDto().setUseSsl(true);
    BusinessObjectDataUploadCredential businessObjectDataUploadCredential = uploaderWebClient.getBusinessObjectDataUploadCredential(manifest, storageName, businessObjectDataVersion, createNewVersion);
    Assert.assertNotNull(businessObjectDataUploadCredential);
    AwsCredential awsCredential = businessObjectDataUploadCredential.getAwsCredential();
    Assert.assertNotNull(awsCredential);
    Assert.assertEquals("https://testWebServiceHostname:1234/herd-app/rest/businessObjectData/upload/credential/namespaces/test1" + "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&businessObjectDataVersion=1234", awsCredential.getAwsAccessKey());
}
Also used : BusinessObjectDataUploadCredential(org.finra.herd.model.api.xml.BusinessObjectDataUploadCredential) DataBridgeBaseManifestDto(org.finra.herd.model.dto.DataBridgeBaseManifestDto) AwsCredential(org.finra.herd.model.api.xml.AwsCredential) Test(org.junit.Test)

Example 5 with BusinessObjectDataUploadCredential

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

the class UploaderWebClientTest method testGetBusinessObjectDataUploadCredential3.

@Test
public void testGetBusinessObjectDataUploadCredential3() throws Exception {
    DataBridgeBaseManifestDto manifest = new DataBridgeBaseManifestDto();
    manifest.setNamespace("test1");
    manifest.setBusinessObjectDefinitionName("test2");
    manifest.setBusinessObjectFormatUsage("test3");
    manifest.setBusinessObjectFormatFileType("test4");
    manifest.setBusinessObjectFormatVersion("test5");
    manifest.setPartitionValue("test6");
    manifest.setSubPartitionValues(Arrays.asList("test7", "test8"));
    String storageName = "test8";
    Integer businessObjectDataVersion = null;
    Boolean createNewVersion = true;
    uploaderWebClient.getRegServerAccessParamsDto().setUseSsl(true);
    BusinessObjectDataUploadCredential businessObjectDataUploadCredential = uploaderWebClient.getBusinessObjectDataUploadCredential(manifest, storageName, businessObjectDataVersion, createNewVersion);
    Assert.assertNotNull(businessObjectDataUploadCredential);
    AwsCredential awsCredential = businessObjectDataUploadCredential.getAwsCredential();
    Assert.assertNotNull(awsCredential);
    Assert.assertEquals("https://testWebServiceHostname:1234/herd-app/rest/businessObjectData/upload/credential/namespaces/test1" + "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&subPartitionValues=test7%7Ctest8&createNewVersion=true", awsCredential.getAwsAccessKey());
}
Also used : BusinessObjectDataUploadCredential(org.finra.herd.model.api.xml.BusinessObjectDataUploadCredential) DataBridgeBaseManifestDto(org.finra.herd.model.dto.DataBridgeBaseManifestDto) AwsCredential(org.finra.herd.model.api.xml.AwsCredential) Test(org.junit.Test)

Aggregations

AwsCredential (org.finra.herd.model.api.xml.AwsCredential)5 BusinessObjectDataUploadCredential (org.finra.herd.model.api.xml.BusinessObjectDataUploadCredential)5 Test (org.junit.Test)4 DataBridgeBaseManifestDto (org.finra.herd.model.dto.DataBridgeBaseManifestDto)3 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)1 StorageUnitUploadCredential (org.finra.herd.model.api.xml.StorageUnitUploadCredential)1