Search in sources :

Example 6 with NamespaceKey

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

the class NamespaceServiceTest method testGetNamespaceMissingRequiredParameters.

@Test
public void testGetNamespaceMissingRequiredParameters() {
    // Try to get a namespace instance when namespace code is not specified.
    try {
        namespaceService.getNamespace(new NamespaceKey(BLANK_TEXT));
        fail("Should throw an IllegalArgumentException when namespace code is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
}
Also used : NamespaceKey(org.finra.herd.model.api.xml.NamespaceKey) Test(org.junit.Test)

Example 7 with NamespaceKey

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

the class NamespaceServiceTest method testGetNamespaceLowerCaseParameters.

@Test
public void testGetNamespaceLowerCaseParameters() {
    // Create and persist a namespace entity using upper case values.
    namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE.toUpperCase());
    // Retrieve the namespace using lower case input parameters.
    Namespace resultNamespace = namespaceService.getNamespace(new NamespaceKey(NAMESPACE.toLowerCase()));
    // Validate the returned object.
    namespaceServiceTestHelper.validateNamespace(NAMESPACE.toUpperCase(), resultNamespace);
}
Also used : NamespaceKey(org.finra.herd.model.api.xml.NamespaceKey) Namespace(org.finra.herd.model.api.xml.Namespace) Test(org.junit.Test)

Example 8 with NamespaceKey

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

the class NamespaceServiceTest method testDeleteNamespace.

@Test
public void testDeleteNamespace() throws Exception {
    // Create and persist a namespace entity.
    namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
    // Validate that this namespace exists.
    NamespaceKey namespaceKey = new NamespaceKey(NAMESPACE);
    assertNotNull(namespaceDao.getNamespaceByKey(namespaceKey));
    // Delete this namespace.
    Namespace deletedNamespace = namespaceService.deleteNamespace(new NamespaceKey(NAMESPACE));
    // Validate the returned object.
    namespaceServiceTestHelper.validateNamespace(NAMESPACE, deletedNamespace);
    // Ensure that this namespace is no longer there.
    assertNull(namespaceDao.getNamespaceByKey(namespaceKey));
}
Also used : NamespaceKey(org.finra.herd.model.api.xml.NamespaceKey) Namespace(org.finra.herd.model.api.xml.Namespace) Test(org.junit.Test)

Example 9 with NamespaceKey

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

the class NamespaceServiceTest method testGetNamespace.

@Test
public void testGetNamespace() throws Exception {
    // Create and persist a namespace entity.
    namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
    // Retrieve the namespace.
    Namespace resultNamespace = namespaceService.getNamespace(new NamespaceKey(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 10 with NamespaceKey

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

the class NamespaceServiceTest method testDeleteNamespaceMissingRequiredParameters.

@Test
public void testDeleteNamespaceMissingRequiredParameters() {
    // Try to delete a namespace instance when namespace code is not specified.
    try {
        namespaceService.deleteNamespace(new NamespaceKey(BLANK_TEXT));
        fail("Should throw an IllegalArgumentException when namespace code is not specified.");
    } catch (IllegalArgumentException e) {
        assertEquals("A namespace must be specified.", e.getMessage());
    }
}
Also used : NamespaceKey(org.finra.herd.model.api.xml.NamespaceKey) 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