Commit 2341a37b authored by Lorenzo Caenazzo's avatar Lorenzo Caenazzo

revert format code

parent 37444213
...@@ -14,6 +14,7 @@ import java.net.URLEncoder; ...@@ -14,6 +14,7 @@ import java.net.URLEncoder;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* Gitlab API Wrapper class * Gitlab API Wrapper class
* *
...@@ -132,8 +133,7 @@ public class GitlabAPI { ...@@ -132,8 +133,7 @@ public class GitlabAPI {
* @param skip_confirmation Skip Confirmation * @param skip_confirmation Skip Confirmation
* @return A GitlabUser * @return A GitlabUser
* @throws IOException on gitlab api call error * @throws IOException on gitlab api call error
* @see * @see <a href="http://doc.gitlab.com/ce/api/users.html">http://doc.gitlab.com/ce/api/users.html</a>
* <a href="http://doc.gitlab.com/ce/api/users.html">http://doc.gitlab.com/ce/api/users.html</a>
*/ */
public GitlabUser createUser(String email, String password, String username, public GitlabUser createUser(String email, String password, String username,
String fullName, String skypeId, String linkedIn, String fullName, String skypeId, String linkedIn,
...@@ -164,6 +164,7 @@ public class GitlabAPI { ...@@ -164,6 +164,7 @@ public class GitlabAPI {
return dispatch().to(tailUrl, GitlabUser.class); return dispatch().to(tailUrl, GitlabUser.class);
} }
/** /**
* Update a user * Update a user
* *
...@@ -271,6 +272,7 @@ public class GitlabAPI { ...@@ -271,6 +272,7 @@ public class GitlabAPI {
retrieve().method("DELETE").to(tailUrl, Void.class); retrieve().method("DELETE").to(tailUrl, Void.class);
} }
/** /**
* Gets all ssh keys for a user * Gets all ssh keys for a user
* *
...@@ -342,7 +344,8 @@ public class GitlabAPI { ...@@ -342,7 +344,8 @@ public class GitlabAPI {
/** /**
* Creates a Group * Creates a Group
* *
* @param name The name of the group. The name will also be used as the path * @param name The name of the group. The
* name will also be used as the path
* of the group. * of the group.
* @return The GitLab Group * @return The GitLab Group
* @throws IOException on gitlab api call error * @throws IOException on gitlab api call error
...@@ -481,24 +484,15 @@ public class GitlabAPI { ...@@ -481,24 +484,15 @@ public class GitlabAPI {
* Creates a Project * Creates a Project
* *
* @param name The name of the project * @param name The name of the project
* @param namespaceId The Namespace for the new project, otherwise null * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user)
* indicates to use the GitLab default (user)
* @param description A description for the project, null otherwise * @param description A description for the project, null otherwise
* @param issuesEnabled Whether Issues should be enabled, otherwise null * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default
* indicates to use GitLab default * @param wallEnabled Whether The Wall should be enabled, otherwise null indicates to use GitLab default
* @param wallEnabled Whether The Wall should be enabled, otherwise null * @param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default
* indicates to use GitLab default * @param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default
* @param mergeRequestsEnabled Whether Merge Requests should be enabled, * @param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default
* otherwise null indicates to use GitLab default * @param publik Whether the project is public or private, if true same as setting visibilityLevel = 20, otherwise null indicates to use GitLab default
* @param wikiEnabled Whether a Wiki should be enabled, otherwise null * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default
* indicates to use GitLab default
* @param snippetsEnabled Whether Snippets should be enabled, otherwise null
* indicates to use GitLab default
* @param publik Whether the project is public or private, if true same as
* setting visibilityLevel = 20, otherwise null indicates to use GitLab
* default
* @param visibilityLevel The visibility level of the project, otherwise
* null indicates to use GitLab default
* @param importUrl The Import URL for the project, otherwise null * @param importUrl The Import URL for the project, otherwise null
* @return the Gitlab Project * @return the Gitlab Project
* @throws IOException on gitlab api call error * @throws IOException on gitlab api call error
...@@ -540,23 +534,14 @@ public class GitlabAPI { ...@@ -540,23 +534,14 @@ public class GitlabAPI {
* @param userId The id of the user to create the project for * @param userId The id of the user to create the project for
* @param name The name of the project * @param name The name of the project
* @param description A description for the project, null otherwise * @param description A description for the project, null otherwise
* @param defaultBranch The default branch for the project, otherwise null * @param defaultBranch The default branch for the project, otherwise null indicates to use GitLab default (master)
* indicates to use GitLab default (master) * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default
* @param issuesEnabled Whether Issues should be enabled, otherwise null * @param wallEnabled Whether The Wall should be enabled, otherwise null indicates to use GitLab default
* indicates to use GitLab default * @param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default
* @param wallEnabled Whether The Wall should be enabled, otherwise null * @param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default
* indicates to use GitLab default * @param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default
* @param mergeRequestsEnabled Whether Merge Requests should be enabled, * @param publik Whether the project is public or private, if true same as setting visibilityLevel = 20, otherwise null indicates to use GitLab default
* otherwise null indicates to use GitLab default * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default
* @param wikiEnabled Whether a Wiki should be enabled, otherwise null
* indicates to use GitLab default
* @param snippetsEnabled Whether Snippets should be enabled, otherwise null
* indicates to use GitLab default
* @param publik Whether the project is public or private, if true same as
* setting visibilityLevel = 20, otherwise null indicates to use GitLab
* default
* @param visibilityLevel The visibility level of the project, otherwise
* null indicates to use GitLab default
* @return The GitLab Project * @return The GitLab Project
* @throws IOException on gitlab api call error * @throws IOException on gitlab api call error
*/ */
...@@ -584,21 +569,13 @@ public class GitlabAPI { ...@@ -584,21 +569,13 @@ public class GitlabAPI {
* @param projectId The id of the project to update * @param projectId The id of the project to update
* @param name The name of the project * @param name The name of the project
* @param description A description for the project, null otherwise * @param description A description for the project, null otherwise
* @param issuesEnabled Whether Issues should be enabled, otherwise null * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default
* indicates to use GitLab default * @param wallEnabled Whether The Wall should be enabled, otherwise null indicates to use GitLab default
* @param wallEnabled Whether The Wall should be enabled, otherwise null * @param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default
* indicates to use GitLab default * @param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default
* @param mergeRequestsEnabled Whether Merge Requests should be enabled, * @param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default
* otherwise null indicates to use GitLab default * @param publik Whether the project is public or private, if true same as setting visibilityLevel = 20, otherwise null indicates to use GitLab default
* @param wikiEnabled Whether a Wiki should be enabled, otherwise null * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default
* indicates to use GitLab default
* @param snippetsEnabled Whether Snippets should be enabled, otherwise null
* indicates to use GitLab default
* @param publik Whether the project is public or private, if true same as
* setting visibilityLevel = 20, otherwise null indicates to use GitLab
* default
* @param visibilityLevel The visibility level of the project, otherwise
* null indicates to use GitLab default
* @return the Gitlab Project * @return the Gitlab Project
* @throws IOException on gitlab api call error * @throws IOException on gitlab api call error
*/ */
...@@ -672,25 +649,24 @@ public class GitlabAPI { ...@@ -672,25 +649,24 @@ public class GitlabAPI {
GitlabHTTPRequestor requestor = retrieve().method("PUT"); GitlabHTTPRequestor requestor = retrieve().method("PUT");
requestor.with("id", project.getId()); requestor.with("id", project.getId());
requestor.with("merge_request_id", mergeRequestId); requestor.with("merge_request_id", mergeRequestId);
if (mergeCommitMessage != null) { if (mergeCommitMessage != null)
requestor.with("merge_commit_message", mergeCommitMessage); requestor.with("merge_commit_message", mergeCommitMessage);
}
return requestor.to(tailUrl, GitlabMergeRequest.class); return requestor.to(tailUrl, GitlabMergeRequest.class);
} }
public List<GitlabNote> getNotes(GitlabMergeRequest mergeRequest) throws IOException { public List<GitlabNote> getNotes(GitlabMergeRequest mergeRequest) throws IOException {
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() +
+ GitlabMergeRequest.URL + "/" + mergeRequest.getId() GitlabMergeRequest.URL + "/" + mergeRequest.getId() +
+ GitlabNote.URL; GitlabNote.URL;
GitlabNote[] notes = retrieve().to(tailUrl, GitlabNote[].class); GitlabNote[] notes = retrieve().to(tailUrl, GitlabNote[].class);
return Arrays.asList(notes); return Arrays.asList(notes);
} }
public List<GitlabNote> getAllNotes(GitlabMergeRequest mergeRequest) throws IOException { public List<GitlabNote> getAllNotes(GitlabMergeRequest mergeRequest) throws IOException {
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() +
+ GitlabMergeRequest.URL + "/" + mergeRequest.getId() GitlabMergeRequest.URL + "/" + mergeRequest.getId() +
+ GitlabNote.URL; GitlabNote.URL;
return retrieve().getAll(tailUrl, GitlabNote[].class); return retrieve().getAll(tailUrl, GitlabNote[].class);
} }
...@@ -711,8 +687,8 @@ public class GitlabAPI { ...@@ -711,8 +687,8 @@ public class GitlabAPI {
Query query = new Query() Query query = new Query()
.append("ref_name", mergeRequest.getSourceBranch()); .append("ref_name", mergeRequest.getSourceBranch());
String tailUrl = GitlabProject.URL + "/" + projectId String tailUrl = GitlabProject.URL + "/" + projectId +
+ "/repository" + GitlabCommit.URL + query.toString(); "/repository" + GitlabCommit.URL + query.toString();
GitlabCommit[] commits = retrieve().to(tailUrl, GitlabCommit[].class); GitlabCommit[] commits = retrieve().to(tailUrl, GitlabCommit[].class);
return Arrays.asList(commits); return Arrays.asList(commits);
...@@ -775,10 +751,8 @@ public class GitlabAPI { ...@@ -775,10 +751,8 @@ public class GitlabAPI {
* Get an archive of the repository * Get an archive of the repository
* *
* @param project The Project * @param project The Project
* @param path The path inside the repository. Used to get content of * @param path The path inside the repository. Used to get content of subdirectories (optional)
* subdirectories (optional) * @param ref_name The name of a repository branch or tag or if not given the default branch (optional)
* @param ref_name The name of a repository branch or tag or if not given
* the default branch (optional)
* @throws IOException on gitlab api call error * @throws IOException on gitlab api call error
*/ */
public List<GitlabRepositoryTree> getRepositoryTree(GitlabProject project, String path, String ref_name) throws IOException { public List<GitlabRepositoryTree> getRepositoryTree(GitlabProject project, String path, String ref_name) throws IOException {
...@@ -792,8 +766,8 @@ public class GitlabAPI { ...@@ -792,8 +766,8 @@ public class GitlabAPI {
} }
public GitlabNote createNote(GitlabMergeRequest mergeRequest, String body) throws IOException { public GitlabNote createNote(GitlabMergeRequest mergeRequest, String body) throws IOException {
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() +
+ GitlabMergeRequest.URL + "/" + mergeRequest.getId() + GitlabNote.URL; GitlabMergeRequest.URL + "/" + mergeRequest.getId() + GitlabNote.URL;
return dispatch().with("body", body).to(tailUrl, GitlabNote.class); return dispatch().with("body", body).to(tailUrl, GitlabNote.class);
} }
......
package org.gitlab.api; package org.gitlab.api;
public enum TokenType { public enum TokenType {
PRIVATE_TOKEN("private_token"), ACCESS_TOKEN("access_token"),; PRIVATE_TOKEN("private_token")
, ACCESS_TOKEN("access_token"),
;
private final String tokenParamName; private final String tokenParamName;
......
...@@ -20,8 +20,8 @@ import java.util.regex.Pattern; ...@@ -20,8 +20,8 @@ import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
/** /**
* Gitlab HTTP Requestor Responsible for handling HTTP requests to the Gitlab * Gitlab HTTP Requestor
* API * Responsible for handling HTTP requests to the Gitlab API
* *
* @author &#064;timols (Tim O) * @author &#064;timols (Tim O)
*/ */
...@@ -57,8 +57,8 @@ public class GitlabHTTPRequestor { ...@@ -57,8 +57,8 @@ public class GitlabHTTPRequestor {
} }
/** /**
* Sets the HTTP Request method for the request. Has a fluent api for method * Sets the HTTP Request method for the request.
* chaining. * Has a fluent api for method chaining.
* *
* @param method The HTTP method * @param method The HTTP method
* @return this * @return this
...@@ -74,8 +74,8 @@ public class GitlabHTTPRequestor { ...@@ -74,8 +74,8 @@ public class GitlabHTTPRequestor {
} }
/** /**
* Sets the HTTP Form Post parameters for the request Has a fluent api for * Sets the HTTP Form Post parameters for the request
* method chaining * Has a fluent api for method chaining
* *
* @param key Form parameter Key * @param key Form parameter Key
* @param value Form parameter Value * @param value Form parameter Value
...@@ -101,8 +101,7 @@ public class GitlabHTTPRequestor { ...@@ -101,8 +101,7 @@ public class GitlabHTTPRequestor {
* Will throw an error * Will throw an error
* *
* @param <T> The return type of the method * @param <T> The return type of the method
* @param tailAPIUrl The url to open a connection to (after the host and * @param tailAPIUrl The url to open a connection to (after the host and namespace)
* namespace)
* @param type The type of the response to be deserialized from * @param type The type of the response to be deserialized from
* @param instance The instance to update from the response * @param instance The instance to update from the response
* @return An object of type T * @return An object of type T
...@@ -232,7 +231,8 @@ public class GitlabHTTPRequestor { ...@@ -232,7 +231,8 @@ public class GitlabHTTPRequestor {
if (matcher.find()) { if (matcher.find()) {
Integer page = Integer.parseInt(matcher.group(2)) + 1; Integer page = Integer.parseInt(matcher.group(2)) + 1;
this.url = new URL(matcher.replaceAll(matcher.group(1) + "page=" + page)); this.url = new URL(matcher.replaceAll(matcher.group(1) + "page=" + page));
} else if (GitlabCommit[].class == type) { } else {
if (GitlabCommit[].class == type) {
// there is a bug in the Gitlab CE API // there is a bug in the Gitlab CE API
// (https://gitlab.com/gitlab-org/gitlab-ce/issues/759) // (https://gitlab.com/gitlab-org/gitlab-ce/issues/759)
// that starts pagination with page=0 for commits // that starts pagination with page=0 for commits
...@@ -243,6 +243,7 @@ public class GitlabHTTPRequestor { ...@@ -243,6 +243,7 @@ public class GitlabHTTPRequestor {
this.url = new URL(url + "&page=2"); this.url = new URL(url + "&page=2");
} }
} }
}
}; };
} }
......
...@@ -8,12 +8,12 @@ import java.util.ArrayList; ...@@ -8,12 +8,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Models the Query aspect of a URL * Models the Query
* aspect of a URL
*/ */
public class Query { public class Query {
private class Tuple<T1, T2> { private class Tuple<T1, T2> {
T1 _1; T1 _1;
T2 _2; T2 _2;
...@@ -24,8 +24,8 @@ public class Query { ...@@ -24,8 +24,8 @@ public class Query {
} }
/** /**
* The type of params is: Tuple<name, * The type of params is:
* Tuple<value, URLEncoder.encode(value, "UTF-8")>> * Tuple<name, Tuple<value, URLEncoder.encode(value, "UTF-8")>>
*/ */
private final List<Tuple<String, Tuple<String, String>>> params = new ArrayList<Tuple<String, Tuple<String, String>>>(); private final List<Tuple<String, Tuple<String, String>>> params = new ArrayList<Tuple<String, Tuple<String, String>>>();
...@@ -35,8 +35,7 @@ public class Query { ...@@ -35,8 +35,7 @@ public class Query {
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot * @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded
* be URL Encoded
*/ */
public Query append(final String name, final String value) throws UnsupportedEncodingException { public Query append(final String name, final String value) throws UnsupportedEncodingException {
params.add(new Tuple<String, Tuple<String, String>>(name, new Tuple<String, String>(value, URLEncoder.encode(value, "UTF-8")))); params.add(new Tuple<String, Tuple<String, String>>(name, new Tuple<String, String>(value, URLEncoder.encode(value, "UTF-8"))));
...@@ -44,14 +43,13 @@ public class Query { ...@@ -44,14 +43,13 @@ public class Query {
} }
/** /**
* Conditionally append a parameter to the query if the value of the * Conditionally append a parameter to the query
* parameter is not null * if the value of the parameter is not null
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot * @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded
* be URL Encoded
*/ */
public Query appendIf(final String name, final String value) throws UnsupportedEncodingException { public Query appendIf(final String name, final String value) throws UnsupportedEncodingException {
if (value != null) { if (value != null) {
...@@ -61,14 +59,13 @@ public class Query { ...@@ -61,14 +59,13 @@ public class Query {
} }
/** /**
* Conditionally append a parameter to the query if the value of the * Conditionally append a parameter to the query
* parameter is not null * if the value of the parameter is not null
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot * @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded
* be URL Encoded
*/ */
public Query appendIf(final String name, final Integer value) throws UnsupportedEncodingException { public Query appendIf(final String name, final Integer value) throws UnsupportedEncodingException {
if (value != null) { if (value != null) {
...@@ -78,14 +75,13 @@ public class Query { ...@@ -78,14 +75,13 @@ public class Query {
} }
/** /**
* Conditionally append a parameter to the query if the value of the * Conditionally append a parameter to the query
* parameter is not null * if the value of the parameter is not null
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot * @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded
* be URL Encoded
*/ */
public Query appendIf(final String name, final Boolean value) throws UnsupportedEncodingException { public Query appendIf(final String name, final Boolean value) throws UnsupportedEncodingException {
if (value != null) { if (value != null) {
...@@ -95,14 +91,13 @@ public class Query { ...@@ -95,14 +91,13 @@ public class Query {
} }
/** /**
* Conditionally append a parameter to the query if the value of the * Conditionally append a parameter to the query
* parameter is not null * if the value of the parameter is not null
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
* @return this * @return this
* @throws java.io.UnsupportedEncodingException If the provided value cannot * @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded
* be URL Encoded
*/ */
public Query appendIf(final String name, final GitlabAccessLevel value) throws UnsupportedEncodingException { public Query appendIf(final String name, final GitlabAccessLevel value) throws UnsupportedEncodingException {
if (value != null) { if (value != null) {
...@@ -112,7 +107,8 @@ public class Query { ...@@ -112,7 +107,8 @@ public class Query {
} }
/** /**
* Returns a Query suitable for appending to a URI * Returns a Query suitable for appending
* to a URI
*/ */
@Override @Override
public String toString() { public String toString() {
......
...@@ -3,7 +3,6 @@ package org.gitlab.api.models; ...@@ -3,7 +3,6 @@ package org.gitlab.api.models;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabBranch { public class GitlabBranch {
public final static String URL = "/repository/branches/"; public final static String URL = "/repository/branches/";
@JsonProperty("name") @JsonProperty("name")
......
...@@ -5,7 +5,6 @@ import java.util.Date; ...@@ -5,7 +5,6 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabBranchCommit { public class GitlabBranchCommit {
public static String URL = "/users"; public static String URL = "/users";
private String id; private String id;
......
...@@ -5,7 +5,6 @@ import java.util.Date; ...@@ -5,7 +5,6 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabMergeRequest { public class GitlabMergeRequest {
public static final String URL = "/merge_requests"; public static final String URL = "/merge_requests";
private Integer id; private Integer id;
......
...@@ -5,7 +5,6 @@ import java.util.Date; ...@@ -5,7 +5,6 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabNamespace { public class GitlabNamespace {
public static final String URL = "/groups"; public static final String URL = "/groups";
private Integer id; private Integer id;
......
...@@ -10,6 +10,7 @@ public class GitlabProjectAccessLevel { ...@@ -10,6 +10,7 @@ public class GitlabProjectAccessLevel {
@JsonProperty("notification_level") @JsonProperty("notification_level")
private int notificationLevel; private int notificationLevel;
public GitlabAccessLevel getAccessLevel() { public GitlabAccessLevel getAccessLevel() {
return GitlabAccessLevel.fromAccessValue(accessLevel); return GitlabAccessLevel.fromAccessValue(accessLevel);
} }
...@@ -18,6 +19,7 @@ public class GitlabProjectAccessLevel { ...@@ -18,6 +19,7 @@ public class GitlabProjectAccessLevel {
this.accessLevel = accessLevel.accessValue; this.accessLevel = accessLevel.accessValue;
} }
public int getNoficationLevel() { public int getNoficationLevel() {
return notificationLevel; return notificationLevel;
} }
...@@ -26,4 +28,5 @@ public class GitlabProjectAccessLevel { ...@@ -26,4 +28,5 @@ public class GitlabProjectAccessLevel {
this.accessLevel = notificationLevel; this.accessLevel = notificationLevel;
} }
} }
package org.gitlab.api.models; package org.gitlab.api.models;
public class GitlabRepositoryTree { public class GitlabRepositoryTree {
public static String URL = "/tree"; public static String URL = "/tree";
private String name; private String name;
......
package org.gitlab.api.models; package org.gitlab.api.models;
public class GitlabSSHKey {
public class GitlabSSHKey {
public static String KEYS_URL = "/keys"; public static String KEYS_URL = "/keys";
private Integer _id; private Integer _id;
......
...@@ -5,7 +5,6 @@ import java.util.Date; ...@@ -5,7 +5,6 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
public class GitlabUser { public class GitlabUser {
public static String URL = "/users"; public static String URL = "/users";
public static String USERS_URL = "/users"; public static String USERS_URL = "/users";
public static String USER_URL = "/user"; // for sudo based ops public static String USER_URL = "/user"; // for sudo based ops
......
...@@ -24,6 +24,7 @@ public class GitlabAPIT { ...@@ -24,6 +24,7 @@ public class GitlabAPIT {
String rand = UUID.randomUUID().toString().replace("-", "").substring(0, 8); String rand = UUID.randomUUID().toString().replace("-", "").substring(0, 8);
@Before @Before
public void setup() throws IOException { public void setup() throws IOException {
api = GitlabAPI.connect(TEST_URL, TEST_TOKEN); api = GitlabAPI.connect(TEST_URL, TEST_TOKEN);
...@@ -61,6 +62,7 @@ public class GitlabAPIT { ...@@ -61,6 +62,7 @@ public class GitlabAPIT {
String password = randVal("$%password"); String password = randVal("$%password");
GitlabUser gitUser = api.createUser(randVal("testEmail@gitlabapitest.com"), GitlabUser gitUser = api.createUser(randVal("testEmail@gitlabapitest.com"),
password, password,
randVal("userName"), randVal("userName"),
...@@ -89,11 +91,14 @@ public class GitlabAPIT { ...@@ -89,11 +91,14 @@ public class GitlabAPIT {
10 /* project limit does not come back on GET */, gitUser.getExternUid(), gitUser.getExternProviderName(), 10 /* project limit does not come back on GET */, gitUser.getExternUid(), gitUser.getExternProviderName(),
gitUser.getBio(), gitUser.isAdmin(), gitUser.isCanCreateGroup()); gitUser.getBio(), gitUser.isAdmin(), gitUser.isCanCreateGroup());
GitlabUser postUpdate = api.getUserViaSudo(gitUser.getUsername()); GitlabUser postUpdate = api.getUserViaSudo(gitUser.getUsername());
assertNotNull(postUpdate); assertNotNull(postUpdate);
assertEquals(postUpdate.getSkype(), "newSkypeId"); assertEquals(postUpdate.getSkype(), "newSkypeId");
api.deleteUser(postUpdate.getId()); api.deleteUser(postUpdate.getId());
// expect a 404, but we have no access to it // expect a 404, but we have no access to it
...@@ -104,6 +109,7 @@ public class GitlabAPIT { ...@@ -104,6 +109,7 @@ public class GitlabAPIT {
assertTrue(true); // expected assertTrue(true); // expected
} }
} }
private String randVal(String postfix) { private String randVal(String postfix) {
......
...@@ -32,6 +32,7 @@ public class QueryTest { ...@@ -32,6 +32,7 @@ public class QueryTest {
Query query = new Query() Query query = new Query()
.append("p1", "v1"); .append("p1", "v1");
query.append("p2", "v2"); query.append("p2", "v2");
query = query.append("p3", "v3"); query = query.append("p3", "v3");
......
Markdown is supported
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