Search in sources :

Example 6 with BusinessObjectDataStorageUnitStatusUpdateResponse

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

the class UpdateBusinessObjectDataStorageUnitStatusTest method testUpdateBusinessObjectDataStorageUnitStatusMissingOptionalParameters.

@Test
public void testUpdateBusinessObjectDataStorageUnitStatusMissingOptionalParameters() throws Exception {
    // Create a business object data storage unit key.
    BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME);
    // Create a storage unit entity.
    storageUnitDaoTestHelper.createStorageUnitEntity(businessObjectDataStorageUnitKey, STORAGE_UNIT_STATUS);
    // Create a storage unit status entity.
    storageUnitStatusDaoTestHelper.createStorageUnitStatusEntity(STORAGE_UNIT_STATUS_2);
    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("businessObjectFormatVersion", "${businessObjectFormatVersion}"));
    fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataVersion", "${businessObjectDataVersion}"));
    fieldExtensionList.add(buildFieldExtension("storageName", "${storageName}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataStorageUnitStatus", "${businessObjectDataStorageUnitStatus}"));
    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("businessObjectFormatVersion", FORMAT_VERSION.toString()));
    parameters.add(buildParameter("partitionValue", PARTITION_VALUE));
    parameters.add(buildParameter("businessObjectDataVersion", DATA_VERSION.toString()));
    parameters.add(buildParameter("storageName", STORAGE_NAME));
    parameters.add(buildParameter("businessObjectDataStorageUnitStatus", STORAGE_UNIT_STATUS_2));
    // Build the expected response object.
    BusinessObjectDataStorageUnitStatusUpdateResponse expectedResponse = new BusinessObjectDataStorageUnitStatusUpdateResponse(businessObjectDataStorageUnitKey, STORAGE_UNIT_STATUS_2, STORAGE_UNIT_STATUS);
    // Run the activiti task and validate the returned response object.
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(UpdateBusinessObjectDataStorageUnitStatus.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedResponse));
    testActivitiServiceTaskSuccess(UpdateBusinessObjectDataStorageUnitStatus.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataStorageUnitKey(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey) HashMap(java.util.HashMap) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) BusinessObjectDataStorageUnitStatusUpdateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitStatusUpdateResponse) Test(org.junit.Test)

Example 7 with BusinessObjectDataStorageUnitStatusUpdateResponse

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

the class UpdateBusinessObjectDataStorageUnitStatusTest method testUpdateBusinessObjectDataStorageUnitStatus.

@Test
public void testUpdateBusinessObjectDataStorageUnitStatus() throws Exception {
    // Create a business object data storage unit key.
    BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME);
    // Create a storage unit entity.
    storageUnitDaoTestHelper.createStorageUnitEntity(businessObjectDataStorageUnitKey, STORAGE_UNIT_STATUS);
    // Create a storage unit status entity.
    storageUnitStatusDaoTestHelper.createStorageUnitStatusEntity(STORAGE_UNIT_STATUS_2);
    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("businessObjectFormatVersion", "${businessObjectFormatVersion}"));
    fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
    fieldExtensionList.add(buildFieldExtension("subPartitionValues", "${subPartitionValues}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataVersion", "${businessObjectDataVersion}"));
    fieldExtensionList.add(buildFieldExtension("storageName", "${storageName}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataStorageUnitStatus", "${businessObjectDataStorageUnitStatus}"));
    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("businessObjectFormatVersion", FORMAT_VERSION.toString()));
    parameters.add(buildParameter("partitionValue", PARTITION_VALUE));
    parameters.add(buildParameter("subPartitionValues", herdStringHelper.buildStringWithDefaultDelimiter(SUBPARTITION_VALUES)));
    parameters.add(buildParameter("businessObjectDataVersion", DATA_VERSION.toString()));
    parameters.add(buildParameter("storageName", STORAGE_NAME));
    parameters.add(buildParameter("businessObjectDataStorageUnitStatus", STORAGE_UNIT_STATUS_2));
    // Build the expected response object.
    BusinessObjectDataStorageUnitStatusUpdateResponse expectedResponse = new BusinessObjectDataStorageUnitStatusUpdateResponse(businessObjectDataStorageUnitKey, STORAGE_UNIT_STATUS_2, STORAGE_UNIT_STATUS);
    // Run the activiti task and validate the returned response object.
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(UpdateBusinessObjectDataStorageUnitStatus.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedResponse));
    testActivitiServiceTaskSuccess(UpdateBusinessObjectDataStorageUnitStatus.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataStorageUnitKey(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey) HashMap(java.util.HashMap) FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) Parameter(org.finra.herd.model.api.xml.Parameter) BusinessObjectDataStorageUnitStatusUpdateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitStatusUpdateResponse) Test(org.junit.Test)

Example 8 with BusinessObjectDataStorageUnitStatusUpdateResponse

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

the class BusinessObjectDataStorageUnitStatusRestController method updateBusinessObjectDataStorageUnitStatusHelper.

/**
 * Updates status of a business object data storage unit.
 *
 * @param businessObjectDataStorageUnitKey the business object data storage unit key
 * @param request the business object data status update request
 *
 * @return the business object data storage unit status update response
 */
private BusinessObjectDataStorageUnitStatusUpdateResponse updateBusinessObjectDataStorageUnitStatusHelper(BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey, BusinessObjectDataStorageUnitStatusUpdateRequest request) {
    // Update status of the business object data storage unit.
    BusinessObjectDataStorageUnitStatusUpdateResponse response = businessObjectDataStorageUnitStatusService.updateBusinessObjectDataStorageUnitStatus(businessObjectDataStorageUnitKey, request);
    // Create storage unit notification.
    notificationEventService.processStorageUnitNotificationEventAsync(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG, storageUnitHelper.getBusinessObjectDataKey(response.getBusinessObjectDataStorageUnitKey()), response.getBusinessObjectDataStorageUnitKey().getStorageName(), response.getStatus(), response.getPreviousStatus());
    return response;
}
Also used : BusinessObjectDataStorageUnitStatusUpdateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitStatusUpdateResponse)

Aggregations

BusinessObjectDataStorageUnitStatusUpdateResponse (org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitStatusUpdateResponse)8 BusinessObjectDataStorageUnitKey (org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey)6 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 FieldExtension (org.activiti.bpmn.model.FieldExtension)3 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)3 BusinessObjectDataStorageUnitStatusUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitStatusUpdateRequest)3 Parameter (org.finra.herd.model.api.xml.Parameter)3 StorageUnitEntity (org.finra.herd.model.jpa.StorageUnitEntity)2 StorageUnitStatusEntity (org.finra.herd.model.jpa.StorageUnitStatusEntity)2 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1