use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_generalMDNMessage.
@Test
public void testGetMessageDetails_generalMDNMessage() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MDNMessage.txt");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertEquals(MDNStandard.getMDNField(msg, MDNStandard.Headers.Disposition).toLowerCase(Locale.getDefault()), details.get(TxDetailType.DISPOSITION.getType()).getDetailValue());
assertEquals(MDNStandard.getMDNField(msg, MDNStandard.Headers.FinalRecipient).toLowerCase(Locale.getDefault()), details.get(TxDetailType.FINAL_RECIPIENTS.getType()).getDetailValue());
assertEquals(MDNStandard.getMDNField(msg, MDNStandard.Headers.OriginalMessageID), details.get(TxDetailType.PARENT_MSG_ID.getType()).getDetailValue());
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_generalDNSMessage_noActionOrStatus.
@Test
public void testGetMessageDetails_generalDNSMessage_noActionOrStatus() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("DSNMessageNoActionOrStatus.txt");
msg.setHeader(MailStandard.Headers.InReplyTo, "");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertNull(details.get(TxDetailType.DSN_ACTION.getType()));
assertNull(details.get(TxDetailType.DSN_STATUS.getType()));
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_commonMessage_timelyAndReliable.
@Test
public void testGetMessageDetails_commonMessage_timelyAndReliable() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
msg.setHeader(MDNStandard.Headers.DispositionNotificationOptions, "X-DIRECT-FINAL-DESTINATION-DELIVERY=optional,true");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.MessageID), details.get(TxDetailType.MSG_ID.getType()).getDetailValue());
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.From).toLowerCase(Locale.getDefault()), details.get(TxDetailType.FROM.getType()).getDetailValue());
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.To).toLowerCase(Locale.getDefault()), details.get(TxDetailType.RECIPIENTS.getType()).getDetailValue());
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.Subject).toLowerCase(Locale.getDefault()), details.get(TxDetailType.SUBJECT.getType()).getDetailValue());
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_getDetailsFromCommonMessage.
@Test
public void testGetMessageDetails_getDetailsFromCommonMessage() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.MessageID), details.get(TxDetailType.MSG_ID.getType()).getDetailValue());
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.From).toLowerCase(Locale.getDefault()), details.get(TxDetailType.FROM.getType()).getDetailValue());
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.To).toLowerCase(Locale.getDefault()), details.get(TxDetailType.RECIPIENTS.getType()).getDetailValue());
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.Subject).toLowerCase(Locale.getDefault()), details.get(TxDetailType.SUBJECT.getType()).getDetailValue());
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_noDisposition.
@Test
public void testGetMessageDetails_noDisposition() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MDNMessageNoDisp.txt");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertNull(details.get(TxDetailType.DISPOSITION.getType()));
}
Aggregations