use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_ToAndCC.
@Test
public void testGetMessageDetails_ToAndCC() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
msg.setHeader(MailStandard.Headers.To, "gm2552@cerner.com");
msg.setHeader(MailStandard.Headers.CC, "ah4626@cerner.com");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertEquals("gm2552@cerner.com,ah4626@cerner.com", details.get(TxDetailType.RECIPIENTS.getType()).getDetailValue());
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_generalDNSMessage_noOrigMessageId.
@Test
public void testGetMessageDetails_generalDNSMessage_noOrigMessageId() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("DSNMessageOrigInReplyTo.txt");
msg.setHeader(MailStandard.Headers.InReplyTo, "");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertNull(details.get(TxDetailType.PARENT_MSG_ID.getType()));
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class TestUtils method makeReliableMessage.
public static Tx makeReliableMessage(TxMessageType type, String msgId, String parentId, String from, String recip, String finalRecip, String action, String disposition) {
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
if (msgId != null && !msgId.isEmpty())
details.put(TxDetailType.MSG_ID.getType(), new TxDetail(TxDetailType.MSG_ID, msgId));
if (parentId != null && !parentId.isEmpty())
details.put(TxDetailType.PARENT_MSG_ID.getType(), new TxDetail(TxDetailType.PARENT_MSG_ID, parentId));
if (from != null && !from.isEmpty())
details.put(TxDetailType.FROM.getType(), new TxDetail(TxDetailType.FROM, from));
if (recip != null && !recip.isEmpty())
details.put(TxDetailType.RECIPIENTS.getType(), new TxDetail(TxDetailType.RECIPIENTS, recip));
if (finalRecip != null && !finalRecip.isEmpty())
details.put(TxDetailType.FINAL_RECIPIENTS.getType(), new TxDetail(TxDetailType.FINAL_RECIPIENTS, finalRecip));
if (action != null && !action.isEmpty())
details.put(TxDetailType.DSN_ACTION.getType(), new TxDetail(TxDetailType.DSN_ACTION, action));
if (disposition != null && !disposition.isEmpty())
details.put(TxDetailType.DISPOSITION.getType(), new TxDetail(TxDetailType.DISPOSITION, disposition));
details.put(TxDetailType.DISPOSITION_OPTIONS.getType(), new TxDetail(TxDetailType.DISPOSITION_OPTIONS, "X-DIRECT-FINAL-DESTINATION-DELIVERY"));
return new Tx(type, details);
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class TxUtil_isRelAndTimelyTest method testIsTimelyAndRequired_NoMNDOptionDetails_assertFalse.
@Test
public void testIsTimelyAndRequired_NoMNDOptionDetails_assertFalse() {
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(TxUtil.isReliableAndTimelyRequested(msg));
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class TxUtil_isRelAndTimelyTest method testIsTimelyAndRequired_MDNOptionNotForTimely_assertFalse.
@Test
public void testIsTimelyAndRequired_MDNOptionNotForTimely_assertFalse() {
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(TxUtil.isReliableAndTimelyRequested(msg));
}
Aggregations