Unverified Commit 09ed795b authored by Gautier de Saint Martin Lacaze's avatar Gautier de Saint Martin Lacaze Committed by GitHub
Browse files

Merge pull request #811 from gitlab4j/issue-810

Fix #810 : Change all model Ids to Long
parents 594bc6c2 f237167c
...@@ -70,7 +70,7 @@ public class TestServicesApi extends AbstractIntegrationTest { ...@@ -70,7 +70,7 @@ public class TestServicesApi extends AbstractIntegrationTest {
@Test @Test
public void testProjectIdOrPath() throws GitLabApiException { public void testProjectIdOrPath() throws GitLabApiException {
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
JiraService jiraServiceById = gitLabApi.getServicesApi().getJiraService(projectId); JiraService jiraServiceById = gitLabApi.getServicesApi().getJiraService(projectId);
assertNotNull(jiraServiceById); assertNotNull(jiraServiceById);
JiraService jiraServiceByPath = gitLabApi.getServicesApi().getJiraService(testProject.getPathWithNamespace()); JiraService jiraServiceByPath = gitLabApi.getServicesApi().getJiraService(testProject.getPathWithNamespace());
......
...@@ -39,28 +39,28 @@ public class TestSnippetDiscussionsApi implements Constants { ...@@ -39,28 +39,28 @@ public class TestSnippetDiscussionsApi implements Constants {
@Test @Test
public void testGetSnippetDiscussionsByList() throws Exception { public void testGetSnippetDiscussionsByList() throws Exception {
List<Discussion> discussions = new DiscussionsApi(gitLabApi).getSnippetDiscussions(1, 1); List<Discussion> discussions = new DiscussionsApi(gitLabApi).getSnippetDiscussions(1, 1L);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions, "snippet-discussions.json")); assertTrue(compareJson(discussions, "snippet-discussions.json"));
} }
@Test @Test
public void testGetSnippetDiscussionsByListWithMaxItems() throws Exception { public void testGetSnippetDiscussionsByListWithMaxItems() throws Exception {
List<Discussion> discussions = new DiscussionsApi(gitLabApi).getSnippetDiscussions(1, 1, 20); List<Discussion> discussions = new DiscussionsApi(gitLabApi).getSnippetDiscussions(1, 1L, 20);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions, "snippet-discussions.json")); assertTrue(compareJson(discussions, "snippet-discussions.json"));
} }
@Test @Test
public void testGetSnippetDiscussionsByPager() throws Exception { public void testGetSnippetDiscussionsByPager() throws Exception {
Pager<Discussion> discussions = new DiscussionsApi(gitLabApi).getSnippetDiscussionsPager(1, 1, 20); Pager<Discussion> discussions = new DiscussionsApi(gitLabApi).getSnippetDiscussionsPager(1, 1L, 20);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions.all(), "snippet-discussions.json")); assertTrue(compareJson(discussions.all(), "snippet-discussions.json"));
} }
@Test @Test
public void testGetSnippetDiscussionsByStream() throws Exception { public void testGetSnippetDiscussionsByStream() throws Exception {
Stream<Discussion> stream = new DiscussionsApi(gitLabApi).getSnippetDiscussionsStream(1, 1); Stream<Discussion> stream = new DiscussionsApi(gitLabApi).getSnippetDiscussionsStream(1, 1L);
assertNotNull(stream); assertNotNull(stream);
List<Discussion> discussions = stream.collect(Collectors.toList()); List<Discussion> discussions = stream.collect(Collectors.toList());
assertTrue(compareJson(discussions, "snippet-discussions.json")); assertTrue(compareJson(discussions, "snippet-discussions.json"));
......
...@@ -127,7 +127,7 @@ public class TestTodosApi extends AbstractIntegrationTest { ...@@ -127,7 +127,7 @@ public class TestTodosApi extends AbstractIntegrationTest {
List<Todo> todos = gitLabApi.getTodosApi().getPendingTodos(); List<Todo> todos = gitLabApi.getTodosApi().getPendingTodos();
assertTrue(todos.size() > 0); assertTrue(todos.size() > 0);
Integer foundId = null; Long foundId = null;
for (Todo todo : todos) { for (Todo todo : todos) {
if (todo.isIssueTodo() && ((Issue)todo.getTarget()).getIid().intValue() == issue.getIid()) { if (todo.isIssueTodo() && ((Issue)todo.getTarget()).getIid().intValue() == issue.getIid()) {
foundId = todo.getId(); foundId = todo.getId();
......
...@@ -39,14 +39,14 @@ public class TestUnitMergeRequestApi { ...@@ -39,14 +39,14 @@ public class TestUnitMergeRequestApi {
@Test @Test
public void whenAllArgumentsNull_thenNoAttributesSent() throws Exception { public void whenAllArgumentsNull_thenNoAttributesSent() throws Exception {
new MergeRequestApi(mockGitLabApi).updateMergeRequest(1, 2, null, null, null, null, null, null, new MergeRequestApi(mockGitLabApi).updateMergeRequest(1, 2L, null, null, null, null, null, null,
null, null, null, null, null); null, null, null, null, null);
assertEquals(0, attributeCaptor.getValue().size()); assertEquals(0, attributeCaptor.getValue().size());
} }
@Test @Test
public void falseBooleansAreSerializedCorrectly() throws Exception { public void falseBooleansAreSerializedCorrectly() throws Exception {
new MergeRequestApi(mockGitLabApi).updateMergeRequest(1, 2, null, null, null, null, null, null, new MergeRequestApi(mockGitLabApi).updateMergeRequest(1, 2L, null, null, null, null, null, null,
null, null, null, null, false); null, null, null, null, false);
assertThat(attributeCaptor.getValue(), assertThat(attributeCaptor.getValue(),
hasEntry("allow_collaboration", Collections.singletonList("false"))); hasEntry("allow_collaboration", Collections.singletonList("false")));
...@@ -54,7 +54,7 @@ public class TestUnitMergeRequestApi { ...@@ -54,7 +54,7 @@ public class TestUnitMergeRequestApi {
@Test @Test
public void trueBooleansAreSerializedCorrectly() throws Exception { public void trueBooleansAreSerializedCorrectly() throws Exception {
new MergeRequestApi(mockGitLabApi).updateMergeRequest(1, 2, null, null, null, null, null, null, new MergeRequestApi(mockGitLabApi).updateMergeRequest(1, 2L, null, null, null, null, null, null,
null, null, null, null, true); null, null, null, null, true);
assertThat(attributeCaptor.getValue(), assertThat(attributeCaptor.getValue(),
hasEntry("allow_collaboration", Collections.singletonList("true"))); hasEntry("allow_collaboration", Collections.singletonList("true")));
......
...@@ -298,7 +298,7 @@ public class TestUserApi extends AbstractIntegrationTest { ...@@ -298,7 +298,7 @@ public class TestUserApi extends AbstractIntegrationTest {
User user = gitLabApi.getUserApi().getCurrentUser(); User user = gitLabApi.getUserApi().getCurrentUser();
assertNotNull(user); assertNotNull(user);
assertEquals(TEST_SUDO_AS_USERNAME, user.getUsername()); assertEquals(TEST_SUDO_AS_USERNAME, user.getUsername());
Integer sudoAsId = user.getId(); Long sudoAsId = user.getId();
gitLabApi.sudo(null); gitLabApi.sudo(null);
user = gitLabApi.getUserApi().getCurrentUser(); user = gitLabApi.getUserApi().getCurrentUser();
...@@ -366,7 +366,7 @@ public class TestUserApi extends AbstractIntegrationTest { ...@@ -366,7 +366,7 @@ public class TestUserApi extends AbstractIntegrationTest {
assertEquals(token.getId(), optional.get().getId()); assertEquals(token.getId(), optional.get().getId());
gitLabApi.getUserApi().revokeImpersonationToken(user.getId(), token.getId()); gitLabApi.getUserApi().revokeImpersonationToken(user.getId(), token.getId());
optional = gitLabApi.getUserApi().getOptionalImpersonationToken(user.getId(), 123456); optional = gitLabApi.getUserApi().getOptionalImpersonationToken(user.getId(), 123456L);
assertNotNull(optional); assertNotNull(optional);
assertFalse(optional.isPresent()); assertFalse(optional.isPresent());
...@@ -452,7 +452,7 @@ public class TestUserApi extends AbstractIntegrationTest { ...@@ -452,7 +452,7 @@ public class TestUserApi extends AbstractIntegrationTest {
assertEquals(sshKey.getId(), optional.get().getId()); assertEquals(sshKey.getId(), optional.get().getId());
gitLabApi.getUserApi().deleteSshKey(sshKey.getId()); gitLabApi.getUserApi().deleteSshKey(sshKey.getId());
optional = gitLabApi.getUserApi().getOptionalSshKey(12345); optional = gitLabApi.getUserApi().getOptionalSshKey(12345L);
assertNotNull(optional); assertNotNull(optional);
assertFalse(optional.isPresent()); assertFalse(optional.isPresent());
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), GitLabApi.getOptionalException(optional).getHttpStatus()); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), GitLabApi.getOptionalException(optional).getHttpStatus());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment