Search in sources :

Example 16 with BusinessObjectDataStorageFilesCreateResponse

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

the class BusinessObjectDataStorageFileServiceTest method testCreateBusinessObjectDataStorageFilesS3ManagedExtraFilesInS3.

@Test
public void testCreateBusinessObjectDataStorageFilesS3ManagedExtraFilesInS3() throws Exception {
    // Create test data.
    createData(null, true, Arrays.asList(testS3KeyPrefix + "/" + FILE_PATH_1));
    // Create and upload to S3 managed storage a set of test files including an extra
    // file not to be listed in the create business object data create request.
    businessObjectDataServiceTestHelper.prepareTestS3Files(testS3KeyPrefix, localTempPath, Arrays.asList(FILE_PATH_1, FILE_PATH_2, FILE_PATH_3));
    BusinessObjectDataStorageFilesCreateRequest request = new BusinessObjectDataStorageFilesCreateRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, StorageEntity.MANAGED_STORAGE, Arrays.asList(createFile(testS3KeyPrefix + "/" + FILE_PATH_2, FILE_SIZE_1_KB, ROW_COUNT_1000)), NO_DISCOVER_STORAGE_FILES);
    BusinessObjectDataStorageFilesCreateResponse response = businessObjectDataStorageFileService.createBusinessObjectDataStorageFiles(request);
    // Validate the returned object.
    businessObjectDataServiceTestHelper.validateBusinessObjectDataStorageFilesCreateResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION, StorageEntity.MANAGED_STORAGE, request.getStorageFiles(), response);
}
Also used : BusinessObjectDataStorageFilesCreateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateResponse) BusinessObjectDataStorageFilesCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest) Test(org.junit.Test)

Example 17 with BusinessObjectDataStorageFilesCreateResponse

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

the class BusinessObjectDataStorageFileServiceTest method testCreateBusinessObjectDataStorageFilesUpperCaseParameters.

@Test
public void testCreateBusinessObjectDataStorageFilesUpperCaseParameters() {
    createDataWithSubPartitions();
    // Create business object data storage files using upper case input parameters (except for case-sensitive partition values and storage file paths).
    BusinessObjectDataStorageFilesCreateRequest request = new BusinessObjectDataStorageFilesCreateRequest(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, PARTITION_VALUE, SUB_PARTITION_VALUES, DATA_VERSION, STORAGE_NAME.toUpperCase(), Arrays.asList(createFile(FILE_PATH_2, FILE_SIZE_1_KB, ROW_COUNT_1000)), NO_DISCOVER_STORAGE_FILES);
    BusinessObjectDataStorageFilesCreateResponse response = businessObjectDataStorageFileService.createBusinessObjectDataStorageFiles(request);
    // Validate the returned object.
    businessObjectDataServiceTestHelper.validateBusinessObjectDataStorageFilesCreateResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUB_PARTITION_VALUES, DATA_VERSION, STORAGE_NAME, request.getStorageFiles(), response);
}
Also used : BusinessObjectDataStorageFilesCreateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateResponse) BusinessObjectDataStorageFilesCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest) Test(org.junit.Test)

Example 18 with BusinessObjectDataStorageFilesCreateResponse

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

the class BusinessObjectDataStorageFileServiceTest method testCreateBusinessObjectDataStorageFilesMissingOptionalParameters.

@Test
public void testCreateBusinessObjectDataStorageFilesMissingOptionalParameters() {
    // Create and persist a business object definition.
    businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION);
    createData(null, false);
    // Create business object data storage files without passing any of the optional parameters.
    BusinessObjectDataStorageFilesCreateRequest request = new BusinessObjectDataStorageFilesCreateRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, STORAGE_NAME, Arrays.asList(createFile(FILE_PATH_2, FILE_SIZE_1_KB, null)), NO_DISCOVER_STORAGE_FILES);
    BusinessObjectDataStorageFilesCreateResponse response = businessObjectDataStorageFileService.createBusinessObjectDataStorageFiles(request);
    // Validate the returned object.
    businessObjectDataServiceTestHelper.validateBusinessObjectDataStorageFilesCreateResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME, request.getStorageFiles(), response);
}
Also used : BusinessObjectDataStorageFilesCreateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateResponse) BusinessObjectDataStorageFilesCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest) Test(org.junit.Test)

