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);
}
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());
}
}
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;
}
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);
}
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);
}
Aggregations