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());
}
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());
}
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());
}
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);
}
Aggregations