use of org.apache.mailet.base.mail.MimeMultipartReport in project nhin-d by DirectProject.
the class MDNFactory_createTest method testCreate_withFailure.
public void testCreate_withFailure() throws Exception {
final Disposition disp = new Disposition(NotificationType.Processed);
final MdnGateway gateway = new MdnGateway("junitGateway");
MimeMultipartReport report = MDNFactory.create("test", "junitUA", "junitProduct", "sender@send.com", "final@final.com", "12345", "", gateway, disp, "", "junit failure", new ArrayList<String>());
assertNotNull(report);
final InternetHeaders headers = getNotificationFieldsAsHeaders(report);
assertEquals("junit failure", headers.getHeader("Failure", ","));
}
use of org.apache.mailet.base.mail.MimeMultipartReport in project nhin-d by DirectProject.
the class MDNFactory_createTest method testCreate_withWarning.
public void testCreate_withWarning() throws Exception {
final Disposition disp = new Disposition(NotificationType.Processed);
final MdnGateway gateway = new MdnGateway("junitGateway");
MimeMultipartReport report = MDNFactory.create("test", "junitUA", "junitProduct", "sender@send.com", "final@final.com", "12345", "", gateway, disp, "junit warning", "", new ArrayList<String>());
assertNotNull(report);
final InternetHeaders headers = getNotificationFieldsAsHeaders(report);
assertEquals("junit warning", headers.getHeader("Warning", ","));
}
use of org.apache.mailet.base.mail.MimeMultipartReport in project nhin-d by DirectProject.
the class MDNFactory_createTest method testCreate_withExtensionNameWithValue.
public void testCreate_withExtensionNameWithValue() throws Exception {
final Disposition disp = new Disposition(NotificationType.Processed);
final MdnGateway gateway = new MdnGateway("junitGateway");
MimeMultipartReport report = MDNFactory.create("test", "junitUA", "junitProduct", "sender@send.com", "final@final.com", "12345", "", gateway, disp, "", "junit failure", Arrays.asList("X-EXTENSION:junit value"));
assertNotNull(report);
final InternetHeaders headers = getNotificationFieldsAsHeaders(report);
assertEquals("junit value", headers.getHeader("X-EXTENSION", ","));
}
use of org.apache.mailet.base.mail.MimeMultipartReport in project nhin-d by DirectProject.
the class MDNFactory_createTest method testCreate_withError_oldConstructor.
public void testCreate_withError_oldConstructor() throws Exception {
final Disposition disp = new Disposition(NotificationType.Processed);
final MdnGateway gateway = new MdnGateway("junitGateway");
MimeMultipartReport report = MDNFactory.create("test", "junitUA", "junitProduct", "sender@send.com", "final@final.com", "12345", "junit error", gateway, disp);
assertNotNull(report);
final InternetHeaders headers = getNotificationFieldsAsHeaders(report);
assertEquals("junit error", headers.getHeader("Error", ","));
}
use of org.apache.mailet.base.mail.MimeMultipartReport in project nhin-d by DirectProject.
the class MDNFactory_createTest method testCreate_withGernalAttributes.
public void testCreate_withGernalAttributes() throws Exception {
final Disposition disp = new Disposition(NotificationType.Processed);
final MdnGateway gateway = new MdnGateway("junitGateway");
MimeMultipartReport report = MDNFactory.create("test", "junitUA", "junitProduct", "sender@send.com", "final@final.com", "12345", "junit error", gateway, disp, "", "", new ArrayList<String>());
assertNotNull(report);
final InternetHeaders headers = getNotificationFieldsAsHeaders(report);
assertTrue(headers.getHeader(MDNStandard.Headers.ReportingAgent, ",").startsWith("junitUA"));
assertTrue(headers.getHeader(MDNStandard.Headers.ReportingAgent, ",").endsWith("junitProduct"));
assertEquals("rfc822; sender@send.com", headers.getHeader(MDNStandard.Headers.OriginalRecipeint, ","));
assertEquals("rfc822; final@final.com", headers.getHeader(MDNStandard.Headers.FinalRecipient, ","));
assertTrue(headers.getHeader(MDNStandard.Headers.Gateway, ",").endsWith("junitGateway"));
assertTrue(headers.getHeader(MDNStandard.Headers.Disposition, ",").endsWith(NotificationType.Processed.toString()));
BodyPart part0 = report.getBodyPart(0);
Object obj = part0.getContent();
assertEquals("test", obj);
}
Aggregations