Search in sources :

Example 6 with BusinessObjectDataStatusUpdateRequest

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

the class BusinessObjectDataStatusServiceTest method testUpdateBusinessObjectDataStatusTrimParameters.

@Test
public void testUpdateBusinessObjectDataStatusTrimParameters() {
    // 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);
    businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(BDATA_STATUS_2);
    // Update the business object data status.
    BusinessObjectDataStatusUpdateResponse response = businessObjectDataStatusService.updateBusinessObjectDataStatus(new BusinessObjectDataKey(addWhitespace(NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(FORMAT_USAGE_CODE), addWhitespace(FORMAT_FILE_TYPE_CODE), FORMAT_VERSION, addWhitespace(PARTITION_VALUE), addWhitespace(SUBPARTITION_VALUES), DATA_VERSION), new BusinessObjectDataStatusUpdateRequest(addWhitespace(BDATA_STATUS_2)));
    // 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_2, BDATA_STATUS, response);
}
Also used : BusinessObjectDataStatusUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest) BusinessObjectDataStatusUpdateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateResponse) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) Test(org.junit.Test)

Example 7 with BusinessObjectDataStatusUpdateRequest

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

the class BusinessObjectDataStatusServiceTest method testUpdateBusinessObjectDataStatusStatusNoExists.

@Test
public void testUpdateBusinessObjectDataStatusStatusNoExists() {
    // Create a business object data entity.
    businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, true, BDATA_STATUS);
    // Try to update a business object data status using non-existing business 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("I_DO_NOT_EXIST"));
        fail("Should throw an ObjectNotFoundException when business object data status does not exist.");
    } catch (ObjectNotFoundException e) {
        assertEquals("Business object data status \"I_DO_NOT_EXIST\" doesn't exist.", e.getMessage());
    }
}
Also used : ObjectNotFoundException(org.finra.herd.model.ObjectNotFoundException) BusinessObjectDataStatusUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) Test(org.junit.Test)

Example 8 with BusinessObjectDataStatusUpdateRequest

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

the class BusinessObjectDataStatusRestControllerTest method testUpdateBusinessObjectDataStatus.

@Test
public void testUpdateBusinessObjectDataStatus() {
    BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION);
    BusinessObjectDataStatusUpdateRequest request = new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS_2);
    BusinessObjectDataStatusUpdateResponse businessObjectDataStatusUpdateResponse = new BusinessObjectDataStatusUpdateResponse();
    when(businessObjectDataStatusService.updateBusinessObjectDataStatus(businessObjectDataKey, request)).thenReturn(businessObjectDataStatusUpdateResponse);
    // Update the business object data status.
    BusinessObjectDataStatusUpdateResponse updatedResponse = businessObjectDataStatusRestController.updateBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3), DATA_VERSION, request);
    // Verify the external calls.
    verify(businessObjectDataStatusService).updateBusinessObjectDataStatus(businessObjectDataKey, request);
    verifyNoMoreInteractions(businessObjectDataStatusService);
    // Validate the returned object.
    assertEquals(businessObjectDataStatusUpdateResponse, updatedResponse);
}
Also used : BusinessObjectDataStatusUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest) BusinessObjectDataStatusUpdateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateResponse) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) Test(org.junit.Test)

Example 9 with BusinessObjectDataStatusUpdateRequest

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

the class BusinessObjectDataStatusRestControllerTest method testUpdateBusinessObjectDataStatusMissingOptionalParameters.

@Test
public void testUpdateBusinessObjectDataStatusMissingOptionalParameters() {
    // Test if we can retrieve an attribute for the business object data with any allowed number of subpartition values (from 0 to MAX_SUBPARTITIONS).
    for (int i = 0; i <= BusinessObjectDataEntity.MAX_SUBPARTITIONS; i++) {
        // Build a list of subpartition values.
        List<String> subPartitionValues = SUBPARTITION_VALUES.subList(0, i);
        BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, subPartitionValues, DATA_VERSION);
        BusinessObjectDataStatusUpdateRequest request = new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS_2);
        BusinessObjectDataStatusUpdateResponse businessObjectDataStatusUpdateResponse = new BusinessObjectDataStatusUpdateResponse();
        when(businessObjectDataStatusService.updateBusinessObjectDataStatus(businessObjectDataKey, request)).thenReturn(businessObjectDataStatusUpdateResponse);
        // Update the business object data status using the relative endpoint.
        BusinessObjectDataStatusUpdateResponse response = null;
        switch(i) {
            case 0:
                response = businessObjectDataStatusRestController.updateBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, DATA_VERSION, new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS_2));
                break;
            case 1:
                response = businessObjectDataStatusRestController.updateBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, subPartitionValues.get(0), DATA_VERSION, new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS_2));
                break;
            case 2:
                response = businessObjectDataStatusRestController.updateBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, subPartitionValues.get(0), subPartitionValues.get(1), DATA_VERSION, new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS_2));
                break;
            case 3:
                response = businessObjectDataStatusRestController.updateBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, subPartitionValues.get(0), subPartitionValues.get(1), subPartitionValues.get(2), DATA_VERSION, new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS_2));
                break;
            case 4:
                response = businessObjectDataStatusRestController.updateBusinessObjectDataStatus(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, subPartitionValues.get(0), subPartitionValues.get(1), subPartitionValues.get(2), subPartitionValues.get(3), DATA_VERSION, new BusinessObjectDataStatusUpdateRequest(BDATA_STATUS_2));
                break;
        }
        verify(businessObjectDataStatusService).updateBusinessObjectDataStatus(businessObjectDataKey, request);
        assertEquals(businessObjectDataStatusUpdateResponse, response);
    }
    verifyNoMoreInteractions(businessObjectDataStatusService);
}
Also used : BusinessObjectDataStatusUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest) BusinessObjectDataStatusUpdateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateResponse) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) Test(org.junit.Test)