Example 19 with BusinessObjectDataStorageFilesCreateResponse

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

the class DataBridgeWebClientTest method testGetBusinessObjectDataStorageFilesCreateResponse200ValidResponse.

@Test
public void testGetBusinessObjectDataStorageFilesCreateResponse200ValidResponse() throws Exception {
    CloseableHttpResponse httpResponse = new MockCloseableHttpResponse(new BasicStatusLine(HttpVersion.HTTP_1_1, 200, "testReasonPhrase"), false);
    httpResponse.setEntity(new StringEntity(xmlHelper.objectToXml(new BusinessObjectDataStorageFilesCreateResponse())));
    BusinessObjectDataStorageFilesCreateResponse businessObjectDataStorageFilesCreateResponse = dataBridgeWebClient.getBusinessObjectDataStorageFilesCreateResponse(httpResponse);
    assertNotNull("businessObjectDataStorageFilesCreateResponse", businessObjectDataStorageFilesCreateResponse);
}
Also used : BusinessObjectDataStorageFilesCreateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateResponse) StringEntity(org.apache.http.entity.StringEntity) MockCloseableHttpResponse(org.finra.herd.dao.impl.MockCloseableHttpResponse) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) MockCloseableHttpResponse(org.finra.herd.dao.impl.MockCloseableHttpResponse) BasicStatusLine(org.apache.http.message.BasicStatusLine) Test(org.junit.Test)

Example 20 with BusinessObjectDataStorageFilesCreateResponse

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

the class DataBridgeWebClientTest method testAddStorageFiles.

/**
 * Calls addStorageFiles() method and makes assertions.
 *
 * @param useSsl specifies whether to use SSL or not
 *
 * @throws IOException
 * @throws JAXBException
 * @throws URISyntaxException
 */
private void testAddStorageFiles(boolean useSsl) throws IOException, JAXBException, URISyntaxException {
    dataBridgeWebClient.regServerAccessParamsDto.setUseSsl(useSsl);
    BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey();
    UploaderInputManifestDto manifest = getUploaderInputManifestDto();
    S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = new S3FileTransferRequestParamsDto();
    String storageName = "testStorage";
    BusinessObjectDataStorageFilesCreateResponse businessObjectDataStorageFilesCreateResponse = dataBridgeWebClient.addStorageFiles(businessObjectDataKey, manifest, s3FileTransferRequestParamsDto, storageName);
    assertNotNull("businessObjectDataStorageFilesCreateResponse", businessObjectDataStorageFilesCreateResponse);
}
Also used : BusinessObjectDataStorageFilesCreateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateResponse) S3FileTransferRequestParamsDto(org.finra.herd.model.dto.S3FileTransferRequestParamsDto) UploaderInputManifestDto(org.finra.herd.model.dto.UploaderInputManifestDto) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey)

Aggregations

BusinessObjectDataStorageFilesCreateResponse (org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateResponse)21 Test (org.junit.Test)16 BusinessObjectDataStorageFilesCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest)14 StringEntity (org.apache.http.entity.StringEntity)4 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)3 BasicStatusLine (org.apache.http.message.BasicStatusLine)3 MockCloseableHttpResponse (org.finra.herd.dao.impl.MockCloseableHttpResponse)3 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)2 StorageFile (org.finra.herd.model.api.xml.StorageFile)2 S3FileTransferRequestParamsDto (org.finra.herd.model.dto.S3FileTransferRequestParamsDto)2 UploaderInputManifestDto (org.finra.herd.model.dto.UploaderInputManifestDto)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 StringWriter (java.io.StringWriter)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 JAXBContext (javax.xml.bind.JAXBContext)1 Marshaller (javax.xml.bind.Marshaller)1 HttpPost (org.apache.http.client.methods.HttpPost)1 URIBuilder (org.apache.http.client.utils.URIBuilder)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1