Search in sources :

Example 1 with BusinessObjectDataAttributeUpdateRequest

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

the class UpdateBusinessObjectDataAttribute 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", false);
    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", false);
    String businessObjectDataAttributeName = activitiHelper.getExpressionVariableAsString(this.businessObjectDataAttributeName, execution);
    String businessObjectDataAttributeValue = activitiHelper.getExpressionVariableAsString(this.businessObjectDataAttributeValue, execution);
    BusinessObjectDataAttributeKey businessObjectDataAttributeKey = new BusinessObjectDataAttributeKey();
    businessObjectDataAttributeKey.setNamespace(namespace);
    businessObjectDataAttributeKey.setBusinessObjectDefinitionName(businessObjectDefinitionName);
    businessObjectDataAttributeKey.setBusinessObjectFormatUsage(businessObjectFormatUsage);
    businessObjectDataAttributeKey.setBusinessObjectFormatFileType(businessObjectFormatFileType);
    businessObjectDataAttributeKey.setBusinessObjectFormatVersion(businessObjectFormatVersion);
    businessObjectDataAttributeKey.setPartitionValue(partitionValue);
    businessObjectDataAttributeKey.setSubPartitionValues(subPartitionValues);
    businessObjectDataAttributeKey.setBusinessObjectDataVersion(businessObjectDataVersion);
    businessObjectDataAttributeKey.setBusinessObjectDataAttributeName(businessObjectDataAttributeName);
    BusinessObjectDataAttributeUpdateRequest businessObjectDataAttributeUpdateRequest = new BusinessObjectDataAttributeUpdateRequest();
    businessObjectDataAttributeUpdateRequest.setBusinessObjectDataAttributeValue(businessObjectDataAttributeValue);
    BusinessObjectDataAttribute businessObjectDataAttribute = businessObjectDataAttributeService.updateBusinessObjectDataAttribute(businessObjectDataAttributeKey, businessObjectDataAttributeUpdateRequest);
    setJsonResponseAsWorkflowVariable(businessObjectDataAttribute, execution);
}
Also used : BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) BusinessObjectDataAttributeUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey)

Example 2 with BusinessObjectDataAttributeUpdateRequest

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

the class BusinessObjectDataAttributeServiceTest method testBusinessObjectDataAttributeServiceMethodsNewTransactionPropagation.

/**
 * This method is to get coverage for the business object data attribute service methods that have an explicit annotation for transaction propagation.
 */
@Test
public void testBusinessObjectDataAttributeServiceMethodsNewTransactionPropagation() {
    // 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 attribute key.
    BusinessObjectDataAttributeKey businessObjectDataAttributeKey = businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE);
    // Try to create a business object data attribute when specified business object format does not exist.
    try {
        businessObjectDataAttributeServiceImpl.createBusinessObjectDataAttribute(new BusinessObjectDataAttributeCreateRequest(businessObjectDataAttributeKey, ATTRIBUTE_VALUE_1));
        fail("Should throw an ObjectNotFoundException when not able to find business object format.");
    } catch (ObjectNotFoundException e) {
        assertEquals(businessObjectFormatServiceTestHelper.getExpectedBusinessObjectFormatNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION), e.getMessage());
    }
    // Try to retrieve a business object data attribute when specified business object data instance does not exist.
    try {
        businessObjectDataAttributeServiceImpl.getBusinessObjectDataAttribute(businessObjectDataAttributeKey);
        fail("Should throw an ObjectNotFoundException when not able to find business object data.");
    } catch (ObjectNotFoundException e) {
        assertEquals(businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataNotFoundErrorMessage(businessObjectDataKey, NO_BDATA_STATUS), e.getMessage());
    }
    // Try to update a business object data attribute when specified business object format does not exist.
    try {
        businessObjectDataAttributeServiceImpl.updateBusinessObjectDataAttribute(businessObjectDataAttributeKey, new BusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_2));
        fail("Should throw an ObjectNotFoundException when not able to find business object format.");
    } catch (ObjectNotFoundException e) {
        assertEquals(businessObjectFormatServiceTestHelper.getExpectedBusinessObjectFormatNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION), e.getMessage());
    }
    // Try to delete a business object data attribute when specified business object format does not exist.
    try {
        businessObjectDataAttributeServiceImpl.deleteBusinessObjectDataAttribute(businessObjectDataAttributeKey);
        fail("Should throw an ObjectNotFoundException when not able to find business object format.");
    } catch (ObjectNotFoundException e) {
        assertEquals(businessObjectFormatServiceTestHelper.getExpectedBusinessObjectFormatNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION), e.getMessage());
    }
    // Try to retrieve keys for all business object data attributes for a non-existing business object data.
    try {
        assertTrue(CollectionUtils.isEmpty(businessObjectDataAttributeServiceImpl.getBusinessObjectDataAttributes(businessObjectDataKey).getBusinessObjectDataAttributeKeys()));
        fail("Should throw an ObjectNotFoundException when not able to find business object data.");
    } catch (ObjectNotFoundException e) {
        assertEquals(businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataNotFoundErrorMessage(businessObjectDataKey, NO_BDATA_STATUS), e.getMessage());
    }
}
Also used : BusinessObjectDataAttributeCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataAttributeCreateRequest) ObjectNotFoundException(org.finra.herd.model.ObjectNotFoundException) BusinessObjectDataAttributeUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) Test(org.junit.Test)

Example 3 with BusinessObjectDataAttributeUpdateRequest

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

the class BusinessObjectDataAttributeServiceTestHelper method createBusinessObjectDataAttributeUpdateRequest.

/**
 * Creates a business object data attribute update request.
 *
 * @return the newly created business object data attribute update request
 */
public BusinessObjectDataAttributeUpdateRequest createBusinessObjectDataAttributeUpdateRequest(String businessObjectDataAttributeValue) {
    BusinessObjectDataAttributeUpdateRequest request = new BusinessObjectDataAttributeUpdateRequest();
    request.setBusinessObjectDataAttributeValue(businessObjectDataAttributeValue);
    return request;
}
Also used : BusinessObjectDataAttributeUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest)

Example 4 with BusinessObjectDataAttributeUpdateRequest

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

the class BusinessObjectDataAttributeRestControllerTest method testUpdateBusinessObjectDataAttributeSubPartitionValuesCount0.

@Test
public void testUpdateBusinessObjectDataAttributeSubPartitionValuesCount0() {
    // Create a business object data update request.
    BusinessObjectDataAttributeUpdateRequest businessObjectDataAttributeUpdateRequest = new BusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1);
    // Create a business object data attribute key.
    BusinessObjectDataAttributeKey businessObjectDataAttributeKey = new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE);
    // Create a business object data attribute.
    BusinessObjectDataAttribute businessObjectDataAttribute = new BusinessObjectDataAttribute(ID, businessObjectDataAttributeKey, ATTRIBUTE_VALUE_1);
    // Mock the external calls.
    when(businessObjectDataAttributeService.updateBusinessObjectDataAttribute(businessObjectDataAttributeKey, businessObjectDataAttributeUpdateRequest)).thenReturn(businessObjectDataAttribute);
    // Call the method under test.
    BusinessObjectDataAttribute result = businessObjectDataAttributeRestController.updateBusinessObjectDataAttribute(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, businessObjectDataAttributeUpdateRequest);
    // Verify the external calls.
    verify(businessObjectDataAttributeService).updateBusinessObjectDataAttribute(businessObjectDataAttributeKey, businessObjectDataAttributeUpdateRequest);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAttribute, result);
}
Also used : BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) BusinessObjectDataAttributeUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Example 5 with BusinessObjectDataAttributeUpdateRequest

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

the class BusinessObjectDataAttributeRestControllerTest method testUpdateBusinessObjectDataAttributeSubPartitionValuesCount1.

@Test
public void testUpdateBusinessObjectDataAttributeSubPartitionValuesCount1() {
    // Create a business object data update request.
    BusinessObjectDataAttributeUpdateRequest businessObjectDataAttributeUpdateRequest = new BusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1);
    // Create a business object data attribute key.
    BusinessObjectDataAttributeKey businessObjectDataAttributeKey = new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUBPARTITION_VALUES.get(0)), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE);
    // Create a business object data attribute.
    BusinessObjectDataAttribute businessObjectDataAttribute = new BusinessObjectDataAttribute(ID, businessObjectDataAttributeKey, ATTRIBUTE_VALUE_1);
    // Mock the external calls.
    when(businessObjectDataAttributeService.updateBusinessObjectDataAttribute(businessObjectDataAttributeKey, businessObjectDataAttributeUpdateRequest)).thenReturn(businessObjectDataAttribute);
    // Call the method under test.
    BusinessObjectDataAttribute result = businessObjectDataAttributeRestController.updateBusinessObjectDataAttribute(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES.get(0), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, businessObjectDataAttributeUpdateRequest);
    // Verify the external calls.
    verify(businessObjectDataAttributeService).updateBusinessObjectDataAttribute(businessObjectDataAttributeKey, businessObjectDataAttributeUpdateRequest);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAttribute, result);
}
Also used : BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) BusinessObjectDataAttributeUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Aggregations

BusinessObjectDataAttributeUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest)8 BusinessObjectDataAttributeKey (org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey)7 BusinessObjectDataAttribute (org.finra.herd.model.api.xml.BusinessObjectDataAttribute)6 Test (org.junit.Test)6 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)1 BusinessObjectDataAttributeCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataAttributeCreateRequest)1 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)1