use of org.apache.camel.Exchange in project nhin-d by DirectProject.
the class MessageIdCorrelationExpression_evaluateTest method testEvaluate_IMFMessage_noMsgId_assertNullId.
@Test
public void testEvaluate_IMFMessage_noMsgId_assertNullId() {
MessageIdCorrelationExpression exp = new MessageIdCorrelationExpression();
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.FROM.getType(), new TxDetail(TxDetailType.FROM, "me@test.com"));
Tx tx = new Tx(TxMessageType.IMF, details);
CamelContext context = mock(CamelContext.class);
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(tx);
assertNull(exp.evaluate(exchange, String.class));
}
use of org.apache.camel.Exchange in project nhin-d by DirectProject.
the class MessageIdCorrelationExpression_evaluateTest method testEvaluate_DSNMessage_parentMsgIdExists_assertMessageIdEvaluated.
@Test
public void testEvaluate_DSNMessage_parentMsgIdExists_assertMessageIdEvaluated() {
MessageIdCorrelationExpression exp = new MessageIdCorrelationExpression();
String msgId = UUID.randomUUID().toString();
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.PARENT_MSG_ID.getType(), new TxDetail(TxDetailType.PARENT_MSG_ID, msgId));
Tx tx = new Tx(TxMessageType.DSN, details);
CamelContext context = mock(CamelContext.class);
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(tx);
assertEquals(msgId, exp.evaluate(exchange, String.class));
}
use of org.apache.camel.Exchange in project nhin-d by DirectProject.
the class MessageIdCorrelationExpression_evaluateTest method testEvaluate_MDNMessage_noParentMsgId_assertNullId.
@Test
public void testEvaluate_MDNMessage_noParentMsgId_assertNullId() {
MessageIdCorrelationExpression exp = new MessageIdCorrelationExpression();
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.FROM.getType(), new TxDetail(TxDetailType.FROM, "me@test.com"));
Tx tx = new Tx(TxMessageType.MDN, details);
CamelContext context = mock(CamelContext.class);
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(tx);
assertNull(exp.evaluate(exchange, String.class));
}
use of org.apache.camel.Exchange in project nhin-d by DirectProject.
the class MessageIdCorrelationExpression_evaluateTest method testEvaluate_DNSMessage_noParentMsgId_assertNullId.
@Test
public void testEvaluate_DNSMessage_noParentMsgId_assertNullId() {
MessageIdCorrelationExpression exp = new MessageIdCorrelationExpression();
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.FROM.getType(), new TxDetail(TxDetailType.FROM, "me@test.com"));
Tx tx = new Tx(TxMessageType.MDN, details);
CamelContext context = mock(CamelContext.class);
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(tx);
assertNull(exp.evaluate(exchange, String.class));
}
use of org.apache.camel.Exchange in project nhin-d by DirectProject.
the class MessageIdCorrelationExpression_evaluateTest method testEvaluate_MDNMessage_parentMsgIdExists_assertMessageIdEvaluated.
@Test
public void testEvaluate_MDNMessage_parentMsgIdExists_assertMessageIdEvaluated() {
MessageIdCorrelationExpression exp = new MessageIdCorrelationExpression();
String msgId = UUID.randomUUID().toString();
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.PARENT_MSG_ID.getType(), new TxDetail(TxDetailType.PARENT_MSG_ID, msgId));
Tx tx = new Tx(TxMessageType.MDN, details);
CamelContext context = mock(CamelContext.class);
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(tx);
assertEquals(msgId, exp.evaluate(exchange, String.class));
}
Aggregations