Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
f237167c
Unverified
Commit
f237167c
authored
Mar 07, 2022
by
Gautier de Saint Martin Lacaze
Browse files
Fix #810 : Change all model Ids to Long
parent
bdc1f6d3
Changes
145
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestServicesApi.java
View file @
f237167c
...
...
@@ -70,7 +70,7 @@ public class TestServicesApi extends AbstractIntegrationTest {
@Test
public
void
testProjectIdOrPath
()
throws
GitLabApiException
{
Integer
projectId
=
testProject
.
getId
();
Long
projectId
=
testProject
.
getId
();
JiraService
jiraServiceById
=
gitLabApi
.
getServicesApi
().
getJiraService
(
projectId
);
assertNotNull
(
jiraServiceById
);
JiraService
jiraServiceByPath
=
gitLabApi
.
getServicesApi
().
getJiraService
(
testProject
.
getPathWithNamespace
());
...
...
src/test/java/org/gitlab4j/api/TestSnippetDiscussionsApi.java
View file @
f237167c
...
...
@@ -39,28 +39,28 @@ public class TestSnippetDiscussionsApi implements Constants {
@Test
public
void
testGetSnippetDiscussionsByList
()
throws
Exception
{
List
<
Discussion
>
discussions
=
new
DiscussionsApi
(
gitLabApi
).
getSnippetDiscussions
(
1
,
1
);
List
<
Discussion
>
discussions
=
new
DiscussionsApi
(
gitLabApi
).
getSnippetDiscussions
(
1
,
1
L
);
assertNotNull
(
discussions
);
assertTrue
(
compareJson
(
discussions
,
"snippet-discussions.json"
));
}
@Test
public
void
testGetSnippetDiscussionsByListWithMaxItems
()
throws
Exception
{
List
<
Discussion
>
discussions
=
new
DiscussionsApi
(
gitLabApi
).
getSnippetDiscussions
(
1
,
1
,
20
);
List
<
Discussion
>
discussions
=
new
DiscussionsApi
(
gitLabApi
).
getSnippetDiscussions
(
1
,
1
L
,
20
);
assertNotNull
(
discussions
);
assertTrue
(
compareJson
(
discussions
,
"snippet-discussions.json"
));
}
@Test
public
void
testGetSnippetDiscussionsByPager
()
throws
Exception
{
Pager
<
Discussion
>
discussions
=
new
DiscussionsApi
(
gitLabApi
).
getSnippetDiscussionsPager
(
1
,
1
,
20
);
Pager
<
Discussion
>
discussions
=
new
DiscussionsApi
(
gitLabApi
).
getSnippetDiscussionsPager
(
1
,
1
L
,
20
);
assertNotNull
(
discussions
);
assertTrue
(
compareJson
(
discussions
.
all
(),
"snippet-discussions.json"
));
}
@Test
public
void
testGetSnippetDiscussionsByStream
()
throws
Exception
{
Stream
<
Discussion
>
stream
=
new
DiscussionsApi
(
gitLabApi
).
getSnippetDiscussionsStream
(
1
,
1
);
Stream
<
Discussion
>
stream
=
new
DiscussionsApi
(
gitLabApi
).
getSnippetDiscussionsStream
(
1
,
1
L
);
assertNotNull
(
stream
);
List
<
Discussion
>
discussions
=
stream
.
collect
(
Collectors
.
toList
());
assertTrue
(
compareJson
(
discussions
,
"snippet-discussions.json"
));
...
...
src/test/java/org/gitlab4j/api/TestTodosApi.java
View file @
f237167c
...
...
@@ -127,7 +127,7 @@ public class TestTodosApi extends AbstractIntegrationTest {
List
<
Todo
>
todos
=
gitLabApi
.
getTodosApi
().
getPendingTodos
();
assertTrue
(
todos
.
size
()
>
0
);
Integer
foundId
=
null
;
Long
foundId
=
null
;
for
(
Todo
todo
:
todos
)
{
if
(
todo
.
isIssueTodo
()
&&
((
Issue
)
todo
.
getTarget
()).
getIid
().
intValue
()
==
issue
.
getIid
())
{
foundId
=
todo
.
getId
();
...
...
src/test/java/org/gitlab4j/api/TestUnitMergeRequestApi.java
View file @
f237167c
...
...
@@ -39,14 +39,14 @@ public class TestUnitMergeRequestApi {
@Test
public
void
whenAllArgumentsNull_thenNoAttributesSent
()
throws
Exception
{
new
MergeRequestApi
(
mockGitLabApi
).
updateMergeRequest
(
1
,
2
,
null
,
null
,
null
,
null
,
null
,
null
,
new
MergeRequestApi
(
mockGitLabApi
).
updateMergeRequest
(
1
,
2
L
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
);
assertEquals
(
0
,
attributeCaptor
.
getValue
().
size
());
}
@Test
public
void
falseBooleansAreSerializedCorrectly
()
throws
Exception
{
new
MergeRequestApi
(
mockGitLabApi
).
updateMergeRequest
(
1
,
2
,
null
,
null
,
null
,
null
,
null
,
null
,
new
MergeRequestApi
(
mockGitLabApi
).
updateMergeRequest
(
1
,
2
L
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
false
);
assertThat
(
attributeCaptor
.
getValue
(),
hasEntry
(
"allow_collaboration"
,
Collections
.
singletonList
(
"false"
)));
...
...
@@ -54,7 +54,7 @@ public class TestUnitMergeRequestApi {
@Test
public
void
trueBooleansAreSerializedCorrectly
()
throws
Exception
{
new
MergeRequestApi
(
mockGitLabApi
).
updateMergeRequest
(
1
,
2
,
null
,
null
,
null
,
null
,
null
,
null
,
new
MergeRequestApi
(
mockGitLabApi
).
updateMergeRequest
(
1
,
2
L
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
null
,
true
);
assertThat
(
attributeCaptor
.
getValue
(),
hasEntry
(
"allow_collaboration"
,
Collections
.
singletonList
(
"true"
)));
...
...
src/test/java/org/gitlab4j/api/TestUserApi.java
View file @
f237167c
...
...
@@ -298,7 +298,7 @@ public class TestUserApi extends AbstractIntegrationTest {
User
user
=
gitLabApi
.
getUserApi
().
getCurrentUser
();
assertNotNull
(
user
);
assertEquals
(
TEST_SUDO_AS_USERNAME
,
user
.
getUsername
());
Integer
sudoAsId
=
user
.
getId
();
Long
sudoAsId
=
user
.
getId
();
gitLabApi
.
sudo
(
null
);
user
=
gitLabApi
.
getUserApi
().
getCurrentUser
();
...
...
@@ -366,7 +366,7 @@ public class TestUserApi extends AbstractIntegrationTest {
assertEquals
(
token
.
getId
(),
optional
.
get
().
getId
());
gitLabApi
.
getUserApi
().
revokeImpersonationToken
(
user
.
getId
(),
token
.
getId
());
optional
=
gitLabApi
.
getUserApi
().
getOptionalImpersonationToken
(
user
.
getId
(),
123456
);
optional
=
gitLabApi
.
getUserApi
().
getOptionalImpersonationToken
(
user
.
getId
(),
123456
L
);
assertNotNull
(
optional
);
assertFalse
(
optional
.
isPresent
());
...
...
@@ -452,7 +452,7 @@ public class TestUserApi extends AbstractIntegrationTest {
assertEquals
(
sshKey
.
getId
(),
optional
.
get
().
getId
());
gitLabApi
.
getUserApi
().
deleteSshKey
(
sshKey
.
getId
());
optional
=
gitLabApi
.
getUserApi
().
getOptionalSshKey
(
12345
);
optional
=
gitLabApi
.
getUserApi
().
getOptionalSshKey
(
12345
L
);
assertNotNull
(
optional
);
assertFalse
(
optional
.
isPresent
());
assertEquals
(
Response
.
Status
.
NOT_FOUND
.
getStatusCode
(),
GitLabApi
.
getOptionalException
(
optional
).
getHttpStatus
());
...
...
Prev
1
…
4
5
6
7
8
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment