use of com.gitblit.models.TicketModel in project gitblit by gitblit.
the class TicketReferenceTest method commitPatchsetNoSelfReference.
@Test
public void commitPatchsetNoSelfReference() throws Exception {
setPatchsetAvailable(true);
TicketModel a = ticketService.createTicket(repo, newTicket("commitPatchsetNoSelfReference-A"));
String branchName = String.format("ticket/%d", a.number);
git.checkout().setCreateBranch(true).setName(branchName).call();
final String message = String.format("commit for #%d - patchset self reference", a.number);
final RevCommit revCommit1 = makeCommit(message);
final String commit1Sha = revCommit1.name();
assertPushSuccess(commit1Sha, branchName);
a = ticketService.getTicket(repo, a.number);
assertFalse(a.hasReferences());
}
use of com.gitblit.models.TicketModel in project gitblit by gitblit.
the class TicketReferenceTest method commitMasterNoUnexpectedReference.
@Test
public void commitMasterNoUnexpectedReference() throws Exception {
TicketModel a = ticketService.createTicket(repo, newTicket("commentMultiReference-A"));
final String branchName = "master";
git.checkout().setCreateBranch(false).setName(branchName).call();
makeCommit("commit for 1 - no reference");
makeCommit("comment for # - no reference");
final RevCommit revCommit1 = makeCommit("comment for #999 - ignores invalid reference");
final String commit1Sha = revCommit1.name();
assertPushSuccess(commit1Sha, branchName);
a = ticketService.getTicket(repo, a.number);
assertFalse(a.hasReferences());
}
use of com.gitblit.models.TicketModel in project gitblit by gitblit.
the class TicketReferenceTest method commitMasterSingleReference.
@Test
public void commitMasterSingleReference() throws Exception {
TicketModel a = ticketService.createTicket(repo, newTicket("commitMasterSingleReference-A"));
final String branchName = "master";
git.checkout().setCreateBranch(false).setName(branchName).call();
final String message = String.format("commit for #%d - single reference", a.number);
final RevCommit revCommit1 = makeCommit(message);
final String commit1Sha = revCommit1.name();
assertPushSuccess(commit1Sha, branchName);
a = ticketService.getTicket(repo, a.number);
assertTrue(a.hasReferences());
List<Reference> cRefA = a.getReferences();
assertNotNull(cRefA);
assertEquals(1, cRefA.size());
assertNull(cRefA.get(0).ticketId);
assertEquals(commit1Sha, cRefA.get(0).hash);
}
use of com.gitblit.models.TicketModel in project gitblit by gitblit.
the class TicketReferenceTest method commentMultiReference.
@Test
public void commentMultiReference() throws Exception {
TicketModel a = ticketService.createTicket(repo, newTicket("commentMultiReference-A"));
TicketModel b = ticketService.createTicket(repo, newTicket("commentMultiReference-B"));
TicketModel c = ticketService.createTicket(repo, newTicket("commentMultiReference-C"));
final Change comment = newComment(String.format("comment for #%d and #%d - multi reference", b.number, c.number));
assertNotNull(ticketService.updateTicket(repo, a.number, comment));
a = ticketService.getTicket(repo, a.number);
b = ticketService.getTicket(repo, b.number);
c = ticketService.getTicket(repo, c.number);
assertFalse(a.hasReferences());
assertTrue(b.hasReferences());
assertTrue(c.hasReferences());
List<Reference> cRefB = b.getReferences();
assertNotNull(cRefB);
assertEquals(1, cRefB.size());
assertEquals(a.number, cRefB.get(0).ticketId.longValue());
assertEquals(comment.comment.id, cRefB.get(0).hash);
List<Reference> cRefC = c.getReferences();
assertNotNull(cRefC);
assertEquals(1, cRefC.size());
assertEquals(a.number, cRefC.get(0).ticketId.longValue());
assertEquals(comment.comment.id, cRefC.get(0).hash);
}
use of com.gitblit.models.TicketModel in project gitblit by gitblit.
the class TicketReferenceTest method commitPatchsetSingleReference.
@Test
public void commitPatchsetSingleReference() throws Exception {
setPatchsetAvailable(true);
TicketModel a = ticketService.createTicket(repo, newTicket("commitPatchsetSingleReference-A"));
TicketModel b = ticketService.createTicket(repo, newTicket("commitPatchsetSingleReference-B"));
String branchName = String.format("ticket/%d", a.number);
git.checkout().setCreateBranch(true).setName(branchName).call();
final String message = String.format("commit for #%d - patchset single reference", b.number);
final RevCommit revCommit1 = makeCommit(message);
final String commit1Sha = revCommit1.name();
assertPushSuccess(commit1Sha, branchName);
a = ticketService.getTicket(repo, a.number);
b = ticketService.getTicket(repo, b.number);
assertFalse(a.hasReferences());
assertTrue(b.hasReferences());
List<Reference> cRefB = b.getReferences();
assertNotNull(cRefB);
assertEquals(1, cRefB.size());
assertNull(cRefB.get(0).ticketId);
assertEquals(commit1Sha, cRefB.get(0).hash);
}
Aggregations