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
97d63f17
Commit
97d63f17
authored
Sep 17, 2017
by
Greg Messner
Browse files
Added support for deploy keys.
parent
4c9df1db
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/GitLabApi.java
View file @
97d63f17
...
@@ -29,6 +29,7 @@ public class GitLabApi {
...
@@ -29,6 +29,7 @@ public class GitLabApi {
private
ApiVersion
apiVersion
;
private
ApiVersion
apiVersion
;
private
int
defaultPerPage
=
DEFAULT_PER_PAGE
;
private
int
defaultPerPage
=
DEFAULT_PER_PAGE
;
private
CommitsApi
commitsApi
;
private
CommitsApi
commitsApi
;
private
DeployKeysApi
deployKeysApi
;
private
GroupApi
groupApi
;
private
GroupApi
groupApi
;
private
MergeRequestApi
mergeRequestApi
;
private
MergeRequestApi
mergeRequestApi
;
private
NamespaceApi
namespaceApi
;
private
NamespaceApi
namespaceApi
;
...
@@ -181,6 +182,7 @@ public class GitLabApi {
...
@@ -181,6 +182,7 @@ public class GitLabApi {
this
.
apiVersion
=
apiVersion
;
this
.
apiVersion
=
apiVersion
;
apiClient
=
new
GitLabApiClient
(
apiVersion
,
hostUrl
,
privateToken
,
secretToken
,
clientConfigProperties
);
apiClient
=
new
GitLabApiClient
(
apiVersion
,
hostUrl
,
privateToken
,
secretToken
,
clientConfigProperties
);
commitsApi
=
new
CommitsApi
(
this
);
commitsApi
=
new
CommitsApi
(
this
);
deployKeysApi
=
new
DeployKeysApi
(
this
);
groupApi
=
new
GroupApi
(
this
);
groupApi
=
new
GroupApi
(
this
);
mergeRequestApi
=
new
MergeRequestApi
(
this
);
mergeRequestApi
=
new
MergeRequestApi
(
this
);
namespaceApi
=
new
NamespaceApi
(
this
);
namespaceApi
=
new
NamespaceApi
(
this
);
...
@@ -293,6 +295,16 @@ public class GitLabApi {
...
@@ -293,6 +295,16 @@ public class GitLabApi {
return
(
commitsApi
);
return
(
commitsApi
);
}
}
/**
* Gets the DeployKeysApi instance owned by this GitLabApi instance. The DeployKeysApi is used
* to perform all deploy key related API calls.
*
* @return the CommitsApi instance owned by this GitLabApi instance
*/
public
DeployKeysApi
getDeployKeysApi
()
{
return
(
deployKeysApi
);
}
/**
/**
* Gets the MergeRequestApi instance owned by this GitLabApi instance. The MergeRequestApi is used
* Gets the MergeRequestApi instance owned by this GitLabApi instance. The MergeRequestApi is used
* to perform all merge request related API calls.
* to perform all merge request related API calls.
...
...
src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java
View file @
97d63f17
...
@@ -35,6 +35,7 @@ import org.gitlab4j.api.models.Branch;
...
@@ -35,6 +35,7 @@ import org.gitlab4j.api.models.Branch;
import
org.gitlab4j.api.models.Comment
;
import
org.gitlab4j.api.models.Comment
;
import
org.gitlab4j.api.models.Commit
;
import
org.gitlab4j.api.models.Commit
;
import
org.gitlab4j.api.models.CompareResults
;
import
org.gitlab4j.api.models.CompareResults
;
import
org.gitlab4j.api.models.DeployKey
;
import
org.gitlab4j.api.models.Diff
;
import
org.gitlab4j.api.models.Diff
;
import
org.gitlab4j.api.models.Event
;
import
org.gitlab4j.api.models.Event
;
import
org.gitlab4j.api.models.Group
;
import
org.gitlab4j.api.models.Group
;
...
@@ -194,6 +195,21 @@ public class TestGitLabApiBeans {
...
@@ -194,6 +195,21 @@ public class TestGitLabApiBeans {
}
}
}
}
@Test
public
void
testDeployKeys
()
{
try
{
InputStreamReader
reader
=
new
InputStreamReader
(
GitLabApi
.
class
.
getResourceAsStream
(
"deploy-keys.json"
));
ObjectMapper
objectMapper
=
jacksonJson
.
getContext
(
null
);
List
<
DeployKey
>
deployKeys
=
objectMapper
.
readValue
(
reader
,
new
TypeReference
<
List
<
DeployKey
>>()
{});
assertTrue
(
compareJson
(
deployKeys
,
"deploy-keys"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Test
@Test
public
void
testArtifactsFile
()
{
public
void
testArtifactsFile
()
{
...
@@ -355,8 +371,7 @@ public class TestGitLabApiBeans {
...
@@ -355,8 +371,7 @@ public class TestGitLabApiBeans {
InputStreamReader
reader
=
new
InputStreamReader
(
GitLabApi
.
class
.
getResourceAsStream
(
"tree.json"
));
InputStreamReader
reader
=
new
InputStreamReader
(
GitLabApi
.
class
.
getResourceAsStream
(
"tree.json"
));
ObjectMapper
objectMapper
=
jacksonJson
.
getContext
(
null
);
ObjectMapper
objectMapper
=
jacksonJson
.
getContext
(
null
);
List
<
TreeItem
>
tree
=
objectMapper
.
readValue
(
reader
,
new
TypeReference
<
List
<
TreeItem
>>()
{
List
<
TreeItem
>
tree
=
objectMapper
.
readValue
(
reader
,
new
TypeReference
<
List
<
TreeItem
>>()
{});
});
assertTrue
(
compareJson
(
tree
,
"tree"
));
assertTrue
(
compareJson
(
tree
,
"tree"
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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