Search in sources :

Example 11 with BusinessObjectDataAttributeKeys

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

the class BusinessObjectDataAttributeRestControllerTest method testGetBusinessObjectDataAttributesSubPartitionValuesCount2.

@Test
public void testGetBusinessObjectDataAttributesSubPartitionValuesCount2() {
    // 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, Arrays.asList(SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1)), DATA_VERSION);
    // Create a business object data attribute keys.
    BusinessObjectDataAttributeKeys businessObjectDataAttributeKeys = new BusinessObjectDataAttributeKeys(Arrays.asList(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)));
    // Mock the external calls.
    when(businessObjectDataAttributeService.getBusinessObjectDataAttributes(businessObjectDataKey)).thenReturn(businessObjectDataAttributeKeys);
    // Call the method under test.
    BusinessObjectDataAttributeKeys result = businessObjectDataAttributeRestController.getBusinessObjectDataAttributes(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), DATA_VERSION);
    // Verify the external calls.
    verify(businessObjectDataAttributeService).getBusinessObjectDataAttributes(businessObjectDataKey);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAttributeKeys, result);
}
Also used : BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataAttributeKeys(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKeys) Test(org.junit.Test)

Example 12 with BusinessObjectDataAttributeKeys

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

the class BusinessObjectDataAttributeRestControllerTest method testGetBusinessObjectDataAttributesSubPartitionValuesCount4.

@Test
public void testGetBusinessObjectDataAttributesSubPartitionValuesCount4() {
    // 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, Arrays.asList(SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3)), DATA_VERSION);
    // Create a business object data attribute keys.
    BusinessObjectDataAttributeKeys businessObjectDataAttributeKeys = new BusinessObjectDataAttributeKeys(Arrays.asList(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)));
    // Mock the external calls.
    when(businessObjectDataAttributeService.getBusinessObjectDataAttributes(businessObjectDataKey)).thenReturn(businessObjectDataAttributeKeys);
    // Call the method under test.
    BusinessObjectDataAttributeKeys result = businessObjectDataAttributeRestController.getBusinessObjectDataAttributes(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), SUBPARTITION_VALUES.get(3), DATA_VERSION);
    // Verify the external calls.
    verify(businessObjectDataAttributeService).getBusinessObjectDataAttributes(businessObjectDataKey);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAttributeKeys, result);
}
Also used : BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataAttributeKeys(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKeys) Test(org.junit.Test)

Example 13 with BusinessObjectDataAttributeKeys

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

the class GetBusinessObjectDataAttributesTest method testGetBusinessObjectDataAttributeMissingOptionalParameters.

@Test
public void testGetBusinessObjectDataAttributeMissingOptionalParameters() 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);
    // Get a list of test attributes.
    List<Attribute> testAttributes = businessObjectDefinitionServiceTestHelper.getNewAttributes();
    // Create a business object data attribute entities.
    for (Attribute attribute : testAttributes) {
        businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(businessObjectDataKey, attribute.getName(), attribute.getValue());
    }
    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}"));
    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()));
    // Build the expected response object.
    BusinessObjectDataAttributeKeys expectedBusinessObjectDataAttributeKeys = new BusinessObjectDataAttributeKeys();
    for (Attribute attribute : testAttributes) {
        expectedBusinessObjectDataAttributeKeys.getBusinessObjectDataAttributeKeys().add(businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, attribute.getName()));
    }
    // Run the activiti task and validate the returned response object.
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(GetBusinessObjectDataAttributes.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataAttributeKeys));
    testActivitiServiceTaskSuccess(GetBusinessObjectDataAttributes.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : Attribute(org.finra.herd.model.api.xml.Attribute) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataAttributeKeys(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKeys) FieldExtension(org.activiti.bpmn.model.FieldExtension) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 14 with BusinessObjectDataAttributeKeys

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

the class GetBusinessObjectDataAttributesTest 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);
    // Get a list of test attributes.
    List<Attribute> testAttributes = businessObjectDefinitionServiceTestHelper.getNewAttributes();
    // Create a business object data attribute entities.
    for (Attribute attribute : testAttributes) {
        businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(businessObjectDataKey, attribute.getName(), attribute.getValue());
    }
    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}"));
    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()));
    // Build the expected response object.
    BusinessObjectDataAttributeKeys expectedBusinessObjectDataAttributeKeys = new BusinessObjectDataAttributeKeys();
    for (Attribute attribute : testAttributes) {
        expectedBusinessObjectDataAttributeKeys.getBusinessObjectDataAttributeKeys().add(businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, attribute.getName()));
    }
    // Run the activiti task and validate the returned response object.
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(GetBusinessObjectDataAttributes.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataAttributeKeys));
    testActivitiServiceTaskSuccess(GetBusinessObjectDataAttributes.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : Attribute(org.finra.herd.model.api.xml.Attribute) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataAttributeKeys(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKeys) FieldExtension(org.activiti.bpmn.model.FieldExtension) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Example 15 with BusinessObjectDataAttributeKeys

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

the class GetBusinessObjectDataAttributesTest method testGetBusinessObjectDataAttribute.

@Test
public void testGetBusinessObjectDataAttribute() 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);
    // Get a list of test attributes.
    List<Attribute> testAttributes = businessObjectDefinitionServiceTestHelper.getNewAttributes();
    // Create a business object data attribute entities.
    for (Attribute attribute : testAttributes) {
        businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(businessObjectDataKey, attribute.getName(), attribute.getValue());
    }
    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}"));
    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()));
    // Build the expected response object.
    BusinessObjectDataAttributeKeys expectedBusinessObjectDataAttributeKeys = new BusinessObjectDataAttributeKeys();
    for (Attribute attribute : testAttributes) {
        expectedBusinessObjectDataAttributeKeys.getBusinessObjectDataAttributeKeys().add(businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, attribute.getName()));
    }
    // Run the activiti task and validate the returned response object.
    Map<String, Object> variableValuesToValidate = new HashMap<>();
    variableValuesToValidate.put(GetBusinessObjectDataAttributes.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataAttributeKeys));
    testActivitiServiceTaskSuccess(GetBusinessObjectDataAttributes.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Also used : Attribute(org.finra.herd.model.api.xml.Attribute) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) BusinessObjectDataAttributeKeys(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKeys) FieldExtension(org.activiti.bpmn.model.FieldExtension) Parameter(org.finra.herd.model.api.xml.Parameter) Test(org.junit.Test)

Aggregations

BusinessObjectDataAttributeKeys (org.finra.herd.model.api.xml.BusinessObjectDataAttributeKeys)16 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)15 Test (org.junit.Test)14 BusinessObjectDataAttributeKey (org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey)5 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 FieldExtension (org.activiti.bpmn.model.FieldExtension)3 Attribute (org.finra.herd.model.api.xml.Attribute)3 Parameter (org.finra.herd.model.api.xml.Parameter)3 BusinessObjectDataAttributeEntity (org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity)1 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)1