use of javax.mail.internet.InternetHeaders in project nhin-d by DirectProject.
the class NotificationTest method testFinalRecip_AssertFinalRecip.
public void testFinalRecip_AssertFinalRecip() throws Exception {
Notification noti = new Notification(NotificationType.Processed);
MimeMultipart mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
BodyPart part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
InternetHeaders headers = noti.getNotificationFieldsAsHeaders();
assertNull(headers.getHeader(MDNStandard.Headers.FinalRecipient));
// set a new gateway
noti.setFinalRecipient("Test Final Recip");
mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
headers = noti.getNotificationFieldsAsHeaders();
assertNotNull(headers.getHeader(MDNStandard.Headers.FinalRecipient));
assertEquals("rfc822; Test Final Recip", headers.getHeader(MDNStandard.Headers.FinalRecipient, ","));
assertEquals(headers.getHeader(MDNStandard.Headers.FinalRecipient, ","), "rfc822; " + noti.getFinalRecipeint());
}
use of javax.mail.internet.InternetHeaders in project nhin-d by DirectProject.
the class NotificationTest method testSetUserAgent_AssertUseragent.
public void testSetUserAgent_AssertUseragent() throws Exception {
Notification noti = new Notification(NotificationType.Processed);
MimeMultipart mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
BodyPart part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
InternetHeaders headers = noti.getNotificationFieldsAsHeaders();
assertNull(headers.getHeader(MDNStandard.Headers.ReportingAgent));
// set a new UA
noti.setReportingAgent(new ReportingUserAgent("Junit Agent Name", "Junit Product Name"));
mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
headers = noti.getNotificationFieldsAsHeaders();
assertNotNull(headers.getHeader(MDNStandard.Headers.ReportingAgent));
assertEquals("Junit Agent Name; Junit Product Name", headers.getHeader(MDNStandard.Headers.ReportingAgent, ","));
assertEquals(headers.getHeader(MDNStandard.Headers.ReportingAgent, ","), noti.getReportingAgent().toString());
}
use of javax.mail.internet.InternetHeaders in project nhin-d by DirectProject.
the class NotificationTest method testExtensions_AssertExtensions.
public void testExtensions_AssertExtensions() throws Exception {
Notification noti = new Notification(NotificationType.Processed);
MimeMultipart mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
BodyPart part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
InternetHeaders headers = noti.getNotificationFieldsAsHeaders();
assertNull(headers.getHeader(MDNStandard.Headers.FinalRecipient));
// set a new gateway
noti.setExtensions(Arrays.asList("X-TEST1", "X-TEST2:value"));
mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
headers = noti.getNotificationFieldsAsHeaders();
assertNotNull(headers.getHeader("X-TEST1"));
assertEquals("", headers.getHeader("X-TEST1", ","));
assertNotNull(headers.getHeader("X-TEST2"));
assertEquals("value", headers.getHeader("X-TEST2", ","));
}
use of javax.mail.internet.InternetHeaders in project nhin-d by DirectProject.
the class NotificationTest method testFailure_AssertFailure.
public void testFailure_AssertFailure() throws Exception {
Notification noti = new Notification(NotificationType.Processed);
MimeMultipart mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
BodyPart part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
InternetHeaders headers = noti.getNotificationFieldsAsHeaders();
assertNull(headers.getHeader(MDNStandard.Headers.FinalRecipient));
// set a new gateway
noti.setFailure("junit failure");
mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
headers = noti.getNotificationFieldsAsHeaders();
assertNotNull(headers.getHeader(MDNStandard.Headers.Failure));
assertEquals("junit failure", headers.getHeader(MDNStandard.Headers.Failure, ","));
}
use of javax.mail.internet.InternetHeaders in project nhin-d by DirectProject.
the class NotificationTest method testGateway_AssertGateway.
public void testGateway_AssertGateway() throws Exception {
Notification noti = new Notification(NotificationType.Processed);
MimeMultipart mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
BodyPart part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
InternetHeaders headers = noti.getNotificationFieldsAsHeaders();
assertNull(headers.getHeader(MDNStandard.Headers.Gateway));
// set a new gateway
noti.setGateway(new MdnGateway("Junit domain", "Junit type"));
mm = noti.getAsMultipart();
assertNotNull(mm);
assertEquals(2, mm.getCount());
part = mm.getBodyPart(1);
assertTrue(part.getContentType().startsWith("message/disposition-notification"));
headers = noti.getNotificationFieldsAsHeaders();
assertNotNull(headers.getHeader(MDNStandard.Headers.Gateway));
assertEquals("Junit type; Junit domain", headers.getHeader(MDNStandard.Headers.Gateway, ","));
assertEquals(headers.getHeader(MDNStandard.Headers.Gateway, ","), noti.getGateway().toString());
}
Aggregations