Search in sources :

Example 26 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_confirmTest method testConfirm_daoException_assertNoAggregation.

@Test
public void testConfirm_daoException_assertNoAggregation() throws Exception {
    AggregationDAO dao = mock(AggregationDAO.class);
    doThrow(new RuntimeException()).when(dao).confirmAggregation((String) any());
    final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(dao);
    boolean exceptionOccured = false;
    try {
        repo.confirm(context, "12345");
    } catch (RuntimeException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : AggregationDAO(org.nhindirect.monitor.dao.AggregationDAO) ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Example 27 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_confirmTest method testConfirm_exchangeNotInRepository_assertNoException.

@Test
public void testConfirm_exchangeNotInRepository_assertNoException() {
    final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(notifDao);
    repo.confirm(context, "12345");
}
Also used : ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Example 28 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_doStartTest method testDoStart_emptyDAO_assertException.

@Test
public void testDoStart_emptyDAO_assertException() throws Exception {
    final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository();
    boolean exceptionOccured = false;
    try {
        repo.doStart();
    } catch (RuntimeException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Example 29 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_doStartTest method testDoStart_emptyAggregation_assertNoException.

@Test
public void testDoStart_emptyAggregation_assertNoException() throws Exception {
    AggregationDAO dao = mock(AggregationDAO.class);
    when(dao.getAggregationKeys()).thenReturn(new ArrayList<String>());
    when(dao.getAggregationCompletedKeys()).thenReturn(new ArrayList<String>());
    final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(dao);
    repo.doStart();
    repo.doStop();
}
Also used : AggregationDAO(org.nhindirect.monitor.dao.AggregationDAO) ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Example 30 with ConcurrentJPAAggregationRepository

use of org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_getKeysTest method testGetKeys_emptyRepository_assertEmptyList.

@Test
public void testGetKeys_emptyRepository_assertEmptyList() {
    final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(notifDao);
    final Set<String> keys = repo.getKeys();
    assertEquals(0, keys.size());
}
Also used : ConcurrentJPAAggregationRepository(org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository) Test(org.junit.Test)

Aggregations

ConcurrentJPAAggregationRepository (org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository)33 Test (org.junit.Test)32 Exchange (org.apache.camel.Exchange)15 DefaultExchange (org.apache.camel.impl.DefaultExchange)15 Tx (org.nhindirect.common.tx.model.Tx)15 AggregationDAO (org.nhindirect.monitor.dao.AggregationDAO)9 Collection (java.util.Collection)4