Package com.gitblit.models

Examples of com.gitblit.models.TicketModel$Change


      String updatedBy, String comment) {
    Change revision = new Change(updatedBy);
    revision.comment(comment);
    revision.comment.id = commentId;
    RepositoryModel repository = repositoryManager.getRepositoryModel(ticket.repository);
    TicketModel revisedTicket = updateTicket(repository, ticket.number, revision);
    return revisedTicket;
  }
View Full Code Here


    Change deletion = new Change(deletedBy);
    deletion.comment("");
    deletion.comment.id = commentId;
    deletion.comment.deleted = true;
    RepositoryModel repository = repositoryManager.getRepositoryModel(ticket.repository);
    TicketModel revisedTicket = updateTicket(repository, ticket.number, deletion);
    return revisedTicket;
  }
View Full Code Here

  }

  @Test
  public void testLifecycle() throws Exception {
    // query non-existent ticket
    TicketModel nonExistent = service.getTicket(getRepository(), 0);
    assertNull(nonExistent);

    // create and insert a ticket
    Change c1 = newChange("testCreation() " + Long.toHexString(System.currentTimeMillis()));
    TicketModel ticket = service.createTicket(getRepository(), c1);
    assertTrue(ticket.number > 0);

    // retrieve ticket and compare
    TicketModel constructed = service.getTicket(getRepository(), ticket.number);
    compare(ticket, constructed);

    assertEquals(1, constructed.changes.size());

    // C1: create the ticket
    int changeCount = 0;
    c1 = newChange("testUpdates() " + Long.toHexString(System.currentTimeMillis()));
    ticket = service.createTicket(getRepository(), c1);
    assertTrue(ticket.number > 0);
    changeCount++;

    constructed = service.getTicket(getRepository(), ticket.number);
    compare(ticket, constructed);
    assertEquals(1, constructed.changes.size());

    // C2: set owner
    Change c2 = new Change("C2");
    c2.comment("I'll fix this");
    c2.setField(Field.responsible, c2.author);
    constructed = service.updateTicket(getRepository(), ticket.number, c2);
    assertNotNull(constructed);
    assertEquals(2, constructed.changes.size());
    assertEquals(c2.author, constructed.responsible);
    changeCount++;

    // C3: add a note
    Change c3 = new Change("C3");
    c3.comment("yeah, this is working");
    constructed = service.updateTicket(getRepository(), ticket.number, c3);
    assertNotNull(constructed);
    assertEquals(3, constructed.changes.size());
    changeCount++;

    if (service.supportsAttachments()) {
      // C4: add attachment
      Change c4 = new Change("C4");
      Attachment a = newAttachment();
      c4.addAttachment(a);
      constructed = service.updateTicket(getRepository(), ticket.number, c4);
      assertNotNull(constructed);
      assertTrue(constructed.hasAttachments());
      Attachment a1 = service.getAttachment(getRepository(), ticket.number, a.name);
      assertEquals(a.content.length, a1.content.length);
      assertTrue(Arrays.areEqual(a.content, a1.content));
      changeCount++;
    }

    // C5: close the issue
    Change c5 = new Change("C5");
    c5.comment("closing issue");
    c5.setField(Field.status, Status.Resolved);
    constructed = service.updateTicket(getRepository(), ticket.number, c5);
    assertNotNull(constructed);
    changeCount++;
    assertTrue(constructed.isClosed());
    assertEquals(changeCount, constructed.changes.size());

    List<TicketModel> allTickets = service.getTickets(getRepository());
    List<TicketModel> openTickets = service.getTickets(getRepository(), new TicketFilter() {
      @Override
View Full Code Here

  @Test
  public void testChangeComment() throws Exception {
    // C1: create the ticket
    Change c1 = newChange("testChangeComment() " + Long.toHexString(System.currentTimeMillis()));
    TicketModel ticket = service.createTicket(getRepository(), c1);
    assertTrue(ticket.number > 0);
    assertTrue(ticket.changes.get(0).hasComment());

    ticket = service.updateComment(ticket, c1.comment.id, "E1", "I changed the comment");
    assertNotNull(ticket);
View Full Code Here

  @Test
  public void testDeleteComment() throws Exception {
    // C1: create the ticket
    Change c1 = newChange("testDeleteComment() " + Long.toHexString(System.currentTimeMillis()));
    TicketModel ticket = service.createTicket(getRepository(), c1);
    assertTrue(ticket.number > 0);
    assertTrue(ticket.changes.get(0).hasComment());

    ticket = service.deleteComment(ticket, c1.comment.id, "D1");
    assertNotNull(ticket);
View Full Code Here

    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);
View Full Code Here

          newComment.comment(txt);
          if (!ticket.isWatching(user.username)) {
            newComment.watch(user.username);
          }
          RepositoryModel repository = app().repositories().getRepositoryModel(ticket.repository);
          TicketModel updatedTicket = app().tickets().updateTicket(repository, ticket.number, newComment);
          if (updatedTicket != null) {
            app().tickets().createNotifier().sendMailing(updatedTicket);
            setResponsePage(pageClass, WicketUtils.newObjectParameter(updatedTicket.repository, "" + ticket.number));
          } else {
            error("Failed to add comment!");
View Full Code Here

TOP

Related Classes of com.gitblit.models.TicketModel$Change

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.