use of com.gitblit.models.Mailing in project gitblit by gitblit.
the class TicketServiceTest method testNotifier.
@Test
public void testNotifier() throws Exception {
Change kernel = new Change("james");
kernel.setField(Field.title, "Sample ticket");
kernel.setField(Field.body, "this **is** my sample body\n\n- I hope\n- you really\n- *really* like it");
kernel.setField(Field.status, Status.New);
kernel.setField(Field.type, Type.Proposal);
kernel.comment("this is a sample comment on a kernel change");
Patchset patchset = new Patchset();
patchset.insertions = 100;
patchset.deletions = 10;
patchset.number = 1;
patchset.rev = 25;
patchset.tip = "50f57913f816d04a16b7407134de5d8406421f37";
kernel.patchset = patchset;
TicketModel ticket = service.createTicket(getRepository(), 0L, kernel);
Change merge = new Change("james");
merge.setField(Field.mergeSha, patchset.tip);
merge.setField(Field.mergeTo, "master");
merge.setField(Field.status, Status.Merged);
ticket = service.updateTicket(getRepository(), ticket.number, merge);
ticket.repository = getRepository().name;
TicketNotifier notifier = service.createNotifier();
Mailing mailing = notifier.queueMailing(ticket);
assertNotNull(mailing);
}
use of com.gitblit.models.Mailing 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