use of com.gitblit.service.MailService in project gitblit by gitblit.
the class GitblitAuthority method loadUsers.
private IUserService loadUsers(File folder) {
File file = new File(folder, "gitblit.properties");
if (!file.exists()) {
return null;
}
gitblitSettings = new FileSettings(file.getAbsolutePath());
mail = new MailService(gitblitSettings);
String us = gitblitSettings.getString(Keys.realm.userService, "${baseFolder}/users.conf");
String ext = us.substring(us.lastIndexOf(".") + 1).toLowerCase();
IUserService service = null;
if (!ext.equals("conf") && !ext.equals("properties") && ext.contains("userservice")) {
String realm = ext.substring(0, ext.indexOf("userservice"));
us = gitblitSettings.getString(MessageFormat.format("realm.{0}.backingUserService", realm), "${baseFolder}/users.conf");
}
if (us.endsWith(".conf")) {
service = new ConfigUserService(FileUtils.resolveParameter(Constants.baseFolder$, folder, us));
} else {
throw new RuntimeException("Unsupported user service: " + us);
}
service = new ConfigUserService(FileUtils.resolveParameter(Constants.baseFolder$, folder, us));
return service;
}
use of com.gitblit.service.MailService in project gitblit by gitblit.
the class MailTest method testSendMail.
@Test
public void testSendMail() throws Exception {
FileSettings settings = new FileSettings("mailtest.properties");
MailService mail = new MailService(settings);
Mailing mailing = Mailing.newPlain();
mailing.setRecipients(settings.getStrings(Keys.mail.adminAddresses));
Message message = mail.createMessage(mailing);
message.setSubject("Test");
message.setText("Lägger till andra stycket i ny fil. UTF-8 encoded");
mail.queue(message);
mail.run();
assertTrue("mail queue is not empty!", mail.hasEmptyQueue());
}
Aggregations