Search in sources :

Example 31 with AttributeValueListKey

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

the class AllowedAttributeValueServiceTest method testDeleteAllowedAttributeValuesMissingAllowedAttributeValue.

@Test
public void testDeleteAllowedAttributeValuesMissingAllowedAttributeValue() {
    // Create attribute value list key.
    AttributeValueListKey attributeValueListKey = new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME);
    // Create a delete request without allowed attribute value.
    AllowedAttributeValuesDeleteRequest request = new AllowedAttributeValuesDeleteRequest(attributeValueListKey, NO_ALLOWED_ATTRIBUTE_VALUES);
    // Try to call method under test.
    try {
        allowedAttributeValueService.deleteAllowedAttributeValues(request);
        fail();
    } catch (IllegalArgumentException e) {
        assertEquals("At least one allowed attribute value must be specified.", e.getMessage());
    }
    // Verify the external calls.
    verify(attributeValueListHelper).validateAttributeValueListKey(attributeValueListKey);
    verifyNoMoreInteractionsHelper();
}
Also used : AllowedAttributeValuesDeleteRequest(org.finra.herd.model.api.xml.AllowedAttributeValuesDeleteRequest) AttributeValueListKey(org.finra.herd.model.api.xml.AttributeValueListKey) Test(org.junit.Test)

Example 32 with AttributeValueListKey

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

the class BusinessObjectFormatServiceTest method createGlobalAttributeDefinitionEntityWithAllowedAttributeValues.

private GlobalAttributeDefinitionEntity createGlobalAttributeDefinitionEntityWithAllowedAttributeValues() {
    // Create attribute value list key.
    AttributeValueListKey attributeValueListKey = new AttributeValueListKey(NAMESPACE_CODE, ATTRIBUTE_VALUE_LIST_NAME);
    List<String> allowedAttributeValueList = Arrays.asList(ALLOWED_ATTRIBUTE_VALUE, ALLOWED_ATTRIBUTE_VALUE_2);
    // Create and persist a attribute value list key entity.
    AttributeValueListEntity attributeValueListEntity = attributeValueListDaoTestHelper.createAttributeValueListEntity(NAMESPACE_CODE, ATTRIBUTE_VALUE_LIST_NAME);
    // Create and persist a list of allowed attribute values.
    List<AllowedAttributeValueEntity> allowedAttributeValueEntities = allowedAttributeValueDaoTestHelper.createAllowedAttributeValueEntities(attributeValueListKey, allowedAttributeValueList);
    attributeValueListEntity.getAllowedAttributeValues().addAll(allowedAttributeValueEntities);
    GlobalAttributeDefinitionEntity globalAttributeDefinitionEntity = globalAttributeDefinitionDaoTestHelper.createGlobalAttributeDefinitionEntity(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME);
    globalAttributeDefinitionEntity.setAttributeValueList(attributeValueListEntity);
    return globalAttributeDefinitionEntity;
}
Also used : GlobalAttributeDefinitionEntity(org.finra.herd.model.jpa.GlobalAttributeDefinitionEntity) AttributeValueListEntity(org.finra.herd.model.jpa.AttributeValueListEntity) AllowedAttributeValueEntity(org.finra.herd.model.jpa.AllowedAttributeValueEntity) AttributeValueListKey(org.finra.herd.model.api.xml.AttributeValueListKey)

Aggregations

AttributeValueListKey (org.finra.herd.model.api.xml.AttributeValueListKey)32 Test (org.junit.Test)27 AttributeValueListEntity (org.finra.herd.model.jpa.AttributeValueListEntity)14 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)11 AllowedAttributeValuesInformation (org.finra.herd.model.api.xml.AllowedAttributeValuesInformation)7 AttributeValueList (org.finra.herd.model.api.xml.AttributeValueList)7 AllowedAttributeValueEntity (org.finra.herd.model.jpa.AllowedAttributeValueEntity)7 ArrayList (java.util.ArrayList)6 AllowedAttributeValuesDeleteRequest (org.finra.herd.model.api.xml.AllowedAttributeValuesDeleteRequest)5 AllowedAttributeValuesCreateRequest (org.finra.herd.model.api.xml.AllowedAttributeValuesCreateRequest)4 AttributeValueListCreateRequest (org.finra.herd.model.api.xml.AttributeValueListCreateRequest)4 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)4 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)3 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)2 AttributeValueListKeys (org.finra.herd.model.api.xml.AttributeValueListKeys)2 HashSet (java.util.HashSet)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 Order (javax.persistence.criteria.Order)1 Predicate (javax.persistence.criteria.Predicate)1 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1