Search in sources :

Example 31 with TxDetail

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

the class VariableCompletionCondition_isTimelyAndRequiredTest method testIsTimelyAndRequired_MDNOptionForTimely_assertTrue.

@Test
public void testIsTimelyAndRequired_MDNOptionForTimely_assertTrue() {
    TxCompletionCondition cond1 = mock(TxCompletionCondition.class);
    TxCompletionCondition cond2 = mock(TxCompletionCondition.class);
    VariableCompletionCondition cond = new VariableCompletionCondition(cond1, cond2);
    Map<String, TxDetail> details = new HashMap<String, TxDetail>();
    details.put(TxDetailType.DISPOSITION_OPTIONS.getType(), new TxDetail(TxDetailType.DISPOSITION_OPTIONS, MDNStandard.DispositionOption_TimelyAndReliable));
    Tx msg = new Tx(TxMessageType.IMF, details);
    assertTrue(cond.isRelAndTimelyRequired(msg));
}
Also used : TxCompletionCondition(org.nhindirect.monitor.condition.TxCompletionCondition) Tx(org.nhindirect.common.tx.model.Tx) HashMap(java.util.HashMap) TxDetail(org.nhindirect.common.tx.model.TxDetail) Test(org.junit.Test)

Example 32 with TxDetail

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

the class VariableCompletionCondition_isTimelyAndRequiredTest method testIsTimelyAndRequired_MDNOptionNotForTimely_assertFalse.

@Test
public void testIsTimelyAndRequired_MDNOptionNotForTimely_assertFalse() {
    TxCompletionCondition cond1 = mock(TxCompletionCondition.class);
    TxCompletionCondition cond2 = mock(TxCompletionCondition.class);
    VariableCompletionCondition cond = new VariableCompletionCondition(cond1, cond2);
    Map<String, TxDetail> details = new HashMap<String, TxDetail>();
    details.put(TxDetailType.DISPOSITION_OPTIONS.getType(), new TxDetail(TxDetailType.DISPOSITION_OPTIONS, "X-NOT-TIMELY"));
    Tx msg = new Tx(TxMessageType.IMF, details);
    assertFalse(cond.isRelAndTimelyRequired(msg));
}
Also used : TxCompletionCondition(org.nhindirect.monitor.condition.TxCompletionCondition) Tx(org.nhindirect.common.tx.model.Tx) HashMap(java.util.HashMap) TxDetail(org.nhindirect.common.tx.model.TxDetail) Test(org.junit.Test)

Example 33 with TxDetail

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

the class TimelyAndReliableCompletionCondition_isCompleteTest method testIsComplete_noFinalRecips_assertFalse.

@Test
public void testIsComplete_noFinalRecips_assertFalse() {
    TimelyAndReliableCompletionCondition condition = new TimelyAndReliableCompletionCondition();
    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));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) HashMap(java.util.HashMap) TxDetail(org.nhindirect.common.tx.model.TxDetail) Test(org.junit.Test)

Example 34 with TxDetail

use of org.nhindirect.common.tx.model.TxDetail 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));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) HashMap(java.util.HashMap) TxDetail(org.nhindirect.common.tx.model.TxDetail) Test(org.junit.Test)

Example 35 with TxDetail

use of org.nhindirect.common.tx.model.TxDetail 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));
}
Also used : Tx(org.nhindirect.common.tx.model.Tx) TxDetail(org.nhindirect.common.tx.model.TxDetail) Test(org.junit.Test)

Aggregations

TxDetail (org.nhindirect.common.tx.model.TxDetail)70 Test (org.junit.Test)50 Tx (org.nhindirect.common.tx.model.Tx)35 MimeMessage (javax.mail.internet.MimeMessage)32 HashMap (java.util.HashMap)20 Exchange (org.apache.camel.Exchange)10 CamelContext (org.apache.camel.CamelContext)9 DefaultExchange (org.apache.camel.impl.DefaultExchange)9 ArrayList (java.util.ArrayList)7 TxMessageType (org.nhindirect.common.tx.model.TxMessageType)6 NotificationDAOException (org.nhindirect.monitor.dao.NotificationDAOException)5 InputStream (java.io.InputStream)4 Address (javax.mail.Address)4 InternetAddress (javax.mail.internet.InternetAddress)4 DefaultTxDetailParser (org.nhindirect.common.tx.impl.DefaultTxDetailParser)4 TxCompletionCondition (org.nhindirect.monitor.condition.TxCompletionCondition)4 Header (javax.mail.Header)3 MessagingException (javax.mail.MessagingException)3 MimeBodyPart (javax.mail.internet.MimeBodyPart)3 DSNMessageHeaders (org.nhindirect.common.mail.dsn.DSNMessageHeaders)3