use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class TimeoutDupStateManager_addNotificationForOriginalRecipsTest method testAddNotificationForOriginalRecips_addDupRecip_assertNotificationsAdded.
@Test
public void testAddNotificationForOriginalRecips_addDupRecip_assertNotificationsAdded() throws Exception {
TimeoutDupStateManager mgr = new TimeoutDupStateManager();
mgr.setDao(notifDao);
final Tx tx = TestUtils.makeReliableMessage(TxMessageType.IMF, "1234", "", "test@test.com", "me@you.com,you@you.com", "test@test.com", "", "");
mgr.addNotificationForOriginalRecips(Arrays.asList(tx));
Set<String> recAddresses = notifDao.getReceivedAddresses("1234", Arrays.asList("me@you.com", "you@you.com"));
assertTrue(recAddresses.contains("me@you.com"));
assertTrue(recAddresses.contains("you@you.com"));
// add it again
mgr.addNotificationForOriginalRecips(Arrays.asList(tx));
recAddresses = notifDao.getReceivedAddresses("1234", Arrays.asList("me@you.com", "you@you.com"));
assertEquals(2, recAddresses.size());
}
use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class TimeoutDupStateManager_addNotificationForOriginalRecipsTest method testAddNotificationForOriginalRecips_noOrigMsg_assertNotificationNotAdded.
@Test
public void testAddNotificationForOriginalRecips_noOrigMsg_assertNotificationNotAdded() throws Exception {
TimeoutDupStateManager mgr = new TimeoutDupStateManager();
NotificationDuplicationDAO dao = mock(NotificationDuplicationDAO.class);
mgr.setDao(dao);
final Tx tx = TestUtils.makeMessage(TxMessageType.MDN, "1234", "", "test@test.com", "me@you.com", "test@test.com");
mgr.addNotificationForOriginalRecips(Arrays.asList(tx));
verify(dao, never()).addNotification((String) any(), (String) any());
}
use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class GeneralCompletionCondition_isCompleteTest method testIsComplete_noFinalRecips_assertFalse.
@Test
public void testIsComplete_noFinalRecips_assertFalse() {
GeneralCompletionCondition condition = new GeneralCompletionCondition();
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
String msgId = UUID.randomUUID().toString();
details.put(TxDetailType.MSG_ID.getType(), new TxDetail(TxDetailType.MSG_ID, msgId));
Tx tx = new Tx(TxMessageType.IMF, details);
List<Tx> txs = Arrays.asList(tx);
assertFalse(condition.isComplete(txs));
}
use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class GeneralCompletionCondition_isCompleteTest method testIsComplete_DSNMessageReceived_assertTrue.
@Test
public void testIsComplete_DSNMessageReceived_assertTrue() {
GeneralCompletionCondition condition = new GeneralCompletionCondition();
// original message
final String originalMessageId = UUID.randomUUID().toString();
Tx originalMessage = TestUtils.makeMessage(TxMessageType.IMF, originalMessageId, "", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "");
// MDN to original message
Tx mdnMessage = TestUtils.makeMessage(TxMessageType.DSN, UUID.randomUUID().toString(), originalMessageId, "gm2552@direct.securehealthemail.com", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com");
List<Tx> txs = Arrays.asList(originalMessage, mdnMessage);
assertTrue(condition.isComplete(txs));
}
use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class GeneralCompletionCondition_isCompleteTest method testIsComplete_noMessageToTrack_assertFalse.
@Test
public void testIsComplete_noMessageToTrack_assertFalse() {
GeneralCompletionCondition condition = new GeneralCompletionCondition();
Tx tx = new Tx(TxMessageType.DSN, new HashMap<String, TxDetail>());
List<Tx> txs = Arrays.asList(tx);
assertFalse(condition.isComplete(txs));
}
Aggregations