Search in sources :

Example 61 with Tx

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

the class TimelyAndReliableCompletionCondition_getIncompleteRecipientsEmptyTxsTest method testIsComplete_noMessageToTrack_emptyTxs.

@Test
public void testIsComplete_noMessageToTrack_emptyTxs() {
    TimelyAndReliableCompletionCondition condition = new TimelyAndReliableCompletionCondition();
    Tx originalMessage = TestUtils.makeMessage(TxMessageType.DSN, "", UUID.randomUUID().toString(), "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "");
    Collection<Tx> txs = new ArrayList<Tx>();
    txs.add(originalMessage);
    Collection<String> recips = condition.getIncompleteRecipients(txs);
    assertEquals(0, recips.size());
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 62 with Tx

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

the class TimelyAndReliableCompletionCondition_isCompleteTest method testIsComplete_noMessageToTrack_assertFalse.

@Test
public void testIsComplete_noMessageToTrack_assertFalse() {
    TimelyAndReliableCompletionCondition condition = new TimelyAndReliableCompletionCondition();
    Tx tx = new Tx(TxMessageType.DSN, new HashMap<String, TxDetail>());
    List<Tx> txs = Arrays.asList(tx);
    assertFalse(condition.isComplete(txs));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) TxDetail(org.nhindirect.common.tx.model.TxDetail) Test(org.junit.Test)

Example 63 with Tx

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

the class TimelyAndReliableCompletionCondition_isCompleteTest method testIsComplete_MDNDispotionNull_assertFalse.

@Test
public void testIsComplete_MDNDispotionNull_assertFalse() {
    TimelyAndReliableCompletionCondition condition = new TimelyAndReliableCompletionCondition();
    // 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.makeReliableMessage(TxMessageType.MDN, UUID.randomUUID().toString(), originalMessageId, "gm2552@direct.securehealthemail.com", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "", "");
    List<Tx> txs = Arrays.asList(originalMessage, mdnMessage);
    assertFalse(condition.isComplete(txs));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) Test(org.junit.Test)

Example 64 with Tx

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

the class TimelyAndReliableCompletionCondition_isCompleteTest method testIsComplete_FinalRicipNull_assertFalse.

@Test
public void testIsComplete_FinalRicipNull_assertFalse() {
    TimelyAndReliableCompletionCondition condition = new TimelyAndReliableCompletionCondition();
    // 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.makeReliableMessage(TxMessageType.MDN, UUID.randomUUID().toString(), originalMessageId, "gm2552@direct.securehealthemail.com", "gm2552@cerner.com", "", "", MDNStandard.Disposition_Processed);
    List<Tx> txs = Arrays.asList(originalMessage, mdnMessage);
    assertFalse(condition.isComplete(txs));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) Test(org.junit.Test)

Example 65 with Tx

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

the class GeneralCompletionCondition_isCompleteTest method testIsComplete_DSNMessageReceived_plusNotationOnDSNRecip_rfc822NotactionOnFinalRecip_assertTrue.

@Test
public void testIsComplete_DSNMessageReceived_plusNotationOnDSNRecip_rfc822NotactionOnFinalRecip_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+readreciept@cerner.com", "rfc822; gm2552@direct.securehealthemail.com");
    List<Tx> txs = Arrays.asList(originalMessage, mdnMessage);
    assertTrue(condition.isComplete(txs));
}
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