Unverified Commit a611729e authored by Gautier de Saint Martin Lacaze's avatar Gautier de Saint Martin Lacaze Committed by GitHub
Browse files

Merge pull request #710 from...

Merge pull request #710 from hu-tmx/add-project-merge_method-suggestion_commit_message-remove_source_branch_after_merge

Add some missing properties to ProjectApi.updateProject and createProject
parents 419570a3 2d69145e
...@@ -1022,7 +1022,9 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -1022,7 +1022,9 @@ public class ProjectApi extends AbstractApi implements Constants {
.withParam("initialize_with_readme", project.getInitializeWithReadme()) .withParam("initialize_with_readme", project.getInitializeWithReadme())
.withParam("packages_enabled", project.getPackagesEnabled()) .withParam("packages_enabled", project.getPackagesEnabled())
.withParam("build_git_strategy", project.getBuildGitStrategy()) .withParam("build_git_strategy", project.getBuildGitStrategy())
.withParam("build_coverage_regex", project.getBuildCoverageRegex()); .withParam("build_coverage_regex", project.getBuildCoverageRegex())
.withParam("suggestion_commit_message", project.getSuggestionCommitMessage())
.withParam("remove_source_branch_after_merge", project.getRemoveSourceBranchAfterMerge());
Namespace namespace = project.getNamespace(); Namespace namespace = project.getNamespace();
if (namespace != null && namespace.getId() != null) { if (namespace != null && namespace.getId() != null) {
...@@ -1265,7 +1267,10 @@ public class ProjectApi extends AbstractApi implements Constants { ...@@ -1265,7 +1267,10 @@ public class ProjectApi extends AbstractApi implements Constants {
.withParam("resolve_outdated_diff_discussions", project.getResolveOutdatedDiffDiscussions()) .withParam("resolve_outdated_diff_discussions", project.getResolveOutdatedDiffDiscussions())
.withParam("packages_enabled", project.getPackagesEnabled()) .withParam("packages_enabled", project.getPackagesEnabled())
.withParam("build_git_strategy", project.getBuildGitStrategy()) .withParam("build_git_strategy", project.getBuildGitStrategy())
.withParam("build_coverage_regex", project.getBuildCoverageRegex()); .withParam("build_coverage_regex", project.getBuildCoverageRegex())
.withParam("merge_method", project.getMergeMethod())
.withParam("suggestion_commit_message", project.getSuggestionCommitMessage())
.withParam("remove_source_branch_after_merge", project.getRemoveSourceBranchAfterMerge());
if (isApiVersion(ApiVersion.V3)) { if (isApiVersion(ApiVersion.V3)) {
formData.withParam("visibility_level", project.getVisibilityLevel()); formData.withParam("visibility_level", project.getVisibilityLevel());
......
...@@ -104,6 +104,7 @@ public class Project { ...@@ -104,6 +104,7 @@ public class Project {
private AutoDevopsDeployStrategy autoDevopsDeployStrategy; private AutoDevopsDeployStrategy autoDevopsDeployStrategy;
private Boolean autocloseReferencedIssues; private Boolean autocloseReferencedIssues;
private Boolean emailsDisabled; private Boolean emailsDisabled;
private String suggestionCommitMessage;
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class) @JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date markedForDeletionOn; private Date markedForDeletionOn;
...@@ -787,6 +788,11 @@ public class Project { ...@@ -787,6 +788,11 @@ public class Project {
this.removeSourceBranchAfterMerge = removeSourceBranchAfterMerge; this.removeSourceBranchAfterMerge = removeSourceBranchAfterMerge;
} }
public Project withRemoveSourceBranchAfterMerge(Boolean removeSourceBranchAfterMerge) {
this.removeSourceBranchAfterMerge = removeSourceBranchAfterMerge;
return this;
}
public Boolean getAutoDevopsEnabled() { public Boolean getAutoDevopsEnabled() {
return autoDevopsEnabled; return autoDevopsEnabled;
} }
...@@ -823,4 +829,17 @@ public class Project { ...@@ -823,4 +829,17 @@ public class Project {
this.emailsDisabled = emailsDisabled; this.emailsDisabled = emailsDisabled;
return this; return this;
} }
public String getSuggestionCommitMessage() {
return this.suggestionCommitMessage;
}
public Project withSuggestionCommitMessage(String suggestionCommitMessage) {
this.suggestionCommitMessage = suggestionCommitMessage;
return this;
}
public void setSuggestionCommitMessage(String suggestionCommitMessage) {
this.suggestionCommitMessage = suggestionCommitMessage;
}
} }
...@@ -235,7 +235,10 @@ public class TestProjectApi extends AbstractIntegrationTest { ...@@ -235,7 +235,10 @@ public class TestProjectApi extends AbstractIntegrationTest {
.withWikiEnabled(true) .withWikiEnabled(true)
.withSnippetsEnabled(true) .withSnippetsEnabled(true)
.withVisibility(Visibility.PUBLIC) .withVisibility(Visibility.PUBLIC)
.withTagList(Arrays.asList("tag1", "tag2")); .withTagList(Arrays.asList("tag1", "tag2"))
.withMergeMethod(Project.MergeMethod.MERGE)
.withSuggestionCommitMessage("SuggestionCommitMessageOriginal")
.withRemoveSourceBranchAfterMerge(false);
Project newProject = gitLabApi.getProjectApi().createProject(project); Project newProject = gitLabApi.getProjectApi().createProject(project);
assertNotNull(newProject); assertNotNull(newProject);
...@@ -247,6 +250,9 @@ public class TestProjectApi extends AbstractIntegrationTest { ...@@ -247,6 +250,9 @@ public class TestProjectApi extends AbstractIntegrationTest {
assertEquals(project.getSnippetsEnabled(), newProject.getSnippetsEnabled()); assertEquals(project.getSnippetsEnabled(), newProject.getSnippetsEnabled());
assertEquals(project.getTagList(), newProject.getTagList()); assertEquals(project.getTagList(), newProject.getTagList());
assertTrue(Visibility.PUBLIC == newProject.getVisibility() || Boolean.TRUE == newProject.getPublic()); assertTrue(Visibility.PUBLIC == newProject.getVisibility() || Boolean.TRUE == newProject.getPublic());
assertEquals(Project.MergeMethod.MERGE, newProject.getMergeMethod());
assertEquals(project.getSuggestionCommitMessage(), newProject.getSuggestionCommitMessage());
assertEquals(project.getRemoveSourceBranchAfterMerge(), newProject.getRemoveSourceBranchAfterMerge());
project = new Project() project = new Project()
.withId(newProject.getId()) .withId(newProject.getId())
...@@ -256,7 +262,10 @@ public class TestProjectApi extends AbstractIntegrationTest { ...@@ -256,7 +262,10 @@ public class TestProjectApi extends AbstractIntegrationTest {
.withMergeRequestsEnabled(false) .withMergeRequestsEnabled(false)
.withWikiEnabled(false) .withWikiEnabled(false)
.withSnippetsEnabled(false) .withSnippetsEnabled(false)
.withVisibility(Visibility.PRIVATE); .withVisibility(Visibility.PRIVATE)
.withMergeMethod(Project.MergeMethod.REBASE_MERGE)
.withSuggestionCommitMessage("SuggestionCommitMessageUpdated")
.withRemoveSourceBranchAfterMerge(true);
Project updatedProject = gitLabApi.getProjectApi().updateProject(project); Project updatedProject = gitLabApi.getProjectApi().updateProject(project);
assertNotNull(updatedProject); assertNotNull(updatedProject);
...@@ -267,6 +276,9 @@ public class TestProjectApi extends AbstractIntegrationTest { ...@@ -267,6 +276,9 @@ public class TestProjectApi extends AbstractIntegrationTest {
assertEquals(project.getWikiEnabled(), updatedProject.getWikiEnabled()); assertEquals(project.getWikiEnabled(), updatedProject.getWikiEnabled());
assertEquals(project.getSnippetsEnabled(), updatedProject.getSnippetsEnabled()); assertEquals(project.getSnippetsEnabled(), updatedProject.getSnippetsEnabled());
assertTrue(Visibility.PRIVATE == updatedProject.getVisibility() || Boolean.FALSE == updatedProject.getPublic()); assertTrue(Visibility.PRIVATE == updatedProject.getVisibility() || Boolean.FALSE == updatedProject.getPublic());
assertEquals(Project.MergeMethod.REBASE_MERGE, updatedProject.getMergeMethod());
assertEquals(project.getSuggestionCommitMessage(), updatedProject.getSuggestionCommitMessage());
assertEquals(true, updatedProject.getRemoveSourceBranchAfterMerge());
} }
@Test @Test
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment