use of org.finra.herd.model.api.xml.BusinessObjectDataAttribute in project herd by FINRAOS.
the class UpdateBusinessObjectDataAttributeTest method testUpdateBusinessObjectDataAttributeMissingOptionalParameters.
@Test
public void testUpdateBusinessObjectDataAttributeMissingOptionalParameters() throws Exception {
// Create a business object data key without sub-partition values.
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION);
// Create a business object data attribute entity.
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
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("businessObjectDataAttributeName", "${businessObjectDataAttributeName}"));
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("businessObjectDataAttributeName", ATTRIBUTE_NAME_1_MIXED_CASE));
// Build the expected response object.
BusinessObjectDataAttribute expectedBusinessObjectDataAttribute = new BusinessObjectDataAttribute(businessObjectDataAttributeEntity.getId(), businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE), null);
// Run the activiti task and validate the returned response object.
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(UpdateBusinessObjectDataAttribute.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataAttribute));
testActivitiServiceTaskSuccess(UpdateBusinessObjectDataAttribute.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataAttribute in project herd by FINRAOS.
the class UpdateBusinessObjectDataAttributeTest method testUpdateBusinessObjectDataAttributeMissingOptionalParametersSubPartitionValuesAsEmptyString.
@Test
public void testUpdateBusinessObjectDataAttributeMissingOptionalParametersSubPartitionValuesAsEmptyString() throws Exception {
// Create a business object data key without sub-partition values.
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION);
// Create a business object data attribute entity.
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
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("businessObjectDataAttributeName", "${businessObjectDataAttributeName}"));
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", EMPTY_STRING));
parameters.add(buildParameter("businessObjectDataVersion", DATA_VERSION.toString()));
parameters.add(buildParameter("businessObjectDataAttributeName", ATTRIBUTE_NAME_1_MIXED_CASE));
// Build the expected response object.
BusinessObjectDataAttribute expectedBusinessObjectDataAttribute = new BusinessObjectDataAttribute(businessObjectDataAttributeEntity.getId(), businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE), null);
// Run the activiti task and validate the returned response object.
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(UpdateBusinessObjectDataAttribute.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataAttribute));
testActivitiServiceTaskSuccess(UpdateBusinessObjectDataAttribute.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataAttribute in project herd by FINRAOS.
the class CreateBusinessObjectDataAttributeTest method testCreateBusinessObjectDataAttribute.
@Test
public void testCreateBusinessObjectDataAttribute() 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.
businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS);
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("businessObjectDataAttributeName", "${businessObjectDataAttributeName}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataAttributeValue", "${businessObjectDataAttributeValue}"));
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("businessObjectDataAttributeName", ATTRIBUTE_NAME_1_MIXED_CASE));
parameters.add(buildParameter("businessObjectDataAttributeValue", ATTRIBUTE_VALUE_1));
// Run the activiti task.
String activitiXml = buildActivitiXml(CreateBusinessObjectDataAttribute.class.getCanonicalName(), fieldExtensionList);
Job job = jobServiceTestHelper.createJobFromActivitiXml(activitiXml, parameters);
assertNotNull(job);
HistoricProcessInstance hisInstance = activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
Map<String, Object> variables = hisInstance.getProcessVariables();
// Validate status.
String serviceTaskStatus = (String) variables.get(getServiceTaskVariableName(ActivitiRuntimeHelper.VARIABLE_STATUS));
assertEquals(ActivitiRuntimeHelper.TASK_STATUS_SUCCESS, serviceTaskStatus);
// Retrieve JSON response.
String jsonResponse = (String) variables.get(getServiceTaskVariableName(BaseJavaDelegate.VARIABLE_JSON_RESPONSE));
ObjectMapper objectMapper = new ObjectMapper();
BusinessObjectDataAttribute businessObjectDataAttribute = objectMapper.readValue(jsonResponse.getBytes(), BusinessObjectDataAttribute.class);
// Validate JSON response.
assertEquals(BDEF_NAMESPACE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getNamespace());
assertEquals(BDEF_NAME, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDefinitionName());
assertEquals(FORMAT_USAGE_CODE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatUsage());
assertEquals(FORMAT_FILE_TYPE_CODE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatFileType());
assertEquals(FORMAT_VERSION, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatVersion());
assertEquals(PARTITION_VALUE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getPartitionValue());
assertEquals(SUBPARTITION_VALUES, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getSubPartitionValues());
assertEquals(DATA_VERSION, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDataVersion());
assertEquals(ATTRIBUTE_NAME_1_MIXED_CASE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDataAttributeName());
assertEquals(ATTRIBUTE_VALUE_1, businessObjectDataAttribute.getBusinessObjectDataAttributeValue());
}
use of org.finra.herd.model.api.xml.BusinessObjectDataAttribute in project herd by FINRAOS.
the class DeleteBusinessObjectDataAttributeTest method testDeleteBusinessObjectDataAttributeMissingOptionalParameters.
@Test
public void testDeleteBusinessObjectDataAttributeMissingOptionalParameters() throws Exception {
// Create a business object data key without sub-partition values.
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, DATA_VERSION);
// Create a business object data attribute key.
BusinessObjectDataAttributeKey businessObjectDataAttributeKey = businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE);
// Create a business object data attribute entity.
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
// Validate that the business object data attribute is created.
assertNotNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(businessObjectDataAttributeKey));
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("businessObjectDataAttributeName", "${businessObjectDataAttributeName}"));
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("businessObjectDataAttributeName", ATTRIBUTE_NAME_1_MIXED_CASE));
// Build the expected response object.
BusinessObjectDataAttribute expectedBusinessObjectDataAttribute = new BusinessObjectDataAttribute(businessObjectDataAttributeEntity.getId(), businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE), ATTRIBUTE_VALUE_1);
// Run the activiti task and validate the returned response object.
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(DeleteBusinessObjectDataAttribute.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataAttribute));
testActivitiServiceTaskSuccess(DeleteBusinessObjectDataAttribute.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
// Validate that the business object data attribute is deleted.
assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(businessObjectDataAttributeKey));
}
use of org.finra.herd.model.api.xml.BusinessObjectDataAttribute in project herd by FINRAOS.
the class CreateBusinessObjectDataAttribute 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);
BusinessObjectDataAttributeCreateRequest businessObjectDataAttributeCreateRequest = new BusinessObjectDataAttributeCreateRequest();
businessObjectDataAttributeCreateRequest.setBusinessObjectDataAttributeKey(businessObjectDataAttributeKey);
businessObjectDataAttributeCreateRequest.setBusinessObjectDataAttributeValue(businessObjectDataAttributeValue);
BusinessObjectDataAttribute businessObjectDataAttribute = businessObjectDataAttributeService.createBusinessObjectDataAttribute(businessObjectDataAttributeCreateRequest);
setJsonResponseAsWorkflowVariable(businessObjectDataAttribute, execution);
}
Aggregations