use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.
the class ConcurrentJPAAggregationRepository_recoverTest method testRecover_daoException_assertException.
@Test
public void testRecover_daoException_assertException() throws Exception {
AggregationDAO dao = mock(AggregationDAO.class);
doThrow(new RuntimeException()).when(dao).getAggregation((String) any());
final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(dao);
boolean exceptionOccured = false;
try {
repo.get(context, "12345");
} catch (RuntimeException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.
the class ConcurrentJPAAggregationRepository_scanTest method testScan_daoException_assertException.
@Test
public void testScan_daoException_assertException() throws Exception {
AggregationDAO dao = mock(AggregationDAO.class);
doThrow(new RuntimeException()).when(dao).getAggregationCompletedKeys();
final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(dao);
boolean exceptionOccured = false;
try {
repo.scan(context);
} catch (RuntimeException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.
the class TestFailedRemovedExchangeMonitorRoute method postProcessTest.
@Override
public void postProcessTest() throws Exception {
super.postProcessTest();
final AggregationDAO dao = (AggregationDAO) context.getRegistry().lookup("errorGenAggregationDAO");
dao.purgeAll();
assertEquals(0, dao.getAggregationKeys().size());
assertEquals(0, dao.getAggregationCompletedKeys().size());
}
use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.
the class TestMultithreadedAddUpdateFailureMonitoringRoute 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());
}
use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.
the class TestRecoveryMonitorRoute method testRecoverFromRepository.
@Test
public void testRecoverFromRepository() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
boolean exchangeFound = false;
int cnt = 0;
List<Exchange> exchanges = null;
while (cnt < 10) {
exchanges = mock.getReceivedExchanges();
if (exchanges.size() == 1) {
exchangeFound = true;
break;
}
++cnt;
Thread.sleep(2000);
}
assertTrue(exchangeFound);
Tx originalMessage = (Tx) exchanges.iterator().next().getIn().getBody();
assertEquals("gm2552@cerner.com", originalMessage.getDetail(TxDetailType.FROM).getDetailValue());
// make sure everything got confirmed
final AggregationDAO dao = (AggregationDAO) context.getRegistry().lookup("aggregationDAO");
assertEquals(0, dao.getAggregationKeys().size());
assertEquals(0, dao.getAggregationCompletedKeys().size());
}
Aggregations