Search in sources :

Example 6 with IncomingMessage

use of org.nhindirect.stagent.IncomingMessage in project nhin-d by DirectProject.

the class NotificationProducerTest method testProduce_MessageIsMDN_AssertEmptyList.

public void testProduce_MessageIsMDN_AssertEmptyList() throws Exception {
    NotificationSettings setting = new NotificationSettings(true, "", "");
    NotificationProducer prod = new NotificationProducer(setting);
    IncomingMessage msg = getMessageFromFile("MDNMessage.txt", Arrays.asList("cerner.com"));
    Collection<NotificationMessage> notes = prod.produce(msg);
    assertNotNull(notes);
    assertEquals(0, notes.size());
}
Also used : NotificationMessage(org.nhindirect.stagent.mail.notifications.NotificationMessage) IncomingMessage(org.nhindirect.stagent.IncomingMessage)

Example 7 with IncomingMessage

use of org.nhindirect.stagent.IncomingMessage in project nhin-d by DirectProject.

the class NotificationProducerTest method testProduceMDN_MultipleRecipients_SingleDomain_AssertOneMDN.

public void testProduceMDN_MultipleRecipients_SingleDomain_AssertOneMDN() throws Exception {
    NotificationSettings setting = new NotificationSettings(true, "", "");
    NotificationProducer prod = new NotificationProducer(setting);
    IncomingMessage msg = getMessageFromFile("MultipleRecipientsIncomingMessage.txt", Arrays.asList("cerner.com"));
    Collection<NotificationMessage> notes = prod.produce(msg);
    assertNotNull(notes);
    assertEquals(1, notes.size());
    NotificationMessage noteMsg = notes.iterator().next();
    assertEquals(msg.getDomainRecipients().get(0).toString(), noteMsg.getFrom()[0].toString());
}
Also used : NotificationMessage(org.nhindirect.stagent.mail.notifications.NotificationMessage) IncomingMessage(org.nhindirect.stagent.IncomingMessage)

Example 8 with IncomingMessage

use of org.nhindirect.stagent.IncomingMessage in project nhin-d by DirectProject.

the class NotificationProducerTest method testProduceSingleMDN.

public void testProduceSingleMDN() throws Exception {
    NotificationSettings setting = new NotificationSettings(true, "", "");
    NotificationProducer prod = new NotificationProducer(setting);
    IncomingMessage msg = getMessageFromFile("PlainIncomingMessage.txt", Arrays.asList("cerner.com"));
    Collection<NotificationMessage> notes = prod.produce(msg);
    assertNotNull(notes);
    assertEquals(1, notes.size());
    NotificationMessage noteMsg = notes.iterator().next();
    assertEquals(msg.getDomainRecipients().get(0).toString(), noteMsg.getFrom()[0].toString());
}
Also used : NotificationMessage(org.nhindirect.stagent.mail.notifications.NotificationMessage) IncomingMessage(org.nhindirect.stagent.IncomingMessage)

Example 9 with IncomingMessage

use of org.nhindirect.stagent.IncomingMessage in project nhin-d by DirectProject.

the class TrustModel_findTrustedSignatureTest method setUp.

@Override
public void setUp() throws Exception {
    CryptoExtensions.registerJCEProviders();
    // load sigCert A
    sigUser1 = TestUtils.getInternalCert("user1");
    // load sigCert A private certificate
    sigUser1CA = TestUtils.getInternalCACert("cacert");
    // load other anchor
    otherCert = TestUtils.loadCertificate("gm2552.der");
    // load the message that will be encrypted
    String testMessage = TestUtils.readResource("MultipartMimeMessage.txt");
    cryptographer = new SMIMECryptographerImpl();
    inMessage = new IncomingMessage(new Message(new ByteArrayInputStream(testMessage.getBytes())));
    signedEntity = cryptographer.sign(inMessage.getMessage(), sigUser1);
    CMSSignedData signatures = cryptographer.deserializeSignatureEnvelope(signedEntity);
    inMessage.setSignature(signatures);
}
Also used : Message(org.nhindirect.stagent.mail.Message) IncomingMessage(org.nhindirect.stagent.IncomingMessage) SMIMECryptographerImpl(org.nhindirect.stagent.cryptography.SMIMECryptographerImpl) IncomingMessage(org.nhindirect.stagent.IncomingMessage) ByteArrayInputStream(java.io.ByteArrayInputStream) CMSSignedData(org.bouncycastle.cms.CMSSignedData)

Aggregations

IncomingMessage (org.nhindirect.stagent.IncomingMessage)9 NotificationMessage (org.nhindirect.stagent.mail.notifications.NotificationMessage)7 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 MessagingException (javax.mail.MessagingException)1 CMSSignedData (org.bouncycastle.cms.CMSSignedData)1 AuditContext (org.nhindirect.common.audit.AuditContext)1 AuditEvent (org.nhindirect.common.audit.AuditEvent)1 DefaultAuditContext (org.nhindirect.common.audit.DefaultAuditContext)1 AgentException (org.nhindirect.stagent.AgentException)1 MockNHINDAgent (org.nhindirect.stagent.MockNHINDAgent)1 NHINDAddress (org.nhindirect.stagent.NHINDAddress)1 NHINDException (org.nhindirect.stagent.NHINDException)1 SMIMECryptographerImpl (org.nhindirect.stagent.cryptography.SMIMECryptographerImpl)1 Message (org.nhindirect.stagent.mail.Message)1