From c2eb881918dc2163e7a87d8c45e48ce471097302 Mon Sep 17 00:00:00 2001 From: Michal Duda Date: Fri, 29 Nov 2019 12:07:41 +0100 Subject: [PATCH] SONAR-12673 additional ITs --- .../ProjectBranchesService.java | 18 ++-- ...SetAutomaticDeletionProtectionRequest.java | 82 +++++++++++++++++++ 2 files changed, 94 insertions(+), 6 deletions(-) create mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/SetAutomaticDeletionProtectionRequest.java diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java index d1459a48009..7509be1cfc5 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesService.java @@ -19,14 +19,13 @@ */ package org.sonarqube.ws.client.projectbranches; -import java.util.stream.Collectors; import javax.annotation.Generated; import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.ProjectBranches.ListWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsConnector; -import org.sonarqube.ws.ProjectBranches.ListWsResponse; /** * @see Further information about this web service online @@ -50,8 +49,7 @@ public class ProjectBranchesService extends BaseService { new PostRequest(path("delete")) .setParam("branch", request.getBranch()) .setParam("project", request.getProject()) - .setMediaType(MediaTypes.JSON) - ).content(); + .setMediaType(MediaTypes.JSON)).content(); } /** @@ -80,7 +78,15 @@ public class ProjectBranchesService extends BaseService { new PostRequest(path("rename")) .setParam("name", request.getName()) .setParam("project", request.getProject()) - .setMediaType(MediaTypes.JSON) - ).content(); + .setMediaType(MediaTypes.JSON)).content(); + } + + public void setAutomaticDeletionProtection(SetAutomaticDeletionProtectionRequest request) { + call( + new PostRequest(path("set_automatic_deletion_protection")) + .setParam("project", request.getProject()) + .setParam("branch", request.getBranch()) + .setParam("value", request.getValue()) + .setMediaType(MediaTypes.JSON)).content(); } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/SetAutomaticDeletionProtectionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/SetAutomaticDeletionProtectionRequest.java new file mode 100644 index 00000000000..6ca13840fe1 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/SetAutomaticDeletionProtectionRequest.java @@ -0,0 +1,82 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.ws.client.projectbranches; + +import javax.annotation.Generated; + +/** + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 8.1 + */ +@Generated("sonar-ws-generator") +public class SetAutomaticDeletionProtectionRequest { + + private String branch; + private String project; + private String value; + + /** + * This is a mandatory parameter. + * Example value: "feature/my_branch" + */ + public SetAutomaticDeletionProtectionRequest setBranch(String branch) { + this.branch = branch; + return this; + } + + public String getBranch() { + return branch; + } + + /** + * This is a mandatory parameter. + * Example value: "my_project" + */ + public SetAutomaticDeletionProtectionRequest setProject(String project) { + this.project = project; + return this; + } + + public String getProject() { + return project; + } + + /** + * This is a mandatory parameter. + * Example value: "true" + * Possible values: + * + */ + public SetAutomaticDeletionProtectionRequest setValue(String value) { + this.value = value; + return this; + } + + public String getValue() { + return value; + } +} -- 2.39.5