Search in sources :

Example 56 with BusinessObjectDataAttributeKey

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

the class BusinessObjectDataAttributeServiceTest method testGetBusinessObjectDataAttributeUpperCaseParameters.

@Test
public void testGetBusinessObjectDataAttributeUpperCaseParameters() {
    // Create and persist a business object data attribute entity using lower case values.
    BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, PARTITION_VALUE.toLowerCase(), convertListToLowerCase(SUBPARTITION_VALUES), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE.toLowerCase(), ATTRIBUTE_VALUE_1.toLowerCase());
    // Get the business object data attribute using upper case input parameters (except for case-sensitive partition values).
    BusinessObjectDataAttribute resultBusinessObjectDataAttribute = businessObjectDataAttributeService.getBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, PARTITION_VALUE.toLowerCase(), convertListToLowerCase(SUBPARTITION_VALUES), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE.toUpperCase()));
    // Validate the returned object.
    businessObjectDataAttributeServiceTestHelper.validateBusinessObjectDataAttribute(businessObjectDataAttributeEntity.getId(), NAMESPACE, BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, PARTITION_VALUE.toLowerCase(), convertListToLowerCase(SUBPARTITION_VALUES), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE.toLowerCase(), ATTRIBUTE_VALUE_1.toLowerCase(), resultBusinessObjectDataAttribute);
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Example 57 with BusinessObjectDataAttributeKey

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

the class BusinessObjectDataAttributeServiceTest method testUpdateBusinessObjectDataAttributeRequiredAttributeMissingValue.

@Test
public void testUpdateBusinessObjectDataAttributeRequiredAttributeMissingValue() {
    // Create and persist a business object data attribute definition entity.
    businessObjectFormatDaoTestHelper.createBusinessObjectDataAttributeDefinitionEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE);
    // Create and persist a required business object data attribute entity.
    businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
    // Try to update the required business object data attribute instance when business object data attribute value is not specified.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(BLANK_TEXT));
        fail("Should throw an IllegalArgumentException when business object data attribute value is not specified for a required attribute.");
    } catch (IllegalArgumentException e) {
        assertEquals(String.format("A business object data attribute value must be specified since \"%s\" is a required attribute for business object " + "format {namespace: \"%s\", businessObjectDefinitionName: \"%s\", businessObjectFormatUsage: \"%s\", businessObjectFormatFileType: \"%s\", " + "businessObjectFormatVersion: %d}.", ATTRIBUTE_NAME_1_MIXED_CASE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION), e.getMessage());
    }
}
Also used : BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Example 58 with BusinessObjectDataAttributeKey

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

the class BusinessObjectDataAttributeServiceTest method testDeleteBusinessObjectDataAttributeTrimParameters.

@Test
public void testDeleteBusinessObjectDataAttributeTrimParameters() {
    // Create and persist a business object data attribute entity.
    BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
    // Validate that this business object data attribute exists.
    businessObjectDataAttributeDaoHelper.getBusinessObjectDataAttributeEntity(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE));
    // Delete the business object data attribute using input parameters with leading and trailing empty spaces.
    BusinessObjectDataAttribute deletedBusinessObjectDataAttribute = businessObjectDataAttributeService.deleteBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, addWhitespace(BDEF_NAME), addWhitespace(FORMAT_USAGE_CODE), addWhitespace(FORMAT_FILE_TYPE_CODE), FORMAT_VERSION, addWhitespace(PARTITION_VALUE), addWhitespace(SUBPARTITION_VALUES), DATA_VERSION, addWhitespace(ATTRIBUTE_NAME_1_MIXED_CASE)));
    // Validate the returned object.
    businessObjectDataAttributeServiceTestHelper.validateBusinessObjectDataAttribute(businessObjectDataAttributeEntity.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1, deletedBusinessObjectDataAttribute);
    // Ensure that this business object data attribute is no longer there.
    try {
        businessObjectDataAttributeDaoHelper.getBusinessObjectDataAttributeEntity(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE));
        fail("Should throw an ObjectNotFoundException when business object data attribute does not exist.");
    } catch (ObjectNotFoundException e) {
        assertEquals(String.format("Attribute with name \"%s\" does not exist for business object data {namespace: \"%s\", businessObjectDefinitionName: \"%s\", " + "businessObjectFormatUsage: \"%s\", businessObjectFormatFileType: \"%s\", businessObjectFormatVersion: %d, " + "businessObjectDataPartitionValue: \"%s\", businessObjectDataSubPartitionValues: \"%s,%s,%s,%s\", businessObjectDataVersion: %d}.", ATTRIBUTE_NAME_1_MIXED_CASE, 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), e.getMessage());
    }
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) BusinessObjectDataAttribute(org.finra.herd.model.api.xml.BusinessObjectDataAttribute) ObjectNotFoundException(org.finra.herd.model.ObjectNotFoundException) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Example 59 with BusinessObjectDataAttributeKey

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

the class BusinessObjectDataAttributeServiceTest method testDeleteBusinessObjectDataAttributeRequiredAttribute.

@Test
public void testDeleteBusinessObjectDataAttributeRequiredAttribute() {
    // Create and persist a business object data attribute definition entity.
    businessObjectFormatDaoTestHelper.createBusinessObjectDataAttributeDefinitionEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE);
    // Create and persist a required business object data attribute entity.
    businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
    // Try to delete the required business object data attribute.
    try {
        businessObjectDataAttributeService.deleteBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE));
        fail("Should throw an IllegalArgumentException when deleting a required business object data attribute.");
    } catch (IllegalArgumentException e) {
        assertEquals(String.format("Cannot delete \"%s\" attribute since it is a required attribute for business object format " + "{namespace: \"%s\", businessObjectDefinitionName: \"%s\", businessObjectFormatUsage: \"%s\", businessObjectFormatFileType: \"%s\", " + "businessObjectFormatVersion: %d}.", ATTRIBUTE_NAME_1_MIXED_CASE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION), e.getMessage());
    }
}
Also used : BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Example 60 with BusinessObjectDataAttributeKey

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

the class BusinessObjectDataAttributeServiceTest method testUpdateBusinessObjectDataAttributeMissingRequiredParameters.

@Test
public void testUpdateBusinessObjectDataAttributeMissingRequiredParameters() {
    // Try to update a business object data attribute instance when business object definition name is not specified.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BLANK_TEXT, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when business object definition name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object definition name must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance when business object format usage is not specified.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, BLANK_TEXT, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when business object format usage is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object format usage must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance when business object format file type is not specified.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, BLANK_TEXT, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when business object format file type is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object format file type must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance when business object format version is not specified.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when business object format version is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object format version must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance when partition value is not specified.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, BLANK_TEXT, NO_SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when partition value is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A partition value must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance without specifying 1st subpartition value.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(BLANK_TEXT, SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3)), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when 1st subpartition value is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A subpartition value must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance without specifying 2nd subpartition value.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUBPARTITION_VALUES.get(0), BLANK_TEXT, SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3)), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when 2nd subpartition value is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A subpartition value must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance without specifying 3rd subpartition value.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), BLANK_TEXT, SUBPARTITION_VALUES.get(3)), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when 3rd subpartition value is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A subpartition value must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance without specifying 4th subpartition value.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(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), BLANK_TEXT), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when 4th subpartition value is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A subpartition value must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance when business object data version is not specified.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, null, ATTRIBUTE_NAME_1_MIXED_CASE), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when business object data version is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object data version must be specified.", e.getMessage());
    }
    // Try to update a business object data attribute instance when business object data attribute name is not specified.
    try {
        businessObjectDataAttributeService.updateBusinessObjectDataAttribute(new BusinessObjectDataAttributeKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, BLANK_TEXT), businessObjectDataAttributeServiceTestHelper.createBusinessObjectDataAttributeUpdateRequest(ATTRIBUTE_VALUE_1));
        fail("Should throw an IllegalArgumentException when business object data attribute name is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A business object data attribute name must be specified.", e.getMessage());
    }
}
Also used : BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) Test(org.junit.Test)

Aggregations

BusinessObjectDataAttributeKey (org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey)66 Test (org.junit.Test)61 BusinessObjectDataAttribute (org.finra.herd.model.api.xml.BusinessObjectDataAttribute)41 BusinessObjectDataAttributeEntity (org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity)23 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)14 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)13 BusinessObjectDataAttributeUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDataAttributeUpdateRequest)7 BusinessObjectDataAttributeCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDataAttributeCreateRequest)5 BusinessObjectDataAttributeKeys (org.finra.herd.model.api.xml.BusinessObjectDataAttributeKeys)5 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 FieldExtension (org.activiti.bpmn.model.FieldExtension)3 Parameter (org.finra.herd.model.api.xml.Parameter)3 BusinessObjectDataStorageUnitKey (org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey)1 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)1 BusinessObjectDataStatusHistoryEntity (org.finra.herd.model.jpa.BusinessObjectDataStatusHistoryEntity)1 StorageFileEntity (org.finra.herd.model.jpa.StorageFileEntity)1 StorageUnitEntity (org.finra.herd.model.jpa.StorageUnitEntity)1