Search in sources :

Example 6 with FileSettings

use of com.gitblit.FileSettings 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());
}
Also used : MailService(com.gitblit.service.MailService) Message(javax.mail.Message) FileSettings(com.gitblit.FileSettings) Mailing(com.gitblit.models.Mailing) Test(org.junit.Test)

Aggregations

FileSettings (com.gitblit.FileSettings)6 File (java.io.File)3 MailService (com.gitblit.service.MailService)2 Test (org.junit.Test)2 ConfigUserService (com.gitblit.ConfigUserService)1 IStoredSettings (com.gitblit.IStoredSettings)1 IUserService (com.gitblit.IUserService)1 IAuthenticationManager (com.gitblit.manager.IAuthenticationManager)1 IFederationManager (com.gitblit.manager.IFederationManager)1 IFilestoreManager (com.gitblit.manager.IFilestoreManager)1 IGitblit (com.gitblit.manager.IGitblit)1 INotificationManager (com.gitblit.manager.INotificationManager)1 IPluginManager (com.gitblit.manager.IPluginManager)1 IProjectManager (com.gitblit.manager.IProjectManager)1 IRepositoryManager (com.gitblit.manager.IRepositoryManager)1 IRuntimeManager (com.gitblit.manager.IRuntimeManager)1 IServicesManager (com.gitblit.manager.IServicesManager)1 IUserManager (com.gitblit.manager.IUserManager)1 Mailing (com.gitblit.models.Mailing)1 ITicketService (com.gitblit.tickets.ITicketService)1