use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class TxUtil_isRelAndTimelyTest method testIsTimelyAndRequired_MDNOptionForTimely_assertTrue.
@Test
public void testIsTimelyAndRequired_MDNOptionForTimely_assertTrue() {
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.DISPOSITION_OPTIONS.getType(), new TxDetail(TxDetailType.DISPOSITION_OPTIONS, MDNStandard.DispositionOption_TimelyAndReliable));
Tx msg = new Tx(TxMessageType.IMF, details);
assertTrue(TxUtil.isReliableAndTimelyRequested(msg));
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class TxUtil_isRelAndTimelyTest method testIsTimelyAndRequired_caseInsensitiveOption_MDNOptionForTimely_assertTrue.
@Test
public void testIsTimelyAndRequired_caseInsensitiveOption_MDNOptionForTimely_assertTrue() {
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.DISPOSITION_OPTIONS.getType(), new TxDetail(TxDetailType.DISPOSITION_OPTIONS, MDNStandard.DispositionOption_TimelyAndReliable.toLowerCase()));
Tx msg = new Tx(TxMessageType.IMF, details);
assertTrue(TxUtil.isReliableAndTimelyRequested(msg));
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMessageDetails_OptionalInputsTest method testGetMessageDetails_getReportExtension_lowercaseOption_assertdispostionOption.
@Test
public void testGetMessageDetails_getReportExtension_lowercaseOption_assertdispostionOption() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MDNDispatchedTimeAndReliableLowerCaseOption.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), details.get(TxDetailType.SUBJECT.getType()).getDetailValue());
assertEquals("X-DIRECT-FINAL-DESTINATION-DELIVERY", details.get(TxDetailType.DISPOSITION_OPTIONS.getType()).getDetailValue());
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMessageDetails_OptionalInputsTest method testGetMessageDetails_getReportExtension_dispostionOption.
@Test
public void testGetMessageDetails_getReportExtension_dispostionOption() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MDNDispatchedTimeAndReliable.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), details.get(TxDetailType.SUBJECT.getType()).getDetailValue());
assertEquals("X-DIRECT-FINAL-DESTINATION-DELIVERY", details.get(TxDetailType.DISPOSITION_OPTIONS.getType()).getDetailValue());
}
use of org.nhindirect.common.tx.model.TxDetail in project nhin-d by DirectProject.
the class DefaultTxDetailParser_getMimeMessageDetailsTest method testGetMessageDetails_mutlipleFroms.
@Test
public void testGetMessageDetails_mutlipleFroms() throws Exception {
final MimeMessage msg = TestUtils.readMimeMessageFromFile("MessageWithAttachment.txt");
msg.setHeader(MailStandard.Headers.From, "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.From).toLowerCase(Locale.getDefault()), details.get(TxDetailType.FROM.getType()).getDetailValue());
}
Aggregations