Search in sources :

Example 1 with AttributeValueListKeys

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

the class AttributeValueListServiceTest method testGetAttributeValueLists.

@Test
public void testGetAttributeValueLists() {
    // Create a set of authorized namespaces.
    Set<String> authorizedNamespaces = new HashSet<>();
    authorizedNamespaces.add(NAMESPACE);
    // Create an attribute value list key.
    List<AttributeValueListKey> attributeValueListKeys = Arrays.asList(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME));
    // Mock calls to external methods.
    when(namespaceSecurityHelper.getAuthorizedNamespaces(NamespacePermissionEnum.READ)).thenReturn(authorizedNamespaces);
    when(attributeValueListDao.getAttributeValueLists(authorizedNamespaces)).thenReturn(attributeValueListKeys);
    // Call the method under test.
    AttributeValueListKeys result = attributeValueListService.getAttributeValueLists();
    // Verify the external calls.
    verify(namespaceSecurityHelper).getAuthorizedNamespaces(NamespacePermissionEnum.READ);
    verify(attributeValueListDao).getAttributeValueLists(authorizedNamespaces);
    verifyNoMoreInteractionsHelper();
    // Validate the result.
    assertEquals(new AttributeValueListKeys(attributeValueListKeys), result);
}
Also used : AttributeValueListKeys(org.finra.herd.model.api.xml.AttributeValueListKeys) AttributeValueListKey(org.finra.herd.model.api.xml.AttributeValueListKey) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with AttributeValueListKeys

use of org.finra.herd.model.api.xml.AttributeValueListKeys 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 3 with AttributeValueListKeys

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

the class AttributeValueListServiceTest method testGetAttributeValueListsNoAuthorizedNamespaces.

@Test
public void testGetAttributeValueListsNoAuthorizedNamespaces() {
    // Create an empty set of authorized namespaces.
    Set<String> authorizedNamespaces = new HashSet<>();
    // Mock calls to external methods.
    when(namespaceSecurityHelper.getAuthorizedNamespaces(NamespacePermissionEnum.READ)).thenReturn(authorizedNamespaces);
    // Call the method under test.
    AttributeValueListKeys result = attributeValueListService.getAttributeValueLists();
    // Verify the external calls.
    verify(namespaceSecurityHelper).getAuthorizedNamespaces(NamespacePermissionEnum.READ);
    verifyNoMoreInteractionsHelper();
    // Validate the result.
    assertEquals(new AttributeValueListKeys(), result);
}
Also used : AttributeValueListKeys(org.finra.herd.model.api.xml.AttributeValueListKeys) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

AttributeValueListKeys (org.finra.herd.model.api.xml.AttributeValueListKeys)3 Test (org.junit.Test)3 HashSet (java.util.HashSet)2 AttributeValueListKey (org.finra.herd.model.api.xml.AttributeValueListKey)2