use of org.gluu.model.SmtpConfiguration in project oxTrust by GluuFederation.
the class SMTPWebResourceTest method updateSmtpServerConfigurationTest.
@Test
public void updateSmtpServerConfigurationTest() {
SmtpConfiguration configuration = getStmp();
HttpPut request = new HttpPut(BASE_URL + ApiConstants.BASE_API_URL + ApiConstants.CONFIGURATION + ApiConstants.SMTP);
try {
String json = mapper.writeValueAsString(configuration);
HttpEntity entity = new ByteArrayEntity(json.toString().getBytes("UTF-8"), ContentType.APPLICATION_FORM_URLENCODED);
request.setEntity(entity);
request.setHeader(CONTENT_TYPE, MediaType.APPLICATION_JSON);
HttpResponse response = handle(request);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
HttpEntity result = response.getEntity();
configuration = mapper.readValue(EntityUtils.toString(result), SmtpConfiguration.class);
Assert.assertNotNull(configuration);
} catch (ParseException | IOException e) {
e.printStackTrace();
Assert.assertTrue(false);
}
}
use of org.gluu.model.SmtpConfiguration in project oxTrust by GluuFederation.
the class SMTPWebResourceTest method getStmp.
private SmtpConfiguration getStmp() {
SmtpConfiguration configuration = new SmtpConfiguration();
configuration.setHost("smtp.gmail.com");
configuration.setPort(587);
configuration.setPassword("XoLsnJdMZ4EQnWaqkvBSBA==");
configuration.setPasswordDecrypted("GluuTestMail");
configuration.setFromEmailAddress("gluutestmail@gmail.com");
configuration.setFromName("Gluu Api");
configuration.setRequiresAuthentication(true);
configuration.setServerTrust(true);
configuration.setRequiresSsl(true);
configuration.setUserName("gluutestmail@gmail.com");
return configuration;
}
Aggregations