summaryrefslogtreecommitdiffstats
path: root/src/test/java/com
diff options
context:
space:
mode:
authorPaul Martin <paul@paulsputer.com>2016-06-18 21:27:05 +0100
committerPaul Martin <paul@paulsputer.com>2016-06-18 21:27:05 +0100
commit7f186f18f5ac1616296fd762570013ef2dd0d1da (patch)
tree405e180eee0e7bcd16d6564d0a9f10a27c19700c /src/test/java/com
parentc2188a840bc4153ae92112b04b2e06a90d3944aa (diff)
downloadgitblit-7f186f18f5ac1616296fd762570013ef2dd0d1da.tar.gz
gitblit-7f186f18f5ac1616296fd762570013ef2dd0d1da.zip
TicketReference Testing #1048
+ Multiple commits in a single push
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/gitblit/tests/TicketReferenceTest.java40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/test/java/com/gitblit/tests/TicketReferenceTest.java b/src/test/java/com/gitblit/tests/TicketReferenceTest.java
index 934659cc..59e00c53 100644
--- a/src/test/java/com/gitblit/tests/TicketReferenceTest.java
+++ b/src/test/java/com/gitblit/tests/TicketReferenceTest.java
@@ -166,7 +166,7 @@ public class TicketReferenceTest extends GitblitUnitTest {
assertNotNull(ticketService.updateTicket(repo, a.number, newComment("comment for 1 - no reference")));
assertNotNull(ticketService.updateTicket(repo, a.number, newComment("comment for # - no reference")));
- assertNotNull(ticketService.updateTicket(repo, a.number, newComment("comment for #42 - ignores invalid reference")));
+ assertNotNull(ticketService.updateTicket(repo, a.number, newComment("comment for #999 - ignores invalid reference")));
a = ticketService.getTicket(repo, a.number);
b = ticketService.getTicket(repo, b.number);
@@ -272,7 +272,7 @@ public class TicketReferenceTest extends GitblitUnitTest {
makeCommit("commit for 1 - no reference");
makeCommit("comment for # - no reference");
- final RevCommit revCommit1 = makeCommit("comment for #42 - ignores invalid reference");
+ final RevCommit revCommit1 = makeCommit("comment for #999 - ignores invalid reference");
final String commit1Sha = revCommit1.name();
assertPushSuccess(commit1Sha, branchName);
@@ -396,7 +396,7 @@ public class TicketReferenceTest extends GitblitUnitTest {
makeCommit("commit for 1 - no reference");
makeCommit("commit for # - no reference");
- final String message = "commit for #42 - ignores invalid reference";
+ final String message = "commit for #999 - ignores invalid reference";
final RevCommit revCommit1 = makeCommit(message);
final String commit1Sha = revCommit1.name();
@@ -587,7 +587,7 @@ public class TicketReferenceTest extends GitblitUnitTest {
makeCommit("commit for 1 - no reference");
makeCommit("commit for # - no reference");
- final String message = "commit for #42 - ignores invalid reference";
+ final String message = "commit for #999 - ignores invalid reference";
final RevCommit revCommit1 = makeCommit(message);
final String commit1Sha = revCommit1.name();
assertPushSuccess(commit1Sha, branchName);
@@ -648,6 +648,38 @@ public class TicketReferenceTest extends GitblitUnitTest {
}
@Test
+ public void commitTicketBranchMultiCommit() throws Exception {
+ setPatchsetAvailable(false);
+ TicketModel a = ticketService.createTicket(repo, newTicket("commitTicketBranchMultiCommit-A"));
+ TicketModel b = ticketService.createTicket(repo, newTicket("commitTicketBranchMultiCommit-B"));
+
+ String branchName = String.format("ticket/%d", a.number);
+ git.checkout().setCreateBranch(true).setName(branchName).call();
+
+ final String message1 = String.format("commit for #%d - patchset multi commit 1", b.number);
+ final RevCommit revCommit1 = makeCommit(message1);
+ final String commit1Sha = revCommit1.name();
+
+ final String message2 = String.format("commit for #%d - patchset multi commit 2", b.number);
+ final RevCommit revCommit2 = makeCommit(message2);
+ final String commit2Sha = revCommit2.name();
+
+ assertPushSuccess(commit2Sha, 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(2, cRefB.size());
+ assertNull(cRefB.get(0).ticketId);
+ assertEquals(commit1Sha, cRefB.get(1).hash);
+ assertEquals(commit2Sha, cRefB.get(0).hash);
+ }
+
+ @Test
public void commitTicketBranchMultiReference() throws Exception {
setPatchsetAvailable(false);
TicketModel a = ticketService.createTicket(repo, newTicket("commitTicketBranchMultiReference-A"));