Search in sources :

Example 1 with TicketNotifier

use of com.gitblit.tickets.TicketNotifier 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);
}
Also used : TicketNotifier(com.gitblit.tickets.TicketNotifier) Patchset(com.gitblit.models.TicketModel.Patchset) TicketModel(com.gitblit.models.TicketModel) Change(com.gitblit.models.TicketModel.Change) Mailing(com.gitblit.models.Mailing) Test(org.junit.Test)

Aggregations

Mailing (com.gitblit.models.Mailing)1 TicketModel (com.gitblit.models.TicketModel)1 Change (com.gitblit.models.TicketModel.Change)1 Patchset (com.gitblit.models.TicketModel.Patchset)1 TicketNotifier (com.gitblit.tickets.TicketNotifier)1 Test (org.junit.Test)1