Search in sources :

Example 16 with AttributeValueListKey

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

the class AttributeValueListRestControllerTest method testCreateAttributeValueList.

@Test
public void testCreateAttributeValueList() {
    // Create an attribute value list key.
    AttributeValueListKey attributeValueListKey = new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME);
    // Create an attribute value list.
    AttributeValueList attributeValueList = new AttributeValueList(ATTRIBUTE_VALUE_LIST_ID, attributeValueListKey);
    // Create an attribute value list create request.
    AttributeValueListCreateRequest request = new AttributeValueListCreateRequest(attributeValueListKey);
    // Mock calls to external methods.
    when(attributeValueListService.createAttributeValueList(request)).thenReturn(attributeValueList);
    // Call the method under test.
    AttributeValueList result = attributeValueListRestController.createAttributeValueList(request);
    // Verify the external calls.
    verify(attributeValueListService).createAttributeValueList(request);
    verifyNoMoreInteractions(attributeValueListService);
    // Validate the result.
    assertEquals(attributeValueList, result);
}
Also used : AttributeValueList(org.finra.herd.model.api.xml.AttributeValueList) AttributeValueListCreateRequest(org.finra.herd.model.api.xml.AttributeValueListCreateRequest) AttributeValueListKey(org.finra.herd.model.api.xml.AttributeValueListKey) Test(org.junit.Test)

Example 17 with AttributeValueListKey

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

the class AttributeValueListRestControllerTest method testGetAttributeValueLists.

@Test
public void testGetAttributeValueLists() {
    // Create an attribute value list key.
    AttributeValueListKeys attributeValueListKeys = new AttributeValueListKeys(Arrays.asList(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME)));
    // Mock calls to external methods.
    when(attributeValueListService.getAttributeValueLists()).thenReturn(attributeValueListKeys);
    // Call the method under test.
    AttributeValueListKeys result = attributeValueListRestController.getAttributeValueLists();
    // Verify the external calls.
    verify(attributeValueListService).getAttributeValueLists();
    verifyNoMoreInteractions(attributeValueListService);
    // Validate the result.
    assertEquals(attributeValueListKeys, result);
}
Also used : AttributeValueListKeys(org.finra.herd.model.api.xml.AttributeValueListKeys) AttributeValueListKey(org.finra.herd.model.api.xml.AttributeValueListKey) Test(org.junit.Test)

Example 18 with AttributeValueListKey

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

the class AttributeValueListRestControllerTest method testDeleteAttributeValueList.

@Test
public void testDeleteAttributeValueList() {
    // Create an attribute value list key.
    AttributeValueListKey attributeValueListKey = new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME);
    // Create an attribute value list.
    AttributeValueList attributeValueList = new AttributeValueList(ATTRIBUTE_VALUE_LIST_ID, attributeValueListKey);
    // Mock calls to external methods.
    when(attributeValueListService.deleteAttributeValueList(attributeValueListKey)).thenReturn(attributeValueList);
    // Call the method under test.
    AttributeValueList result = attributeValueListRestController.deleteAttributeValueList(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME);
    // Verify the external calls.
    verify(attributeValueListService).deleteAttributeValueList(attributeValueListKey);
    verifyNoMoreInteractions(attributeValueListService);
    // Validate the result.
    assertEquals(attributeValueList, result);
}
Also used : AttributeValueList(org.finra.herd.model.api.xml.AttributeValueList) AttributeValueListKey(org.finra.herd.model.api.xml.AttributeValueListKey) Test(org.junit.Test)

Example 19 with AttributeValueListKey

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

the class AllowedAttributeValueRestControllerTest method testCreateAllowedAttributeValue.

@Test
public void testCreateAllowedAttributeValue() {
    // Create attribute value list key.
    AttributeValueListKey attributeValueListKey = new AttributeValueListKey(NAMESPACE_CODE, ATTRIBUTE_VALUE_LIST_NAME);
    AllowedAttributeValuesCreateRequest request = new AllowedAttributeValuesCreateRequest(attributeValueListKey, Arrays.asList(ALLOWED_ATTRIBUTE_VALUE));
    // Create the allowed attribute values information.
    AllowedAttributeValuesInformation allowedAttributeValuesInformation = new AllowedAttributeValuesInformation();
    allowedAttributeValuesInformation.setAttributeValueListKey(attributeValueListKey);
    allowedAttributeValuesInformation.setAllowedAttributeValues(Arrays.asList(ALLOWED_ATTRIBUTE_VALUE));
    // Mock calls to external method.
    when(allowedAttributeValueService.createAllowedAttributeValues(request)).thenReturn(allowedAttributeValuesInformation);
    // Call the method under test.
    AllowedAttributeValuesInformation response = allowedAttributeValueRestController.createAllowedAttributeValues(request);
    // Verify the external calls.
    verify(allowedAttributeValueService).createAllowedAttributeValues(request);
    verifyNoMoreInteractions(allowedAttributeValueService);
    // Validate the response.
    assertEquals(allowedAttributeValuesInformation, response);
}
Also used : AllowedAttributeValuesCreateRequest(org.finra.herd.model.api.xml.AllowedAttributeValuesCreateRequest) AttributeValueListKey(org.finra.herd.model.api.xml.AttributeValueListKey) AllowedAttributeValuesInformation(org.finra.herd.model.api.xml.AllowedAttributeValuesInformation) Test(org.junit.Test)

Example 20 with AttributeValueListKey

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

the class AllowedAttributeValueRestControllerTest method testDeleteAllowedAttributeValue.

@Test
public void testDeleteAllowedAttributeValue() {
    // Create attribute value list key.
    AttributeValueListKey attributeValueListKey = new AttributeValueListKey(NAMESPACE_CODE, ATTRIBUTE_VALUE_LIST_NAME);
    AllowedAttributeValuesDeleteRequest request = new AllowedAttributeValuesDeleteRequest(attributeValueListKey, Arrays.asList(ALLOWED_ATTRIBUTE_VALUE));
    // Create the allowed attribute values information.
    AllowedAttributeValuesInformation allowedAttributeValuesInformation = new AllowedAttributeValuesInformation();
    allowedAttributeValuesInformation.setAttributeValueListKey(attributeValueListKey);
    allowedAttributeValuesInformation.setAllowedAttributeValues(Arrays.asList(ALLOWED_ATTRIBUTE_VALUE));
    // Mock calls to external method.
    when(allowedAttributeValueService.deleteAllowedAttributeValues(request)).thenReturn(allowedAttributeValuesInformation);
    // Call the method under test.
    AllowedAttributeValuesInformation response = allowedAttributeValueRestController.deleteAllowedAttributeValues(request);
    // Verify the external calls.
    verify(allowedAttributeValueService).deleteAllowedAttributeValues(request);
    verifyNoMoreInteractions(allowedAttributeValueService);
    // Validate the response.
    assertEquals(allowedAttributeValuesInformation, response);
}
Also used : AllowedAttributeValuesDeleteRequest(org.finra.herd.model.api.xml.AllowedAttributeValuesDeleteRequest) AttributeValueListKey(org.finra.herd.model.api.xml.AttributeValueListKey) AllowedAttributeValuesInformation(org.finra.herd.model.api.xml.AllowedAttributeValuesInformation) Test(org.junit.Test)

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