use of org.finra.herd.model.api.xml.UploadSingleInitiationResponse in project herd by FINRAOS.
the class UploadDownloadServiceTest method testPerformCompleteUploadSingleMessageS3FileNoExists.
@Test
public void testPerformCompleteUploadSingleMessageS3FileNoExists() {
uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting();
UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, FILE_NAME));
String filePath = resultUploadSingleInitiationResponse.getTargetBusinessObjectData().getStorageUnits().get(0).getStorageFiles().get(0).getFilePath();
// Try to complete the upload, when source S3 file does not exist.
UploadDownloadServiceImpl.CompleteUploadSingleMessageResult result = uploadDownloadService.performCompleteUploadSingleMessage(filePath);
assertEquals(BusinessObjectDataStatusEntity.UPLOADING, result.getSourceOldBusinessObjectDataStatus());
assertEquals(BusinessObjectDataStatusEntity.DELETED, result.getSourceNewBusinessObjectDataStatus());
assertEquals(BusinessObjectDataStatusEntity.UPLOADING, result.getTargetOldBusinessObjectDataStatus());
assertEquals(BusinessObjectDataStatusEntity.INVALID, result.getTargetNewBusinessObjectDataStatus());
}
use of org.finra.herd.model.api.xml.UploadSingleInitiationResponse in project herd by FINRAOS.
the class UploadDownloadServiceTest method testInitiateUploadSingleRequiredAttribute.
@Test
public void testInitiateUploadSingleRequiredAttribute() {
// Create database entities required for testing.
uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting();
// Create and persist a business object data attribute definition entity.
businessObjectFormatDaoTestHelper.createBusinessObjectDataAttributeDefinitionEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE);
// Initiate a file upload.
UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest());
// Validate the returned object.
uploadDownloadServiceTestHelper.validateUploadSingleInitiationResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, businessObjectDefinitionServiceTestHelper.getNewAttributes(), FILE_NAME, FILE_SIZE_1_KB, null, resultUploadSingleInitiationResponse);
}
use of org.finra.herd.model.api.xml.UploadSingleInitiationResponse in project herd by FINRAOS.
the class UploadDownloadServiceTest method testInitiateDownloadSingle.
@Test
public void testInitiateDownloadSingle() {
// Create the upload data.
UploadSingleInitiationResponse uploadSingleInitiationResponse = uploadDownloadServiceTestHelper.createUploadedFileData(BusinessObjectDataStatusEntity.VALID);
// Initiate the download against the uploaded data (i.e. the target business object data).
DownloadSingleInitiationResponse downloadSingleInitiationResponse = initiateDownload(uploadSingleInitiationResponse.getTargetBusinessObjectData());
// Validate the download initiation response.
uploadDownloadServiceTestHelper.validateDownloadSingleInitiationResponse(uploadSingleInitiationResponse, downloadSingleInitiationResponse);
}
use of org.finra.herd.model.api.xml.UploadSingleInitiationResponse in project herd by FINRAOS.
the class UploadDownloadServiceTest method testInitiateUploadSingle.
@Test
public void testInitiateUploadSingle() {
// Create database entities required for testing.
uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting();
// Initiate a file upload.
UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest());
// Validate the returned object.
uploadDownloadServiceTestHelper.validateUploadSingleInitiationResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, businessObjectDefinitionServiceTestHelper.getNewAttributes(), FILE_NAME, FILE_SIZE_1_KB, null, resultUploadSingleInitiationResponse);
}
use of org.finra.herd.model.api.xml.UploadSingleInitiationResponse in project herd by FINRAOS.
the class UploadDownloadServiceTest method testInitiateUploadSingleLowerCaseParameters.
@Test
public void testInitiateUploadSingleLowerCaseParameters() {
// Create database entities required for testing.
uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting();
// Initiate a file upload using upper case values.
UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, NAMESPACE.toUpperCase(), BDEF_NAME_2.toUpperCase(), FORMAT_USAGE_CODE_2.toUpperCase(), FORMAT_FILE_TYPE_CODE_2.toUpperCase(), FORMAT_VERSION_2));
// Validate the returned object.
uploadDownloadServiceTestHelper.validateUploadSingleInitiationResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, businessObjectDefinitionServiceTestHelper.getNewAttributes(), FILE_NAME, FILE_SIZE_1_KB, null, resultUploadSingleInitiationResponse);
}
Aggregations