Search in sources :

Example 6 with CertPolicyDaoImpl

use of org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl in project nhin-d by DirectProject.

the class CertPolicyDaoImpl_getPolicyGroupsTest method testGetPolicyGroups_noEntityManager_assertException.

@Test
public void testGetPolicyGroups_noEntityManager_assertException() {
    final CertPolicyDaoImpl dao = new CertPolicyDaoImpl();
    boolean exceptionOccured = false;
    try {
        dao.getPolicyGroups();
    } catch (IllegalStateException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : CertPolicyDaoImpl(org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl) Test(org.junit.Test)

Example 7 with CertPolicyDaoImpl

use of org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl in project nhin-d by DirectProject.

the class CertPolicyDaoImpl_removePolicyUseFromGroupTest method testRemovePolicyFromGroup_noEntityManager_assertException.

@Test
public void testRemovePolicyFromGroup_noEntityManager_assertException() {
    final CertPolicyDaoImpl certDao = new CertPolicyDaoImpl();
    boolean exceptionOccured = false;
    try {
        certDao.removePolicyUseFromGroup(1234);
    } catch (IllegalStateException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : CertPolicyDaoImpl(org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl) Test(org.junit.Test)

Example 8 with CertPolicyDaoImpl

use of org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl in project nhin-d by DirectProject.

the class CertPolicyDaoImpl_updateGroupAttributesTest method ttestUpdateGroupAttributes_noEntityManager_assertException.

@Test
public void ttestUpdateGroupAttributes_noEntityManager_assertException() throws Exception {
    final CertPolicyDaoImpl dao = new CertPolicyDaoImpl();
    boolean exceptionOccured = false;
    try {
        dao.updateGroupAttributes(12345, "");
    } catch (IllegalStateException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : CertPolicyDaoImpl(org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl) Test(org.junit.Test)

Example 9 with CertPolicyDaoImpl

use of org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl in project nhin-d by DirectProject.

the class CertPolicyDaoImpl_updateGroupAttributesTest method testUpdateGroupAttributes_exceptionInQuery_assertException.

@Test
public void testUpdateGroupAttributes_exceptionInQuery_assertException() throws Exception {
    final EntityManager manager = mock(EntityManager.class);
    doThrow(new RuntimeException("Just Passing Through")).when(manager).createQuery((String) any());
    final CertPolicyDaoImpl dao = new CertPolicyDaoImpl();
    dao.setEntityManager(manager);
    boolean exceptionOccured = false;
    try {
        dao.updateGroupAttributes(12345, "");
    } catch (ConfigurationStoreException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : EntityManager(javax.persistence.EntityManager) CertPolicyDaoImpl(org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl) Test(org.junit.Test)

Example 10 with CertPolicyDaoImpl

use of org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl in project nhin-d by DirectProject.

the class CertPolicyDaoImpl_getPoliciesTest method testGetPolices_noEntityManager_assertException.

@Test
public void testGetPolices_noEntityManager_assertException() {
    final CertPolicyDaoImpl dao = new CertPolicyDaoImpl();
    boolean exceptionOccured = false;
    try {
        dao.getPolicies();
    } catch (IllegalStateException ex) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : CertPolicyDaoImpl(org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)44 CertPolicyDaoImpl (org.nhindirect.config.store.dao.impl.CertPolicyDaoImpl)44 EntityManager (javax.persistence.EntityManager)24 DomainDao (org.nhindirect.config.store.dao.DomainDao)10 Query (javax.persistence.Query)8 NoResultException (javax.persistence.NoResultException)3