Search in sources :

Example 11 with AggregationDAO

use of org.nhindirect.monitor.dao.AggregationDAO 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 12 with AggregationDAO

use of org.nhindirect.monitor.dao.AggregationDAO 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 13 with AggregationDAO

use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.

the class ConcurrentJPAAggregationRepository_getKeysTest method testGetKeys_daoException_assertException.

@Test
public void testGetKeys_daoException_assertException() throws Exception {
    AggregationDAO dao = mock(AggregationDAO.class);
    doThrow(new RuntimeException()).when(dao).getAggregationKeys();
    final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(dao);
    boolean exceptionOccured = false;
    try {
        repo.getKeys();
    } 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 14 with AggregationDAO

use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.

the class TestSingleRecipReliableMessageMonitorRoute method postProcessTest.

@Override
public void postProcessTest() throws Exception {
    super.postProcessTest();
    final AggregationDAO dao = (AggregationDAO) context.getRegistry().lookup("aggregationDAO");
    dao.purgeAll();
    assertEquals(0, dao.getAggregationKeys().size());
    assertEquals(0, dao.getAggregationCompletedKeys().size());
}
Also used : AggregationDAO(org.nhindirect.monitor.dao.AggregationDAO)

Example 15 with AggregationDAO

use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.

the class TestFailedAddUpdateExchangeMonitorRoute method postProcessTest.

@Override
public void postProcessTest() throws Exception {
    super.postProcessTest();
    final AggregationDAO dao = (AggregationDAO) context.getRegistry().lookup("aggregationDAO");
    dao.purgeAll();
    assertEquals(0, dao.getAggregationKeys().size());
    assertEquals(0, dao.getAggregationCompletedKeys().size());
}
Also used : AggregationDAO(org.nhindirect.monitor.dao.AggregationDAO)

Aggregations

AggregationDAO (org.nhindirect.monitor.dao.AggregationDAO)17 Test (org.junit.Test)9 ConcurrentJPAAggregationRepository (org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository)9 Exchange (org.apache.camel.Exchange)2 DefaultExchange (org.apache.camel.impl.DefaultExchange)2 Tx (org.nhindirect.common.tx.model.Tx)2 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)1