Search in sources :

Example 21 with TxCompletionCondition

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

the class VariableCompletionCondition_isCompleteTest method testIsComplete_isTimely_assertComplete.

@SuppressWarnings("unchecked")
@Test
public void testIsComplete_isTimely_assertComplete() {
    TxCompletionCondition timelyCond = mock(TxCompletionCondition.class);
    when(timelyCond.isComplete((Collection<Tx>) any())).thenReturn(true);
    TxCompletionCondition generalCond = mock(TxCompletionCondition.class);
    VariableCompletionCondition cond = new VariableCompletionCondition(timelyCond, generalCond);
    VariableCompletionCondition spy = spy(cond);
    Tx msgToTrack = mock(Tx.class);
    when(spy.getMessageToTrackInternal((Collection<Tx>) any())).thenReturn(msgToTrack);
    when(spy.isRelAndTimelyRequired((Tx) any())).thenReturn(true);
    assertTrue(spy.isComplete(null));
    verify(timelyCond, times(1)).isComplete((Collection<Tx>) any());
    verify(generalCond, never()).isComplete((Collection<Tx>) any());
}
Also used : TxCompletionCondition(org.nhindirect.monitor.condition.TxCompletionCondition) Tx(org.nhindirect.common.tx.model.Tx) 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