Commit 71efa977 authored by timols's avatar timols

Updated code conventions to not use _ variables, fixed whitespace, resolved backwards compat issues

parent 3dbfade8
This diff is collapsed.
...@@ -16,6 +16,7 @@ public class Query { ...@@ -16,6 +16,7 @@ public class Query {
private class Tuple<T1, T2> { private class Tuple<T1, T2> {
T1 _1; T1 _1;
T2 _2; T2 _2;
public Tuple(T1 _1, T2 _2) { public Tuple(T1 _1, T2 _2) {
this._1 = _1; this._1 = _1;
this._2 = _2; this._2 = _2;
...@@ -24,20 +25,19 @@ public class Query { ...@@ -24,20 +25,19 @@ public class Query {
/** /**
* The type of params is: * The type of params is:
* Tuple<name, 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>>>();
/** /**
* Appends a parameter to the query * Appends a parameter to the query
* *
* @param name Parameter name * @param name Parameter name
* @param value Parameter value * @param value Parameter value
*
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot 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(name, new Tuple(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"))));
return this; return this;
} }
...@@ -45,13 +45,12 @@ public class Query { ...@@ -45,13 +45,12 @@ public class Query {
* Conditionally append a parameter to the query * Conditionally append a parameter to the query
* if the value of the 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
*
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot 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) {
append(name, value); append(name, value);
} }
return this; return this;
...@@ -61,13 +60,12 @@ public class Query { ...@@ -61,13 +60,12 @@ public class Query {
* Conditionally append a parameter to the query * Conditionally append a parameter to the query
* if the value of the 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
*
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot 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) {
append(name, value.toString()); append(name, value.toString());
} }
return this; return this;
...@@ -77,13 +75,12 @@ public class Query { ...@@ -77,13 +75,12 @@ public class Query {
* Conditionally append a parameter to the query * Conditionally append a parameter to the query
* if the value of the 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
*
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot 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) {
append(name, value.toString()); append(name, value.toString());
} }
return this; return this;
...@@ -93,13 +90,12 @@ public class Query { ...@@ -93,13 +90,12 @@ public class Query {
* Conditionally append a parameter to the query * Conditionally append a parameter to the query
* if the value of the 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
*
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded * @throws java.io.UnsupportedEncodingException If the provided value cannot 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) {
append(name, Integer.toString(value.accessValue)); append(name, Integer.toString(value.accessValue));
} }
return this; return this;
...@@ -113,8 +109,8 @@ public class Query { ...@@ -113,8 +109,8 @@ public class Query {
public String toString() { public String toString() {
final StringBuilder builder = new StringBuilder(); final StringBuilder builder = new StringBuilder();
for(final Tuple<String, Tuple<String, String>> param : params) { for (final Tuple<String, Tuple<String, String>> param : params) {
if(builder.length() == 0) { if (builder.length() == 0) {
builder.append('?'); builder.append('?');
} else { } else {
builder.append('&'); builder.append('&');
......
...@@ -4,17 +4,17 @@ import org.codehaus.jackson.annotate.JsonProperty; ...@@ -4,17 +4,17 @@ import org.codehaus.jackson.annotate.JsonProperty;
public abstract class GitlabAbstractMember extends GitlabUser { public abstract class GitlabAbstractMember extends GitlabUser {
public static final String URL = "/members"; public static final String URL = "/members";
@JsonProperty("access_level") @JsonProperty("access_level")
private int _accessLevel; private int accessLevel;
public GitlabAccessLevel getAccessLevel() { public GitlabAccessLevel getAccessLevel() {
return GitlabAccessLevel.fromAccessValue(_accessLevel); return GitlabAccessLevel.fromAccessValue(accessLevel);
} }
public void setAccessLevel(GitlabAccessLevel accessLevel) { public void setAccessLevel(GitlabAccessLevel accessLevel) {
_accessLevel = accessLevel.accessValue; this.accessLevel = accessLevel.accessValue;
} }
} }
...@@ -9,16 +9,17 @@ public enum GitlabAccessLevel { ...@@ -9,16 +9,17 @@ public enum GitlabAccessLevel {
Owner(50); Owner(50);
public final int accessValue; public final int accessValue;
GitlabAccessLevel(int accessValue) { GitlabAccessLevel(int accessValue) {
this.accessValue = accessValue; this.accessValue = accessValue;
} }
public static GitlabAccessLevel fromAccessValue(final int accessValue) throws IllegalArgumentException { public static GitlabAccessLevel fromAccessValue(final int accessValue) throws IllegalArgumentException {
for(final GitlabAccessLevel gitlabAccessLevel : GitlabAccessLevel.values()) { for (final GitlabAccessLevel gitlabAccessLevel : GitlabAccessLevel.values()) {
if(gitlabAccessLevel.accessValue == accessValue) { if (gitlabAccessLevel.accessValue == accessValue) {
return gitlabAccessLevel; return gitlabAccessLevel;
} }
} }
throw new IllegalArgumentException("No GitLab Access Level enum constant with access value: " + accessValue); throw new IllegalArgumentException("No GitLab Access Level enum constant with access value: " + accessValue);
} }
} }
\ No newline at end of file
...@@ -3,38 +3,38 @@ package org.gitlab.api.models; ...@@ -3,38 +3,38 @@ package org.gitlab.api.models;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.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")
private String _name; private String name;
@JsonProperty("commit") @JsonProperty("commit")
private GitlabBranchCommit _commit; private GitlabBranchCommit commit;
@JsonProperty("protected") @JsonProperty("protected")
private boolean _protected; private boolean branchProtected;
public String getName() { public String getName() {
return _name; return name;
} }
public void setName(String name) { public void setName(String name) {
this._name = name; this.name = name;
} }
public GitlabBranchCommit getCommit() { public GitlabBranchCommit getCommit() {
return _commit; return commit;
} }
public void setCommit(GitlabBranchCommit commit) { public void setCommit(GitlabBranchCommit commit) {
this._commit = commit; this.commit = commit;
} }
public boolean isProtected() { public boolean isProtected() {
return _protected; return branchProtected;
} }
public void setProtected(boolean isProtected) { public void setProtected(boolean isProtected) {
this._protected = isProtected; this.branchProtected = isProtected;
} }
} }
\ No newline at end of file
package org.gitlab.api.models; package org.gitlab.api.models;
import org.gitlab.api.models.GitlabUser; import org.codehaus.jackson.annotate.JsonProperty;
import java.lang.String;
import java.util.Date; import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty;
public class GitlabBranchCommit { public class GitlabBranchCommit {
public static String URL = "/users"; public static String URL = "/users";
private String _id; private String id;
private String _tree; private String tree;
private String _message; private String message;
private GitlabUser _author; private GitlabUser author;
private GitlabUser _committer; private GitlabUser committer;
@JsonProperty("authored_date") @JsonProperty("authored_date")
private Date _authoredDate; private Date authoredDate;
@JsonProperty("committed_date") @JsonProperty("committed_date")
private Date _committedDate; private Date committedDate;
public String getId() { public String getId() {
return _id; return id;
} }
public void setId(String id) { public void setId(String id) {
_id = id; this.id = id;
} }
public String getTree() { public String getTree() {
return _tree; return tree;
} }
public void setTree(String tree) { public void setTree(String tree) {
_tree = tree; this.tree = tree;
} }
public String getMessage() { public String getMessage() {
return _message; return message;
} }
public void setMessage(String message) { public void setMessage(String message) {
_message = message; this.message = message;
} }
public GitlabUser getAuthor() { public GitlabUser getAuthor() {
return _author; return author;
} }
public void setAuthor(GitlabUser author) { public void setAuthor(GitlabUser author) {
_author = author; this.author = author;
} }
public GitlabUser getCommitter() { public GitlabUser getCommitter() {
return _committer; return committer;
} }
public void setCommitter(GitlabUser committer) { public void setCommitter(GitlabUser committer) {
_committer = committer; this.committer = committer;
} }
public Date getAuthoredDate() { public Date getAuthoredDate() {
return _authoredDate; return authoredDate;
} }
public void setAuthoredDate(Date authoredDate) { public void setAuthoredDate(Date authoredDate) {
_authoredDate = authoredDate; this.authoredDate = authoredDate;
} }
public Date getCommittedDate() { public Date getCommittedDate() {
return _committedDate; return committedDate;
} }
public void setCommittedDate(Date committedDate) { public void setCommittedDate(Date committedDate) {
_committedDate = committedDate; this.committedDate = committedDate;
} }
} }
package org.gitlab.api.models; package org.gitlab.api.models;
import org.codehaus.jackson.annotate.JsonProperty;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.codehaus.jackson.annotate.JsonProperty;
public class GitlabCommit { public class GitlabCommit {
public final static String URL = "/commits"; public final static String URL = "/commits";
private String _id; private String id;
private String _title; private String title;
private String _description; private String description;
@JsonProperty("short_id") @JsonProperty("short_id")
private String _shortId; private String shortId;
@JsonProperty("author_name") @JsonProperty("author_name")
private String _authorName; private String authorName;
@JsonProperty("author_email") @JsonProperty("author_email")
private String _authorEmail; private String authorEmail;
@JsonProperty("created_at") @JsonProperty("created_at")
private Date _createdAt; private Date createdAt;
@JsonProperty("committed_date") @JsonProperty("committed_date")
private Date _committedDate; private Date committedDate;
@JsonProperty("authored_date") @JsonProperty("authored_date")
private Date _authoredDate; private Date authoredDate;
@JsonProperty("parent_ids") @JsonProperty("parent_ids")
private List<String> _parentIds; private List<String> parentIds;
public String getId() { public String getId() {
return _id; return id;
} }
public void setId(String id) { public void setId(String id) {
_id = id; this.id = id;
} }
public String getShortId() { public String getShortId() {
return _shortId; return shortId;
} }
public void setShortId(String shortId) { public void setShortId(String shortId) {
_shortId = shortId; this.shortId = shortId;
} }
public String getTitle() { public String getTitle() {
return _title; return title;
} }
public void setTitle(String title) { public void setTitle(String title) {
_title = title; this.title = title;
} }
public String getDescription() { public String getDescription() {
return _description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
_description = description; this.description = description;
} }
public String getAuthorName() { public String getAuthorName() {
return _authorName; return authorName;
} }
public void setAuthorName(String authorName) { public void setAuthorName(String authorName) {
_authorName = authorName; this.authorName = authorName;
} }
public String getAuthorEmail() { public String getAuthorEmail() {
return _authorEmail; return authorEmail;
} }
public void setAuthorEmail(String authorEmail) { public void setAuthorEmail(String authorEmail) {
_authorEmail = authorEmail; this.authorEmail = authorEmail;
} }
public Date getCreatedAt() { public Date getCreatedAt() {
return _createdAt; return createdAt;
} }
public void setCreatedAt(Date createdAt) { public void setCreatedAt(Date createdAt) {
_createdAt = createdAt; this.createdAt = createdAt;
} }
public List<String> getParentIds() { public List<String> getParentIds() {
return _parentIds; return parentIds;
} }
public void setParentIds(List<String> parentIds) { public void setParentIds(List<String> parentIds) {
_parentIds = parentIds; this.parentIds = parentIds;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
// we say that two commit objects are equal iff they have the same ID // we say that two commit objects are equal iff they have the same ID
// this prevents us from having to do clever workarounds for // this prevents us from having to do clever workarounds for
// https://gitlab.com/gitlab-org/gitlab-ce/issues/759 // https://gitlab.com/gitlab-org/gitlab-ce/issues/759
try { try {
GitlabCommit commitObj = (GitlabCommit) obj; GitlabCommit commitObj = (GitlabCommit) obj;
return (this.getId().compareTo(commitObj.getId()) == 0); return (this.getId().compareTo(commitObj.getId()) == 0);
} catch (ClassCastException e) { } catch (ClassCastException e) {
return false; return false;
} }
} }
} }
...@@ -7,90 +7,90 @@ public class GitlabCommitDiff { ...@@ -7,90 +7,90 @@ public class GitlabCommitDiff {
public final static String URL = "/diff"; public final static String URL = "/diff";
@JsonProperty("diff") @JsonProperty("diff")
private String _diff; private String diff;
@JsonProperty("new_path") @JsonProperty("new_path")
private String _newPath; private String newPath;
@JsonProperty("old_path") @JsonProperty("old_path")
private String _oldPath; private String oldPath;
@JsonProperty("a_mode") @JsonProperty("a_mode")
private String _aMode; private String aMode;
@JsonProperty("b_mode") @JsonProperty("b_mode")
private String _bMode; private String bMode;
@JsonProperty("new_file") @JsonProperty("new_file")
private boolean _newFile; private boolean newFile;
@JsonProperty("renamed_file") @JsonProperty("renamed_file")
private boolean _renamedFile; private boolean renamedFile;
@JsonProperty("deleted_file") @JsonProperty("deleted_file")
private boolean _deletedFile; private boolean deletedFile;
public String getDiff() { public String getDiff() {
return _diff; return diff;
} }
public void setDiff(String diff) { public void setDiff(String diff) {
_diff = diff; this.diff = diff;
} }
public String getNewPath() { public String getNewPath() {
return _newPath; return newPath;
} }
public void setNewPath(String newPath) { public void setNewPath(String newPath) {
_newPath = newPath; this.newPath = newPath;
} }
public String getOldPath() { public String getOldPath() {
return _oldPath; return oldPath;
} }
public void setOldPath(String oldPath) { public void setOldPath(String oldPath) {
_oldPath = oldPath; this.oldPath = oldPath;
} }
public String getAMode() { public String getAMode() {
return _aMode; return aMode;
} }
public void setAMode(String aMode) { public void setAMode(String aMode) {
_aMode = aMode; this.aMode = aMode;
} }
public String getBMode() { public String getBMode() {
return _bMode; return bMode;
} }
public void setBMode(String bMode) { public void setBMode(String bMode) {
_bMode = bMode; this.bMode = bMode;
} }
public boolean getNewFile() { public boolean getNewFile() {
return _newFile; return newFile;
} }
public void setNewFile(boolean newFile) { public void setNewFile(boolean newFile) {
_newFile = newFile; this.newFile = newFile;
} }
public boolean getRenamedFile() { public boolean getRenamedFile() {
return _renamedFile; return renamedFile;
} }
public void setRenamedFile(boolean renamedFile) { public void setRenamedFile(boolean renamedFile) {
_renamedFile = renamedFile; this.renamedFile = renamedFile;
} }
public boolean getDeletedFile() { public boolean getDeletedFile() {
return _deletedFile; return deletedFile;
} }
public void setDeletedFile(boolean deletedFile) { public void setDeletedFile(boolean deletedFile) {
_deletedFile = deletedFile; this.deletedFile = deletedFile;
} }
} }
...@@ -6,53 +6,53 @@ public class GitlabGroup { ...@@ -6,53 +6,53 @@ public class GitlabGroup {
public static final String URL = "/groups"; public static final String URL = "/groups";
private Integer _id; private Integer id;
private String _name; private String name;
private String _path; private String path;
@JsonProperty("ldap_cn") @JsonProperty("ldap_cn")
private String _ldapCn; private String ldapCn;
@JsonProperty("ldap_access") @JsonProperty("ldap_access")
private Integer _ldapAccess; private Integer ldapAccess;
public Integer getId() { public Integer getId() {
return _id; return id;
} }
public void setId(Integer id) { public void setId(Integer id) {
_id = id; this.id = id;
} }
public String getName() { public String getName() {
return _name; return name;
} }
public void setName(String name) { public void setName(String name) {
_name = name; this.name = name;
} }
public String getPath() { public String getPath() {
return _path; return path;
} }
public void setPath(String path) { public void setPath(String path) {
_path = path; this.path = path;
} }
public String getLdapCn() { public String getLdapCn() {
return _ldapCn; return ldapCn;
} }
public void setLdapCn(String ldapCn) { public void setLdapCn(String ldapCn) {
this._ldapCn = ldapCn; this.ldapCn = ldapCn;
} }
public GitlabAccessLevel getLdapAccess() { public GitlabAccessLevel getLdapAccess() {
return GitlabAccessLevel.fromAccessValue(_ldapAccess); return GitlabAccessLevel.fromAccessValue(ldapAccess);
} }
public void setLdapAccess(GitlabAccessLevel ldapGitlabAccessLevel) { public void setLdapAccess(GitlabAccessLevel ldapGitlabAccessLevel) {
this._ldapAccess = ldapGitlabAccessLevel.accessValue; this.ldapAccess = ldapGitlabAccessLevel.accessValue;
} }
} }
package org.gitlab.api.models; package org.gitlab.api.models;
import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import java.util.Date;
public class GitlabIssue { public class GitlabIssue {
public enum Action {
LEAVE, CLOSE, REOPEN public enum Action {
} LEAVE, CLOSE, REOPEN
}
public static final String StateClosed = "closed";
public static final String StateOpened = "opened"; public static final String STATE_CLOSED = "closed";
public static final String STATE_OPENED = "opened";
public static final String URL = "/issues";
public static final String URL = "/issues";
private int _id;
private int _iid; private int id;
private int iid;
@JsonProperty("project_id")
private int _projectId; @JsonProperty("project_id")
private int projectId;
private String _title;
private String _description; private String title;
private String[] _labels; private String description;
private GitlabMilestone _milestone; private String[] labels;
private GitlabMilestone milestone;
private GitlabUser _assignee;
private GitlabUser _author; private GitlabUser assignee;
private GitlabUser author;
private String _state;
private String state;
@JsonProperty("updated_at")
private Date _updatedAt; @JsonProperty("updated_at")
private Date updatedAt;
@JsonProperty("created_at")
private Date _createdAt; @JsonProperty("created_at")
private Date createdAt;
public int getId() {
return _id; public int getId() {
} return id;
}
public void setId(int id) {
_id = id; public void setId(int id) {
} this.id = id;
}
public int getIid() {
return _iid; public int getIid() {
} return iid;
}
public void setIid(int iid) {
_iid = iid; public void setIid(int iid) {
} this.iid = iid;
}
public int getProjectId() {
return _projectId; public int getProjectId() {
} return projectId;
}
public void setProjectId(int projectId) {
_projectId = projectId; public void setProjectId(int projectId) {
} this.projectId = projectId;
}
public String getTitle() {
return _title; public String getTitle() {
} return title;
}
public void setTitle(String title) {
_title = title; public void setTitle(String title) {
} this.title = title;
}
public String getDescription() {
return _description; public String getDescription() {
} return description;
}
public void setDescription(String description) {
_description = description; public void setDescription(String description) {
} this.description = description;
}
public String[] getLabels() {
return _labels; public String[] getLabels() {
} return labels;
}
public void setLabels(String[] labels) {
_labels = labels; public void setLabels(String[] labels) {
} this.labels = labels;
}
public GitlabMilestone getMilestone() {
return _milestone; public GitlabMilestone getMilestone() {
} return milestone;
}
public void setMilestone(GitlabMilestone milestone) {
_milestone = milestone; public void setMilestone(GitlabMilestone milestone) {
} this.milestone = milestone;
}
public GitlabUser getAssignee() {
return _assignee; public GitlabUser getAssignee() {
} return assignee;
}
public void setAssignee(GitlabUser assignee) {
_assignee = assignee; public void setAssignee(GitlabUser assignee) {
} this.assignee = assignee;
}
public GitlabUser getAuthor() {
return _author; public GitlabUser getAuthor() {
} return author;
}
public void setAuthor(GitlabUser author) {
_author = author; public void setAuthor(GitlabUser author) {
} this.author = author;
}
public String getState() {
return _state; public String getState() {
} return state;
}
public void setState(String state) {
_state = state; public void setState(String state) {
} this.state = state;
}
public Date getUpdatedAt() {
return _updatedAt; public Date getUpdatedAt() {
} return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
_updatedAt = updatedAt; public void setUpdatedAt(Date updatedAt) {
} this.updatedAt = updatedAt;
}
public Date getCreatedAt() {
return _createdAt; public Date getCreatedAt() {
} return createdAt;
}
public void setCreatedAt(Date createdAt) {
_createdAt = createdAt; public void setCreatedAt(Date createdAt) {
} this.createdAt = createdAt;
}
} }
...@@ -5,136 +5,145 @@ import org.codehaus.jackson.annotate.JsonProperty; ...@@ -5,136 +5,145 @@ import org.codehaus.jackson.annotate.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;
private Integer _iid; private Integer iid;
private String _title; private String title;
private String _state; private String state;
private String _description; private String description;
private boolean _closed; private boolean closed;
private boolean _merged; private boolean merged;
private GitlabUser _author; private GitlabUser author;
private GitlabUser _assignee; private GitlabUser assignee;
@JsonProperty("target_branch") @JsonProperty("target_branch")
private String _targetBranch; private String targetBranch;
@JsonProperty("source_branch") @JsonProperty("source_branch")
private String _sourceBranch; private String sourceBranch;
@JsonProperty("project_id") @JsonProperty("project_id")
private Integer _projectId; private Integer projectId;
@JsonProperty("source_project_id") @JsonProperty("source_project_id")
private Integer _sourceProjectId; private Integer sourceProjectId;
@JsonProperty("milestone_id") @JsonProperty("milestone_id")
private Integer _milestone_id; private Integer milestoneId;
public Integer getId() { public Integer getId() {
return _id; return id;
} }
public void setId(Integer id) { public void setId(Integer id) {
_id = id; this.id = id;
} }
public Integer getMilestoneId(){ return _milestone_id; } public Integer getMilestoneId() {
public void setMilestoneId(Integer id) { _milestone_id = id; } return milestoneId;
}
public void setMilestoneId(Integer id) {
milestoneId = id;
}
public Integer getIid() { public Integer getIid() {
return _iid; return iid;
} }
public void setIid(Integer iid) { public void setIid(Integer iid) {
_iid = iid; this.iid = iid;
} }
public String getTargetBranch() { public String getTargetBranch() {
return _targetBranch; return targetBranch;
} }
public void setTargetBranch(String targetBranch) { public void setTargetBranch(String targetBranch) {
_targetBranch = targetBranch; this.targetBranch = targetBranch;
} }
public String getSourceBranch() { public String getSourceBranch() {
return _sourceBranch; return sourceBranch;
} }
public void setSourceBranch(String sourceBranch) { public void setSourceBranch(String sourceBranch) {
_sourceBranch = sourceBranch; this.sourceBranch = sourceBranch;
} }
public Integer getProjectId() { public Integer getProjectId() {
return _projectId; return projectId;
} }
public void setProjectId(Integer projectId) { public void setProjectId(Integer projectId) {
_projectId = projectId; this.projectId = projectId;
} }
public Integer getSourceProjectId() { public Integer getSourceProjectId() {
return _sourceProjectId; return sourceProjectId;
} }
public void setSourceProjectId(Integer sourceProjectId) { public void setSourceProjectId(Integer sourceProjectId) {
_sourceProjectId = sourceProjectId; this.sourceProjectId = sourceProjectId;
} }
public String getTitle() { public String getTitle() {
return _title; return title;
} }
public void setTitle(String title) { public void setTitle(String title) {
_title = title; this.title = title;
} }
public String getDescription() { return _description; } public String getDescription() {
return description;
}
public void setDescription(String d) { _description = d; } public void setDescription(String d) {
description = d;
}
public boolean isClosed() { public boolean isClosed() {
return _closed; return closed;
} }
public void setClosed(boolean closed) { public void setClosed(boolean closed) {
_closed = closed; this.closed = closed;
} }
public boolean isMerged() { public boolean isMerged() {
return _merged; return merged;
} }
public void setMerged(boolean merged) { public void setMerged(boolean merged) {
_merged = merged; this.merged = merged;
} }
public GitlabUser getAuthor() { public GitlabUser getAuthor() {
return _author; return author;
} }
public void setAuthor(GitlabUser author) { public void setAuthor(GitlabUser author) {
_author = author; this.author = author;
} }
public GitlabUser getAssignee() { public GitlabUser getAssignee() {
return _assignee; return assignee;
} }
public void setAssignee(GitlabUser assignee) { public void setAssignee(GitlabUser assignee) {
_assignee = assignee; this.assignee = assignee;
} }
public String getState() { public String getState() {
return _state; return state;
} }
public void setState(String state) { public void setState(String state) {
_state = state; this.state = state;
if(state != null) { if (state != null) {
_closed = state.equals("closed"); closed = state.equals("closed");
_merged = state.equals("merged"); merged = state.equals("merged");
} }
} }
} }
package org.gitlab.api.models; package org.gitlab.api.models;
import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import java.util.Date;
public class GitlabMilestone { public class GitlabMilestone {
public static final String URL = "/milestones"; public static final String URL = "/milestones";
private int _id; private int id;
private int _iid; private int iid;
private int _projectId; private int projectId;
private String _title; private String title;
private String _description; private String description;
@JsonProperty("due_date") @JsonProperty("due_date")
private Date _dueDate; private Date dueDate;
private String _state; private String state;
@JsonProperty("updated_date") @JsonProperty("updated_date")
private Date _updatedDate; private Date updatedDate;
@JsonProperty("created_date") @JsonProperty("created_date")
private Date _createdDate; private Date createdDate;
public int getId() { public int getId() {
return _id; return id;
} }
public void setId(int id) { public void setId(int id) {
_id = id; this.id = id;
} }
public int getIid() { public int getIid() {
return _iid; return iid;
} }
public void setIid(int iid) { public void setIid(int iid) {
_iid = iid; this.iid = iid;
} }
public int getProjectId() { public int getProjectId() {
return _projectId; return projectId;
} }
public void setProjectId(int projectId) { public void setProjectId(int projectId) {
_projectId = projectId; this.projectId = projectId;
} }
public String getTitle() { public String getTitle() {
return _title; return title;
} }
public void setTitle(String title) { public void setTitle(String title) {
_title = title; this.title = title;
} }
public String getDescription() { public String getDescription() {
return _description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
_description = description; this.description = description;
} }
public Date getDueDate() { public Date getDueDate() {
return _dueDate; return dueDate;
} }
public void setDueDate(Date dueDate) { public void setDueDate(Date dueDate) {
_dueDate = dueDate; this.dueDate = dueDate;
} }
public String getState() { public String getState() {
return _state; return state;
} }
public void setState(String state) { public void setState(String state) {
_state = state; this.state = state;
} }
public Date getUpdatedDate() { public Date getUpdatedDate() {
return _updatedDate; return updatedDate;
} }
public void setUpdatedDate(Date updatedDate) { public void setUpdatedDate(Date updatedDate) {
_updatedDate = updatedDate; this.updatedDate = updatedDate;
} }
public Date getCreatedDate() { public Date getCreatedDate() {
return _createdDate; return createdDate;
} }
public void setCreatedDate(Date createdDate) { public void setCreatedDate(Date createdDate) {
_createdDate = createdDate; this.createdDate = createdDate;
} }
} }
package org.gitlab.api.models; package org.gitlab.api.models;
import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import java.util.Date;
public class GitlabNamespace { public class GitlabNamespace {
public static final String URL = "/groups"; public static final String URL = "/groups";
private Integer _id; private Integer id;
private String _name; private String name;
private String _path; private String path;
private String _description; private String description;
@JsonProperty("created_at") @JsonProperty("created_at")
private Date _createdAt; private Date createdAt;
@JsonProperty("updated_at") @JsonProperty("updated_at")
private Date _updatedAt; private Date updatedAt;
@JsonProperty("owner_id") @JsonProperty("owner_id")
private Integer _ownerId; private Integer ownerId;
public Integer getId() { public Integer getId() {
return _id; return id;
} }
public void setId(Integer id) { public void setId(Integer id) {
_id = id; this.id = id;
} }
public Date getCreatedAt() { public Date getCreatedAt() {
return _createdAt; return createdAt;
} }
public void setCreatedAt(Date createdAt) { public void setCreatedAt(Date createdAt) {
_createdAt = createdAt; this.createdAt = createdAt;
} }
public Date getUpdatedAt() { public Date getUpdatedAt() {
return _updatedAt; return updatedAt;
} }
public void setUpdatedAt(Date updatedAt) { public void setUpdatedAt(Date updatedAt) {
_updatedAt = updatedAt; this.updatedAt = updatedAt;
} }
public Integer getOwnerId() { public Integer getOwnerId() {
return _ownerId; return ownerId;
} }
public void setOwnerId(Integer ownerId) { public void setOwnerId(Integer ownerId) {
_ownerId = ownerId; this.ownerId = ownerId;
} }
public String getName() { public String getName() {
return _name; return name;
} }
public void setName(String name) { public void setName(String name) {
_name = name; this.name = name;
} }
public String getPath() { public String getPath() {
return _path; return path;
} }
public void setPath(String path) { public void setPath(String path) {
_path = path; this.path = path;
} }
public String getDescription() { public String getDescription() {
return _description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
_description = description; this.description = description;
} }
} }
package org.gitlab.api.models; package org.gitlab.api.models;
import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import java.util.Date;
public class GitlabNote { public class GitlabNote {
public static final String URL = "/notes"; public static final String URL = "/notes";
private Integer _id; private Integer id;
private String _body; private String body;
private String _attachment; private String attachment;
private GitlabUser _author; private GitlabUser author;
@JsonProperty("created_at") @JsonProperty("created_at")
private Date _createdAt; private Date createdAt;
public Integer getId() { public Integer getId() {
return _id; return id;
} }
public void setId(Integer id) { public void setId(Integer id) {
_id = id; this.id = id;
} }
public String getBody() { public String getBody() {
return _body; return body;
} }
public void setBody(String body) { public void setBody(String body) {
_body = body; this.body = body;
} }
public GitlabUser getAuthor() { public GitlabUser getAuthor() {
return _author; return author;
} }
public void setAuthor(GitlabUser author) { public void setAuthor(GitlabUser author) {
_author = author; this.author = author;
} }
public Date getCreatedAt() { public Date getCreatedAt() {
return _createdAt; return createdAt;
} }
public void setCreatedAt(Date createdAt) { public void setCreatedAt(Date createdAt) {
_createdAt = createdAt; this.createdAt = createdAt;
} }
public String getAttachment() { public String getAttachment() {
return _attachment; return attachment;
} }
public void setAttachment(String attachment) { public void setAttachment(String attachment) {
_attachment = attachment; this.attachment = attachment;
} }
} }
package org.gitlab.api.models;
import org.codehaus.jackson.annotate.JsonProperty;
public class GitlabPermission {
@JsonProperty("project_access")
private GitlabProjectAccessLevel projectAccess;
@JsonProperty("group_access")
private GitlabProjectAccessLevel groupAccess;
public GitlabProjectAccessLevel getProjectAccess() {
return projectAccess;
}
public GitlabProjectAccessLevel getProjectGroupAccess() {
return groupAccess;
}
}
package org.gitlab.api.models;
import org.codehaus.jackson.annotate.JsonProperty;
public class GitlabPersmission {
@JsonProperty("project_access")
private GitlabProjectAccessLevel _projectAccess;
@JsonProperty("group_access")
private GitlabProjectAccessLevel _groupAccess;
public GitlabProjectAccessLevel getProjectAccess() {
return _projectAccess;
}
public GitlabProjectAccessLevel getProjectGroupAccess() {
return _groupAccess;
}
}
package org.gitlab.api.models; package org.gitlab.api.models;
import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import java.util.Date;
public class GitlabProject { public class GitlabProject {
public static final String URL = "/projects"; public static final String URL = "/projects";
private Integer _id; private Integer id;
private String _name; private String name;
@JsonProperty("name_with_namespace") @JsonProperty("name_with_namespace")
private String _nameWithNamespace; private String nameWithNamespace;
private String _description; private String description;
@JsonProperty("default_branch") @JsonProperty("default_branch")
private String _defaultBranch; private String defaultBranch;
private GitlabUser _owner; private GitlabUser owner;
private boolean _public; private boolean publicProject;
private String _path; private String path;
@JsonProperty("visibility_level") @JsonProperty("visibility_level")
private Integer _visibilityLevel; private Integer visibilityLevel;
@JsonProperty("path_with_namespace") @JsonProperty("path_with_namespace")
private String _pathWithNamespace; private String pathWithNamespace;
@JsonProperty("issues_enabled") @JsonProperty("issues_enabled")
private boolean _issuesEnabled; private boolean issuesEnabled;
@JsonProperty("merge_requests_enabled") @JsonProperty("merge_requests_enabled")
private boolean _mergeRequestsEnabled; private boolean mergeRequestsEnabled;
@JsonProperty("snippets_enabled") @JsonProperty("snippets_enabled")
private boolean _snippetsEnabled; private boolean snippetsEnabled;
@JsonProperty("wall_enabled") @JsonProperty("wall_enabled")
private boolean _wallEnabled; private boolean wallEnabled;
@JsonProperty("wiki_enabled") @JsonProperty("wiki_enabled")
private boolean _wikiEnabled; private boolean wikiEnabled;
@JsonProperty("created_at") @JsonProperty("created_at")
private Date _createdAt; private Date createdAt;
@JsonProperty("ssh_url_to_repo") @JsonProperty("ssh_url_to_repo")
private String _sshUrl; private String sshUrl;
@JsonProperty("web_url") @JsonProperty("web_url")
private String _webUrl; private String webUrl;
@JsonProperty("http_url_to_repo") @JsonProperty("http_url_to_repo")
private String _httpUrl; private String httpUrl;
@JsonProperty("last_activity_at") @JsonProperty("last_activity_at")
private Date _lastActivityAt; private Date lastActivityAt;
@JsonProperty("archived") @JsonProperty("archived")
private boolean _archived; private boolean archived;
private GitlabNamespace namespace;
private GitlabNamespace _namespace;
@JsonProperty("permissions") @JsonProperty("permissions")
private GitlabPersmission _permissions; private GitlabPermission permissions;
public Integer getId() { public Integer getId() {
return _id; return id;
} }
public void setId(Integer id) { public void setId(Integer id) {
_id = id; this.id = id;
} }
public String getName() { public String getName() {
return _name; return name;
} }
public void setName(String name) { public void setName(String name) {
_name = name; this.name = name;
} }
public String getNameWithNamespace() { public String getNameWithNamespace() {
return _nameWithNamespace; return nameWithNamespace;
} }
public void setNameWithNamespace(String nameWithNamespace) { public void setNameWithNamespace(String nameWithNamespace) {
this._nameWithNamespace = nameWithNamespace; this.nameWithNamespace = nameWithNamespace;
} }
public String getDescription() { public String getDescription() {
return _description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
_description = description; this.description = description;
} }
public String getDefaultBranch() { public String getDefaultBranch() {
return _defaultBranch; return defaultBranch;
} }
public void setDefaultBranch(String defaultBranch) { public void setDefaultBranch(String defaultBranch) {
_defaultBranch = defaultBranch; this.defaultBranch = defaultBranch;
} }
public Integer getVisibilityLevel() { public Integer getVisibilityLevel() {
return _visibilityLevel; return visibilityLevel;
} }
public void setVisibilityLevel(Integer visibilityLevel) { public void setVisibilityLevel(Integer visibilityLevel) {
this._visibilityLevel = visibilityLevel; this.visibilityLevel = visibilityLevel;
} }
public GitlabUser getOwner() { public GitlabUser getOwner() {
return _owner; return owner;
} }
public void setOwner(GitlabUser owner) { public void setOwner(GitlabUser owner) {
_owner = owner; this.owner = owner;
} }
public String getPath() { public String getPath() {
return _path; return path;
} }
public void setPath(String path) { public void setPath(String path) {
_path = path; this.path = path;
} }
public String getPathWithNamespace() { public String getPathWithNamespace() {
return _pathWithNamespace; return pathWithNamespace;
} }
public void setPathWithNamespace(String pathWithNamespace) { public void setPathWithNamespace(String pathWithNamespace) {
_pathWithNamespace = pathWithNamespace; this.pathWithNamespace = pathWithNamespace;
} }
public boolean isIssuesEnabled() { public boolean isIssuesEnabled() {
return _issuesEnabled; return issuesEnabled;
} }
public void setIssuesEnabled(boolean issuesEnabled) { public void setIssuesEnabled(boolean issuesEnabled) {
_issuesEnabled = issuesEnabled; this.issuesEnabled = issuesEnabled;
} }
public boolean isMergeRequestsEnabled() { public boolean isMergeRequestsEnabled() {
return _mergeRequestsEnabled; return mergeRequestsEnabled;
} }
public void setMergeRequestsEnabled(boolean mergeRequestsEnabled) { public void setMergeRequestsEnabled(boolean mergeRequestsEnabled) {
_mergeRequestsEnabled = mergeRequestsEnabled; this.mergeRequestsEnabled = mergeRequestsEnabled;
} }
public boolean isSnippetsEnabled() { public boolean isSnippetsEnabled() {
return _snippetsEnabled; return snippetsEnabled;
} }
public void setSnippetsEnabled(boolean snippetsEnabled) { public void setSnippetsEnabled(boolean snippetsEnabled) {
this._snippetsEnabled = snippetsEnabled; this.snippetsEnabled = snippetsEnabled;
} }
public boolean isWallEnabled() { public boolean isWallEnabled() {
return _wallEnabled; return wallEnabled;
} }
public void setWallEnabled(boolean wallEnabled) { public void setWallEnabled(boolean wallEnabled) {
_wallEnabled = wallEnabled; this.wallEnabled = wallEnabled;
} }
public boolean isWikiEnabled() { public boolean isWikiEnabled() {
return _wikiEnabled; return wikiEnabled;
} }
public void setWikiEnabled(boolean wikiEnabled) { public void setWikiEnabled(boolean wikiEnabled) {
_wikiEnabled = wikiEnabled; this.wikiEnabled = wikiEnabled;
} }
public Date getCreatedAt() { public Date getCreatedAt() {
return _createdAt; return createdAt;
} }
public void setCreatedAt(Date createdAt) { public void setCreatedAt(Date createdAt) {
_createdAt = createdAt; this.createdAt = createdAt;
} }
public String getSshUrl() { public String getSshUrl() {
return _sshUrl; return sshUrl;
} }
public void setSshUrl(String sshUrl) { public void setSshUrl(String sshUrl) {
_sshUrl = sshUrl; this.sshUrl = sshUrl;
} }
public String getWebUrl() { public String getWebUrl() {
return _webUrl; return webUrl;
} }
public void setWebUrl(String webUrl) { public void setWebUrl(String webUrl) {
_webUrl = webUrl; this.webUrl = webUrl;
} }
public String getHttpUrl() { public String getHttpUrl() {
return _httpUrl; return httpUrl;
} }
public void setHttpUrl(String httpUrl) { public void setHttpUrl(String httpUrl) {
_httpUrl = httpUrl; this.httpUrl = httpUrl;
} }
public GitlabNamespace getNamespace() { public GitlabNamespace getNamespace() {
return _namespace; return namespace;
} }
public void setNamespace(GitlabNamespace namespace) { public void setNamespace(GitlabNamespace namespace) {
_namespace = namespace; this.namespace = namespace;
} }
public boolean isPublic() { public boolean isPublic() {
return _public; return publicProject;
} }
public void setPublic(boolean aPublic) { public void setPublic(boolean aPublic) {
_public = aPublic; publicProject = aPublic;
} }
public boolean isArchived() { public boolean isArchived() {
return _archived; return archived;
} }
public void setArchived(boolean archived) { public void setArchived(boolean archived) {
_archived = archived; this.archived = archived;
} }
public Date getLastActivityAt() { public Date getLastActivityAt() {
return _lastActivityAt; return lastActivityAt;
} }
public void setLastActivityAt(Date lastActivityAt) { public void setLastActivityAt(Date lastActivityAt) {
_lastActivityAt = lastActivityAt; this.lastActivityAt = lastActivityAt;
} }
public GitlabPersmission getPermissions() { public GitlabPermission getPermissions() {
return _permissions; return permissions;
} }
public void setPermissions(GitlabPersmission permissions) { public void setPermissions(GitlabPermission permissions) {
this._permissions = permissions; this.permissions = permissions;
} }
} }
...@@ -4,29 +4,29 @@ import org.codehaus.jackson.annotate.JsonProperty; ...@@ -4,29 +4,29 @@ import org.codehaus.jackson.annotate.JsonProperty;
public class GitlabProjectAccessLevel { public class GitlabProjectAccessLevel {
@JsonProperty("access_level") @JsonProperty("access_level")
private int _accessLevel; private int accessLevel;
@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);
} }
public void setAccessLevel(GitlabAccessLevel accessLevel) { public void setAccessLevel(GitlabAccessLevel accessLevel) {
_accessLevel = accessLevel.accessValue; this.accessLevel = accessLevel.accessValue;
} }
public int getNoficationLevel() { public int getNoficationLevel() {
return _notificationLevel; return notificationLevel;
} }
public void setNoficationLevel(int notificationLevel) { public void setNoficationLevel(int notificationLevel) {
this._accessLevel=notificationLevel; this.accessLevel = notificationLevel;
} }
} }
package org.gitlab.api.models; package org.gitlab.api.models;
import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import java.util.Date;
public class GitlabProjectHook { public class GitlabProjectHook {
public final static String URL = "/hooks"; public final static String URL = "/hooks";
private String _id; private String id;
private String _url; private String url;
private Integer projectId;
private Integer _projectId;
@JsonProperty("push_events") @JsonProperty("push_events")
private boolean _pushEvents; private boolean pushEvents;
@JsonProperty("issues_events") @JsonProperty("issues_events")
private boolean _issueEvents; private boolean issueEvents;
@JsonProperty("merge_requests_events") @JsonProperty("merge_requests_events")
private boolean _mergeRequestsEvents; private boolean mergeRequestsEvents;
@JsonProperty("created_at") @JsonProperty("created_at")
private Date _createdAt; private Date createdAt;
public String getId() {
public String getId() { return id;
return _id;
} }
public void setId(String id) { public void setId(String id) {
_id = id; this.id = id;
} }
public String getUrl() { public String getUrl() {
return _url; return url;
} }
public void setUrl(String url) { public void setUrl(String url) {
this._url = url; this.url = url;
} }
public Integer getProjectId() {
return _projectId;
}
public void setProjectId(Integer projectId) { public Integer getProjectId() {
_projectId = projectId; return projectId;
} }
public boolean getPushEvents() { public void setProjectId(Integer projectId) {
return _pushEvents; this.projectId = projectId;
} }
public boolean getPushEvents() {
return pushEvents;
}
public void setPushEvents(boolean pushEvents) { public void setPushEvents(boolean pushEvents) {
_pushEvents = pushEvents; this.pushEvents = pushEvents;
} }
public boolean getIssueEvents() { public boolean getIssueEvents() {
return _issueEvents; return issueEvents;
} }
public void setIssueEvents(boolean issueEvents) { public void setIssueEvents(boolean issueEvents) {
_issueEvents = issueEvents; this.issueEvents = issueEvents;
} }
public boolean isMergeRequestsEvents() { public boolean isMergeRequestsEvents() {
return _mergeRequestsEvents; return mergeRequestsEvents;
} }
public void setMergeRequestsEvents(boolean mergeRequestsEvents) { public void setMergeRequestsEvents(boolean mergeRequestsEvents) {
_mergeRequestsEvents = mergeRequestsEvents; this.mergeRequestsEvents = mergeRequestsEvents;
} }
public Date getCreatedAt() { public Date getCreatedAt() {
return _createdAt; return createdAt;
} }
public void setCreatedAt(Date createdAt) { public void setCreatedAt(Date createdAt) {
_createdAt = createdAt; this.createdAt = createdAt;
} }
} }
\ No newline at end of file
...@@ -3,17 +3,18 @@ package org.gitlab.api.models; ...@@ -3,17 +3,18 @@ package org.gitlab.api.models;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
public class GitlabSession extends GitlabUser { public class GitlabSession extends GitlabUser {
public static final String URL = "/session";
@JsonProperty("private_token")
private String _privateToken;
public String getPrivateToken() { public static final String URL = "/session";
return _privateToken;
} @JsonProperty("private_token")
private String privateToken;
public String getPrivateToken() {
return privateToken;
}
public void setPrivateToken(String privateToken) {
this.privateToken = privateToken;
}
public void setPrivateToken(String privateToken) {
_privateToken = privateToken;
}
} }
package org.gitlab.api.models; package org.gitlab.api.models;
import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import java.util.Date;
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";
...@@ -18,16 +19,16 @@ public class GitlabUser { ...@@ -18,16 +19,16 @@ public class GitlabUser {
private String _provider; private String _provider;
private String _state; private String _state;
private boolean _blocked; private boolean _blocked;
@JsonProperty("private_token") @JsonProperty("private_token")
private String _privateToken; private String _privateToken;
@JsonProperty("color_scheme_id") @JsonProperty("color_scheme_id")
private Integer _colorSchemeId; private Integer _colorSchemeId;
@JsonProperty("provider") @JsonProperty("provider")
private String _externProviderName; private String _externProviderName;
@JsonProperty("website_url") @JsonProperty("website_url")
private String _websiteUrl; private String _websiteUrl;
...@@ -57,7 +58,7 @@ public class GitlabUser { ...@@ -57,7 +58,7 @@ public class GitlabUser {
@JsonProperty("can_create_team") @JsonProperty("can_create_team")
private boolean _canCreateTeam; private boolean _canCreateTeam;
@JsonProperty("avatar_url") @JsonProperty("avatar_url")
private String _avatarUrl; private String _avatarUrl;
...@@ -180,21 +181,21 @@ public class GitlabUser { ...@@ -180,21 +181,21 @@ public class GitlabUser {
public void setState(String state) { public void setState(String state) {
_state = state; _state = state;
} }
public String getExternProviderName() { public String getExternProviderName() {
return _externProviderName; return _externProviderName;
} }
public void setExternProviderName(String externProviderName) { public void setExternProviderName(String externProviderName) {
_externProviderName = externProviderName; _externProviderName = externProviderName;
} }
public String getWebsiteUrl() { public String getWebsiteUrl() {
return _websiteUrl; return _websiteUrl;
} }
public void setWebsiteUrl(String websiteUrl) { public void setWebsiteUrl(String websiteUrl) {
_websiteUrl = websiteUrl; _websiteUrl = websiteUrl;
} }
public boolean isAdmin() { public boolean isAdmin() {
...@@ -229,27 +230,27 @@ public class GitlabUser { ...@@ -229,27 +230,27 @@ public class GitlabUser {
_canCreateTeam = canCreateTeam; _canCreateTeam = canCreateTeam;
} }
public String getAvatarUrl() { public String getAvatarUrl() {
return _avatarUrl; return _avatarUrl;
} }
public void setAvatarUrl(String avatarUrl) { public void setAvatarUrl(String avatarUrl) {
this._avatarUrl = avatarUrl; this._avatarUrl = avatarUrl;
} }
public Integer getColorSchemeId() { public Integer getColorSchemeId() {
return _colorSchemeId; return _colorSchemeId;
} }
public void setColorSchemeId(Integer colorSchemeId) { public void setColorSchemeId(Integer colorSchemeId) {
this._colorSchemeId = colorSchemeId; this._colorSchemeId = colorSchemeId;
} }
public String getPrivateToken() { public String getPrivateToken() {
return _privateToken; return _privateToken;
} }
public void setPrivateToken(String privateToken) { public void setPrivateToken(String privateToken) {
this._privateToken = privateToken; this._privateToken = privateToken;
} }
} }
package org.gitlab.api; package org.gitlab.api;
import org.gitlab.api.models.GitlabUser; import org.gitlab.api.models.GitlabUser;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.net.ConnectException;
import java.net.URL; import java.net.URL;
import java.util.UUID; import java.util.UUID;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assume.assumeNoException; import static org.junit.Assume.assumeNoException;
import java.net.ConnectException;
public class GitlabAPIT { public class GitlabAPIT {
GitlabAPI _api; GitlabAPI api;
private static final String TEST_URL = System.getProperty("TEST_URL", "http://localhost"); private static final String TEST_URL = System.getProperty("TEST_URL", "http://localhost");
private static final String TEST_TOKEN = System.getProperty("TEST_TOKEN", "y0E5b9761b7y4qk"); private static final String TEST_TOKEN = System.getProperty("TEST_TOKEN", "y0E5b9761b7y4qk");
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);
try { try {
_api.dispatch().with("login", "INVALID").with("password", rand).to("session", GitlabUser.class); api.dispatch().with("login", "INVALID").with("password", rand).to("session", GitlabUser.class);
} catch (ConnectException e) { } catch (ConnectException e) {
assumeNoException("GITLAB not running on '" + TEST_URL + "', skipping...", e); assumeNoException("GITLAB not running on '" + TEST_URL + "', skipping...", e);
} catch (IOException e) { } catch (IOException e) {
...@@ -43,78 +40,77 @@ public class GitlabAPIT { ...@@ -43,78 +40,77 @@ public class GitlabAPIT {
@Test @Test
public void testConnect() throws IOException { public void testConnect() throws IOException {
assertEquals(GitlabAPI.class, _api.getClass()); assertEquals(GitlabAPI.class, api.getClass());
} }
@Test @Test
public void testGetAPIUrl() throws IOException { public void testGetAPIUrl() throws IOException {
URL expected = new URL(TEST_URL+"/api/v3/?private_token="+TEST_TOKEN); URL expected = new URL(TEST_URL + "/api/v3/?private_token=" + TEST_TOKEN);
assertEquals(expected, _api.getAPIUrl("")); assertEquals(expected, api.getAPIUrl(""));
} }
@Test @Test
public void testGetUrl() throws IOException { public void testGetUrl() throws IOException {
URL expected = new URL(TEST_URL); URL expected = new URL(TEST_URL);
assertEquals(expected +"/", _api.getUrl("").toString()); assertEquals(expected + "/", api.getUrl("").toString());
} }
@Test @Test
public void testCreateUpdateDeleteUser() throws IOException { public void testCreateUpdateDeleteUser() throws IOException {
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"),
randVal("fullName"), randVal("fullName"),
randVal("skypeId"), randVal("skypeId"),
randVal("linledin"), randVal("linledin"),
randVal("twitter"), randVal("twitter"),
"http://"+randVal("url.com"), "http://" + randVal("url.com"),
10, 10,
randVal("externuid"), randVal("externuid"),
randVal("externprovidername"), randVal("externprovidername"),
randVal("bio"), randVal("bio"),
false, false,
false, false,
false); false);
Assert.assertNotNull(gitUser); assertNotNull(gitUser);
GitlabUser refetched = _api.getUserViaSudo(gitUser.getUsername()); GitlabUser refetched = api.getUserViaSudo(gitUser.getUsername());
Assert.assertNotNull(refetched); assertNotNull(refetched);
Assert.assertEquals(refetched.getUsername(),gitUser.getUsername()); assertEquals(refetched.getUsername(), gitUser.getUsername());
_api.updateUser(gitUser.getId(), gitUser.getEmail(), password , gitUser.getUsername(), api.updateUser(gitUser.getId(), gitUser.getEmail(), password, gitUser.getUsername(),
gitUser.getName(), "newSkypeId", gitUser.getLinkedin(), gitUser.getTwitter(), gitUser.getWebsiteUrl(), gitUser.getName(), "newSkypeId", gitUser.getLinkedin(), gitUser.getTwitter(), gitUser.getWebsiteUrl(),
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(), false); gitUser.getBio(), gitUser.isAdmin(), gitUser.isCanCreateGroup(), false);
GitlabUser postUpdate = _api.getUserViaSudo(gitUser.getUsername()); GitlabUser postUpdate = api.getUserViaSudo(gitUser.getUsername());
Assert.assertNotNull(postUpdate); assertNotNull(postUpdate);
Assert.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
try { try {
GitlabUser shouldNotExist = _api.getUser(postUpdate.getId()); GitlabUser shouldNotExist = api.getUser(postUpdate.getId());
Assert.assertNull(shouldNotExist); // should never even get here assertNull(shouldNotExist);
} catch (FileNotFoundException thisIsSoOddForAnRESTApiClient) {
} catch(FileNotFoundException thisIsSoOddForAnRESTApiClient) { assertTrue(true); // expected
Assert.assertTrue(true); // expected }
}
} }
private String randVal(String postfix) { private String randVal(String postfix) {
return rand + "-" + postfix; return rand + "-" + postfix;
} }
} }
package org.gitlab.api.http; package org.gitlab.api.http;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import static org.junit.Assert.assertEquals;
public class QueryTest { public class QueryTest {
@Test @Test
...@@ -20,8 +21,8 @@ public class QueryTest { ...@@ -20,8 +21,8 @@ public class QueryTest {
@Test @Test
public void fluentStyle_append() throws UnsupportedEncodingException { public void fluentStyle_append() throws UnsupportedEncodingException {
Query query = new Query() Query query = new Query()
.append("p1", "v1") .append("p1", "v1")
.append("p2", "v2"); .append("p2", "v2");
assertEquals("?p1=v1&p2=v2", query.toString()); assertEquals("?p1=v1&p2=v2", query.toString());
} }
...@@ -42,8 +43,8 @@ public class QueryTest { ...@@ -42,8 +43,8 @@ public class QueryTest {
@Test @Test
public void conditionalAppend_notNull() throws UnsupportedEncodingException { public void conditionalAppend_notNull() throws UnsupportedEncodingException {
Query query = new Query() Query query = new Query()
.appendIf("p1", "v1") .appendIf("p1", "v1")
.appendIf("p2", "v2"); .appendIf("p2", "v2");
assertEquals("?p1=v1&p2=v2", query.toString()); assertEquals("?p1=v1&p2=v2", query.toString());
} }
...@@ -51,7 +52,7 @@ public class QueryTest { ...@@ -51,7 +52,7 @@ public class QueryTest {
@Test @Test
public void conditionalAppend_null() throws UnsupportedEncodingException { public void conditionalAppend_null() throws UnsupportedEncodingException {
Query query = new Query() Query query = new Query()
.appendIf("p1", (String) null); .appendIf("p1", (String) null);
assertEquals("", query.toString()); assertEquals("", query.toString());
} }
...@@ -59,7 +60,7 @@ public class QueryTest { ...@@ -59,7 +60,7 @@ public class QueryTest {
@Test @Test
public void conditionalAppend_null_notNull() throws UnsupportedEncodingException { public void conditionalAppend_null_notNull() throws UnsupportedEncodingException {
Query query = new Query() Query query = new Query()
.appendIf("p1", (String)null) .appendIf("p1", (String) null)
.appendIf("p2", "v2"); .appendIf("p2", "v2");
assertEquals("?p2=v2", query.toString()); assertEquals("?p2=v2", query.toString());
...@@ -68,8 +69,8 @@ public class QueryTest { ...@@ -68,8 +69,8 @@ public class QueryTest {
@Test @Test
public void append_encodes_values() throws UnsupportedEncodingException { public void append_encodes_values() throws UnsupportedEncodingException {
Query query = new Query() Query query = new Query()
.append("p1", "v 1") .append("p1", "v 1")
.append("p2", "v 2"); .append("p2", "v 2");
assertEquals("?p1=v+1&p2=v+2", query.toString()); assertEquals("?p1=v+1&p2=v+2", query.toString());
} }
......
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