use of org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest in project herd by FINRAOS.
the class UploadDownloadServiceTest method testPerformCompleteUploadSingleMessageSourceBusinessObjectDataStatusNotUploading.
@Test
public void testPerformCompleteUploadSingleMessageSourceBusinessObjectDataStatusNotUploading() {
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();
// Create a business object data status.
businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(BDATA_STATUS);
// Update the status of the source business object data so it would not be "UPLOADING".
businessObjectDataStatusService.updateBusinessObjectDataStatus(businessObjectDataHelper.getBusinessObjectDataKey(resultUploadSingleInitiationResponse.getSourceBusinessObjectData()), new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS));
// Try to complete the upload, when source business object data status is not "UPLOADING".
UploadDownloadServiceImpl.CompleteUploadSingleMessageResult result = uploadDownloadService.performCompleteUploadSingleMessage(filePath);
assertEquals(BDATA_STATUS, result.getSourceOldBusinessObjectDataStatus());
assertNull(result.getSourceNewBusinessObjectDataStatus());
assertEquals(BusinessObjectDataStatusEntity.UPLOADING, result.getTargetOldBusinessObjectDataStatus());
assertNull(result.getTargetNewBusinessObjectDataStatus());
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest in project herd by FINRAOS.
the class UploadDownloadServiceTest method testPerformCompleteUploadSingleMessageTargetBusinessObjectDataStatusNotUploading.
@Test
public void testPerformCompleteUploadSingleMessageTargetBusinessObjectDataStatusNotUploading() {
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();
// Create a business object data status.
businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(BDATA_STATUS);
// Update the status of the target business object data so it would not be "UPLOADING".
businessObjectDataStatusService.updateBusinessObjectDataStatus(businessObjectDataHelper.getBusinessObjectDataKey(resultUploadSingleInitiationResponse.getTargetBusinessObjectData()), new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS));
// Try to complete the upload, when target business object data status is not "UPLOADING".
UploadDownloadServiceImpl.CompleteUploadSingleMessageResult result = uploadDownloadService.performCompleteUploadSingleMessage(filePath);
assertEquals(BusinessObjectDataStatusEntity.UPLOADING, result.getSourceOldBusinessObjectDataStatus());
assertNull(result.getSourceNewBusinessObjectDataStatus());
assertEquals(BDATA_STATUS, result.getTargetOldBusinessObjectDataStatus());
assertNull(result.getTargetNewBusinessObjectDataStatus());
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest in project herd by FINRAOS.
the class BusinessObjectDataStatusServiceTest method testUpdateBusinessObjectDataStatusLowerCaseParameters.
@Test
public void testUpdateBusinessObjectDataStatusLowerCaseParameters() {
// Create and persist relative test entities.
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, true, BDATA_STATUS.toUpperCase());
businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(BDATA_STATUS_2.toUpperCase());
// Update the business object data status using lower case input parameters (except for case-sensitive partition values).
BusinessObjectDataStatusUpdateResponse response = businessObjectDataStatusService.updateBusinessObjectDataStatus(new BusinessObjectDataKey(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS_2.toLowerCase()));
// Validate the returned object.
businessObjectDataServiceTestHelper.validateBusinessObjectDataStatusUpdateResponse(new BusinessObjectDataKey(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), BDATA_STATUS_2.toUpperCase(), BDATA_STATUS.toUpperCase(), response);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest in project herd by FINRAOS.
the class BusinessObjectDataStatusServiceTest method testUpdateBusinessObjectDataStatusBusinessObjectDataNoExists.
@Test
public void testUpdateBusinessObjectDataStatusBusinessObjectDataNoExists() {
// Try to update a business object data status using non-existing business object data.
businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(BDATA_STATUS);
try {
businessObjectDataStatusService.updateBusinessObjectDataStatus(new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS));
fail("Should throw an ObjectNotFoundException when business object data does not exist.");
} catch (ObjectNotFoundException e) {
assertEquals(businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataNotFoundErrorMessage(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, null), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest in project herd by FINRAOS.
the class BusinessObjectDataStatusServiceTest method testUpdateBusinessObjectDataStatusNoStatusChange.
@Test
public void testUpdateBusinessObjectDataStatusNoStatusChange() {
// Create and persist relative test entities.
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, true, BDATA_STATUS);
// Update the business object data status.
BusinessObjectDataStatusUpdateResponse response = businessObjectDataStatusService.updateBusinessObjectDataStatus(new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS));
// Validate the returned object.
businessObjectDataServiceTestHelper.validateBusinessObjectDataStatusUpdateResponse(new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), BDATA_STATUS, BDATA_STATUS, response);
}
Aggregations