Search in sources :

Example 16 with TxCompletionCondition

use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.

the class VariableCompletionCondition_isTimelyAndRequiredTest method testIsTimelyAndRequired_emptyDetails_assertFalse.

@Test
public void testIsTimelyAndRequired_emptyDetails_assertFalse() {
    TxCompletionCondition cond1 = mock(TxCompletionCondition.class);
    TxCompletionCondition cond2 = mock(TxCompletionCondition.class);
    VariableCompletionCondition cond = new VariableCompletionCondition(cond1, cond2);
    Tx msg = new Tx(TxMessageType.IMF, new HashMap<String, TxDetail>());
    assertFalse(cond.isRelAndTimelyRequired(msg));
}
Also used : TxCompletionCondition(org.nhindirect.monitor.condition.TxCompletionCondition) Tx(org.nhindirect.common.tx.model.Tx) TxDetail(org.nhindirect.common.tx.model.TxDetail) Test(org.junit.Test)

Example 17 with TxCompletionCondition

use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.

the class VariableCompletionCondition_isTimelyAndRequiredTest method testIsTimelyAndRequired_NoMNDOptionDetails_assertFalse.

@Test
public void testIsTimelyAndRequired_NoMNDOptionDetails_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.FROM.getType(), new TxDetail(TxDetailType.FROM, "me@test.com"));
    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 18 with TxCompletionCondition

use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.

the class VariableCompletionCondition_isTimelyAndRequiredTest method testIsTimelyAndRequired_nullMessage_assertFalse.

@Test
public void testIsTimelyAndRequired_nullMessage_assertFalse() {
    TxCompletionCondition cond1 = mock(TxCompletionCondition.class);
    TxCompletionCondition cond2 = mock(TxCompletionCondition.class);
    VariableCompletionCondition cond = new VariableCompletionCondition(cond1, cond2);
    assertFalse(cond.isRelAndTimelyRequired(null));
}
Also used : TxCompletionCondition(org.nhindirect.monitor.condition.TxCompletionCondition) Test(org.junit.Test)

Example 19 with TxCompletionCondition

use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.

the class VariableCompletionCondition_constructionTest method testConstruction.

@Test
public void testConstruction() {
    TxCompletionCondition cond1 = mock(TxCompletionCondition.class);
    TxCompletionCondition cond2 = mock(TxCompletionCondition.class);
    VariableCompletionCondition cond = new VariableCompletionCondition(cond1, cond2);
    assertEquals(cond1, cond.timelyRelCondition);
    assertEquals(cond2, cond.generalCondition);
}
Also used : TxCompletionCondition(org.nhindirect.monitor.condition.TxCompletionCondition) Test(org.junit.Test)

Example 20 with TxCompletionCondition

use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.

the class VariableCompletionCondition_getIncompleteRecipientsEmptyTxsTest method testIsComplete_noMessageToTrack_emptyTxs.

@Test
public void testIsComplete_noMessageToTrack_emptyTxs() {
    TxCompletionCondition cond = mock(TxCompletionCondition.class);
    VariableCompletionCondition condition = new VariableCompletionCondition(cond, cond);
    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 : TxCompletionCondition(org.nhindirect.monitor.condition.TxCompletionCondition) Tx(org.nhindirect.common.tx.model.Tx) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

TxCompletionCondition (org.nhindirect.monitor.condition.TxCompletionCondition)21 Test (org.junit.Test)20 Tx (org.nhindirect.common.tx.model.Tx)14 Exchange (org.apache.camel.Exchange)5 ArrayList (java.util.ArrayList)4 TxDetail (org.nhindirect.common.tx.model.TxDetail)4 HashMap (java.util.HashMap)3 Message (org.apache.camel.Message)3 TxTimeoutCondition (org.nhindirect.monitor.condition.TxTimeoutCondition)3 CamelContext (org.apache.camel.CamelContext)2 DefaultExchange (org.apache.camel.impl.DefaultExchange)2 DSNFailureTextBodyPartGenerator (org.nhindirect.common.mail.dsn.DSNFailureTextBodyPartGenerator)1 DSNGenerator (org.nhindirect.common.mail.dsn.DSNGenerator)1 DefaultDSNFailureTextBodyPartGenerator (org.nhindirect.common.mail.dsn.impl.DefaultDSNFailureTextBodyPartGenerator)1 GeneralCompletionCondition (org.nhindirect.monitor.condition.impl.GeneralCompletionCondition)1