Skip to content

Commit 2863c78

Browse files
rkpatel7timols
authored andcommitted
Get commits for merge request (timols#361)
* Update getCommits for merge requests to use the correct gitlab API endpoint; closes timols#259 * Fix failing unit tests * use openjdk8 instead of oraclejdk8 in travis config
1 parent 84f1706 commit 2863c78

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ sudo: required
33
services:
44
- docker
55
jdk:
6-
- oraclejdk8
6+
- openjdk8
77
install:
88
- ./mvnw -B -q -Pdocker-gitlab dependency:go-offline verify -DskipTests -Ddocker.skip
99
script:

src/main/java/org/gitlab/api/GitlabAPI.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,13 +2125,9 @@ public List<GitlabCommit> getCommits(GitlabMergeRequest mergeRequest, Pagination
21252125
projectId = mergeRequest.getProjectId();
21262126
}
21272127

2128-
Query query = new Query()
2129-
.append("ref_name", mergeRequest.getSourceBranch());
2130-
2131-
query.mergeWith(pagination.asQuery());
2132-
21332128
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) +
2134-
"/repository" + GitlabCommit.URL + query.toString();
2129+
GitlabMergeRequest.URL + "/" + mergeRequest.getIid() +
2130+
GitlabCommit.URL + pagination.toString();
21352131

21362132
GitlabCommit[] commits = retrieve().to(tailUrl, GitlabCommit[].class);
21372133
return Arrays.asList(commits);

src/test/java/org/gitlab/api/GitlabAPIUT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.junit.jupiter.api.Test;
55

66
import java.io.IOException;
7+
import java.net.NoRouteToHostException;
78
import java.net.ServerSocket;
89
import java.net.SocketTimeoutException;
910

@@ -23,8 +24,8 @@ public class GitlabAPIUT {
2324
public void unitTest_20180503175711() {
2425
GitlabAPI api = GitlabAPI.connect("http://172.16.0.0:80", "test");
2526
api.setConnectionTimeout(100);
26-
Throwable exception = assertThrows(SocketTimeoutException.class, api::getVersion);
27-
assertThat(exception.getMessage(), is("connect timed out"));
27+
Throwable exception = assertThrows(NoRouteToHostException.class, api::getVersion);
28+
assertThat(exception.getMessage(), is("No route to host"));
2829
}
2930

3031
@Test

src/test/java/org/gitlab/api/InstantDeserializerTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import java.io.IOException;
99
import java.time.*;
10+
import java.util.concurrent.TimeUnit;
1011

1112
import static org.junit.jupiter.api.Assertions.*;
1213

@@ -24,7 +25,7 @@ void deserialize() throws IOException {
2425
assertEquals(Instant.from(
2526
ZonedDateTime.of(
2627
LocalDate.of(2016, 8, 11),
27-
LocalTime.of(11, 28, 34, 85),
28+
LocalTime.of(11, 28, 34, (int) TimeUnit.MILLISECONDS.toNanos(85)),
2829
ZoneOffset.UTC
2930
)
3031
), instant);

0 commit comments

Comments
 (0)