Search in sources :

Example 21 with AttributeDefinition

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

the class BusinessObjectFormatServiceTest method testUpdateBusinessObjectFormatAttributeDefinitionsDuplicateAttributeDefintions.

@Test
public void testUpdateBusinessObjectFormatAttributeDefinitionsDuplicateAttributeDefintions() {
    List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes();
    BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes);
    List<AttributeDefinition> attributeDefinitions = businessObjectFormatServiceTestHelper.getTestAttributeDefinitions2();
    // Check for the duplicate attribute definition.
    attributeDefinitions.add(new AttributeDefinition(AbstractServiceTest.ATTRIBUTE_NAME_1_MIXED_CASE, AbstractServiceTest.NO_PUBLISH_ATTRIBUTE));
    BusinessObjectFormatAttributeDefinitionsUpdateRequest request = new BusinessObjectFormatAttributeDefinitionsUpdateRequest(attributeDefinitions);
    try {
        businessObjectFormatService.updateBusinessObjectFormatAttributeDefinitions(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request);
        fail("Should throw an IllegalArgumentException.");
    } catch (IllegalArgumentException ex) {
        assertEquals(String.format("Duplicate attribute definition name \"%s\" found.", ATTRIBUTE_NAME_1_MIXED_CASE), ex.getMessage());
    }
}
Also used : Attribute(org.finra.herd.model.api.xml.Attribute) BusinessObjectFormatKey(org.finra.herd.model.api.xml.BusinessObjectFormatKey) AttributeDefinition(org.finra.herd.model.api.xml.AttributeDefinition) BusinessObjectFormatAttributeDefinitionsUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectFormatAttributeDefinitionsUpdateRequest) DescriptiveBusinessObjectFormat(org.finra.herd.model.api.xml.DescriptiveBusinessObjectFormat) BusinessObjectFormat(org.finra.herd.model.api.xml.BusinessObjectFormat) Test(org.junit.Test)

Aggregations

AttributeDefinition (org.finra.herd.model.api.xml.AttributeDefinition)21 Test (org.junit.Test)13 Attribute (org.finra.herd.model.api.xml.Attribute)12 ArrayList (java.util.ArrayList)10 BusinessObjectFormat (org.finra.herd.model.api.xml.BusinessObjectFormat)10 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)10 BusinessObjectFormatAttributeDefinitionsUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectFormatAttributeDefinitionsUpdateRequest)8 DescriptiveBusinessObjectFormat (org.finra.herd.model.api.xml.DescriptiveBusinessObjectFormat)7 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)4 NotificationMessageDefinition (org.finra.herd.model.api.xml.NotificationMessageDefinition)4 NotificationMessageDefinitions (org.finra.herd.model.api.xml.NotificationMessageDefinitions)4 NotificationMessage (org.finra.herd.model.dto.NotificationMessage)4 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)4 ConfigurationEntity (org.finra.herd.model.jpa.ConfigurationEntity)4 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 BusinessObjectFormatCreateRequest (org.finra.herd.model.api.xml.BusinessObjectFormatCreateRequest)3 BusinessObjectDataAttributeDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDataAttributeDefinitionEntity)3 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)3 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)2