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());
}
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));
}
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);
}
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());
}
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());
}
Aggregations