use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class TxUtil_isRelAndTimelyTest method testIsTimelyAndRequired_emptyDetails_assertFalse.
@Test
public void testIsTimelyAndRequired_emptyDetails_assertFalse() {
Tx msg = new Tx(TxMessageType.IMF, new HashMap<String, TxDetail>());
assertFalse(TxUtil.isReliableAndTimelyRequested(msg));
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMessageDetails_OptionalInputsTest method testGetMessageDetailsFromInputStream_getDetailsFromCommonMessage.
@Test
public void testGetMessageDetailsFromInputStream_getDetailsFromCommonMessage() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
final InputStream inStream = IOUtils.toInputStream(TestUtils.readMessageFromFile("MessageWithAttachment.txt"));
try {
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(inStream);
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());
} finally {
IOUtils.closeQuietly(inStream);
}
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMessageDetails_OptionalInputsTest method testGetMessageDetails_getReportExtension_noDispostionOption.
@Test
public void testGetMessageDetails_getReportExtension_noDispostionOption() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MDNMessage.txt");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertNull("X-DIRECT-FINAL-DESTINATION-DELIVERY", details.get(TxDetailType.DISPOSITION_OPTIONS.getType()));
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMessageDetails_OptionalInputsTest method testGetMessageDetailsFromHeaders_getDetailsFromCommonMessage.
@Test
public void testGetMessageDetailsFromHeaders_getDetailsFromCommonMessage() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
final InputStream inStream = IOUtils.toInputStream(TestUtils.readMessageFromFile("MessageWithAttachment.txt"));
try {
final InternetHeaders headers = new InternetHeaders(inStream);
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(headers);
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());
} finally {
IOUtils.closeQuietly(inStream);
}
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_senderExists.
@Test
public void testGetMessageDetails_senderExists() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
msg.setHeader(MailStandard.Headers.Sender, "gm2552@cerner.com");
final DefaultTxDetailParser parser = new DefaultTxDetailParser();
final Map<String, TxDetail> details = parser.getMessageDetails(msg);
assertEquals(MailStandard.getHeader(msg, MailStandard.Headers.Sender).toLowerCase(Locale.getDefault()), details.get(TxDetailType.SENDER.getType()).getDetailValue());
}
Aggregations