Search in sources :

Example 96 with BusinessObjectData

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

the class BusinessObjectDataRetryStoragePolicyTransitionHelperTest method testRetryStoragePolicyTransitionUpperCaseParameters.

@Test
public void testRetryStoragePolicyTransitionUpperCaseParameters() {
    // 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 a storage policy key.
    StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME);
    // Create database entities required for testing.
    BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataServiceTestHelper.createDatabaseEntitiesForRetryStoragePolicyTransitionTesting(businessObjectDataKey, storagePolicyKey);
    // Retry a storage policy transition using upper case input parameters (except for case-sensitive partition values).
    BusinessObjectData businessObjectData = businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(new BusinessObjectDataKey(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD.toUpperCase(), STORAGE_POLICY_NAME.toUpperCase())));
    // Validate the returned object.
    businessObjectDataServiceTestHelper.validateBusinessObjectData(businessObjectDataEntity.getId(), businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS, businessObjectData);
}
Also used : BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) StoragePolicyKey(org.finra.herd.model.api.xml.StoragePolicyKey) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataRetryStoragePolicyTransitionRequest(org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 97 with BusinessObjectData

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

the class BusinessObjectDataRetryStoragePolicyTransitionHelperTest method testRetryStoragePolicyTransition.

@Test
public void testRetryStoragePolicyTransition() {
    // 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 a storage policy key.
    StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME);
    // Create database entities required for testing.
    BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataServiceTestHelper.createDatabaseEntitiesForRetryStoragePolicyTransitionTesting(businessObjectDataKey, storagePolicyKey);
    // Retry a storage policy transition.
    BusinessObjectData businessObjectData = businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(businessObjectDataKey, new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
    // Validate the returned object.
    businessObjectDataServiceTestHelper.validateBusinessObjectData(businessObjectDataEntity.getId(), businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS, businessObjectData);
}
Also used : BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) StoragePolicyKey(org.finra.herd.model.api.xml.StoragePolicyKey) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataRetryStoragePolicyTransitionRequest(org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 98 with BusinessObjectData

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

the class BusinessObjectDataRetryStoragePolicyTransitionHelperTest method testRetryStoragePolicyTransitionLowerCaseParameters.

@Test
public void testRetryStoragePolicyTransitionLowerCaseParameters() {
    // 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 a storage policy key.
    StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME);
    // Create database entities required for testing.
    BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataServiceTestHelper.createDatabaseEntitiesForRetryStoragePolicyTransitionTesting(businessObjectDataKey, storagePolicyKey);
    // Retry a storage policy transition using lower case input parameters (except for case-sensitive partition values).
    BusinessObjectData businessObjectData = businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(new BusinessObjectDataKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD.toLowerCase(), STORAGE_POLICY_NAME.toLowerCase())));
    // Validate the returned object.
    businessObjectDataServiceTestHelper.validateBusinessObjectData(businessObjectDataEntity.getId(), businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS, businessObjectData);
}
Also used : BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) StoragePolicyKey(org.finra.herd.model.api.xml.StoragePolicyKey) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataRetryStoragePolicyTransitionRequest(org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 99 with BusinessObjectData

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

the class BusinessObjectDataRetryStoragePolicyTransitionHelperTest method testRetryStoragePolicyTransitionStoragePolicyFilterNoOptionalFields.

@Test
public void testRetryStoragePolicyTransitionStoragePolicyFilterNoOptionalFields() {
    // 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 two storage policy keys.
    List<StoragePolicyKey> storagePolicyKeys = Arrays.asList(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME), new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME_2));
    // Create database entities required for testing.
    BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataServiceTestHelper.createDatabaseEntitiesForRetryStoragePolicyTransitionTesting(businessObjectDataKey, storagePolicyKeys.get(0));
    // Create another storage policy with storage policy filter with missing optional fields.
    storagePolicyDaoTestHelper.createStoragePolicyEntity(storagePolicyKeys.get(1), StoragePolicyRuleTypeEntity.DAYS_SINCE_BDATA_REGISTERED, AbstractServiceTest.BDATA_AGE_IN_DAYS, NO_BDEF_NAMESPACE, NO_BDEF_NAME, NO_FORMAT_USAGE_CODE, NO_FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_NAME, StoragePolicyStatusEntity.ENABLED, AbstractServiceTest.INITIAL_VERSION, AbstractServiceTest.LATEST_VERSION_FLAG_SET);
    // Retry a storage policy transition with storage policy filter missing all optional fields.
    BusinessObjectData businessObjectData = businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(businessObjectDataKey, new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKeys.get(1)));
    // Validate the returned object.
    businessObjectDataServiceTestHelper.validateBusinessObjectData(businessObjectDataEntity.getId(), businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS, businessObjectData);
}
Also used : BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) StoragePolicyKey(org.finra.herd.model.api.xml.StoragePolicyKey) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataRetryStoragePolicyTransitionRequest(org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 100 with BusinessObjectData

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

the class GetBusinessObjectDataTest method testGetBusinessObjectDataIncludeBusinessObjectDataStatusHistory.

@Test
public void testGetBusinessObjectDataIncludeBusinessObjectDataStatusHistory() throws Exception {
    // 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 a business object data entity.
    BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectDataKey, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID);
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    fieldExtensionList.add(buildFieldExtension("namespace", "${namespace}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDefinitionName", "${businessObjectDefinitionName}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatUsage", "${businessObjectFormatUsage}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatFileType", "${businessObjectFormatFileType}"));
    fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
    fieldExtensionList.add(buildFieldExtension("subPartitionValues", "${subPartitionValues}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatVersion", "${businessObjectFormatVersion}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataVersion", "${businessObjectDataVersion}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataStatus", "${businessObjectDataStatus}"));
    fieldExtensionList.add(buildFieldExtension("includeBusinessObjectDataStatusHistory", "${includeBusinessObjectDataStatusHistory}"));
    fieldExtensionList.add(buildFieldExtension("includeStorageUnitStatusHistory", "${includeStorageUnitStatusHistory}"));
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(buildParameter("namespace", BDEF_NAMESPACE));
    parameters.add(buildParameter("businessObjectDefinitionName", BDEF_NAME));
    parameters.add(buildParameter("businessObjectFormatUsage", FORMAT_USAGE_CODE));
    parameters.add(buildParameter("businessObjectFormatFileType", FORMAT_FILE_TYPE_CODE));
    parameters.add(buildParameter("partitionValue", PARTITION_VALUE));
    parameters.add(buildParameter("subPartitionValues", herdStringHelper.buildStringWithDefaultDelimiter(SUBPARTITION_VALUES)));
    parameters.add(buildParameter("businessObjectFormatVersion", FORMAT_VERSION.toString()));
    parameters.add(buildParameter("businessObjectDataVersion", DATA_VERSION.toString()));
    parameters.add(buildParameter("businessObjectDataStatus", BusinessObjectDataStatusEntity.VALID));
    parameters.add(buildParameter("includeBusinessObjectDataStatusHistory", INCLUDE_BUSINESS_OBJECT_DATA_STATUS_HISTORY.toString()));
    parameters.add(buildParameter("includeStorageUnitStatusHistory", NO_INCLUDE_STORAGE_UNIT_STATUS_HISTORY.toString()));
    // Build the expected response object. The business object data history record is expected to have system username for the createdBy auditable field.
    BusinessObjectData expectedBusinessObjectData = new BusinessObjectData(businessObjectDataEntity.getId(), BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_KEY, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID, NO_STORAGE_UNITS, NO_ATTRIBUTES, NO_BUSINESS_OBJECT_DATA_PARENTS, NO_BUSINESS_OBJECT_DATA_CHILDREN, Arrays.asList(new BusinessObjectDataStatusChangeEvent(BusinessObjectDataStatusEntity.VALID, HerdDateUtils.getXMLGregorianCalendarValue(IterableUtils.get(businessObjectDataEntity.getHistoricalStatuses(), 0).getCreatedOn()), HerdDaoSecurityHelper.SYSTEM_USER)));
    // Run the activiti task and validate the returned response object.
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(GetBusinessObjectDataStatus.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectData));
    testActivitiServiceTaskSuccess(GetBusinessObjectData.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataStatusChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDataStatusChangeEvent) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) FieldExtension(org.activiti.bpmn.model.FieldExtension) Parameter(org.finra.herd.model.api.xml.Parameter) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) Test(org.junit.Test)

Aggregations

BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)150 Test (org.junit.Test)121 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)64 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)57 ArrayList (java.util.ArrayList)39 BusinessObjectDataSearchKey (org.finra.herd.model.api.xml.BusinessObjectDataSearchKey)29 StorageUnit (org.finra.herd.model.api.xml.StorageUnit)25 BusinessObjectDataCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataCreateRequest)19 Storage (org.finra.herd.model.api.xml.Storage)19 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)16 Attribute (org.finra.herd.model.api.xml.Attribute)15 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)14 S3FileTransferRequestParamsDto (org.finra.herd.model.dto.S3FileTransferRequestParamsDto)12 StorageUnitEntity (org.finra.herd.model.jpa.StorageUnitEntity)11 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)9 AttributeValueFilter (org.finra.herd.model.api.xml.AttributeValueFilter)8 UploaderInputManifestDto (org.finra.herd.model.dto.UploaderInputManifestDto)8 IOException (java.io.IOException)7 BusinessObjectDataRetryStoragePolicyTransitionRequest (org.finra.herd.model.api.xml.BusinessObjectDataRetryStoragePolicyTransitionRequest)7 BusinessObjectDataSearchRequest (org.finra.herd.model.api.xml.BusinessObjectDataSearchRequest)7