Search in sources :

Example 21 with NamespaceKey

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

the class NamespaceServiceTest method testGetNamespaces.

@Test
public void testGetNamespaces() throws Exception {
    // Create and persist namespace entities.
    for (NamespaceKey key : namespaceDaoTestHelper.getTestNamespaceKeys()) {
        namespaceDaoTestHelper.createNamespaceEntity(key.getNamespaceCode());
    }
    // Retrieve a list of namespace keys.
    NamespaceKeys resultNamespaceKeys = namespaceService.getNamespaces();
    // Validate the returned object.
    assertNotNull(resultNamespaceKeys);
    assertNotNull(resultNamespaceKeys.getNamespaceKeys());
    assertTrue(resultNamespaceKeys.getNamespaceKeys().size() >= namespaceDaoTestHelper.getTestNamespaceKeys().size());
    for (NamespaceKey key : namespaceDaoTestHelper.getTestNamespaceKeys()) {
        assertTrue(resultNamespaceKeys.getNamespaceKeys().contains(key));
    }
}
Also used : NamespaceKey(org.finra.herd.model.api.xml.NamespaceKey) NamespaceKeys(org.finra.herd.model.api.xml.NamespaceKeys) Test(org.junit.Test)

Example 22 with NamespaceKey

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

the class NamespaceServiceTest method testGetNamespaceTrimParameters.

@Test
public void testGetNamespaceTrimParameters() {
    // Create and persist a namespace entity.
    namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
    // Retrieve the namespace using input parameters with leading and trailing empty spaces.
    Namespace resultNamespace = namespaceService.getNamespace(new NamespaceKey(addWhitespace(NAMESPACE)));
    // Validate the returned object.
    namespaceServiceTestHelper.validateNamespace(NAMESPACE, resultNamespace);
}
Also used : NamespaceKey(org.finra.herd.model.api.xml.NamespaceKey) Namespace(org.finra.herd.model.api.xml.Namespace) Test(org.junit.Test)

Example 23 with NamespaceKey

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

the class NamespaceRestControllerTest method testGetNamespace.

@Test
public void testGetNamespace() throws Exception {
    Namespace namespace = new Namespace(NAMESPACE);
    when(namespaceService.getNamespace(new NamespaceKey(NAMESPACE))).thenReturn(namespace);
    // Retrieve the namespace.
    Namespace resultNamespace = namespaceRestController.getNamespace(NAMESPACE);
    // Verify the external calls.
    verify(namespaceService).getNamespace(new NamespaceKey(NAMESPACE));
    verifyNoMoreInteractions(namespaceService);
    // Validate the returned object.
    assertEquals(namespace, resultNamespace);
}
Also used : NamespaceKey(org.finra.herd.model.api.xml.NamespaceKey) Namespace(org.finra.herd.model.api.xml.Namespace) Test(org.junit.Test)

Aggregations

NamespaceKey (org.finra.herd.model.api.xml.NamespaceKey)23 Test (org.junit.Test)20 Namespace (org.finra.herd.model.api.xml.Namespace)10 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)5 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)2 NamespaceKeys (org.finra.herd.model.api.xml.NamespaceKeys)2 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)1 NamespaceAuthorization (org.finra.herd.model.api.xml.NamespaceAuthorization)1