use of javax.mail.internet.MimeMessage in project nhin-d by DirectProject.
the class DefaultTxDetailParser method getMessageDetails.
public Map<String, TxDetail> getMessageDetails(InputStream stream) {
Map<String, TxDetail> retVal = null;
if (stream == null)
throw new IllegalArgumentException("Input stream cannot be null");
try {
// convert into a MimeMessage
final MimeMessage msg = new MimeMessage(null, stream);
retVal = getMessageDetails(msg);
}///CLOVER:OFF
catch (MessagingException e) {
LOGGER.warn("Failed to translate input stream into MimeMessage.", e);
}
return retVal;
}
use of javax.mail.internet.MimeMessage in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_noFullHeaders.
@Test
public void testGetMessageDetails_noFullHeaders() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
final DefaultTxDetailParser parser = new DefaultTxDetailParser() {
@Override
public String getHeadersAsStringInternal(MimeMessage msg) {
return "";
}
};
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertNull(details.get(TxDetailType.MSG_FULL_HEADERS.getType()));
}
use of javax.mail.internet.MimeMessage in project nhin-d by DirectProject.
the class TxUtil_getMessageTypeTypeTest method testGetMessageType_SMIMEMessage.
@Test
public void testGetMessageType_SMIMEMessage() throws Exception {
MimeMessage msg = TestUtils.readMimeMessageFromFile("SMIMEMessage.txt");
assertEquals(TxMessageType.SMIME, TxUtil.getMessageType(msg));
}
use of javax.mail.internet.MimeMessage in project nhin-d by DirectProject.
the class TxUtil_isRelAndTimelyTest method testIsTimelyAndRequired_MDNOptionForTimelyMimeMessage_assertTrue.
@Test
public void testIsTimelyAndRequired_MDNOptionForTimelyMimeMessage_assertTrue() throws Exception {
MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
msg.addHeader(MDNStandard.Headers.DispositionNotificationOptions, MDNStandard.DispositionOption_TimelyAndReliable);
msg.saveChanges();
assertTrue(TxUtil.isReliableAndTimelyRequested(msg));
}
use of javax.mail.internet.MimeMessage in project nhin-d by DirectProject.
the class TxUtil_isRelAndTimelyTest method testIsTimelyAndRequired_NoMDNOptionForTimelyMimeMessage_assertFalse.
@Test
public void testIsTimelyAndRequired_NoMDNOptionForTimelyMimeMessage_assertFalse() throws Exception {
MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
assertFalse(TxUtil.isReliableAndTimelyRequested(msg));
}
Aggregations