Example 10 with BusinessObjectDataStatusUpdateRequest

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

the class UpdateBusinessObjectDataStatus method executeImpl.

@Override
public void executeImpl(DelegateExecution execution) throws Exception {
    String namespace = activitiHelper.getExpressionVariableAsString(this.namespace, execution);
    String businessObjectDefinitionName = activitiHelper.getExpressionVariableAsString(this.businessObjectDefinitionName, execution);
    String businessObjectFormatUsage = activitiHelper.getExpressionVariableAsString(this.businessObjectFormatUsage, execution);
    String businessObjectFormatFileType = activitiHelper.getExpressionVariableAsString(this.businessObjectFormatFileType, execution);
    Integer businessObjectFormatVersion = activitiHelper.getExpressionVariableAsInteger(this.businessObjectFormatVersion, execution, "businessObjectFormatVersion", true);
    String partitionValue = activitiHelper.getExpressionVariableAsString(this.partitionValue, execution);
    String subPartitionValuesString = activitiHelper.getExpressionVariableAsString(this.subPartitionValues, execution);
    List<String> subPartitionValues = daoHelper.splitStringWithDefaultDelimiterEscaped(subPartitionValuesString);
    Integer businessObjectDataVersion = activitiHelper.getExpressionVariableAsInteger(this.businessObjectDataVersion, execution, "businessObjectDataVersion", true);
    String businessObjectDataStatus = activitiHelper.getExpressionVariableAsString(this.businessObjectDataStatus, execution);
    BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey();
    businessObjectDataKey.setNamespace(namespace);
    businessObjectDataKey.setBusinessObjectDefinitionName(businessObjectDefinitionName);
    businessObjectDataKey.setBusinessObjectFormatUsage(businessObjectFormatUsage);
    businessObjectDataKey.setBusinessObjectFormatFileType(businessObjectFormatFileType);
    businessObjectDataKey.setBusinessObjectFormatVersion(businessObjectFormatVersion);
    businessObjectDataKey.setPartitionValue(partitionValue);
    businessObjectDataKey.setSubPartitionValues(subPartitionValues);
    businessObjectDataKey.setBusinessObjectDataVersion(businessObjectDataVersion);
    BusinessObjectDataStatusUpdateResponse businessObjectDataStatusUpdateResponse = businessObjectDataStatusService.updateBusinessObjectDataStatus(businessObjectDataKey, new BusinessObjectDataStatusUpdateRequest(businessObjectDataStatus));
    // Create a business object data notification.
    notificationEventService.processBusinessObjectDataNotificationEventAsync(NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG, businessObjectDataStatusUpdateResponse.getBusinessObjectDataKey(), businessObjectDataStatusUpdateResponse.getStatus(), businessObjectDataStatusUpdateResponse.getPreviousStatus());
    setJsonResponseAsWorkflowVariable(businessObjectDataStatusUpdateResponse, execution);
}
Also used : BusinessObjectDataStatusUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest) BusinessObjectDataStatusUpdateResponse(org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateResponse) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey)

Aggregations

BusinessObjectDataStatusUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateRequest)16 Test (org.junit.Test)14 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)13 BusinessObjectDataStatusUpdateResponse (org.finra.herd.model.api.xml.BusinessObjectDataStatusUpdateResponse)10 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)3 UploadSingleInitiationResponse (org.finra.herd.model.api.xml.UploadSingleInitiationResponse)2 UploadDownloadServiceImpl (org.finra.herd.service.impl.UploadDownloadServiceImpl)2 StringWriter (java.io.StringWriter)1 JAXBContext (javax.xml.bind.JAXBContext)1 Marshaller (javax.xml.bind.Marshaller)1 HttpPut (org.apache.http.client.methods.HttpPut)1 URIBuilder (org.apache.http.client.utils.URIBuilder)1 StringEntity (org.apache.http.entity.StringEntity)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1