Search in sources :

Example 36 with BusinessObjectDataAttribute

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

the class DeleteBusinessObjectDataAttributeTest method testDeleteBusinessObjectDataAttributeMissingOptionalParametersSubPartitionValuesAsEmptyString.

@Test
public void testDeleteBusinessObjectDataAttributeMissingOptionalParametersSubPartitionValuesAsEmptyString() 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("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), 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));
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) HashMap(java.util.HashMap) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) ArrayList(java.util.ArrayList) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) FieldExtension(org.activiti.bpmn.model.FieldExtension) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 37 with BusinessObjectDataAttribute

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

the class GetBusinessObjectDataAttributeTest method testGetBusinessObjectDataAttributeMissingOptionalParametersSubPartitionValuesAsEmptyString.

@Test
public void testGetBusinessObjectDataAttributeMissingOptionalParametersSubPartitionValuesAsEmptyString() 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), ATTRIBUTE_VALUE_1);
    // Run the activiti task and validate the returned response object.
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(GetBusinessObjectDataAttribute.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataAttribute));
    testActivitiServiceTaskSuccess(GetBusinessObjectDataAttribute.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) FieldExtension(org.activiti.bpmn.model.FieldExtension) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 38 with BusinessObjectDataAttribute

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

the class BusinessObjectDataAttributeRestControllerTest method testDeleteBusinessObjectDataAttributeSubPartitionValuesCount3.

@Test
public void testDeleteBusinessObjectDataAttributeSubPartitionValuesCount3() {
    // 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), SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2)), 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.deleteBusinessObjectDataAttribute(businessObjectDataAttributeKey)).thenReturn(businessObjectDataAttribute);
    // Call the method under test.
    BusinessObjectDataAttribute result = businessObjectDataAttributeRestController.deleteBusinessObjectDataAttribute(BDEF_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), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE);
    // Verify the external calls.
    verify(businessObjectDataAttributeService).deleteBusinessObjectDataAttribute(businessObjectDataAttributeKey);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAttribute, result);
}
Also used : BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Example 39 with BusinessObjectDataAttribute

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

the class BusinessObjectDataAttributeRestControllerTest method testCreateBusinessObjectDataAttribute.

@Test
public void testCreateBusinessObjectDataAttribute() {
    // 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 create request.
    BusinessObjectDataAttributeCreateRequest businessObjectDataAttributeCreateRequest = new BusinessObjectDataAttributeCreateRequest(businessObjectDataAttributeKey, ATTRIBUTE_VALUE_1);
    // Create a business object data attribute.
    BusinessObjectDataAttribute businessObjectDataAttribute = new BusinessObjectDataAttribute(ID, businessObjectDataAttributeKey, ATTRIBUTE_VALUE_1);
    // Mock the external calls.
    when(businessObjectDataAttributeService.createBusinessObjectDataAttribute(businessObjectDataAttributeCreateRequest)).thenReturn(businessObjectDataAttribute);
    // Call the method under test.
    BusinessObjectDataAttribute result = businessObjectDataAttributeRestController.createBusinessObjectDataAttribute(businessObjectDataAttributeCreateRequest);
    // Verify the external calls.
    verify(businessObjectDataAttributeService).createBusinessObjectDataAttribute(businessObjectDataAttributeCreateRequest);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAttribute, result);
}
Also used : BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) BusinessObjectDataAttributeCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDataAttributeCreateRequest) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Example 40 with BusinessObjectDataAttribute

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

the class BusinessObjectDataAttributeRestControllerTest method testGetBusinessObjectDataAttributeSubPartitionValuesCount1.

@Test
public void testGetBusinessObjectDataAttributeSubPartitionValuesCount1() {
    // 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.getBusinessObjectDataAttribute(businessObjectDataAttributeKey)).thenReturn(businessObjectDataAttribute);
    // Call the method under test.
    BusinessObjectDataAttribute result = businessObjectDataAttributeRestController.getBusinessObjectDataAttribute(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);
    // Verify the external calls.
    verify(businessObjectDataAttributeService).getBusinessObjectDataAttribute(businessObjectDataAttributeKey);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAttribute, result);
}
Also used : BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Aggregations

BusinessObjectDataAttribute (org.finra.herd.model.api.xml.BusinessObjectDataAttribute)58 Test (org.junit.Test)53 BusinessObjectDataAttributeKey (org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey)41 BusinessObjectDataAttributeEntity (org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity)27 ArrayList (java.util.ArrayList)12 FieldExtension (org.activiti.bpmn.model.FieldExtension)12 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)12 Parameter (org.finra.herd.model.api.xml.Parameter)12 HashMap (java.util.HashMap)9 BusinessObjectDataAttributeUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest)6 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)3 Job (org.finra.herd.model.api.xml.Job)3 BusinessObjectDataAttributeCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataAttributeCreateRequest)2