Search in sources :

Example 16 with Tx

use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.

the class DefaultDuplicateNotificationStateManager_suppressNotificationTest method testSuppressNotification_nonNotificationTx_assertFalse.

@Test
public void testSuppressNotification_nonNotificationTx_assertFalse() throws Exception {
    DefaultDuplicateNotificationStateManager mgr = new DefaultDuplicateNotificationStateManager();
    mgr.setDao(notifDao);
    Tx tx = TestUtils.makeMessage(TxMessageType.IMF, "1234", "", "", "", "gm2552@cerner.com");
    assertFalse(mgr.suppressNotification(tx));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) Test(org.junit.Test)

Example 17 with Tx

use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.

the class DefaultDuplicateNotificationStateManager_suppressNotificationTest method testSuppressNotification_recipInStore_assertTrue.

@Test
public void testSuppressNotification_recipInStore_assertTrue() throws Exception {
    DefaultDuplicateNotificationStateManager mgr = new DefaultDuplicateNotificationStateManager();
    mgr.setDao(notifDao);
    Tx tx = TestUtils.makeMessage(TxMessageType.MDN, "1234", "5678", "", "", "gm2552@cerner.com", "", MDNStandard.Disposition_Error);
    mgr.addNotification(tx);
    assertTrue(mgr.suppressNotification(tx));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) Test(org.junit.Test)

Example 18 with Tx

use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.

the class DefaultDuplicateNotificationStateManager_suppressNotificationTest method testSuppressNotification_displayedDisposition_assertFalse.

@Test
public void testSuppressNotification_displayedDisposition_assertFalse() throws Exception {
    DefaultDuplicateNotificationStateManager mgr = new DefaultDuplicateNotificationStateManager();
    mgr.setDao(notifDao);
    Tx tx = TestUtils.makeMessage(TxMessageType.MDN, "1234", "5678", "", "", "", "", MDNStandard.Disposition_Displayed);
    assertFalse(mgr.suppressNotification(tx));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) Test(org.junit.Test)

Example 19 with Tx

use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.

the class DefaultDuplicateNotificationStateManager_suppressNotificationTest method testAddNotification_daoError_assertException.

@SuppressWarnings("unchecked")
@Test
public void testAddNotification_daoError_assertException() throws Exception {
    DefaultDuplicateNotificationStateManager mgr = new DefaultDuplicateNotificationStateManager();
    boolean execptionOccured = false;
    NotificationDuplicationDAO spyDao = mock(NotificationDuplicationDAO.class);
    doThrow(new NotificationDAOException("")).when(spyDao).getReceivedAddresses((String) any(), (Collection<String>) any());
    mgr.setDao(spyDao);
    try {
        Tx tx = TestUtils.makeMessage(TxMessageType.DSN, "1234", "5678", "", "", "gm2552@cerner.com,ah4626@cerner.com");
        mgr.suppressNotification(tx);
    } catch (DuplicateNotificationStateManagerException e) {
        execptionOccured = true;
    }
    assertTrue(execptionOccured);
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) NotificationDAOException(org.nhindirect.monitor.dao.NotificationDAOException) NotificationDuplicationDAO(org.nhindirect.monitor.dao.NotificationDuplicationDAO) DuplicateNotificationStateManagerException(org.nhindirect.monitor.processor.DuplicateNotificationStateManagerException) Test(org.junit.Test)

Example 20 with Tx

use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.

the class DefaultDuplicateNotificationStateManager_suppressNotificationTest method testSuppressNotification_noFinalRecip_assertFalse.

@Test
public void testSuppressNotification_noFinalRecip_assertFalse() throws Exception {
    DefaultDuplicateNotificationStateManager mgr = new DefaultDuplicateNotificationStateManager();
    mgr.setDao(notifDao);
    Tx tx = TestUtils.makeMessage(TxMessageType.MDN, "1234", "5678", "", "", "", "", MDNStandard.Disposition_Error);
    assertFalse(mgr.suppressNotification(tx));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) Test(org.junit.Test)

Aggregations

Tx (org.nhindirect.common.tx.model.Tx)174 Test (org.junit.Test)156 Exchange (org.apache.camel.Exchange)83 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)49 TxDetail (org.nhindirect.common.tx.model.TxDetail)35 DefaultExchange (org.apache.camel.impl.DefaultExchange)32 ArrayList (java.util.ArrayList)26 HashMap (java.util.HashMap)19 MimeMessage (javax.mail.internet.MimeMessage)17 CamelContext (org.apache.camel.CamelContext)17 ConcurrentJPAAggregationRepository (org.nhindirect.monitor.aggregator.repository.ConcurrentJPAAggregationRepository)15 TxCompletionCondition (org.nhindirect.monitor.condition.TxCompletionCondition)14 TxTimeoutCondition (org.nhindirect.monitor.condition.TxTimeoutCondition)8 Collection (java.util.Collection)7 NotificationDuplicationDAO (org.nhindirect.monitor.dao.NotificationDuplicationDAO)7 NHINDAddress (org.nhindirect.stagent.NHINDAddress)6 NHINDAddressCollection (org.nhindirect.stagent.NHINDAddressCollection)6 Response (javax.ws.rs.core.Response)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 MessagingException (javax.mail.MessagingException)4