use of org.nhindirect.nhindclient.impl.NHINDClientImpl in project nhin-d by DirectProject.
the class NHINDClientTest method testClient.
/**
* Quick integration test for the NHINDClient class.
*
* @throws Exception
*/
public void testClient() throws Exception {
String sender = "lewistower1@gmail.com";
// Collection<String> receivers = Arrays.asList("beau+receiver@nologs.org", "beau+receiver2@nologs.org", "http://ELS4055:8080/xd/services/DocumentRepository_Service");
Collection<String> receivers = Arrays.asList("beau+receiver@nologs.org", "beau+receiver2@nologs.org");
DirectMessage message = new DirectMessage(sender, receivers);
message.setSubject("This is a test message (subject)");
message.setBody("Please find the attached data.");
message.setDirectDocuments(getTestDirectDocuments());
NHINDClient client = new NHINDClientImpl(new NHINDClientConfig("gmail-smtp.l.google.com", "lewistower1@gmail.com", "hadron106"));
try {
client.send(message);
} catch (Throwable t) {
Throwable inner = t.getCause();
if (inner != null && inner instanceof MessagingException) {
Throwable nextInner = inner.getCause();
if (nextInner != null && nextInner instanceof ConnectException) {
// if this occurs
return;
}
}
}
message.getDirectDocuments().getSubmissionSet().setIntendedRecipient(Arrays.asList("|beau+document2@nologs.org^Smith^John^^^Dr^^^&1.3.6.1.4.1.21367.3100.1&ISO"));
try {
client.send(message);
} catch (Throwable t) {
Throwable inner = t.getCause();
if (inner != null && inner instanceof MessagingException) {
Throwable nextInner = inner.getCause();
if (nextInner != null && nextInner instanceof ConnectException) {
// if this occurs
return;
}
}
}
}
Aggregations