Commit 97d63f17 authored by Greg Messner's avatar Greg Messner
Browse files

Added support for deploy keys.

parent 4c9df1db
...@@ -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.
......
...@@ -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) {
......
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