use of org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest in project herd by FINRAOS.
the class BusinessObjectDataStorageFileServiceTest method testBusinessObjectDataStorageFileServiceMethodsNewTx.
/**
* This method is to get the coverage for the business object data storage file service method that starts the new transaction.
*/
@Test
public void testBusinessObjectDataStorageFileServiceMethodsNewTx() throws Exception {
BusinessObjectDataStorageFilesCreateRequest request = new BusinessObjectDataStorageFilesCreateRequest();
try {
businessObjectDataStorageFileServiceImpl.createBusinessObjectDataStorageFiles(request);
fail("Should throw a IllegalArgumentException.");
} catch (IllegalArgumentException e) {
assertEquals("A namespace must be specified.", e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest in project herd by FINRAOS.
the class BusinessObjectDataStorageFileServiceTest method testCreateBusinessObjectDataStorageFilesAutoDiscoveryPreviouslyRegisteredS3FileNotFound.
@Test
public void testCreateBusinessObjectDataStorageFilesAutoDiscoveryPreviouslyRegisteredS3FileNotFound() throws Exception {
// Create test data.
createData(testS3KeyPrefix, true, Arrays.asList(testS3KeyPrefix + "/" + FILE_PATH_1));
// Create and upload to S3 managed storage a test file that is not the already registered storage file.
businessObjectDataServiceTestHelper.prepareTestS3Files(testS3KeyPrefix, localTempPath, Arrays.asList(FILE_PATH_2));
// Try to discover storage files when an already registered storage file is not found in S3.
try {
businessObjectDataStorageFileService.createBusinessObjectDataStorageFiles(new BusinessObjectDataStorageFilesCreateRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION, StorageEntity.MANAGED_STORAGE, NO_STORAGE_FILES, DISCOVER_STORAGE_FILES));
fail("Should throw an ObjectNotFoundException when an already registered storage file not found in S3.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Previously registered storage file not found at s3://%s/%s/%s location.", storageDaoTestHelper.getS3ManagedBucketName(), testS3KeyPrefix, FILE_PATH_1), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest in project herd by FINRAOS.
the class BusinessObjectDataServiceTestHelper method getNewBusinessObjectDataStorageFilesCreateRequest.
public BusinessObjectDataStorageFilesCreateRequest getNewBusinessObjectDataStorageFilesCreateRequest() {
// Crete a test business object format (and associated data).
BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(false);
BusinessObjectDataStatusEntity businessObjectDataStatusEntity = businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(AbstractServiceTest.BDATA_STATUS, AbstractServiceTest.DESCRIPTION, AbstractServiceTest.BDATA_STATUS_PRE_REGISTRATION_FLAG_SET);
BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectFormatEntity, AbstractServiceTest.PARTITION_VALUE, AbstractServiceTest.DATA_VERSION, AbstractServiceTest.LATEST_VERSION_FLAG_SET, businessObjectDataStatusEntity.getCode());
StorageEntity storageEntity = storageDaoTestHelper.createStorageEntity();
storageUnitDaoTestHelper.createStorageUnitEntity(storageEntity, businessObjectDataEntity, StorageUnitStatusEntity.ENABLED, AbstractServiceTest.NO_STORAGE_DIRECTORY_PATH);
// Create a business object data storage files create request.
BusinessObjectDataStorageFilesCreateRequest businessObjectDataStorageFilesCreateRequest = new BusinessObjectDataStorageFilesCreateRequest();
businessObjectDataStorageFilesCreateRequest.setNamespace(businessObjectFormatEntity.getBusinessObjectDefinition().getNamespace().getCode());
businessObjectDataStorageFilesCreateRequest.setBusinessObjectDefinitionName(businessObjectFormatEntity.getBusinessObjectDefinition().getName());
businessObjectDataStorageFilesCreateRequest.setBusinessObjectFormatUsage(businessObjectFormatEntity.getUsage());
businessObjectDataStorageFilesCreateRequest.setBusinessObjectFormatFileType(businessObjectFormatEntity.getFileType().getCode());
businessObjectDataStorageFilesCreateRequest.setBusinessObjectFormatVersion(businessObjectFormatEntity.getBusinessObjectFormatVersion());
businessObjectDataStorageFilesCreateRequest.setPartitionValue(businessObjectDataEntity.getPartitionValue());
businessObjectDataStorageFilesCreateRequest.setBusinessObjectDataVersion(businessObjectDataEntity.getVersion());
businessObjectDataStorageFilesCreateRequest.setStorageName(storageEntity.getName());
businessObjectDataStorageFilesCreateRequest.setStorageFiles(getStorageFiles());
return businessObjectDataStorageFilesCreateRequest;
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest in project herd by FINRAOS.
the class AddBusinessObjectDataStorageFilesTest method testAddBusinessObjectDataStorageFilesJson.
@Test
public void testAddBusinessObjectDataStorageFilesJson() throws Exception {
BusinessObjectDataStorageFilesCreateRequest businessObjectDataStorageFilesCreateRequest = businessObjectDataServiceTestHelper.getNewBusinessObjectDataStorageFilesCreateRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataStorageFilesCreateRequest", "${businessObjectDataStorageFilesCreateRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "json"));
parameters.add(buildParameter("businessObjectDataStorageFilesCreateRequest", jsonHelper.objectToJson(businessObjectDataStorageFilesCreateRequest)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_NOT_NULL);
testActivitiServiceTaskSuccess(AddBusinessObjectDataStorageFiles.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataStorageFilesCreateRequest in project herd by FINRAOS.
the class AddBusinessObjectDataStorageFilesTest method testAddBusinessObjectDataStorageFilesXml.
@Test
public void testAddBusinessObjectDataStorageFilesXml() throws Exception {
BusinessObjectDataStorageFilesCreateRequest businessObjectDataStorageFilesCreateRequest = businessObjectDataServiceTestHelper.getNewBusinessObjectDataStorageFilesCreateRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataStorageFilesCreateRequest", "${businessObjectDataStorageFilesCreateRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "xml"));
parameters.add(buildParameter("businessObjectDataStorageFilesCreateRequest", xmlHelper.objectToXml(businessObjectDataStorageFilesCreateRequest)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_NOT_NULL);
testActivitiServiceTaskSuccess(AddBusinessObjectDataStorageFiles.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Aggregations