use of javax.mail.internet.MimeMessage in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_mutlipleTo.
@Test
public void testGetMessageDetails_mutlipleTo() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
msg.setHeader(MailStandard.Headers.To, "gm2552@cerner.com,ah4626@cerner.com");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.To).toLowerCase(Locale.getDefault()), details.get(TxDetailType.RECIPIENTS.getType()).getDetailValue());
}
use of javax.mail.internet.MimeMessage in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_generalDNSMessage_noOrigMessageId_getFromReplyTo.
@Test
public void testGetMessageDetails_generalDNSMessage_noOrigMessageId_getFromReplyTo() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("DSNMessageOrigInReplyTo.txt");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertEquals("<9501051053.aa04167@IETF.CNR I.Reston.VA.US>", details.get(TxDetailType.PARENT_MSG_ID.getType()).getDetailValue());
}
use of javax.mail.internet.MimeMessage in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_noFrom.
@Test
public void testGetMessageDetails_noFrom() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
msg.setHeader(MailStandard.Headers.From, "");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertNull(details.get(TxDetailType.FROM.getType()));
}
use of javax.mail.internet.MimeMessage 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 javax.mail.internet.MimeMessage 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()));
}
Aggregations