use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.
the class TestRecoveryMonitorRoute method postProcessTest.
@Override
public void postProcessTest() throws Exception {
super.postProcessTest();
final AggregationDAO dao = (AggregationDAO) context.getRegistry().lookup("shortRecoveryIntervalAggregationDAO");
dao.purgeAll();
assertEquals(0, dao.getAggregationKeys().size());
assertEquals(0, dao.getAggregationCompletedKeys().size());
// pre populate some recovery data
// send original message
final String originalMessageId = UUID.randomUUID().toString();
final Tx originalMessage = TestUtils.makeMessage(TxMessageType.IMF, originalMessageId, "", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com,ah4626@direct.securehealthemail.com", "");
final Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(originalMessage);
final ConcurrentJPAAggregationRepository repo = (ConcurrentJPAAggregationRepository) context.getRegistry().lookup("monitoringRepo");
repo.add(context, originalMessageId, exchange);
repo.remove(context, originalMessageId, exchange);
// lock the row to create a delay and ensure we recover
// exchange ids that return null at some point
repo.recover(context, exchange.getExchangeId());
}
use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.
the class TestTimedOutMonitorRoute 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 ConcurrentJPAAggregationRepository_doStartTest method testDoStart_nonEmptyAggregation_assertNoException.
@Test
public void testDoStart_nonEmptyAggregation_assertNoException() throws Exception {
AggregationDAO dao = mock(AggregationDAO.class);
when(dao.getAggregationKeys()).thenReturn(Arrays.asList("12345"));
when(dao.getAggregationCompletedKeys()).thenReturn(Arrays.asList("12345"));
final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(dao);
repo.doStart();
repo.doStop();
}
use of org.nhindirect.monitor.dao.AggregationDAO in project nhin-d by DirectProject.
the class ConcurrentJPAAggregationRepository_getTest method testGet_daoException_assertException.
@Test
public void testGet_daoException_assertException() throws Exception {
AggregationDAO dao = mock(AggregationDAO.class);
doThrow(new RuntimeException()).when(dao).getAggregationCompleted((String) any(), eq(true));
final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(dao);
boolean exceptionOccured = false;
try {
repo.recover(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_nullKeys_assertEmptySet.
@Test
public void testScan_nullKeys_assertEmptySet() throws Exception {
AggregationDAO dao = mock(AggregationDAO.class);
when(dao.getAggregationCompletedKeys()).thenReturn(null);
final ConcurrentJPAAggregationRepository repo = new ConcurrentJPAAggregationRepository(notifDao);
final Set<String> ids = repo.scan(context);
assertEquals(0, ids.size());
}
Aggregations