diff --git a/src/main/java/org/gitlab4j/api/models/AbstractUser.java b/src/main/java/org/gitlab4j/api/models/AbstractUser.java index df7e59054..72dab0ecd 100644 --- a/src/main/java/org/gitlab4j/api/models/AbstractUser.java +++ b/src/main/java/org/gitlab4j/api/models/AbstractUser.java @@ -1,7 +1,6 @@ package org.gitlab4j.api.models; import java.util.Date; -import java.util.List; import org.gitlab4j.api.utils.JacksonJson; @@ -11,37 +10,13 @@ public abstract class AbstractUser> { private String avatarUrl; - private String bio; - private Boolean canCreateGroup; - private Boolean canCreateProject; - private Integer colorSchemeId; - private Date confirmedAt; private Date createdAt; - private Date currentSignInAt; - private List customAttributes; private String email; - private Boolean external; private Integer id; - private List identities; - private Boolean isAdmin; - private Date lastActivityOn; - private Date lastSignInAt; - private String linkedin; - private String location; private String name; - private String organization; - private Integer projectsLimit; - private String provider; - private Integer sharedRunnersMinutesLimit; - private String skype; private String state; - private Integer themeId; - private String twitter; - private Boolean twoFactorEnabled; private String username; - private String websiteUrl; private String webUrl; - private Boolean skipConfirmation; public String getAvatarUrl() { return avatarUrl; @@ -51,46 +26,6 @@ public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; } - public String getBio() { - return bio; - } - - public void setBio(String bio) { - this.bio = bio; - } - - public Boolean getCanCreateGroup() { - return canCreateGroup; - } - - public void setCanCreateGroup(Boolean canCreateGroup) { - this.canCreateGroup = canCreateGroup; - } - - public Boolean getCanCreateProject() { - return canCreateProject; - } - - public void setCanCreateProject(Boolean canCreateProject) { - this.canCreateProject = canCreateProject; - } - - public Integer getColorSchemeId() { - return colorSchemeId; - } - - public void setColorSchemeId(Integer colorSchemeId) { - this.colorSchemeId = colorSchemeId; - } - - public Date getConfirmedAt() { - return confirmedAt; - } - - public void setConfirmedAt(Date confirmedAt) { - this.confirmedAt = confirmedAt; - } - public Date getCreatedAt() { return createdAt; } @@ -99,14 +34,6 @@ public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } - public Date getCurrentSignInAt() { - return currentSignInAt; - } - - public void setCurrentSignInAt(Date currentSignInAt) { - this.currentSignInAt = currentSignInAt; - } - public String getEmail() { return email; } @@ -115,14 +42,6 @@ public void setEmail(String email) { this.email = email; } - public Boolean getExternal() { - return external; - } - - public void setExternal(Boolean external) { - this.external = external; - } - public Integer getId() { return id; } @@ -131,54 +50,6 @@ public void setId(Integer id) { this.id = id; } - public List getIdentities() { - return identities; - } - - public void setIdentities(List identities) { - this.identities = identities; - } - - public Boolean getIsAdmin() { - return isAdmin; - } - - public void setIsAdmin(Boolean isAdmin) { - this.isAdmin = isAdmin; - } - - public Date getLastActivityOn() { - return lastActivityOn; - } - - public void setLastActivityOn(Date lastActivityOn) { - this.lastActivityOn = lastActivityOn; - } - - public Date getLastSignInAt() { - return lastSignInAt; - } - - public void setLastSignInAt(Date lastSignInAt) { - this.lastSignInAt = lastSignInAt; - } - - public String getLinkedin() { - return linkedin; - } - - public void setLinkedin(String linkedin) { - this.linkedin = linkedin; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - public String getName() { return name; } @@ -187,46 +58,6 @@ public void setName(String name) { this.name = name; } - public String getOrganization() { - return organization; - } - - public void setOrganization(String organization) { - this.organization = organization; - } - - public Integer getProjectsLimit() { - return projectsLimit; - } - - public void setProjectsLimit(Integer projectsLimit) { - this.projectsLimit = projectsLimit; - } - - public String getProvider() { - return provider; - } - - public void setProvider(String provider) { - this.provider = provider; - } - - public Integer getSharedRunnersMinutesLimit() { - return sharedRunnersMinutesLimit; - } - - public void setSharedRunnersMinutesLimit(Integer sharedRunnersMinutesLimit) { - this.sharedRunnersMinutesLimit = sharedRunnersMinutesLimit; - } - - public String getSkype() { - return skype; - } - - public void setSkype(String skype) { - this.skype = skype; - } - public String getState() { return state; } @@ -235,30 +66,6 @@ public void setState(String state) { this.state = state; } - public Integer getThemeId() { - return themeId; - } - - public void setThemeId(Integer themeId) { - this.themeId = themeId; - } - - public String getTwitter() { - return twitter; - } - - public void setTwitter(String twitter) { - this.twitter = twitter; - } - - public Boolean getTwoFactorEnabled() { - return twoFactorEnabled; - } - - public void setTwoFactorEnabled(Boolean twoFactorEnabled) { - this.twoFactorEnabled = twoFactorEnabled; - } - public String getUsername() { return username; } @@ -267,14 +74,6 @@ public void setUsername(String username) { this.username = username; } - public String getWebsiteUrl() { - return websiteUrl; - } - - public void setWebsiteUrl(String websiteUrl) { - this.websiteUrl = websiteUrl; - } - public String getWebUrl() { return webUrl; } @@ -283,214 +82,53 @@ public void setWebUrl(String webUrl) { this.webUrl = webUrl; } - public Boolean getSkipConfirmation() { - return skipConfirmation; - } - - public void setSkipConfirmation(Boolean skipConfirmation) { - this.skipConfirmation = skipConfirmation; - } - - public List getCustomAttributes() { - return customAttributes; - } - - public void setCustomAttributes(List customAttributes) { - this.customAttributes = customAttributes; - } - - @SuppressWarnings("unchecked") public U withAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; return (U)this; } - @SuppressWarnings("unchecked") - public U withBio(String bio) { - this.bio = bio; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withCanCreateGroup(Boolean canCreateGroup) { - this.canCreateGroup = canCreateGroup; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withCanCreateProject(Boolean canCreateProject) { - this.canCreateProject = canCreateProject; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withColorSchemeId(Integer colorSchemeId) { - this.colorSchemeId = colorSchemeId; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withConfirmedAt(Date confirmedAt) { - this.confirmedAt = confirmedAt; - return (U)this; - } - @SuppressWarnings("unchecked") public U withCreatedAt(Date createdAt) { this.createdAt = createdAt; return (U)this; } - @SuppressWarnings("unchecked") - public U withCurrentSignInAt(Date currentSignInAt) { - this.currentSignInAt = currentSignInAt; - return (U)this; - } - @SuppressWarnings("unchecked") public U withEmail(String email) { this.email = email; return (U)this; } - @SuppressWarnings("unchecked") - public U withExternal(Boolean external) { - this.external = external; - return (U)this; - } - @SuppressWarnings("unchecked") public U withId(Integer id) { this.id = id; return (U)this; } - @SuppressWarnings("unchecked") - public U withIdentities(List identities) { - this.identities = identities; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withIsAdmin(Boolean isAdmin) { - this.isAdmin = isAdmin; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withLastActivityOn(Date lastActivityOn) { - this.lastActivityOn = lastActivityOn; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withLastSignInAt(Date lastSignInAt) { - this.lastSignInAt = lastSignInAt; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withLinkedin(String linkedin) { - this.linkedin = linkedin; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withLocation(String location) { - this.location = location; - return (U)this; - } - @SuppressWarnings("unchecked") public U withName(String name) { this.name = name; return (U)this; } - @SuppressWarnings("unchecked") - public U withOrganization(String organization) { - this.organization = organization; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withProjectsLimit(Integer projectsLimit) { - this.projectsLimit = projectsLimit; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withProvider(String provider) { - this.provider = provider; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withSharedRunnersMinutesLimit(Integer sharedRunnersMinutesLimit) { - this.sharedRunnersMinutesLimit = sharedRunnersMinutesLimit; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withSkype(String skype) { - this.skype = skype; - return (U)this; - } - @SuppressWarnings("unchecked") public U withState(String state) { this.state = state; return (U)this; } - @SuppressWarnings("unchecked") - public U withThemeId(Integer themeId) { - this.themeId = themeId; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withTwitter(String twitter) { - this.twitter = twitter; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withTwoFactorEnabled(Boolean twoFactorEnabled) { - this.twoFactorEnabled = twoFactorEnabled; - return (U)this; - } - @SuppressWarnings("unchecked") public U withUsername(String username) { this.username = username; return (U)this; } - @SuppressWarnings("unchecked") - public U withWebsiteUrl(String websiteUrl) { - this.websiteUrl = websiteUrl; - return (U)this; - } - @SuppressWarnings("unchecked") public U withWebUrl(String webUrl) { this.webUrl = webUrl; return (U)this; } - - @SuppressWarnings("unchecked") - public U withSkipConfirmation(Boolean skipConfirmation) { - this.skipConfirmation = skipConfirmation; - return (U)this; - } - - @SuppressWarnings("unchecked") - public U withCustomAttributes(List customAttributes) { - this.customAttributes = customAttributes; - return (U)this; - } @Override public String toString() { diff --git a/src/main/java/org/gitlab4j/api/models/Contributor.java b/src/main/java/org/gitlab4j/api/models/Contributor.java index 176975944..b6670ae94 100644 --- a/src/main/java/org/gitlab4j/api/models/Contributor.java +++ b/src/main/java/org/gitlab4j/api/models/Contributor.java @@ -1,4 +1,36 @@ package org.gitlab4j.api.models; +/** + * This class models the object for a repository contributor. + * See Contributors at GitLab. + */ public class Contributor extends AbstractUser { + + private Integer commits; + private Integer additions; + private Integer deletions; + + public Integer getCommits() { + return commits; + } + + public void setCommits(Integer commits) { + this.commits = commits; + } + + public Integer getAdditions() { + return additions; + } + + public void setAdditions(Integer additions) { + this.additions = additions; + } + + public Integer getDeletions() { + return deletions; + } + + public void setDeletions(Integer deletions) { + this.deletions = deletions; + } } \ No newline at end of file diff --git a/src/main/java/org/gitlab4j/api/models/Member.java b/src/main/java/org/gitlab4j/api/models/Member.java index b036a7ffc..cfe56a74f 100644 --- a/src/main/java/org/gitlab4j/api/models/Member.java +++ b/src/main/java/org/gitlab4j/api/models/Member.java @@ -5,14 +5,10 @@ import org.gitlab4j.api.utils.JacksonJson; -public class Member { +public class Member extends AbstractUser { private AccessLevel accessLevel; - private Date createdAt; - private Integer id; - private String name; - private String state; - private String username; + private Date expiresAt; public AccessLevel getAccessLevel() { return this.accessLevel; @@ -22,44 +18,12 @@ public void setAccessLevel(AccessLevel accessLevel) { this.accessLevel = accessLevel; } - public Date getCreatedAt() { - return this.createdAt; + public Date getExpiresAt() { + return this.expiresAt; } - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Integer getId() { - return this.id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getUsername() { - return this.username; - } - - public void setUsername(String username) { - this.username = username; + public void setExpiresAt(Date expiresAt) { + this.expiresAt = expiresAt; } public Member withAccessLevel(AccessLevel accessLevel) { @@ -67,23 +31,8 @@ public Member withAccessLevel(AccessLevel accessLevel) { return this; } - public Member withCreatedAt(Date createdAt) { - this.createdAt = createdAt; - return this; - } - - public Member withId(Integer id) { - this.id = id; - return this; - } - - public Member withState(String state) { - this.state = state; - return this; - } - - public Member withUsername(String username) { - this.username = username; + public Member withExpiresAt(Date expiresAt) { + this.expiresAt = expiresAt; return this; } diff --git a/src/main/java/org/gitlab4j/api/models/Owner.java b/src/main/java/org/gitlab4j/api/models/Owner.java index 5dadf6f4d..441666fdb 100644 --- a/src/main/java/org/gitlab4j/api/models/Owner.java +++ b/src/main/java/org/gitlab4j/api/models/Owner.java @@ -1,41 +1,4 @@ package org.gitlab4j.api.models; -import java.util.Date; - -import org.gitlab4j.api.utils.JacksonJson; - -public class Owner { - - private Date createdAt; - private Integer id; - private String name; - - public Date getCreatedAt() { - return this.createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Integer getId() { - return this.id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return (JacksonJson.toJsonString(this)); - } +public class Owner extends AbstractUser { } diff --git a/src/main/java/org/gitlab4j/api/models/ProjectUser.java b/src/main/java/org/gitlab4j/api/models/ProjectUser.java index 23ccf9ede..135b96a76 100644 --- a/src/main/java/org/gitlab4j/api/models/ProjectUser.java +++ b/src/main/java/org/gitlab4j/api/models/ProjectUser.java @@ -1,66 +1,4 @@ package org.gitlab4j.api.models; -import org.gitlab4j.api.utils.JacksonJson; - -public class ProjectUser { - - private Integer id; - private String username; - private String name; - private String state; - private String avatarUrl; - private String webUrl; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getAvatarUrl() { - return avatarUrl; - } - - public void setAvatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - } - - public String getWebUrl() { - return webUrl; - } - - public void setWebUrl(String webUrl) { - this.webUrl = webUrl; - } - - @Override - public String toString() { - return (JacksonJson.toJsonString(this)); - } +public class ProjectUser extends AbstractUser { } diff --git a/src/main/java/org/gitlab4j/api/models/User.java b/src/main/java/org/gitlab4j/api/models/User.java index ddddee688..a138a445e 100644 --- a/src/main/java/org/gitlab4j/api/models/User.java +++ b/src/main/java/org/gitlab4j/api/models/User.java @@ -1,10 +1,97 @@ package org.gitlab4j.api.models; +import java.util.Date; +import java.util.List; + import org.gitlab4j.api.utils.JacksonJson; public class User extends AbstractUser { + private String bio; + private Boolean canCreateGroup; + private Boolean canCreateProject; + private Integer colorSchemeId; + private Date confirmedAt; + private Date currentSignInAt; + private List customAttributes; + private Boolean external; private String externUid; + private Integer extraSharedRunnersMinutesLimit; + private List identities; + private Boolean isAdmin; + private Date lastActivityOn; + private Date lastSignInAt; + private String linkedin; + private String location; + private String organization; + private Boolean privateProfile; + private Integer projectsLimit; + private String provider; + private String publicEmail; + private Integer sharedRunnersMinutesLimit; + private String skype; + private String state; + private Integer themeId; + private String twitter; + private Boolean twoFactorEnabled; + private String websiteUrl; + private Boolean skipConfirmation; + + public String getBio() { + return bio; + } + + public void setBio(String bio) { + this.bio = bio; + } + + public Boolean getCanCreateGroup() { + return canCreateGroup; + } + + public void setCanCreateGroup(Boolean canCreateGroup) { + this.canCreateGroup = canCreateGroup; + } + + public Boolean getCanCreateProject() { + return canCreateProject; + } + + public void setCanCreateProject(Boolean canCreateProject) { + this.canCreateProject = canCreateProject; + } + + public Integer getColorSchemeId() { + return colorSchemeId; + } + + public void setColorSchemeId(Integer colorSchemeId) { + this.colorSchemeId = colorSchemeId; + } + + public Date getConfirmedAt() { + return confirmedAt; + } + + public void setConfirmedAt(Date confirmedAt) { + this.confirmedAt = confirmedAt; + } + + public Date getCurrentSignInAt() { + return currentSignInAt; + } + + public void setCurrentSignInAt(Date currentSignInAt) { + this.currentSignInAt = currentSignInAt; + } + + public Boolean getExternal() { + return external; + } + + public void setExternal(Boolean external) { + this.external = external; + } public void setExternUid(String externUid) { this.externUid = externUid; @@ -14,8 +101,316 @@ public String getExternUid() { return this.externUid; } + public Integer getExtraSharedRunnersMinutesLimit() { + return extraSharedRunnersMinutesLimit; + } + + public void setExtraSharedRunnersMinutesLimit(Integer extraSharedRunnersMinutesLimit) { + this.extraSharedRunnersMinutesLimit = extraSharedRunnersMinutesLimit; + } + + public List getIdentities() { + return identities; + } + + public void setIdentities(List identities) { + this.identities = identities; + } + + public Boolean getIsAdmin() { + return isAdmin; + } + + public void setIsAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + } + + public Date getLastActivityOn() { + return lastActivityOn; + } + + public void setLastActivityOn(Date lastActivityOn) { + this.lastActivityOn = lastActivityOn; + } + + public Date getLastSignInAt() { + return lastSignInAt; + } + + public void setLastSignInAt(Date lastSignInAt) { + this.lastSignInAt = lastSignInAt; + } + + public String getLinkedin() { + return linkedin; + } + + public void setLinkedin(String linkedin) { + this.linkedin = linkedin; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public Boolean getPrivateProfile() { + return privateProfile; + } + + public void setPrivateProfile(Boolean privateProfile) { + this.privateProfile = privateProfile; + } + + public Integer getProjectsLimit() { + return projectsLimit; + } + + public void setProjectsLimit(Integer projectsLimit) { + this.projectsLimit = projectsLimit; + } + + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public String getPublicEmail() { + return publicEmail; + } + + public void setPublicEmail(String publicEmail) { + this.publicEmail = publicEmail; + } + + public Integer getSharedRunnersMinutesLimit() { + return sharedRunnersMinutesLimit; + } + + public void setSharedRunnersMinutesLimit(Integer sharedRunnersMinutesLimit) { + this.sharedRunnersMinutesLimit = sharedRunnersMinutesLimit; + } + + public String getSkype() { + return skype; + } + + public void setSkype(String skype) { + this.skype = skype; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public Integer getThemeId() { + return themeId; + } + + public void setThemeId(Integer themeId) { + this.themeId = themeId; + } + + public String getTwitter() { + return twitter; + } + + public void setTwitter(String twitter) { + this.twitter = twitter; + } + + public Boolean getTwoFactorEnabled() { + return twoFactorEnabled; + } + + public void setTwoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + } + + public String getWebsiteUrl() { + return websiteUrl; + } + + public void setWebsiteUrl(String websiteUrl) { + this.websiteUrl = websiteUrl; + } + + public Boolean getSkipConfirmation() { + return skipConfirmation; + } + + public void setSkipConfirmation(Boolean skipConfirmation) { + this.skipConfirmation = skipConfirmation; + } + + public List getCustomAttributes() { + return customAttributes; + } + + public void setCustomAttributes(List customAttributes) { + this.customAttributes = customAttributes; + } + + public User withBio(String bio) { + this.bio = bio; + return this; + } + + public User withCanCreateGroup(Boolean canCreateGroup) { + this.canCreateGroup = canCreateGroup; + return this; + } + + public User withCanCreateProject(Boolean canCreateProject) { + this.canCreateProject = canCreateProject; + return this; + } + + public User withColorSchemeId(Integer colorSchemeId) { + this.colorSchemeId = colorSchemeId; + return this; + } + + public User withConfirmedAt(Date confirmedAt) { + this.confirmedAt = confirmedAt; + return this; + } + + public User withCurrentSignInAt(Date currentSignInAt) { + this.currentSignInAt = currentSignInAt; + return this; + } + + public User withExternal(Boolean external) { + this.external = external; + return this; + } + public User withExternUid(String externUid) { - setExternUid(externUid); + this.externUid = externUid; + return this; + } + + public User withExtraSharedRunnersMinutesLimit(Integer extraSharedRunnersMinutesLimit) { + this.extraSharedRunnersMinutesLimit = extraSharedRunnersMinutesLimit; + return this; + } + + public User withIdentities(List identities) { + this.identities = identities; + return this; + } + + public User withIsAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + public User withLastActivityOn(Date lastActivityOn) { + this.lastActivityOn = lastActivityOn; + return this; + } + + public User withLastSignInAt(Date lastSignInAt) { + this.lastSignInAt = lastSignInAt; + return this; + } + + public User withLinkedin(String linkedin) { + this.linkedin = linkedin; + return this; + } + + public User withLocation(String location) { + this.location = location; + return this; + } + + public User withOrganization(String organization) { + this.organization = organization; + return this; + } + + public User withPrivateProfile(Boolean privateProfile) { + this.privateProfile = privateProfile; + return this; + } + + public User withProjectsLimit(Integer projectsLimit) { + this.projectsLimit = projectsLimit; + return this; + } + + public User withProvider(String provider) { + this.provider = provider; + return this; + } + + public User withPublicEmail(String publicEmail) { + this.publicEmail = publicEmail; + return this; + } + + public User withSharedRunnersMinutesLimit(Integer sharedRunnersMinutesLimit) { + this.sharedRunnersMinutesLimit = sharedRunnersMinutesLimit; + return this; + } + + public User withSkype(String skype) { + this.skype = skype; + return this; + } + + public User withState(String state) { + this.state = state; + return this; + } + + public User withThemeId(Integer themeId) { + this.themeId = themeId; + return this; + } + + public User withTwitter(String twitter) { + this.twitter = twitter; + return this; + } + + public User withTwoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + return this; + } + + public User withWebsiteUrl(String websiteUrl) { + this.websiteUrl = websiteUrl; + return this; + } + + public User withSkipConfirmation(Boolean skipConfirmation) { + this.skipConfirmation = skipConfirmation; + return this; + } + + public User withCustomAttributes(List customAttributes) { + this.customAttributes = customAttributes; return this; } diff --git a/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java b/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java index 10416223e..935dfe33f 100644 --- a/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java +++ b/src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java @@ -42,6 +42,7 @@ import org.gitlab4j.api.models.CommitPayload; import org.gitlab4j.api.models.CommitStatus; import org.gitlab4j.api.models.CompareResults; +import org.gitlab4j.api.models.Contributor; import org.gitlab4j.api.models.DeployKey; import org.gitlab4j.api.models.Diff; import org.gitlab4j.api.models.Discussion; @@ -141,6 +142,12 @@ public void testCompareResults() throws Exception { assertTrue(compareJson(compareResults, "compare-results.json")); } + @Test + public void testContributors() throws Exception { + List contributors = unmarshalResourceList(Contributor.class, "contributors.json"); + assertTrue(compareJson(contributors, "contributors.json")); + } + @Test public void testDiff() throws Exception { List diffs = unmarshalResourceList(Diff.class, "diff.json"); @@ -340,9 +347,9 @@ public void testKey() throws Exception { } @Test - public void testMember() throws Exception { - Member member = unmarshalResource(Member.class, "member.json"); - assertTrue(compareJson(member, "member.json")); + public void testMembers() throws Exception { + List members = unmarshalResourceList(Member.class, "members.json"); + assertTrue(compareJson(members, "members.json")); } @Test diff --git a/src/test/java/org/gitlab4j/api/TestGroupApi.java b/src/test/java/org/gitlab4j/api/TestGroupApi.java index 4b6d7076f..186235ede 100644 --- a/src/test/java/org/gitlab4j/api/TestGroupApi.java +++ b/src/test/java/org/gitlab4j/api/TestGroupApi.java @@ -115,6 +115,7 @@ public void testMemberOperations() throws GitLabApiException { Member member = gitLabApi.getGroupApi().addMember(testGroup.getId(), testUser.getId(), AccessLevel.DEVELOPER); assertNotNull(member); assertEquals(testUser.getId(), member.getId()); + assertEquals(AccessLevel.DEVELOPER, member.getAccessLevel()); gitLabApi.getGroupApi().removeMember(testGroup.getId(), testUser.getId()); } diff --git a/src/test/resources/org/gitlab4j/api/contributors.json b/src/test/resources/org/gitlab4j/api/contributors.json new file mode 100644 index 000000000..be75b4ace --- /dev/null +++ b/src/test/resources/org/gitlab4j/api/contributors.json @@ -0,0 +1,13 @@ +[{ + "name": "Dmitriy Zaporozhets", + "email": "dmitriy.zaporozhets@gmail.com", + "commits": 123, + "additions": 3456, + "deletions": 890 +}, { + "name": "Jacob Vosmaer", + "email": "contact@jacobvosmaer.nl", + "commits": 12, + "additions": 345, + "deletions": 67 +}] \ No newline at end of file diff --git a/src/test/resources/org/gitlab4j/api/member.json b/src/test/resources/org/gitlab4j/api/member.json deleted file mode 100644 index d9f0866b3..000000000 --- a/src/test/resources/org/gitlab4j/api/member.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id": 1, - "username": "raymond_smith", - "name": "Raymond Smith", - "state": "active", - "created_at": "2012-10-22T14:13:35Z", - "access_level": 30 -} \ No newline at end of file diff --git a/src/test/resources/org/gitlab4j/api/members.json b/src/test/resources/org/gitlab4j/api/members.json new file mode 100644 index 000000000..d7d640335 --- /dev/null +++ b/src/test/resources/org/gitlab4j/api/members.json @@ -0,0 +1,22 @@ +[ + { + "id": 1, + "username": "raymond_smith", + "name": "Raymond Smith", + "state": "active", + "avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon", + "web_url": "http://192.168.1.8:3000/root", + "expires_at": "2012-10-22T14:13:35Z", + "access_level": 30 + }, + { + "id": 2, + "username": "john_doe", + "name": "John Doe", + "state": "active", + "avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon", + "web_url": "http://192.168.1.8:3000/root", + "expires_at": "2012-10-22T14:13:35Z", + "access_level": 30 + } +] \ No newline at end of file diff --git a/src/test/resources/org/gitlab4j/api/pipeline-schedule.json b/src/test/resources/org/gitlab4j/api/pipeline-schedule.json index cbe18b05b..7073bb4ae 100644 --- a/src/test/resources/org/gitlab4j/api/pipeline-schedule.json +++ b/src/test/resources/org/gitlab4j/api/pipeline-schedule.json @@ -16,6 +16,10 @@ }, "owner": { "name": "Administrator", - "id": 1 + "username": "root", + "id": 1, + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", + "web_url": "https://gitlab.example.com/root" } } \ No newline at end of file diff --git a/src/test/resources/org/gitlab4j/api/user.json b/src/test/resources/org/gitlab4j/api/user.json index d6125b0a3..09f322df9 100644 --- a/src/test/resources/org/gitlab4j/api/user.json +++ b/src/test/resources/org/gitlab4j/api/user.json @@ -8,6 +8,9 @@ "web_url": "http://localhost:3000/john_smith", "created_at": "2012-05-23T08:00:58Z", "is_admin": false, + "bio": "", + "location": "", + "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", @@ -29,5 +32,7 @@ "can_create_project": true, "two_factor_enabled": true, "external": false, - "shared_runners_minutes_limit": 133 + "private_profile": false, + "shared_runners_minutes_limit": 133, + "extra_shared_runners_minutes_limit": 133 } \ No newline at end of file